aws-cdk-lib.aws_appsync.GraphqlApiProps

interface GraphqlApiProps

LanguageType name
.NETAmazon.CDK.AWS.AppSync.GraphqlApiProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappsync#GraphqlApiProps
Javasoftware.amazon.awscdk.services.appsync.GraphqlApiProps
Pythonaws_cdk.aws_appsync.GraphqlApiProps
TypeScript (source)aws-cdk-lib » aws_appsync » GraphqlApiProps

Properties for an AppSync GraphQL API.

Example

const api = new appsync.GraphqlApi(stack, 'EventBridgeApi', {
  name: 'EventBridgeApi',
  schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.eventbridge.graphql')),
});

const bus = new events.EventBus(stack, 'DestinationEventBus', {});

const dataSource = api.addEventBridgeDataSource('NoneDS', bus);

dataSource.createResolver('EventResolver', {
  typeName: 'Mutation',
  fieldName: 'emitEvent',
  requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'),
  responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'),
});

Properties

NameTypeDescription
namestringthe name of the GraphQL API.
schemaISchemaGraphQL schema definition. Specify how you want to define your schema.
authorizationConfig?AuthorizationConfigOptional authorization configuration.
domainName?DomainOptionsThe domain name configuration for the GraphQL API.
logConfig?LogConfigLogging configuration for this api.
visibility?VisibilityA value indicating whether the API is accessible from anywhere (GLOBAL) or can only be access from a VPC (PRIVATE).
xrayEnabled?booleanA flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.

name

Type: string

the name of the GraphQL API.


schema

Type: ISchema

GraphQL schema definition. Specify how you want to define your schema.

Schema.fromFile(filePath: string) allows schema definition through schema.graphql file


authorizationConfig?

Type: AuthorizationConfig (optional, default: API Key authorization)

Optional authorization configuration.


domainName?

Type: DomainOptions (optional, default: no domain name)

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


logConfig?

Type: LogConfig (optional, default: None)

Logging configuration for this api.


visibility?

Type: Visibility (optional, default: GLOBAL)

A value indicating whether the API is accessible from anywhere (GLOBAL) or can only be access from a VPC (PRIVATE).


xrayEnabled?

Type: boolean (optional, default: false)

A flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.