awscdkappsyncalpha

package module
v2.59.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 1

README

AWS AppSync Construct Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


The @aws-cdk/aws-appsync package contains constructs for building flexible APIs that use GraphQL.

import appsync "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

Example

DynamoDB

Example of a GraphQL API with AWS_IAM authorization resolving into a DynamoDb backend data source.

GraphQL schema file schema.graphql:

type demo {
  id: String!
  version: String!
}
type Query {
  getDemos: [ demo! ]
}
input DemoInput {
  version: String!
}
type Mutation {
  addDemo(input: DemoInput!): demo
}

CDK stack file app-stack.ts:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})
Aurora Serverless

AppSync provides a data source for executing SQL commands against Amazon Aurora Serverless clusters. You can use AppSync resolvers to execute SQL statements against the Data API with GraphQL queries, mutations, and subscriptions.

// Build a data source for AppSync to access the database.
var api graphqlApi
// Create username and password secret for DB Cluster
secret := rds.NewDatabaseSecret(this, jsii.String("AuroraSecret"), &databaseSecretProps{
	username: jsii.String("clusteradmin"),
})

// The VPC to place the cluster in
vpc := ec2.NewVpc(this, jsii.String("AuroraVpc"))

// Create the serverless cluster, provide all values needed to customise the database.
cluster := rds.NewServerlessCluster(this, jsii.String("AuroraCluster"), &serverlessClusterProps{
	engine: rds.databaseClusterEngine_AURORA_MYSQL(),
	vpc: vpc,
	credentials: map[string]*string{
		"username": jsii.String("clusteradmin"),
	},
	clusterIdentifier: jsii.String("db-endpoint-test"),
	defaultDatabaseName: jsii.String("demos"),
})
rdsDS := api.addRdsDataSource(jsii.String("rds"), cluster, secret, jsii.String("demos"))

// Set up a resolver for an RDS query.
rdsDS.createResolver(jsii.String("QueryGetDemosRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosRds"),
	requestMappingTemplate: appsync.mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"SELECT * FROM demos\"\n    ]\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n  ")),
})

// Set up a resolver for an RDS mutation.
rdsDS.createResolver(jsii.String("MutationAddDemoRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemoRds"),
	requestMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"INSERT INTO demos VALUES (:id, :version)\",\n      \"SELECT * WHERE id = :id\"\n    ],\n    \"variableMap\": {\n      \":id\": $util.toJson($util.autoId()),\n      \":version\": $util.toJson($ctx.args.version)\n    }\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n  ")),
})
HTTP Endpoints

GraphQL schema file schema.graphql:

type job {
  id: String!
  version: String!
}

input DemoInput {
  version: String!
}

type Mutation {
  callStepFunction(input: DemoInput!): job
}

GraphQL request mapping template request.vtl:

{
  "version": "2018-05-29",
  "method": "POST",
  "resourcePath": "/",
  "params": {
    "headers": {
      "content-type": "application/x-amz-json-1.0",
      "x-amz-target":"AWSStepFunctions.StartExecution"
    },
    "body": {
      "stateMachineArn": "<your step functions arn>",
      "input": "{ \"id\": \"$context.arguments.id\" }"
    }
  }
}

GraphQL response mapping template response.vtl:

{
  "id": "${context.result.id}"
}

CDK stack file app-stack.ts:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})
Amazon OpenSearch Service

AppSync has builtin support for Amazon OpenSearch Service (successor to Amazon Elasticsearch Service) from domains that are provisioned through your AWS account. You can use AppSync resolvers to perform GraphQL operations such as queries, mutations, and subscriptions.

import opensearch "github.com/aws/aws-cdk-go/awscdk"

var api graphqlApi


user := iam.NewUser(this, jsii.String("User"))
domain := opensearch.NewDomain(this, jsii.String("Domain"), &domainProps{
	version: opensearch.engineVersion_OPENSEARCH_1_3(),
	removalPolicy: awscdk.RemovalPolicy_DESTROY,
	fineGrainedAccessControl: &advancedSecurityOptions{
		masterUserArn: user.userArn,
	},
	encryptionAtRest: &encryptionAtRestOptions{
		enabled: jsii.Boolean(true),
	},
	nodeToNodeEncryption: jsii.Boolean(true),
	enforceHttps: jsii.Boolean(true),
})
ds := api.addOpenSearchDataSource(jsii.String("ds"), domain)

ds.createResolver(jsii.String("QueryGetTestsResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getTests"),
	requestMappingTemplate: appsync.mappingTemplate.fromString(jSON.stringify(map[string]interface{}{
		"version": jsii.String("2017-02-28"),
		"operation": jsii.String("GET"),
		"path": jsii.String("/id/post/_search"),
		"params": map[string]map[string]interface{}{
			"headers": map[string]interface{}{
			},
			"queryString": map[string]interface{}{
			},
			"body": map[string]*f64{
				"from": jsii.Number(0),
				"size": jsii.Number(50),
			},
		},
	})),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("[\n    #foreach($entry in $context.result.hits.hits)\n    #if( $velocityCount > 1 ) , #end\n    $utils.toJson($entry.get(\"_source\"))\n    #end\n  ]")),
})

Custom Domain Names

For many use cases you may want to associate a custom domain name with your GraphQL API. This can be done during the API creation.

import acm "github.com/aws/aws-cdk-go/awscdk"
import route53 "github.com/aws/aws-cdk-go/awscdk"

// hosted zone and route53 features
var hostedZoneId string
zoneName := "example.com"


myDomainName := "api.example.com"
certificate := acm.NewCertificate(this, jsii.String("cert"), &certificateProps{
	domainName: myDomainName,
})
schema := appsync.NewSchemaFile(&schemaProps{
	filePath: jsii.String("mySchemaFile"),
})
api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("myApi"),
	schema: schema,
	domainName: &domainOptions{
		certificate: certificate,
		domainName: myDomainName,
	},
})

// hosted zone for adding appsync domain
zone := route53.hostedZone.fromHostedZoneAttributes(this, jsii.String("HostedZone"), &hostedZoneAttributes{
	hostedZoneId: jsii.String(hostedZoneId),
	zoneName: jsii.String(zoneName),
})

// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.NewCnameRecord(this, jsii.String("CnameApiRecord"), &cnameRecordProps{
	recordName: jsii.String("api"),
	zone: zone,
	domainName: api.appSyncDomainName,
})

Log Group

AppSync automatically create a log group with the name /aws/appsync/apis/<graphql_api_id> upon deployment with log data set to never expire. If you want to set a different expiration period, use the logConfig.retention property.

To obtain the GraphQL API's log group as a logs.ILogGroup use the logGroup property of the GraphqlApi construct.

import logs "github.com/aws/aws-cdk-go/awscdk"


logConfig := &logConfig{
	retention: logs.retentionDays_ONE_WEEK,
}

appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	authorizationConfig: &authorizationConfig{
	},
	name: jsii.String("myApi"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("myApi.graphql"))),
	logConfig: logConfig,
})

Schema

You can define a schema using from a local file using SchemaFile.fromAsset

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("myApi"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphl"))),
})
ISchema

Alternative schema sources can be defined by implementing the ISchema interface. An example of this is the CodeFirstSchema class provided in awscdk-appsync-utils

Imports

Any GraphQL Api that has been created outside the stack can be imported from another stack into your CDK app. Utilizing the fromXxx function, you have the ability to add data sources and resolvers through a IGraphqlApi interface.

var api graphqlApi
var table table

importedApi := appsync.graphqlApi.fromGraphqlApiAttributes(this, jsii.String("IApi"), &graphqlApiAttributes{
	graphqlApiId: api.apiId,
	graphqlApiArn: api.arn,
})
importedApi.addDynamoDbDataSource(jsii.String("TableDataSource"), table)

If you don't specify graphqlArn in fromXxxAttributes, CDK will autogenerate the expected arn for the imported api, given the apiId. For creating data sources and resolvers, an apiId is sufficient.

Authorization

There are multiple authorization types available for GraphQL API to cater to different access use cases. They are:

  • API Keys (AuthorizationType.API_KEY)
  • Amazon Cognito User Pools (AuthorizationType.USER_POOL)
  • OpenID Connect (AuthorizationType.OPENID_CONNECT)
  • AWS Identity and Access Management (AuthorizationType.AWS_IAM)
  • AWS Lambda (AuthorizationType.AWS_LAMBDA)

These types can be used simultaneously in a single API, allowing different types of clients to access data. When you specify an authorization type, you can also specify the corresponding authorization mode to finish defining your authorization. For example, this is a GraphQL API with AWS Lambda Authorization.

import lambda "github.com/aws/aws-cdk-go/awscdk"
var authFunction function


appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("appsync.test.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_LAMBDA,
			lambdaAuthorizerConfig: &lambdaAuthorizerConfig{
				handler: authFunction,
			},
		},
	},
})

Permissions

When using AWS_IAM as the authorization type for GraphQL API, an IAM Role with correct permissions must be used for access to API.

When configuring permissions, you can specify specific resources to only be accessible by IAM authorization. For example, if you want to only allow mutability for IAM authorized access you would configure the following.

In schema.graphql:

type Mutation {
  updateExample(...): ...
    @aws_iam
}

In IAM:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "appsync:GraphQL"
      ],
      "Resource": [
        "arn:aws:appsync:REGION:ACCOUNT_ID:apis/GRAPHQL_ID/types/Mutation/fields/updateExample"
      ]
    }
  ]
}

See documentation for more details.

To make this easier, CDK provides grant API.

Use the grant function for more granular authorization.

var api graphqlApi
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})

api.grant(role, appsync.iamResource.custom(jsii.String("types/Mutation/fields/updateExample")), jsii.String("appsync:GraphQL"))
IamResource

In order to use the grant functions, you need to use the class IamResource.

  • IamResource.custom(...arns) permits custom ARNs and requires an argument.
  • IamResouce.ofType(type, ...fields) permits ARNs for types and their fields.
  • IamResource.all() permits ALL resources.
Generic Permissions

Alternatively, you can use more generic grant functions to accomplish the same usage.

These include:

  • grantMutation (use to grant access to Mutation fields)
  • grantQuery (use to grant access to Query fields)
  • grantSubscription (use to grant access to Subscription fields)
var api graphqlApi
var role role


// For generic types
api.grantMutation(role, jsii.String("updateExample"))

// For custom types and granular design
api.grant(role, appsync.iamResource.ofType(jsii.String("Mutation"), jsii.String("updateExample")), jsii.String("appsync:GraphQL"))

