Skip to content
v2.277.0

BasePathMappingOptions Struct ​

Example ​

ts
declare const domain: apigateway.DomainName;
declare const api1: apigateway.RestApi;
declare const api2: apigateway.RestApi;

domain.addBasePathMapping(api1, { basePath: 'go-to-api1' });
domain.addBasePathMapping(api2, { basePath: 'boom' });
python
# domain: apigateway.DomainName
# api1: apigateway.RestApi
# api2: apigateway.RestApi


domain.add_base_path_mapping(api1, base_path="go-to-api1")
domain.add_base_path_mapping(api2, base_path="boom")
java
DomainName domain;
RestApi api1;
RestApi api2;


domain.addBasePathMapping(api1, BasePathMappingOptions.builder().basePath("go-to-api1").build());
domain.addBasePathMapping(api2, BasePathMappingOptions.builder().basePath("boom").build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
DomainName domain;
RestApi api1;
RestApi api2;


domain.AddBasePathMapping(api1, new BasePathMappingOptions { BasePath = "go-to-api1" });
domain.AddBasePathMapping(api2, new BasePathMappingOptions { BasePath = "boom" });
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var domain DomainName
var api1 RestApi
var api2 RestApi


domain.AddBasePathMapping(api1, &BasePathMappingOptions{
	BasePath: jsii.String("go-to-api1"),
})
domain.AddBasePathMapping(api2, &BasePathMappingOptions{
	BasePath: jsii.String("boom"),
})

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.

stageoptionalStagestageoptionalStagestageoptionalStageStageoptionalStageStageoptionalStage #
The Deployment stage of API [disable-awslint:ref-via-interface].

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