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 | aws.apigatewayv2.api_mappings |
Fields
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. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | DomainName, Stage, ApiId, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all api_mappings
in a region.
SELECT
region,
api_mapping_id,
domain_name,
stage,
api_mapping_key,
api_id
FROM aws.apigatewayv2.api_mappings
WHERE region = 'us-east-1';
Gets all properties from an individual api_mapping
.
SELECT
region,
api_mapping_id,
domain_name,
stage,
api_mapping_key,
api_id
FROM aws.apigatewayv2.api_mappings
WHERE region = 'us-east-1' AND data__Identifier = '<ApiMappingId>|<DomainName>';
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 aws.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiId,
region
)
SELECT
'{{ DomainName }}',
'{{ Stage }}',
'{{ ApiId }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiMappingKey,
ApiId,
region
)
SELECT
'{{ DomainName }}',
'{{ Stage }}',
'{{ ApiMappingKey }}',
'{{ ApiId }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: api_mapping
props:
- name: DomainName
value: '{{ DomainName }}'
- name: Stage
value: '{{ Stage }}'
- name: ApiMappingKey
value: '{{ ApiMappingKey }}'
- name: ApiId
value: '{{ ApiId }}'
DELETE
example
/*+ delete */
DELETE FROM aws.apigatewayv2.api_mappings
WHERE data__Identifier = '<ApiMappingId|DomainName>'
AND region = 'us-east-1';
Permissions
To operate on the api_mappings
resource, the following permissions are required:
Create
apigateway:POST
Update
apigateway:PATCH,
apigateway:GET,
apigateway:PUT
Read
apigateway:GET
Delete
apigateway:DELETE
List
apigateway:GET