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 | awscc.apigatewayv2.routes |
Fields
- get (all properties)
- list (identifiers only)
| 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. |
| Name | Datatype | Description |
|---|---|---|
route_id | string | |
api_id | string | The API identifier. |
region | string | AWS region. |
For more information, see AWS::ApiGatewayV2::Route.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | routes | INSERT | RouteKey, ApiId, region |
delete_resource | routes | DELETE | Identifier, region |
update_resource | routes | UPDATE | Identifier, PatchDocument, region |
list_resources | routes_list_only | SELECT | region |
get_resource | routes | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 awscc.apigatewayv2.routes
WHERE
region = 'us-east-1' AND
Identifier = '{{ api_id }}|{{ route_id }}';
Lists all routes in a region.
SELECT
region,
api_id,
route_id
FROM awscc.apigatewayv2.routes_list_only
WHERE
region = 'us-east-1';
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 awscc.apigatewayv2.routes (
RouteKey,
ApiId,
region
)
SELECT
'{{ route_key }}',
'{{ api_id }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.apigatewayv2.routes (
RouteResponseSelectionExpression,
RequestModels,
OperationName,
AuthorizationScopes,
ApiKeyRequired,
RouteKey,
AuthorizationType,
ModelSelectionExpression,
ApiId,
RequestParameters,
Target,
AuthorizerId,
region
)
SELECT
'{{ 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 }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: route
props:
- name: route_response_selection_expression
value: '{{ route_response_selection_expression }}'
- name: request_models
value: {}
- name: operation_name
value: '{{ operation_name }}'
- name: authorization_scopes
value:
- '{{ authorization_scopes[0] }}'
- name: api_key_required
value: '{{ api_key_required }}'
- name: route_key
value: '{{ route_key }}'
- name: authorization_type
value: '{{ authorization_type }}'
- name: model_selection_expression
value: '{{ model_selection_expression }}'
- name: api_id
value: '{{ api_id }}'
- name: request_parameters
value: {}
- name: target
value: '{{ target }}'
- name: authorizer_id
value: '{{ authorizer_id }}'
UPDATE example
Use the following StackQL query and manifest file to update a route resource, using stack-deploy.
/*+ update */
UPDATE awscc.apigatewayv2.routes
SET PatchDocument = string('{{ {
"RouteResponseSelectionExpression": route_response_selection_expression,
"RequestModels": request_models,
"OperationName": operation_name,
"AuthorizationScopes": authorization_scopes,
"ApiKeyRequired": api_key_required,
"RouteKey": route_key,
"AuthorizationType": authorization_type,
"ModelSelectionExpression": model_selection_expression,
"RequestParameters": request_parameters,
"Target": target,
"AuthorizerId": authorizer_id
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ api_id }}|{{ route_id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.apigatewayv2.routes
WHERE
Identifier = '{{ api_id }}|{{ route_id }}' AND
region = 'us-east-1';
Permissions
To operate on the routes resource, the following permissions are required:
- Create
- Update
- Read
- Delete
- List
apigateway:POST
apigateway:PATCH,
apigateway:GET,
apigateway:PUT
apigateway:GET
apigateway:GET,
apigateway:DELETE
apigateway:GET