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\GoogleLongrunningOperation;
21use Google\Service\BackupforGKE\ListRestorePlansResponse;
22use Google\Service\BackupforGKE\Policy;
23use Google\Service\BackupforGKE\RestorePlan;
24use Google\Service\BackupforGKE\SetIamPolicyRequest;
25use Google\Service\BackupforGKE\TestIamPermissionsRequest;
26use Google\Service\BackupforGKE\TestIamPermissionsResponse;
27
28/**
29 * The "restorePlans" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $gkebackupService = new Google\Service\BackupforGKE(...);
33 *   $restorePlans = $gkebackupService->restorePlans;
34 *  </code>
35 */
36class ProjectsLocationsRestorePlans extends \Google\Service\Resource
37{
38  /**
39   * Creates a new RestorePlan in a given location. (restorePlans.create)
40   *
41   * @param string $parent Required. The location within which to create the
42   * RestorePlan. Format: projects/{project}/locations/{location}
43   * @param RestorePlan $postBody
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string restorePlanId Required. The client-provided short name for
47   * the RestorePlan 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 RestorePlans in this location
51   * @return GoogleLongrunningOperation
52   */
53  public function create($parent, RestorePlan $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 RestorePlan. (restorePlans.delete)
61   *
62   * @param string $name Required. Fully qualified RestorePlan name. Format:
63   * projects/{project}/locations/{location}/restorePlans/{restore_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   * @opt_param bool force If set to true, any restores below this restorePlan
69   * will also be deleted. Otherwise, the request will only succeed if the
70   * restorePlan has no restores.
71   * @return GoogleLongrunningOperation
72   */
73  public function delete($name, $optParams = [])
74  {
75    $params = ['name' => $name];
76    $params = array_merge($params, $optParams);
77    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
78  }
79  /**
80   * Retrieve the details of a single RestorePlan. (restorePlans.get)
81   *
82   * @param string $name Required. Fully qualified RestorePlan name. Format:
83   * projects/{project}/locations/{location}/restorePlans/{restore_plan}
84   * @param array $optParams Optional parameters.
85   * @return RestorePlan
86   */
87  public function get($name, $optParams = [])
88  {
89    $params = ['name' => $name];
90    $params = array_merge($params, $optParams);
91    return $this->call('get', [$params], RestorePlan::class);
92  }
93  /**
94   * Gets the access control policy for a resource. Returns an empty policy if the
95   * resource exists and does not have a policy set. (restorePlans.getIamPolicy)
96   *
97   * @param string $resource REQUIRED: The resource for which the policy is being
98   * requested. See the operation documentation for the appropriate value for this
99   * field.
100   * @param array $optParams Optional parameters.
101   *
102   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
103   * version that will be used to format the policy. Valid values are 0, 1, and 3.
104   * Requests specifying an invalid value will be rejected. Requests for policies
105   * with any conditional role bindings must specify version 3. Policies with no
106   * conditional role bindings may specify any valid value or leave the field
107   * unset. The policy in the response might use the policy version that you
108   * specified, or it might use a lower policy version. For example, if you
109   * specify version 3, but the policy has no conditional role bindings, the
110   * response uses version 1. To learn which resources support conditions in their
111   * IAM policies, see the [IAM
112   * documentation](https://cloud.google.com/iam/help/conditions/resource-
113   * policies).
114   * @return Policy
115   */
116  public function getIamPolicy($resource, $optParams = [])
117  {
118    $params = ['resource' => $resource];
119    $params = array_merge($params, $optParams);
120    return $this->call('getIamPolicy', [$params], Policy::class);
121  }
122  /**
123   * Lists RestorePlans in a given location.
124   * (restorePlans.listProjectsLocationsRestorePlans)
125   *
126   * @param string $parent Required. The location that contains the RestorePlans
127   * to list. Format: projects/{project}/locations/{location}
128   * @param array $optParams Optional parameters.
129   *
130   * @opt_param string filter List filter.
131   * @opt_param string orderBy Sort results.
132   * @opt_param int pageSize The target number of results to return in a single
133   * response. If not specified, a default value will be chosen by the service.
134   * Note that the response may inclue a partial list and a caller should only
135   * rely on the response's next_page_token to determine if there are more
136   * instances left to be queried.
137   * @opt_param string pageToken The value of next_page_token received from a
138   * previous `ListRestorePlans` call. Provide this to retrieve the subsequent
139   * page in a multi-page list of results. When paginating, all other parameters
140   * provided to `ListRestorePlans` must match the call that provided the page
141   * token.
142   * @return ListRestorePlansResponse
143   */
144  public function listProjectsLocationsRestorePlans($parent, $optParams = [])
145  {
146    $params = ['parent' => $parent];
147    $params = array_merge($params, $optParams);
148    return $this->call('list', [$params], ListRestorePlansResponse::class);
149  }
150  /**
151   * Update a RestorePlan. (restorePlans.patch)
152   *
153   * @param string $name Output only. [Output Only] The full name of the
154   * RestorePlan resource. Format: projects/locations/restorePlans
155   * @param RestorePlan $postBody
156   * @param array $optParams Optional parameters.
157   *
158   * @opt_param string updateMask This is used to specify the fields to be
159   * overwritten in the RestorePlan targeted for update. The values for each of
160   * these updated fields will be taken from the `restore_plan` provided with this
161   * request. Field names are relative to the root of the resource. If no
162   * `update_mask` is provided, all fields in `restore_plan` will be written to
163   * the target RestorePlan resource. Note that OUTPUT_ONLY and IMMUTABLE fields
164   * in `restore_plan` are ignored and are not used to update the target
165   * RestorePlan.
166   * @return GoogleLongrunningOperation
167   */
168  public function patch($name, RestorePlan $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. (restorePlans.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.
198   * (restorePlans.testIamPermissions)
199   *
200   * @param string $resource REQUIRED: The resource for which the policy detail is
201   * being requested. See the operation documentation for the appropriate value
202   * for this field.
203   * @param TestIamPermissionsRequest $postBody
204   * @param array $optParams Optional parameters.
205   * @return TestIamPermissionsResponse
206   */
207  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
208  {
209    $params = ['resource' => $resource, 'postBody' => $postBody];
210    $params = array_merge($params, $optParams);
211    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
212  }
213}
214
215// Adding a class alias for backwards compatibility with the previous class name.
216class_alias(ProjectsLocationsRestorePlans::class, 'Google_Service_BackupforGKE_Resource_ProjectsLocationsRestorePlans');
217