AddRoutesOptions

class aws_cdk.aws_apigatewayv2.AddRoutesOptions(*, integration, path, authorization_scopes=None, authorizer=None, methods=None)

Bases: BatchHttpRouteOptions

(experimental) Options for the Route with Integration resource.

Parameters:
  • integration (HttpRouteIntegration) – (experimental) The integration to be configured on this route.

  • path (str) – (experimental) The path at which all of these routes are configured.

  • authorization_scopes (Optional[Sequence[str]]) – (experimental) The list of OIDC scopes to include in the authorization. These scopes will override the default authorization scopes on the gateway. Set to [] to remove default scopes Default: - uses defaultAuthorizationScopes if configured on the API, otherwise none.

  • authorizer (Optional[IHttpRouteAuthorizer]) – (experimental) Authorizer to be associated to these routes. Use NoneAuthorizer to remove the default authorizer for the api Default: - uses the default authorizer if one is specified on the HttpApi

  • methods (Optional[Sequence[HttpMethod]]) – (experimental) The HTTP methods to be configured. Default: HttpMethod.ANY

Stability:

experimental

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_authorizers import HttpLambdaAuthorizer, HttpLambdaResponseType
from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration

# This function handles your auth logic
# auth_handler: lambda.Function


authorizer = HttpLambdaAuthorizer("BooksAuthorizer", auth_handler,
    response_types=[HttpLambdaResponseType.SIMPLE]
)

api = apigwv2.HttpApi(self, "HttpApi")

api.add_routes(
    integration=HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.myproxy.internal"),
    path="/books",
    authorizer=authorizer
)

Attributes

authorization_scopes

(experimental) The list of OIDC scopes to include in the authorization.

These scopes will override the default authorization scopes on the gateway. Set to [] to remove default scopes

Default:
  • uses defaultAuthorizationScopes if configured on the API, otherwise none.

Stability:

experimental

authorizer

(experimental) Authorizer to be associated to these routes.

Use NoneAuthorizer to remove the default authorizer for the api

Default:
  • uses the default authorizer if one is specified on the HttpApi

Stability:

experimental

integration

(experimental) The integration to be configured on this route.

Stability:

experimental

methods

(experimental) The HTTP methods to be configured.

Default:

HttpMethod.ANY

Stability:

experimental

path

(experimental) The path at which all of these routes are configured.

Stability:

experimental