Search in sources :

Example 11 with ImportJob

use of com.google.cloud.kms.v1.ImportJob 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)

Example 12 with ImportJob

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

the class AsyncGetImportJob method asyncGetImportJob.

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

Example 13 with ImportJob

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

the class SyncGetImportJob method syncGetImportJob.

public static void syncGetImportJob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        GetImportJobRequest request = GetImportJobRequest.newBuilder().setName(ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]").toString()).build();
        ImportJob response = keyManagementServiceClient.getImportJob(request);
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient) GetImportJobRequest(com.google.cloud.kms.v1.GetImportJobRequest)

Example 14 with ImportJob

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

the class SyncGetImportJobImportjobname method syncGetImportJobImportjobname.

public static void syncGetImportJobImportjobname() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ImportJobName name = ImportJobName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
        ImportJob response = keyManagementServiceClient.getImportJob(name);
    }
}
Also used : ImportJobName(com.google.cloud.kms.v1.ImportJobName) ImportJob(com.google.cloud.kms.v1.ImportJob) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 15 with ImportJob

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

the class AsyncListImportJobs method asyncListImportJobs.

public static void asyncListImportJobs() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ListImportJobsRequest request = ListImportJobsRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setFilter("filter-1274492040").setOrderBy("orderBy-1207110587").build();
        ApiFuture<ImportJob> future = keyManagementServiceClient.listImportJobsPagedCallable().futureCall(request);
        // Do something.
        for (ImportJob element : future.get().iterateAll()) {
        // doThingsWith(element);
        }
    }
}
Also used : ListImportJobsRequest(com.google.cloud.kms.v1.ListImportJobsRequest) ImportJob(com.google.cloud.kms.v1.ImportJob) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)12 ImportJob (com.google.cloud.kms.v1.ImportJob)10 ListImportJobsPagedResponse (com.google.cloud.kms.v1.KeyManagementServiceClient.ListImportJobsPagedResponse)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 CreateImportJobRequest (com.google.cloud.kms.v1.CreateImportJobRequest)2 CryptoKeyVersion (com.google.cloud.kms.v1.CryptoKeyVersion)2 GetImportJobRequest (com.google.cloud.kms.v1.GetImportJobRequest)2 ImportCryptoKeyVersionRequest (com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest)2 ListImportJobsRequest (com.google.cloud.kms.v1.ListImportJobsRequest)2 ByteString (com.google.protobuf.ByteString)2 ImportJobName (com.google.cloud.kms.v1.ImportJobName)1 KeyRingName (com.google.cloud.kms.v1.KeyRingName)1 ListImportJobsResponse (com.google.cloud.kms.v1.ListImportJobsResponse)1