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\Backup;
21use Google\Service\BigtableAdmin\BigtableadminEmpty;
22use Google\Service\BigtableAdmin\GetIamPolicyRequest;
23use Google\Service\BigtableAdmin\ListBackupsResponse;
24use Google\Service\BigtableAdmin\Operation;
25use Google\Service\BigtableAdmin\Policy;
26use Google\Service\BigtableAdmin\SetIamPolicyRequest;
27use Google\Service\BigtableAdmin\TestIamPermissionsRequest;
28use Google\Service\BigtableAdmin\TestIamPermissionsResponse;
29
30/**
31 * The "backups" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $bigtableadminService = new Google\Service\BigtableAdmin(...);
35 *   $backups = $bigtableadminService->backups;
36 *  </code>
37 */
38class ProjectsInstancesClustersBackups extends \Google\Service\Resource
39{
40  /**
41   * Starts creating a new Cloud Bigtable Backup. The returned backup long-running
42   * operation can be used to track creation of the backup. The metadata field
43   * type is CreateBackupMetadata. The response field type is Backup, if
44   * successful. Cancelling the returned operation will stop the creation and
45   * delete the backup. (backups.create)
46   *
47   * @param string $parent Required. This must be one of the clusters in the
48   * instance in which this table is located. The backup will be stored in this
49   * cluster. Values are of the form
50   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
51   * @param Backup $postBody
52   * @param array $optParams Optional parameters.
53   *
54   * @opt_param string backupId Required. The id of the backup to be created. The
55   * `backup_id` along with the parent `parent` are combined as
56   * {parent}/backups/{backup_id} to create the full backup name, of the form: `pr
57   * ojects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`
58   * . This string must be between 1 and 50 characters in length and match the
59   * regex _a-zA-Z0-9*.
60   * @return Operation
61   */
62  public function create($parent, Backup $postBody, $optParams = [])
63  {
64    $params = ['parent' => $parent, 'postBody' => $postBody];
65    $params = array_merge($params, $optParams);
66    return $this->call('create', [$params], Operation::class);
67  }
68  /**
69   * Deletes a pending or completed Cloud Bigtable backup. (backups.delete)
70   *
71   * @param string $name Required. Name of the backup to delete. Values are of the
72   * form `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{bac
73   * kup}`.
74   * @param array $optParams Optional parameters.
75   * @return BigtableadminEmpty
76   */
77  public function delete($name, $optParams = [])
78  {
79    $params = ['name' => $name];
80    $params = array_merge($params, $optParams);
81    return $this->call('delete', [$params], BigtableadminEmpty::class);
82  }
83  /**
84   * Gets metadata on a pending or completed Cloud Bigtable Backup. (backups.get)
85   *
86   * @param string $name Required. Name of the backup. Values are of the form `pro
87   * jects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
88   * @param array $optParams Optional parameters.
89   * @return Backup
90   */
91  public function get($name, $optParams = [])
92  {
93    $params = ['name' => $name];
94    $params = array_merge($params, $optParams);
95    return $this->call('get', [$params], Backup::class);
96  }
97  /**
98   * Gets the access control policy for a Table resource. Returns an empty policy
99   * if the resource exists but does not have a policy set. (backups.getIamPolicy)
100   *
101   * @param string $resource REQUIRED: The resource for which the policy is being
102   * requested. See the operation documentation for the appropriate value for this
103   * field.
104   * @param GetIamPolicyRequest $postBody
105   * @param array $optParams Optional parameters.
106   * @return Policy
107   */
108  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
109  {
110    $params = ['resource' => $resource, 'postBody' => $postBody];
111    $params = array_merge($params, $optParams);
112    return $this->call('getIamPolicy', [$params], Policy::class);
113  }
114  /**
115   * Lists Cloud Bigtable backups. Returns both completed and pending backups.
116   * (backups.listProjectsInstancesClustersBackups)
117   *
118   * @param string $parent Required. The cluster to list backups from. Values are
119   * of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. Use
120   * `{cluster} = '-'` to list backups for all clusters in an instance, e.g.,
121   * `projects/{project}/instances/{instance}/clusters/-`.
122   * @param array $optParams Optional parameters.
123   *
124   * @opt_param string filter A filter expression that filters backups listed in
125   * the response. The expression must specify the field name, a comparison
126   * operator, and the value that you want to use for filtering. The value must be
127   * a string, a number, or a boolean. The comparison operator must be <, >, <=,
128   * >=, !=, =, or :. Colon ':' represents a HAS operator which is roughly
129   * synonymous with equality. Filter rules are case insensitive. The fields
130   * eligible for filtering are: * `name` * `source_table` * `state` *
131   * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * `end_time`
132   * (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * `expire_time` (and
133   * values are of the format YYYY-MM-DDTHH:MM:SSZ) * `size_bytes` To filter on
134   * multiple expressions, provide each separate expression within parentheses. By
135   * default, each expression is an AND expression. However, you can include AND,
136   * OR, and NOT expressions explicitly. Some examples of using filters are: *
137   * `name:"exact"` --> The backup's name is the string "exact". * `name:howl` -->
138   * The backup's name contains the string "howl". * `source_table:prod` --> The
139   * source_table's name contains the string "prod". * `state:CREATING` --> The
140   * backup is pending creation. * `state:READY` --> The backup is fully created
141   * and ready for use. * `(name:howl) AND (start_time <
142   * \"2018-03-28T14:50:00Z\")` --> The backup name contains the string "howl" and
143   * start_time of the backup is before 2018-03-28T14:50:00Z. * `size_bytes >
144   * 10000000000` --> The backup's size is greater than 10GB
145   * @opt_param string orderBy An expression for specifying the sort order of the
146   * results of the request. The string value should specify one or more fields in
147   * Backup. The full syntax is described at https://aip.dev/132#ordering. Fields
148   * supported are: * name * source_table * expire_time * start_time * end_time *
149   * size_bytes * state For example, "start_time". The default sorting order is
150   * ascending. To specify descending order for the field, a suffix " desc" should
151   * be appended to the field name. For example, "start_time desc". Redundant
152   * space characters in the syntax are insigificant. If order_by is empty,
153   * results will be sorted by `start_time` in descending order starting from the
154   * most recently created backup.
155   * @opt_param int pageSize Number of backups to be returned in the response. If
156   * 0 or less, defaults to the server's maximum allowed page size.
157   * @opt_param string pageToken If non-empty, `page_token` should contain a
158   * next_page_token from a previous ListBackupsResponse to the same `parent` and
159   * with the same `filter`.
160   * @return ListBackupsResponse
161   */
162  public function listProjectsInstancesClustersBackups($parent, $optParams = [])
163  {
164    $params = ['parent' => $parent];
165    $params = array_merge($params, $optParams);
166    return $this->call('list', [$params], ListBackupsResponse::class);
167  }
168  /**
169   * Updates a pending or completed Cloud Bigtable Backup. (backups.patch)
170   *
171   * @param string $name A globally unique identifier for the backup which cannot
172   * be changed. Values are of the form
173   * `projects/{project}/instances/{instance}/clusters/{cluster}/ backups/_a-
174   * zA-Z0-9*` The final segment of the name must be between 1 and 50 characters
175   * in length. The backup is stored in the cluster identified by the prefix of
176   * the backup name of the form
177   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
178   * @param Backup $postBody
179   * @param array $optParams Optional parameters.
180   *
181   * @opt_param string updateMask Required. A mask specifying which fields (e.g.
182   * `expire_time`) in the Backup resource should be updated. This mask is
183   * relative to the Backup resource, not to the request message. The field mask
184   * must always be specified; this prevents any future fields from being erased
185   * accidentally by clients that do not know about them.
186   * @return Backup
187   */
188  public function patch($name, Backup $postBody, $optParams = [])
189  {
190    $params = ['name' => $name, 'postBody' => $postBody];
191    $params = array_merge($params, $optParams);
192    return $this->call('patch', [$params], Backup::class);
193  }
194  /**
195   * Sets the access control policy on a Table resource. Replaces any existing
196   * policy. (backups.setIamPolicy)
197   *
198   * @param string $resource REQUIRED: The resource for which the policy is being
199   * specified. See the operation documentation for the appropriate value for this
200   * field.
201   * @param SetIamPolicyRequest $postBody
202   * @param array $optParams Optional parameters.
203   * @return Policy
204   */
205  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
206  {
207    $params = ['resource' => $resource, 'postBody' => $postBody];
208    $params = array_merge($params, $optParams);
209    return $this->call('setIamPolicy', [$params], Policy::class);
210  }
211  /**
212   * Returns permissions that the caller has on the specified table resource.
213   * (backups.testIamPermissions)
214   *
215   * @param string $resource REQUIRED: The resource for which the policy detail is
216   * being requested. See the operation documentation for the appropriate value
217   * for this field.
218   * @param TestIamPermissionsRequest $postBody
219   * @param array $optParams Optional parameters.
220   * @return TestIamPermissionsResponse
221   */
222  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
223  {
224    $params = ['resource' => $resource, 'postBody' => $postBody];
225    $params = array_merge($params, $optParams);
226    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
227  }
228}
229
230// Adding a class alias for backwards compatibility with the previous class name.
231class_alias(ProjectsInstancesClustersBackups::class, 'Google_Service_BigtableAdmin_Resource_ProjectsInstancesClustersBackups');
232