HttpApiProps

class aws_cdk.aws_apigatewayv2.HttpApiProps(*, api_name=None, cors_preflight=None, create_default_stage=None, default_authorization_scopes=None, default_authorizer=None, default_domain_mapping=None, default_integration=None, description=None, disable_execute_api_endpoint=None)

Bases: object

Properties to initialize an instance of HttpApi.

Parameters:
  • api_name (Optional[str]) – Name for the HTTP API resource. Default: - id of the HttpApi construct.

  • cors_preflight (Union[CorsPreflightOptions, Dict[str, Any], None]) – Specifies a CORS configuration for an API. Default: - CORS disabled.

  • create_default_stage (Optional[bool]) – Whether a default stage and deployment should be automatically created. Default: true

  • default_authorization_scopes (Optional[Sequence[str]]) – Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route. The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. Default: - no default authorization scopes

  • default_authorizer (Optional[IHttpRouteAuthorizer]) – Default Authorizer applied to all routes in the gateway. Default: - no default authorizer

  • default_domain_mapping (Union[DomainMappingOptions, Dict[str, Any], None]) – Configure a custom domain with the API mapping resource to the HTTP API. Default: - no default domain mapping configured. meaningless if createDefaultStage is false.

  • default_integration (Optional[HttpRouteIntegration]) – An integration that will be configured on the catch-all route ($default). Default: - none

  • description (Optional[str]) – The description of the API. Default: - none

  • disable_execute_api_endpoint (Optional[bool]) – Specifies whether clients can invoke your API using the default endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. Enable this if you would like clients to use your custom domain name. Default: false execute-api endpoint enabled.

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_integrations import HttpAlbIntegration

# lb: elbv2.ApplicationLoadBalancer

listener = lb.add_listener("listener", port=80)
listener.add_targets("target",
    port=80
)

http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
    default_integration=HttpAlbIntegration("DefaultIntegration", listener,
        parameter_mapping=apigwv2.ParameterMapping().custom("myKey", "myValue")
    )
)

Attributes

api_name

Name for the HTTP API resource.

Default:
  • id of the HttpApi construct.

cors_preflight

Specifies a CORS configuration for an API.

Default:
  • CORS disabled.

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html

create_default_stage

Whether a default stage and deployment should be automatically created.

Default:

true

default_authorization_scopes

Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.

The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation.

Default:
  • no default authorization scopes

default_authorizer

Default Authorizer applied to all routes in the gateway.

Default:
  • no default authorizer

default_domain_mapping

Configure a custom domain with the API mapping resource to the HTTP API.

Default:
  • no default domain mapping configured. meaningless if createDefaultStage is false.

default_integration

An integration that will be configured on the catch-all route ($default).

Default:
  • none

description

The description of the API.

Default:
  • none

disable_execute_api_endpoint

Specifies whether clients can invoke your API using the default endpoint.

By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. Enable this if you would like clients to use your custom domain name.

Default:

false execute-api endpoint enabled.