Pipeline Resolvers and AppSync Functions

AppSync Functions are local functions that perform certain operations onto a backend data source. Developers can compose operations (Functions) and execute them in sequence with Pipeline Resolvers.

var api graphqlApi


appsyncFunction := appsync.NewAppsyncFunction(this, jsii.String("function"), &appsyncFunctionProps{
	name: jsii.String("appsync_function"),
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

AppSync Functions are used in tandem with pipeline resolvers to compose multiple operations.

var api graphqlApi
var appsyncFunction appsyncFunction


pipelineResolver := appsync.NewResolver(this, jsii.String("pipeline"), &resolverProps{
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	typeName: jsii.String("typeName"),
	fieldName: jsii.String("fieldName"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("beforeRequest.vtl")),
	pipelineConfig: []iAppsyncFunction{
		appsyncFunction,
	},
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("afterResponse.vtl")),
})

Learn more about Pipeline Resolvers and AppSync Functions here.

Documentation

Overview

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

The CDK Construct Library for AWS::AppSync

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppsyncFunction_IsConstruct

func AppsyncFunction_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func AppsyncFunction_IsOwnedResource

func AppsyncFunction_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func AppsyncFunction_IsResource

func AppsyncFunction_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func BackedDataSource_IsConstruct

func BackedDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func BaseDataSource_IsConstruct

func BaseDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func DynamoDbDataSource_IsConstruct

func DynamoDbDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func ElasticsearchDataSource_IsConstruct

func ElasticsearchDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: - use `OpenSearchDataSource`.

func GraphqlApiBase_IsConstruct

func GraphqlApiBase_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func GraphqlApiBase_IsOwnedResource

func GraphqlApiBase_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func GraphqlApiBase_IsResource

func GraphqlApiBase_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func GraphqlApi_IsConstruct

func GraphqlApi_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func GraphqlApi_IsOwnedResource

func GraphqlApi_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func GraphqlApi_IsResource

func GraphqlApi_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func HttpDataSource_IsConstruct

func HttpDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func LambdaDataSource_IsConstruct

func LambdaDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func NewAppsyncFunction_Override

func NewAppsyncFunction_Override(a AppsyncFunction, scope constructs.Construct, id *string, props *AppsyncFunctionProps)

Experimental.

func NewAssign_Override

func NewAssign_Override(a Assign, attr *string, arg *string)

Experimental.

func NewAttributeValuesStep_Override

func NewAttributeValuesStep_Override(a AttributeValuesStep, attr *string, container *string, assignments *[]Assign)

Experimental.

func NewAttributeValues_Override

func NewAttributeValues_Override(a AttributeValues, container *string, assignments *[]Assign)

Experimental.

func NewBackedDataSource_Override

func NewBackedDataSource_Override(b BackedDataSource, scope constructs.Construct, id *string, props *BackedDataSourceProps, extended *ExtendedDataSourceProps)

Experimental.

func NewBaseDataSource_Override

func NewBaseDataSource_Override(b BaseDataSource, scope constructs.Construct, id *string, props *BackedDataSourceProps, extended *ExtendedDataSourceProps)

Experimental.

func NewDynamoDbDataSource_Override

func NewDynamoDbDataSource_Override(d DynamoDbDataSource, scope constructs.Construct, id *string, props *DynamoDbDataSourceProps)

Experimental.

func NewElasticsearchDataSource_Override deprecated

func NewElasticsearchDataSource_Override(e ElasticsearchDataSource, scope constructs.Construct, id *string, props *ElasticsearchDataSourceProps)

Deprecated: - use `OpenSearchDataSource`.

func NewGraphqlApiBase_Override

func NewGraphqlApiBase_Override(g GraphqlApiBase, scope constructs.Construct, id *string, props *awscdk.ResourceProps)

Experimental.

func NewGraphqlApi_Override

func NewGraphqlApi_Override(g GraphqlApi, scope constructs.Construct, id *string, props *GraphqlApiProps)

Experimental.

func NewHttpDataSource_Override

func NewHttpDataSource_Override(h HttpDataSource, scope constructs.Construct, id *string, props *HttpDataSourceProps)

Experimental.

func NewLambdaDataSource_Override

func NewLambdaDataSource_Override(l LambdaDataSource, scope constructs.Construct, id *string, props *LambdaDataSourceProps)

Experimental.

func NewMappingTemplate_Override

func NewMappingTemplate_Override(m MappingTemplate)

Experimental.

func NewNoneDataSource_Override

func NewNoneDataSource_Override(n NoneDataSource, scope constructs.Construct, id *string, props *NoneDataSourceProps)

Experimental.

func NewOpenSearchDataSource_Override

func NewOpenSearchDataSource_Override(o OpenSearchDataSource, scope constructs.Construct, id *string, props *OpenSearchDataSourceProps)

Experimental.

func NewPartitionKeyStep_Override

func NewPartitionKeyStep_Override(p PartitionKeyStep, key *string)

Experimental.

func NewPartitionKey_Override

func NewPartitionKey_Override(p PartitionKey, pkey Assign)

Experimental.

func NewPrimaryKey_Override

func NewPrimaryKey_Override(p PrimaryKey, pkey Assign, skey Assign)

Experimental.

func NewRdsDataSource_Override

func NewRdsDataSource_Override(r RdsDataSource, scope constructs.Construct, id *string, props *RdsDataSourceProps)

Experimental.

func NewResolver_Override

func NewResolver_Override(r Resolver, scope constructs.Construct, id *string, props *ResolverProps)

Experimental.

func NewSchemaFile_Override

func NewSchemaFile_Override(s SchemaFile, options *SchemaProps)

Experimental.

func NewSortKeyStep_Override

func NewSortKeyStep_Override(s SortKeyStep, pkey Assign, skey *string)

Experimental.

func NewValues_Override

func NewValues_Override(v Values)

Experimental.

func NoneDataSource_IsConstruct

func NoneDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func OpenSearchDataSource_IsConstruct

func OpenSearchDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func RdsDataSource_IsConstruct

func RdsDataSource_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Resolver_IsConstruct

func Resolver_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

Types

type ApiKeyConfig

type ApiKeyConfig struct {
	// Description of API key.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The time from creation time after which the API key expires.
	//
	// It must be a minimum of 1 day and a maximum of 365 days from date of creation.
	// Rounded down to the nearest hour.
	// Experimental.
	Expires awscdk.Expiration `field:"optional" json:"expires" yaml:"expires"`
	// Unique name of the API Key.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
}

Configuration for API Key authorization in AppSync.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"

var expiration expiration

apiKeyConfig := &apiKeyConfig{
	description: jsii.String("description"),
	expires: expiration,
	name: jsii.String("name"),
}

Experimental.

type AppsyncFunction

type AppsyncFunction interface {
	awscdk.Resource
	IAppsyncFunction
	// the data source of this AppSync Function.
	// Experimental.
	DataSource() BaseDataSource
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// the ARN of the AppSync function.
	// Experimental.
	FunctionArn() *string
	// the ID of the AppSync function.
	// Experimental.
	FunctionId() *string
	// the name of this AppSync Function.
	// Experimental.
	FunctionName() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

AppSync Functions are local functions that perform certain operations onto a backend data source.

Developers can compose operations (Functions) and execute them in sequence with Pipeline Resolvers.

Example:

var api graphqlApi

appsyncFunction := appsync.NewAppsyncFunction(this, jsii.String("function"), &appsyncFunctionProps{
	name: jsii.String("appsync_function"),
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

func NewAppsyncFunction

func NewAppsyncFunction(scope constructs.Construct, id *string, props *AppsyncFunctionProps) AppsyncFunction

Experimental.

type AppsyncFunctionAttributes

type AppsyncFunctionAttributes struct {
	// the ARN of the AppSync function.
	// Experimental.
	FunctionArn *string `field:"required" json:"functionArn" yaml:"functionArn"`
}

The attributes for imported AppSync Functions.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

appsyncFunctionAttributes := &appsyncFunctionAttributes{
	functionArn: jsii.String("functionArn"),
}

Experimental.

type AppsyncFunctionProps

type AppsyncFunctionProps struct {
	// the name of the AppSync Function.
	// Experimental.
	Name *string `field:"required" json:"name" yaml:"name"`
	// the description for this AppSync Function.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// the request mapping template for the AppSync Function.
	// Experimental.
	RequestMappingTemplate MappingTemplate `field:"optional" json:"requestMappingTemplate" yaml:"requestMappingTemplate"`
	// the response mapping template for the AppSync Function.
	// Experimental.
	ResponseMappingTemplate MappingTemplate `field:"optional" json:"responseMappingTemplate" yaml:"responseMappingTemplate"`
	// the GraphQL Api linked to this AppSync Function.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the data source linked to this AppSync Function.
	// Experimental.
	DataSource BaseDataSource `field:"required" json:"dataSource" yaml:"dataSource"`
}

the CDK properties for AppSync Functions.

Example:

var api graphqlApi

appsyncFunction := appsync.NewAppsyncFunction(this, jsii.String("function"), &appsyncFunctionProps{
	name: jsii.String("appsync_function"),
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

type Assign

type Assign interface {
	// Renders the assignment as a map element.
	// Experimental.
	PutInMap(map_ *string) *string
	// Renders the assignment as a VTL string.
	// Experimental.
	RenderAsAssignment() *string
}

Utility class representing the assigment of a value to an attribute.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

assign := appsync_alpha.NewAssign(jsii.String("attr"), jsii.String("arg"))

Experimental.

func NewAssign

func NewAssign(attr *string, arg *string) Assign

Experimental.

type AttributeValues

type AttributeValues interface {
	// Allows assigning a value to the specified attribute.
	// Experimental.
	Attribute(attr *string) AttributeValuesStep
	// Renders the attribute value assingments to a VTL string.
	// Experimental.
	RenderTemplate() *string
	// Renders the variables required for `renderTemplate`.
	// Experimental.
	RenderVariables() *string
}

Specifies the attribute value assignments.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

func NewAttributeValues

func NewAttributeValues(container *string, assignments *[]Assign) AttributeValues

Experimental.

func Values_Projecting

func Values_Projecting(arg *string) AttributeValues

Treats the specified object as a map of assignments, where the property names represent attribute names.

It’s opinionated about how it represents some of the nested objects: e.g., it will use lists (“L”) rather than sets (“SS”, “NS”, “BS”). By default it projects the argument container ("$ctx.args"). Experimental.

type AttributeValuesStep

type AttributeValuesStep interface {
	// Assign the value to the current attribute.
	// Experimental.
	Is(val *string) AttributeValues
}

Utility class to allow assigning a value to an attribute.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var assign assign

attributeValuesStep := appsync_alpha.NewAttributeValuesStep(jsii.String("attr"), jsii.String("container"), []assign{
	assign,
})

Experimental.

func NewAttributeValuesStep

func NewAttributeValuesStep(attr *string, container *string, assignments *[]Assign) AttributeValuesStep

Experimental.

func Values_Attribute

func Values_Attribute(attr *string) AttributeValuesStep

Allows assigning a value to the specified attribute. Experimental.

type AuthorizationConfig

type AuthorizationConfig struct {
	// Additional authorization modes.
	// Experimental.
	AdditionalAuthorizationModes *[]*AuthorizationMode `field:"optional" json:"additionalAuthorizationModes" yaml:"additionalAuthorizationModes"`
	// Optional authorization configuration.
	// Experimental.
	DefaultAuthorization *AuthorizationMode `field:"optional" json:"defaultAuthorization" yaml:"defaultAuthorization"`
}

Configuration of the API authorization modes.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"
var authFunction function

appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("appsync.test.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_LAMBDA,
			lambdaAuthorizerConfig: &lambdaAuthorizerConfig{
				handler: authFunction,
			},
		},
	},
})

Experimental.

type AuthorizationMode

type AuthorizationMode struct {
	// One of possible four values AppSync supports.
	// See: https://docs.aws.amazon.com/appsync/latest/devguide/security.html
	//
	// Experimental.
	AuthorizationType AuthorizationType `field:"required" json:"authorizationType" yaml:"authorizationType"`
	// If authorizationType is `AuthorizationType.API_KEY`, this option can be configured.
	// Experimental.
	ApiKeyConfig *ApiKeyConfig `field:"optional" json:"apiKeyConfig" yaml:"apiKeyConfig"`
	// If authorizationType is `AuthorizationType.LAMBDA`, this option is required.
	// Experimental.
	LambdaAuthorizerConfig *LambdaAuthorizerConfig `field:"optional" json:"lambdaAuthorizerConfig" yaml:"lambdaAuthorizerConfig"`
	// If authorizationType is `AuthorizationType.OIDC`, this option is required.
	// Experimental.
	OpenIdConnectConfig *OpenIdConnectConfig `field:"optional" json:"openIdConnectConfig" yaml:"openIdConnectConfig"`
	// If authorizationType is `AuthorizationType.USER_POOL`, this option is required.
	// Experimental.
	UserPoolConfig *UserPoolConfig `field:"optional" json:"userPoolConfig" yaml:"userPoolConfig"`
}

Interface to specify default or additional authorization(s).

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

type AuthorizationType

type AuthorizationType string

enum with all possible values for AppSync authorization type.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

const (
	// API Key authorization type.
	// Experimental.
	AuthorizationType_API_KEY AuthorizationType = "API_KEY"
	// AWS IAM authorization type.
	//
	// Can be used with Cognito Identity Pool federated credentials.
	// Experimental.
	AuthorizationType_IAM AuthorizationType = "IAM"
	// Cognito User Pool authorization type.
	// Experimental.
	AuthorizationType_USER_POOL AuthorizationType = "USER_POOL"
	// OpenID Connect authorization type.
	// Experimental.
	AuthorizationType_OIDC AuthorizationType = "OIDC"
	// Lambda authorization type.
	// Experimental.
	AuthorizationType_LAMBDA AuthorizationType = "LAMBDA"
)

type AwsIamConfig

type AwsIamConfig struct {
	// The signing region for AWS IAM authorization.
	// Experimental.
	SigningRegion *string `field:"required" json:"signingRegion" yaml:"signingRegion"`
	// The signing service name for AWS IAM authorization.
	// Experimental.
	SigningServiceName *string `field:"required" json:"signingServiceName" yaml:"signingServiceName"`
}

The authorization config in case the HTTP endpoint requires authorization.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

type BackedDataSource

type BackedDataSource interface {
	BaseDataSource
	awsiam.IGrantable
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Abstract AppSync datasource implementation.

Do not use directly but use subclasses for resource backed datasources. Experimental.

type BackedDataSourceProps

type BackedDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Experimental.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
}

properties for an AppSync datasource backed by a resource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var graphqlApi graphqlApi
var role role

backedDataSourceProps := &backedDataSourceProps{
	api: graphqlApi,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
}

Experimental.

type BaseAppsyncFunctionProps

type BaseAppsyncFunctionProps struct {
	// the name of the AppSync Function.
	// Experimental.
	Name *string `field:"required" json:"name" yaml:"name"`
	// the description for this AppSync Function.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// the request mapping template for the AppSync Function.
	// Experimental.
	RequestMappingTemplate MappingTemplate `field:"optional" json:"requestMappingTemplate" yaml:"requestMappingTemplate"`
	// the response mapping template for the AppSync Function.
	// Experimental.
	ResponseMappingTemplate MappingTemplate `field:"optional" json:"responseMappingTemplate" yaml:"responseMappingTemplate"`
}

the base properties for AppSync Functions.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var mappingTemplate mappingTemplate

baseAppsyncFunctionProps := &baseAppsyncFunctionProps{
	name: jsii.String("name"),

	// the properties below are optional
	description: jsii.String("description"),
	requestMappingTemplate: mappingTemplate,
	responseMappingTemplate: mappingTemplate,
}

Experimental.

type BaseDataSource

type BaseDataSource interface {
	constructs.Construct
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Abstract AppSync datasource implementation.

Do not use directly but use subclasses for concrete datasources.

Example:

var api graphqlApi

appsyncFunction := appsync.NewAppsyncFunction(this, jsii.String("function"), &appsyncFunctionProps{
	name: jsii.String("appsync_function"),
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

type BaseDataSourceProps

type BaseDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
}

Base properties for an AppSync datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var graphqlApi graphqlApi

baseDataSourceProps := &baseDataSourceProps{
	api: graphqlApi,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
}

Experimental.

type BaseResolverProps

type BaseResolverProps struct {
	// name of the GraphQL field in the given type this resolver is attached to.
	// Experimental.
	FieldName *string `field:"required" json:"fieldName" yaml:"fieldName"`
	// name of the GraphQL type this resolver is attached to.
	// Experimental.
	TypeName *string `field:"required" json:"typeName" yaml:"typeName"`
	// The caching configuration for this resolver.
	// Experimental.
	CachingConfig *CachingConfig `field:"optional" json:"cachingConfig" yaml:"cachingConfig"`
	// The maximum number of elements per batch, when using batch invoke.
	// Experimental.
	MaxBatchSize *float64 `field:"optional" json:"maxBatchSize" yaml:"maxBatchSize"`
	// configuration of the pipeline resolver.
	// Experimental.
	PipelineConfig *[]IAppsyncFunction `field:"optional" json:"pipelineConfig" yaml:"pipelineConfig"`
	// The request mapping template for this resolver.
	// Experimental.
	RequestMappingTemplate MappingTemplate `field:"optional" json:"requestMappingTemplate" yaml:"requestMappingTemplate"`
	// The response mapping template for this resolver.
	// Experimental.
	ResponseMappingTemplate MappingTemplate `field:"optional" json:"responseMappingTemplate" yaml:"responseMappingTemplate"`
}

Basic properties for an AppSync resolver.

Example:

// Build a data source for AppSync to access the database.
var api graphqlApi
// Create username and password secret for DB Cluster
secret := rds.NewDatabaseSecret(this, jsii.String("AuroraSecret"), &databaseSecretProps{
	username: jsii.String("clusteradmin"),
})

// The VPC to place the cluster in
vpc := ec2.NewVpc(this, jsii.String("AuroraVpc"))

// Create the serverless cluster, provide all values needed to customise the database.
cluster := rds.NewServerlessCluster(this, jsii.String("AuroraCluster"), &serverlessClusterProps{
	engine: rds.databaseClusterEngine_AURORA_MYSQL(),
	vpc: vpc,
	credentials: map[string]*string{
		"username": jsii.String("clusteradmin"),
	},
	clusterIdentifier: jsii.String("db-endpoint-test"),
	defaultDatabaseName: jsii.String("demos"),
})
rdsDS := api.addRdsDataSource(jsii.String("rds"), cluster, secret, jsii.String("demos"))

// Set up a resolver for an RDS query.
rdsDS.createResolver(jsii.String("QueryGetDemosRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosRds"),
	requestMappingTemplate: appsync.mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"SELECT * FROM demos\"\n    ]\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n  ")),
})

// Set up a resolver for an RDS mutation.
rdsDS.createResolver(jsii.String("MutationAddDemoRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemoRds"),
	requestMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"INSERT INTO demos VALUES (:id, :version)\",\n      \"SELECT * WHERE id = :id\"\n    ],\n    \"variableMap\": {\n      \":id\": $util.toJson($util.autoId()),\n      \":version\": $util.toJson($ctx.args.version)\n    }\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n  ")),
})

