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\CheckDataAccessRequest; 21use Google\Service\CloudHealthcare\CheckDataAccessResponse; 22use Google\Service\CloudHealthcare\ConsentStore; 23use Google\Service\CloudHealthcare\EvaluateUserConsentsRequest; 24use Google\Service\CloudHealthcare\EvaluateUserConsentsResponse; 25use Google\Service\CloudHealthcare\HealthcareEmpty; 26use Google\Service\CloudHealthcare\ListConsentStoresResponse; 27use Google\Service\CloudHealthcare\Operation; 28use Google\Service\CloudHealthcare\Policy; 29use Google\Service\CloudHealthcare\QueryAccessibleDataRequest; 30use Google\Service\CloudHealthcare\SetIamPolicyRequest; 31use Google\Service\CloudHealthcare\TestIamPermissionsRequest; 32use Google\Service\CloudHealthcare\TestIamPermissionsResponse; 33 34/** 35 * The "consentStores" collection of methods. 36 * Typical usage is: 37 * <code> 38 * $healthcareService = new Google\Service\CloudHealthcare(...); 39 * $consentStores = $healthcareService->consentStores; 40 * </code> 41 */ 42class ProjectsLocationsDatasetsConsentStores extends \Google\Service\Resource 43{ 44 /** 45 * Checks if a particular data_id of a User data mapping in the specified 46 * consent store is consented for the specified use. 47 * (consentStores.checkDataAccess) 48 * 49 * @param string $consentStore Required. Name of the consent store where the 50 * requested data_id is stored, of the form `projects/{project_id}/locations/{lo 51 * cation_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. 52 * @param CheckDataAccessRequest $postBody 53 * @param array $optParams Optional parameters. 54 * @return CheckDataAccessResponse 55 */ 56 public function checkDataAccess($consentStore, CheckDataAccessRequest $postBody, $optParams = []) 57 { 58 $params = ['consentStore' => $consentStore, 'postBody' => $postBody]; 59 $params = array_merge($params, $optParams); 60 return $this->call('checkDataAccess', [$params], CheckDataAccessResponse::class); 61 } 62 /** 63 * Creates a new consent store in the parent dataset. Attempting to create a 64 * consent store with the same ID as an existing store fails with an 65 * ALREADY_EXISTS error. (consentStores.create) 66 * 67 * @param string $parent Required. The name of the dataset this consent store 68 * belongs to. 69 * @param ConsentStore $postBody 70 * @param array $optParams Optional parameters. 71 * 72 * @opt_param string consentStoreId Required. The ID of the consent store to 73 * create. The string must match the following regex: 74 * `[\p{L}\p{N}_\-\.]{1,256}`. Cannot be changed after creation. 75 * @return ConsentStore 76 */ 77 public function create($parent, ConsentStore $postBody, $optParams = []) 78 { 79 $params = ['parent' => $parent, 'postBody' => $postBody]; 80 $params = array_merge($params, $optParams); 81 return $this->call('create', [$params], ConsentStore::class); 82 } 83 /** 84 * Deletes the specified consent store and removes all the consent store's data. 85 * (consentStores.delete) 86 * 87 * @param string $name Required. The resource name of the consent store to 88 * delete. 89 * @param array $optParams Optional parameters. 90 * @return HealthcareEmpty 91 */ 92 public function delete($name, $optParams = []) 93 { 94 $params = ['name' => $name]; 95 $params = array_merge($params, $optParams); 96 return $this->call('delete', [$params], HealthcareEmpty::class); 97 } 98 /** 99 * Evaluates the user's Consents for all matching User data mappings. Note: User 100 * data mappings are indexed asynchronously, which can cause a slight delay 101 * between the time mappings are created or updated and when they are included 102 * in EvaluateUserConsents results. (consentStores.evaluateUserConsents) 103 * 104 * @param string $consentStore Required. Name of the consent store to retrieve 105 * User data mappings from. 106 * @param EvaluateUserConsentsRequest $postBody 107 * @param array $optParams Optional parameters. 108 * @return EvaluateUserConsentsResponse 109 */ 110 public function evaluateUserConsents($consentStore, EvaluateUserConsentsRequest $postBody, $optParams = []) 111 { 112 $params = ['consentStore' => $consentStore, 'postBody' => $postBody]; 113 $params = array_merge($params, $optParams); 114 return $this->call('evaluateUserConsents', [$params], EvaluateUserConsentsResponse::class); 115 } 116 /** 117 * Gets the specified consent store. (consentStores.get) 118 * 119 * @param string $name Required. The resource name of the consent store to get. 120 * @param array $optParams Optional parameters. 121 * @return ConsentStore 122 */ 123 public function get($name, $optParams = []) 124 { 125 $params = ['name' => $name]; 126 $params = array_merge($params, $optParams); 127 return $this->call('get', [$params], ConsentStore::class); 128 } 129 /** 130 * Gets the access control policy for a resource. Returns an empty policy if the 131 * resource exists and does not have a policy set. (consentStores.getIamPolicy) 132 * 133 * @param string $resource REQUIRED: The resource for which the policy is being 134 * requested. See the operation documentation for the appropriate value for this 135 * field. 136 * @param array $optParams Optional parameters. 137 * 138 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 139 * version that will be used to format the policy. Valid values are 0, 1, and 3. 140 * Requests specifying an invalid value will be rejected. Requests for policies 141 * with any conditional role bindings must specify version 3. Policies with no 142 * conditional role bindings may specify any valid value or leave the field 143 * unset. The policy in the response might use the policy version that you 144 * specified, or it might use a lower policy version. For example, if you 145 * specify version 3, but the policy has no conditional role bindings, the 146 * response uses version 1. To learn which resources support conditions in their 147 * IAM policies, see the [IAM 148 * documentation](https://cloud.google.com/iam/help/conditions/resource- 149 * policies). 150 * @return Policy 151 */ 152 public function getIamPolicy($resource, $optParams = []) 153 { 154 $params = ['resource' => $resource]; 155 $params = array_merge($params, $optParams); 156 return $this->call('getIamPolicy', [$params], Policy::class); 157 } 158 /** 159 * Lists the consent stores in the specified dataset. 160 * (consentStores.listProjectsLocationsDatasetsConsentStores) 161 * 162 * @param string $parent Required. Name of the dataset. 163 * @param array $optParams Optional parameters. 164 * 165 * @opt_param string filter Optional. Restricts the stores returned to those 166 * matching a filter. Only filtering on labels is supported. For example, 167 * `filter=labels.key=value`. 168 * @opt_param int pageSize Optional. Limit on the number of consent stores to 169 * return in a single response. If not specified, 100 is used. May not be larger 170 * than 1000. 171 * @opt_param string pageToken Optional. Token to retrieve the next page of 172 * results, or empty to get the first page. 173 * @return ListConsentStoresResponse 174 */ 175 public function listProjectsLocationsDatasetsConsentStores($parent, $optParams = []) 176 { 177 $params = ['parent' => $parent]; 178 $params = array_merge($params, $optParams); 179 return $this->call('list', [$params], ListConsentStoresResponse::class); 180 } 181 /** 182 * Updates the specified consent store. (consentStores.patch) 183 * 184 * @param string $name Resource name of the consent store, of the form `projects 185 * /{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{co 186 * nsent_store_id}`. Cannot be changed after creation. 187 * @param ConsentStore $postBody 188 * @param array $optParams Optional parameters. 189 * 190 * @opt_param string updateMask Required. The update mask that applies to the 191 * resource. For the `FieldMask` definition, see https://developers.google.com 192 * /protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the 193 * `labels`, `default_consent_ttl`, and `enable_consent_create_on_update` fields 194 * are allowed to be updated. 195 * @return ConsentStore 196 */ 197 public function patch($name, ConsentStore $postBody, $optParams = []) 198 { 199 $params = ['name' => $name, 'postBody' => $postBody]; 200 $params = array_merge($params, $optParams); 201 return $this->call('patch', [$params], ConsentStore::class); 202 } 203 /** 204 * Queries all data_ids that are consented for a specified use in the given 205 * consent store and writes them to a specified destination. The returned 206 * Operation includes a progress counter for the number of User data mappings 207 * processed. If the request is successful, a detailed response is returned of 208 * type QueryAccessibleDataResponse, contained in the response field when the 209 * operation finishes. The metadata field type is OperationMetadata. Errors are 210 * logged to Cloud Logging (see [Viewing error logs in Cloud 211 * Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). For 212 * example, the following sample log entry shows a `failed to evaluate consent 213 * policy` error that occurred during a QueryAccessibleData call to consent 214 * store `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/co 215 * nsentStores/{consent_store_id}`. ```json jsonPayload: { @type: "type.googleap 216 * is.com/google.cloud.healthcare.logging.QueryAccessibleDataLogEntry" error: { 217 * code: 9 message: "failed to evaluate consent policy" } resourceName: "project 218 * s/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{c 219 * onsent_store_id}/consents/{consent_id}" } logName: "projects/{project_id}/log 220 * s/healthcare.googleapis.com%2Fquery_accessible_data" operation: { id: "projec 221 * ts/{project_id}/locations/{location_id}/datasets/{dataset_id}/operations/{ope 222 * ration_id}" producer: "healthcare.googleapis.com/QueryAccessibleData" } 223 * receiveTimestamp: "TIMESTAMP" resource: { labels: { consent_store_id: 224 * "{consent_store_id}" dataset_id: "{dataset_id}" location: "{location_id}" 225 * project_id: "{project_id}" } type: "healthcare_consent_store" } severity: 226 * "ERROR" timestamp: "TIMESTAMP" ``` (consentStores.queryAccessibleData) 227 * 228 * @param string $consentStore Required. Name of the consent store to retrieve 229 * User data mappings from. 230 * @param QueryAccessibleDataRequest $postBody 231 * @param array $optParams Optional parameters. 232 * @return Operation 233 */ 234 public function queryAccessibleData($consentStore, QueryAccessibleDataRequest $postBody, $optParams = []) 235 { 236 $params = ['consentStore' => $consentStore, 'postBody' => $postBody]; 237 $params = array_merge($params, $optParams); 238 return $this->call('queryAccessibleData', [$params], Operation::class); 239 } 240 /** 241 * Sets the access control policy on the specified resource. Replaces any 242 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 243 * `PERMISSION_DENIED` errors. (consentStores.setIamPolicy) 244 * 245 * @param string $resource REQUIRED: The resource for which the policy is being 246 * specified. See the operation documentation for the appropriate value for this 247 * field. 248 * @param SetIamPolicyRequest $postBody 249 * @param array $optParams Optional parameters. 250 * @return Policy 251 */ 252 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 253 { 254 $params = ['resource' => $resource, 'postBody' => $postBody]; 255 $params = array_merge($params, $optParams); 256 return $this->call('setIamPolicy', [$params], Policy::class); 257 } 258 /** 259 * Returns permissions that a caller has on the specified resource. If the 260 * resource does not exist, this will return an empty set of permissions, not a 261 * `NOT_FOUND` error. Note: This operation is designed to be used for building 262 * permission-aware UIs and command-line tools, not for authorization checking. 263 * This operation may "fail open" without warning. 264 * (consentStores.testIamPermissions) 265 * 266 * @param string $resource REQUIRED: The resource for which the policy detail is 267 * being requested. See the operation documentation for the appropriate value 268 * for this field. 269 * @param TestIamPermissionsRequest $postBody 270 * @param array $optParams Optional parameters. 271 * @return TestIamPermissionsResponse 272 */ 273 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 274 { 275 $params = ['resource' => $resource, 'postBody' => $postBody]; 276 $params = array_merge($params, $optParams); 277 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 278 } 279} 280 281// Adding a class alias for backwards compatibility with the previous class name. 282class_alias(ProjectsLocationsDatasetsConsentStores::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsConsentStores'); 283