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

(experimental) Properties to initialize an instance of HttpApi.

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

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

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

  • default_authorization_scopes (Optional[Sequence[str]]) – (experimental) Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route. Default: - no default authorization scopes

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

  • default_domain_mapping (Union[DomainMappingOptions, Dict[str, Any], None]) – (experimental) 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]) – (experimental) An integration that will be configured on the catch-all route ($default). Default: - none

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

  • disable_execute_api_endpoint (Optional[bool]) – (experimental) 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.

Stability:

experimental

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

(experimental) Name for the HTTP API resource.

Default:
  • id of the HttpApi construct.

Stability:

experimental

cors_preflight

(experimental) Specifies a CORS configuration for an API.

Default:
  • CORS disabled.

See:

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

Stability:

experimental

create_default_stage

(experimental) Whether a default stage and deployment should be automatically created.

Default:

true

Stability:

experimental

default_authorization_scopes

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

Default:
  • no default authorization scopes

Stability:

experimental

default_authorizer

(experimental) Default Authorizer to applied to all routes in the gateway.

Default:
  • No authorizer

Stability:

experimental

default_domain_mapping

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

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

Stability:

experimental

default_integration

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

Default:
  • none

Stability:

experimental

description

(experimental) The description of the API.

Default:
  • none

Stability:

experimental

disable_execute_api_endpoint

(experimental) 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.

Stability:

experimental