Search in sources :

Example 1 with UpdateCryptoKeyPrimaryVersionRequest

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

the class SyncUpdateCryptoKeyPrimaryVersion method syncUpdateCryptoKeyPrimaryVersion.

public static void syncUpdateCryptoKeyPrimaryVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        UpdateCryptoKeyPrimaryVersionRequest request = UpdateCryptoKeyPrimaryVersionRequest.newBuilder().setName(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCryptoKeyVersionId("cryptoKeyVersionId987674581").build();
        CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(request);
    }
}
Also used : CryptoKey(com.google.cloud.kms.v1.CryptoKey) UpdateCryptoKeyPrimaryVersionRequest(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with UpdateCryptoKeyPrimaryVersionRequest

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

the class AsyncUpdateCryptoKeyPrimaryVersion method asyncUpdateCryptoKeyPrimaryVersion.

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

Aggregations

CryptoKey (com.google.cloud.kms.v1.CryptoKey)2 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)2 UpdateCryptoKeyPrimaryVersionRequest (com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest)2