DomainMappingOptions

class aws_cdk.aws_apigatewayv2.DomainMappingOptions(*, domain_name, mapping_key=None)

Bases: object

Options for DomainMapping.

Parameters:
  • domain_name (IDomainName) – The domain name for the mapping.

  • mapping_key (Optional[str]) – The API mapping key. Leave it undefined for the root path mapping. Default: - empty key for the root path mapping

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration

# handler: lambda.Function
# dn: apigwv2.DomainName


api_demo = apigwv2.HttpApi(self, "DemoApi",
    default_integration=HttpLambdaIntegration("DefaultIntegration", handler),
    # https://${dn.domainName}/demo goes to apiDemo $default stage
    default_domain_mapping=apigwv2.DomainMappingOptions(
        domain_name=dn,
        mapping_key="demo"
    )
)

Attributes

domain_name

The domain name for the mapping.

mapping_key

The API mapping key.

Leave it undefined for the root path mapping.

Default:
  • empty key for the root path mapping