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\AttributeDefinition;
21use Google\Service\CloudHealthcare\HealthcareEmpty;
22use Google\Service\CloudHealthcare\ListAttributeDefinitionsResponse;
23
24/**
25 * The "attributeDefinitions" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $healthcareService = new Google\Service\CloudHealthcare(...);
29 *   $attributeDefinitions = $healthcareService->attributeDefinitions;
30 *  </code>
31 */
32class ProjectsLocationsDatasetsConsentStoresAttributeDefinitions extends \Google\Service\Resource
33{
34  /**
35   * Creates a new Attribute definition in the parent consent store.
36   * (attributeDefinitions.create)
37   *
38   * @param string $parent Required. The name of the consent store that this
39   * Attribute definition belongs to.
40   * @param AttributeDefinition $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string attributeDefinitionId Required. The ID of the Attribute
44   * definition to create. The string must match the following regex: `_a-
45   * zA-Z{0,255}` and must not be a reserved keyword within the Common Expression
46   * Language as listed on https://github.com/google/cel-
47   * spec/blob/master/doc/langdef.md.
48   * @return AttributeDefinition
49   */
50  public function create($parent, AttributeDefinition $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], AttributeDefinition::class);
55  }
56  /**
57   * Deletes the specified Attribute definition. Fails if the Attribute definition
58   * is referenced by any User data mapping, or the latest revision of any
59   * Consent. (attributeDefinitions.delete)
60   *
61   * @param string $name Required. The resource name of the Attribute definition
62   * to delete. To preserve referential integrity, Attribute definitions
63   * referenced by a User data mapping or the latest revision of a Consent cannot
64   * be deleted.
65   * @param array $optParams Optional parameters.
66   * @return HealthcareEmpty
67   */
68  public function delete($name, $optParams = [])
69  {
70    $params = ['name' => $name];
71    $params = array_merge($params, $optParams);
72    return $this->call('delete', [$params], HealthcareEmpty::class);
73  }
74  /**
75   * Gets the specified Attribute definition. (attributeDefinitions.get)
76   *
77   * @param string $name Required. The resource name of the Attribute definition
78   * to get.
79   * @param array $optParams Optional parameters.
80   * @return AttributeDefinition
81   */
82  public function get($name, $optParams = [])
83  {
84    $params = ['name' => $name];
85    $params = array_merge($params, $optParams);
86    return $this->call('get', [$params], AttributeDefinition::class);
87  }
88  /**
89   * Lists the Attribute definitions in the specified consent store. (attributeDef
90   * initions.listProjectsLocationsDatasetsConsentStoresAttributeDefinitions)
91   *
92   * @param string $parent Required. Name of the consent store to retrieve
93   * Attribute definitions from.
94   * @param array $optParams Optional parameters.
95   *
96   * @opt_param string filter Optional. Restricts the attributes returned to those
97   * matching a filter. The only field available for filtering is `category`. For
98   * example, `filter=category=\"REQUEST\"`.
99   * @opt_param int pageSize Optional. Limit on the number of Attribute
100   * definitions to return in a single response. If not specified, 100 is used.
101   * May not be larger than 1000.
102   * @opt_param string pageToken Optional. Token to retrieve the next page of
103   * results or empty to get the first page.
104   * @return ListAttributeDefinitionsResponse
105   */
106  public function listProjectsLocationsDatasetsConsentStoresAttributeDefinitions($parent, $optParams = [])
107  {
108    $params = ['parent' => $parent];
109    $params = array_merge($params, $optParams);
110    return $this->call('list', [$params], ListAttributeDefinitionsResponse::class);
111  }
112  /**
113   * Updates the specified Attribute definition. (attributeDefinitions.patch)
114   *
115   * @param string $name Resource name of the Attribute definition, of the form `p
116   * rojects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentSto
117   * res/{consent_store_id}/attributeDefinitions/{attribute_definition_id}`.
118   * Cannot be changed after creation.
119   * @param AttributeDefinition $postBody
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string updateMask Required. The update mask that applies to the
123   * resource. For the `FieldMask` definition, see https://developers.google.com
124   * /protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the
125   * `description`, `allowed_values`, `consent_default_values` and
126   * `data_mapping_default_value` fields can be updated. The updated
127   * `allowed_values` must contain all values from the previous `allowed_values`.
128   * @return AttributeDefinition
129   */
130  public function patch($name, AttributeDefinition $postBody, $optParams = [])
131  {
132    $params = ['name' => $name, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('patch', [$params], AttributeDefinition::class);
135  }
136}
137
138// Adding a class alias for backwards compatibility with the previous class name.
139class_alias(ProjectsLocationsDatasetsConsentStoresAttributeDefinitions::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsConsentStoresAttributeDefinitions');
140