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\DataprocMetastore\Resource;
19
20use Google\Service\DataprocMetastore\Backup;
21use Google\Service\DataprocMetastore\ListBackupsResponse;
22use Google\Service\DataprocMetastore\Operation;
23use Google\Service\DataprocMetastore\Policy;
24use Google\Service\DataprocMetastore\SetIamPolicyRequest;
25use Google\Service\DataprocMetastore\TestIamPermissionsRequest;
26use Google\Service\DataprocMetastore\TestIamPermissionsResponse;
27
28/**
29 * The "backups" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $metastoreService = new Google\Service\DataprocMetastore(...);
33 *   $backups = $metastoreService->backups;
34 *  </code>
35 */
36class ProjectsLocationsServicesBackups extends \Google\Service\Resource
37{
38  /**
39   * Creates a new backup in a given project and location. (backups.create)
40   *
41   * @param string $parent Required. The relative resource name of the service in
42   * which to create a backup of the following
43   * form:projects/{project_number}/locations/{location_id}/services/{service_id}.
44   * @param Backup $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string backupId Required. The ID of the backup, which is used as
48   * the final component of the backup's name.This value must be between 1 and 64
49   * characters long, begin with a letter, end with a letter or number, and
50   * consist of alpha-numeric ASCII characters or hyphens.
51   * @opt_param string requestId Optional. A request ID. Specify a unique request
52   * ID to allow the server to ignore the request if it has completed. The server
53   * will ignore subsequent requests that provide a duplicate request ID for at
54   * least 60 minutes after the first request.For example, if an initial request
55   * times out, followed by another request with the same request ID, the server
56   * ignores the second request to prevent the creation of duplicate
57   * commitments.The request ID must be a valid UUID
58   * (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero
59   * UUID (00000000-0000-0000-0000-000000000000) is not supported.
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 single backup. (backups.delete)
70   *
71   * @param string $name Required. The relative resource name of the backup to
72   * delete, in the following form:projects/{project_number}/locations/{location_i
73   * d}/services/{service_id}/backups/{backup_id}.
74   * @param array $optParams Optional parameters.
75   *
76   * @opt_param string requestId Optional. A request ID. Specify a unique request
77   * ID to allow the server to ignore the request if it has completed. The server
78   * will ignore subsequent requests that provide a duplicate request ID for at
79   * least 60 minutes after the first request.For example, if an initial request
80   * times out, followed by another request with the same request ID, the server
81   * ignores the second request to prevent the creation of duplicate
82   * commitments.The request ID must be a valid UUID
83   * (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero
84   * UUID (00000000-0000-0000-0000-000000000000) is not supported.
85   * @return Operation
86   */
87  public function delete($name, $optParams = [])
88  {
89    $params = ['name' => $name];
90    $params = array_merge($params, $optParams);
91    return $this->call('delete', [$params], Operation::class);
92  }
93  /**
94   * Gets details of a single backup. (backups.get)
95   *
96   * @param string $name Required. The relative resource name of the backup to
97   * retrieve, in the following form:projects/{project_number}/locations/{location
98   * _id}/services/{service_id}/backups/{backup_id}.
99   * @param array $optParams Optional parameters.
100   * @return Backup
101   */
102  public function get($name, $optParams = [])
103  {
104    $params = ['name' => $name];
105    $params = array_merge($params, $optParams);
106    return $this->call('get', [$params], Backup::class);
107  }
108  /**
109   * Gets the access control policy for a resource. Returns an empty policy if the
110   * resource exists and does not have a policy set. (backups.getIamPolicy)
111   *
112   * @param string $resource REQUIRED: The resource for which the policy is being
113   * requested. See the operation documentation for the appropriate value for this
114   * field.
115   * @param array $optParams Optional parameters.
116   *
117   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
118   * version that will be used to format the policy.Valid values are 0, 1, and 3.
119   * Requests specifying an invalid value will be rejected.Requests for policies
120   * with any conditional role bindings must specify version 3. Policies with no
121   * conditional role bindings may specify any valid value or leave the field
122   * unset.The policy in the response might use the policy version that you
123   * specified, or it might use a lower policy version. For example, if you
124   * specify version 3, but the policy has no conditional role bindings, the
125   * response uses version 1.To learn which resources support conditions in their
126   * IAM policies, see the IAM documentation
127   * (https://cloud.google.com/iam/help/conditions/resource-policies).
128   * @return Policy
129   */
130  public function getIamPolicy($resource, $optParams = [])
131  {
132    $params = ['resource' => $resource];
133    $params = array_merge($params, $optParams);
134    return $this->call('getIamPolicy', [$params], Policy::class);
135  }
136  /**
137   * Lists backups in a service. (backups.listProjectsLocationsServicesBackups)
138   *
139   * @param string $parent Required. The relative resource name of the service
140   * whose backups to list, in the following form:projects/{project_number}/locati
141   * ons/{location_id}/services/{service_id}/backups.
142   * @param array $optParams Optional parameters.
143   *
144   * @opt_param string filter Optional. The filter to apply to list results.
145   * @opt_param string orderBy Optional. Specify the ordering of results as
146   * described in Sorting Order
147   * (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not
148   * specified, the results will be sorted in the default order.
149   * @opt_param int pageSize Optional. The maximum number of backups to return.
150   * The response may contain less than the maximum number. If unspecified, no
151   * more than 500 backups are returned. The maximum value is 1000; values above
152   * 1000 are changed to 1000.
153   * @opt_param string pageToken Optional. A page token, received from a previous
154   * DataprocMetastore.ListBackups call. Provide this token to retrieve the
155   * subsequent page.To retrieve the first page, supply an empty page token.When
156   * paginating, other parameters provided to DataprocMetastore.ListBackups must
157   * match the call that provided the page token.
158   * @return ListBackupsResponse
159   */
160  public function listProjectsLocationsServicesBackups($parent, $optParams = [])
161  {
162    $params = ['parent' => $parent];
163    $params = array_merge($params, $optParams);
164    return $this->call('list', [$params], ListBackupsResponse::class);
165  }
166  /**
167   * Sets the access control policy on the specified resource. Replaces any
168   * existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
169   * errors. (backups.setIamPolicy)
170   *
171   * @param string $resource REQUIRED: The resource for which the policy is being
172   * specified. See the operation documentation for the appropriate value for this
173   * field.
174   * @param SetIamPolicyRequest $postBody
175   * @param array $optParams Optional parameters.
176   * @return Policy
177   */
178  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
179  {
180    $params = ['resource' => $resource, 'postBody' => $postBody];
181    $params = array_merge($params, $optParams);
182    return $this->call('setIamPolicy', [$params], Policy::class);
183  }
184  /**
185   * Returns permissions that a caller has on the specified resource. If the
186   * resource does not exist, this will return an empty set of permissions, not a
187   * NOT_FOUND error.Note: This operation is designed to be used for building
188   * permission-aware UIs and command-line tools, not for authorization checking.
189   * This operation may "fail open" without warning. (backups.testIamPermissions)
190   *
191   * @param string $resource REQUIRED: The resource for which the policy detail is
192   * being requested. See the operation documentation for the appropriate value
193   * for this field.
194   * @param TestIamPermissionsRequest $postBody
195   * @param array $optParams Optional parameters.
196   * @return TestIamPermissionsResponse
197   */
198  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
199  {
200    $params = ['resource' => $resource, 'postBody' => $postBody];
201    $params = array_merge($params, $optParams);
202    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
203  }
204}
205
206// Adding a class alias for backwards compatibility with the previous class name.
207class_alias(ProjectsLocationsServicesBackups::class, 'Google_Service_DataprocMetastore_Resource_ProjectsLocationsServicesBackups');
208