ApiKeyOptions¶
-
class
aws_cdk.aws_apigateway.
ApiKeyOptions
(*, default_cors_preflight_options=None, default_integration=None, default_method_options=None, api_key_name=None, description=None, value=None)¶ Bases:
aws_cdk.aws_apigateway.ResourceOptions
The options for creating an API Key.
- Parameters
default_cors_preflight_options (
Optional
[CorsOptions
]) – Adds a CORS preflight OPTIONS method to this resource and all child resources. You can add CORS at the resource-level usingaddCorsPreflight
. Default: - CORS is disableddefault_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 (
Optional
[MethodOptions
]) – Method options to use as a default for all methods created within this API unless custom options are specified. Default: - Inherited from parent.api_key_name (
Optional
[str
]) – A name for the API key. If you don’t specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name. Default: automically generated namedescription (
Optional
[str
]) – A description of the purpose of the API key. Default: nonevalue (
Optional
[str
]) – The value of the API key. Must be at least 20 characters long. Default: none
- ExampleMetadata
infused
Example:
# api: apigateway.RestApi key = api.add_api_key("ApiKey", api_key_name="myApiKey1", value="MyApiKeyThatIsAtLeast20Characters" )
Attributes
-
api_key_name
¶ A name for the API key.
If you don’t specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.
- Default
automically generated name
- Link
- Return type
Optional
[str
]
-
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
]
-
description
¶ A description of the purpose of the API key.
- Default
none
- Link
- Return type
Optional
[str
]
-
value
¶ The value of the API key.
Must be at least 20 characters long.
- Default
none
- Link
- Return type
Optional
[str
]