Class SecretManagerClientImpl

    • Method Detail

      • createSecret

        public void createSecret​(java.lang.String secretId)
        Description copied from interface: SecretManagerClient
        Creates a new secret in the Cloud Secret Manager with no data.

        Use addVersion to add data to this secret.

        Specified by:
        createSecret in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret, must be unique in a project
      • secretExists

        public boolean secretExists​(java.lang.String secretId)
        Description copied from interface: SecretManagerClient
        Checks if a secret with the given secretId already exists.
        Specified by:
        secretExists in interface SecretManagerClient
      • addSecretVersion

        public java.lang.String addSecretVersion​(java.lang.String secretId,
                                                 java.lang.String data)
        Description copied from interface: SecretManagerClient
        Adds a new version of data to a secret.
        Specified by:
        addSecretVersion in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret
        data - The secret data to be stored in Cloud Secret Manager, encoded in utf-8 charset
        Returns:
        The version string of the newly added secret data
      • getSecretData

        public java.lang.String getSecretData​(java.lang.String secretId,
                                              java.util.Optional<java.lang.String> version)
        Description copied from interface: SecretManagerClient
        Returns the data of a secret at the given version.
        Specified by:
        getSecretData in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret
        version - The version of the secret to fetch. If not provided, the latest version will be returned
      • enableSecretVersion

        public void enableSecretVersion​(java.lang.String secretId,
                                        java.lang.String version)
        Description copied from interface: SecretManagerClient
        Enables a secret version.
        Specified by:
        enableSecretVersion in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret
        version - The version of the secret to fetch. If not provided, the latest version will be returned
      • disableSecretVersion

        public void disableSecretVersion​(java.lang.String secretId,
                                         java.lang.String version)
        Description copied from interface: SecretManagerClient
        Disables a secret version.
        Specified by:
        disableSecretVersion in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret
        version - The version of the secret to fetch. If not provided, the latest version will be returned
      • destroySecretVersion

        public void destroySecretVersion​(java.lang.String secretId,
                                         java.lang.String version)
        Description copied from interface: SecretManagerClient
        Destroys a secret version.
        Specified by:
        destroySecretVersion in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret
        version - The version of the secret to destroy
      • deleteSecret

        public void deleteSecret​(java.lang.String secretId)
        Description copied from interface: SecretManagerClient
        Deletes a secret from the Secret Manager. All versions of this secret will be destroyed.
        Specified by:
        deleteSecret in interface SecretManagerClient
        Parameters:
        secretId - The ID of the secret to be deleted