Search in sources :

Example 1 with ExportResourcesRequest

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);
    }
}
Also used : FhirStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) ExportResourcesRequest(com.google.api.services.healthcare.v1.model.ExportResourcesRequest) Operation(com.google.api.services.healthcare.v1.model.Operation) GoogleCloudHealthcareV1FhirGcsDestination(com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsDestination) IOException(java.io.IOException)

Example 2 with ExportResourcesRequest

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();
}
Also used : ExportResourcesRequest(com.google.api.services.healthcare.v1.model.ExportResourcesRequest) GoogleCloudHealthcareV1FhirGcsDestination(com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsDestination)

Aggregations

ExportResourcesRequest (com.google.api.services.healthcare.v1.model.ExportResourcesRequest)2 GoogleCloudHealthcareV1FhirGcsDestination (com.google.api.services.healthcare.v1.model.GoogleCloudHealthcareV1FhirGcsDestination)2 CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)1 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)1 Operation (com.google.api.services.healthcare.v1.model.Operation)1 IOException (java.io.IOException)1