Search in sources :

Example 51 with SecretName

use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.

the class SnippetsIT method testIamGrantAccess.

@Test
public void testIamGrantAccess() throws IOException {
    SecretName name = SecretName.parse(TEST_SECRET.getName());
    new IamGrantAccess().iamGrantAccess(name.getProject(), name.getSecret(), IAM_USER);
    assertThat(stdOut.toString()).contains("Updated IAM policy");
}
Also used : SecretName(com.google.cloud.secretmanager.v1.SecretName) Test(org.junit.Test)

Example 52 with SecretName

use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.

the class SnippetsIT method testCreateSecret.

@Test
public void testCreateSecret() throws IOException {
    SecretName name = TEST_SECRET_TO_CREATE_NAME;
    new CreateSecret().createSecret(name.getProject(), name.getSecret());
    assertThat(stdOut.toString()).contains("Created secret");
}
Also used : SecretName(com.google.cloud.secretmanager.v1.SecretName) Test(org.junit.Test)

Example 53 with SecretName

use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.

the class SnippetsIT method testListSecrets.

@Test
public void testListSecrets() throws IOException {
    SecretName name = SecretName.parse(TEST_SECRET.getName());
    new ListSecrets().listSecrets(name.getProject());
    assertThat(stdOut.toString()).contains("Secret projects/");
    assertThat(stdOut.toString()).contains(name.getSecret());
}
Also used : SecretName(com.google.cloud.secretmanager.v1.SecretName) Test(org.junit.Test)

Example 54 with SecretName

use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.

the class SnippetsIT method testUpdateSecret.

@Test
public void testUpdateSecret() throws IOException {
    SecretName name = SecretName.parse(TEST_SECRET.getName());
    new UpdateSecret().updateSecret(name.getProject(), name.getSecret());
    assertThat(stdOut.toString()).contains("Updated secret");
}
Also used : SecretName(com.google.cloud.secretmanager.v1.SecretName) Test(org.junit.Test)

Aggregations

SecretName (com.google.cloud.secretmanager.v1.SecretName)52 SecretManagerServiceClient (com.google.cloud.secretmanager.v1.SecretManagerServiceClient)23 Test (org.junit.Test)22 DeleteSecretRequest (com.google.cloud.secretmanager.v1.DeleteSecretRequest)8 Secret (com.google.cloud.secretmanager.v1.Secret)5 SecretVersion (com.google.cloud.secretmanager.v1.SecretVersion)5 AddSecretVersionRequest (com.google.cloud.secretmanager.v1.AddSecretVersionRequest)4 ListSecretVersionsPagedResponse (com.google.cloud.secretmanager.v1.SecretManagerServiceClient.ListSecretVersionsPagedResponse)4 SecretPayload (com.google.cloud.secretmanager.v1.SecretPayload)4 Binding (com.google.iam.v1.Binding)4 Policy (com.google.iam.v1.Policy)4 FieldMask (com.google.protobuf.FieldMask)3 AfterClass (org.junit.AfterClass)3 ListSecretVersionsRequest (com.google.cloud.secretmanager.v1.ListSecretVersionsRequest)2 AccessSecretVersionResponse (com.google.cloud.secretmanager.v1.AccessSecretVersionResponse)1 SecretVersionName (com.google.cloud.secretmanager.v1.SecretVersionName)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 ByteString (com.google.protobuf.ByteString)1 EventListener (io.micronaut.runtime.event.annotation.EventListener)1 ArrayList (java.util.ArrayList)1