Experimental.

type CachingConfig

type CachingConfig struct {
	// The TTL in seconds for a resolver that has caching enabled.
	//
	// Valid values are between 1 and 3600 seconds.
	// Experimental.
	Ttl awscdk.Duration `field:"required" json:"ttl" yaml:"ttl"`
	// The caching keys for a resolver that has caching enabled.
	//
	// Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.
	// Experimental.
	CachingKeys *[]*string `field:"optional" json:"cachingKeys" yaml:"cachingKeys"`
}

CachingConfig for AppSync resolvers.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"

cachingConfig := &cachingConfig{
	ttl: cdk.duration.minutes(jsii.Number(30)),

	// the properties below are optional
	cachingKeys: []*string{
		jsii.String("cachingKeys"),
	},
}

Experimental.

type DataSourceOptions

type DataSourceOptions struct {
	// The description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source, overrides the id given by cdk.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
}

Optional configuration for data sources.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

dataSourceOptions := &dataSourceOptions{
	description: jsii.String("description"),
	name: jsii.String("name"),
}

Experimental.

type DomainOptions

type DomainOptions struct {
	// The certificate to use with the domain name.
	// Experimental.
	Certificate awscertificatemanager.ICertificate `field:"required" json:"certificate" yaml:"certificate"`
	// The actual domain name.
	//
	// For example, `api.example.com`.
	// Experimental.
	DomainName *string `field:"required" json:"domainName" yaml:"domainName"`
}

