Definition

class aws_cdk.aws_appsync.Definition

Bases: object

AppSync definition.

Specify how you want to define your AppSync API.

ExampleMetadata:

infused

Example:

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
    )
)

Attributes

schema

Schema, when AppSync API is created from schema file.

source_api_options

Source APIs for Merged API.

Static Methods

classmethod from_file(file_path)

Schema from file, allows schema definition through schema.graphql file.

Parameters:

file_path (str) – the file path of the schema file.

Return type:

Definition

Returns:

Definition with schema from file

classmethod from_schema(schema)

Schema from schema object.

Parameters:

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

Return type:

Definition

Returns:

Definition with schema from file

classmethod from_source_apis(*, source_apis, merged_api_execution_role=None)

Schema from existing AppSync APIs - used for creating a AppSync Merged API.

Parameters:
  • source_apis (Sequence[Union[SourceApi, Dict[str, Any]]]) – Definition of source APIs associated with this Merged API.

  • merged_api_execution_role (Optional[Role]) – IAM Role used to validate access to source APIs at runtime and to update the merged API endpoint with the source API changes. Default: - An IAM Role with acccess to source schemas will be created

Return type:

Definition

Returns:

Definition with for AppSync Merged API