java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:44.712Z") @Stability(Stable) public class CfnApiKey extends CfnResource implements IInspectable
A CloudFormation AWS::ApiGateway::ApiKey.

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();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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 Construct scope, @NotNull String id, @Nullable CfnApiKeyProps props)
      Create a new AWS::ApiGateway::ApiKey.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
    • CfnApiKey

      @Stability(Stable) public CfnApiKey(@NotNull Construct scope, @NotNull String id)
      Create a new AWS::ApiGateway::ApiKey.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrApiKeyId

      @Stability(Stable) @NotNull public String getAttrApiKeyId()
      The ID for the API key.

      For example: abc123 .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      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.

    • getCustomerId

      @Stability(Stable) @Nullable public String getCustomerId()
      An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
    • setCustomerId

      @Stability(Stable) public void setCustomerId(@Nullable String value)
      An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the ApiKey.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the ApiKey.
    • getEnabled

      @Stability(Stable) @Nullable public Object getEnabled()
      Specifies whether the ApiKey can be used by callers.
    • setEnabled

      @Stability(Stable) public void setEnabled(@Nullable Boolean value)
      Specifies whether the ApiKey can be used by callers.
    • setEnabled

      @Stability(Stable) public void setEnabled(@Nullable IResolvable value)
      Specifies whether the ApiKey can be used by callers.
    • getGenerateDistinctId

      @Stability(Stable) @Nullable public Object getGenerateDistinctId()
      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.

    • setGenerateDistinctId

      @Stability(Stable) public void setGenerateDistinctId(@Nullable Boolean value)
      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.

    • setGenerateDistinctId

      @Stability(Stable) public void setGenerateDistinctId(@Nullable IResolvable value)
      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.

    • getName

      @Stability(Stable) @Nullable public String getName()
      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. 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.

    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      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. 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.

    • getStageKeys

      @Stability(Stable) @Nullable public Object getStageKeys()
      DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    • setStageKeys

      @Stability(Stable) public void setStageKeys(@Nullable IResolvable value)
      DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    • setStageKeys

      @Stability(Stable) public void setStageKeys(@Nullable List<Object> value)
      DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    • getValue

      @Stability(Stable) @Nullable public String getValue()
      Specifies a value of the API key.
    • setValue

      @Stability(Stable) public void setValue(@Nullable String value)
      Specifies a value of the API key.