CfnUrlPropsMixin

class aws_cdk.mixins_preview.aws_lambda.mixins.CfnUrlPropsMixin(props, *, strategy=None)

Bases: Mixin

The AWS::Lambda::Url resource creates a function URL with the specified configuration parameters.

A function URL is a dedicated HTTP(S) endpoint that you can use to invoke your function.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-url.html

CloudformationResource:

AWS::Lambda::Url

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_lambda import mixins as lambda_mixins

cfn_url_props_mixin = lambda_mixins.CfnUrlPropsMixin(lambda_mixins.CfnUrlMixinProps(
    auth_type="authType",
    cors=lambda_mixins.CfnUrlPropsMixin.CorsProperty(
        allow_credentials=False,
        allow_headers=["allowHeaders"],
        allow_methods=["allowMethods"],
        allow_origins=["allowOrigins"],
        expose_headers=["exposeHeaders"],
        max_age=123
    ),
    invoke_mode="invokeMode",
    qualifier="qualifier",
    target_function_arn="targetFunctionArn"
),
    strategy=mixins.PropertyMergeStrategy.OVERRIDE
)

Create a mixin to apply properties to AWS::Lambda::Url.

Parameters:
  • props (Union[CfnUrlMixinProps, 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 = ['authType', 'cors', 'invokeMode', 'qualifier', 'targetFunctionArn']

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

CorsProperty

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

Bases: object

The Cross-Origin Resource Sharing (CORS) settings for your function URL. Use CORS to grant access to your function URL from any origin. You can also use CORS to control access for specific HTTP headers and methods in requests to your function URL.

Parameters:
  • allow_credentials (Union[bool, IResolvable, None]) – Whether you want to allow cookies or other credentials in requests to your function URL. The default is false .

  • allow_headers (Optional[Sequence[str]]) – The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

  • allow_methods (Optional[Sequence[str]]) – The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

  • allow_origins (Optional[Sequence[str]]) – The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 . Alternatively, you can grant access to all origins with the wildcard character ( * ).

  • expose_headers (Optional[Sequence[str]]) – The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

  • max_age (Union[int, float, None]) – The maximum amount of time, in seconds, that browsers can cache results of a preflight request. By default, this is set to 0 , which means the browser will not cache results.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-url-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_lambda import mixins as lambda_mixins

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

Attributes

allow_credentials

Whether you want to allow cookies or other credentials in requests to your function URL.

The default is false .

See:

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

allow_headers

The HTTP headers that origins can include in requests to your function URL.

For example: Date , Keep-Alive , X-Custom-Header .

See:

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

allow_methods

The HTTP methods that are allowed when calling your function URL.

For example: GET , POST , DELETE , or the wildcard character ( * ).

See:

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

allow_origins

The origins that can access your function URL.

You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

Alternatively, you can grant access to all origins with the wildcard character ( * ).

See:

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

expose_headers

The HTTP headers in your function response that you want to expose to origins that call your function URL.

For example: Date , Keep-Alive , X-Custom-Header .

See:

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

max_age

The maximum amount of time, in seconds, that browsers can cache results of a preflight request.

By default, this is set to 0 , which means the browser will not cache results.

See:

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