Search in sources :

Example 1 with ImportCryptoKeyVersionRequest

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

the class AsyncImportCryptoKeyVersion method asyncImportCryptoKeyVersion.

public static void asyncImportCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ImportCryptoKeyVersionRequest request = ImportCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setImportJob("importJob-208547368").build();
        ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.importCryptoKeyVersionCallable().futureCall(request);
        // Do something.
        CryptoKeyVersion response = future.get();
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) ImportCryptoKeyVersionRequest(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with ImportCryptoKeyVersionRequest

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

the class SyncImportCryptoKeyVersion method syncImportCryptoKeyVersion.

public static void syncImportCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ImportCryptoKeyVersionRequest request = ImportCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setImportJob("importJob-208547368").build();
        CryptoKeyVersion response = keyManagementServiceClient.importCryptoKeyVersion(request);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) ImportCryptoKeyVersionRequest(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

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