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\DeidentifyFhirStoreRequest;
21use Google\Service\CloudHealthcare\ExportResourcesRequest;
22use Google\Service\CloudHealthcare\FhirStore;
23use Google\Service\CloudHealthcare\HealthcareEmpty;
24use Google\Service\CloudHealthcare\ImportResourcesRequest;
25use Google\Service\CloudHealthcare\ListFhirStoresResponse;
26use Google\Service\CloudHealthcare\Operation;
27use Google\Service\CloudHealthcare\Policy;
28use Google\Service\CloudHealthcare\SetIamPolicyRequest;
29use Google\Service\CloudHealthcare\TestIamPermissionsRequest;
30use Google\Service\CloudHealthcare\TestIamPermissionsResponse;
31
32/**
33 * The "fhirStores" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $healthcareService = new Google\Service\CloudHealthcare(...);
37 *   $fhirStores = $healthcareService->fhirStores;
38 *  </code>
39 */
40class ProjectsLocationsDatasetsFhirStores extends \Google\Service\Resource
41{
42  /**
43   * Creates a new FHIR store within the parent dataset. (fhirStores.create)
44   *
45   * @param string $parent The name of the dataset this FHIR store belongs to.
46   * @param FhirStore $postBody
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string fhirStoreId The ID of the FHIR store that is being created.
50   * The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`.
51   * @return FhirStore
52   */
53  public function create($parent, FhirStore $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], FhirStore::class);
58  }
59  /**
60   * De-identifies data from the source store and writes it to the destination
61   * store. The metadata field type is OperationMetadata. If the request is
62   * successful, the response field type is DeidentifyFhirStoreSummary. If errors
63   * occur, error is set. Error details are also logged to Cloud Logging (see
64   * [Viewing error logs in Cloud
65   * Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
66   * (fhirStores.deidentify)
67   *
68   * @param string $sourceStore Source FHIR store resource name. For example, `pro
69   * jects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{
70   * fhir_store_id}`.
71   * @param DeidentifyFhirStoreRequest $postBody
72   * @param array $optParams Optional parameters.
73   * @return Operation
74   */
75  public function deidentify($sourceStore, DeidentifyFhirStoreRequest $postBody, $optParams = [])
76  {
77    $params = ['sourceStore' => $sourceStore, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('deidentify', [$params], Operation::class);
80  }
81  /**
82   * Deletes the specified FHIR store and removes all resources within it.
83   * (fhirStores.delete)
84   *
85   * @param string $name The resource name of the FHIR store to delete.
86   * @param array $optParams Optional parameters.
87   * @return HealthcareEmpty
88   */
89  public function delete($name, $optParams = [])
90  {
91    $params = ['name' => $name];
92    $params = array_merge($params, $optParams);
93    return $this->call('delete', [$params], HealthcareEmpty::class);
94  }
95  /**
96   * Export resources from the FHIR store to the specified destination. This
97   * method returns an Operation that can be used to track the status of the
98   * export by calling GetOperation. Immediate fatal errors appear in the error
99   * field, errors are also logged to Cloud Logging (see [Viewing error logs in
100   * Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
101   * Otherwise, when the operation finishes, a detailed response of type
102   * ExportResourcesResponse is returned in the response field. The metadata field
103   * type for this operation is OperationMetadata. (fhirStores.export)
104   *
105   * @param string $name The name of the FHIR store to export resource from, in
106   * the format of `projects/{project_id}/locations/{location_id}/datasets/{datase
107   * t_id}/fhirStores/{fhir_store_id}`.
108   * @param ExportResourcesRequest $postBody
109   * @param array $optParams Optional parameters.
110   * @return Operation
111   */
112  public function export($name, ExportResourcesRequest $postBody, $optParams = [])
113  {
114    $params = ['name' => $name, 'postBody' => $postBody];
115    $params = array_merge($params, $optParams);
116    return $this->call('export', [$params], Operation::class);
117  }
118  /**
119   * Gets the configuration of the specified FHIR store. (fhirStores.get)
120   *
121   * @param string $name The resource name of the FHIR store to get.
122   * @param array $optParams Optional parameters.
123   * @return FhirStore
124   */
125  public function get($name, $optParams = [])
126  {
127    $params = ['name' => $name];
128    $params = array_merge($params, $optParams);
129    return $this->call('get', [$params], FhirStore::class);
130  }
131  /**
132   * Gets the access control policy for a resource. Returns an empty policy if the
133   * resource exists and does not have a policy set. (fhirStores.getIamPolicy)
134   *
135   * @param string $resource REQUIRED: The resource for which the policy is being
136   * requested. See the operation documentation for the appropriate value for this
137   * field.
138   * @param array $optParams Optional parameters.
139   *
140   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
141   * version that will be used to format the policy. Valid values are 0, 1, and 3.
142   * Requests specifying an invalid value will be rejected. Requests for policies
143   * with any conditional role bindings must specify version 3. Policies with no
144   * conditional role bindings may specify any valid value or leave the field
145   * unset. The policy in the response might use the policy version that you
146   * specified, or it might use a lower policy version. For example, if you
147   * specify version 3, but the policy has no conditional role bindings, the
148   * response uses version 1. To learn which resources support conditions in their
149   * IAM policies, see the [IAM
150   * documentation](https://cloud.google.com/iam/help/conditions/resource-
151   * policies).
152   * @return Policy
153   */
154  public function getIamPolicy($resource, $optParams = [])
155  {
156    $params = ['resource' => $resource];
157    $params = array_merge($params, $optParams);
158    return $this->call('getIamPolicy', [$params], Policy::class);
159  }
160  /**
161   * Imports resources to the FHIR store by loading data from the specified
162   * sources. This method is optimized to load large quantities of data using
163   * import semantics that ignore some FHIR store configuration options and are
164   * not suitable for all use cases. It is primarily intended to load data into an
165   * empty FHIR store that is not being used by other clients. In cases where this
166   * method is not appropriate, consider using ExecuteBundle to load data. Every
167   * resource in the input must contain a client-supplied ID. Each resource is
168   * stored using the supplied ID regardless of the enable_update_create setting
169   * on the FHIR store. It is strongly advised not to include or encode any
170   * sensitive data such as patient identifiers in client-specified resource IDs.
171   * Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and
172   * Cloud Pub/Sub notifications. Those IDs can also be contained in reference
173   * fields within other resources. The import process does not enforce
174   * referential integrity, regardless of the disable_referential_integrity
175   * setting on the FHIR store. This allows the import of resources with arbitrary
176   * interdependencies without considering grouping or ordering, but if the input
177   * data contains invalid references or if some resources fail to be imported,
178   * the FHIR store might be left in a state that violates referential integrity.
179   * The import process does not trigger Pub/Sub notification or BigQuery
180   * streaming update, regardless of how those are configured on the FHIR store.
181   * If a resource with the specified ID already exists, the most recent version
182   * of the resource is overwritten without creating a new historical version,
183   * regardless of the disable_resource_versioning setting on the FHIR store. If
184   * transient failures occur during the import, it's possible that successfully
185   * imported resources will be overwritten more than once. The import operation
186   * is idempotent unless the input data contains multiple valid resources with
187   * the same ID but different contents. In that case, after the import completes,
188   * the store contains exactly one resource with that ID but there is no ordering
189   * guarantee on which version of the contents it will have. The operation result
190   * counters do not count duplicate IDs as an error and count one success for
191   * each resource in the input, which might result in a success count larger than
192   * the number of resources in the FHIR store. This often occurs when importing
193   * data organized in bundles produced by Patient-everything where each bundle
194   * contains its own copy of a resource such as Practitioner that might be
195   * referred to by many patients. If some resources fail to import, for example
196   * due to parsing errors, successfully imported resources are not rolled back.
197   * The location and format of the input data is specified by the parameters in
198   * ImportResourcesRequest. Note that if no format is specified, this method
199   * assumes the `BUNDLE` format. When using the `BUNDLE` format this method
200   * ignores the `Bundle.type` field, except that `history` bundles are rejected,
201   * and does not apply any of the bundle processing semantics for batch or
202   * transaction bundles. Unlike in ExecuteBundle, transaction bundles are not
203   * executed as a single transaction and bundle-internal references are not
204   * rewritten. The bundle is treated as a collection of resources to be written
205   * as provided in `Bundle.entry.resource`, ignoring `Bundle.entry.request`. As
206   * an example, this allows the import of `searchset` bundles produced by a FHIR
207   * search or Patient-everything operation. This method returns an Operation that
208   * can be used to track the status of the import by calling GetOperation.
209   * Immediate fatal errors appear in the error field, errors are also logged to
210   * Cloud Logging (see [Viewing error logs in Cloud
211   * Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
212   * Otherwise, when the operation finishes, a detailed response of type
213   * ImportResourcesResponse is returned in the response field. The metadata field
214   * type for this operation is OperationMetadata. (fhirStores.import)
215   *
216   * @param string $name The name of the FHIR store to import FHIR resources to,
217   * in the format of `projects/{project_id}/locations/{location_id}/datasets/{dat
218   * aset_id}/fhirStores/{fhir_store_id}`.
219   * @param ImportResourcesRequest $postBody
220   * @param array $optParams Optional parameters.
221   * @return Operation
222   */
223  public function import($name, ImportResourcesRequest $postBody, $optParams = [])
224  {
225    $params = ['name' => $name, 'postBody' => $postBody];
226    $params = array_merge($params, $optParams);
227    return $this->call('import', [$params], Operation::class);
228  }
229  /**
230   * Lists the FHIR stores in the given dataset.
231   * (fhirStores.listProjectsLocationsDatasetsFhirStores)
232   *
233   * @param string $parent Name of the dataset.
234   * @param array $optParams Optional parameters.
235   *
236   * @opt_param string filter Restricts stores returned to those matching a
237   * filter. The following syntax is available: * A string field value can be
238   * written as text inside quotation marks, for example `"query text"`. The only
239   * valid relational operation for text fields is equality (`=`), where text is
240   * searched within the field, rather than having the field be equal to the text.
241   * For example, `"Comment = great"` returns messages with `great` in the comment
242   * field. * A number field value can be written as an integer, a decimal, or an
243   * exponential. The valid relational operators for number fields are the
244   * equality operator (`=`), along with the less than/greater than operators
245   * (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You
246   * can prepend the `NOT` operator to an expression to negate it. * A date field
247   * value must be written in `yyyy-mm-dd` form. Fields with date and time use the
248   * RFC3339 time format. Leading zeros are required for one-digit months and
249   * days. The valid relational operators for date fields are the equality
250   * operator (`=`) , along with the less than/greater than operators (`<`, `<=`,
251   * `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend
252   * the `NOT` operator to an expression to negate it. * Multiple field query
253   * expressions can be combined in one query by adding `AND` or `OR` operators
254   * between the expressions. If a boolean operator appears within a quoted
255   * string, it is not treated as special, it's just another part of the character
256   * string to be matched. You can prepend the `NOT` operator to an expression to
257   * negate it. Only filtering on labels is supported, for example
258   * `labels.key=value`.
259   * @opt_param int pageSize Limit on the number of FHIR stores to return in a
260   * single response. If not specified, 100 is used. May not be larger than 1000.
261   * @opt_param string pageToken The next_page_token value returned from the
262   * previous List request, if any.
263   * @return ListFhirStoresResponse
264   */
265  public function listProjectsLocationsDatasetsFhirStores($parent, $optParams = [])
266  {
267    $params = ['parent' => $parent];
268    $params = array_merge($params, $optParams);
269    return $this->call('list', [$params], ListFhirStoresResponse::class);
270  }
271  /**
272   * Updates the configuration of the specified FHIR store. (fhirStores.patch)
273   *
274   * @param string $name Output only. Resource name of the FHIR store, of the form
275   * `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
276   * @param FhirStore $postBody
277   * @param array $optParams Optional parameters.
278   *
279   * @opt_param string updateMask The update mask applies to the resource. For the
280   * `FieldMask` definition, see https://developers.google.com/protocol-
281   * buffers/docs/reference/google.protobuf#fieldmask
282   * @return FhirStore
283   */
284  public function patch($name, FhirStore $postBody, $optParams = [])
285  {
286    $params = ['name' => $name, 'postBody' => $postBody];
287    $params = array_merge($params, $optParams);
288    return $this->call('patch', [$params], FhirStore::class);
289  }
290  /**
291   * Sets the access control policy on the specified resource. Replaces any
292   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
293   * `PERMISSION_DENIED` errors. (fhirStores.setIamPolicy)
294   *
295   * @param string $resource REQUIRED: The resource for which the policy is being
296   * specified. See the operation documentation for the appropriate value for this
297   * field.
298   * @param SetIamPolicyRequest $postBody
299   * @param array $optParams Optional parameters.
300   * @return Policy
301   */
302  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
303  {
304    $params = ['resource' => $resource, 'postBody' => $postBody];
305    $params = array_merge($params, $optParams);
306    return $this->call('setIamPolicy', [$params], Policy::class);
307  }
308  /**
309   * Returns permissions that a caller has on the specified resource. If the
310   * resource does not exist, this will return an empty set of permissions, not a
311   * `NOT_FOUND` error. Note: This operation is designed to be used for building
312   * permission-aware UIs and command-line tools, not for authorization checking.
313   * This operation may "fail open" without warning.
314   * (fhirStores.testIamPermissions)
315   *
316   * @param string $resource REQUIRED: The resource for which the policy detail is
317   * being requested. See the operation documentation for the appropriate value
318   * for this field.
319   * @param TestIamPermissionsRequest $postBody
320   * @param array $optParams Optional parameters.
321   * @return TestIamPermissionsResponse
322   */
323  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
324  {
325    $params = ['resource' => $resource, 'postBody' => $postBody];
326    $params = array_merge($params, $optParams);
327    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
328  }
329}
330
331// Adding a class alias for backwards compatibility with the previous class name.
332class_alias(ProjectsLocationsDatasetsFhirStores::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsFhirStores');
333