Skip to main content

api_mappings

Creates, updates, deletes or gets an api_mapping resource or lists api_mappings in a region

Overview

Nameapi_mappings
TypeResource
DescriptionThe 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.
Idawscc.apigatewayv2.api_mappings

Fields

NameDatatypeDescription
api_mapping_idstring
domain_namestringThe domain name.
stagestringThe API stage.
api_mapping_keystringThe API mapping key.
api_idstringThe identifier of the API.
regionstringAWS region.

For more information, see AWS::ApiGatewayV2::ApiMapping.

Methods

NameResourceAccessible byRequired Params
create_resourceapi_mappingsINSERTDomainName, Stage, ApiId, region
delete_resourceapi_mappingsDELETEIdentifier, region
update_resourceapi_mappingsUPDATEIdentifier, PatchDocument, region
list_resourcesapi_mappings_list_onlySELECTregion
get_resourceapi_mappingsSELECTIdentifier, region

SELECT examples

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 }}';

INSERT example

Use the following StackQL query and manifest file to create a new api_mapping resource, using stack-deploy.

/*+ 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
;

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:

ParameterDescription
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:

apigateway:POST