use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.
the class FhirStoreGetIamPolicy method fhirStoreGetIamPolicy.
public static void fhirStoreGetIamPolicy(String fhirStoreName) throws IOException {
// String fhirStoreName =
// String.format(
// FHIR_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-fhir-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
FhirStores.GetIamPolicy request = client.projects().locations().datasets().fhirStores().getIamPolicy(fhirStoreName);
// Execute the request and process the results.
Policy policy = request.execute();
System.out.println("FHIR store IAMPolicy retrieved: \n" + policy.toPrettyString());
}
use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.
the class FhirStoreGetMetadata method fhirStoreGetMetadata.
public static void fhirStoreGetMetadata(String fhirStoreName) throws IOException {
// String fhirStoreName =
// String.format(
// FHIR_NAME, "project-id", "region-id", "dataset-id", "store-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
Capabilities request = client.projects().locations().datasets().fhirStores().fhir().capabilities(fhirStoreName);
// Execute the request and process the results.
HttpBody response = request.execute();
System.out.println("FHIR store metadata retrieved: " + response.toPrettyString());
}
use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.
the class FhirStoreImport method fhirStoreImport.
public static void fhirStoreImport(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 should be imported from.
GoogleCloudHealthcareV1FhirGcsSource gcsSource = new GoogleCloudHealthcareV1FhirGcsSource().setUri(gcsUri);
ImportResourcesRequest importRequest = new ImportResourcesRequest().setGcsSource(gcsSource);
// Create request and configure any parameters.
FhirStores.CloudHealthcareImport request = client.projects().locations().datasets().fhirStores().healthcareImport(fhirStoreName, importRequest);
// 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 import 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.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.
the class DicomStoreSetIamPolicy method dicomStoreSetIamPolicy.
public static void dicomStoreSetIamPolicy(String dicomStoreName) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure the IAMPolicy to apply to the store.
// For more information on understanding IAM roles, see the following:
// https://cloud.google.com/iam/docs/understanding-roles
Binding binding = new Binding().setRole("roles/healthcare.dicomStoreAdmin").setMembers(Arrays.asList("domain:google.com"));
Policy policy = new Policy().setBindings(Arrays.asList(binding));
SetIamPolicyRequest policyRequest = new SetIamPolicyRequest().setPolicy(policy);
// Create request and configure any parameters.
DicomStores.SetIamPolicy request = client.projects().locations().datasets().dicomStores().setIamPolicy(dicomStoreName, policyRequest);
// Execute the request and process the results.
Policy updatedPolicy = request.execute();
System.out.println("DICOM policy has been updated: " + updatedPolicy.toPrettyString());
}
use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.
the class DicomWebRetrieveRendered method dicomWebRetrieveRendered.
public static void dicomWebRetrieveRendered(String dicomStoreName, String dicomWebPath) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// String dicomWebPath = String.format(DICOMWEB_PATH, "your-study-id", "your-series-id",
// "your-instance-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
Instances.RetrieveRendered request = client.projects().locations().datasets().dicomStores().studies().series().instances().retrieveRendered(dicomStoreName, dicomWebPath);
// Execute the request and process the results.
HttpResponse response = request.executeUnparsed();
String outputPath = "image.png";
OutputStream outputStream = new FileOutputStream(new File(outputPath));
try {
response.download(outputStream);
System.out.println("DICOM rendered PNG image written to file " + outputPath);
} finally {
outputStream.close();
}
if (!response.isSuccessStatusCode()) {
System.err.print(String.format("Exception retrieving DICOM rendered image: %s\n", response.getStatusMessage()));
throw new RuntimeException();
}
}
Aggregations