api_mappings
Creates, updates, deletes or gets an api_mapping resource or lists api_mappings in a region
Overview
| Name | api_mappings |
| Type | Resource |
| Description | The AWS::ApiGatewayV2::ApiMapping resource contains an API mapping. An API mapping relates a path of your custom domain name to a stage of your API. A custom domain name can have multiple API mappings, but the paths can't overlap. A custom domain can map only to APIs of the same protocol type. For more information, see CreateApiMapping in the Amazon API Gateway V2 API Reference. |
| Id | awscc.apigatewayv2.api_mappings |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
api_mapping_id | string | |
domain_name | string | The domain name. |
stage | string | The API stage. |
api_mapping_key | string | The API mapping key. |
api_id | string | The identifier of the API. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
api_mapping_id | string | |
domain_name | string | The domain name. |
region | string | AWS region. |
For more information, see AWS::ApiGatewayV2::ApiMapping.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | api_mappings | INSERT | DomainName, Stage, ApiId, region |
delete_resource | api_mappings | DELETE | Identifier, region |
update_resource | api_mappings | UPDATE | Identifier, PatchDocument, region |
list_resources | api_mappings_list_only | SELECT | region |
get_resource | api_mappings | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual api_mapping.
SELECT
region,
api_mapping_id,
domain_name,
stage,
api_mapping_key,
api_id
FROM awscc.apigatewayv2.api_mappings
WHERE
region = '{{ region }}' AND
Identifier = '{{ api_mapping_id }}|{{ domain_name }}';
Lists all api_mappings in a region.
SELECT
region,
api_mapping_id,
domain_name
FROM awscc.apigatewayv2.api_mappings_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new api_mapping resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiId,
region
)
SELECT
'{{ domain_name }}',
'{{ stage }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiMappingKey,
ApiId,
region
)
SELECT
'{{ domain_name }}',
'{{ stage }}',
'{{ api_mapping_key }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: api_mapping
props:
- name: domain_name
value: '{{ domain_name }}'
- name: stage
value: '{{ stage }}'
- name: api_mapping_key
value: '{{ api_mapping_key }}'
- name: api_id
value: '{{ api_id }}'
UPDATE example
Use the following StackQL query and manifest file to update a api_mapping resource, using stack-deploy.
/*+ update */
UPDATE awscc.apigatewayv2.api_mappings
SET PatchDocument = string('{{ {
"Stage": stage,
"ApiMappingKey": api_mapping_key,
"ApiId": api_id
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ api_mapping_id }}|{{ domain_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.apigatewayv2.api_mappings
WHERE
Identifier = '{{ api_mapping_id }}|{{ domain_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the api_mappings resource, the following permissions are required:
- Create
- Update
- Read
- Delete
- List
apigateway:POST
apigateway:PATCH,
apigateway:GET,
apigateway:PUT
apigateway:GET
apigateway:DELETE
apigateway:GET