public class SecretManagerTemplate extends Object implements SecretManagerOperations
| Constructor and Description |
|---|
SecretManagerTemplate(com.google.cloud.secretmanager.v1beta1.SecretManagerServiceClient secretManagerServiceClient,
GcpProjectIdProvider projectIdProvider) |
| Modifier and Type | Method and Description |
|---|---|
void |
createSecret(String secretId,
byte[] payload)
Creates a new secret or a new version of existing secret with the provided
payload. |
void |
createSecret(String secretId,
String payload)
Creates a new secret or a new version of existing secret with the provided
payload. |
byte[] |
getSecretBytes(String secretId)
Gets the secret payload of the specified
secretId at the latest version. |
byte[] |
getSecretBytes(String secretId,
String versionName)
Gets the secret payload of the specified
secretId at version
versionName. |
com.google.protobuf.ByteString |
getSecretByteString(String secretId,
String versionName)
Gets the secret payload of the specified
secretId at version
versionName. |
String |
getSecretString(String secretId)
Gets the secret payload of the specified
secretId at the latest version. |
String |
getSecretString(String secretId,
String versionName)
Gets the secret payload of the specified
secretId at version
versionName. |
boolean |
secretExists(String secretId)
Returns true if there already exists a secret under the GCP project with the
secretId. |
public SecretManagerTemplate(com.google.cloud.secretmanager.v1beta1.SecretManagerServiceClient secretManagerServiceClient,
GcpProjectIdProvider projectIdProvider)
public void createSecret(String secretId, String payload)
SecretManagerOperationspayload.
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 secret
payload.
createSecret in interface SecretManagerOperationssecretId - the secret ID of the secret to create.payload - the secret payload string.public void createSecret(String secretId, byte[] payload)
SecretManagerOperationspayload.
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 secret
payload.
createSecret in interface SecretManagerOperationssecretId - the secret ID of the secret to create.payload - the secret payload as a byte array.public String getSecretString(String secretId)
SecretManagerOperationssecretId at the latest version.getSecretString in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.public String getSecretString(String secretId, String versionName)
SecretManagerOperationssecretId at version
versionName.getSecretString in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.versionName - which version of the secret to load. The version can be a version
number as a string (e.g. "5") or an alias (e.g. "latest").public byte[] getSecretBytes(String secretId)
SecretManagerOperationssecretId at the latest version.getSecretBytes in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.public byte[] getSecretBytes(String secretId, String versionName)
SecretManagerOperationssecretId at version
versionName.getSecretBytes in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.versionName - which version of the secret to load. The version can be a version
number as a string (e.g. "5") or an alias (e.g. "latest").public com.google.protobuf.ByteString getSecretByteString(String secretId, String versionName)
SecretManagerOperationssecretId at version
versionName.getSecretByteString in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.versionName - which version of the secret to load. The version can be a version
number as a string (e.g. "5") or an alias (e.g. "latest").ByteStringpublic boolean secretExists(String secretId)
SecretManagerOperationssecretId.secretExists in interface SecretManagerOperationssecretId - unique identifier of your secret in Secret Manager.Copyright © 2020 Pivotal Software, Inc.. All rights reserved.