SchemaProps

class aws_cdk.aws_appsync.SchemaProps(*, file_path)

Bases: object

The options for configuring a schema from an existing file.

Parameters:

file_path (str) – The file path for the schema. When this option is configured, then the schema will be generated from an existing file from disk.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_certificatemanager as acm
import aws_cdk.aws_route53 as route53

# hosted zone and route53 features
# hosted_zone_id: str
zone_name = "example.com"


my_domain_name = "api.example.com"
certificate = acm.Certificate(self, "cert", domain_name=my_domain_name)
schema = appsync.SchemaFile(file_path="mySchemaFile")
api = appsync.GraphqlApi(self, "api",
    name="myApi",
    definition=appsync.Definition.from_schema(schema),
    domain_name=appsync.DomainOptions(
        certificate=certificate,
        domain_name=my_domain_name
    )
)

# hosted zone for adding appsync domain
zone = route53.HostedZone.from_hosted_zone_attributes(self, "HostedZone",
    hosted_zone_id=hosted_zone_id,
    zone_name=zone_name
)

# create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.CnameRecord(self, "CnameApiRecord",
    record_name="api",
    zone=zone,
    domain_name=api.app_sync_domain_name
)

Attributes

file_path

The file path for the schema.

When this option is configured, then the schema will be generated from an existing file from disk.