Domain name configuration for AppSync.

Example:

import acm "github.com/aws/aws-cdk-go/awscdk"
import route53 "github.com/aws/aws-cdk-go/awscdk"

// hosted zone and route53 features
var hostedZoneId string
zoneName := "example.com"

myDomainName := "api.example.com"
certificate := acm.NewCertificate(this, jsii.String("cert"), &certificateProps{
	domainName: myDomainName,
})
schema := appsync.NewSchemaFile(&schemaProps{
	filePath: jsii.String("mySchemaFile"),
})
api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("myApi"),
	schema: schema,
	domainName: &domainOptions{
		certificate: certificate,
		domainName: myDomainName,
	},
})

// hosted zone for adding appsync domain
zone := route53.hostedZone.fromHostedZoneAttributes(this, jsii.String("HostedZone"), &hostedZoneAttributes{
	hostedZoneId: jsii.String(hostedZoneId),
	zoneName: jsii.String(zoneName),
})

// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.NewCnameRecord(this, jsii.String("CnameApiRecord"), &cnameRecordProps{
	recordName: jsii.String("api"),
	zone: zone,
	domainName: api.appSyncDomainName,
})

Experimental.

type DynamoDbDataSource

type DynamoDbDataSource interface {
	BackedDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync datasource backed by a DynamoDB table.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

func NewDynamoDbDataSource

func NewDynamoDbDataSource(scope constructs.Construct, id *string, props *DynamoDbDataSourceProps) DynamoDbDataSource

Experimental.

type DynamoDbDataSourceProps

type DynamoDbDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Experimental.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
	// The DynamoDB table backing this data source.
	// Experimental.
	Table awsdynamodb.ITable `field:"required" json:"table" yaml:"table"`
	// Specify whether this DS is read only or has read and write permissions to the DynamoDB table.
	// Experimental.
	ReadOnlyAccess *bool `field:"optional" json:"readOnlyAccess" yaml:"readOnlyAccess"`
	// use credentials of caller to access DynamoDB.
	// Experimental.
	UseCallerCredentials *bool `field:"optional" json:"useCallerCredentials" yaml:"useCallerCredentials"`
}

Properties for an AppSync DynamoDB datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var graphqlApi graphqlApi
var role role
var table table

dynamoDbDataSourceProps := &dynamoDbDataSourceProps{
	api: graphqlApi,
	table: table,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	readOnlyAccess: jsii.Boolean(false),
	serviceRole: role,
	useCallerCredentials: jsii.Boolean(false),
}

Experimental.

type ElasticsearchDataSource deprecated

type ElasticsearchDataSource interface {
	BackedDataSource
	// Deprecated: - use `OpenSearchDataSource`.
	Api() IGraphqlApi
	// Deprecated: - use `OpenSearchDataSource`.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Deprecated: - use `OpenSearchDataSource`.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Deprecated: - use `OpenSearchDataSource`.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Deprecated: - use `OpenSearchDataSource`.
	Name() *string
	// The tree node.
	// Deprecated: - use `OpenSearchDataSource`.
	Node() constructs.Node
	// Deprecated: - use `OpenSearchDataSource`.
	ServiceRole() awsiam.IRole
	// Deprecated: - use `OpenSearchDataSource`.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Deprecated: - use `OpenSearchDataSource`.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Deprecated: - use `OpenSearchDataSource`.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Deprecated: - use `OpenSearchDataSource`.
	ToString() *string
}

An Appsync datasource backed by Elasticsearch.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var domain domain
var graphqlApi graphqlApi
var role role

elasticsearchDataSource := appsync_alpha.NewElasticsearchDataSource(this, jsii.String("MyElasticsearchDataSource"), &elasticsearchDataSourceProps{
	api: graphqlApi,
	domain: domain,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
})

Deprecated: - use `OpenSearchDataSource`.

func NewElasticsearchDataSource deprecated

func NewElasticsearchDataSource(scope constructs.Construct, id *string, props *ElasticsearchDataSourceProps) ElasticsearchDataSource

Deprecated: - use `OpenSearchDataSource`.

type ElasticsearchDataSourceProps deprecated

type ElasticsearchDataSourceProps struct {
	// The API to attach this data source to.
	// Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
	// The elasticsearch domain containing the endpoint for the data source.
	// Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.
	Domain awselasticsearch.IDomain `field:"required" json:"domain" yaml:"domain"`
}

Properties for the Elasticsearch Data Source.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var domain domain
var graphqlApi graphqlApi
var role role

elasticsearchDataSourceProps := &elasticsearchDataSourceProps{
	api: graphqlApi,
	domain: domain,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
}

Deprecated: - use `OpenSearchDataSourceProps` with `OpenSearchDataSource`.

type ExtendedDataSourceProps

type ExtendedDataSourceProps struct {
	// the type of the AppSync datasource.
	// Experimental.
	Type *string `field:"required" json:"type" yaml:"type"`
	// configuration for DynamoDB Datasource.
	// Experimental.
	DynamoDbConfig interface{} `field:"optional" json:"dynamoDbConfig" yaml:"dynamoDbConfig"`
	// configuration for Elasticsearch data source.
	// Deprecated: - use `openSearchConfig`.
	ElasticsearchConfig interface{} `field:"optional" json:"elasticsearchConfig" yaml:"elasticsearchConfig"`
	// configuration for HTTP Datasource.
	// Experimental.
	HttpConfig interface{} `field:"optional" json:"httpConfig" yaml:"httpConfig"`
	// configuration for Lambda Datasource.
	// Experimental.
	LambdaConfig interface{} `field:"optional" json:"lambdaConfig" yaml:"lambdaConfig"`
	// configuration for OpenSearch data source.
	// Experimental.
	OpenSearchServiceConfig interface{} `field:"optional" json:"openSearchServiceConfig" yaml:"openSearchServiceConfig"`
	// configuration for RDS Datasource.
	// Experimental.
	RelationalDatabaseConfig interface{} `field:"optional" json:"relationalDatabaseConfig" yaml:"relationalDatabaseConfig"`
}

props used by implementations of BaseDataSource to provide configuration.

Should not be used directly.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

extendedDataSourceProps := &extendedDataSourceProps{
	type: jsii.String("type"),

	// the properties below are optional
	dynamoDbConfig: &dynamoDBConfigProperty{
		awsRegion: jsii.String("awsRegion"),
		tableName: jsii.String("tableName"),

		// the properties below are optional
		deltaSyncConfig: &deltaSyncConfigProperty{
			baseTableTtl: jsii.String("baseTableTtl"),
			deltaSyncTableName: jsii.String("deltaSyncTableName"),
			deltaSyncTableTtl: jsii.String("deltaSyncTableTtl"),
		},
		useCallerCredentials: jsii.Boolean(false),
		versioned: jsii.Boolean(false),
	},
	elasticsearchConfig: &elasticsearchConfigProperty{
		awsRegion: jsii.String("awsRegion"),
		endpoint: jsii.String("endpoint"),
	},
	httpConfig: &httpConfigProperty{
		endpoint: jsii.String("endpoint"),

		// the properties below are optional
		authorizationConfig: &authorizationConfigProperty{
			authorizationType: jsii.String("authorizationType"),

			// the properties below are optional
			awsIamConfig: &awsIamConfigProperty{
				signingRegion: jsii.String("signingRegion"),
				signingServiceName: jsii.String("signingServiceName"),
			},
		},
	},
	lambdaConfig: &lambdaConfigProperty{
		lambdaFunctionArn: jsii.String("lambdaFunctionArn"),
	},
	openSearchServiceConfig: &openSearchServiceConfigProperty{
		awsRegion: jsii.String("awsRegion"),
		endpoint: jsii.String("endpoint"),
	},
	relationalDatabaseConfig: &relationalDatabaseConfigProperty{
		relationalDatabaseSourceType: jsii.String("relationalDatabaseSourceType"),

		// the properties below are optional
		rdsHttpEndpointConfig: &rdsHttpEndpointConfigProperty{
			awsRegion: jsii.String("awsRegion"),
			awsSecretStoreArn: jsii.String("awsSecretStoreArn"),
			dbClusterIdentifier: jsii.String("dbClusterIdentifier"),

			// the properties below are optional
			databaseName: jsii.String("databaseName"),
			schema: jsii.String("schema"),
		},
	},
}

Experimental.

type ExtendedResolverProps

type ExtendedResolverProps struct {
	// name of the GraphQL field in the given type this resolver is attached to.
	// Experimental.
	FieldName *string `field:"required" json:"fieldName" yaml:"fieldName"`
	// name of the GraphQL type this resolver is attached to.
	// Experimental.
	TypeName *string `field:"required" json:"typeName" yaml:"typeName"`
	// The caching configuration for this resolver.
	// Experimental.
	CachingConfig *CachingConfig `field:"optional" json:"cachingConfig" yaml:"cachingConfig"`
	// The maximum number of elements per batch, when using batch invoke.
	// Experimental.
	MaxBatchSize *float64 `field:"optional" json:"maxBatchSize" yaml:"maxBatchSize"`
	// configuration of the pipeline resolver.
	// Experimental.
	PipelineConfig *[]IAppsyncFunction `field:"optional" json:"pipelineConfig" yaml:"pipelineConfig"`
	// The request mapping template for this resolver.
	// Experimental.
	RequestMappingTemplate MappingTemplate `field:"optional" json:"requestMappingTemplate" yaml:"requestMappingTemplate"`
	// The response mapping template for this resolver.
	// Experimental.
	ResponseMappingTemplate MappingTemplate `field:"optional" json:"responseMappingTemplate" yaml:"responseMappingTemplate"`
	// The data source this resolver is using.
	// Experimental.
	DataSource BaseDataSource `field:"optional" json:"dataSource" yaml:"dataSource"`
}

Additional property for an AppSync resolver for data source reference.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"

var appsyncFunction appsyncFunction
var baseDataSource baseDataSource
var mappingTemplate mappingTemplate

extendedResolverProps := &extendedResolverProps{
	fieldName: jsii.String("fieldName"),
	typeName: jsii.String("typeName"),

	// the properties below are optional
	cachingConfig: &cachingConfig{
		ttl: cdk.duration.minutes(jsii.Number(30)),

		// the properties below are optional
		cachingKeys: []*string{
			jsii.String("cachingKeys"),
		},
	},
	dataSource: baseDataSource,
	maxBatchSize: jsii.Number(123),
	pipelineConfig: []iAppsyncFunction{
		appsyncFunction,
	},
	requestMappingTemplate: mappingTemplate,
	responseMappingTemplate: mappingTemplate,
}

