ApiKeyProps Struct
ApiKey Properties.
| Source | aws-apigatewayv2/lib/websocket/api-key.ts |
|---|---|
| Type last changed |
Example
ts
// Auto-generated name and value
const autoKey = new apigwv2.ApiKey(this, 'AutoKey');
// Explicit name and value
const explicitKey = new apigwv2.ApiKey(this, 'ExplicitKey', {
apiKeyName: 'MyWebSocketApiKey',
value: 'MyApiKeyThatIsAtLeast20Characters',
});
python
# Auto-generated name and value
auto_key = apigwv2.ApiKey(self, "AutoKey")
# Explicit name and value
explicit_key = apigwv2.ApiKey(self, "ExplicitKey",
api_key_name="MyWebSocketApiKey",
value="MyApiKeyThatIsAtLeast20Characters"
)
java
// Auto-generated name and value
ApiKey autoKey = new ApiKey(this, "AutoKey");
// Explicit name and value
ApiKey explicitKey = ApiKey.Builder.create(this, "ExplicitKey")
.apiKeyName("MyWebSocketApiKey")
.value("MyApiKeyThatIsAtLeast20Characters")
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Auto-generated name and value
var autoKey = new ApiKey(this, "AutoKey");
// Explicit name and value
var explicitKey = new ApiKey(this, "ExplicitKey", new ApiKeyProps {
ApiKeyName = "MyWebSocketApiKey",
Value = "MyApiKeyThatIsAtLeast20Characters"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Auto-generated name and value
autoKey := apigwv2.NewApiKey(this, jsii.String("AutoKey"))
// Explicit name and value
explicitKey := apigwv2.NewApiKey(this, jsii.String("ExplicitKey"), &ApiKeyProps{
ApiKeyName: jsii.String("MyWebSocketApiKey"),
Value: jsii.String("MyApiKeyThatIsAtLeast20Characters"),
})
Properties
apiKeyNameoptionalstringapi_key_nameoptionalstrapiKeyNameoptionalStringApiKeyNameoptionalstringApiKeyNameoptional*string #A name for the API key.
Default: automatically generated name
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.
customerIdoptionalstringcustomer_idoptionalstrcustomerIdoptionalStringCustomerIdoptionalstringCustomerIdoptional*string = none #An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = none #A description of the purpose of the API key.
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool = true #Indicates whether the API key can be used by clients.
generateDistinctIdoptionalbooleangenerate_distinct_idoptionalboolgenerateDistinctIdoptionalBooleanGenerateDistinctIdoptionalboolGenerateDistinctIdoptional*bool = false #Specifies whether the key identifier is distinct from the created API key value.
valueoptionalstringvalueoptionalstrvalueoptionalStringValueoptionalstringValueoptional*string = none #The value of the API key.
Must be at least 20 characters long.