Class SecretManagerTemplate
- All Implemented Interfaces:
SecretManagerOperations
- Since:
- 1.2.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSecretManagerTemplate(com.google.cloud.secretmanager.v1.SecretManagerServiceClient secretManagerServiceClient, GcpProjectIdProvider projectIdProvider) SecretManagerTemplate(SecretManagerServiceClientFactory clientFactory, GcpProjectIdProvider projectIdProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateSecret(String secretId, byte[] payload) Creates a new secret or a new version of existing secret with the providedpayload.voidcreateSecret(String secretId, byte[] payload, String projectId) Creates a new secret or a new version of existing secret with the providedpayloadfor a specificprojectId.voidcreateSecret(String secretId, byte[] payload, String projectId, String locationId) Creates a new secret or a new version of existing secret with the providedpayloadfor a specificprojectId.voidcreateSecret(String secretId, String payload) Creates a new secret or a new version of existing secret with the providedpayload.voidcreateSecret(String secretId, String payload, String locationId) Creates a new secret or a new version of existing secret with the providedpayload.voiddeleteSecret(String secretId) Deletes the specified secret under the default-configured project.voiddeleteSecret(String secretId, String projectId) Deletes the specified secret.voiddeleteSecret(String secretId, String projectId, String locationId) Deletes the specified secret.voiddeleteSecretVersion(String secretId, String version, String projectId) Deletes the specified secret version.voiddeleteSecretVersion(String secretId, String version, String projectId, String locationId) Deletes the specified secret version.voiddisableSecretVersion(String secretId, String version) Disables the specified secret version under the default-configured project.voiddisableSecretVersion(String secretId, String version, String projectId) Disables the secret version under the specified project.voiddisableSecretVersion(String secretId, String version, String projectId, String locationId) Disables the secret version under the specified project.voidenableSecretVersion(String secretId, String version) Enables the specified secret version under the default-configured project.voidenableSecretVersion(String secretId, String version, String projectId) Enables the secret version under the specified project.voidenableSecretVersion(String secretId, String version, String projectId, String locationId) Enables the secret version under the specified project.byte[]getSecretBytes(String secretIdentifier) Gets the secret payload of the specifiedsecretIdentifiersecret.getSecretString(String secretIdentifier) Gets the secret payload of the specifiedsecretIdentifiersecret.booleansecretExists(String secretId) Returns true if there already exists a secret under the GCP project with thesecretId.booleansecretExists(String secretId, String projectId) Returns true if there already exists a secret under the GCPprojectIdwith thesecretId.booleansecretExists(String secretId, String projectId, String locationId) Returns true if there already exists a secret under the GCPprojectIdwith thesecretId.setAllowDefaultSecretValue(boolean allowDefaultSecretValue)
-
Field Details
-
LATEST_VERSION
Default value for the latest version of the secret.- See Also:
-
GLOBAL_LOCATION
Default value for the latest version of the secret.- See Also:
-
-
Constructor Details
-
SecretManagerTemplate
public SecretManagerTemplate(com.google.cloud.secretmanager.v1.SecretManagerServiceClient secretManagerServiceClient, GcpProjectIdProvider projectIdProvider) -
SecretManagerTemplate
public SecretManagerTemplate(SecretManagerServiceClientFactory clientFactory, GcpProjectIdProvider projectIdProvider)
-
-
Method Details
-
setAllowDefaultSecretValue
-
getProjectId
-
createSecret
Description copied from interface:SecretManagerOperationsCreates a new secret or a new version of existing secret with the providedpayload.If there is already a secret saved in SecretManager with the specified
secretId, then it simply creates a new version under the secret with the secretpayload.- Specified by:
createSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to create.payload- the secret payload string.
-
createSecret
Description copied from interface:SecretManagerOperationsCreates a new secret or a new version of existing secret with the providedpayload.If there is already a secret saved in SecretManager with the specified
secretId, then it simply creates a new version under the secret with the secretpayload.- Specified by:
createSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to create.payload- the secret payload string.locationId- the secret location string.
-
createSecret
Description copied from interface:SecretManagerOperationsCreates a new secret or a new version of existing secret with the providedpayload.If there is already a secret saved in SecretManager with the specified
secretId, then it simply creates a new version under the secret with the secretpayload.- Specified by:
createSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to create.payload- the secret payload as a byte array.
-
createSecret
Description copied from interface:SecretManagerOperationsCreates a new secret or a new version of existing secret with the providedpayloadfor a specificprojectId.If there is already a secret saved in SecretManager with the specified
secretId, then it simply creates a new version under the secret with the secretpayload.- Specified by:
createSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to create.payload- the secret payload as a byte array.projectId- unique identifier of your project.
-
createSecret
Description copied from interface:SecretManagerOperationsCreates a new secret or a new version of existing secret with the providedpayloadfor a specificprojectId.If there is already a secret saved in SecretManager with the specified
secretId, then it simply creates a new version under the secret with the secretpayload.- Specified by:
createSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to create.payload- the secret payload as a byte array.projectId- unique identifier of your project.locationId- the secret location string.
-
getSecretString
Description copied from interface:SecretManagerOperationsGets the secret payload of the specifiedsecretIdentifiersecret.The
secretIdentifiermust either be a secret ID or a fully qualified `sm://` protocol string which specifies the secret (see javadocs ofSecretManagerOperationsfor the protocol format).If the secret ID string is passed in, then this will return the payload of the secret for the default project at the latest version.
- Specified by:
getSecretStringin interfaceSecretManagerOperations- Parameters:
secretIdentifier- the GCP secret ID of the secret or a sm:// formatted string specifying the secret.- Returns:
- The secret payload as String
-
getSecretBytes
Description copied from interface:SecretManagerOperationsGets the secret payload of the specifiedsecretIdentifiersecret.The
secretIdentifiermust either be a secret ID or a fully qualified `sm://` protocol string which specifies the secret (see javadocs ofSecretManagerOperationsfor the protocol format).If the secret ID string is passed in, then this will return the payload of the secret for the default project at the latest version.
- Specified by:
getSecretBytesin interfaceSecretManagerOperations- Parameters:
secretIdentifier- the GCP secret ID of the secret or a sm:// formatted string specifying the secret.- Returns:
- The secret payload as byte array
-
secretExists
Description copied from interface:SecretManagerOperationsReturns true if there already exists a secret under the GCP project with thesecretId.- Specified by:
secretExistsin interfaceSecretManagerOperations- Parameters:
secretId- unique identifier of your secret in Secret Manager.- Returns:
- true if the secret exists in Secret Manager; false otherwise
-
secretExists
Description copied from interface:SecretManagerOperationsReturns true if there already exists a secret under the GCPprojectIdwith thesecretId.- Specified by:
secretExistsin interfaceSecretManagerOperations- Parameters:
secretId- unique identifier of your secret in Secret Manager.projectId- unique identifier of your project.- Returns:
- true if the secret exists in Secret Manager; false otherwise
-
secretExists
Description copied from interface:SecretManagerOperationsReturns true if there already exists a secret under the GCPprojectIdwith thesecretId.- Specified by:
secretExistsin interfaceSecretManagerOperations- Parameters:
secretId- unique identifier of your secret in Secret Manager.projectId- unique identifier of your project.locationId- the secret location string.- Returns:
- true if the secret exists in Secret Manager; false otherwise
-
disableSecretVersion
Description copied from interface:SecretManagerOperationsDisables the specified secret version under the default-configured project.- Specified by:
disableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to disable.version- the version to disable
-
disableSecretVersion
Description copied from interface:SecretManagerOperationsDisables the secret version under the specified project.- Specified by:
disableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to disable.version- the version to disableprojectId- unique identifier of your project.
-
disableSecretVersion
public void disableSecretVersion(String secretId, String version, String projectId, String locationId) Description copied from interface:SecretManagerOperationsDisables the secret version under the specified project.- Specified by:
disableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to disable.version- the version to disableprojectId- unique identifier of your project.locationId- the secret location string.
-
enableSecretVersion
Description copied from interface:SecretManagerOperationsEnables the specified secret version under the default-configured project.- Specified by:
enableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to enable.version- the version to enable
-
enableSecretVersion
Description copied from interface:SecretManagerOperationsEnables the secret version under the specified project.- Specified by:
enableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to enable.version- the version to enableprojectId- unique identifier of your project.
-
enableSecretVersion
public void enableSecretVersion(String secretId, String version, String projectId, String locationId) Description copied from interface:SecretManagerOperationsEnables the secret version under the specified project.- Specified by:
enableSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to enable.version- the version to enableprojectId- unique identifier of your project.locationId- the secret location string.
-
deleteSecret
Description copied from interface:SecretManagerOperationsDeletes the specified secret under the default-configured project.- Specified by:
deleteSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to delete.
-
deleteSecret
Description copied from interface:SecretManagerOperationsDeletes the specified secret.- Specified by:
deleteSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to delete.projectId- the GCP project containing the secret to delete.
-
deleteSecret
Description copied from interface:SecretManagerOperationsDeletes the specified secret.- Specified by:
deleteSecretin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to delete.projectId- the GCP project containing the secret to delete.locationId- the secret location string.
-
deleteSecretVersion
Description copied from interface:SecretManagerOperationsDeletes the specified secret version.- Specified by:
deleteSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to delete.version- the version to deleteprojectId- the GCP project containing the secret to delete.
-
deleteSecretVersion
public void deleteSecretVersion(String secretId, String version, String projectId, String locationId) Description copied from interface:SecretManagerOperationsDeletes the specified secret version.- Specified by:
deleteSecretVersionin interfaceSecretManagerOperations- Parameters:
secretId- the secret ID of the secret to delete.version- the version to deleteprojectId- the GCP project containing the secret to delete.locationId- the secret location string.
-