java.lang.Object
software.amazon.awssdk.services.appsync.model.ApiKey
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<ApiKey.Builder,ApiKey>

@Generated("software.amazon.awssdk:codegen") public final class ApiKey extends Object implements SdkPojo, Serializable, ToCopyableBuilder<ApiKey.Builder,ApiKey>

Describes an API key.

Customers invoke AppSync GraphQL API operations with API keys as an identity mechanism. There are two key versions:

da1: We introduced this version at launch in November 2017. These keys always expire after 7 days. Amazon DynamoDB TTL manages key expiration. These keys ceased to be valid after February 21, 2018, and they should no longer be used.

  • ListApiKeys returns the expiration time in milliseconds.

  • CreateApiKey returns the expiration time in milliseconds.

  • UpdateApiKey is not available for this key version.

  • DeleteApiKey deletes the item from the table.

  • Expiration is stored in DynamoDB as milliseconds. This results in a bug where keys are not automatically deleted because DynamoDB expects the TTL to be stored in seconds. As a one-time action, we deleted these keys from the table on February 21, 2018.

da2: We introduced this version in February 2018 when AppSync added support to extend key expiration.

  • ListApiKeys returns the expiration time and deletion time in seconds.

  • CreateApiKey returns the expiration time and deletion time in seconds and accepts a user-provided expiration time in seconds.

  • UpdateApiKey returns the expiration time and and deletion time in seconds and accepts a user-provided expiration time in seconds. Expired API keys are kept for 60 days after the expiration time. You can update the key expiration time as long as the key isn't deleted.

  • DeleteApiKey deletes the item from the table.

  • Expiration is stored in DynamoDB as seconds. After the expiration time, using the key to authenticate will fail. However, you can reinstate the key before deletion.

  • Deletion is stored in DynamoDB as seconds. The key is deleted after deletion time.

See Also:
  • Method Details

    • id

      public final String id()

      The API key ID.

      Returns:
      The API key ID.
    • description

      public final String description()

      A description of the purpose of the API key.

      Returns:
      A description of the purpose of the API key.
    • expires

      public final Long expires()

      The time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour.

      Returns:
      The time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour.
    • deletes

      public final Long deletes()

      The time after which the API key is deleted. The date is represented as seconds since the epoch, rounded down to the nearest hour.

      Returns:
      The time after which the API key is deleted. The date is represented as seconds since the epoch, rounded down to the nearest hour.
    • toBuilder

      public ApiKey.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<ApiKey.Builder,ApiKey>
      Returns:
      a builder for type T
    • builder

      public static ApiKey.Builder builder()
    • serializableBuilderClass

      public static Class<? extends ApiKey.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsBySdkFields

      public final boolean equalsBySdkFields(Object obj)
      Description copied from interface: SdkPojo
      Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.