use of com.google.api.services.healthcare.v1.model.ListDatasetsResponse in project java-docs-samples by GoogleCloudPlatform.
the class DatasetList method datasetList.
public static void datasetList(String projectId, String regionId) throws IOException {
// String projectId = "your-project-id";
// String regionId = "us-central1";
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Results are paginated, so multiple queries may be required.
String parentName = String.format("projects/%s/locations/%s", projectId, regionId);
String pageToken = null;
List<Dataset> datasets = new ArrayList<>();
do {
// Create request and configure any parameters.
Datasets.List request = client.projects().locations().datasets().list(parentName).setPageSize(// Specify pageSize up to 1000
100).setPageToken(pageToken);
// Execute response and collect results.
ListDatasetsResponse response = request.execute();
datasets.addAll(response.getDatasets());
// Update the page token for the next request.
pageToken = response.getNextPageToken();
} while (pageToken != null);
// Print results.
System.out.printf("Retrieved %s datasets: \n", datasets.size());
for (Dataset data : datasets) {
System.out.println("\t" + data.toPrettyString());
}
}
Aggregations