use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.
the class SnippetsIT method testListSecretVersions.
@Test
public void testListSecretVersions() throws IOException {
SecretName name = SecretName.parse(TEST_SECRET_WITH_VERSIONS.getName());
new ListSecretVersions().listSecretVersions(name.getProject(), name.getSecret());
assertThat(stdOut.toString()).contains("Secret version");
}
use of com.google.cloud.secretmanager.v1.SecretName in project java-secretmanager by googleapis.
the class SnippetsIT method testAddSecretVersion.
@Test
public void testAddSecretVersion() throws IOException {
SecretName name = SecretName.parse(TEST_SECRET_WITH_VERSIONS.getName());
new AddSecretVersion().addSecretVersion(name.getProject(), name.getSecret());
assertThat(stdOut.toString()).contains("Added secret version");
}
use of com.google.cloud.secretmanager.v1.SecretName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerTemplate method createNewSecretVersion.
/**
* Create a new version of the secret with the specified payload under a {@link Secret}.
* Will also create the parent secret if it does not already exist.
*/
private void createNewSecretVersion(String secretId, ByteString payload, String projectId) {
if (!secretExists(secretId, projectId)) {
createSecretInternal(secretId, projectId);
}
SecretName name = SecretName.of(projectId, secretId);
AddSecretVersionRequest payloadRequest = AddSecretVersionRequest.newBuilder().setParent(name.toString()).setPayload(SecretPayload.newBuilder().setData(payload)).build();
secretManagerServiceClient.addSecretVersion(payloadRequest);
}
use of com.google.cloud.secretmanager.v1.SecretName in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method testListSecretVersionsWithFilter.
@Test
public void testListSecretVersionsWithFilter() throws IOException {
SecretName name = SecretName.parse(TEST_SECRET_WITH_VERSIONS.getName());
ListSecretVersionsWithFilter.listSecretVersions(name.getProject(), name.getSecret(), "name:1");
assertThat(stdOut.toString()).contains("Secret version");
}
use of com.google.cloud.secretmanager.v1.SecretName in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method testDeleteSecret.
@Test
public void testDeleteSecret() throws IOException {
SecretName name = SecretName.parse(TEST_SECRET_TO_DELETE.getName());
DeleteSecret.deleteSecret(name.getProject(), name.getSecret());
assertThat(stdOut.toString()).contains("Deleted secret");
}
Aggregations