Search in sources :

Example 16 with Secret

use of com.google.cloud.secretmanager.v1.Secret in project java-docs-samples by GoogleCloudPlatform.

the class SnippetsIT method testDestroySecretVersionWithEtag.

@Test
public void testDestroySecretVersionWithEtag() throws IOException {
    SecretVersionName name = SecretVersionName.parse(TEST_SECRET_VERSION_TO_DESTROY_WITH_ETAG.getName());
    String etag = TEST_SECRET_VERSION_TO_DESTROY_WITH_ETAG.getEtag();
    DestroySecretVersionWithEtag.destroySecretVersion(name.getProject(), name.getSecret(), name.getSecretVersion(), etag);
    assertThat(stdOut.toString()).contains("Destroyed secret version");
}
Also used : SecretVersionName(com.google.cloud.secretmanager.v1.SecretVersionName) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 17 with Secret

use of com.google.cloud.secretmanager.v1.Secret in project java-docs-samples by GoogleCloudPlatform.

the class SnippetsIT method testDeleteSecretWithEtag.

@Test
public void testDeleteSecretWithEtag() throws IOException {
    SecretName name = SecretName.parse(TEST_SECRET_TO_DELETE_WITH_ETAG.getName());
    String etag = TEST_SECRET_TO_DELETE_WITH_ETAG.getEtag();
    DeleteSecretWithEtag.deleteSecret(name.getProject(), name.getSecret(), etag);
    assertThat(stdOut.toString()).contains("Deleted secret");
}
Also used : SecretName(com.google.cloud.secretmanager.v1.SecretName) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 18 with Secret

use of com.google.cloud.secretmanager.v1.Secret in project java-docs-samples by GoogleCloudPlatform.

the class SnippetsIT method testDisableSecretVersionWithEtag.

@Test
public void testDisableSecretVersionWithEtag() throws IOException {
    SecretVersionName name = SecretVersionName.parse(TEST_SECRET_VERSION_TO_DISABLE_WITH_ETAG.getName());
    String etag = TEST_SECRET_VERSION_TO_DISABLE_WITH_ETAG.getEtag();
    DisableSecretVersionWithEtag.disableSecretVersion(name.getProject(), name.getSecret(), name.getSecretVersion(), etag);
    assertThat(stdOut.toString()).contains("Disabled secret version");
}
Also used : SecretVersionName(com.google.cloud.secretmanager.v1.SecretVersionName) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 19 with Secret

use of com.google.cloud.secretmanager.v1.Secret in project java-docs-samples by GoogleCloudPlatform.

the class SnippetsIT method testEnableSecretVersion.

@Test
public void testEnableSecretVersion() throws IOException {
    SecretVersionName name = SecretVersionName.parse(TEST_SECRET_VERSION_TO_ENABLE.getName());
    EnableSecretVersion.enableSecretVersion(name.getProject(), name.getSecret(), name.getSecretVersion());
    assertThat(stdOut.toString()).contains("Enabled secret version");
}
Also used : SecretVersionName(com.google.cloud.secretmanager.v1.SecretVersionName) Test(org.junit.Test)

Example 20 with Secret

use of com.google.cloud.secretmanager.v1.Secret in project java-docs-samples by GoogleCloudPlatform.

the class SnippetsIT method testEnableSecretVersionWithEtag.

@Test
public void testEnableSecretVersionWithEtag() throws IOException {
    SecretVersionName name = SecretVersionName.parse(TEST_SECRET_VERSION_TO_ENABLE_WITH_ETAG.getName());
    String etag = TEST_SECRET_VERSION_TO_ENABLE_WITH_ETAG.getEtag();
    EnableSecretVersionWithEtag.enableSecretVersion(name.getProject(), name.getSecret(), name.getSecretVersion(), etag);
    assertThat(stdOut.toString()).contains("Enabled secret version");
}
Also used : SecretVersionName(com.google.cloud.secretmanager.v1.SecretVersionName) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

SecretManagerServiceClient (com.google.cloud.secretmanager.v1.SecretManagerServiceClient)49 SecretName (com.google.cloud.secretmanager.v1.SecretName)43 Test (org.junit.Test)42 SecretVersionName (com.google.cloud.secretmanager.v1.SecretVersionName)37 SecretVersion (com.google.cloud.secretmanager.v1.SecretVersion)20 Secret (com.google.cloud.secretmanager.v1.Secret)19 ProjectName (com.google.cloud.secretmanager.v1.ProjectName)14 ByteString (com.google.protobuf.ByteString)10 AccessSecretVersionResponse (com.google.cloud.secretmanager.v1.AccessSecretVersionResponse)7 CreateSecretRequest (com.google.cloud.secretmanager.v1.CreateSecretRequest)6 ListSecretsPagedResponse (com.google.cloud.secretmanager.v1.SecretManagerServiceClient.ListSecretsPagedResponse)6 SecretPayload (com.google.cloud.secretmanager.v1.SecretPayload)5 Test (org.junit.jupiter.api.Test)5 AddSecretVersionRequest (com.google.cloud.secretmanager.v1.AddSecretVersionRequest)4 DeleteSecretRequest (com.google.cloud.secretmanager.v1.DeleteSecretRequest)4 ListSecretVersionsPagedResponse (com.google.cloud.secretmanager.v1.SecretManagerServiceClient.ListSecretVersionsPagedResponse)4 Binding (com.google.iam.v1.Binding)4 Policy (com.google.iam.v1.Policy)4 ListSecretsRequest (com.google.cloud.secretmanager.v1.ListSecretsRequest)3 Secret (com.google.cloud.secretmanager.v1beta1.Secret)3