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 |
|
---|
18 | namespace Google\Service\Bigquery\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Bigquery\GetIamPolicyRequest;
|
---|
21 | use Google\Service\Bigquery\Policy;
|
---|
22 | use Google\Service\Bigquery\SetIamPolicyRequest;
|
---|
23 | use Google\Service\Bigquery\Table;
|
---|
24 | use Google\Service\Bigquery\TableList;
|
---|
25 | use Google\Service\Bigquery\TestIamPermissionsRequest;
|
---|
26 | use Google\Service\Bigquery\TestIamPermissionsResponse;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "tables" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $bigqueryService = new Google\Service\Bigquery(...);
|
---|
33 | * $tables = $bigqueryService->tables;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class Tables extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Deletes the table specified by tableId from the dataset. If the table
|
---|
40 | * contains data, all the data will be deleted. (tables.delete)
|
---|
41 | *
|
---|
42 | * @param string $projectId Required. Project ID of the table to delete
|
---|
43 | * @param string $datasetId Required. Dataset ID of the table to delete
|
---|
44 | * @param string $tableId Required. Table ID of the table to delete
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | * @throws \Google\Service\Exception
|
---|
47 | */
|
---|
48 | public function delete($projectId, $datasetId, $tableId, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('delete', [$params]);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Gets the specified table resource by table ID. This method does not return
|
---|
56 | * the data in the table, it only returns the table resource, which describes
|
---|
57 | * the structure of this table. (tables.get)
|
---|
58 | *
|
---|
59 | * @param string $projectId Required. Project ID of the requested table
|
---|
60 | * @param string $datasetId Required. Dataset ID of the requested table
|
---|
61 | * @param string $tableId Required. Table ID of the requested table
|
---|
62 | * @param array $optParams Optional parameters.
|
---|
63 | *
|
---|
64 | * @opt_param string selectedFields List of table schema fields to return
|
---|
65 | * (comma-separated). If unspecified, all fields are returned. A fieldMask
|
---|
66 | * cannot be used here because the fields will automatically be converted from
|
---|
67 | * camelCase to snake_case and the conversion will fail if there are
|
---|
68 | * underscores. Since these are fields in BigQuery table schemas, underscores
|
---|
69 | * are allowed.
|
---|
70 | * @opt_param string view Optional. Specifies the view that determines which
|
---|
71 | * table information is returned. By default, basic table information and
|
---|
72 | * storage statistics (STORAGE_STATS) are returned.
|
---|
73 | * @return Table
|
---|
74 | * @throws \Google\Service\Exception
|
---|
75 | */
|
---|
76 | public function get($projectId, $datasetId, $tableId, $optParams = [])
|
---|
77 | {
|
---|
78 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId];
|
---|
79 | $params = array_merge($params, $optParams);
|
---|
80 | return $this->call('get', [$params], Table::class);
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
84 | * resource exists and does not have a policy set. (tables.getIamPolicy)
|
---|
85 | *
|
---|
86 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
87 | * requested. See [Resource
|
---|
88 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
89 | * appropriate value for this field.
|
---|
90 | * @param GetIamPolicyRequest $postBody
|
---|
91 | * @param array $optParams Optional parameters.
|
---|
92 | * @return Policy
|
---|
93 | * @throws \Google\Service\Exception
|
---|
94 | */
|
---|
95 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
96 | {
|
---|
97 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
98 | $params = array_merge($params, $optParams);
|
---|
99 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
100 | }
|
---|
101 | /**
|
---|
102 | * Creates a new, empty table in the dataset. (tables.insert)
|
---|
103 | *
|
---|
104 | * @param string $projectId Required. Project ID of the new table
|
---|
105 | * @param string $datasetId Required. Dataset ID of the new table
|
---|
106 | * @param Table $postBody
|
---|
107 | * @param array $optParams Optional parameters.
|
---|
108 | * @return Table
|
---|
109 | * @throws \Google\Service\Exception
|
---|
110 | */
|
---|
111 | public function insert($projectId, $datasetId, Table $postBody, $optParams = [])
|
---|
112 | {
|
---|
113 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody];
|
---|
114 | $params = array_merge($params, $optParams);
|
---|
115 | return $this->call('insert', [$params], Table::class);
|
---|
116 | }
|
---|
117 | /**
|
---|
118 | * Lists all tables in the specified dataset. Requires the READER dataset role.
|
---|
119 | * (tables.listTables)
|
---|
120 | *
|
---|
121 | * @param string $projectId Required. Project ID of the tables to list
|
---|
122 | * @param string $datasetId Required. Dataset ID of the tables to list
|
---|
123 | * @param array $optParams Optional parameters.
|
---|
124 | *
|
---|
125 | * @opt_param string maxResults The maximum number of results to return in a
|
---|
126 | * single response page. Leverage the page tokens to iterate through the entire
|
---|
127 | * collection.
|
---|
128 | * @opt_param string pageToken Page token, returned by a previous call, to
|
---|
129 | * request the next page of results
|
---|
130 | * @return TableList
|
---|
131 | * @throws \Google\Service\Exception
|
---|
132 | */
|
---|
133 | public function listTables($projectId, $datasetId, $optParams = [])
|
---|
134 | {
|
---|
135 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId];
|
---|
136 | $params = array_merge($params, $optParams);
|
---|
137 | return $this->call('list', [$params], TableList::class);
|
---|
138 | }
|
---|
139 | /**
|
---|
140 | * Updates information in an existing table. The update method replaces the
|
---|
141 | * entire table resource, whereas the patch method only replaces fields that are
|
---|
142 | * provided in the submitted table resource. This method supports RFC5789 patch
|
---|
143 | * semantics. (tables.patch)
|
---|
144 | *
|
---|
145 | * @param string $projectId Required. Project ID of the table to update
|
---|
146 | * @param string $datasetId Required. Dataset ID of the table to update
|
---|
147 | * @param string $tableId Required. Table ID of the table to update
|
---|
148 | * @param Table $postBody
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | *
|
---|
151 | * @opt_param bool autodetect_schema Optional. When true will autodetect
|
---|
152 | * schema, else will keep original schema
|
---|
153 | * @return Table
|
---|
154 | * @throws \Google\Service\Exception
|
---|
155 | */
|
---|
156 | public function patch($projectId, $datasetId, $tableId, Table $postBody, $optParams = [])
|
---|
157 | {
|
---|
158 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody];
|
---|
159 | $params = array_merge($params, $optParams);
|
---|
160 | return $this->call('patch', [$params], Table::class);
|
---|
161 | }
|
---|
162 | /**
|
---|
163 | * Sets the access control policy on the specified resource. Replaces any
|
---|
164 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
165 | * `PERMISSION_DENIED` errors. (tables.setIamPolicy)
|
---|
166 | *
|
---|
167 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
168 | * specified. See [Resource
|
---|
169 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
170 | * appropriate value for this field.
|
---|
171 | * @param SetIamPolicyRequest $postBody
|
---|
172 | * @param array $optParams Optional parameters.
|
---|
173 | * @return Policy
|
---|
174 | * @throws \Google\Service\Exception
|
---|
175 | */
|
---|
176 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
177 | {
|
---|
178 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
179 | $params = array_merge($params, $optParams);
|
---|
180 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
181 | }
|
---|
182 | /**
|
---|
183 | * Returns permissions that a caller has on the specified resource. If the
|
---|
184 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
185 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
186 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
187 | * This operation may "fail open" without warning. (tables.testIamPermissions)
|
---|
188 | *
|
---|
189 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
190 | * being requested. See [Resource
|
---|
191 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
192 | * appropriate value for this field.
|
---|
193 | * @param TestIamPermissionsRequest $postBody
|
---|
194 | * @param array $optParams Optional parameters.
|
---|
195 | * @return TestIamPermissionsResponse
|
---|
196 | * @throws \Google\Service\Exception
|
---|
197 | */
|
---|
198 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
199 | {
|
---|
200 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
201 | $params = array_merge($params, $optParams);
|
---|
202 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
203 | }
|
---|
204 | /**
|
---|
205 | * Updates information in an existing table. The update method replaces the
|
---|
206 | * entire Table resource, whereas the patch method only replaces fields that are
|
---|
207 | * provided in the submitted Table resource. (tables.update)
|
---|
208 | *
|
---|
209 | * @param string $projectId Required. Project ID of the table to update
|
---|
210 | * @param string $datasetId Required. Dataset ID of the table to update
|
---|
211 | * @param string $tableId Required. Table ID of the table to update
|
---|
212 | * @param Table $postBody
|
---|
213 | * @param array $optParams Optional parameters.
|
---|
214 | *
|
---|
215 | * @opt_param bool autodetect_schema Optional. When true will autodetect
|
---|
216 | * schema, else will keep original schema
|
---|
217 | * @return Table
|
---|
218 | * @throws \Google\Service\Exception
|
---|
219 | */
|
---|
220 | public function update($projectId, $datasetId, $tableId, Table $postBody, $optParams = [])
|
---|
221 | {
|
---|
222 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody];
|
---|
223 | $params = array_merge($params, $optParams);
|
---|
224 | return $this->call('update', [$params], Table::class);
|
---|
225 | }
|
---|
226 | }
|
---|
227 |
|
---|
228 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
229 | class_alias(Tables::class, 'Google_Service_Bigquery_Resource_Tables');
|
---|