Skip to content
v2.277.0

CfnApiKeyProps Struct ​

Properties for defining a CfnApiKey.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
const cfnApiKeyProps: apigateway.CfnApiKeyProps = {
  customerId: 'customerId',
  description: 'description',
  enabled: false,
  generateDistinctId: false,
  name: 'name',
  stageKeys: [{
    restApiId: 'restApiId',
    stageName: 'stageName',
  }],
  tags: [{
    key: 'key',
    value: 'value',
  }],
  value: 'value',
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigateway as apigateway

cfn_api_key_props = apigateway.CfnApiKeyProps(
    customer_id="customerId",
    description="description",
    enabled=False,
    generate_distinct_id=False,
    name="name",
    stage_keys=[apigateway.CfnApiKey.StageKeyProperty(
        rest_api_id="restApiId",
        stage_name="stageName"
    )],
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    value="value"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;

CfnApiKeyProps cfnApiKeyProps = CfnApiKeyProps.builder()
        .customerId("customerId")
        .description("description")
        .enabled(false)
        .generateDistinctId(false)
        .name("name")
        .stageKeys(List.of(StageKeyProperty.builder()
                .restApiId("restApiId")
                .stageName("stageName")
                .build()))
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .value("value")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.APIGateway;

var cfnApiKeyProps = new CfnApiKeyProps {
    CustomerId = "customerId",
    Description = "description",
    Enabled = false,
    GenerateDistinctId = false,
    Name = "name",
    StageKeys = new [] { new StageKeyProperty {
        RestApiId = "restApiId",
        StageName = "stageName"
    } },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    Value = "value"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnApiKeyProps := &CfnApiKeyProps{
	CustomerId: jsii.String("customerId"),
	Description: jsii.String("description"),
	Enabled: jsii.Boolean(false),
	GenerateDistinctId: jsii.Boolean(false),
	Name: jsii.String("name"),
	StageKeys: []interface{}{
		&StageKeyProperty{
			RestApiId: jsii.String("restApiId"),
			StageName: jsii.String("stageName"),
		},
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	Value: jsii.String("value"),
}

Properties ​

customerIdoptionalstringcustomer_idoptionalstrcustomerIdoptionalStringCustomerIdoptionalstringCustomerIdoptional*string#
An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
The description of the ApiKey.
enabledoptionalboolean | IResolvableenabledoptionaltyping.Union[bool, IResolvable]enabledoptionalBooleanEnabledoptionalboolEnabledoptionalinterface{}= false#
Specifies whether the ApiKey can be used by callers.
generateDistinctIdoptionalboolean | IResolvablegenerate_distinct_idoptionaltyping.Union[bool, IResolvable]generateDistinctIdoptionalBooleanGenerateDistinctIdoptionalboolGenerateDistinctIdoptionalinterface{}#
Specifies whether ( `true` ) or not ( `false` ) the key identifier is distinct from the created API key value.

This parameter is deprecated and should not be used.

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string#
A name for the API key.
notes

If you don't specify a name, CloudFormation generates a unique physical ID and uses that ID for the API key name. For more information, see Name Type .

If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

stageKeysoptionalIResolvable | IResolvable | CfnApiKey.StageKeyProperty[]stage_keysoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, StageKeyProperty]]]stageKeysoptionalIResolvableStageKeysoptionalIResolvableStageKeysoptionalinterface{}#
DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag#
The key-value map of strings.

The valid character set is [a-zA-Z+-=._😕]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters.

valueoptionalstringvalueoptionalstrvalueoptionalStringValueoptionalstringValueoptional*string#
Specifies a value of the API key.