Class OpenSearchDataSource
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.appsync.BaseDataSource
software.amazon.awscdk.services.appsync.BackedDataSource
software.amazon.awscdk.services.appsync.OpenSearchDataSource
- All Implemented Interfaces:
IGrantable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:32.715Z")
@Stability(Stable)
public class OpenSearchDataSource
extends BackedDataSource
An Appsync datasource backed by OpenSearch.
Example:
import software.amazon.awscdk.services.opensearchservice.*;
GraphqlApi api;
User user = new User(this, "User");
Domain domain = Domain.Builder.create(this, "Domain")
.version(EngineVersion.OPENSEARCH_2_3)
.removalPolicy(RemovalPolicy.DESTROY)
.fineGrainedAccessControl(AdvancedSecurityOptions.builder().masterUserArn(user.getUserArn()).build())
.encryptionAtRest(EncryptionAtRestOptions.builder().enabled(true).build())
.nodeToNodeEncryption(true)
.enforceHttps(true)
.build();
OpenSearchDataSource ds = api.addOpenSearchDataSource("ds", domain);
ds.createResolver("QueryGetTestsResolver", BaseResolverProps.builder()
.typeName("Query")
.fieldName("getTests")
.requestMappingTemplate(MappingTemplate.fromString(JSON.stringify(Map.of(
"version", "2017-02-28",
"operation", "GET",
"path", "/id/post/_search",
"params", Map.of(
"headers", Map.of(),
"queryString", Map.of(),
"body", Map.of("from", 0, "size", 50))))))
.responseMappingTemplate(MappingTemplate.fromString("[\n #foreach($entry in $context.result.hits.hits)\n #if( $velocityCount > 1 ) , #end\n $utils.toJson($entry.get(\"_source\"))\n #end\n ]"))
.build());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IGrantable
IGrantable.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOpenSearchDataSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedOpenSearchDataSource(software.amazon.jsii.JsiiObjectRef objRef) OpenSearchDataSource(software.constructs.Construct scope, String id, OpenSearchDataSourceProps props) -
Method Summary
Methods inherited from class software.amazon.awscdk.services.appsync.BackedDataSource
getGrantPrincipalMethods inherited from class software.amazon.awscdk.services.appsync.BaseDataSource
createFunction, createResolver, getApi, getDs, getName, getServiceRole, setApi, setServiceRoleMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
OpenSearchDataSource
protected OpenSearchDataSource(software.amazon.jsii.JsiiObjectRef objRef) -
OpenSearchDataSource
protected OpenSearchDataSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
OpenSearchDataSource
@Stability(Stable) public OpenSearchDataSource(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull OpenSearchDataSourceProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-