Experimental.

type FieldLogLevel

type FieldLogLevel string

log-level for fields in AppSync. Experimental.

const (
	// No logging.
	// Experimental.
	FieldLogLevel_NONE FieldLogLevel = "NONE"
	// Error logging.
	// Experimental.
	FieldLogLevel_ERROR FieldLogLevel = "ERROR"
	// All logging.
	// Experimental.
	FieldLogLevel_ALL FieldLogLevel = "ALL"
)

type GraphqlApi

type GraphqlApi interface {
	GraphqlApiBase
	// an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
	// Experimental.
	ApiId() *string
	// the configured API key, if present.
	// Experimental.
	ApiKey() *string
	// The AppSyncDomainName of the associated custom domain.
	// Experimental.
	AppSyncDomainName() *string
	// the ARN of the API.
	// Experimental.
	Arn() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// the URL of the endpoint created by AppSync.
	// Experimental.
	GraphqlUrl() *string
	// the CloudWatch Log Group for this API.
	// Experimental.
	LogGroup() awslogs.ILogGroup
	// The Authorization Types for this GraphQL Api.
	// Experimental.
	Modes() *[]AuthorizationType
	// the name of the API.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// the schema attached to this api.
	// Experimental.
	Schema() ISchema
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// add a new DynamoDB data source to this API.
	// Experimental.
	AddDynamoDbDataSource(id *string, table awsdynamodb.ITable, options *DataSourceOptions) DynamoDbDataSource
	// add a new elasticsearch data source to this API.
	// Deprecated: - use `addOpenSearchDataSource`.
	AddElasticsearchDataSource(id *string, domain awselasticsearch.IDomain, options *DataSourceOptions) ElasticsearchDataSource
	// add a new http data source to this API.
	// Experimental.
	AddHttpDataSource(id *string, endpoint *string, options *HttpDataSourceOptions) HttpDataSource
	// add a new Lambda data source to this API.
	// Experimental.
	AddLambdaDataSource(id *string, lambdaFunction awslambda.IFunction, options *DataSourceOptions) LambdaDataSource
	// add a new dummy data source to this API.
	//
	// Useful for pipeline resolvers
	// and for backend changes that don't require a data source.
	// Experimental.
	AddNoneDataSource(id *string, options *DataSourceOptions) NoneDataSource
	// add a new OpenSearch data source to this API.
	// Experimental.
	AddOpenSearchDataSource(id *string, domain awsopensearchservice.IDomain, options *DataSourceOptions) OpenSearchDataSource
	// add a new Rds data source to this API.
	// Experimental.
	AddRdsDataSource(id *string, serverlessCluster awsrds.IServerlessCluster, secretStore awssecretsmanager.ISecret, databaseName *string, options *DataSourceOptions) RdsDataSource
	// Add schema dependency to a given construct.
	// Experimental.
	AddSchemaDependency(construct awscdk.CfnResource) *bool
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *ExtendedResolverProps) Resolver
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Adds an IAM policy statement associated with this GraphQLApi to an IAM principal's policy.
	// Experimental.
	Grant(grantee awsiam.IGrantable, resources IamResource, actions ...*string) awsiam.Grant
	// Adds an IAM policy statement for Mutation access to this GraphQLApi to an IAM principal's policy.
	// Experimental.
	GrantMutation(grantee awsiam.IGrantable, fields ...*string) awsiam.Grant
	// Adds an IAM policy statement for Query access to this GraphQLApi to an IAM principal's policy.
	// Experimental.
	GrantQuery(grantee awsiam.IGrantable, fields ...*string) awsiam.Grant
	// Adds an IAM policy statement for Subscription access to this GraphQLApi to an IAM principal's policy.
	// Experimental.
	GrantSubscription(grantee awsiam.IGrantable, fields ...*string) awsiam.Grant
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync GraphQL API.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

func NewGraphqlApi

func NewGraphqlApi(scope constructs.Construct, id *string, props *GraphqlApiProps) GraphqlApi

Experimental.

type GraphqlApiAttributes

type GraphqlApiAttributes struct {
	// an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
	// Experimental.
	GraphqlApiId *string `field:"required" json:"graphqlApiId" yaml:"graphqlApiId"`
	// the arn for the GraphQL Api.
	// Experimental.
	GraphqlApiArn *string `field:"optional" json:"graphqlApiArn" yaml:"graphqlApiArn"`
}

Attributes for GraphQL imports.

Example:

var api graphqlApi
var table table

importedApi := appsync.graphqlApi.fromGraphqlApiAttributes(this, jsii.String("IApi"), &graphqlApiAttributes{
	graphqlApiId: api.apiId,
	graphqlApiArn: api.arn,
})
importedApi.addDynamoDbDataSource(jsii.String("TableDataSource"), table)

Experimental.

type GraphqlApiBase

type GraphqlApiBase interface {
	awscdk.Resource
	IGraphqlApi
	// an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
	// Experimental.
	ApiId() *string
	// the ARN of the API.
	// Experimental.
	Arn() *string
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// add a new DynamoDB data source to this API.
	// Experimental.
	AddDynamoDbDataSource(id *string, table awsdynamodb.ITable, options *DataSourceOptions) DynamoDbDataSource
	// add a new elasticsearch data source to this API.
	// Deprecated: - use `addOpenSearchDataSource`.
	AddElasticsearchDataSource(id *string, domain awselasticsearch.IDomain, options *DataSourceOptions) ElasticsearchDataSource
	// add a new http data source to this API.
	// Experimental.
	AddHttpDataSource(id *string, endpoint *string, options *HttpDataSourceOptions) HttpDataSource
	// add a new Lambda data source to this API.
	// Experimental.
	AddLambdaDataSource(id *string, lambdaFunction awslambda.IFunction, options *DataSourceOptions) LambdaDataSource
	// add a new dummy data source to this API.
	//
	// Useful for pipeline resolvers
	// and for backend changes that don't require a data source.
	// Experimental.
	AddNoneDataSource(id *string, options *DataSourceOptions) NoneDataSource
	// add a new OpenSearch data source to this API.
	// Experimental.
	AddOpenSearchDataSource(id *string, domain awsopensearchservice.IDomain, options *DataSourceOptions) OpenSearchDataSource
	// add a new Rds data source to this API.
	// Experimental.
	AddRdsDataSource(id *string, serverlessCluster awsrds.IServerlessCluster, secretStore awssecretsmanager.ISecret, databaseName *string, options *DataSourceOptions) RdsDataSource
	// Add schema dependency if not imported.
	// Experimental.
	AddSchemaDependency(construct awscdk.CfnResource) *bool
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *ExtendedResolverProps) Resolver
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Base Class for GraphQL API. Experimental.

type GraphqlApiProps

type GraphqlApiProps struct {
	// the name of the GraphQL API.
	// Experimental.
	Name *string `field:"required" json:"name" yaml:"name"`
	// GraphQL schema definition. Specify how you want to define your schema.
	//
	// Schema.fromFile(filePath: string) allows schema definition through schema.graphql file
	// Experimental.
	Schema ISchema `field:"required" json:"schema" yaml:"schema"`
	// Optional authorization configuration.
	// Experimental.
	AuthorizationConfig *AuthorizationConfig `field:"optional" json:"authorizationConfig" yaml:"authorizationConfig"`
	// The domain name configuration for the GraphQL API.
	//
	// The Route 53 hosted zone and CName DNS record must be configured in addition to this setting to
	// enable custom domain URL.
	// Experimental.
	DomainName *DomainOptions `field:"optional" json:"domainName" yaml:"domainName"`
	// Logging configuration for this api.
	// Experimental.
	LogConfig *LogConfig `field:"optional" json:"logConfig" yaml:"logConfig"`
	// A flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.
	// Experimental.
	XrayEnabled *bool `field:"optional" json:"xrayEnabled" yaml:"xrayEnabled"`
}

Properties for an AppSync GraphQL API.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

type HttpDataSource

type HttpDataSource interface {
	BackedDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync datasource backed by a http endpoint.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

func NewHttpDataSource

func NewHttpDataSource(scope constructs.Construct, id *string, props *HttpDataSourceProps) HttpDataSource

Experimental.

type HttpDataSourceOptions

type HttpDataSourceOptions struct {
	// The description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source, overrides the id given by cdk.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The authorization config in case the HTTP endpoint requires authorization.
	// Experimental.
	AuthorizationConfig *AwsIamConfig `field:"optional" json:"authorizationConfig" yaml:"authorizationConfig"`
}

Optional configuration for Http data sources.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

type HttpDataSourceProps

type HttpDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The http endpoint.
	// Experimental.
	Endpoint *string `field:"required" json:"endpoint" yaml:"endpoint"`
	// The authorization config in case the HTTP endpoint requires authorization.
	// Experimental.
	AuthorizationConfig *AwsIamConfig `field:"optional" json:"authorizationConfig" yaml:"authorizationConfig"`
}

Properties for an AppSync http datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var graphqlApi graphqlApi

httpDataSourceProps := &httpDataSourceProps{
	api: graphqlApi,
	endpoint: jsii.String("endpoint"),

	// the properties below are optional
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("signingRegion"),
		signingServiceName: jsii.String("signingServiceName"),
	},
	description: jsii.String("description"),
	name: jsii.String("name"),
}

Experimental.

type IAppsyncFunction

type IAppsyncFunction interface {
	awscdk.IResource
	// the ARN of the AppSync function.
	// Experimental.
	FunctionArn() *string
	// the name of this AppSync Function.
	// Experimental.
	FunctionId() *string
}

Interface for AppSync Functions. Experimental.

func AppsyncFunction_FromAppsyncFunctionAttributes

func AppsyncFunction_FromAppsyncFunctionAttributes(scope constructs.Construct, id *string, attrs *AppsyncFunctionAttributes) IAppsyncFunction

Import Appsync Function from arn. Experimental.

type IGraphqlApi

