routes
Creates, updates, deletes, gets or lists a routes resource.
Overview
| Name | routes |
| Type | Resource |
| Id | aws.apigatewayv2.routes |
Fields
The following fields are returned by SELECT queries:
- get_route
- get_routes
| Name | Datatype | Description |
|---|---|---|
api_gateway_managed | boolean | Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key. |
api_key_required | boolean | Specifies whether an API key is required for this route. Supported only for WebSocket APIs. |
authorization_scopes | array | A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes. |
authorization_type | string | The authorization type. 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. (NONE, AWS_IAM, CUSTOM, JWT) |
authorizer_id | string | The identifier. |
model_selection_expression | string | An expression used to extract information at runtime. See Selection Expressions for more information. |
operation_name | string | A string with a length between [1-64]. |
request_models | object | The request models for the route. Supported only for WebSocket APIs. |
request_parameters | object | The request parameters for the route. Supported only for WebSocket APIs. |
route_id | string | The identifier. |
route_key | string | After evaluating a selection expression, the result is compared against one or more selection keys to find a matching key. See Selection Expressions for a list of expressions and each expression's associated selection key type. |
route_response_selection_expression | string | An expression used to extract information at runtime. See Selection Expressions for more information. |
target | string | A string with a length between [1-128]. |
| Name | Datatype | Description |
|---|---|---|
api_gateway_managed | boolean | Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key. |
api_key_required | boolean | Specifies whether an API key is required for this route. Supported only for WebSocket APIs. |
authorization_scopes | array | A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes. |
authorization_type | string | The authorization type. 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. (NONE, AWS_IAM, CUSTOM, JWT) |
authorizer_id | string | The identifier. |
model_selection_expression | string | An expression used to extract information at runtime. See Selection Expressions for more information. |
operation_name | string | A string with a length between [1-64]. |
request_models | object | The request models for the route. Supported only for WebSocket APIs. |
request_parameters | object | The request parameters for the route. Supported only for WebSocket APIs. |
route_id | string | The identifier. |
route_key | string | After evaluating a selection expression, the result is compared against one or more selection keys to find a matching key. See Selection Expressions for a list of expressions and each expression's associated selection key type. |
route_response_selection_expression | string | An expression used to extract information at runtime. See Selection Expressions for more information. |
target | string | A string with a length between [1-128]. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_route | select | api_id, route_id, region | Gets a Route. | |
get_routes | select | api_id, region | maxResults, nextToken | Gets the Routes for an API. |
create_route | insert | api_id, region, RouteKey | Creates a Route for an API. | |
update_route | update | api_id, route_id, region | Updates a Route. | |
delete_route_request_parameter | delete | api_id, request_parameter_key, route_id, region | Deletes a route request parameter. Supported only for WebSocket APIs. | |
delete_route_settings | delete | api_id, route_key, stage_name, region | Deletes the RouteSettings for a stage. | |
delete_route | delete | api_id, route_id, region | Deletes a Route. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_id | string | The API identifier. |
region | string | AWS region (default: us-east-1) |
request_parameter_key | string | The route request parameter key. |
route_id | string | The route ID. |
route_key | string | The route key. |
stage_name | string | The stage name. Stage names can only contain alphanumeric characters, hyphens, and underscores. Maximum length is 128 characters. |
maxResults | string | The maximum number of elements to be returned for this resource. |
nextToken | string | The next page of elements from this collection. Not valid for the last element of the collection. |
SELECT examples
- get_route
- get_routes
Gets a Route.
SELECT
api_gateway_managed,
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
model_selection_expression,
operation_name,
request_models,
request_parameters,
route_id,
route_key,
route_response_selection_expression,
target
FROM aws.apigatewayv2.routes
WHERE api_id = '{{ api_id }}' -- required
AND route_id = '{{ route_id }}' -- required
AND region = '{{ region }}' -- required
;
Gets the Routes for an API.
SELECT
api_gateway_managed,
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
model_selection_expression,
operation_name,
request_models,
request_parameters,
route_id,
route_key,
route_response_selection_expression,
target
FROM aws.apigatewayv2.routes
WHERE api_id = '{{ api_id }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
;
INSERT examples
- create_route
- Manifest
Creates a Route for an API.
INSERT INTO aws.apigatewayv2.routes (
ApiKeyRequired,
AuthorizationScopes,
AuthorizationType,
AuthorizerId,
ModelSelectionExpression,
OperationName,
RequestModels,
RequestParameters,
RouteKey,
RouteResponseSelectionExpression,
Target,
api_id,
region
)
SELECT
{{ ApiKeyRequired }},
'{{ AuthorizationScopes }}',
'{{ AuthorizationType }}',
'{{ AuthorizerId }}',
'{{ ModelSelectionExpression }}',
'{{ OperationName }}',
'{{ RequestModels }}',
'{{ RequestParameters }}',
'{{ RouteKey }}' /* required */,
'{{ RouteResponseSelectionExpression }}',
'{{ Target }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
api_gateway_managed,
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
model_selection_expression,
operation_name,
request_models,
request_parameters,
route_id,
route_key,
route_response_selection_expression,
target
;
# Description fields are for documentation purposes
- name: routes
props:
- name: api_id
value: "{{ api_id }}"
description: Required parameter for the routes resource.
- name: region
value: "{{ region }}"
description: Required parameter for the routes resource.
- name: ApiKeyRequired
value: {{ ApiKeyRequired }}
- name: AuthorizationScopes
value:
- "{{ AuthorizationScopes }}"
description: |
A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
- name: AuthorizationType
value: "{{ AuthorizationType }}"
description: |
The authorization type. 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.
valid_values: ['NONE', 'AWS_IAM', 'CUSTOM', 'JWT']
- name: AuthorizerId
value: "{{ AuthorizerId }}"
description: |
The identifier.
- name: ModelSelectionExpression
value: "{{ ModelSelectionExpression }}"
description: |
An expression used to extract information at runtime. See Selection Expressions for more information.
- name: OperationName
value: "{{ OperationName }}"
description: |
A string with a length between [1-64].
- name: RequestModels
value: "{{ RequestModels }}"
description: |
The route models.
- name: RequestParameters
value: "{{ RequestParameters }}"
description: |
The route parameters.
- name: RouteKey
value: "{{ RouteKey }}"
description: |
After evaluating a selection expression, the result is compared against one or more selection keys to find a matching key. See Selection Expressions for a list of expressions and each expression's associated selection key type.
- name: RouteResponseSelectionExpression
value: "{{ RouteResponseSelectionExpression }}"
description: |
An expression used to extract information at runtime. See Selection Expressions for more information.
- name: Target
value: "{{ Target }}"
description: |
A string with a length between [1-128].
UPDATE examples
- update_route
Updates a Route.
UPDATE aws.apigatewayv2.routes
SET
ApiKeyRequired = {{ ApiKeyRequired }},
AuthorizationScopes = '{{ AuthorizationScopes }}',
AuthorizationType = '{{ AuthorizationType }}',
AuthorizerId = '{{ AuthorizerId }}',
ModelSelectionExpression = '{{ ModelSelectionExpression }}',
OperationName = '{{ OperationName }}',
RequestModels = '{{ RequestModels }}',
RequestParameters = '{{ RequestParameters }}',
RouteKey = '{{ RouteKey }}',
RouteResponseSelectionExpression = '{{ RouteResponseSelectionExpression }}',
Target = '{{ Target }}'
WHERE
api_id = '{{ api_id }}' --required
AND route_id = '{{ route_id }}' --required
AND region = '{{ region }}' --required
RETURNING
api_gateway_managed,
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
model_selection_expression,
operation_name,
request_models,
request_parameters,
route_id,
route_key,
route_response_selection_expression,
target;
DELETE examples
- delete_route_request_parameter
- delete_route_settings
- delete_route
Deletes a route request parameter. Supported only for WebSocket APIs.
DELETE FROM aws.apigatewayv2.routes
WHERE api_id = '{{ api_id }}' --required
AND request_parameter_key = '{{ request_parameter_key }}' --required
AND route_id = '{{ route_id }}' --required
AND region = '{{ region }}' --required
;
Deletes the RouteSettings for a stage.
DELETE FROM aws.apigatewayv2.routes
WHERE api_id = '{{ api_id }}' --required
AND route_key = '{{ route_key }}' --required
AND stage_name = '{{ stage_name }}' --required
AND region = '{{ region }}' --required
;
Deletes a Route.
DELETE FROM aws.apigatewayv2.routes
WHERE api_id = '{{ api_id }}' --required
AND route_id = '{{ route_id }}' --required
AND region = '{{ region }}' --required
;