ProxyResourceOptions

class aws_cdk.aws_apigateway.ProxyResourceOptions(*, default_cors_preflight_options=None, default_integration=None, default_method_options=None, any_method=None)

Bases: aws_cdk.aws_apigateway.ResourceOptions

Parameters
  • default_cors_preflight_options (Union[CorsOptions, Dict[str, Any], None]) – Adds a CORS preflight OPTIONS method to this resource and all child resources. You can add CORS at the resource-level using addCorsPreflight. Default: - CORS is disabled

  • default_integration (Optional[Integration]) – An integration to use as a default for all methods created within this API unless an integration is specified. Default: - Inherited from parent.

  • default_method_options (Union[MethodOptions, Dict[str, Any], None]) – Method options to use as a default for all methods created within this API unless custom options are specified. Default: - Inherited from parent.

  • any_method (Optional[bool]) – Adds an “ANY” method to this resource. If set to false, you will have to explicitly add methods to this resource after it’s created. Default: true

ExampleMetadata

infused

Example:

# resource: apigateway.Resource
# handler: lambda.Function

proxy = resource.add_proxy(
    default_integration=apigateway.LambdaIntegration(handler),

    # "false" will require explicitly adding methods on the `proxy` resource
    any_method=True
)

Attributes

any_method

Adds an “ANY” method to this resource.

If set to false, you will have to explicitly add methods to this resource after it’s created.

Default

true

Return type

Optional[bool]

default_cors_preflight_options

Adds a CORS preflight OPTIONS method to this resource and all child resources.

You can add CORS at the resource-level using addCorsPreflight.

Default
  • CORS is disabled

Return type

Optional[CorsOptions]

default_integration

An integration to use as a default for all methods created within this API unless an integration is specified.

Default
  • Inherited from parent.

Return type

Optional[Integration]

default_method_options

Method options to use as a default for all methods created within this API unless custom options are specified.

Default
  • Inherited from parent.

Return type

Optional[MethodOptions]