Skip to main content

routes

Creates, updates, deletes or gets a route resource or lists routes in a region

Overview

Nameroutes
TypeResource
DescriptionThe ``AWS::ApiGatewayV2::Route`` resource creates a route for an API.
Idawscc.apigatewayv2.routes

Fields

NameDatatypeDescription
route_idstring
route_response_selection_expressionstringThe route response selection expression for the route. Supported only for WebSocket APIs.
request_modelsobjectThe request models for the route. Supported only for WebSocket APIs.
operation_namestringThe operation name for the route.
authorization_scopesarrayThe authorization scopes supported by this route.
api_key_requiredbooleanSpecifies whether an API key is required for the route. Supported only for WebSocket APIs.
route_keystringThe 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_typestringThe 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_expressionstringThe model selection expression for the route. Supported only for WebSocket APIs.
api_idstringThe API identifier.
request_parametersobjectThe request parameters for the route. Supported only for WebSocket APIs.
targetstringThe target for the route.
authorizer_idstringThe identifier of the ``Authorizer`` resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.
regionstringAWS region.

For more information, see AWS::ApiGatewayV2::Route.

Methods

NameResourceAccessible byRequired Params
create_resourceroutesINSERTRouteKey, ApiId, region
delete_resourceroutesDELETEIdentifier, region
update_resourceroutesUPDATEIdentifier, PatchDocument, region
list_resourcesroutes_list_onlySELECTregion
get_resourceroutesSELECTIdentifier, region

SELECT examples

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 }}';

INSERT example

Use the following StackQL query and manifest file to create a new route resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.apigatewayv2.routes (
RouteKey,
ApiId,
region
)
SELECT
'{{ route_key }}',
'{{ api_id }}',
'{{ region }}';

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:

apigateway:POST