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](https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/domainnames-domainname-apimappings.html#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 = 'us-east-1' 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 = 'us-east-1';
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 }}';
/*+ create */
INSERT INTO awscc.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiMappingKey,
ApiId,
region
)
SELECT
'{{ domain_name }}',
'{{ stage }}',
'{{ api_mapping_key }}',
'{{ api_id }}',
'{{ region }}';
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.apigatewayv2.api_mappings
WHERE
Identifier = '{{ api_mapping_id }}|{{ domain_name }}' AND
region = 'us-east-1';
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