BasePathMapping
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
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleDeployment = new Aws.ApiGateway.Deployment("exampleDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = aws_api_gateway_rest_api.MyDemoAPI.Id,
StageName = "live",
});
var exampleDomainName = new Aws.ApiGateway.DomainName("exampleDomainName", new Aws.ApiGateway.DomainNameArgs
{
CertificateBody = File.ReadAllText($"{path.Module}/example.com/example.crt"),
CertificateChain = File.ReadAllText($"{path.Module}/example.com/ca.crt"),
CertificateName = "example-api",
CertificatePrivateKey = File.ReadAllText($"{path.Module}/example.com/example.key"),
DomainName = "example.com",
});
var test = new Aws.ApiGateway.BasePathMapping("test", new Aws.ApiGateway.BasePathMappingArgs
{
RestApi = aws_api_gateway_rest_api.MyDemoAPI.Id,
DomainName = exampleDomainName.Domain,
StageName = exampleDeployment.StageName,
});
}
}
Coming soon!
import pulumi
import pulumi_aws as aws
example_deployment = aws.apigateway.Deployment("exampleDeployment",
rest_api=aws_api_gateway_rest_api["MyDemoAPI"]["id"],
stage_name="live")
example_domain_name = aws.apigateway.DomainName("exampleDomainName",
certificate_body=(lambda path: open(path).read())(f"{path['module']}/example.com/example.crt"),
certificate_chain=(lambda path: open(path).read())(f"{path['module']}/example.com/ca.crt"),
certificate_name="example-api",
certificate_private_key=(lambda path: open(path).read())(f"{path['module']}/example.com/example.key"),
domain_name="example.com")
test = aws.apigateway.BasePathMapping("test",
rest_api=aws_api_gateway_rest_api["MyDemoAPI"]["id"],
domain_name=example_domain_name.domain_name,
stage_name=example_deployment.stage_name)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fs from "fs";
const exampleDeployment = new aws.apigateway.Deployment("example", {
// See aws_api_gateway_rest_api docs for how to create this
restApi: aws_api_gateway_rest_api_MyDemoAPI.id,
stageName: "live",
});
const exampleDomainName = new aws.apigateway.DomainName("example", {
certificateBody: fs.readFileSync(`./example.com/example.crt`, "utf-8"),
certificateChain: fs.readFileSync(`./example.com/ca.crt`, "utf-8"),
certificateName: "example-api",
certificatePrivateKey: fs.readFileSync(`./example.com/example.key`, "utf-8"),
domainName: "example.com",
});
const test = new aws.apigateway.BasePathMapping("test", {
restApi: aws_api_gateway_rest_api_MyDemoAPI.id,
domainName: exampleDomainName.domainName,
stageName: exampleDeployment.stageName,
});Create a BasePathMapping Resource
new BasePathMapping(name: string, args: BasePathMappingArgs, opts?: CustomResourceOptions);def BasePathMapping(resource_name, opts=None, base_path=None, domain_name=None, rest_api=None, stage_name=None, __props__=None);func NewBasePathMapping(ctx *Context, name string, args BasePathMappingArgs, opts ...ResourceOption) (*BasePathMapping, error)public BasePathMapping(string name, BasePathMappingArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args BasePathMappingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BasePathMappingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BasePathMappingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
BasePathMapping Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The BasePathMapping resource accepts the following input properties:
- Domain
Name string The already-registered domain name to connect the API to.
- Rest
Api string The id of the API to connect.
- Base
Path 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.
- Stage
Name string The 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.
- Domain
Name string The already-registered domain name to connect the API to.
- Rest
Api interface{} The id of the API to connect.
- Base
Path 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.
- Stage
Name string The 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.
- domain
Name string The already-registered domain name to connect the API to.
- rest
Api string | RestApi The id of the API to connect.
- base
Path 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.
- stage
Name string The 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.
- domain_
name str The already-registered domain name to connect the API to.
- rest_
api string | str The id of the API to connect.
- base_
path str 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.
- stage_
name str The 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the BasePathMapping resource produces the following output properties:
Look up an Existing BasePathMapping Resource
Get an existing BasePathMapping resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BasePathMappingState, opts?: CustomResourceOptions): BasePathMappingstatic get(resource_name, id, opts=None, base_path=None, domain_name=None, rest_api=None, stage_name=None, __props__=None);func GetBasePathMapping(ctx *Context, name string, id IDInput, state *BasePathMappingState, opts ...ResourceOption) (*BasePathMapping, error)public static BasePathMapping Get(string name, Input<string> id, BasePathMappingState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Base
Path 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.
- Domain
Name string The already-registered domain name to connect the API to.
- Rest
Api string The id of the API to connect.
- Stage
Name string The 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.
- Base
Path 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.
- Domain
Name string The already-registered domain name to connect the API to.
- Rest
Api interface{} The id of the API to connect.
- Stage
Name string The 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.
- base
Path 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.
- domain
Name string The already-registered domain name to connect the API to.
- rest
Api string | RestApi The id of the API to connect.
- stage
Name string The 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.
- base_
path str 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.
- domain_
name str The already-registered domain name to connect the API to.
- rest_
api string | str The id of the API to connect.
- stage_
name str The 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.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.