Skip to content
v2.277.0

GraphqlApiProps Struct ​

Properties for an AppSync GraphQL API.

Example ​

ts
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
new appsync.GraphqlApi(this, 'api', {
  name: 'myApi',
  definition: appsync.Definition.fromSchema(schema),
  enhancedMetricsConfig: {
    dataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
    operationLevelMetricsConfig: appsync.OperationLevelMetricsConfig.ENABLED,
    resolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS,
  },
});
python
schema = appsync.SchemaFile(file_path="mySchemaFile")
appsync.GraphqlApi(self, "api",
    name="myApi",
    definition=appsync.Definition.from_schema(schema),
    enhanced_metrics_config=appsync.EnhancedMetricsConfig(
        data_source_level_metrics_behavior=appsync.DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
        operation_level_metrics_config=appsync.OperationLevelMetricsConfig.ENABLED,
        resolver_level_metrics_behavior=appsync.ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS
    )
)
java
SchemaFile schema = SchemaFile.Builder.create().filePath("mySchemaFile").build();
GraphqlApi.Builder.create(this, "api")
        .name("myApi")
        .definition(Definition.fromSchema(schema))
        .enhancedMetricsConfig(EnhancedMetricsConfig.builder()
                .dataSourceLevelMetricsBehavior(DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS)
                .operationLevelMetricsConfig(OperationLevelMetricsConfig.ENABLED)
                .resolverLevelMetricsBehavior(ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var schema = new SchemaFile(new SchemaProps { FilePath = "mySchemaFile" });
new GraphqlApi(this, "api", new GraphqlApiProps {
    Name = "myApi",
    Definition = Definition.FromSchema(schema),
    EnhancedMetricsConfig = new EnhancedMetricsConfig {
        DataSourceLevelMetricsBehavior = DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
        OperationLevelMetricsConfig = OperationLevelMetricsConfig.ENABLED,
        ResolverLevelMetricsBehavior = ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
schema := appsync.NewSchemaFile(&SchemaProps{
	FilePath: jsii.String("mySchemaFile"),
})
appsync.NewGraphqlApi(this, jsii.String("api"), &GraphqlApiProps{
	Name: jsii.String("myApi"),
	Definition: appsync.Definition_FromSchema(schema),
	EnhancedMetricsConfig: &EnhancedMetricsConfig{
		DataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior_FULL_REQUEST_DATA_SOURCE_METRICS,
		OperationLevelMetricsConfig: appsync.OperationLevelMetricsConfig_ENABLED,
		ResolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior_FULL_REQUEST_RESOLVER_METRICS,
	},
})

Properties ​

authorizationConfigoptionalAuthorizationConfigauthorization_configoptionalAuthorizationConfigauthorizationConfigoptionalAuthorizationConfigAuthorizationConfigoptionalAuthorizationConfigAuthorizationConfigoptionalAuthorizationConfig #
Optional authorization configuration.

Default: API Key authorization

definitionoptionalDefinitiondefinitionoptionalDefinitiondefinitionoptionalDefinitionDefinitionoptionalDefinitionDefinitionoptionalDefinition #
Definition (schema file or source APIs) for this GraphQL Api.
domainNameoptionalDomainOptionsdomain_nameoptionalDomainOptionsdomainNameoptionalDomainOptionsDomainNameoptionalDomainOptionsDomainNameoptionalDomainOptions #
The domain name configuration for the GraphQL API.

Default: no domain name

The Route 53 hosted zone and CName DNS record must be configured in addition to this setting to enable custom domain URL

enhancedMetricsConfigoptionalEnhancedMetricsConfigenhanced_metrics_configoptionalEnhancedMetricsConfigenhancedMetricsConfigoptionalEnhancedMetricsConfigEnhancedMetricsConfigoptionalEnhancedMetricsConfigEnhancedMetricsConfigoptionalEnhancedMetricsConfig #
Enables and controls the enhanced metrics feature.

Default: Enhanced metrics disabled.

environmentVariablesoptional{ [key: string]: string }environment_variablesoptionaltyping.Mapping[str, str]environmentVariablesoptionalMap<String, String>EnvironmentVariablesoptionalIDictionary<string, string>EnvironmentVariablesoptional*map[string]*string #
A map containing the list of resources with their properties and environment variables.

Default: No environment variables.

notes

There are a few rules you must follow when creating keys and values:

  • Keys must begin with a letter.
  • Keys must be between 2 and 64 characters long.
  • Keys can only contain letters, numbers, and the underscore character (_).
  • Values can be up to 512 characters long.
  • You can configure up to 50 key-value pairs in a GraphQL API.
introspectionConfigoptionalIntrospectionConfigintrospection_configoptionalIntrospectionConfigintrospectionConfigoptionalIntrospectionConfigIntrospectionConfigoptionalIntrospectionConfigIntrospectionConfigoptionalIntrospectionConfig = IntrospectionConfig.ENABLED #
A value indicating whether the API to enable (ENABLED) or disable (DISABLED) introspection.
logConfigoptionalLogConfiglog_configoptionalLogConfiglogConfigoptionalLogConfigLogConfigoptionalLogConfigLogConfigoptionalLogConfig = None #
Logging configuration for this api.
namestringnamestrnameStringNamestringName*string required #
the name of the GraphQL API.
ownerContactoptionalstringowner_contactoptionalstrownerContactoptionalStringOwnerContactoptionalstringOwnerContactoptional*string #
The owner contact information for an API resource.

Default: No owner contact.

This field accepts any string input with a length of 0 - 256 characters.

queryDepthLimitoptionalnumberquery_depth_limitoptionalint | floatqueryDepthLimitoptionalNumberQueryDepthLimitoptionaldoubleQueryDepthLimitoptional*float64 #
A number indicating the maximum depth resolvers should be accepted when handling queries.

Default: The default value is 0 (or unspecified) which indicates no maximum depth.

Value must be withing range of 0 to 75

resolverCountLimitoptionalnumberresolver_count_limitoptionalint | floatresolverCountLimitoptionalNumberResolverCountLimitoptionaldoubleResolverCountLimitoptional*float64 #
A number indicating the maximum number of resolvers that should be accepted when handling queries.

Default: The default value is 0 (or unspecified), which will set the limit to 10000

Value must be withing range of 0 to 10000

schemaoptionalISchemaschemaoptionalISchemaschemaoptionalISchemaSchemaoptionalISchemaSchemaoptionalISchema deprecated #
use Definition.schema instead

Default: schema will be generated code-first (i.e. addType, addObjectType, etc.)

SchemaFile.fromAsset(filePath: string) allows schema definition through schema.graphql file

visibilityoptionalVisibilityvisibilityoptionalVisibilityvisibilityoptionalVisibilityVisibilityoptionalVisibilityVisibilityoptionalVisibility = GLOBAL #
A value indicating whether the API is accessible from anywhere (GLOBAL) or can only be access from a VPC (PRIVATE).
xrayEnabledoptionalbooleanxray_enabledoptionalboolxrayEnabledoptionalBooleanXrayEnabledoptionalboolXrayEnabledoptional*bool = false #
A flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.