Search in sources :

Example 6 with ListImportJobsRequest

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

the class AsyncListImportJobsPaged method asyncListImportJobsPaged.

public static void asyncListImportJobsPaged() 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();
        while (true) {
            ListImportJobsResponse response = keyManagementServiceClient.listImportJobsCallable().call(request);
            for (ImportJob element : response.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : ListImportJobsResponse(com.google.cloud.kms.v1.ListImportJobsResponse) ListImportJobsRequest(com.google.cloud.kms.v1.ListImportJobsRequest) ImportJob(com.google.cloud.kms.v1.ImportJob) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

ListImportJobsPagedResponse (com.google.cloud.kms.v1.KeyManagementServiceClient.ListImportJobsPagedResponse)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ImportJob (com.google.cloud.kms.v1.ImportJob)2 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)2 ListImportJobsRequest (com.google.cloud.kms.v1.ListImportJobsRequest)2 ByteString (com.google.protobuf.ByteString)2 ListImportJobsResponse (com.google.cloud.kms.v1.ListImportJobsResponse)1