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\Dataproc\Resource;
19
20use Google\Service\Dataproc\DataprocEmpty;
21use Google\Service\Dataproc\GetIamPolicyRequest;
22use Google\Service\Dataproc\ListOperationsResponse;
23use Google\Service\Dataproc\Operation;
24use Google\Service\Dataproc\Policy;
25use Google\Service\Dataproc\SetIamPolicyRequest;
26use Google\Service\Dataproc\TestIamPermissionsRequest;
27use Google\Service\Dataproc\TestIamPermissionsResponse;
28
29/**
30 * The "operations" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $dataprocService = new Google\Service\Dataproc(...);
34 *   $operations = $dataprocService->operations;
35 *  </code>
36 */
37class ProjectsRegionsOperations extends \Google\Service\Resource
38{
39  /**
40   * Starts asynchronous cancellation on a long-running operation. The server
41   * makes a best effort to cancel the operation, but success is not guaranteed.
42   * If the server doesn't support this method, it returns
43   * google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or
44   * other methods to check whether the cancellation succeeded or whether the
45   * operation completed despite cancellation. On successful cancellation, the
46   * operation is not deleted; instead, it becomes an operation with an
47   * Operation.error value with a google.rpc.Status.code of 1, corresponding to
48   * Code.CANCELLED. (operations.cancel)
49   *
50   * @param string $name The name of the operation resource to be cancelled.
51   * @param array $optParams Optional parameters.
52   * @return DataprocEmpty
53   */
54  public function cancel($name, $optParams = [])
55  {
56    $params = ['name' => $name];
57    $params = array_merge($params, $optParams);
58    return $this->call('cancel', [$params], DataprocEmpty::class);
59  }
60  /**
61   * Deletes a long-running operation. This method indicates that the client is no
62   * longer interested in the operation result. It does not cancel the operation.
63   * If the server doesn't support this method, it returns
64   * google.rpc.Code.UNIMPLEMENTED. (operations.delete)
65   *
66   * @param string $name The name of the operation resource to be deleted.
67   * @param array $optParams Optional parameters.
68   * @return DataprocEmpty
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], DataprocEmpty::class);
75  }
76  /**
77   * Gets the latest state of a long-running operation. Clients can use this
78   * method to poll the operation result at intervals as recommended by the API
79   * service. (operations.get)
80   *
81   * @param string $name The name of the operation resource.
82   * @param array $optParams Optional parameters.
83   * @return Operation
84   */
85  public function get($name, $optParams = [])
86  {
87    $params = ['name' => $name];
88    $params = array_merge($params, $optParams);
89    return $this->call('get', [$params], Operation::class);
90  }
91  /**
92   * Gets the access control policy for a resource. Returns an empty policy if the
93   * resource exists and does not have a policy set. (operations.getIamPolicy)
94   *
95   * @param string $resource REQUIRED: The resource for which the policy is being
96   * requested. See the operation documentation for the appropriate value for this
97   * field.
98   * @param GetIamPolicyRequest $postBody
99   * @param array $optParams Optional parameters.
100   * @return Policy
101   */
102  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
103  {
104    $params = ['resource' => $resource, 'postBody' => $postBody];
105    $params = array_merge($params, $optParams);
106    return $this->call('getIamPolicy', [$params], Policy::class);
107  }
108  /**
109   * Lists operations that match the specified filter in the request. If the
110   * server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name
111   * binding allows API services to override the binding to use different resource
112   * name schemes, such as users/operations. To override the binding, API services
113   * can add a binding such as "/v1/{name=users}/operations" to their service
114   * configuration. For backwards compatibility, the default name includes the
115   * operations collection id, however overriding users must ensure the name
116   * binding is the parent resource, without the operations collection id.
117   * (operations.listProjectsRegionsOperations)
118   *
119   * @param string $name The name of the operation's parent resource.
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string filter The standard list filter.
123   * @opt_param int pageSize The standard list page size.
124   * @opt_param string pageToken The standard list page token.
125   * @return ListOperationsResponse
126   */
127  public function listProjectsRegionsOperations($name, $optParams = [])
128  {
129    $params = ['name' => $name];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], ListOperationsResponse::class);
132  }
133  /**
134   * Sets the access control policy on the specified resource. Replaces any
135   * existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
136   * errors. (operations.setIamPolicy)
137   *
138   * @param string $resource REQUIRED: The resource for which the policy is being
139   * specified. See the operation documentation for the appropriate value for this
140   * field.
141   * @param SetIamPolicyRequest $postBody
142   * @param array $optParams Optional parameters.
143   * @return Policy
144   */
145  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
146  {
147    $params = ['resource' => $resource, 'postBody' => $postBody];
148    $params = array_merge($params, $optParams);
149    return $this->call('setIamPolicy', [$params], Policy::class);
150  }
151  /**
152   * Returns permissions that a caller has on the specified resource. If the
153   * resource does not exist, this will return an empty set of permissions, not a
154   * NOT_FOUND error.Note: This operation is designed to be used for building
155   * permission-aware UIs and command-line tools, not for authorization checking.
156   * This operation may "fail open" without warning.
157   * (operations.testIamPermissions)
158   *
159   * @param string $resource REQUIRED: The resource for which the policy detail is
160   * being requested. See the operation documentation for the appropriate value
161   * for this field.
162   * @param TestIamPermissionsRequest $postBody
163   * @param array $optParams Optional parameters.
164   * @return TestIamPermissionsResponse
165   */
166  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
167  {
168    $params = ['resource' => $resource, 'postBody' => $postBody];
169    $params = array_merge($params, $optParams);
170    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
171  }
172}
173
174// Adding a class alias for backwards compatibility with the previous class name.
175class_alias(ProjectsRegionsOperations::class, 'Google_Service_Dataproc_Resource_ProjectsRegionsOperations');
176