1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CloudHealthcare\Resource;
19
20use Google\Service\CloudHealthcare\Dataset;
21use Google\Service\CloudHealthcare\DeidentifyDatasetRequest;
22use Google\Service\CloudHealthcare\HealthcareEmpty;
23use Google\Service\CloudHealthcare\ListDatasetsResponse;
24use Google\Service\CloudHealthcare\Operation;
25use Google\Service\CloudHealthcare\Policy;
26use Google\Service\CloudHealthcare\SetIamPolicyRequest;
27use Google\Service\CloudHealthcare\TestIamPermissionsRequest;
28use Google\Service\CloudHealthcare\TestIamPermissionsResponse;
29
30/**
31 * The "datasets" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $healthcareService = new Google\Service\CloudHealthcare(...);
35 *   $datasets = $healthcareService->datasets;
36 *  </code>
37 */
38class ProjectsLocationsDatasets extends \Google\Service\Resource
39{
40  /**
41   * Creates a new health dataset. Results are returned through the Operation
42   * interface which returns either an `Operation.response` which contains a
43   * Dataset or `Operation.error`. The metadata field type is OperationMetadata.
44   * (datasets.create)
45   *
46   * @param string $parent The name of the project where the server creates the
47   * dataset. For example, `projects/{project_id}/locations/{location_id}`.
48   * @param Dataset $postBody
49   * @param array $optParams Optional parameters.
50   *
51   * @opt_param string datasetId The ID of the dataset that is being created. The
52   * string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`.
53   * @return Operation
54   */
55  public function create($parent, Dataset $postBody, $optParams = [])
56  {
57    $params = ['parent' => $parent, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('create', [$params], Operation::class);
60  }
61  /**
62   * Creates a new dataset containing de-identified data from the source dataset.
63   * The metadata field type is OperationMetadata. If the request is successful,
64   * the response field type is DeidentifySummary. If errors occur, error is set.
65   * The LRO result may still be successful if de-identification fails for some
66   * DICOM instances. The new de-identified dataset will not contain these failed
67   * resources. Failed resource totals are tracked in Operation.metadata. Error
68   * details are also logged to Cloud Logging. For more information, see [Viewing
69   * error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-
70   * tos/logging). (datasets.deidentify)
71   *
72   * @param string $sourceDataset Source dataset resource name. For example,
73   * `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
74   * @param DeidentifyDatasetRequest $postBody
75   * @param array $optParams Optional parameters.
76   * @return Operation
77   */
78  public function deidentify($sourceDataset, DeidentifyDatasetRequest $postBody, $optParams = [])
79  {
80    $params = ['sourceDataset' => $sourceDataset, 'postBody' => $postBody];
81    $params = array_merge($params, $optParams);
82    return $this->call('deidentify', [$params], Operation::class);
83  }
84  /**
85   * Deletes the specified health dataset and all data contained in the dataset.
86   * Deleting a dataset does not affect the sources from which the dataset was
87   * imported (if any). (datasets.delete)
88   *
89   * @param string $name The name of the dataset to delete. For example,
90   * `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
91   * @param array $optParams Optional parameters.
92   * @return HealthcareEmpty
93   */
94  public function delete($name, $optParams = [])
95  {
96    $params = ['name' => $name];
97    $params = array_merge($params, $optParams);
98    return $this->call('delete', [$params], HealthcareEmpty::class);
99  }
100  /**
101   * Gets any metadata associated with a dataset. (datasets.get)
102   *
103   * @param string $name The name of the dataset to read. For example,
104   * `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
105   * @param array $optParams Optional parameters.
106   * @return Dataset
107   */
108  public function get($name, $optParams = [])
109  {
110    $params = ['name' => $name];
111    $params = array_merge($params, $optParams);
112    return $this->call('get', [$params], Dataset::class);
113  }
114  /**
115   * Gets the access control policy for a resource. Returns an empty policy if the
116   * resource exists and does not have a policy set. (datasets.getIamPolicy)
117   *
118   * @param string $resource REQUIRED: The resource for which the policy is being
119   * requested. See the operation documentation for the appropriate value for this
120   * field.
121   * @param array $optParams Optional parameters.
122   *
123   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
124   * version that will be used to format the policy. Valid values are 0, 1, and 3.
125   * Requests specifying an invalid value will be rejected. Requests for policies
126   * with any conditional role bindings must specify version 3. Policies with no
127   * conditional role bindings may specify any valid value or leave the field
128   * unset. The policy in the response might use the policy version that you
129   * specified, or it might use a lower policy version. For example, if you
130   * specify version 3, but the policy has no conditional role bindings, the
131   * response uses version 1. To learn which resources support conditions in their
132   * IAM policies, see the [IAM
133   * documentation](https://cloud.google.com/iam/help/conditions/resource-
134   * policies).
135   * @return Policy
136   */
137  public function getIamPolicy($resource, $optParams = [])
138  {
139    $params = ['resource' => $resource];
140    $params = array_merge($params, $optParams);
141    return $this->call('getIamPolicy', [$params], Policy::class);
142  }
143  /**
144   * Lists the health datasets in the current project.
145   * (datasets.listProjectsLocationsDatasets)
146   *
147   * @param string $parent The name of the project whose datasets should be
148   * listed. For example, `projects/{project_id}/locations/{location_id}`.
149   * @param array $optParams Optional parameters.
150   *
151   * @opt_param int pageSize The maximum number of items to return. If not
152   * specified, 100 is used. May not be larger than 1000.
153   * @opt_param string pageToken The next_page_token value returned from a
154   * previous List request, if any.
155   * @return ListDatasetsResponse
156   */
157  public function listProjectsLocationsDatasets($parent, $optParams = [])
158  {
159    $params = ['parent' => $parent];
160    $params = array_merge($params, $optParams);
161    return $this->call('list', [$params], ListDatasetsResponse::class);
162  }
163  /**
164   * Updates dataset metadata. (datasets.patch)
165   *
166   * @param string $name Resource name of the dataset, of the form
167   * `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
168   * @param Dataset $postBody
169   * @param array $optParams Optional parameters.
170   *
171   * @opt_param string updateMask The update mask applies to the resource. For the
172   * `FieldMask` definition, see https://developers.google.com/protocol-
173   * buffers/docs/reference/google.protobuf#fieldmask
174   * @return Dataset
175   */
176  public function patch($name, Dataset $postBody, $optParams = [])
177  {
178    $params = ['name' => $name, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('patch', [$params], Dataset::class);
181  }
182  /**
183   * Sets the access control policy on the specified resource. Replaces any
184   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
185   * `PERMISSION_DENIED` errors. (datasets.setIamPolicy)
186   *
187   * @param string $resource REQUIRED: The resource for which the policy is being
188   * specified. See the operation documentation for the appropriate value for this
189   * field.
190   * @param SetIamPolicyRequest $postBody
191   * @param array $optParams Optional parameters.
192   * @return Policy
193   */
194  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
195  {
196    $params = ['resource' => $resource, 'postBody' => $postBody];
197    $params = array_merge($params, $optParams);
198    return $this->call('setIamPolicy', [$params], Policy::class);
199  }
200  /**
201   * Returns permissions that a caller has on the specified resource. If the
202   * resource does not exist, this will return an empty set of permissions, not a
203   * `NOT_FOUND` error. Note: This operation is designed to be used for building
204   * permission-aware UIs and command-line tools, not for authorization checking.
205   * This operation may "fail open" without warning. (datasets.testIamPermissions)
206   *
207   * @param string $resource REQUIRED: The resource for which the policy detail is
208   * being requested. See the operation documentation for the appropriate value
209   * for this field.
210   * @param TestIamPermissionsRequest $postBody
211   * @param array $optParams Optional parameters.
212   * @return TestIamPermissionsResponse
213   */
214  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
215  {
216    $params = ['resource' => $resource, 'postBody' => $postBody];
217    $params = array_merge($params, $optParams);
218    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
219  }
220}
221
222// Adding a class alias for backwards compatibility with the previous class name.
223class_alias(ProjectsLocationsDatasets::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasets');
224