interface ApiKeyOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.ApiKeyOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#ApiKeyOptions |
Java | software.amazon.awscdk.services.apigateway.ApiKeyOptions |
Python | aws_cdk.aws_apigateway.ApiKeyOptions |
TypeScript (source) | aws-cdk-lib » aws_apigateway » ApiKeyOptions |
The options for creating an API Key.
Example
declare const api: apigateway.RestApi;
const key = api.addApiKey('ApiKey', {
apiKeyName: 'myApiKey1',
value: 'MyApiKeyThatIsAtLeast20Characters',
});
Properties
Name | Type | Description |
---|---|---|
api | string | A name for the API key. |
default | Cors | Adds a CORS preflight OPTIONS method to this resource and all child resources. |
default | Integration | An integration to use as a default for all methods created within this API unless an integration is specified. |
default | Method | Method options to use as a default for all methods created within this API unless custom options are specified. |
description? | string | A description of the purpose of the API key. |
value? | string | The value of the API key. |
apiKeyName?
Type:
string
(optional, default: automically generated 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.
defaultCorsPreflightOptions?
Type:
Cors
(optional, default: CORS is disabled)
Adds a CORS preflight OPTIONS method to this resource and all child resources.
You can add CORS at the resource-level using addCorsPreflight
.
defaultIntegration?
Type:
Integration
(optional, default: Inherited from parent.)
An integration to use as a default for all methods created within this API unless an integration is specified.
defaultMethodOptions?
Type:
Method
(optional, default: Inherited from parent.)
Method options to use as a default for all methods created within this API unless custom options are specified.
description?
Type:
string
(optional, default: none)
A description of the purpose of the API key.
value?
Type:
string
(optional, default: none)
The value of the API key.
Must be at least 20 characters long.