class ApiMapping (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGatewayv2.ApiMapping |
Java | software.amazon.awscdk.services.apigatewayv2.ApiMapping |
Python | aws_cdk.aws_apigatewayv2.ApiMapping |
TypeScript (source) | @aws-cdk/aws-apigatewayv2 » ApiMapping |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IApi
Create a new API mapping for API Gateway API endpoint.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2';
declare const api: apigatewayv2.IApi;
declare const domainName: apigatewayv2.DomainName;
declare const stage: apigatewayv2.IStage;
const apiMapping = new apigatewayv2.ApiMapping(this, 'MyApiMapping', {
api: api,
domainName: domainName,
// the properties below are optional
apiMappingKey: 'apiMappingKey',
stage: stage,
});
Initializer
new ApiMapping(scope: Construct, id: string, props: ApiMappingProps)
Parameters
- scope
Construct
- id
string
- props
Api
Mapping Props
Construct Props
Name | Type | Description |
---|---|---|
api | IApi | The Api to which this mapping is applied. |
domain | IDomain | custom domain name of the mapping target. |
api | string | Api mapping key. |
stage? | IStage | stage for the ApiMapping resource required for WebSocket API defaults to default stage of an HTTP API. |
api
Type:
IApi
The Api to which this mapping is applied.
domainName
Type:
IDomain
custom domain name of the mapping target.
apiMappingKey?
Type:
string
(optional, default: undefined for the root path mapping.)
Api mapping key.
The path where this stage should be mapped to on the domain
stage?
Type:
IStage
(optional, default: Default stage of the passed API for HTTP API, required for WebSocket API)
stage for the ApiMapping resource required for WebSocket API defaults to default stage of an HTTP API.
Properties
Name | Type | Description |
---|---|---|
api | string | ID of the API Mapping. |
domain | IDomain | API domain name. |
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
mapping | string | API Mapping key. |
apiMappingId
Type:
string
ID of the API Mapping.
domainName
Type:
IDomain
API domain name.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
mappingKey?
Type:
string
(optional)
API Mapping key.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | import from API ID. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ApiMappingAttributes(scope, id, attrs)
static frompublic static fromApiMappingAttributes(scope: Construct, id: string, attrs: ApiMappingAttributes): IApiMapping
Parameters
- scope
Construct
- id
string
- attrs
Api
Mapping Attributes
Returns
import from API ID.