@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-07T23:47:01.088Z") @Stability(value=Experimental) public class OpenSearchDataSource extends BackedDataSource
Example:
import software.amazon.awscdk.core.*;
GraphqlApi api;
User user = new User(this, "User");
Domain domain = Domain.Builder.create(this, "Domain")
.version(EngineVersion.OPENSEARCH_1_2)
.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(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());
| Modifier and Type | Class and Description |
|---|---|
static class |
OpenSearchDataSource.Builder
(experimental) A fluent builder for
OpenSearchDataSource. |
software.amazon.jsii.JsiiObject.InitializationModeIGrantable.Jsii$DefaultIConstruct.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
OpenSearchDataSource(software.constructs.Construct scope,
String id,
OpenSearchDataSourceProps props) |
protected |
OpenSearchDataSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
OpenSearchDataSource(software.amazon.jsii.JsiiObjectRef objRef) |
getGrantPrincipalcreateFunction, createResolver, getApi, getDs, getName, getServiceRole, setApi, setServiceRolegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected OpenSearchDataSource(software.amazon.jsii.JsiiObjectRef objRef)
protected OpenSearchDataSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
public OpenSearchDataSource(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
OpenSearchDataSourceProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.Copyright © 2022. All rights reserved.