routes
Creates, updates, deletes or gets a route
resource or lists routes
in a region
Overview
Name | routes |
Type | Resource |
Description | The AWS::ApiGatewayV2::Route resource creates a route for an API. |
Id | aws.apigatewayv2.routes |
Fields
Name | Datatype | Description |
---|---|---|
route_id | string | |
route_response_selection_expression | string | The route response selection expression for the route. Supported only for WebSocket APIs. |
request_models | object | The request models for the route. Supported only for WebSocket APIs. |
operation_name | string | The operation name for the route. |
authorization_scopes | array | The authorization scopes supported by this route. |
api_key_required | boolean | Specifies whether an API key is required for the route. Supported only for WebSocket APIs. |
route_key | string | The route key for the route. For HTTP APIs, the route key can be either $default , or a combination of an HTTP method and resource path, for example, GET /pets . |
authorization_type | string | The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. |
model_selection_expression | string | The model selection expression for the route. Supported only for WebSocket APIs. |
api_id | string | The API identifier. |
request_parameters | object | The request parameters for the route. Supported only for WebSocket APIs. |
target | string | The target for the route. |
authorizer_id | string | The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | RouteKey, 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 routes
in a region.
SELECT
region,
route_id,
route_response_selection_expression,
request_models,
operation_name,
authorization_scopes,
api_key_required,
route_key,
authorization_type,
model_selection_expression,
api_id,
request_parameters,
target,
authorizer_id
FROM aws.apigatewayv2.routes
WHERE region = 'us-east-1';
Gets all properties from an individual route
.
SELECT
region,
route_id,
route_response_selection_expression,
request_models,
operation_name,
authorization_scopes,
api_key_required,
route_key,
authorization_type,
model_selection_expression,
api_id,
request_parameters,
target,
authorizer_id
FROM aws.apigatewayv2.routes
WHERE region = 'us-east-1' AND data__Identifier = '<ApiId>|<RouteId>';
INSERT
example
Use the following StackQL query and manifest file to create a new route
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.apigatewayv2.routes (
RouteKey,
ApiId,
region
)
SELECT
'{{ RouteKey }}',
'{{ ApiId }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigatewayv2.routes (
RouteResponseSelectionExpression,
RequestModels,
OperationName,
AuthorizationScopes,
ApiKeyRequired,
RouteKey,
AuthorizationType,
ModelSelectionExpression,
ApiId,
RequestParameters,
Target,
AuthorizerId,
region
)
SELECT
'{{ RouteResponseSelectionExpression }}',
'{{ RequestModels }}',
'{{ OperationName }}',
'{{ AuthorizationScopes }}',
'{{ ApiKeyRequired }}',
'{{ RouteKey }}',
'{{ AuthorizationType }}',
'{{ ModelSelectionExpression }}',
'{{ ApiId }}',
'{{ RequestParameters }}',
'{{ Target }}',
'{{ AuthorizerId }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: route
props:
- name: RouteResponseSelectionExpression
value: '{{ RouteResponseSelectionExpression }}'
- name: RequestModels
value: {}
- name: OperationName
value: '{{ OperationName }}'
- name: AuthorizationScopes
value:
- '{{ AuthorizationScopes[0] }}'
- name: ApiKeyRequired
value: '{{ ApiKeyRequired }}'
- name: RouteKey
value: '{{ RouteKey }}'
- name: AuthorizationType
value: '{{ AuthorizationType }}'
- name: ModelSelectionExpression
value: '{{ ModelSelectionExpression }}'
- name: ApiId
value: '{{ ApiId }}'
- name: RequestParameters
value: {}
- name: Target
value: '{{ Target }}'
- name: AuthorizerId
value: '{{ AuthorizerId }}'
DELETE
example
/*+ delete */
DELETE FROM aws.apigatewayv2.routes
WHERE data__Identifier = '<ApiId|RouteId>'
AND region = 'us-east-1';
Permissions
To operate on the routes
resource, the following permissions are required:
Create
apigateway:POST
Update
apigateway:PATCH,
apigateway:GET,
apigateway:PUT
Read
apigateway:GET
Delete
apigateway:GET,
apigateway:DELETE
List
apigateway:GET