use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncGetCryptoKeyVersion method asyncGetCryptoKeyVersion.
public static void asyncGetCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetCryptoKeyVersionRequest request = GetCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.getCryptoKeyVersionCallable().futureCall(request);
// Do something.
CryptoKeyVersion response = future.get();
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncGetCryptoKeyVersion method syncGetCryptoKeyVersion.
public static void syncGetCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetCryptoKeyVersionRequest request = GetCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(request);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncGetIamPolicy method asyncGetIamPolicy.
public static void asyncGetIamPolicy() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setOptions(GetPolicyOptions.newBuilder().build()).build();
ApiFuture<Policy> future = keyManagementServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncEncryptResourcenameBytestring method syncEncryptResourcenameBytestring.
public static void syncEncryptResourcenameBytestring() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ResourceName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString plaintext = ByteString.EMPTY;
EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncGetImportJobString method syncGetImportJobString.
public static void syncGetImportJobString() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
String name = ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]").toString();
ImportJob response = keyManagementServiceClient.getImportJob(name);
}
}
Aggregations