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\ExportMessagesRequest;
21use Google\Service\CloudHealthcare\HealthcareEmpty;
22use Google\Service\CloudHealthcare\Hl7V2Store;
23use Google\Service\CloudHealthcare\ImportMessagesRequest;
24use Google\Service\CloudHealthcare\ListHl7V2StoresResponse;
25use Google\Service\CloudHealthcare\Operation;
26use Google\Service\CloudHealthcare\Policy;
27use Google\Service\CloudHealthcare\SetIamPolicyRequest;
28use Google\Service\CloudHealthcare\TestIamPermissionsRequest;
29use Google\Service\CloudHealthcare\TestIamPermissionsResponse;
30
31/**
32 * The "hl7V2Stores" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $healthcareService = new Google\Service\CloudHealthcare(...);
36 *   $hl7V2Stores = $healthcareService->hl7V2Stores;
37 *  </code>
38 */
39class ProjectsLocationsDatasetsHl7V2Stores extends \Google\Service\Resource
40{
41  /**
42   * Creates a new HL7v2 store within the parent dataset. (hl7V2Stores.create)
43   *
44   * @param string $parent The name of the dataset this HL7v2 store belongs to.
45   * @param Hl7V2Store $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string hl7V2StoreId The ID of the HL7v2 store that is being
49   * created. The string must match the following regex:
50   * `[\p{L}\p{N}_\-\.]{1,256}`.
51   * @return Hl7V2Store
52   */
53  public function create($parent, Hl7V2Store $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], Hl7V2Store::class);
58  }
59  /**
60   * Deletes the specified HL7v2 store and removes all messages that it contains.
61   * (hl7V2Stores.delete)
62   *
63   * @param string $name The resource name of the HL7v2 store to delete.
64   * @param array $optParams Optional parameters.
65   * @return HealthcareEmpty
66   */
67  public function delete($name, $optParams = [])
68  {
69    $params = ['name' => $name];
70    $params = array_merge($params, $optParams);
71    return $this->call('delete', [$params], HealthcareEmpty::class);
72  }
73  /**
74   * Exports the messages to a destination. To filter messages to be exported,
75   * define a filter using the start and end time, relative to the message
76   * generation time (MSH.7). This API returns an Operation that can be used to
77   * track the status of the job by calling GetOperation. Immediate fatal errors
78   * appear in the error field. Otherwise, when the operation finishes, a detailed
79   * response of type ExportMessagesResponse is returned in the response field.
80   * The metadata field type for this operation is OperationMetadata.
81   * (hl7V2Stores.export)
82   *
83   * @param string $name The name of the source HL7v2 store, in the format `projec
84   * ts/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl
85   * 7v2_store_id}`
86   * @param ExportMessagesRequest $postBody
87   * @param array $optParams Optional parameters.
88   * @return Operation
89   */
90  public function export($name, ExportMessagesRequest $postBody, $optParams = [])
91  {
92    $params = ['name' => $name, 'postBody' => $postBody];
93    $params = array_merge($params, $optParams);
94    return $this->call('export', [$params], Operation::class);
95  }
96  /**
97   * Gets the specified HL7v2 store. (hl7V2Stores.get)
98   *
99   * @param string $name The resource name of the HL7v2 store to get.
100   * @param array $optParams Optional parameters.
101   * @return Hl7V2Store
102   */
103  public function get($name, $optParams = [])
104  {
105    $params = ['name' => $name];
106    $params = array_merge($params, $optParams);
107    return $this->call('get', [$params], Hl7V2Store::class);
108  }
109  /**
110   * Gets the access control policy for a resource. Returns an empty policy if the
111   * resource exists and does not have a policy set. (hl7V2Stores.getIamPolicy)
112   *
113   * @param string $resource REQUIRED: The resource for which the policy is being
114   * requested. See the operation documentation for the appropriate value for this
115   * field.
116   * @param array $optParams Optional parameters.
117   *
118   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
119   * version that will be used to format the policy. Valid values are 0, 1, and 3.
120   * Requests specifying an invalid value will be rejected. Requests for policies
121   * with any conditional role bindings must specify version 3. Policies with no
122   * conditional role bindings may specify any valid value or leave the field
123   * unset. The policy in the response might use the policy version that you
124   * specified, or it might use a lower policy version. For example, if you
125   * specify version 3, but the policy has no conditional role bindings, the
126   * response uses version 1. To learn which resources support conditions in their
127   * IAM policies, see the [IAM
128   * documentation](https://cloud.google.com/iam/help/conditions/resource-
129   * policies).
130   * @return Policy
131   */
132  public function getIamPolicy($resource, $optParams = [])
133  {
134    $params = ['resource' => $resource];
135    $params = array_merge($params, $optParams);
136    return $this->call('getIamPolicy', [$params], Policy::class);
137  }
138  /**
139   * Import messages to the HL7v2 store by loading data from the specified
140   * sources. This method is optimized to load large quantities of data using
141   * import semantics that ignore some HL7v2 store configuration options and are
142   * not suitable for all use cases. It is primarily intended to load data into an
143   * empty HL7v2 store that is not being used by other clients. An existing
144   * message will be overwritten if a duplicate message is imported. A duplicate
145   * message is a message with the same raw bytes as a message that already exists
146   * in this HL7v2 store. When a message is overwritten, its labels will also be
147   * overwritten. The import operation is idempotent unless the input data
148   * contains multiple valid messages with the same raw bytes but different
149   * labels. In that case, after the import completes, the store contains exactly
150   * one message with those raw bytes but there is no ordering guarantee on which
151   * version of the labels it has. The operation result counters do not count
152   * duplicated raw bytes as an error and count one success for each message in
153   * the input, which might result in a success count larger than the number of
154   * messages in the HL7v2 store. If some messages fail to import, for example due
155   * to parsing errors, successfully imported messages are not rolled back. This
156   * method returns an Operation that can be used to track the status of the
157   * import by calling GetOperation. Immediate fatal errors appear in the error
158   * field, errors are also logged to Cloud Logging (see [Viewing error logs in
159   * Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
160   * Otherwise, when the operation finishes, a response of type
161   * ImportMessagesResponse is returned in the response field. The metadata field
162   * type for this operation is OperationMetadata. (hl7V2Stores.import)
163   *
164   * @param string $name The name of the target HL7v2 store, in the format `projec
165   * ts/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl
166   * 7v2_store_id}`
167   * @param ImportMessagesRequest $postBody
168   * @param array $optParams Optional parameters.
169   * @return Operation
170   */
171  public function import($name, ImportMessagesRequest $postBody, $optParams = [])
172  {
173    $params = ['name' => $name, 'postBody' => $postBody];
174    $params = array_merge($params, $optParams);
175    return $this->call('import', [$params], Operation::class);
176  }
177  /**
178   * Lists the HL7v2 stores in the given dataset.
179   * (hl7V2Stores.listProjectsLocationsDatasetsHl7V2Stores)
180   *
181   * @param string $parent Name of the dataset.
182   * @param array $optParams Optional parameters.
183   *
184   * @opt_param string filter Restricts stores returned to those matching a
185   * filter. The following syntax is available: * A string field value can be
186   * written as text inside quotation marks, for example `"query text"`. The only
187   * valid relational operation for text fields is equality (`=`), where text is
188   * searched within the field, rather than having the field be equal to the text.
189   * For example, `"Comment = great"` returns messages with `great` in the comment
190   * field. * A number field value can be written as an integer, a decimal, or an
191   * exponential. The valid relational operators for number fields are the
192   * equality operator (`=`), along with the less than/greater than operators
193   * (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You
194   * can prepend the `NOT` operator to an expression to negate it. * A date field
195   * value must be written in `yyyy-mm-dd` form. Fields with date and time use the
196   * RFC3339 time format. Leading zeros are required for one-digit months and
197   * days. The valid relational operators for date fields are the equality
198   * operator (`=`) , along with the less than/greater than operators (`<`, `<=`,
199   * `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend
200   * the `NOT` operator to an expression to negate it. * Multiple field query
201   * expressions can be combined in one query by adding `AND` or `OR` operators
202   * between the expressions. If a boolean operator appears within a quoted
203   * string, it is not treated as special, it's just another part of the character
204   * string to be matched. You can prepend the `NOT` operator to an expression to
205   * negate it. Only filtering on labels is supported. For example,
206   * `labels.key=value`.
207   * @opt_param int pageSize Limit on the number of HL7v2 stores to return in a
208   * single response. If not specified, 100 is used. May not be larger than 1000.
209   * @opt_param string pageToken The next_page_token value returned from the
210   * previous List request, if any.
211   * @return ListHl7V2StoresResponse
212   */
213  public function listProjectsLocationsDatasetsHl7V2Stores($parent, $optParams = [])
214  {
215    $params = ['parent' => $parent];
216    $params = array_merge($params, $optParams);
217    return $this->call('list', [$params], ListHl7V2StoresResponse::class);
218  }
219  /**
220   * Updates the HL7v2 store. (hl7V2Stores.patch)
221   *
222   * @param string $name Resource name of the HL7v2 store, of the form
223   * `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
224   * @param Hl7V2Store $postBody
225   * @param array $optParams Optional parameters.
226   *
227   * @opt_param string updateMask The update mask applies to the resource. For the
228   * `FieldMask` definition, see https://developers.google.com/protocol-
229   * buffers/docs/reference/google.protobuf#fieldmask
230   * @return Hl7V2Store
231   */
232  public function patch($name, Hl7V2Store $postBody, $optParams = [])
233  {
234    $params = ['name' => $name, 'postBody' => $postBody];
235    $params = array_merge($params, $optParams);
236    return $this->call('patch', [$params], Hl7V2Store::class);
237  }
238  /**
239   * Sets the access control policy on the specified resource. Replaces any
240   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
241   * `PERMISSION_DENIED` errors. (hl7V2Stores.setIamPolicy)
242   *
243   * @param string $resource REQUIRED: The resource for which the policy is being
244   * specified. See the operation documentation for the appropriate value for this
245   * field.
246   * @param SetIamPolicyRequest $postBody
247   * @param array $optParams Optional parameters.
248   * @return Policy
249   */
250  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
251  {
252    $params = ['resource' => $resource, 'postBody' => $postBody];
253    $params = array_merge($params, $optParams);
254    return $this->call('setIamPolicy', [$params], Policy::class);
255  }
256  /**
257   * Returns permissions that a caller has on the specified resource. If the
258   * resource does not exist, this will return an empty set of permissions, not a
259   * `NOT_FOUND` error. Note: This operation is designed to be used for building
260   * permission-aware UIs and command-line tools, not for authorization checking.
261   * This operation may "fail open" without warning.
262   * (hl7V2Stores.testIamPermissions)
263   *
264   * @param string $resource REQUIRED: The resource for which the policy detail is
265   * being requested. See the operation documentation for the appropriate value
266   * for this field.
267   * @param TestIamPermissionsRequest $postBody
268   * @param array $optParams Optional parameters.
269   * @return TestIamPermissionsResponse
270   */
271  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
272  {
273    $params = ['resource' => $resource, 'postBody' => $postBody];
274    $params = array_merge($params, $optParams);
275    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
276  }
277}
278
279// Adding a class alias for backwards compatibility with the previous class name.
280class_alias(ProjectsLocationsDatasetsHl7V2Stores::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsHl7V2Stores');
281