Search in sources :

Example 1 with CreateImportJobRequest

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

the class AsyncCreateImportJob method asyncCreateImportJob.

public static void asyncCreateImportJob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CreateImportJobRequest request = CreateImportJobRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setImportJobId("importJobId1449444627").setImportJob(ImportJob.newBuilder().build()).build();
        ApiFuture<ImportJob> future = keyManagementServiceClient.createImportJobCallable().futureCall(request);
        // Do something.
        ImportJob response = future.get();
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) CreateImportJobRequest(com.google.cloud.kms.v1.CreateImportJobRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with CreateImportJobRequest

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

the class SyncCreateImportJob method syncCreateImportJob.

public static void syncCreateImportJob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CreateImportJobRequest request = CreateImportJobRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setImportJobId("importJobId1449444627").setImportJob(ImportJob.newBuilder().build()).build();
        ImportJob response = keyManagementServiceClient.createImportJob(request);
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) CreateImportJobRequest(com.google.cloud.kms.v1.CreateImportJobRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

CreateImportJobRequest (com.google.cloud.kms.v1.CreateImportJobRequest)2 ImportJob (com.google.cloud.kms.v1.ImportJob)2 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)2