Skip to content
v2.275.0

CfnRouteProps Struct ​

Properties for defining a CfnRoute.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';

declare const requestModels: any;
declare const requestParameters: any;
const cfnRouteProps: apigatewayv2.CfnRouteProps = {
  apiId: 'apiId',
  routeKey: 'routeKey',

  // the properties below are optional
  apiKeyRequired: false,
  authorizationScopes: ['authorizationScopes'],
  authorizationType: 'authorizationType',
  authorizerId: 'authorizerId',
  modelSelectionExpression: 'modelSelectionExpression',
  operationName: 'operationName',
  requestModels: requestModels,
  requestParameters: requestParameters,
  routeResponseSelectionExpression: 'routeResponseSelectionExpression',
  target: 'target',
};

Properties ​

apiIdstring | IApiRefapi_idtyping.Union[str, IApiRef]apiIdStringApiIdstringApiIdinterface{}required#
The API identifier.
apiKeyRequiredoptionalboolean | IResolvableapi_key_requiredoptionaltyping.Union[bool, IResolvable]apiKeyRequiredoptionalBooleanApiKeyRequiredoptionalboolApiKeyRequiredoptionalinterface{}#
Specifies whether an API key is required for the route.

Supported only for WebSocket APIs.

authorizationScopesoptionalstring[]authorization_scopesoptionaltyping.List[str]authorizationScopesoptionalList<String>AuthorizationScopesoptionalstring[]AuthorizationScopesoptional*[]*string#
The authorization scopes supported by this route.
authorizationTypeoptionalstringauthorization_typeoptionalstrauthorizationTypeoptionalStringAuthorizationTypeoptionalstringAuthorizationTypeoptional*string#
The authorization type for the route.
notes

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.

authorizerIdoptionalstring | IAuthorizerRefauthorizer_idoptionaltyping.Union[str, IAuthorizerRef]authorizerIdoptionalStringAuthorizerIdoptionalstringAuthorizerIdoptionalinterface{}#
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.

modelSelectionExpressionoptionalstringmodel_selection_expressionoptionalstrmodelSelectionExpressionoptionalStringModelSelectionExpressionoptionalstringModelSelectionExpressionoptional*string#
The model selection expression for the route.

Supported only for WebSocket APIs.

operationNameoptionalstringoperation_nameoptionalstroperationNameoptionalStringOperationNameoptionalstringOperationNameoptional*string#
The operation name for the route.
requestModelsoptionalanyrequest_modelsoptionalAnyrequestModelsoptionalObjectRequestModelsoptionalobjectRequestModelsoptionalinterface{}#
The request models for the route.

Supported only for WebSocket APIs.

requestParametersoptionalanyrequest_parametersoptionalAnyrequestParametersoptionalObjectRequestParametersoptionalobjectRequestParametersoptionalinterface{}#
The request parameters for the route.

Supported only for WebSocket APIs.

routeKeystringroute_keystrrouteKeyStringRouteKeystringRouteKey*stringrequired#
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 .

routeResponseSelectionExpressionoptionalstringroute_response_selection_expressionoptionalstrrouteResponseSelectionExpressionoptionalStringRouteResponseSelectionExpressionoptionalstringRouteResponseSelectionExpressionoptional*string#
The route response selection expression for the route.

Supported only for WebSocket APIs.

targetoptionalstring | IIntegrationReftargetoptionaltyping.Union[str, IIntegrationRef]targetoptionalStringTargetoptionalstringTargetoptionalinterface{}#
The target for the route.