use of com.google.api.services.healthcare.v1.model.ExportResourcesRequest in project java-docs-samples by GoogleCloudPlatform.
the class FhirStoreExport method fhirStoreExport.
public static void fhirStoreExport(String fhirStoreName, String gcsUri) throws IOException {
// String fhirStoreName =
// String.format(
// FHIR_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-fhir-id");
// String gcsUri = "gs://your-bucket-id/path/to/destination/dir"
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure where the store will be exported too.
GoogleCloudHealthcareV1FhirGcsDestination gcsDestination = new GoogleCloudHealthcareV1FhirGcsDestination().setUriPrefix(gcsUri);
ExportResourcesRequest exportRequest = new ExportResourcesRequest().setGcsDestination(gcsDestination);
// Create request and configure any parameters.
FhirStores.Export request = client.projects().locations().datasets().fhirStores().export(fhirStoreName, exportRequest);
// Execute the request, wait for the operation to complete, and process the results.
try {
Operation operation = request.execute();
while (operation.getDone() == null || !operation.getDone()) {
// Update the status of the operation with another request.
// Pause for 500ms between requests.
Thread.sleep(500);
operation = client.projects().locations().datasets().operations().get(operation.getName()).execute();
}
System.out.println("Fhir store export complete." + operation.getResponse());
} catch (Exception ex) {
System.out.printf("Error during request execution: %s", ex.toString());
ex.printStackTrace(System.out);
}
}
use of com.google.api.services.healthcare.v1.model.ExportResourcesRequest in project beam by apache.
the class HttpHealthcareApiClient method exportFhirResourceToGcs.
@Override
public Operation exportFhirResourceToGcs(String fhirStore, String gcsDestinationPrefix) throws IOException {
GoogleCloudHealthcareV1FhirGcsDestination gcsDst = new GoogleCloudHealthcareV1FhirGcsDestination();
gcsDst.setUriPrefix(gcsDestinationPrefix);
ExportResourcesRequest exportRequest = new ExportResourcesRequest();
exportRequest.setGcsDestination(gcsDst);
return client.projects().locations().datasets().fhirStores().export(fhirStore, exportRequest).execute();
}
Aggregations