BasePathMappingArgs

data class BasePathMappingArgs(val basePath: Output<String>? = null, val domainName: Output<String>? = null, val restApi: Output<String>? = null, val stageName: Output<String>? = null) : ConvertibleToJava<BasePathMappingArgs>

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

aws_api_gateway_base_path_mapping can be imported by using the domain name and base path, e.g., For empty base_path (e.g., root path (/))

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

Otherwise

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

Constructors

Link copied to clipboard
constructor(basePath: Output<String>? = null, domainName: Output<String>? = null, restApi: Output<String>? = null, stageName: Output<String>? = null)

Properties

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

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>? = null

Already-registered domain name to connect the API to.

Link copied to clipboard
val restApi: Output<String>? = null

ID of the API to connect.

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

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.

Functions

Link copied to clipboard
open override fun toJava(): BasePathMappingArgs