Search in sources :

Example 1 with CreateCryptoKeyVersionRequest

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

Example 2 with CreateCryptoKeyVersionRequest

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

Aggregations

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