Search in sources :

Example 1 with GetCryptoKeyVersionRequest

use of com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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();
    }
}
Also used : GetCryptoKeyVersionRequest(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with GetCryptoKeyVersionRequest

use of com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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);
    }
}
Also used : GetCryptoKeyVersionRequest(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

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