Class CfnApiKey
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.apigateway.CfnApiKey
- All Implemented Interfaces:
IInspectable,IApiKeyRef,IEnvironmentAware,ITaggable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-20T23:37:13.523Z")
@Stability(Stable)
public class CfnApiKey
extends CfnResource
implements IInspectable, IApiKeyRef, ITaggable
The
AWS::ApiGateway::ApiKey resource creates a unique key that you can distribute to clients who are executing API Gateway Method resources that require an API key.
To specify which API key clients must use, map the API key with the RestApi and Stage resources that include the methods that require a key.
Example:
// 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.*;
CfnApiKey cfnApiKey = CfnApiKey.Builder.create(this, "MyCfnApiKey")
.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();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnApiKey.static interfaceStageKeyis a property of the AWS::ApiGateway::ApiKey resource that specifies the stage to associate with the API key.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.apigateway.IApiKeyRef
IApiKeyRef.Jsii$Default, IApiKeyRef.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnApiKey(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnApiKey(software.amazon.jsii.JsiiObjectRef objRef) Create a newAWS::ApiGateway::ApiKey.CfnApiKey(software.constructs.Construct scope, String id, CfnApiKeyProps props) Create a newAWS::ApiGateway::ApiKey. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForApiKey(IApiKeyRef resource) static IApiKeyReffromApiKeyId(software.constructs.Construct scope, String id, String apiKeyId) Creates a new IApiKeyRef from a apiKeyId.A reference to a ApiKey resource.The ID for the API key.An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.The description of the ApiKey.Specifies whether the ApiKey can be used by callers.Specifies whether (true) or not (false) the key identifier is distinct from the created API key value.getName()A name for the API key.DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.getTags()Tag Manager which manages the tags for this resource.The key-value map of strings.getValue()Specifies a value of the API key.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetCustomerId(String value) An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.voidsetDescription(String value) The description of the ApiKey.voidsetEnabled(Boolean value) Specifies whether the ApiKey can be used by callers.voidsetEnabled(IResolvable value) Specifies whether the ApiKey can be used by callers.voidsetGenerateDistinctId(Boolean value) Specifies whether (true) or not (false) the key identifier is distinct from the created API key value.voidsetGenerateDistinctId(IResolvable value) Specifies whether (true) or not (false) the key identifier is distinct from the created API key value.voidA name for the API key.voidsetStageKeys(List<Object> value) DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.voidsetStageKeys(IResolvable value) DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.voidsetTagsRaw(List<CfnTag> value) The key-value map of strings.voidSpecifies a value of the API key.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnApiKey
protected CfnApiKey(software.amazon.jsii.JsiiObjectRef objRef) -
CfnApiKey
protected CfnApiKey(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnApiKey
@Stability(Stable) public CfnApiKey(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnApiKeyProps props) Create a newAWS::ApiGateway::ApiKey.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnApiKey
@Stability(Stable) public CfnApiKey(@NotNull software.constructs.Construct scope, @NotNull String id) Create a newAWS::ApiGateway::ApiKey.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
arnForApiKey
- Parameters:
resource- This parameter is required.
-
fromApiKeyId
@Stability(Stable) @NotNull public static IApiKeyRef fromApiKeyId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String apiKeyId) Creates a new IApiKeyRef from a apiKeyId.- Parameters:
scope- This parameter is required.id- This parameter is required.apiKeyId- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getApiKeyRef
A reference to a ApiKey resource.- Specified by:
getApiKeyRefin interfaceIApiKeyRef
-
getAttrApiKeyId
The ID for the API key.For example:
abc123. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getCustomerId
An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace. -
setCustomerId
An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace. -
getDescription
The description of the ApiKey. -
setDescription
The description of the ApiKey. -
getEnabled
Specifies whether the ApiKey can be used by callers.Returns union: either
BooleanorIResolvable -
setEnabled
Specifies whether the ApiKey can be used by callers. -
setEnabled
Specifies whether the ApiKey can be used by callers. -
getGenerateDistinctId
Specifies whether (true) or not (false) the key identifier is distinct from the created API key value.Returns union: either
BooleanorIResolvable -
setGenerateDistinctId
Specifies whether (true) or not (false) the key identifier is distinct from the created API key value. -
setGenerateDistinctId
Specifies whether (true) or not (false) the key identifier is distinct from the created API key value. -
getName
A name for the API key. -
setName
A name for the API key. -
getStageKeys
DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnApiKey.StageKeyProperty> -
setStageKeys
DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key. -
setStageKeys
DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key. -
getTagsRaw
The key-value map of strings. -
setTagsRaw
The key-value map of strings. -
getValue
Specifies a value of the API key. -
setValue
Specifies a value of the API key.
-