type IGraphqlApi interface {
	awscdk.IResource
	// add a new DynamoDB data source to this API.
	// Experimental.
	AddDynamoDbDataSource(id *string, table awsdynamodb.ITable, options *DataSourceOptions) DynamoDbDataSource
	// add a new elasticsearch data source to this API.
	// Deprecated: - use `addOpenSearchDataSource`.
	AddElasticsearchDataSource(id *string, domain awselasticsearch.IDomain, options *DataSourceOptions) ElasticsearchDataSource
	// add a new http data source to this API.
	// Experimental.
	AddHttpDataSource(id *string, endpoint *string, options *HttpDataSourceOptions) HttpDataSource
	// add a new Lambda data source to this API.
	// Experimental.
	AddLambdaDataSource(id *string, lambdaFunction awslambda.IFunction, options *DataSourceOptions) LambdaDataSource
	// add a new dummy data source to this API.
	//
	// Useful for pipeline resolvers
	// and for backend changes that don't require a data source.
	// Experimental.
	AddNoneDataSource(id *string, options *DataSourceOptions) NoneDataSource
	// Add a new OpenSearch data source to this API.
	// Experimental.
	AddOpenSearchDataSource(id *string, domain awsopensearchservice.IDomain, options *DataSourceOptions) OpenSearchDataSource
	// add a new Rds data source to this API.
	// Experimental.
	AddRdsDataSource(id *string, serverlessCluster awsrds.IServerlessCluster, secretStore awssecretsmanager.ISecret, databaseName *string, options *DataSourceOptions) RdsDataSource
	// Add schema dependency if not imported.
	// Experimental.
	AddSchemaDependency(construct awscdk.CfnResource) *bool
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *ExtendedResolverProps) Resolver
	// an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
	// Experimental.
	ApiId() *string
	// the ARN of the API.
	// Experimental.
	Arn() *string
}

Interface for GraphQL. Experimental.

func GraphqlApi_FromGraphqlApiAttributes

func GraphqlApi_FromGraphqlApiAttributes(scope constructs.Construct, id *string, attrs *GraphqlApiAttributes) IGraphqlApi

Import a GraphQL API through this function. Experimental.

type ISchema

type ISchema interface {
	// Binds a schema string to a GraphQlApi.
	//
	// Returns: ISchemaConfig with apiId and schema definition string.
	// Experimental.
	Bind(api IGraphqlApi, options *SchemaBindOptions) ISchemaConfig
}

Interface for implementing your own schema.

Useful for providing schema's from sources other than assets. Experimental.

type ISchemaConfig

type ISchemaConfig interface {
	// The ID of the api the schema is bound to.
	// Experimental.
	ApiId() *string
	// Experimental.
	SetApiId(a *string)
	// The schema definition string.
	// Experimental.
	Definition() *string
	// Experimental.
	SetDefinition(d *string)
}

Configuration for bound graphql schema.

Returned from ISchema.bind allowing late binding of schemas to graphqlapi-base Experimental.

type IamResource

type IamResource interface {
	// Return the Resource ARN.
	// Experimental.
	ResourceArns(api GraphqlApi) *[]*string
}

A class used to generate resource arns for AppSync.

Example:

var api graphqlApi
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})

api.grant(role, appsync.iamResource.custom(jsii.String("types/Mutation/fields/updateExample")), jsii.String("appsync:GraphQL"))

Experimental.

func IamResource_All

func IamResource_All() IamResource

Generate the resource names that accepts all types: `*`. Experimental.

func IamResource_Custom

func IamResource_Custom(arns ...*string) IamResource

Generate the resource names given custom arns. Experimental.

func IamResource_OfType

func IamResource_OfType(type_ *string, fields ...*string) IamResource

Generate the resource names given a type and fields. Experimental.

type KeyCondition

type KeyCondition interface {
	// Conjunction between two conditions.
	// Experimental.
	And(keyCond KeyCondition) KeyCondition
	// Renders the key condition to a VTL string.
	// Experimental.
	RenderTemplate() *string
}

Factory class for DynamoDB key conditions.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

keyCondition := appsync_alpha.keyCondition.beginsWith(jsii.String("keyName"), jsii.String("arg"))

Experimental.

func KeyCondition_BeginsWith

func KeyCondition_BeginsWith(keyName *string, arg *string) KeyCondition

Condition (k, arg).

True if the key attribute k begins with the Query argument. Experimental.

func KeyCondition_Between

func KeyCondition_Between(keyName *string, arg1 *string, arg2 *string) KeyCondition

Condition k BETWEEN arg1 AND arg2, true if k >= arg1 and k <= arg2. Experimental.

func KeyCondition_Eq

func KeyCondition_Eq(keyName *string, arg *string) KeyCondition

Condition k = arg, true if the key attribute k is equal to the Query argument. Experimental.

func KeyCondition_Ge

func KeyCondition_Ge(keyName *string, arg *string) KeyCondition

Condition k >= arg, true if the key attribute k is greater or equal to the Query argument. Experimental.

func KeyCondition_Gt

func KeyCondition_Gt(keyName *string, arg *string) KeyCondition

Condition k > arg, true if the key attribute k is greater than the the Query argument. Experimental.

func KeyCondition_Le

func KeyCondition_Le(keyName *string, arg *string) KeyCondition

Condition k <= arg, true if the key attribute k is less than or equal to the Query argument. Experimental.

func KeyCondition_Lt

func KeyCondition_Lt(keyName *string, arg *string) KeyCondition

Condition k < arg, true if the key attribute k is less than the Query argument. Experimental.

type LambdaAuthorizerConfig

type LambdaAuthorizerConfig struct {
	// The authorizer lambda function.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-lambdaauthorizerconfig.html
	//
	// Experimental.
	Handler awslambda.IFunction `field:"required" json:"handler" yaml:"handler"`
	// How long the results are cached.
	//
	// Disable caching by setting this to 0.
	// Experimental.
	ResultsCacheTtl awscdk.Duration `field:"optional" json:"resultsCacheTtl" yaml:"resultsCacheTtl"`
	// A regular expression for validation of tokens before the Lambda function is called.
	// Experimental.
	ValidationRegex *string `field:"optional" json:"validationRegex" yaml:"validationRegex"`
}

Configuration for Lambda authorization in AppSync.

Note that you can only have a single AWS Lambda function configured to authorize your API.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"
var authFunction function

appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("appsync.test.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_LAMBDA,
			lambdaAuthorizerConfig: &lambdaAuthorizerConfig{
				handler: authFunction,
			},
		},
	},
})

Experimental.

type LambdaDataSource

type LambdaDataSource interface {
	BackedDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync datasource backed by a Lambda function.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var function_ function
var graphqlApi graphqlApi
var role role

lambdaDataSource := appsync_alpha.NewLambdaDataSource(this, jsii.String("MyLambdaDataSource"), &lambdaDataSourceProps{
	api: graphqlApi,
	lambdaFunction: function_,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
})

Experimental.

func NewLambdaDataSource

func NewLambdaDataSource(scope constructs.Construct, id *string, props *LambdaDataSourceProps) LambdaDataSource

Experimental.

type LambdaDataSourceProps

type LambdaDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Experimental.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
	// The Lambda function to call to interact with this data source.
	// Experimental.
	LambdaFunction awslambda.IFunction `field:"required" json:"lambdaFunction" yaml:"lambdaFunction"`
}

Properties for an AppSync Lambda datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var function_ function
var graphqlApi graphqlApi
var role role

lambdaDataSourceProps := &lambdaDataSourceProps{
	api: graphqlApi,
	lambdaFunction: function_,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
}

Experimental.

type LogConfig

type LogConfig struct {
	// exclude verbose content.
	// Experimental.
	ExcludeVerboseContent interface{} `field:"optional" json:"excludeVerboseContent" yaml:"excludeVerboseContent"`
	// log level for fields.
	// Experimental.
	FieldLogLevel FieldLogLevel `field:"optional" json:"fieldLogLevel" yaml:"fieldLogLevel"`
	// The number of days log events are kept in CloudWatch Logs.
	//
	// By default AppSync keeps the logs infinitely. When updating this property,
	// unsetting it doesn't remove the log retention policy.
	// To remove the retention policy, set the value to `INFINITE`.
	// Experimental.
	Retention awslogs.RetentionDays `field:"optional" json:"retention" yaml:"retention"`
	// The role for CloudWatch Logs.
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
}

Logging configuration for AppSync.

Example:

import logs "github.com/aws/aws-cdk-go/awscdk"

logConfig := &logConfig{
	retention: logs.retentionDays_ONE_WEEK,
}

appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	authorizationConfig: &authorizationConfig{
	},
	name: jsii.String("myApi"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("myApi.graphql"))),
	logConfig: logConfig,
})

Experimental.

type MappingTemplate

type MappingTemplate interface {
	// this is called to render the mapping template to a VTL string.
	// Experimental.
	RenderTemplate() *string
}

MappingTemplates for AppSync resolvers.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

func MappingTemplate_DynamoDbDeleteItem

func MappingTemplate_DynamoDbDeleteItem(keyName *string, idArg *string) MappingTemplate

Mapping template to delete a single item from a DynamoDB table. Experimental.

func MappingTemplate_DynamoDbGetItem

func MappingTemplate_DynamoDbGetItem(keyName *string, idArg *string, consistentRead *bool) MappingTemplate

Mapping template to get a single item from a DynamoDB table. Experimental.

func MappingTemplate_DynamoDbPutItem

func MappingTemplate_DynamoDbPutItem(key PrimaryKey, values AttributeValues) MappingTemplate

Mapping template to save a single item to a DynamoDB table. Experimental.

func MappingTemplate_DynamoDbQuery

func MappingTemplate_DynamoDbQuery(cond KeyCondition, indexName *string, consistentRead *bool) MappingTemplate

Mapping template to query a set of items from a DynamoDB table. Experimental.

func MappingTemplate_DynamoDbResultItem

func MappingTemplate_DynamoDbResultItem() MappingTemplate

Mapping template for a single result item from DynamoDB. Experimental.

func MappingTemplate_DynamoDbResultList

func MappingTemplate_DynamoDbResultList() MappingTemplate

Mapping template for a result list from DynamoDB. Experimental.

func MappingTemplate_DynamoDbScanTable

func MappingTemplate_DynamoDbScanTable(consistentRead *bool) MappingTemplate

Mapping template to scan a DynamoDB table to fetch all entries. Experimental.

func MappingTemplate_FromFile

func MappingTemplate_FromFile(fileName *string) MappingTemplate

Create a mapping template from the given file. Experimental.

func MappingTemplate_FromString

func MappingTemplate_FromString(template *string) MappingTemplate

Create a mapping template from the given string. Experimental.

func MappingTemplate_LambdaRequest

