java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.ApiKey
All Implemented Interfaces:
IResource, IApiKey, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:11.751Z") @Stability(Stable) public class ApiKey extends Resource implements IApiKey
An API Gateway ApiKey.

An ApiKey can be distributed to API clients that are executing requests for Method resources that require an Api Key.

Example:

 IApiKey importedKey = ApiKey.fromApiKeyId(this, "imported-key", "<api-key-id>");
 
  • Constructor Details

    • ApiKey

      protected ApiKey(software.amazon.jsii.JsiiObjectRef objRef)
    • ApiKey

      protected ApiKey(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ApiKey

      @Stability(Stable) public ApiKey(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ApiKeyProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • ApiKey

      @Stability(Stable) public ApiKey(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromApiKeyId

      @Stability(Stable) @NotNull public static IApiKey fromApiKeyId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String apiKeyId)
      Import an ApiKey by its Id.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      apiKeyId - This parameter is required.
    • grantRead

      @Stability(Stable) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
      Permits the IAM principal all read operations through this key.

      Parameters:
      grantee - The principal to grant access to. This parameter is required.
    • grantReadWrite

      @Stability(Stable) @NotNull public Grant grantReadWrite(@NotNull IGrantable grantee)
      Permits the IAM principal all read and write operations through this key.

      Parameters:
      grantee - The principal to grant access to. This parameter is required.
    • grantWrite

      @Stability(Stable) @NotNull public Grant grantWrite(@NotNull IGrantable grantee)
      Permits the IAM principal all write operations through this key.

      Parameters:
      grantee - The principal to grant access to. This parameter is required.
    • getKeyArn

      @Stability(Stable) @NotNull public String getKeyArn()
      The API key ARN.
      Specified by:
      getKeyArn in interface IApiKey
    • getKeyId

      @Stability(Stable) @NotNull public String getKeyId()
      The API key ID.
      Specified by:
      getKeyId in interface IApiKey