use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.
the class AsyncRestoreCryptoKeyVersion method asyncRestoreCryptoKeyVersion.
public static void asyncRestoreCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
RestoreCryptoKeyVersionRequest request = RestoreCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.restoreCryptoKeyVersionCallable().futureCall(request);
// Do something.
CryptoKeyVersion response = future.get();
}
}
use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.
the class SyncRestoreCryptoKeyVersion method syncRestoreCryptoKeyVersion.
public static void syncRestoreCryptoKeyVersion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
RestoreCryptoKeyVersionRequest request = RestoreCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(request);
}
}
use of com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion 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);
}
}
use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.
the class SyncCreateCryptoKeyVersionCryptokeynameCryptokeyversion method syncCreateCryptoKeyVersionCryptokeynameCryptokeyversion.
public static void syncCreateCryptoKeyVersionCryptokeynameCryptokeyversion() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
}
}
Aggregations