func MappingTemplate_LambdaRequest(payload *string, operation *string) MappingTemplate

Mapping template to invoke a Lambda function. Experimental.

func MappingTemplate_LambdaResult

func MappingTemplate_LambdaResult() MappingTemplate

Mapping template to return the Lambda result to the caller. Experimental.

type NoneDataSource

type NoneDataSource interface {
	BaseDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync dummy datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var graphqlApi graphqlApi

noneDataSource := appsync_alpha.NewNoneDataSource(this, jsii.String("MyNoneDataSource"), &noneDataSourceProps{
	api: graphqlApi,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
})

Experimental.

func NewNoneDataSource

func NewNoneDataSource(scope constructs.Construct, id *string, props *NoneDataSourceProps) NoneDataSource

Experimental.

type NoneDataSourceProps

type NoneDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
}

Properties for an AppSync dummy datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var graphqlApi graphqlApi

noneDataSourceProps := &noneDataSourceProps{
	api: graphqlApi,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
}

Experimental.

type OpenIdConnectConfig

type OpenIdConnectConfig struct {
	// The issuer for the OIDC configuration.
	//
	// The issuer returned by discovery must exactly match the value of `iss` in the OIDC token.
	// Experimental.
	OidcProvider *string `field:"required" json:"oidcProvider" yaml:"oidcProvider"`
	// The client identifier of the Relying party at the OpenID identity provider.
	//
	// A regular expression can be specified so AppSync can validate against multiple client identifiers at a time.
	//
	// Example:
	//   -"ABCD|CDEF"
	//
	// Experimental.
	ClientId *string `field:"optional" json:"clientId" yaml:"clientId"`
	// The number of milliseconds an OIDC token is valid after being authenticated by OIDC provider.
	//
	// `auth_time` claim in OIDC token is required for this validation to work.
	// Experimental.
	TokenExpiryFromAuth *float64 `field:"optional" json:"tokenExpiryFromAuth" yaml:"tokenExpiryFromAuth"`
	// The number of milliseconds an OIDC token is valid after being issued to a user.
	//
	// This validation uses `iat` claim of OIDC token.
	// Experimental.
	TokenExpiryFromIssue *float64 `field:"optional" json:"tokenExpiryFromIssue" yaml:"tokenExpiryFromIssue"`
}

Configuration for OpenID Connect authorization in AppSync.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

openIdConnectConfig := &openIdConnectConfig{
	oidcProvider: jsii.String("oidcProvider"),

	// the properties below are optional
	clientId: jsii.String("clientId"),
	tokenExpiryFromAuth: jsii.Number(123),
	tokenExpiryFromIssue: jsii.Number(123),
}

Experimental.

type OpenSearchDataSource

type OpenSearchDataSource interface {
	BackedDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An Appsync datasource backed by OpenSearch.

Example:

import opensearch "github.com/aws/aws-cdk-go/awscdk"

var api graphqlApi

user := iam.NewUser(this, jsii.String("User"))
domain := opensearch.NewDomain(this, jsii.String("Domain"), &domainProps{
	version: opensearch.engineVersion_OPENSEARCH_1_3(),
	removalPolicy: awscdk.RemovalPolicy_DESTROY,
	fineGrainedAccessControl: &advancedSecurityOptions{
		masterUserArn: user.userArn,
	},
	encryptionAtRest: &encryptionAtRestOptions{
		enabled: jsii.Boolean(true),
	},
	nodeToNodeEncryption: jsii.Boolean(true),
	enforceHttps: jsii.Boolean(true),
})
ds := api.addOpenSearchDataSource(jsii.String("ds"), domain)

ds.createResolver(jsii.String("QueryGetTestsResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getTests"),
	requestMappingTemplate: appsync.mappingTemplate.fromString(jSON.stringify(map[string]interface{}{
		"version": jsii.String("2017-02-28"),
		"operation": jsii.String("GET"),
		"path": jsii.String("/id/post/_search"),
		"params": map[string]map[string]interface{}{
			"headers": map[string]interface{}{
			},
			"queryString": map[string]interface{}{
			},
			"body": map[string]*f64{
				"from": jsii.Number(0),
				"size": jsii.Number(50),
			},
		},
	})),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("[\n    #foreach($entry in $context.result.hits.hits)\n    #if( $velocityCount > 1 ) , #end\n    $utils.toJson($entry.get(\"_source\"))\n    #end\n  ]")),
})

Experimental.

func NewOpenSearchDataSource

func NewOpenSearchDataSource(scope constructs.Construct, id *string, props *OpenSearchDataSourceProps) OpenSearchDataSource

Experimental.

type OpenSearchDataSourceProps

type OpenSearchDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Experimental.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
	// The OpenSearch domain containing the endpoint for the data source.
	// Experimental.
	Domain awsopensearchservice.IDomain `field:"required" json:"domain" yaml:"domain"`
}

Properties for the OpenSearch Data Source.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var domain domain
var graphqlApi graphqlApi
var role role

openSearchDataSourceProps := &openSearchDataSourceProps{
	api: graphqlApi,
	domain: domain,

	// the properties below are optional
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
}

Experimental.

type PartitionKey

type PartitionKey interface {
	PrimaryKey
	// Experimental.
	Pkey() Assign
	// Renders the key assignment to a VTL string.
	// Experimental.
	RenderTemplate() *string
	// Allows assigning a value to the sort key.
	// Experimental.
	Sort(key *string) SortKeyStep
}

Specifies the assignment to the partition key.

It can be enhanced with the assignment of the sort key.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var assign assign

partitionKey := appsync_alpha.NewPartitionKey(assign)

Experimental.

func NewPartitionKey

func NewPartitionKey(pkey Assign) PartitionKey

Experimental.

type PartitionKeyStep

type PartitionKeyStep interface {
	// Assign an auto-generated value to the partition key.
	// Experimental.
	Auto() PartitionKey
	// Assign an auto-generated value to the partition key.
	// Experimental.
	Is(val *string) PartitionKey
}

Utility class to allow assigning a value or an auto-generated id to a partition key.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

partitionKeyStep := appsync_alpha.NewPartitionKeyStep(jsii.String("key"))

Experimental.

func NewPartitionKeyStep

func NewPartitionKeyStep(key *string) PartitionKeyStep

Experimental.

func PartitionKey_Partition

func PartitionKey_Partition(key *string) PartitionKeyStep

Allows assigning a value to the partition key. Experimental.

func PrimaryKey_Partition

func PrimaryKey_Partition(key *string) PartitionKeyStep

Allows assigning a value to the partition key. Experimental.

type PrimaryKey

type PrimaryKey interface {
	// Experimental.
	Pkey() Assign
	// Renders the key assignment to a VTL string.
	// Experimental.
	RenderTemplate() *string
}

Specifies the assignment to the primary key.

It either contains the full primary key or only the partition key.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

func NewPrimaryKey

func NewPrimaryKey(pkey Assign, skey Assign) PrimaryKey

Experimental.

type RdsDataSource

type RdsDataSource interface {
	BackedDataSource
	// Experimental.
	Api() IGraphqlApi
	// Experimental.
	SetApi(val IGraphqlApi)
	// the underlying CFN data source resource.
	// Experimental.
	Ds() awsappsync.CfnDataSource
	// the principal of the data source to be IGrantable.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// the name of the data source.
	// Experimental.
	Name() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Experimental.
	ServiceRole() awsiam.IRole
	// Experimental.
	SetServiceRole(val awsiam.IRole)
	// creates a new appsync function for this datasource and API using the given properties.
	// Experimental.
	CreateFunction(id *string, props *BaseAppsyncFunctionProps) AppsyncFunction
	// creates a new resolver for this datasource and API using the given properties.
	// Experimental.
	CreateResolver(id *string, props *BaseResolverProps) Resolver
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync datasource backed by RDS.

Example:

// Build a data source for AppSync to access the database.
var api graphqlApi
// Create username and password secret for DB Cluster
secret := rds.NewDatabaseSecret(this, jsii.String("AuroraSecret"), &databaseSecretProps{
	username: jsii.String("clusteradmin"),
})

// The VPC to place the cluster in
vpc := ec2.NewVpc(this, jsii.String("AuroraVpc"))

// Create the serverless cluster, provide all values needed to customise the database.
cluster := rds.NewServerlessCluster(this, jsii.String("AuroraCluster"), &serverlessClusterProps{
	engine: rds.databaseClusterEngine_AURORA_MYSQL(),
	vpc: vpc,
	credentials: map[string]*string{
		"username": jsii.String("clusteradmin"),
	},
	clusterIdentifier: jsii.String("db-endpoint-test"),
	defaultDatabaseName: jsii.String("demos"),
})
rdsDS := api.addRdsDataSource(jsii.String("rds"), cluster, secret, jsii.String("demos"))

// Set up a resolver for an RDS query.
rdsDS.createResolver(jsii.String("QueryGetDemosRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosRds"),
	requestMappingTemplate: appsync.mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"SELECT * FROM demos\"\n    ]\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n  ")),
})

// Set up a resolver for an RDS mutation.
rdsDS.createResolver(jsii.String("MutationAddDemoRdsResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemoRds"),
	requestMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"INSERT INTO demos VALUES (:id, :version)\",\n      \"SELECT * WHERE id = :id\"\n    ],\n    \"variableMap\": {\n      \":id\": $util.toJson($util.autoId()),\n      \":version\": $util.toJson($ctx.args.version)\n    }\n  }\n  ")),
	responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n  ")),
})

Experimental.

func NewRdsDataSource

func NewRdsDataSource(scope constructs.Construct, id *string, props *RdsDataSourceProps) RdsDataSource

Experimental.

type RdsDataSourceProps

type RdsDataSourceProps struct {
	// The API to attach this data source to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
	// the description of the data source.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The name of the data source.
	// Experimental.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// The IAM service role to be assumed by AppSync to interact with the data source.
	// Experimental.
	ServiceRole awsiam.IRole `field:"optional" json:"serviceRole" yaml:"serviceRole"`
	// The secret containing the credentials for the database.
	// Experimental.
	SecretStore awssecretsmanager.ISecret `field:"required" json:"secretStore" yaml:"secretStore"`
	// The serverless cluster to call to interact with this data source.
	// Experimental.
	ServerlessCluster awsrds.IServerlessCluster `field:"required" json:"serverlessCluster" yaml:"serverlessCluster"`
	// The name of the database to use within the cluster.
	// Experimental.
	DatabaseName *string `field:"optional" json:"databaseName" yaml:"databaseName"`
}

