use of com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest in project gapic-generator-java by googleapis.
the class AsyncCreateCryptoKeyVersion method asyncCreateCryptoKeyVersion.
public static void asyncCreateCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CreateCryptoKeyVersionRequest request = CreateCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build()).build();
ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.createCryptoKeyVersionCallable().futureCall(request);
// Do something.
CryptoKeyVersion response = future.get();
}
}
use of com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest in project gapic-generator-java by googleapis.
the class SyncCreateCryptoKeyVersion method syncCreateCryptoKeyVersion.
public static void syncCreateCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CreateCryptoKeyVersionRequest request = CreateCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build()).build();
CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(request);
}
}
Aggregations