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