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\BigtableAdmin\Resource;
19
20use Google\Service\BigtableAdmin\BigtableadminEmpty;
21use Google\Service\BigtableAdmin\CheckConsistencyRequest;
22use Google\Service\BigtableAdmin\CheckConsistencyResponse;
23use Google\Service\BigtableAdmin\CreateTableRequest;
24use Google\Service\BigtableAdmin\DropRowRangeRequest;
25use Google\Service\BigtableAdmin\GenerateConsistencyTokenRequest;
26use Google\Service\BigtableAdmin\GenerateConsistencyTokenResponse;
27use Google\Service\BigtableAdmin\GetIamPolicyRequest;
28use Google\Service\BigtableAdmin\ListTablesResponse;
29use Google\Service\BigtableAdmin\ModifyColumnFamiliesRequest;
30use Google\Service\BigtableAdmin\Operation;
31use Google\Service\BigtableAdmin\Policy;
32use Google\Service\BigtableAdmin\RestoreTableRequest;
33use Google\Service\BigtableAdmin\SetIamPolicyRequest;
34use Google\Service\BigtableAdmin\Table;
35use Google\Service\BigtableAdmin\TestIamPermissionsRequest;
36use Google\Service\BigtableAdmin\TestIamPermissionsResponse;
37
38/**
39 * The "tables" collection of methods.
40 * Typical usage is:
41 *  <code>
42 *   $bigtableadminService = new Google\Service\BigtableAdmin(...);
43 *   $tables = $bigtableadminService->tables;
44 *  </code>
45 */
46class ProjectsInstancesTables extends \Google\Service\Resource
47{
48  /**
49   * Checks replication consistency based on a consistency token, that is, if
50   * replication has caught up based on the conditions specified in the token and
51   * the check request. (tables.checkConsistency)
52   *
53   * @param string $name Required. The unique name of the Table for which to check
54   * replication consistency. Values are of the form
55   * `projects/{project}/instances/{instance}/tables/{table}`.
56   * @param CheckConsistencyRequest $postBody
57   * @param array $optParams Optional parameters.
58   * @return CheckConsistencyResponse
59   */
60  public function checkConsistency($name, CheckConsistencyRequest $postBody, $optParams = [])
61  {
62    $params = ['name' => $name, 'postBody' => $postBody];
63    $params = array_merge($params, $optParams);
64    return $this->call('checkConsistency', [$params], CheckConsistencyResponse::class);
65  }
66  /**
67   * Creates a new table in the specified instance. The table can be created with
68   * a full set of initial column families, specified in the request.
69   * (tables.create)
70   *
71   * @param string $parent Required. The unique name of the instance in which to
72   * create the table. Values are of the form
73   * `projects/{project}/instances/{instance}`.
74   * @param CreateTableRequest $postBody
75   * @param array $optParams Optional parameters.
76   * @return Table
77   */
78  public function create($parent, CreateTableRequest $postBody, $optParams = [])
79  {
80    $params = ['parent' => $parent, 'postBody' => $postBody];
81    $params = array_merge($params, $optParams);
82    return $this->call('create', [$params], Table::class);
83  }
84  /**
85   * Permanently deletes a specified table and all of its data. (tables.delete)
86   *
87   * @param string $name Required. The unique name of the table to be deleted.
88   * Values are of the form
89   * `projects/{project}/instances/{instance}/tables/{table}`.
90   * @param array $optParams Optional parameters.
91   * @return BigtableadminEmpty
92   */
93  public function delete($name, $optParams = [])
94  {
95    $params = ['name' => $name];
96    $params = array_merge($params, $optParams);
97    return $this->call('delete', [$params], BigtableadminEmpty::class);
98  }
99  /**
100   * Permanently drop/delete a row range from a specified table. The request can
101   * specify whether to delete all rows in a table, or only those that match a
102   * particular prefix. (tables.dropRowRange)
103   *
104   * @param string $name Required. The unique name of the table on which to drop a
105   * range of rows. Values are of the form
106   * `projects/{project}/instances/{instance}/tables/{table}`.
107   * @param DropRowRangeRequest $postBody
108   * @param array $optParams Optional parameters.
109   * @return BigtableadminEmpty
110   */
111  public function dropRowRange($name, DropRowRangeRequest $postBody, $optParams = [])
112  {
113    $params = ['name' => $name, 'postBody' => $postBody];
114    $params = array_merge($params, $optParams);
115    return $this->call('dropRowRange', [$params], BigtableadminEmpty::class);
116  }
117  /**
118   * Generates a consistency token for a Table, which can be used in
119   * CheckConsistency to check whether mutations to the table that finished before
120   * this call started have been replicated. The tokens will be available for 90
121   * days. (tables.generateConsistencyToken)
122   *
123   * @param string $name Required. The unique name of the Table for which to
124   * create a consistency token. Values are of the form
125   * `projects/{project}/instances/{instance}/tables/{table}`.
126   * @param GenerateConsistencyTokenRequest $postBody
127   * @param array $optParams Optional parameters.
128   * @return GenerateConsistencyTokenResponse
129   */
130  public function generateConsistencyToken($name, GenerateConsistencyTokenRequest $postBody, $optParams = [])
131  {
132    $params = ['name' => $name, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('generateConsistencyToken', [$params], GenerateConsistencyTokenResponse::class);
135  }
136  /**
137   * Gets metadata information about the specified table. (tables.get)
138   *
139   * @param string $name Required. The unique name of the requested table. Values
140   * are of the form `projects/{project}/instances/{instance}/tables/{table}`.
141   * @param array $optParams Optional parameters.
142   *
143   * @opt_param string view The view to be applied to the returned table's fields.
144   * Defaults to `SCHEMA_VIEW` if unspecified.
145   * @return Table
146   */
147  public function get($name, $optParams = [])
148  {
149    $params = ['name' => $name];
150    $params = array_merge($params, $optParams);
151    return $this->call('get', [$params], Table::class);
152  }
153  /**
154   * Gets the access control policy for a Table resource. Returns an empty policy
155   * if the resource exists but does not have a policy set. (tables.getIamPolicy)
156   *
157   * @param string $resource REQUIRED: The resource for which the policy is being
158   * requested. See the operation documentation for the appropriate value for this
159   * field.
160   * @param GetIamPolicyRequest $postBody
161   * @param array $optParams Optional parameters.
162   * @return Policy
163   */
164  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
165  {
166    $params = ['resource' => $resource, 'postBody' => $postBody];
167    $params = array_merge($params, $optParams);
168    return $this->call('getIamPolicy', [$params], Policy::class);
169  }
170  /**
171   * Lists all tables served from a specified instance.
172   * (tables.listProjectsInstancesTables)
173   *
174   * @param string $parent Required. The unique name of the instance for which
175   * tables should be listed. Values are of the form
176   * `projects/{project}/instances/{instance}`.
177   * @param array $optParams Optional parameters.
178   *
179   * @opt_param int pageSize Maximum number of results per page. A page_size of
180   * zero lets the server choose the number of items to return. A page_size which
181   * is strictly positive will return at most that many items. A negative
182   * page_size will cause an error. Following the first request, subsequent
183   * paginated calls are not required to pass a page_size. If a page_size is set
184   * in subsequent calls, it must match the page_size given in the first request.
185   * @opt_param string pageToken The value of `next_page_token` returned by a
186   * previous call.
187   * @opt_param string view The view to be applied to the returned tables' fields.
188   * Only NAME_ONLY view (default), REPLICATION_VIEW and ENCRYPTION_VIEW are
189   * supported.
190   * @return ListTablesResponse
191   */
192  public function listProjectsInstancesTables($parent, $optParams = [])
193  {
194    $params = ['parent' => $parent];
195    $params = array_merge($params, $optParams);
196    return $this->call('list', [$params], ListTablesResponse::class);
197  }
198  /**
199   * Performs a series of column family modifications on the specified table.
200   * Either all or none of the modifications will occur before this method
201   * returns, but data requests received prior to that point may see a table where
202   * only some modifications have taken effect. (tables.modifyColumnFamilies)
203   *
204   * @param string $name Required. The unique name of the table whose families
205   * should be modified. Values are of the form
206   * `projects/{project}/instances/{instance}/tables/{table}`.
207   * @param ModifyColumnFamiliesRequest $postBody
208   * @param array $optParams Optional parameters.
209   * @return Table
210   */
211  public function modifyColumnFamilies($name, ModifyColumnFamiliesRequest $postBody, $optParams = [])
212  {
213    $params = ['name' => $name, 'postBody' => $postBody];
214    $params = array_merge($params, $optParams);
215    return $this->call('modifyColumnFamilies', [$params], Table::class);
216  }
217  /**
218   * Create a new table by restoring from a completed backup. The new table must
219   * be in the same project as the instance containing the backup. The returned
220   * table long-running operation can be used to track the progress of the
221   * operation, and to cancel it. The metadata field type is RestoreTableMetadata.
222   * The response type is Table, if successful. (tables.restore)
223   *
224   * @param string $parent Required. The name of the instance in which to create
225   * the restored table. This instance must be in the same project as the source
226   * backup. Values are of the form `projects//instances/`.
227   * @param RestoreTableRequest $postBody
228   * @param array $optParams Optional parameters.
229   * @return Operation
230   */
231  public function restore($parent, RestoreTableRequest $postBody, $optParams = [])
232  {
233    $params = ['parent' => $parent, 'postBody' => $postBody];
234    $params = array_merge($params, $optParams);
235    return $this->call('restore', [$params], Operation::class);
236  }
237  /**
238   * Sets the access control policy on a Table resource. Replaces any existing
239   * policy. (tables.setIamPolicy)
240   *
241   * @param string $resource REQUIRED: The resource for which the policy is being
242   * specified. See the operation documentation for the appropriate value for this
243   * field.
244   * @param SetIamPolicyRequest $postBody
245   * @param array $optParams Optional parameters.
246   * @return Policy
247   */
248  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
249  {
250    $params = ['resource' => $resource, 'postBody' => $postBody];
251    $params = array_merge($params, $optParams);
252    return $this->call('setIamPolicy', [$params], Policy::class);
253  }
254  /**
255   * Returns permissions that the caller has on the specified table resource.
256   * (tables.testIamPermissions)
257   *
258   * @param string $resource REQUIRED: The resource for which the policy detail is
259   * being requested. See the operation documentation for the appropriate value
260   * for this field.
261   * @param TestIamPermissionsRequest $postBody
262   * @param array $optParams Optional parameters.
263   * @return TestIamPermissionsResponse
264   */
265  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
266  {
267    $params = ['resource' => $resource, 'postBody' => $postBody];
268    $params = array_merge($params, $optParams);
269    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
270  }
271}
272
273// Adding a class alias for backwards compatibility with the previous class name.
274class_alias(ProjectsInstancesTables::class, 'Google_Service_BigtableAdmin_Resource_ProjectsInstancesTables');
275