Class SecretCacheItem

java.lang.Object
com.amazonaws.secretsmanager.caching.cache.SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
com.amazonaws.secretsmanager.caching.cache.SecretCacheItem

public class SecretCacheItem extends SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
The cached secret item which contains information from the DescribeSecret request to AWS Secrets Manager along with any associated GetSecretValue results.
  • Constructor Details

    • SecretCacheItem

      public SecretCacheItem(String secretId, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient client, SecretCacheConfiguration config)
      Construct a new cached item for the secret.
      Parameters:
      secretId - The secret identifier. This identifier could be the full ARN or the friendly name for the secret.
      client - The AWS Secrets Manager client to use for requesting the secret.
      config - Cache configuration.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
    • toString

      public String toString()
      Specified by:
      toString in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
    • isRefreshNeeded

      protected boolean isRefreshNeeded()
      Determine if the secret object should be refreshed. This method extends the base class functionality to check if a refresh is needed based on the configured TTL for the item.
      Overrides:
      isRefreshNeeded in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
      Returns:
      True if the secret item should be refreshed.
    • executeRefresh

      protected software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse executeRefresh()
      Execute the logic to perform the actual refresh of the item.
      Specified by:
      executeRefresh in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
      Returns:
      The result from AWS Secrets Manager for the refresh.
    • getSecretValue

      protected software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse getSecretValue(software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse describeResponse)
      Return the cached result from AWS Secrets Manager for GetSecretValue.
      Specified by:
      getSecretValue in class SecretCacheObject<software.amazon.awssdk.services.secretsmanager.model.DescribeSecretResponse>
      Parameters:
      describeResponse - The result of the Describe Secret request to AWS Secrets Manager.
      Returns:
      The cached GetSecretValue result.