use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerPropertyUtilsTests method testShortProperty_projectSecretIdVersion.
@Test
public void testShortProperty_projectSecretIdVersion() {
String property = "sm://my-project/the-secret/2";
SecretVersionName secretIdentifier = SecretManagerPropertyUtils.getSecretVersionName(property, DEFAULT_PROJECT_ID_PROVIDER);
assertThat(secretIdentifier.getProject()).isEqualTo("my-project");
assertThat(secretIdentifier.getSecret()).isEqualTo("the-secret");
assertThat(secretIdentifier.getSecretVersion()).isEqualTo("2");
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerTemplateTests method verifyDisableSecretVersionRequest.
private void verifyDisableSecretVersionRequest(String secretId, String version, String projectId) {
SecretVersionName secretVersionName = SecretVersionName.newBuilder().setProject(projectId).setSecret(secretId).setSecretVersion(version).build();
verify(this.client).disableSecretVersion(secretVersionName);
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerTemplate method disableSecretVersion.
@Override
public void disableSecretVersion(String secretId, String version, String projectId) {
SecretVersionName secretVersionName = SecretVersionName.newBuilder().setProject(projectId).setSecret(secretId).setSecretVersion(version).build();
this.secretManagerServiceClient.disableSecretVersion(secretVersionName);
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerTemplate method enableSecretVersion.
@Override
public void enableSecretVersion(String secretId, String version, String projectId) {
SecretVersionName secretVersionName = SecretVersionName.newBuilder().setProject(projectId).setSecret(secretId).setSecretVersion(version).build();
this.secretManagerServiceClient.enableSecretVersion(secretVersionName);
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method testGetSecretVersion.
@Test
public void testGetSecretVersion() throws IOException {
SecretVersionName name = SecretVersionName.parse(TEST_SECRET_VERSION.getName());
GetSecretVersion.getSecretVersion(name.getProject(), name.getSecret(), name.getSecretVersion());
assertThat(stdOut.toString()).contains("Secret version");
assertThat(stdOut.toString()).contains("state ENABLED");
}
Aggregations