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\BackupforGKE\Resource;
19
20use Google\Service\BackupforGKE\Backup;
21use Google\Service\BackupforGKE\GoogleLongrunningOperation;
22use Google\Service\BackupforGKE\ListBackupsResponse;
23use Google\Service\BackupforGKE\Policy;
24use Google\Service\BackupforGKE\SetIamPolicyRequest;
25use Google\Service\BackupforGKE\TestIamPermissionsRequest;
26use Google\Service\BackupforGKE\TestIamPermissionsResponse;
27
28/**
29 * The "backups" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $gkebackupService = new Google\Service\BackupforGKE(...);
33 *   $backups = $gkebackupService->backups;
34 *  </code>
35 */
36class ProjectsLocationsBackupPlansBackups extends \Google\Service\Resource
37{
38  /**
39   * Creates a Backup for the given BackupPlan. (backups.create)
40   *
41   * @param string $parent Required. The BackupPlan within which to create the
42   * Backup. Format:
43   * projects/{project}/locations/{location}/backupPlans/{backup_plan}
44   * @param Backup $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string backupId The client-provided short name for the Backup
48   * resource. This name must: a. be between 1 and 63 characters long (inclusive)
49   * b. consist of only lower-case ASCII letters, numbers, and dashes c. start
50   * with a lower-case letter d. end with a lower-case letter or number e. be
51   * unique within the set of Backups in this BackupPlan
52   * @return GoogleLongrunningOperation
53   */
54  public function create($parent, Backup $postBody, $optParams = [])
55  {
56    $params = ['parent' => $parent, 'postBody' => $postBody];
57    $params = array_merge($params, $optParams);
58    return $this->call('create', [$params], GoogleLongrunningOperation::class);
59  }
60  /**
61   * Deletes an existing Backup. (backups.delete)
62   *
63   * @param string $name Required. Name of the Backup resource. Format: projects/{
64   * project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param string etag etag, if provided, it must match the server's etag for
68   * the delete to happen.
69   * @opt_param bool force If set to true, any volumeBackups below this backup
70   * will also be deleted. Otherwise, the request will only succeed if the backup
71   * has no volumeBackups.
72   * @return GoogleLongrunningOperation
73   */
74  public function delete($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
79  }
80  /**
81   * Retrieve the details of a single Backup. (backups.get)
82   *
83   * @param string $name Required. Full name of the Backup resource. Format: proje
84   * cts/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}
85   * @param array $optParams Optional parameters.
86   * @return Backup
87   */
88  public function get($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('get', [$params], Backup::class);
93  }
94  /**
95   * Gets the access control policy for a resource. Returns an empty policy if the
96   * resource exists and does not have a policy set. (backups.getIamPolicy)
97   *
98   * @param string $resource REQUIRED: The resource for which the policy is being
99   * requested. See the operation documentation for the appropriate value for this
100   * field.
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
104   * version that will be used to format the policy. Valid values are 0, 1, and 3.
105   * Requests specifying an invalid value will be rejected. Requests for policies
106   * with any conditional role bindings must specify version 3. Policies with no
107   * conditional role bindings may specify any valid value or leave the field
108   * unset. The policy in the response might use the policy version that you
109   * specified, or it might use a lower policy version. For example, if you
110   * specify version 3, but the policy has no conditional role bindings, the
111   * response uses version 1. To learn which resources support conditions in their
112   * IAM policies, see the [IAM
113   * documentation](https://cloud.google.com/iam/help/conditions/resource-
114   * policies).
115   * @return Policy
116   */
117  public function getIamPolicy($resource, $optParams = [])
118  {
119    $params = ['resource' => $resource];
120    $params = array_merge($params, $optParams);
121    return $this->call('getIamPolicy', [$params], Policy::class);
122  }
123  /**
124   * Lists the Backups for a given BackupPlan.
125   * (backups.listProjectsLocationsBackupPlansBackups)
126   *
127   * @param string $parent Required. The BackupPlan that contains the Backups to
128   * list. Format:
129   * projects/{project}/locations/{location}/backupPlans/{backup_plan}
130   * @param array $optParams Optional parameters.
131   *
132   * @opt_param string filter List filter.
133   * @opt_param string orderBy Sort results.
134   * @opt_param int pageSize The target number of results to return in a single
135   * response. If not specified, a default value will be chosen by the service.
136   * Note that the response may inclue a partial list and a caller should only
137   * rely on the response's next_page_token to determine if there are more
138   * instances left to be queried.
139   * @opt_param string pageToken The value of next_page_token received from a
140   * previous `ListBackups` call. Provide this to retrieve the subsequent page in
141   * a multi-page list of results. When paginating, all other parameters provided
142   * to `ListBackups` must match the call that provided the page token.
143   * @return ListBackupsResponse
144   */
145  public function listProjectsLocationsBackupPlansBackups($parent, $optParams = [])
146  {
147    $params = ['parent' => $parent];
148    $params = array_merge($params, $optParams);
149    return $this->call('list', [$params], ListBackupsResponse::class);
150  }
151  /**
152   * Update a Backup. (backups.patch)
153   *
154   * @param string $name Output only. The fully qualified name of the Backup.
155   * projects/locations/backupPlans/backups
156   * @param Backup $postBody
157   * @param array $optParams Optional parameters.
158   *
159   * @opt_param string updateMask This is used to specify the fields to be
160   * overwritten in the Backup targeted for update. The values for each of these
161   * updated fields will be taken from the `backup_plan` provided with this
162   * request. Field names are relative to the root of the resource. If no
163   * `update_mask` is provided, all fields in `backup` will be written to the
164   * target Backup resource. Note that OUTPUT_ONLY and IMMUTABLE fields in
165   * `backup` are ignored and are not used to update the target Backup.
166   * @return GoogleLongrunningOperation
167   */
168  public function patch($name, Backup $postBody, $optParams = [])
169  {
170    $params = ['name' => $name, 'postBody' => $postBody];
171    $params = array_merge($params, $optParams);
172    return $this->call('patch', [$params], GoogleLongrunningOperation::class);
173  }
174  /**
175   * Sets the access control policy on the specified resource. Replaces any
176   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
177   * `PERMISSION_DENIED` errors. (backups.setIamPolicy)
178   *
179   * @param string $resource REQUIRED: The resource for which the policy is being
180   * specified. See the operation documentation for the appropriate value for this
181   * field.
182   * @param SetIamPolicyRequest $postBody
183   * @param array $optParams Optional parameters.
184   * @return Policy
185   */
186  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
187  {
188    $params = ['resource' => $resource, 'postBody' => $postBody];
189    $params = array_merge($params, $optParams);
190    return $this->call('setIamPolicy', [$params], Policy::class);
191  }
192  /**
193   * Returns permissions that a caller has on the specified resource. If the
194   * resource does not exist, this will return an empty set of permissions, not a
195   * `NOT_FOUND` error. Note: This operation is designed to be used for building
196   * permission-aware UIs and command-line tools, not for authorization checking.
197   * This operation may "fail open" without warning. (backups.testIamPermissions)
198   *
199   * @param string $resource REQUIRED: The resource for which the policy detail is
200   * being requested. See the operation documentation for the appropriate value
201   * for this field.
202   * @param TestIamPermissionsRequest $postBody
203   * @param array $optParams Optional parameters.
204   * @return TestIamPermissionsResponse
205   */
206  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
207  {
208    $params = ['resource' => $resource, 'postBody' => $postBody];
209    $params = array_merge($params, $optParams);
210    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
211  }
212}
213
214// Adding a class alias for backwards compatibility with the previous class name.
215class_alias(ProjectsLocationsBackupPlansBackups::class, 'Google_Service_BackupforGKE_Resource_ProjectsLocationsBackupPlansBackups');
216