Properties for an AppSync RDS datasource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var graphqlApi graphqlApi
var role role
var secret secret
var serverlessCluster serverlessCluster

rdsDataSourceProps := &rdsDataSourceProps{
	api: graphqlApi,
	secretStore: secret,
	serverlessCluster: serverlessCluster,

	// the properties below are optional
	databaseName: jsii.String("databaseName"),
	description: jsii.String("description"),
	name: jsii.String("name"),
	serviceRole: role,
}

Experimental.

type Resolver

type Resolver interface {
	constructs.Construct
	// the ARN of the resolver.
	// Experimental.
	Arn() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An AppSync resolver.

Example:

var api graphqlApi
var appsyncFunction appsyncFunction

pipelineResolver := appsync.NewResolver(this, jsii.String("pipeline"), &resolverProps{
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	typeName: jsii.String("typeName"),
	fieldName: jsii.String("fieldName"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("beforeRequest.vtl")),
	pipelineConfig: []iAppsyncFunction{
		appsyncFunction,
	},
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("afterResponse.vtl")),
})

Experimental.

func NewResolver

func NewResolver(scope constructs.Construct, id *string, props *ResolverProps) Resolver

Experimental.

type ResolverProps

type ResolverProps struct {
	// name of the GraphQL field in the given type this resolver is attached to.
	// Experimental.
	FieldName *string `field:"required" json:"fieldName" yaml:"fieldName"`
	// name of the GraphQL type this resolver is attached to.
	// Experimental.
	TypeName *string `field:"required" json:"typeName" yaml:"typeName"`
	// The caching configuration for this resolver.
	// Experimental.
	CachingConfig *CachingConfig `field:"optional" json:"cachingConfig" yaml:"cachingConfig"`
	// The maximum number of elements per batch, when using batch invoke.
	// Experimental.
	MaxBatchSize *float64 `field:"optional" json:"maxBatchSize" yaml:"maxBatchSize"`
	// configuration of the pipeline resolver.
	// Experimental.
	PipelineConfig *[]IAppsyncFunction `field:"optional" json:"pipelineConfig" yaml:"pipelineConfig"`
	// The request mapping template for this resolver.
	// Experimental.
	RequestMappingTemplate MappingTemplate `field:"optional" json:"requestMappingTemplate" yaml:"requestMappingTemplate"`
	// The response mapping template for this resolver.
	// Experimental.
	ResponseMappingTemplate MappingTemplate `field:"optional" json:"responseMappingTemplate" yaml:"responseMappingTemplate"`
	// The data source this resolver is using.
	// Experimental.
	DataSource BaseDataSource `field:"optional" json:"dataSource" yaml:"dataSource"`
	// The API this resolver is attached to.
	// Experimental.
	Api IGraphqlApi `field:"required" json:"api" yaml:"api"`
}

Additional property for an AppSync resolver for GraphQL API reference.

Example:

var api graphqlApi
var appsyncFunction appsyncFunction

pipelineResolver := appsync.NewResolver(this, jsii.String("pipeline"), &resolverProps{
	api: api,
	dataSource: api.addNoneDataSource(jsii.String("none")),
	typeName: jsii.String("typeName"),
	fieldName: jsii.String("fieldName"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("beforeRequest.vtl")),
	pipelineConfig: []iAppsyncFunction{
		appsyncFunction,
	},
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("afterResponse.vtl")),
})

Experimental.

type SchemaBindOptions

type SchemaBindOptions struct {
}

Used for configuring schema bind behavior.

This is intended to prevent breaking changes to implementors of ISchema if needing to add new behavior.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

schemaBindOptions := &schemaBindOptions{
}

Experimental.

type SchemaFile

type SchemaFile interface {
	ISchema
	// The definition for this schema.
	// Experimental.
	Definition() *string
	// Experimental.
	SetDefinition(val *string)
	// Called when the GraphQL Api is initialized to allow this object to bind to the stack.
	// Experimental.
	Bind(api IGraphqlApi, _options *SchemaBindOptions) ISchemaConfig
}

The Schema for a GraphQL Api.

If no options are configured, schema will be generated code-first.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("api"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
})

httpDs := api.addHttpDataSource(jsii.String("ds"), jsii.String("https://states.amazonaws.com"), &httpDataSourceOptions{
	name: jsii.String("httpDsWithStepF"),
	description: jsii.String("from appsync to StepFunctions Workflow"),
	authorizationConfig: &awsIamConfig{
		signingRegion: jsii.String("us-east-1"),
		signingServiceName: jsii.String("states"),
	},
})

httpDs.createResolver(jsii.String("MutationCallStepFunctionResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("callStepFunction"),
	requestMappingTemplate: appsync.mappingTemplate.fromFile(jsii.String("request.vtl")),
	responseMappingTemplate: appsync.*mappingTemplate.fromFile(jsii.String("response.vtl")),
})

Experimental.

func NewSchemaFile

func NewSchemaFile(options *SchemaProps) SchemaFile

Experimental.

func SchemaFile_FromAsset

func SchemaFile_FromAsset(filePath *string) SchemaFile

Generate a Schema from file.

Returns: `SchemaAsset` with immutable schema defintion. Experimental.

type SchemaProps

type SchemaProps struct {
	// The file path for the schema.
	//
	// When this option is
	// configured, then the schema will be generated from an
	// existing file from disk.
	// Experimental.
	FilePath *string `field:"required" json:"filePath" yaml:"filePath"`
}

The options for configuring a schema from an existing file.

Example:

import acm "github.com/aws/aws-cdk-go/awscdk"
import route53 "github.com/aws/aws-cdk-go/awscdk"

// hosted zone and route53 features
var hostedZoneId string
zoneName := "example.com"

myDomainName := "api.example.com"
certificate := acm.NewCertificate(this, jsii.String("cert"), &certificateProps{
	domainName: myDomainName,
})
schema := appsync.NewSchemaFile(&schemaProps{
	filePath: jsii.String("mySchemaFile"),
})
api := appsync.NewGraphqlApi(this, jsii.String("api"), &graphqlApiProps{
	name: jsii.String("myApi"),
	schema: schema,
	domainName: &domainOptions{
		certificate: certificate,
		domainName: myDomainName,
	},
})

// hosted zone for adding appsync domain
zone := route53.hostedZone.fromHostedZoneAttributes(this, jsii.String("HostedZone"), &hostedZoneAttributes{
	hostedZoneId: jsii.String(hostedZoneId),
	zoneName: jsii.String(zoneName),
})

// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.NewCnameRecord(this, jsii.String("CnameApiRecord"), &cnameRecordProps{
	recordName: jsii.String("api"),
	zone: zone,
	domainName: api.appSyncDomainName,
})

Experimental.

type SortKeyStep

type SortKeyStep interface {
	// Assign an auto-generated value to the sort key.
	// Experimental.
	Auto() PrimaryKey
	// Assign an auto-generated value to the sort key.
	// Experimental.
	Is(val *string) PrimaryKey
}

Utility class to allow assigning a value or an auto-generated id to a sort key.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"

var assign assign

sortKeyStep := appsync_alpha.NewSortKeyStep(assign, jsii.String("skey"))

Experimental.

func NewSortKeyStep

func NewSortKeyStep(pkey Assign, skey *string) SortKeyStep

Experimental.

type UserPoolConfig

type UserPoolConfig struct {
	// The Cognito user pool to use as identity source.
	// Experimental.
	UserPool awscognito.IUserPool `field:"required" json:"userPool" yaml:"userPool"`
	// the optional app id regex.
	// Experimental.
	AppIdClientRegex *string `field:"optional" json:"appIdClientRegex" yaml:"appIdClientRegex"`
	// Default auth action.
	// Experimental.
	DefaultAction UserPoolDefaultAction `field:"optional" json:"defaultAction" yaml:"defaultAction"`
}

Configuration for Cognito user-pools in AppSync.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import appsync_alpha "github.com/aws/aws-cdk-go/awscdkappsyncalpha"
import "github.com/aws/aws-cdk-go/awscdk"

var userPool userPool

userPoolConfig := &userPoolConfig{
	userPool: userPool,

	// the properties below are optional
	appIdClientRegex: jsii.String("appIdClientRegex"),
	defaultAction: appsync_alpha.userPoolDefaultAction_ALLOW,
}

Experimental.

type UserPoolDefaultAction

type UserPoolDefaultAction string

enum with all possible values for Cognito user-pool default actions. Experimental.

const (
	// ALLOW access to API.
	// Experimental.
	UserPoolDefaultAction_ALLOW UserPoolDefaultAction = "ALLOW"
	// DENY access to API.
	// Experimental.
	UserPoolDefaultAction_DENY UserPoolDefaultAction = "DENY"
)

type Values

type Values interface {
}

Factory class for attribute value assignments.

Example:

api := appsync.NewGraphqlApi(this, jsii.String("Api"), &graphqlApiProps{
	name: jsii.String("demo"),
	schema: appsync.schemaFile.fromAsset(path.join(__dirname, jsii.String("schema.graphql"))),
	authorizationConfig: &authorizationConfig{
		defaultAuthorization: &authorizationMode{
			authorizationType: appsync.authorizationType_IAM,
		},
	},
	xrayEnabled: jsii.Boolean(true),
})

demoTable := dynamodb.NewTable(this, jsii.String("DemoTable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

demoDS := api.addDynamoDbDataSource(jsii.String("demoDataSource"), demoTable)

// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.createResolver(jsii.String("QueryGetDemosResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemos"),
	requestMappingTemplate: appsync.mappingTemplate.dynamoDbScanTable(),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver(jsii.String("MutationAddDemoResolver"), &baseResolverProps{
	typeName: jsii.String("Mutation"),
	fieldName: jsii.String("addDemo"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbPutItem(appsync.primaryKey.partition(jsii.String("id")).auto(), appsync.values.projecting(jsii.String("input"))),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultItem(),
})

//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver(jsii.String("QueryGetDemosConsistentResolver"), &baseResolverProps{
	typeName: jsii.String("Query"),
	fieldName: jsii.String("getDemosConsistent"),
	requestMappingTemplate: appsync.*mappingTemplate.dynamoDbScanTable(jsii.Boolean(true)),
	responseMappingTemplate: appsync.*mappingTemplate.dynamoDbResultList(),
})

Experimental.

func NewValues

func NewValues() Values

Experimental.

Source Files

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL