Skip to content
v2.277.0

BasePathMappingProps Struct ​

Example ​

ts
declare const api: apigateway.RestApi;

const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'DomainName', {
  domainName: 'domainName',
  domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId',
  domainNameAliasTarget: 'domainNameAliasTarget',
});

new apigateway.BasePathMapping(this, 'BasePathMapping', {
  domainName: domainName,
  restApi: api,
});
python
# api: apigateway.RestApi


domain_name = apigateway.DomainName.from_domain_name_attributes(self, "DomainName",
    domain_name="domainName",
    domain_name_alias_hosted_zone_id="domainNameAliasHostedZoneId",
    domain_name_alias_target="domainNameAliasTarget"
)

apigateway.BasePathMapping(self, "BasePathMapping",
    domain_name=domain_name,
    rest_api=api
)
java
RestApi api;


IDomainName domainName = DomainName.fromDomainNameAttributes(this, "DomainName", DomainNameAttributes.builder()
        .domainName("domainName")
        .domainNameAliasHostedZoneId("domainNameAliasHostedZoneId")
        .domainNameAliasTarget("domainNameAliasTarget")
        .build());

BasePathMapping.Builder.create(this, "BasePathMapping")
        .domainName(domainName)
        .restApi(api)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
RestApi api;


var domainName = DomainName.FromDomainNameAttributes(this, "DomainName", new DomainNameAttributes {
    DomainName = "domainName",
    DomainNameAliasHostedZoneId = "domainNameAliasHostedZoneId",
    DomainNameAliasTarget = "domainNameAliasTarget"
});

new BasePathMapping(this, "BasePathMapping", new BasePathMappingProps {
    DomainName = domainName,
    RestApi = api
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api RestApi


domainName := apigateway.DomainName_FromDomainNameAttributes(this, jsii.String("DomainName"), &DomainNameAttributes{
	DomainName: jsii.String("domainName"),
	DomainNameAliasHostedZoneId: jsii.String("domainNameAliasHostedZoneId"),
	DomainNameAliasTarget: jsii.String("domainNameAliasTarget"),
})

apigateway.NewBasePathMapping(this, jsii.String("BasePathMapping"), &BasePathMappingProps{
	DomainName: domainName,
	RestApi: api,
})

Properties ​

attachToStageoptionalbooleanattach_to_stageoptionalboolattachToStageoptionalBooleanAttachToStageoptionalboolAttachToStageoptional*bool = true #
Whether to attach the base path mapping to a stage.

Use this property to create a base path mapping without attaching it to the Rest API default stage. This property is ignored if stage is provided.

basePathoptionalstringbase_pathoptionalstrbasePathoptionalStringBasePathoptionalstringBasePathoptional*string #
The base path name that callers of the API must provide in the URL after the domain name (e.g. `example.com/base-path`). If you specify this property, it can't be an empty string.

Default: map requests from the domain root (e.g. example.com). If this is undefined, no additional mappings will be allowed on this domain name.

domainNameIDomainNameRefdomain_nameIDomainNameRefdomainNameIDomainNameRefDomainNameIDomainNameRefDomainNameIDomainNameRef required #
The DomainName to associate with this base path mapping.
restApiIRestApiRefrest_apiIRestApiRefrestApiIRestApiRefRestApiIRestApiRefRestApiIRestApiRef required #
The RestApi resource to target.
stageoptionalStagestageoptionalStagestageoptionalStageStageoptionalStageStageoptionalStage #
The Deployment stage of API [disable-awslint:ref-via-interface].

Default: map to deploymentStage of restApi otherwise stage needs to pass in URL