BasePathMapping

class BasePathMapping : KotlinCustomResource

Connects a custom domain name registered via aws.apigateway.DomainName with a deployed API so that its methods can be called via the custom domain name.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import com.pulumi.aws.apigateway.DomainName;
import com.pulumi.aws.apigateway.DomainNameArgs;
import com.pulumi.aws.apigateway.BasePathMapping;
import com.pulumi.aws.apigateway.BasePathMappingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleStage = new Stage("exampleStage", StageArgs.builder()
.deployment(aws_api_gateway_deployment.example().id())
.restApi(aws_api_gateway_rest_api.example().id())
.stageName("example")
.build());
var exampleDomainName = new DomainName("exampleDomainName", DomainNameArgs.builder()
.domainName("example.com")
.certificateName("example-api")
.certificateBody(Files.readString(Paths.get(String.format("%s/example.com/example.crt", path.module()))))
.certificateChain(Files.readString(Paths.get(String.format("%s/example.com/ca.crt", path.module()))))
.certificatePrivateKey(Files.readString(Paths.get(String.format("%s/example.com/example.key", path.module()))))
.build());
var exampleBasePathMapping = new BasePathMapping("exampleBasePathMapping", BasePathMappingArgs.builder()
.restApi(aws_api_gateway_rest_api.example().id())
.stageName(exampleStage.stageName())
.domainName(exampleDomainName.domainName())
.build());
}
}

Import

For a non-root base_path: Using pulumi import, import aws_api_gateway_base_path_mapping using the domain name and base path. For example: For an empty base_path or, in other words, a root path (/):

$ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/

For a non-root base_path:

$ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/base-path

Properties

Link copied to clipboard
val basePath: Output<String>?

Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.

Link copied to clipboard
val domainName: Output<String>

Already-registered domain name to connect the API to.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val restApi: Output<String>

ID of the API to connect.

Link copied to clipboard
val stageName: Output<String>?

Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.

Link copied to clipboard
val urn: Output<String>