CfnApiPropsMixin

class aws_cdk.mixins_preview.aws_apigatewayv2.mixins.CfnApiPropsMixin(props, *, strategy=None)

Bases: Mixin

The AWS::ApiGatewayV2::Api resource creates an API.

WebSocket APIs and HTTP APIs are supported. For more information about WebSocket APIs, see About WebSocket APIs in API Gateway in the API Gateway Developer Guide . For more information about HTTP APIs, see HTTP APIs in the API Gateway Developer Guide.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html

CloudformationResource:

AWS::ApiGatewayV2::Api

Mixin:

true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview import mixins
from aws_cdk.mixins_preview.aws_apigatewayv2 import mixins as apigatewayv2_mixins

# body: Any

cfn_api_props_mixin = apigatewayv2_mixins.CfnApiPropsMixin(apigatewayv2_mixins.CfnApiMixinProps(
    api_key_selection_expression="apiKeySelectionExpression",
    base_path="basePath",
    body=body,
    body_s3_location=apigatewayv2_mixins.CfnApiPropsMixin.BodyS3LocationProperty(
        bucket="bucket",
        etag="etag",
        key="key",
        version="version"
    ),
    cors_configuration=apigatewayv2_mixins.CfnApiPropsMixin.CorsProperty(
        allow_credentials=False,
        allow_headers=["allowHeaders"],
        allow_methods=["allowMethods"],
        allow_origins=["allowOrigins"],
        expose_headers=["exposeHeaders"],
        max_age=123
    ),
    credentials_arn="credentialsArn",
    description="description",
    disable_execute_api_endpoint=False,
    disable_schema_validation=False,
    fail_on_warnings=False,
    ip_address_type="ipAddressType",
    name="name",
    protocol_type="protocolType",
    route_key="routeKey",
    route_selection_expression="routeSelectionExpression",
    tags={
        "tags_key": "tags"
    },
    target="target",
    version="version"
),
    strategy=mixins.PropertyMergeStrategy.OVERRIDE
)

Create a mixin to apply properties to AWS::ApiGatewayV2::Api.

Parameters:
  • props (Union[CfnApiMixinProps, Dict[str, Any]]) – L1 properties to apply.

  • strategy (Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE

Methods

apply_to(construct)

Apply the mixin properties to the construct.

Parameters:

construct (IConstruct)

Return type:

IConstruct

supports(construct)

Check if this mixin supports the given construct.

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

CFN_PROPERTY_KEYS = ['apiKeySelectionExpression', 'basePath', 'body', 'bodyS3Location', 'corsConfiguration', 'credentialsArn', 'description', 'disableExecuteApiEndpoint', 'disableSchemaValidation', 'failOnWarnings', 'ipAddressType', 'name', 'protocolType', 'routeKey', 'routeSelectionExpression', 'tags', 'target', 'version']

Static Methods

classmethod is_mixin(x)

(experimental) Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.

Stability:

experimental

BodyS3LocationProperty

class CfnApiPropsMixin.BodyS3LocationProperty(*, bucket=None, etag=None, key=None, version=None)

Bases: object

The BodyS3Location property specifies an S3 location from which to import an OpenAPI definition.

Supported only for HTTP APIs.

Parameters:
  • bucket (Optional[str]) – The S3 bucket that contains the OpenAPI definition to import. Required if you specify a BodyS3Location for an API.

  • etag (Optional[str]) – The Etag of the S3 object.

  • key (Optional[str]) – The key of the S3 object. Required if you specify a BodyS3Location for an API.

  • version (Optional[str]) – The version of the S3 object.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-bodys3location.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_apigatewayv2 import mixins as apigatewayv2_mixins

body_s3_location_property = apigatewayv2_mixins.CfnApiPropsMixin.BodyS3LocationProperty(
    bucket="bucket",
    etag="etag",
    key="key",
    version="version"
)

Attributes

bucket

The S3 bucket that contains the OpenAPI definition to import.

Required if you specify a BodyS3Location for an API.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-bodys3location.html#cfn-apigatewayv2-api-bodys3location-bucket

etag

The Etag of the S3 object.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-bodys3location.html#cfn-apigatewayv2-api-bodys3location-etag

key

The key of the S3 object.

Required if you specify a BodyS3Location for an API.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-bodys3location.html#cfn-apigatewayv2-api-bodys3location-key

version

The version of the S3 object.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-bodys3location.html#cfn-apigatewayv2-api-bodys3location-version

CorsProperty

class CfnApiPropsMixin.CorsProperty(*, allow_credentials=None, allow_headers=None, allow_methods=None, allow_origins=None, expose_headers=None, max_age=None)

Bases: object

The Cors property specifies a CORS configuration for an API.

Supported only for HTTP APIs. See Configuring CORS for more information.

Parameters:
  • allow_credentials (Union[bool, IResolvable, None]) – Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.

  • allow_headers (Optional[Sequence[str]]) – Represents a collection of allowed headers. Supported only for HTTP APIs.

  • allow_methods (Optional[Sequence[str]]) – Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.

  • allow_origins (Optional[Sequence[str]]) – Represents a collection of allowed origins. Supported only for HTTP APIs.

  • expose_headers (Optional[Sequence[str]]) – Represents a collection of exposed headers. Supported only for HTTP APIs.

  • max_age (Union[int, float, None]) – The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_apigatewayv2 import mixins as apigatewayv2_mixins

cors_property = apigatewayv2_mixins.CfnApiPropsMixin.CorsProperty(
    allow_credentials=False,
    allow_headers=["allowHeaders"],
    allow_methods=["allowMethods"],
    allow_origins=["allowOrigins"],
    expose_headers=["exposeHeaders"],
    max_age=123
)

Attributes

allow_credentials

Specifies whether credentials are included in the CORS request.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-allowcredentials

allow_headers

Represents a collection of allowed headers.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-allowheaders

allow_methods

Represents a collection of allowed HTTP methods.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-allowmethods

allow_origins

Represents a collection of allowed origins.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-alloworigins

expose_headers

Represents a collection of exposed headers.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-exposeheaders

max_age

The number of seconds that the browser should cache preflight request results.

Supported only for HTTP APIs.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-api-cors.html#cfn-apigatewayv2-api-cors-maxage