Search in sources :

Example 1 with DestroyCryptoKeyVersionRequest

use of com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest in project gapic-generator-java by googleapis.

the class AsyncDestroyCryptoKeyVersion method asyncDestroyCryptoKeyVersion.

public static void asyncDestroyCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        DestroyCryptoKeyVersionRequest request = DestroyCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
        ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.destroyCryptoKeyVersionCallable().futureCall(request);
        // Do something.
        CryptoKeyVersion response = future.get();
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) DestroyCryptoKeyVersionRequest(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with DestroyCryptoKeyVersionRequest

use of com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest in project gapic-generator-java by googleapis.

the class SyncDestroyCryptoKeyVersion method syncDestroyCryptoKeyVersion.

public static void syncDestroyCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        DestroyCryptoKeyVersionRequest request = DestroyCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
        CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(request);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) DestroyCryptoKeyVersionRequest(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

CryptoKeyVersion (com.google.cloud.kms.v1.CryptoKeyVersion)2 DestroyCryptoKeyVersionRequest (com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest)2 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)2