Interface SecretsManagerClient

All Known Implementing Classes:
AWSSecretsManagerClient, DBSecretsManagerClient

public interface SecretsManagerClient
Secret manager client that defines useful methods required to communicate to a specific remote secret manager.
  • Method Details

    • createLastSecretVersionsCacheEntry

      default LastSecretVersionsCacheEntry createLastSecretVersionsCacheEntry(Long companyId, String name)
      Returns a LastSecretVersionsCacheEntry using the provided parameters.
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      Returns:
      a LastSecretVersionsCacheEntry using the provided parameters.
    • createSecretEntry

      default SecretEntry createSecretEntry(Long companyId, String name, String versionId)
      Returns a SecretEntry using the provided parameters.
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      versionId - String about the version ID.
      Returns:
      a SecretEntry using the provided parameters.
    • getSecretFullName

      String getSecretFullName(Long companyId, @NotNull @NotNull String name)
      Returns the complete secret name that will identify a secret on the backend service.
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      Returns:
      the complete secret name that will identify a secret on the backend service.
    • getVersionIds

      String[] getVersionIds(Long companyId, @NotNull @NotNull String name)
      Returns a String[] containing the version ids belonging to the current and the previous (if any) secrets
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      Returns:
      String[] containing the current secrets version id in the first position, and the previous secrets version id in the second position. If there's no previous secrets, the array will contain only the current version id.
      Throws:
      SecretsManagerException - in case of error during the secret retrieval or if it can not be found
    • getSecret

      Secret getSecret(Long companyId, @NotNull @NotNull String name, @NotNull @NotNull String versionId)
      Returns the secrets value identified by the company, the name and the version
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      versionId - the version identifier
      Returns:
      the secret's value
      Throws:
      SecretsManagerException - in case of error during the secret retrieval or if it can not be found
    • getType

      Returns:
      the SecretsManagerType's type that this instance belongs to
    • getNormalizedName

      default String getNormalizedName(Long companyId, @NotNull @NotNull String name)
      Returns a String about a normalized secret name calculated using the provided parameters.
      Parameters:
      companyId - Long about the company ID. Use null value if the secret doesn't belong to any company but is shared across all of them
      name - String about the secret name.
      Returns:
      a String about a key calculated using the provided parameters.