public class SecretManagerResourceManager
extends java.lang.Object
implements org.apache.beam.it.common.ResourceManager
ResourceManager
interface.
The class provides an interaction with the real GCP Secret Manager client, with operations related to management of Secrets in the SecretManager.
Modifier and Type | Class and Description |
---|---|
static class |
SecretManagerResourceManager.Builder
Builder for
SecretManagerResourceManager . |
Constructor and Description |
---|
SecretManagerResourceManager(java.lang.String projectId,
com.google.cloud.secretmanager.v1.SecretManagerServiceClient secretManagerServiceClient) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
accessSecret(java.lang.String secretVersion)
Calls Secret Manager with a Secret Version and returns the secret value.
|
void |
addSecretVersion(java.lang.String secretId,
java.lang.String secretData)
Creates a new SecretVersion containing secret data and attaches it to an existing Secret.
|
static SecretManagerResourceManager.Builder |
builder(java.lang.String projectId,
com.google.api.gax.core.CredentialsProvider credentialsProvider) |
void |
cleanupAll() |
void |
createSecret(java.lang.String secretId,
java.lang.String secretData)
Creates a Secret with given name on GCP Secret Manager.
|
void |
deleteSecret(java.lang.String secretId)
Deletes a Secret.
|
void |
destroySecretVersion(java.lang.String secretVersion)
Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.
|
void |
disableSecretVersion(java.lang.String secretVersion)
Disables a SecretVersion.
|
void |
enableSecretVersion(java.lang.String secretVersion)
Enables a SecretVersion.
|
public SecretManagerResourceManager(java.lang.String projectId, com.google.cloud.secretmanager.v1.SecretManagerServiceClient secretManagerServiceClient)
public static SecretManagerResourceManager.Builder builder(java.lang.String projectId, com.google.api.gax.core.CredentialsProvider credentialsProvider)
public void createSecret(java.lang.String secretId, java.lang.String secretData)
secretId
- Secret ID of the secret to be createdsecretData
- Value of the secret to be addedpublic void addSecretVersion(java.lang.String secretId, java.lang.String secretData)
secretId
- Parent secret to which version will be addedsecretData
- Value of the secret to be addedpublic java.lang.String accessSecret(java.lang.String secretVersion)
secretVersion
- Secret Version of the form
projects/{project}/secrets/{secret}/versions/{secret_version}public void enableSecretVersion(java.lang.String secretVersion)
secretVersion
- The resource name of the SecretVersion to destroy in the format of
projects/{project}/secrets/{secret}/versions/{secret_version}public void disableSecretVersion(java.lang.String secretVersion)
secretVersion
- The resource name of the SecretVersion to destroy in the format of
projects/{project}/secrets/{secret}/versions/{secret_version}public void destroySecretVersion(java.lang.String secretVersion)
secretVersion
- The resource name of the SecretVersion to destroy in the format of
projects/{project}/secrets/{secret}/versions/{secret_version}public void deleteSecret(java.lang.String secretId)
secretId
- The resource name of the SecretVersion to delete in the format of
projects/{project}/secrets/{secret}/versions/{secret_version}public void cleanupAll()
cleanupAll
in interface org.apache.beam.it.common.ResourceManager