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\Bigquery\Resource;
19
20use Google\Service\Bigquery\GetIamPolicyRequest;
21use Google\Service\Bigquery\ListRowAccessPoliciesResponse;
22use Google\Service\Bigquery\Policy;
23use Google\Service\Bigquery\SetIamPolicyRequest;
24use Google\Service\Bigquery\TestIamPermissionsRequest;
25use Google\Service\Bigquery\TestIamPermissionsResponse;
26
27/**
28 * The "rowAccessPolicies" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $bigqueryService = new Google\Service\Bigquery(...);
32 *   $rowAccessPolicies = $bigqueryService->rowAccessPolicies;
33 *  </code>
34 */
35class RowAccessPolicies extends \Google\Service\Resource
36{
37  /**
38   * Gets the access control policy for a resource. Returns an empty policy if the
39   * resource exists and does not have a policy set.
40   * (rowAccessPolicies.getIamPolicy)
41   *
42   * @param string $resource REQUIRED: The resource for which the policy is being
43   * requested. See the operation documentation for the appropriate value for this
44   * field.
45   * @param GetIamPolicyRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return Policy
48   */
49  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
50  {
51    $params = ['resource' => $resource, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('getIamPolicy', [$params], Policy::class);
54  }
55  /**
56   * Lists all row access policies on the specified table.
57   * (rowAccessPolicies.listRowAccessPolicies)
58   *
59   * @param string $projectId Required. Project ID of the row access policies to
60   * list.
61   * @param string $datasetId Required. Dataset ID of row access policies to list.
62   * @param string $tableId Required. Table ID of the table to list row access
63   * policies.
64   * @param array $optParams Optional parameters.
65   *
66   * @opt_param int pageSize The maximum number of results to return in a single
67   * response page. Leverage the page tokens to iterate through the entire
68   * collection.
69   * @opt_param string pageToken Page token, returned by a previous call, to
70   * request the next page of results.
71   * @return ListRowAccessPoliciesResponse
72   */
73  public function listRowAccessPolicies($projectId, $datasetId, $tableId, $optParams = [])
74  {
75    $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId];
76    $params = array_merge($params, $optParams);
77    return $this->call('list', [$params], ListRowAccessPoliciesResponse::class);
78  }
79  /**
80   * Sets the access control policy on the specified resource. Replaces any
81   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
82   * `PERMISSION_DENIED` errors. (rowAccessPolicies.setIamPolicy)
83   *
84   * @param string $resource REQUIRED: The resource for which the policy is being
85   * specified. See the operation documentation for the appropriate value for this
86   * field.
87   * @param SetIamPolicyRequest $postBody
88   * @param array $optParams Optional parameters.
89   * @return Policy
90   */
91  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
92  {
93    $params = ['resource' => $resource, 'postBody' => $postBody];
94    $params = array_merge($params, $optParams);
95    return $this->call('setIamPolicy', [$params], Policy::class);
96  }
97  /**
98   * Returns permissions that a caller has on the specified resource. If the
99   * resource does not exist, this will return an empty set of permissions, not a
100   * `NOT_FOUND` error. Note: This operation is designed to be used for building
101   * permission-aware UIs and command-line tools, not for authorization checking.
102   * This operation may "fail open" without warning.
103   * (rowAccessPolicies.testIamPermissions)
104   *
105   * @param string $resource REQUIRED: The resource for which the policy detail is
106   * being requested. See the operation documentation for the appropriate value
107   * for this field.
108   * @param TestIamPermissionsRequest $postBody
109   * @param array $optParams Optional parameters.
110   * @return TestIamPermissionsResponse
111   */
112  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
113  {
114    $params = ['resource' => $resource, 'postBody' => $postBody];
115    $params = array_merge($params, $optParams);
116    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
117  }
118}
119
120// Adding a class alias for backwards compatibility with the previous class name.
121class_alias(RowAccessPolicies::class, 'Google_Service_Bigquery_Resource_RowAccessPolicies');
122