source: vendor/google/apiclient-services/src/CloudTasks/Resource/ProjectsLocationsQueues.php@ e3d4e0a

Last change on this file since e3d4e0a was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 9 days ago

Upload project files

  • Property mode set to 100644
File size: 14.2 KB
Line 
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\CloudTasks\Resource;
19
20use Google\Service\CloudTasks\CloudtasksEmpty;
21use Google\Service\CloudTasks\GetIamPolicyRequest;
22use Google\Service\CloudTasks\ListQueuesResponse;
23use Google\Service\CloudTasks\PauseQueueRequest;
24use Google\Service\CloudTasks\Policy;
25use Google\Service\CloudTasks\PurgeQueueRequest;
26use Google\Service\CloudTasks\Queue;
27use Google\Service\CloudTasks\ResumeQueueRequest;
28use Google\Service\CloudTasks\SetIamPolicyRequest;
29use Google\Service\CloudTasks\TestIamPermissionsRequest;
30use Google\Service\CloudTasks\TestIamPermissionsResponse;
31
32/**
33 * The "queues" collection of methods.
34 * Typical usage is:
35 * <code>
36 * $cloudtasksService = new Google\Service\CloudTasks(...);
37 * $queues = $cloudtasksService->projects_locations_queues;
38 * </code>
39 */
40class ProjectsLocationsQueues extends \Google\Service\Resource
41{
42 /**
43 * Creates a queue. Queues created with this method allow tasks to live for a
44 * maximum of 31 days. After a task is 31 days old, the task will be deleted
45 * regardless of whether it was dispatched or not. WARNING: Using this method
46 * may have unintended side effects if you are using an App Engine `queue.yaml`
47 * or `queue.xml` file to manage your queues. Read [Overview of Queue Management
48 * and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
49 * this method. (queues.create)
50 *
51 * @param string $parent Required. The location name in which the queue will be
52 * created. For example: `projects/PROJECT_ID/locations/LOCATION_ID` The list of
53 * allowed locations can be obtained by calling Cloud Tasks' implementation of
54 * ListLocations.
55 * @param Queue $postBody
56 * @param array $optParams Optional parameters.
57 * @return Queue
58 * @throws \Google\Service\Exception
59 */
60 public function create($parent, Queue $postBody, $optParams = [])
61 {
62 $params = ['parent' => $parent, 'postBody' => $postBody];
63 $params = array_merge($params, $optParams);
64 return $this->call('create', [$params], Queue::class);
65 }
66 /**
67 * Deletes a queue. This command will delete the queue even if it has tasks in
68 * it. Note: If you delete a queue, you may be prevented from creating a new
69 * queue with the same name as the deleted queue for a tombstone window of up to
70 * 3 days. During this window, the CreateQueue operation may appear to recreate
71 * the queue, but this can be misleading. If you attempt to create a queue with
72 * the same name as one that is in the tombstone window, run GetQueue to confirm
73 * that the queue creation was successful. If GetQueue returns 200 response
74 * code, your queue was successfully created with the name of the previously
75 * deleted queue. Otherwise, your queue did not successfully recreate. WARNING:
76 * Using this method may have unintended side effects if you are using an App
77 * Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview
78 * of Queue Management and
79 * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this
80 * method. (queues.delete)
81 *
82 * @param string $name Required. The queue name. For example:
83 * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
84 * @param array $optParams Optional parameters.
85 * @return CloudtasksEmpty
86 * @throws \Google\Service\Exception
87 */
88 public function delete($name, $optParams = [])
89 {
90 $params = ['name' => $name];
91 $params = array_merge($params, $optParams);
92 return $this->call('delete', [$params], CloudtasksEmpty::class);
93 }
94 /**
95 * Gets a queue. (queues.get)
96 *
97 * @param string $name Required. The resource name of the queue. For example:
98 * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
99 * @param array $optParams Optional parameters.
100 * @return Queue
101 * @throws \Google\Service\Exception
102 */
103 public function get($name, $optParams = [])
104 {
105 $params = ['name' => $name];
106 $params = array_merge($params, $optParams);
107 return $this->call('get', [$params], Queue::class);
108 }
109 /**
110 * Gets the access control policy for a Queue. Returns an empty policy if the
111 * resource exists and does not have a policy set. Authorization requires the
112 * following [Google IAM](https://cloud.google.com/iam) permission on the
113 * specified resource parent: * `cloudtasks.queues.getIamPolicy`
114 * (queues.getIamPolicy)
115 *
116 * @param string $resource REQUIRED: The resource for which the policy is being
117 * requested. See [Resource
118 * names](https://cloud.google.com/apis/design/resource_names) for the
119 * appropriate value for this field.
120 * @param GetIamPolicyRequest $postBody
121 * @param array $optParams Optional parameters.
122 * @return Policy
123 * @throws \Google\Service\Exception
124 */
125 public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
126 {
127 $params = ['resource' => $resource, 'postBody' => $postBody];
128 $params = array_merge($params, $optParams);
129 return $this->call('getIamPolicy', [$params], Policy::class);
130 }
131 /**
132 * Lists queues. Queues are returned in lexicographical order.
133 * (queues.listProjectsLocationsQueues)
134 *
135 * @param string $parent Required. The location name. For example:
136 * `projects/PROJECT_ID/locations/LOCATION_ID`
137 * @param array $optParams Optional parameters.
138 *
139 * @opt_param string filter `filter` can be used to specify a subset of queues.
140 * Any Queue field can be used as a filter and several operators as supported.
141 * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as
142 * described in [Stackdriver's Advanced Logs
143 * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). Sample
144 * filter "state: PAUSED". Note that using filters might cause fewer queues than
145 * the requested page_size to be returned.
146 * @opt_param int pageSize Requested page size. The maximum page size is 9800.
147 * If unspecified, the page size will be the maximum. Fewer queues than
148 * requested might be returned, even if more queues exist; use the
149 * next_page_token in the response to determine if more queues exist.
150 * @opt_param string pageToken A token identifying the page of results to
151 * return. To request the first page results, page_token must be empty. To
152 * request the next page of results, page_token must be the value of
153 * next_page_token returned from the previous call to ListQueues method. It is
154 * an error to switch the value of the filter while iterating through pages.
155 * @return ListQueuesResponse
156 * @throws \Google\Service\Exception
157 */
158 public function listProjectsLocationsQueues($parent, $optParams = [])
159 {
160 $params = ['parent' => $parent];
161 $params = array_merge($params, $optParams);
162 return $this->call('list', [$params], ListQueuesResponse::class);
163 }
164 /**
165 * Updates a queue. This method creates the queue if it does not exist and
166 * updates the queue if it does exist. Queues created with this method allow
167 * tasks to live for a maximum of 31 days. After a task is 31 days old, the task
168 * will be deleted regardless of whether it was dispatched or not. WARNING:
169 * Using this method may have unintended side effects if you are using an App
170 * Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview
171 * of Queue Management and
172 * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this
173 * method. (queues.patch)
174 *
175 * @param string $name Caller-specified and required in CreateQueue, after which
176 * it becomes output only. The queue name. The queue name must have the
177 * following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
178 * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-),
179 * colons (:), or periods (.). For more information, see [Identifying
180 * projects](https://cloud.google.com/resource-manager/docs/creating-managing-
181 * projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the
182 * queue's location. The list of available locations can be obtained by calling
183 * ListLocations. For more information, see
184 * https://cloud.google.com/about/locations/. * `QUEUE_ID` can contain letters
185 * ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100
186 * characters.
187 * @param Queue $postBody
188 * @param array $optParams Optional parameters.
189 *
190 * @opt_param string updateMask A mask used to specify which fields of the queue
191 * are being updated. If empty, then all fields will be updated.
192 * @return Queue
193 * @throws \Google\Service\Exception
194 */
195 public function patch($name, Queue $postBody, $optParams = [])
196 {
197 $params = ['name' => $name, 'postBody' => $postBody];
198 $params = array_merge($params, $optParams);
199 return $this->call('patch', [$params], Queue::class);
200 }
201 /**
202 * Pauses the queue. If a queue is paused then the system will stop dispatching
203 * tasks until the queue is resumed via ResumeQueue. Tasks can still be added
204 * when the queue is paused. A queue is paused if its state is PAUSED.
205 * (queues.pause)
206 *
207 * @param string $name Required. The queue name. For example:
208 * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
209 * @param PauseQueueRequest $postBody
210 * @param array $optParams Optional parameters.
211 * @return Queue
212 * @throws \Google\Service\Exception
213 */
214 public function pause($name, PauseQueueRequest $postBody, $optParams = [])
215 {
216 $params = ['name' => $name, 'postBody' => $postBody];
217 $params = array_merge($params, $optParams);
218 return $this->call('pause', [$params], Queue::class);
219 }
220 /**
221 * Purges a queue by deleting all of its tasks. All tasks created before this
222 * method is called are permanently deleted. Purge operations can take up to one
223 * minute to take effect. Tasks might be dispatched before the purge takes
224 * effect. A purge is irreversible. (queues.purge)
225 *
226 * @param string $name Required. The queue name. For example:
227 * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
228 * @param PurgeQueueRequest $postBody
229 * @param array $optParams Optional parameters.
230 * @return Queue
231 * @throws \Google\Service\Exception
232 */
233 public function purge($name, PurgeQueueRequest $postBody, $optParams = [])
234 {
235 $params = ['name' => $name, 'postBody' => $postBody];
236 $params = array_merge($params, $optParams);
237 return $this->call('purge', [$params], Queue::class);
238 }
239 /**
240 * Resume a queue. This method resumes a queue after it has been PAUSED or
241 * DISABLED. The state of a queue is stored in the queue's state; after calling
242 * this method it will be set to RUNNING. WARNING: Resuming many high-QPS queues
243 * at the same time can lead to target overloading. If you are resuming high-QPS
244 * queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks
245 * Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-
246 * scaling). (queues.resume)
247 *
248 * @param string $name Required. The queue name. For example:
249 * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
250 * @param ResumeQueueRequest $postBody
251 * @param array $optParams Optional parameters.
252 * @return Queue
253 * @throws \Google\Service\Exception
254 */
255 public function resume($name, ResumeQueueRequest $postBody, $optParams = [])
256 {
257 $params = ['name' => $name, 'postBody' => $postBody];
258 $params = array_merge($params, $optParams);
259 return $this->call('resume', [$params], Queue::class);
260 }
261 /**
262 * Sets the access control policy for a Queue. Replaces any existing policy.
263 * Note: The Cloud Console does not check queue-level IAM permissions yet.
264 * Project-level permissions are required to use the Cloud Console.
265 * Authorization requires the following [Google
266 * IAM](https://cloud.google.com/iam) permission on the specified resource
267 * parent: * `cloudtasks.queues.setIamPolicy` (queues.setIamPolicy)
268 *
269 * @param string $resource REQUIRED: The resource for which the policy is being
270 * specified. See [Resource
271 * names](https://cloud.google.com/apis/design/resource_names) for the
272 * appropriate value for this field.
273 * @param SetIamPolicyRequest $postBody
274 * @param array $optParams Optional parameters.
275 * @return Policy
276 * @throws \Google\Service\Exception
277 */
278 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
279 {
280 $params = ['resource' => $resource, 'postBody' => $postBody];
281 $params = array_merge($params, $optParams);
282 return $this->call('setIamPolicy', [$params], Policy::class);
283 }
284 /**
285 * Returns permissions that a caller has on a Queue. If the resource does not
286 * exist, this will return an empty set of permissions, not a NOT_FOUND error.
287 * Note: This operation is designed to be used for building permission-aware UIs
288 * and command-line tools, not for authorization checking. This operation may
289 * "fail open" without warning. (queues.testIamPermissions)
290 *
291 * @param string $resource REQUIRED: The resource for which the policy detail is
292 * being requested. See [Resource
293 * names](https://cloud.google.com/apis/design/resource_names) for the
294 * appropriate value for this field.
295 * @param TestIamPermissionsRequest $postBody
296 * @param array $optParams Optional parameters.
297 * @return TestIamPermissionsResponse
298 * @throws \Google\Service\Exception
299 */
300 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
301 {
302 $params = ['resource' => $resource, 'postBody' => $postBody];
303 $params = array_merge($params, $optParams);
304 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
305 }
306}
307
308// Adding a class alias for backwards compatibility with the previous class name.
309class_alias(ProjectsLocationsQueues::class, 'Google_Service_CloudTasks_Resource_ProjectsLocationsQueues');
Note: See TracBrowser for help on using the repository browser.