Search in sources :

Example 31 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DatasetDelete method datasetDelete.

public static void datasetDelete(String datasetName) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Create request and configure any parameters.
    Datasets.Delete request = client.projects().locations().datasets().delete(datasetName);
    // Execute the request and process the results.
    request.execute();
    System.out.println("Dataset deleted.");
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 32 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DatasetGetIamPolicy method datasetGetIamPolicy.

public static void datasetGetIamPolicy(String datasetName) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Create request and configure any parameters.
    Datasets.GetIamPolicy request = client.projects().locations().datasets().getIamPolicy(datasetName);
    // Execute the request and process the results.
    Policy policy = request.execute();
    System.out.println("Dataset IAMPolicy retrieved: \n" + policy.toPrettyString());
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Policy(com.google.api.services.healthcare.v1.model.Policy) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 33 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets 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());
    }
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Dataset(com.google.api.services.healthcare.v1.model.Dataset) ArrayList(java.util.ArrayList) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) ListDatasetsResponse(com.google.api.services.healthcare.v1.model.ListDatasetsResponse)

Example 34 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DatasetPatch method datasetPatch.

public static void datasetPatch(String datasetName) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Fetch the initial state of the dataset.
    Datasets.Get getRequest = client.projects().locations().datasets().get(datasetName);
    Dataset dataset = getRequest.execute();
    // Update the Dataset fields as needed as needed. For a full list of dataset fields, see:
    // https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets#Dataset
    dataset.setTimeZone("America/New_York");
    // Create request and configure any parameters.
    Datasets.Patch request = client.projects().locations().datasets().patch(datasetName, dataset).setUpdateMask("timeZone");
    // Execute the request and process the results.
    dataset = request.execute();
    System.out.println("Dataset patched: \n" + dataset.toPrettyString());
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Dataset(com.google.api.services.healthcare.v1.model.Dataset) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 35 with Datasets

use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets in project java-docs-samples by GoogleCloudPlatform.

the class DatasetSetIamPolicy method datasetSetIamPolicy.

public static void datasetSetIamPolicy(String datasetName) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Configure the IAMPolicy to apply to the dataset.
    // 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.datasetViewer").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.
    Datasets.SetIamPolicy request = client.projects().locations().datasets().setIamPolicy(datasetName, policyRequest);
    // Execute the request and process the results.
    Policy updatedPolicy = request.execute();
    System.out.println("Dataset policy has been updated: " + updatedPolicy.toPrettyString());
}
Also used : Binding(com.google.api.services.healthcare.v1.model.Binding) Policy(com.google.api.services.healthcare.v1.model.Policy) Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) SetIamPolicyRequest(com.google.api.services.healthcare.v1.model.SetIamPolicyRequest) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Aggregations

CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)46 DicomStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores)11 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)9 Datasets (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets)8 Policy (com.google.api.services.healthcare.v1.model.Policy)8 Hl7V2Stores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores)7 FhirStore (com.google.api.services.healthcare.v1.model.FhirStore)6 Message (com.google.api.services.healthcare.v1.model.Message)6 Operation (com.google.api.services.healthcare.v1.model.Operation)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 HttpResponse (com.google.api.client.http.HttpResponse)5 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)5 DicomStore (com.google.api.services.healthcare.v1.model.DicomStore)5 Binding (com.google.api.services.healthcare.v1.model.Binding)4 Dataset (com.google.api.services.healthcare.v1.model.Dataset)4 Hl7V2Store (com.google.api.services.healthcare.v1.model.Hl7V2Store)4 NotificationConfig (com.google.api.services.healthcare.v1.model.NotificationConfig)4 SetIamPolicyRequest (com.google.api.services.healthcare.v1.model.SetIamPolicyRequest)4 HashMap (java.util.HashMap)4