use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by GoogleCloudPlatform.
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 spring-cloud-gcp by GoogleCloudPlatform.
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 GoogleCloudPlatform.
the class SecretManagerPropertyUtilsTests method testLongProperty_projectSecretVersion.
@Test
void testLongProperty_projectSecretVersion() {
String property = "sm://projects/my-project/secrets/the-secret/versions/3";
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("3");
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerPropertyUtilsTests method testLongProperty_projectSecretVersion.
@Test
public void testLongProperty_projectSecretVersion() {
String property = "sm://projects/my-project/secrets/the-secret/versions/3";
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("3");
}
use of com.google.cloud.secretmanager.v1.SecretVersionName in project spring-cloud-gcp by spring-cloud.
the class SecretManagerPropertyUtilsTests method testNonSecret.
@Test
public void testNonSecret() {
String property = "spring.cloud.datasource";
SecretVersionName secretIdentifier = SecretManagerPropertyUtils.getSecretVersionName(property, DEFAULT_PROJECT_ID_PROVIDER);
assertThat(secretIdentifier).isNull();
}
Aggregations