google_cloud_tasks_v2/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_rpc;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Request message for
39/// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
40///
41/// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct ListQueuesRequest {
45 /// Required. The location name.
46 /// For example: `projects/PROJECT_ID/locations/LOCATION_ID`
47 pub parent: std::string::String,
48
49 /// `filter` can be used to specify a subset of queues. Any
50 /// [Queue][google.cloud.tasks.v2.Queue] field can be used as a filter and
51 /// several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
52 /// filter syntax is the same as described in [Stackdriver's Advanced Logs
53 /// Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
54 ///
55 /// Sample filter "state: PAUSED".
56 ///
57 /// Note that using filters might cause fewer queues than the
58 /// requested page_size to be returned.
59 ///
60 /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
61 pub filter: std::string::String,
62
63 /// Requested page size.
64 ///
65 /// The maximum page size is 9800. If unspecified, the page size will
66 /// be the maximum. Fewer queues than requested might be returned,
67 /// even if more queues exist; use the
68 /// [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
69 /// in the response to determine if more queues exist.
70 ///
71 /// [google.cloud.tasks.v2.ListQueuesResponse.next_page_token]: crate::model::ListQueuesResponse::next_page_token
72 pub page_size: i32,
73
74 /// A token identifying the page of results to return.
75 ///
76 /// To request the first page results, page_token must be empty. To
77 /// request the next page of results, page_token must be the value of
78 /// [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
79 /// returned from the previous call to
80 /// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] method. It is an
81 /// error to switch the value of the
82 /// [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating
83 /// through pages.
84 ///
85 /// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
86 /// [google.cloud.tasks.v2.ListQueuesRequest.filter]: crate::model::ListQueuesRequest::filter
87 /// [google.cloud.tasks.v2.ListQueuesResponse.next_page_token]: crate::model::ListQueuesResponse::next_page_token
88 pub page_token: std::string::String,
89
90 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
91}
92
93impl ListQueuesRequest {
94 /// Creates a new default instance.
95 pub fn new() -> Self {
96 std::default::Default::default()
97 }
98
99 /// Sets the value of [parent][crate::model::ListQueuesRequest::parent].
100 ///
101 /// # Example
102 /// ```ignore,no_run
103 /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
104 /// let x = ListQueuesRequest::new().set_parent("example");
105 /// ```
106 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
107 self.parent = v.into();
108 self
109 }
110
111 /// Sets the value of [filter][crate::model::ListQueuesRequest::filter].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
116 /// let x = ListQueuesRequest::new().set_filter("example");
117 /// ```
118 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
119 self.filter = v.into();
120 self
121 }
122
123 /// Sets the value of [page_size][crate::model::ListQueuesRequest::page_size].
124 ///
125 /// # Example
126 /// ```ignore,no_run
127 /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
128 /// let x = ListQueuesRequest::new().set_page_size(42);
129 /// ```
130 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
131 self.page_size = v.into();
132 self
133 }
134
135 /// Sets the value of [page_token][crate::model::ListQueuesRequest::page_token].
136 ///
137 /// # Example
138 /// ```ignore,no_run
139 /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
140 /// let x = ListQueuesRequest::new().set_page_token("example");
141 /// ```
142 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
143 self.page_token = v.into();
144 self
145 }
146}
147
148impl wkt::message::Message for ListQueuesRequest {
149 fn typename() -> &'static str {
150 "type.googleapis.com/google.cloud.tasks.v2.ListQueuesRequest"
151 }
152}
153
154/// Response message for
155/// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
156///
157/// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
158#[derive(Clone, Default, PartialEq)]
159#[non_exhaustive]
160pub struct ListQueuesResponse {
161 /// The list of queues.
162 pub queues: std::vec::Vec<crate::model::Queue>,
163
164 /// A token to retrieve next page of results.
165 ///
166 /// To return the next page of results, call
167 /// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] with this value
168 /// as the [page_token][google.cloud.tasks.v2.ListQueuesRequest.page_token].
169 ///
170 /// If the next_page_token is empty, there are no more results.
171 ///
172 /// The page token is valid for only 2 hours.
173 ///
174 /// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
175 /// [google.cloud.tasks.v2.ListQueuesRequest.page_token]: crate::model::ListQueuesRequest::page_token
176 pub next_page_token: std::string::String,
177
178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
179}
180
181impl ListQueuesResponse {
182 /// Creates a new default instance.
183 pub fn new() -> Self {
184 std::default::Default::default()
185 }
186
187 /// Sets the value of [queues][crate::model::ListQueuesResponse::queues].
188 ///
189 /// # Example
190 /// ```ignore,no_run
191 /// # use google_cloud_tasks_v2::model::ListQueuesResponse;
192 /// use google_cloud_tasks_v2::model::Queue;
193 /// let x = ListQueuesResponse::new()
194 /// .set_queues([
195 /// Queue::default()/* use setters */,
196 /// Queue::default()/* use (different) setters */,
197 /// ]);
198 /// ```
199 pub fn set_queues<T, V>(mut self, v: T) -> Self
200 where
201 T: std::iter::IntoIterator<Item = V>,
202 V: std::convert::Into<crate::model::Queue>,
203 {
204 use std::iter::Iterator;
205 self.queues = v.into_iter().map(|i| i.into()).collect();
206 self
207 }
208
209 /// Sets the value of [next_page_token][crate::model::ListQueuesResponse::next_page_token].
210 ///
211 /// # Example
212 /// ```ignore,no_run
213 /// # use google_cloud_tasks_v2::model::ListQueuesResponse;
214 /// let x = ListQueuesResponse::new().set_next_page_token("example");
215 /// ```
216 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
217 self.next_page_token = v.into();
218 self
219 }
220}
221
222impl wkt::message::Message for ListQueuesResponse {
223 fn typename() -> &'static str {
224 "type.googleapis.com/google.cloud.tasks.v2.ListQueuesResponse"
225 }
226}
227
228#[doc(hidden)]
229impl google_cloud_gax::paginator::internal::PageableResponse for ListQueuesResponse {
230 type PageItem = crate::model::Queue;
231
232 fn items(self) -> std::vec::Vec<Self::PageItem> {
233 self.queues
234 }
235
236 fn next_page_token(&self) -> std::string::String {
237 use std::clone::Clone;
238 self.next_page_token.clone()
239 }
240}
241
242/// Request message for [GetQueue][google.cloud.tasks.v2.CloudTasks.GetQueue].
243///
244/// [google.cloud.tasks.v2.CloudTasks.GetQueue]: crate::client::CloudTasks::get_queue
245#[derive(Clone, Default, PartialEq)]
246#[non_exhaustive]
247pub struct GetQueueRequest {
248 /// Required. The resource name of the queue. For example:
249 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
250 pub name: std::string::String,
251
252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
253}
254
255impl GetQueueRequest {
256 /// Creates a new default instance.
257 pub fn new() -> Self {
258 std::default::Default::default()
259 }
260
261 /// Sets the value of [name][crate::model::GetQueueRequest::name].
262 ///
263 /// # Example
264 /// ```ignore,no_run
265 /// # use google_cloud_tasks_v2::model::GetQueueRequest;
266 /// let x = GetQueueRequest::new().set_name("example");
267 /// ```
268 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
269 self.name = v.into();
270 self
271 }
272}
273
274impl wkt::message::Message for GetQueueRequest {
275 fn typename() -> &'static str {
276 "type.googleapis.com/google.cloud.tasks.v2.GetQueueRequest"
277 }
278}
279
280/// Request message for
281/// [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue].
282///
283/// [google.cloud.tasks.v2.CloudTasks.CreateQueue]: crate::client::CloudTasks::create_queue
284#[derive(Clone, Default, PartialEq)]
285#[non_exhaustive]
286pub struct CreateQueueRequest {
287 /// Required. The location name in which the queue will be created.
288 /// For example: `projects/PROJECT_ID/locations/LOCATION_ID`
289 ///
290 /// The list of allowed locations can be obtained by calling Cloud
291 /// Tasks' implementation of
292 /// [ListLocations][google.cloud.location.Locations.ListLocations].
293 pub parent: std::string::String,
294
295 /// Required. The queue to create.
296 ///
297 /// [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an
298 /// existing queue.
299 ///
300 /// [google.cloud.tasks.v2.Queue.name]: crate::model::Queue::name
301 pub queue: std::option::Option<crate::model::Queue>,
302
303 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
304}
305
306impl CreateQueueRequest {
307 /// Creates a new default instance.
308 pub fn new() -> Self {
309 std::default::Default::default()
310 }
311
312 /// Sets the value of [parent][crate::model::CreateQueueRequest::parent].
313 ///
314 /// # Example
315 /// ```ignore,no_run
316 /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
317 /// let x = CreateQueueRequest::new().set_parent("example");
318 /// ```
319 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
320 self.parent = v.into();
321 self
322 }
323
324 /// Sets the value of [queue][crate::model::CreateQueueRequest::queue].
325 ///
326 /// # Example
327 /// ```ignore,no_run
328 /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
329 /// use google_cloud_tasks_v2::model::Queue;
330 /// let x = CreateQueueRequest::new().set_queue(Queue::default()/* use setters */);
331 /// ```
332 pub fn set_queue<T>(mut self, v: T) -> Self
333 where
334 T: std::convert::Into<crate::model::Queue>,
335 {
336 self.queue = std::option::Option::Some(v.into());
337 self
338 }
339
340 /// Sets or clears the value of [queue][crate::model::CreateQueueRequest::queue].
341 ///
342 /// # Example
343 /// ```ignore,no_run
344 /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
345 /// use google_cloud_tasks_v2::model::Queue;
346 /// let x = CreateQueueRequest::new().set_or_clear_queue(Some(Queue::default()/* use setters */));
347 /// let x = CreateQueueRequest::new().set_or_clear_queue(None::<Queue>);
348 /// ```
349 pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
350 where
351 T: std::convert::Into<crate::model::Queue>,
352 {
353 self.queue = v.map(|x| x.into());
354 self
355 }
356}
357
358impl wkt::message::Message for CreateQueueRequest {
359 fn typename() -> &'static str {
360 "type.googleapis.com/google.cloud.tasks.v2.CreateQueueRequest"
361 }
362}
363
364/// Request message for
365/// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue].
366///
367/// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
368#[derive(Clone, Default, PartialEq)]
369#[non_exhaustive]
370pub struct UpdateQueueRequest {
371 /// Required. The queue to create or update.
372 ///
373 /// The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified.
374 ///
375 /// Output only fields cannot be modified using UpdateQueue.
376 /// Any value specified for an output only field will be ignored.
377 /// The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed.
378 ///
379 /// [google.cloud.tasks.v2.Queue.name]: crate::model::Queue::name
380 pub queue: std::option::Option<crate::model::Queue>,
381
382 /// A mask used to specify which fields of the queue are being updated.
383 ///
384 /// If empty, then all fields will be updated.
385 pub update_mask: std::option::Option<wkt::FieldMask>,
386
387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
388}
389
390impl UpdateQueueRequest {
391 /// Creates a new default instance.
392 pub fn new() -> Self {
393 std::default::Default::default()
394 }
395
396 /// Sets the value of [queue][crate::model::UpdateQueueRequest::queue].
397 ///
398 /// # Example
399 /// ```ignore,no_run
400 /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
401 /// use google_cloud_tasks_v2::model::Queue;
402 /// let x = UpdateQueueRequest::new().set_queue(Queue::default()/* use setters */);
403 /// ```
404 pub fn set_queue<T>(mut self, v: T) -> Self
405 where
406 T: std::convert::Into<crate::model::Queue>,
407 {
408 self.queue = std::option::Option::Some(v.into());
409 self
410 }
411
412 /// Sets or clears the value of [queue][crate::model::UpdateQueueRequest::queue].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
417 /// use google_cloud_tasks_v2::model::Queue;
418 /// let x = UpdateQueueRequest::new().set_or_clear_queue(Some(Queue::default()/* use setters */));
419 /// let x = UpdateQueueRequest::new().set_or_clear_queue(None::<Queue>);
420 /// ```
421 pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
422 where
423 T: std::convert::Into<crate::model::Queue>,
424 {
425 self.queue = v.map(|x| x.into());
426 self
427 }
428
429 /// Sets the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
430 ///
431 /// # Example
432 /// ```ignore,no_run
433 /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
434 /// use wkt::FieldMask;
435 /// let x = UpdateQueueRequest::new().set_update_mask(FieldMask::default()/* use setters */);
436 /// ```
437 pub fn set_update_mask<T>(mut self, v: T) -> Self
438 where
439 T: std::convert::Into<wkt::FieldMask>,
440 {
441 self.update_mask = std::option::Option::Some(v.into());
442 self
443 }
444
445 /// Sets or clears the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
446 ///
447 /// # Example
448 /// ```ignore,no_run
449 /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
450 /// use wkt::FieldMask;
451 /// let x = UpdateQueueRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
452 /// let x = UpdateQueueRequest::new().set_or_clear_update_mask(None::<FieldMask>);
453 /// ```
454 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
455 where
456 T: std::convert::Into<wkt::FieldMask>,
457 {
458 self.update_mask = v.map(|x| x.into());
459 self
460 }
461}
462
463impl wkt::message::Message for UpdateQueueRequest {
464 fn typename() -> &'static str {
465 "type.googleapis.com/google.cloud.tasks.v2.UpdateQueueRequest"
466 }
467}
468
469/// Request message for
470/// [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue].
471///
472/// [google.cloud.tasks.v2.CloudTasks.DeleteQueue]: crate::client::CloudTasks::delete_queue
473#[derive(Clone, Default, PartialEq)]
474#[non_exhaustive]
475pub struct DeleteQueueRequest {
476 /// Required. The queue name. For example:
477 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
478 pub name: std::string::String,
479
480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
481}
482
483impl DeleteQueueRequest {
484 /// Creates a new default instance.
485 pub fn new() -> Self {
486 std::default::Default::default()
487 }
488
489 /// Sets the value of [name][crate::model::DeleteQueueRequest::name].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_tasks_v2::model::DeleteQueueRequest;
494 /// let x = DeleteQueueRequest::new().set_name("example");
495 /// ```
496 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
497 self.name = v.into();
498 self
499 }
500}
501
502impl wkt::message::Message for DeleteQueueRequest {
503 fn typename() -> &'static str {
504 "type.googleapis.com/google.cloud.tasks.v2.DeleteQueueRequest"
505 }
506}
507
508/// Request message for
509/// [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue].
510///
511/// [google.cloud.tasks.v2.CloudTasks.PurgeQueue]: crate::client::CloudTasks::purge_queue
512#[derive(Clone, Default, PartialEq)]
513#[non_exhaustive]
514pub struct PurgeQueueRequest {
515 /// Required. The queue name. For example:
516 /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
517 pub name: std::string::String,
518
519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
520}
521
522impl PurgeQueueRequest {
523 /// Creates a new default instance.
524 pub fn new() -> Self {
525 std::default::Default::default()
526 }
527
528 /// Sets the value of [name][crate::model::PurgeQueueRequest::name].
529 ///
530 /// # Example
531 /// ```ignore,no_run
532 /// # use google_cloud_tasks_v2::model::PurgeQueueRequest;
533 /// let x = PurgeQueueRequest::new().set_name("example");
534 /// ```
535 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
536 self.name = v.into();
537 self
538 }
539}
540
541impl wkt::message::Message for PurgeQueueRequest {
542 fn typename() -> &'static str {
543 "type.googleapis.com/google.cloud.tasks.v2.PurgeQueueRequest"
544 }
545}
546
547/// Request message for
548/// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue].
549///
550/// [google.cloud.tasks.v2.CloudTasks.PauseQueue]: crate::client::CloudTasks::pause_queue
551#[derive(Clone, Default, PartialEq)]
552#[non_exhaustive]
553pub struct PauseQueueRequest {
554 /// Required. The queue name. For example:
555 /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
556 pub name: std::string::String,
557
558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
559}
560
561impl PauseQueueRequest {
562 /// Creates a new default instance.
563 pub fn new() -> Self {
564 std::default::Default::default()
565 }
566
567 /// Sets the value of [name][crate::model::PauseQueueRequest::name].
568 ///
569 /// # Example
570 /// ```ignore,no_run
571 /// # use google_cloud_tasks_v2::model::PauseQueueRequest;
572 /// let x = PauseQueueRequest::new().set_name("example");
573 /// ```
574 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
575 self.name = v.into();
576 self
577 }
578}
579
580impl wkt::message::Message for PauseQueueRequest {
581 fn typename() -> &'static str {
582 "type.googleapis.com/google.cloud.tasks.v2.PauseQueueRequest"
583 }
584}
585
586/// Request message for
587/// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue].
588///
589/// [google.cloud.tasks.v2.CloudTasks.ResumeQueue]: crate::client::CloudTasks::resume_queue
590#[derive(Clone, Default, PartialEq)]
591#[non_exhaustive]
592pub struct ResumeQueueRequest {
593 /// Required. The queue name. For example:
594 /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
595 pub name: std::string::String,
596
597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
598}
599
600impl ResumeQueueRequest {
601 /// Creates a new default instance.
602 pub fn new() -> Self {
603 std::default::Default::default()
604 }
605
606 /// Sets the value of [name][crate::model::ResumeQueueRequest::name].
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_cloud_tasks_v2::model::ResumeQueueRequest;
611 /// let x = ResumeQueueRequest::new().set_name("example");
612 /// ```
613 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
614 self.name = v.into();
615 self
616 }
617}
618
619impl wkt::message::Message for ResumeQueueRequest {
620 fn typename() -> &'static str {
621 "type.googleapis.com/google.cloud.tasks.v2.ResumeQueueRequest"
622 }
623}
624
625/// Request message for listing tasks using
626/// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
627///
628/// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
629#[derive(Clone, Default, PartialEq)]
630#[non_exhaustive]
631pub struct ListTasksRequest {
632 /// Required. The queue name. For example:
633 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
634 pub parent: std::string::String,
635
636 /// The response_view specifies which subset of the
637 /// [Task][google.cloud.tasks.v2.Task] will be returned.
638 ///
639 /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
640 /// not all information is retrieved by default because some data, such as
641 /// payloads, might be desirable to return only when needed because
642 /// of its large size or because of the sensitivity of data that it
643 /// contains.
644 ///
645 /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
646 /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
647 /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
648 ///
649 /// [google.cloud.tasks.v2.Task]: crate::model::Task
650 /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
651 /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
652 pub response_view: crate::model::task::View,
653
654 /// Maximum page size.
655 ///
656 /// Fewer tasks than requested might be returned, even if more tasks exist; use
657 /// [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
658 /// in the response to determine if more tasks exist.
659 ///
660 /// The maximum page size is 1000. If unspecified, the page size will be the
661 /// maximum.
662 ///
663 /// [google.cloud.tasks.v2.ListTasksResponse.next_page_token]: crate::model::ListTasksResponse::next_page_token
664 pub page_size: i32,
665
666 /// A token identifying the page of results to return.
667 ///
668 /// To request the first page results, page_token must be empty. To
669 /// request the next page of results, page_token must be the value of
670 /// [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
671 /// returned from the previous call to
672 /// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] method.
673 ///
674 /// The page token is valid for only 2 hours.
675 ///
676 /// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
677 /// [google.cloud.tasks.v2.ListTasksResponse.next_page_token]: crate::model::ListTasksResponse::next_page_token
678 pub page_token: std::string::String,
679
680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
681}
682
683impl ListTasksRequest {
684 /// Creates a new default instance.
685 pub fn new() -> Self {
686 std::default::Default::default()
687 }
688
689 /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_tasks_v2::model::ListTasksRequest;
694 /// let x = ListTasksRequest::new().set_parent("example");
695 /// ```
696 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
697 self.parent = v.into();
698 self
699 }
700
701 /// Sets the value of [response_view][crate::model::ListTasksRequest::response_view].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_tasks_v2::model::ListTasksRequest;
706 /// use google_cloud_tasks_v2::model::task::View;
707 /// let x0 = ListTasksRequest::new().set_response_view(View::Basic);
708 /// let x1 = ListTasksRequest::new().set_response_view(View::Full);
709 /// ```
710 pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
711 mut self,
712 v: T,
713 ) -> Self {
714 self.response_view = v.into();
715 self
716 }
717
718 /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
719 ///
720 /// # Example
721 /// ```ignore,no_run
722 /// # use google_cloud_tasks_v2::model::ListTasksRequest;
723 /// let x = ListTasksRequest::new().set_page_size(42);
724 /// ```
725 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
726 self.page_size = v.into();
727 self
728 }
729
730 /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
731 ///
732 /// # Example
733 /// ```ignore,no_run
734 /// # use google_cloud_tasks_v2::model::ListTasksRequest;
735 /// let x = ListTasksRequest::new().set_page_token("example");
736 /// ```
737 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
738 self.page_token = v.into();
739 self
740 }
741}
742
743impl wkt::message::Message for ListTasksRequest {
744 fn typename() -> &'static str {
745 "type.googleapis.com/google.cloud.tasks.v2.ListTasksRequest"
746 }
747}
748
749/// Response message for listing tasks using
750/// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
751///
752/// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
753#[derive(Clone, Default, PartialEq)]
754#[non_exhaustive]
755pub struct ListTasksResponse {
756 /// The list of tasks.
757 pub tasks: std::vec::Vec<crate::model::Task>,
758
759 /// A token to retrieve next page of results.
760 ///
761 /// To return the next page of results, call
762 /// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] with this value as
763 /// the [page_token][google.cloud.tasks.v2.ListTasksRequest.page_token].
764 ///
765 /// If the next_page_token is empty, there are no more results.
766 ///
767 /// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
768 /// [google.cloud.tasks.v2.ListTasksRequest.page_token]: crate::model::ListTasksRequest::page_token
769 pub next_page_token: std::string::String,
770
771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
772}
773
774impl ListTasksResponse {
775 /// Creates a new default instance.
776 pub fn new() -> Self {
777 std::default::Default::default()
778 }
779
780 /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
781 ///
782 /// # Example
783 /// ```ignore,no_run
784 /// # use google_cloud_tasks_v2::model::ListTasksResponse;
785 /// use google_cloud_tasks_v2::model::Task;
786 /// let x = ListTasksResponse::new()
787 /// .set_tasks([
788 /// Task::default()/* use setters */,
789 /// Task::default()/* use (different) setters */,
790 /// ]);
791 /// ```
792 pub fn set_tasks<T, V>(mut self, v: T) -> Self
793 where
794 T: std::iter::IntoIterator<Item = V>,
795 V: std::convert::Into<crate::model::Task>,
796 {
797 use std::iter::Iterator;
798 self.tasks = v.into_iter().map(|i| i.into()).collect();
799 self
800 }
801
802 /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
803 ///
804 /// # Example
805 /// ```ignore,no_run
806 /// # use google_cloud_tasks_v2::model::ListTasksResponse;
807 /// let x = ListTasksResponse::new().set_next_page_token("example");
808 /// ```
809 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
810 self.next_page_token = v.into();
811 self
812 }
813}
814
815impl wkt::message::Message for ListTasksResponse {
816 fn typename() -> &'static str {
817 "type.googleapis.com/google.cloud.tasks.v2.ListTasksResponse"
818 }
819}
820
821#[doc(hidden)]
822impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
823 type PageItem = crate::model::Task;
824
825 fn items(self) -> std::vec::Vec<Self::PageItem> {
826 self.tasks
827 }
828
829 fn next_page_token(&self) -> std::string::String {
830 use std::clone::Clone;
831 self.next_page_token.clone()
832 }
833}
834
835/// Request message for getting a task using
836/// [GetTask][google.cloud.tasks.v2.CloudTasks.GetTask].
837///
838/// [google.cloud.tasks.v2.CloudTasks.GetTask]: crate::client::CloudTasks::get_task
839#[derive(Clone, Default, PartialEq)]
840#[non_exhaustive]
841pub struct GetTaskRequest {
842 /// Required. The task name. For example:
843 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
844 pub name: std::string::String,
845
846 /// The response_view specifies which subset of the
847 /// [Task][google.cloud.tasks.v2.Task] will be returned.
848 ///
849 /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
850 /// not all information is retrieved by default because some data, such as
851 /// payloads, might be desirable to return only when needed because
852 /// of its large size or because of the sensitivity of data that it
853 /// contains.
854 ///
855 /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
856 /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
857 /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
858 ///
859 /// [google.cloud.tasks.v2.Task]: crate::model::Task
860 /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
861 /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
862 pub response_view: crate::model::task::View,
863
864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
865}
866
867impl GetTaskRequest {
868 /// Creates a new default instance.
869 pub fn new() -> Self {
870 std::default::Default::default()
871 }
872
873 /// Sets the value of [name][crate::model::GetTaskRequest::name].
874 ///
875 /// # Example
876 /// ```ignore,no_run
877 /// # use google_cloud_tasks_v2::model::GetTaskRequest;
878 /// let x = GetTaskRequest::new().set_name("example");
879 /// ```
880 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
881 self.name = v.into();
882 self
883 }
884
885 /// Sets the value of [response_view][crate::model::GetTaskRequest::response_view].
886 ///
887 /// # Example
888 /// ```ignore,no_run
889 /// # use google_cloud_tasks_v2::model::GetTaskRequest;
890 /// use google_cloud_tasks_v2::model::task::View;
891 /// let x0 = GetTaskRequest::new().set_response_view(View::Basic);
892 /// let x1 = GetTaskRequest::new().set_response_view(View::Full);
893 /// ```
894 pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
895 mut self,
896 v: T,
897 ) -> Self {
898 self.response_view = v.into();
899 self
900 }
901}
902
903impl wkt::message::Message for GetTaskRequest {
904 fn typename() -> &'static str {
905 "type.googleapis.com/google.cloud.tasks.v2.GetTaskRequest"
906 }
907}
908
909/// Request message for
910/// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
911///
912/// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
913#[derive(Clone, Default, PartialEq)]
914#[non_exhaustive]
915pub struct CreateTaskRequest {
916 /// Required. The queue name. For example:
917 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
918 ///
919 /// The queue must already exist.
920 pub parent: std::string::String,
921
922 /// Required. The task to add.
923 ///
924 /// Task names have the following format:
925 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
926 /// The user can optionally specify a task
927 /// [name][google.cloud.tasks.v2.Task.name]. If a name is not specified then
928 /// the system will generate a random unique task id, which will be set in the
929 /// task returned in the [response][google.cloud.tasks.v2.Task.name].
930 ///
931 /// If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or
932 /// is in the past then Cloud Tasks will set it to the current time.
933 ///
934 /// Task De-duplication:
935 ///
936 /// Explicitly specifying a task ID enables task de-duplication. If
937 /// a task's ID is identical to that of an existing task or a task
938 /// that was deleted or executed recently then the call will fail
939 /// with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
940 /// If the task's queue was created using Cloud Tasks, then another task with
941 /// the same name can't be created for ~1hour after the original task was
942 /// deleted or executed. If the task's queue was created using queue.yaml or
943 /// queue.xml, then another task with the same name can't be created
944 /// for ~9days after the original task was deleted or executed.
945 ///
946 /// Because there is an extra lookup cost to identify duplicate task
947 /// names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]
948 /// calls have significantly increased latency. Using hashed strings for the
949 /// task id or for the prefix of the task id is recommended. Choosing task ids
950 /// that are sequential or have sequential prefixes, for example using a
951 /// timestamp, causes an increase in latency and error rates in all
952 /// task commands. The infrastructure relies on an approximately
953 /// uniform distribution of task ids to store and serve tasks
954 /// efficiently.
955 ///
956 /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
957 /// [google.cloud.tasks.v2.Task.name]: crate::model::Task::name
958 /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
959 pub task: std::option::Option<crate::model::Task>,
960
961 /// The response_view specifies which subset of the
962 /// [Task][google.cloud.tasks.v2.Task] will be returned.
963 ///
964 /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
965 /// not all information is retrieved by default because some data, such as
966 /// payloads, might be desirable to return only when needed because
967 /// of its large size or because of the sensitivity of data that it
968 /// contains.
969 ///
970 /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
971 /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
972 /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
973 ///
974 /// [google.cloud.tasks.v2.Task]: crate::model::Task
975 /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
976 /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
977 pub response_view: crate::model::task::View,
978
979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
980}
981
982impl CreateTaskRequest {
983 /// Creates a new default instance.
984 pub fn new() -> Self {
985 std::default::Default::default()
986 }
987
988 /// Sets the value of [parent][crate::model::CreateTaskRequest::parent].
989 ///
990 /// # Example
991 /// ```ignore,no_run
992 /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
993 /// let x = CreateTaskRequest::new().set_parent("example");
994 /// ```
995 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
996 self.parent = v.into();
997 self
998 }
999
1000 /// Sets the value of [task][crate::model::CreateTaskRequest::task].
1001 ///
1002 /// # Example
1003 /// ```ignore,no_run
1004 /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1005 /// use google_cloud_tasks_v2::model::Task;
1006 /// let x = CreateTaskRequest::new().set_task(Task::default()/* use setters */);
1007 /// ```
1008 pub fn set_task<T>(mut self, v: T) -> Self
1009 where
1010 T: std::convert::Into<crate::model::Task>,
1011 {
1012 self.task = std::option::Option::Some(v.into());
1013 self
1014 }
1015
1016 /// Sets or clears the value of [task][crate::model::CreateTaskRequest::task].
1017 ///
1018 /// # Example
1019 /// ```ignore,no_run
1020 /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1021 /// use google_cloud_tasks_v2::model::Task;
1022 /// let x = CreateTaskRequest::new().set_or_clear_task(Some(Task::default()/* use setters */));
1023 /// let x = CreateTaskRequest::new().set_or_clear_task(None::<Task>);
1024 /// ```
1025 pub fn set_or_clear_task<T>(mut self, v: std::option::Option<T>) -> Self
1026 where
1027 T: std::convert::Into<crate::model::Task>,
1028 {
1029 self.task = v.map(|x| x.into());
1030 self
1031 }
1032
1033 /// Sets the value of [response_view][crate::model::CreateTaskRequest::response_view].
1034 ///
1035 /// # Example
1036 /// ```ignore,no_run
1037 /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1038 /// use google_cloud_tasks_v2::model::task::View;
1039 /// let x0 = CreateTaskRequest::new().set_response_view(View::Basic);
1040 /// let x1 = CreateTaskRequest::new().set_response_view(View::Full);
1041 /// ```
1042 pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
1043 mut self,
1044 v: T,
1045 ) -> Self {
1046 self.response_view = v.into();
1047 self
1048 }
1049}
1050
1051impl wkt::message::Message for CreateTaskRequest {
1052 fn typename() -> &'static str {
1053 "type.googleapis.com/google.cloud.tasks.v2.CreateTaskRequest"
1054 }
1055}
1056
1057/// Request message for deleting a task using
1058/// [DeleteTask][google.cloud.tasks.v2.CloudTasks.DeleteTask].
1059///
1060/// [google.cloud.tasks.v2.CloudTasks.DeleteTask]: crate::client::CloudTasks::delete_task
1061#[derive(Clone, Default, PartialEq)]
1062#[non_exhaustive]
1063pub struct DeleteTaskRequest {
1064 /// Required. The task name. For example:
1065 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1066 pub name: std::string::String,
1067
1068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1069}
1070
1071impl DeleteTaskRequest {
1072 /// Creates a new default instance.
1073 pub fn new() -> Self {
1074 std::default::Default::default()
1075 }
1076
1077 /// Sets the value of [name][crate::model::DeleteTaskRequest::name].
1078 ///
1079 /// # Example
1080 /// ```ignore,no_run
1081 /// # use google_cloud_tasks_v2::model::DeleteTaskRequest;
1082 /// let x = DeleteTaskRequest::new().set_name("example");
1083 /// ```
1084 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1085 self.name = v.into();
1086 self
1087 }
1088}
1089
1090impl wkt::message::Message for DeleteTaskRequest {
1091 fn typename() -> &'static str {
1092 "type.googleapis.com/google.cloud.tasks.v2.DeleteTaskRequest"
1093 }
1094}
1095
1096/// Request message for forcing a task to run now using
1097/// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask].
1098///
1099/// [google.cloud.tasks.v2.CloudTasks.RunTask]: crate::client::CloudTasks::run_task
1100#[derive(Clone, Default, PartialEq)]
1101#[non_exhaustive]
1102pub struct RunTaskRequest {
1103 /// Required. The task name. For example:
1104 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1105 pub name: std::string::String,
1106
1107 /// The response_view specifies which subset of the
1108 /// [Task][google.cloud.tasks.v2.Task] will be returned.
1109 ///
1110 /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
1111 /// not all information is retrieved by default because some data, such as
1112 /// payloads, might be desirable to return only when needed because
1113 /// of its large size or because of the sensitivity of data that it
1114 /// contains.
1115 ///
1116 /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
1117 /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1118 /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
1119 ///
1120 /// [google.cloud.tasks.v2.Task]: crate::model::Task
1121 /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
1122 /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
1123 pub response_view: crate::model::task::View,
1124
1125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1126}
1127
1128impl RunTaskRequest {
1129 /// Creates a new default instance.
1130 pub fn new() -> Self {
1131 std::default::Default::default()
1132 }
1133
1134 /// Sets the value of [name][crate::model::RunTaskRequest::name].
1135 ///
1136 /// # Example
1137 /// ```ignore,no_run
1138 /// # use google_cloud_tasks_v2::model::RunTaskRequest;
1139 /// let x = RunTaskRequest::new().set_name("example");
1140 /// ```
1141 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1142 self.name = v.into();
1143 self
1144 }
1145
1146 /// Sets the value of [response_view][crate::model::RunTaskRequest::response_view].
1147 ///
1148 /// # Example
1149 /// ```ignore,no_run
1150 /// # use google_cloud_tasks_v2::model::RunTaskRequest;
1151 /// use google_cloud_tasks_v2::model::task::View;
1152 /// let x0 = RunTaskRequest::new().set_response_view(View::Basic);
1153 /// let x1 = RunTaskRequest::new().set_response_view(View::Full);
1154 /// ```
1155 pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
1156 mut self,
1157 v: T,
1158 ) -> Self {
1159 self.response_view = v.into();
1160 self
1161 }
1162}
1163
1164impl wkt::message::Message for RunTaskRequest {
1165 fn typename() -> &'static str {
1166 "type.googleapis.com/google.cloud.tasks.v2.RunTaskRequest"
1167 }
1168}
1169
1170/// A queue is a container of related tasks. Queues are configured to manage
1171/// how those tasks are dispatched. Configurable properties include rate limits,
1172/// retry options, queue types, and others.
1173#[derive(Clone, Default, PartialEq)]
1174#[non_exhaustive]
1175pub struct Queue {
1176 /// Caller-specified and required in
1177 /// [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue], after which it
1178 /// becomes output only.
1179 ///
1180 /// The queue name.
1181 ///
1182 /// The queue name must have the following format:
1183 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1184 ///
1185 /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
1186 /// hyphens (-), colons (:), or periods (.).
1187 /// For more information, see
1188 /// [Identifying
1189 /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
1190 /// * `LOCATION_ID` is the canonical ID for the queue's location.
1191 /// The list of available locations can be obtained by calling
1192 /// [ListLocations][google.cloud.location.Locations.ListLocations].
1193 /// For more information, see <https://cloud.google.com/about/locations/>.
1194 /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
1195 /// hyphens (-). The maximum length is 100 characters.
1196 ///
1197 /// [google.cloud.tasks.v2.CloudTasks.CreateQueue]: crate::client::CloudTasks::create_queue
1198 pub name: std::string::String,
1199
1200 /// Overrides for
1201 /// [task-level
1202 /// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
1203 /// These settings apply only to
1204 /// [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in this
1205 /// queue. [Http tasks][google.cloud.tasks.v2.HttpRequest] are not affected.
1206 ///
1207 /// If set, `app_engine_routing_override` is used for all
1208 /// [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in the
1209 /// queue, no matter what the setting is for the [task-level
1210 /// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
1211 ///
1212 /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
1213 /// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
1214 /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
1215 pub app_engine_routing_override: std::option::Option<crate::model::AppEngineRouting>,
1216
1217 /// Rate limits for task dispatches.
1218 ///
1219 /// [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] and
1220 /// [retry_config][google.cloud.tasks.v2.Queue.retry_config] are related
1221 /// because they both control task attempts. However they control task attempts
1222 /// in different ways:
1223 ///
1224 /// * [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] controls the total
1225 /// rate of
1226 /// dispatches from a queue (i.e. all traffic dispatched from the
1227 /// queue, regardless of whether the dispatch is from a first
1228 /// attempt or a retry).
1229 /// * [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls what
1230 /// happens to
1231 /// particular a task after its first attempt fails. That is,
1232 /// [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls task
1233 /// retries (the second attempt, third attempt, etc).
1234 ///
1235 /// The queue's actual dispatch rate is the result of:
1236 ///
1237 /// * Number of tasks in the queue
1238 /// * User-specified throttling:
1239 /// [rate_limits][google.cloud.tasks.v2.Queue.rate_limits],
1240 /// [retry_config][google.cloud.tasks.v2.Queue.retry_config], and the
1241 /// [queue's state][google.cloud.tasks.v2.Queue.state].
1242 /// * System throttling due to `429` (Too Many Requests) or `503` (Service
1243 /// Unavailable) responses from the worker, high error rates, or to smooth
1244 /// sudden large traffic spikes.
1245 ///
1246 /// [google.cloud.tasks.v2.Queue.rate_limits]: crate::model::Queue::rate_limits
1247 /// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
1248 /// [google.cloud.tasks.v2.Queue.state]: crate::model::Queue::state
1249 pub rate_limits: std::option::Option<crate::model::RateLimits>,
1250
1251 /// Settings that determine the retry behavior.
1252 ///
1253 /// * For tasks created using Cloud Tasks: the queue-level retry settings
1254 /// apply to all tasks in the queue that were created using Cloud Tasks.
1255 /// Retry settings cannot be set on individual tasks.
1256 /// * For tasks created using the App Engine SDK: the queue-level retry
1257 /// settings apply to all tasks in the queue which do not have retry settings
1258 /// explicitly set on the task and were created by the App Engine SDK. See
1259 /// [App Engine
1260 /// documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks).
1261 pub retry_config: std::option::Option<crate::model::RetryConfig>,
1262
1263 /// Output only. The state of the queue.
1264 ///
1265 /// `state` can only be changed by calling
1266 /// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue],
1267 /// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue], or uploading
1268 /// [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref).
1269 /// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] cannot be used
1270 /// to change `state`.
1271 ///
1272 /// [google.cloud.tasks.v2.CloudTasks.PauseQueue]: crate::client::CloudTasks::pause_queue
1273 /// [google.cloud.tasks.v2.CloudTasks.ResumeQueue]: crate::client::CloudTasks::resume_queue
1274 /// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
1275 pub state: crate::model::queue::State,
1276
1277 /// Output only. The last time this queue was purged.
1278 ///
1279 /// All tasks that were [created][google.cloud.tasks.v2.Task.create_time]
1280 /// before this time were purged.
1281 ///
1282 /// A queue can be purged using
1283 /// [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue], the [App Engine
1284 /// Task Queue SDK, or the Cloud
1285 /// Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue).
1286 ///
1287 /// Purge time will be truncated to the nearest microsecond. Purge
1288 /// time will be unset if the queue has never been purged.
1289 ///
1290 /// [google.cloud.tasks.v2.CloudTasks.PurgeQueue]: crate::client::CloudTasks::purge_queue
1291 /// [google.cloud.tasks.v2.Task.create_time]: crate::model::Task::create_time
1292 pub purge_time: std::option::Option<wkt::Timestamp>,
1293
1294 /// Configuration options for writing logs to
1295 /// [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this
1296 /// field is unset, then no logs are written.
1297 pub stackdriver_logging_config: std::option::Option<crate::model::StackdriverLoggingConfig>,
1298
1299 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1300}
1301
1302impl Queue {
1303 /// Creates a new default instance.
1304 pub fn new() -> Self {
1305 std::default::Default::default()
1306 }
1307
1308 /// Sets the value of [name][crate::model::Queue::name].
1309 ///
1310 /// # Example
1311 /// ```ignore,no_run
1312 /// # use google_cloud_tasks_v2::model::Queue;
1313 /// let x = Queue::new().set_name("example");
1314 /// ```
1315 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1316 self.name = v.into();
1317 self
1318 }
1319
1320 /// Sets the value of [app_engine_routing_override][crate::model::Queue::app_engine_routing_override].
1321 ///
1322 /// # Example
1323 /// ```ignore,no_run
1324 /// # use google_cloud_tasks_v2::model::Queue;
1325 /// use google_cloud_tasks_v2::model::AppEngineRouting;
1326 /// let x = Queue::new().set_app_engine_routing_override(AppEngineRouting::default()/* use setters */);
1327 /// ```
1328 pub fn set_app_engine_routing_override<T>(mut self, v: T) -> Self
1329 where
1330 T: std::convert::Into<crate::model::AppEngineRouting>,
1331 {
1332 self.app_engine_routing_override = std::option::Option::Some(v.into());
1333 self
1334 }
1335
1336 /// Sets or clears the value of [app_engine_routing_override][crate::model::Queue::app_engine_routing_override].
1337 ///
1338 /// # Example
1339 /// ```ignore,no_run
1340 /// # use google_cloud_tasks_v2::model::Queue;
1341 /// use google_cloud_tasks_v2::model::AppEngineRouting;
1342 /// let x = Queue::new().set_or_clear_app_engine_routing_override(Some(AppEngineRouting::default()/* use setters */));
1343 /// let x = Queue::new().set_or_clear_app_engine_routing_override(None::<AppEngineRouting>);
1344 /// ```
1345 pub fn set_or_clear_app_engine_routing_override<T>(mut self, v: std::option::Option<T>) -> Self
1346 where
1347 T: std::convert::Into<crate::model::AppEngineRouting>,
1348 {
1349 self.app_engine_routing_override = v.map(|x| x.into());
1350 self
1351 }
1352
1353 /// Sets the value of [rate_limits][crate::model::Queue::rate_limits].
1354 ///
1355 /// # Example
1356 /// ```ignore,no_run
1357 /// # use google_cloud_tasks_v2::model::Queue;
1358 /// use google_cloud_tasks_v2::model::RateLimits;
1359 /// let x = Queue::new().set_rate_limits(RateLimits::default()/* use setters */);
1360 /// ```
1361 pub fn set_rate_limits<T>(mut self, v: T) -> Self
1362 where
1363 T: std::convert::Into<crate::model::RateLimits>,
1364 {
1365 self.rate_limits = std::option::Option::Some(v.into());
1366 self
1367 }
1368
1369 /// Sets or clears the value of [rate_limits][crate::model::Queue::rate_limits].
1370 ///
1371 /// # Example
1372 /// ```ignore,no_run
1373 /// # use google_cloud_tasks_v2::model::Queue;
1374 /// use google_cloud_tasks_v2::model::RateLimits;
1375 /// let x = Queue::new().set_or_clear_rate_limits(Some(RateLimits::default()/* use setters */));
1376 /// let x = Queue::new().set_or_clear_rate_limits(None::<RateLimits>);
1377 /// ```
1378 pub fn set_or_clear_rate_limits<T>(mut self, v: std::option::Option<T>) -> Self
1379 where
1380 T: std::convert::Into<crate::model::RateLimits>,
1381 {
1382 self.rate_limits = v.map(|x| x.into());
1383 self
1384 }
1385
1386 /// Sets the value of [retry_config][crate::model::Queue::retry_config].
1387 ///
1388 /// # Example
1389 /// ```ignore,no_run
1390 /// # use google_cloud_tasks_v2::model::Queue;
1391 /// use google_cloud_tasks_v2::model::RetryConfig;
1392 /// let x = Queue::new().set_retry_config(RetryConfig::default()/* use setters */);
1393 /// ```
1394 pub fn set_retry_config<T>(mut self, v: T) -> Self
1395 where
1396 T: std::convert::Into<crate::model::RetryConfig>,
1397 {
1398 self.retry_config = std::option::Option::Some(v.into());
1399 self
1400 }
1401
1402 /// Sets or clears the value of [retry_config][crate::model::Queue::retry_config].
1403 ///
1404 /// # Example
1405 /// ```ignore,no_run
1406 /// # use google_cloud_tasks_v2::model::Queue;
1407 /// use google_cloud_tasks_v2::model::RetryConfig;
1408 /// let x = Queue::new().set_or_clear_retry_config(Some(RetryConfig::default()/* use setters */));
1409 /// let x = Queue::new().set_or_clear_retry_config(None::<RetryConfig>);
1410 /// ```
1411 pub fn set_or_clear_retry_config<T>(mut self, v: std::option::Option<T>) -> Self
1412 where
1413 T: std::convert::Into<crate::model::RetryConfig>,
1414 {
1415 self.retry_config = v.map(|x| x.into());
1416 self
1417 }
1418
1419 /// Sets the value of [state][crate::model::Queue::state].
1420 ///
1421 /// # Example
1422 /// ```ignore,no_run
1423 /// # use google_cloud_tasks_v2::model::Queue;
1424 /// use google_cloud_tasks_v2::model::queue::State;
1425 /// let x0 = Queue::new().set_state(State::Running);
1426 /// let x1 = Queue::new().set_state(State::Paused);
1427 /// let x2 = Queue::new().set_state(State::Disabled);
1428 /// ```
1429 pub fn set_state<T: std::convert::Into<crate::model::queue::State>>(mut self, v: T) -> Self {
1430 self.state = v.into();
1431 self
1432 }
1433
1434 /// Sets the value of [purge_time][crate::model::Queue::purge_time].
1435 ///
1436 /// # Example
1437 /// ```ignore,no_run
1438 /// # use google_cloud_tasks_v2::model::Queue;
1439 /// use wkt::Timestamp;
1440 /// let x = Queue::new().set_purge_time(Timestamp::default()/* use setters */);
1441 /// ```
1442 pub fn set_purge_time<T>(mut self, v: T) -> Self
1443 where
1444 T: std::convert::Into<wkt::Timestamp>,
1445 {
1446 self.purge_time = std::option::Option::Some(v.into());
1447 self
1448 }
1449
1450 /// Sets or clears the value of [purge_time][crate::model::Queue::purge_time].
1451 ///
1452 /// # Example
1453 /// ```ignore,no_run
1454 /// # use google_cloud_tasks_v2::model::Queue;
1455 /// use wkt::Timestamp;
1456 /// let x = Queue::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
1457 /// let x = Queue::new().set_or_clear_purge_time(None::<Timestamp>);
1458 /// ```
1459 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
1460 where
1461 T: std::convert::Into<wkt::Timestamp>,
1462 {
1463 self.purge_time = v.map(|x| x.into());
1464 self
1465 }
1466
1467 /// Sets the value of [stackdriver_logging_config][crate::model::Queue::stackdriver_logging_config].
1468 ///
1469 /// # Example
1470 /// ```ignore,no_run
1471 /// # use google_cloud_tasks_v2::model::Queue;
1472 /// use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
1473 /// let x = Queue::new().set_stackdriver_logging_config(StackdriverLoggingConfig::default()/* use setters */);
1474 /// ```
1475 pub fn set_stackdriver_logging_config<T>(mut self, v: T) -> Self
1476 where
1477 T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
1478 {
1479 self.stackdriver_logging_config = std::option::Option::Some(v.into());
1480 self
1481 }
1482
1483 /// Sets or clears the value of [stackdriver_logging_config][crate::model::Queue::stackdriver_logging_config].
1484 ///
1485 /// # Example
1486 /// ```ignore,no_run
1487 /// # use google_cloud_tasks_v2::model::Queue;
1488 /// use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
1489 /// let x = Queue::new().set_or_clear_stackdriver_logging_config(Some(StackdriverLoggingConfig::default()/* use setters */));
1490 /// let x = Queue::new().set_or_clear_stackdriver_logging_config(None::<StackdriverLoggingConfig>);
1491 /// ```
1492 pub fn set_or_clear_stackdriver_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
1493 where
1494 T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
1495 {
1496 self.stackdriver_logging_config = v.map(|x| x.into());
1497 self
1498 }
1499}
1500
1501impl wkt::message::Message for Queue {
1502 fn typename() -> &'static str {
1503 "type.googleapis.com/google.cloud.tasks.v2.Queue"
1504 }
1505}
1506
1507/// Defines additional types related to [Queue].
1508pub mod queue {
1509 #[allow(unused_imports)]
1510 use super::*;
1511
1512 /// State of the queue.
1513 ///
1514 /// # Working with unknown values
1515 ///
1516 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1517 /// additional enum variants at any time. Adding new variants is not considered
1518 /// a breaking change. Applications should write their code in anticipation of:
1519 ///
1520 /// - New values appearing in future releases of the client library, **and**
1521 /// - New values received dynamically, without application changes.
1522 ///
1523 /// Please consult the [Working with enums] section in the user guide for some
1524 /// guidelines.
1525 ///
1526 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1527 #[derive(Clone, Debug, PartialEq)]
1528 #[non_exhaustive]
1529 pub enum State {
1530 /// Unspecified state.
1531 Unspecified,
1532 /// The queue is running. Tasks can be dispatched.
1533 ///
1534 /// If the queue was created using Cloud Tasks and the queue has
1535 /// had no activity (method calls or task dispatches) for 30 days,
1536 /// the queue may take a few minutes to re-activate. Some method
1537 /// calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and
1538 /// tasks may not be dispatched for a few minutes until the queue
1539 /// has been re-activated.
1540 Running,
1541 /// Tasks are paused by the user. If the queue is paused then Cloud
1542 /// Tasks will stop delivering tasks from it, but more tasks can
1543 /// still be added to it by the user.
1544 Paused,
1545 /// The queue is disabled.
1546 ///
1547 /// A queue becomes `DISABLED` when
1548 /// [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref)
1549 /// or
1550 /// [queue.xml](https://cloud.google.com/appengine/docs/standard/java/config/queueref)
1551 /// is uploaded which does not contain the queue. You cannot directly disable
1552 /// a queue.
1553 ///
1554 /// When a queue is disabled, tasks can still be added to a queue
1555 /// but the tasks are not dispatched.
1556 ///
1557 /// To permanently delete this queue and all of its tasks, call
1558 /// [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue].
1559 ///
1560 /// [google.cloud.tasks.v2.CloudTasks.DeleteQueue]: crate::client::CloudTasks::delete_queue
1561 Disabled,
1562 /// If set, the enum was initialized with an unknown value.
1563 ///
1564 /// Applications can examine the value using [State::value] or
1565 /// [State::name].
1566 UnknownValue(state::UnknownValue),
1567 }
1568
1569 #[doc(hidden)]
1570 pub mod state {
1571 #[allow(unused_imports)]
1572 use super::*;
1573 #[derive(Clone, Debug, PartialEq)]
1574 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1575 }
1576
1577 impl State {
1578 /// Gets the enum value.
1579 ///
1580 /// Returns `None` if the enum contains an unknown value deserialized from
1581 /// the string representation of enums.
1582 pub fn value(&self) -> std::option::Option<i32> {
1583 match self {
1584 Self::Unspecified => std::option::Option::Some(0),
1585 Self::Running => std::option::Option::Some(1),
1586 Self::Paused => std::option::Option::Some(2),
1587 Self::Disabled => std::option::Option::Some(3),
1588 Self::UnknownValue(u) => u.0.value(),
1589 }
1590 }
1591
1592 /// Gets the enum value as a string.
1593 ///
1594 /// Returns `None` if the enum contains an unknown value deserialized from
1595 /// the integer representation of enums.
1596 pub fn name(&self) -> std::option::Option<&str> {
1597 match self {
1598 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1599 Self::Running => std::option::Option::Some("RUNNING"),
1600 Self::Paused => std::option::Option::Some("PAUSED"),
1601 Self::Disabled => std::option::Option::Some("DISABLED"),
1602 Self::UnknownValue(u) => u.0.name(),
1603 }
1604 }
1605 }
1606
1607 impl std::default::Default for State {
1608 fn default() -> Self {
1609 use std::convert::From;
1610 Self::from(0)
1611 }
1612 }
1613
1614 impl std::fmt::Display for State {
1615 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1616 wkt::internal::display_enum(f, self.name(), self.value())
1617 }
1618 }
1619
1620 impl std::convert::From<i32> for State {
1621 fn from(value: i32) -> Self {
1622 match value {
1623 0 => Self::Unspecified,
1624 1 => Self::Running,
1625 2 => Self::Paused,
1626 3 => Self::Disabled,
1627 _ => Self::UnknownValue(state::UnknownValue(
1628 wkt::internal::UnknownEnumValue::Integer(value),
1629 )),
1630 }
1631 }
1632 }
1633
1634 impl std::convert::From<&str> for State {
1635 fn from(value: &str) -> Self {
1636 use std::string::ToString;
1637 match value {
1638 "STATE_UNSPECIFIED" => Self::Unspecified,
1639 "RUNNING" => Self::Running,
1640 "PAUSED" => Self::Paused,
1641 "DISABLED" => Self::Disabled,
1642 _ => Self::UnknownValue(state::UnknownValue(
1643 wkt::internal::UnknownEnumValue::String(value.to_string()),
1644 )),
1645 }
1646 }
1647 }
1648
1649 impl serde::ser::Serialize for State {
1650 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1651 where
1652 S: serde::Serializer,
1653 {
1654 match self {
1655 Self::Unspecified => serializer.serialize_i32(0),
1656 Self::Running => serializer.serialize_i32(1),
1657 Self::Paused => serializer.serialize_i32(2),
1658 Self::Disabled => serializer.serialize_i32(3),
1659 Self::UnknownValue(u) => u.0.serialize(serializer),
1660 }
1661 }
1662 }
1663
1664 impl<'de> serde::de::Deserialize<'de> for State {
1665 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1666 where
1667 D: serde::Deserializer<'de>,
1668 {
1669 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1670 ".google.cloud.tasks.v2.Queue.State",
1671 ))
1672 }
1673 }
1674}
1675
1676/// Rate limits.
1677///
1678/// This message determines the maximum rate that tasks can be dispatched by a
1679/// queue, regardless of whether the dispatch is a first task attempt or a retry.
1680///
1681/// Note: The debugging command,
1682/// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task even if
1683/// the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits].
1684///
1685/// [google.cloud.tasks.v2.CloudTasks.RunTask]: crate::client::CloudTasks::run_task
1686/// [google.cloud.tasks.v2.RateLimits]: crate::model::RateLimits
1687#[derive(Clone, Default, PartialEq)]
1688#[non_exhaustive]
1689pub struct RateLimits {
1690 /// The maximum rate at which tasks are dispatched from this queue.
1691 ///
1692 /// If unspecified when the queue is created, Cloud Tasks will pick the
1693 /// default.
1694 ///
1695 /// * The maximum allowed value is 500.
1696 ///
1697 /// This field has the same meaning as
1698 /// [rate in
1699 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate).
1700 pub max_dispatches_per_second: f64,
1701
1702 /// Output only. The max burst size.
1703 ///
1704 /// Max burst size limits how fast tasks in queue are processed when
1705 /// many tasks are in the queue and the rate is high. This field
1706 /// allows the queue to have a high rate so processing starts shortly
1707 /// after a task is enqueued, but still limits resource usage when
1708 /// many tasks are enqueued in a short period of time.
1709 ///
1710 /// The [token bucket](https://wikipedia.org/wiki/Token_Bucket)
1711 /// algorithm is used to control the rate of task dispatches. Each
1712 /// queue has a token bucket that holds tokens, up to the maximum
1713 /// specified by `max_burst_size`. Each time a task is dispatched, a
1714 /// token is removed from the bucket. Tasks will be dispatched until
1715 /// the queue's bucket runs out of tokens. The bucket will be
1716 /// continuously refilled with new tokens based on
1717 /// [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second].
1718 ///
1719 /// Cloud Tasks will pick the value of `max_burst_size` based on the
1720 /// value of
1721 /// [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second].
1722 ///
1723 /// For queues that were created or updated using
1724 /// `queue.yaml/xml`, `max_burst_size` is equal to
1725 /// [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size).
1726 /// Since `max_burst_size` is output only, if
1727 /// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a
1728 /// queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on
1729 /// the value of
1730 /// [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second],
1731 /// regardless of whether
1732 /// [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]
1733 /// is updated.
1734 ///
1735 /// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
1736 /// [google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]: crate::model::RateLimits::max_dispatches_per_second
1737 pub max_burst_size: i32,
1738
1739 /// The maximum number of concurrent tasks that Cloud Tasks allows
1740 /// to be dispatched for this queue. After this threshold has been
1741 /// reached, Cloud Tasks stops dispatching tasks until the number of
1742 /// concurrent requests decreases.
1743 ///
1744 /// If unspecified when the queue is created, Cloud Tasks will pick the
1745 /// default.
1746 ///
1747 /// The maximum allowed value is 5,000.
1748 ///
1749 /// This field has the same meaning as
1750 /// [max_concurrent_requests in
1751 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests).
1752 pub max_concurrent_dispatches: i32,
1753
1754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1755}
1756
1757impl RateLimits {
1758 /// Creates a new default instance.
1759 pub fn new() -> Self {
1760 std::default::Default::default()
1761 }
1762
1763 /// Sets the value of [max_dispatches_per_second][crate::model::RateLimits::max_dispatches_per_second].
1764 ///
1765 /// # Example
1766 /// ```ignore,no_run
1767 /// # use google_cloud_tasks_v2::model::RateLimits;
1768 /// let x = RateLimits::new().set_max_dispatches_per_second(42.0);
1769 /// ```
1770 pub fn set_max_dispatches_per_second<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1771 self.max_dispatches_per_second = v.into();
1772 self
1773 }
1774
1775 /// Sets the value of [max_burst_size][crate::model::RateLimits::max_burst_size].
1776 ///
1777 /// # Example
1778 /// ```ignore,no_run
1779 /// # use google_cloud_tasks_v2::model::RateLimits;
1780 /// let x = RateLimits::new().set_max_burst_size(42);
1781 /// ```
1782 pub fn set_max_burst_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1783 self.max_burst_size = v.into();
1784 self
1785 }
1786
1787 /// Sets the value of [max_concurrent_dispatches][crate::model::RateLimits::max_concurrent_dispatches].
1788 ///
1789 /// # Example
1790 /// ```ignore,no_run
1791 /// # use google_cloud_tasks_v2::model::RateLimits;
1792 /// let x = RateLimits::new().set_max_concurrent_dispatches(42);
1793 /// ```
1794 pub fn set_max_concurrent_dispatches<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1795 self.max_concurrent_dispatches = v.into();
1796 self
1797 }
1798}
1799
1800impl wkt::message::Message for RateLimits {
1801 fn typename() -> &'static str {
1802 "type.googleapis.com/google.cloud.tasks.v2.RateLimits"
1803 }
1804}
1805
1806/// Retry config.
1807///
1808/// These settings determine when a failed task attempt is retried.
1809#[derive(Clone, Default, PartialEq)]
1810#[non_exhaustive]
1811pub struct RetryConfig {
1812 /// Number of attempts per task.
1813 ///
1814 /// Cloud Tasks will attempt the task `max_attempts` times (that is, if the
1815 /// first attempt fails, then there will be `max_attempts - 1` retries). Must
1816 /// be >= -1.
1817 ///
1818 /// If unspecified when the queue is created, Cloud Tasks will pick the
1819 /// default.
1820 ///
1821 /// -1 indicates unlimited attempts.
1822 ///
1823 /// This field has the same meaning as
1824 /// [task_retry_limit in
1825 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
1826 pub max_attempts: i32,
1827
1828 /// If positive, `max_retry_duration` specifies the time limit for
1829 /// retrying a failed task, measured from when the task was first
1830 /// attempted. Once `max_retry_duration` time has passed *and* the
1831 /// task has been attempted
1832 /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times, no
1833 /// further attempts will be made and the task will be deleted.
1834 ///
1835 /// If zero, then the task age is unlimited.
1836 ///
1837 /// If unspecified when the queue is created, Cloud Tasks will pick the
1838 /// default.
1839 ///
1840 /// `max_retry_duration` will be truncated to the nearest second.
1841 ///
1842 /// This field has the same meaning as
1843 /// [task_age_limit in
1844 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
1845 ///
1846 /// [google.cloud.tasks.v2.RetryConfig.max_attempts]: crate::model::RetryConfig::max_attempts
1847 pub max_retry_duration: std::option::Option<wkt::Duration>,
1848
1849 /// A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
1850 /// retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
1851 /// and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
1852 /// after it fails, if the queue's
1853 /// [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
1854 /// should be retried.
1855 ///
1856 /// If unspecified when the queue is created, Cloud Tasks will pick the
1857 /// default.
1858 ///
1859 /// `min_backoff` will be truncated to the nearest second.
1860 ///
1861 /// This field has the same meaning as
1862 /// [min_backoff_seconds in
1863 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
1864 ///
1865 /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
1866 /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
1867 /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
1868 /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
1869 pub min_backoff: std::option::Option<wkt::Duration>,
1870
1871 /// A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
1872 /// retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
1873 /// and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
1874 /// after it fails, if the queue's
1875 /// [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
1876 /// should be retried.
1877 ///
1878 /// If unspecified when the queue is created, Cloud Tasks will pick the
1879 /// default.
1880 ///
1881 /// `max_backoff` will be truncated to the nearest second.
1882 ///
1883 /// This field has the same meaning as
1884 /// [max_backoff_seconds in
1885 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
1886 ///
1887 /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
1888 /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
1889 /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
1890 /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
1891 pub max_backoff: std::option::Option<wkt::Duration>,
1892
1893 /// The time between retries will double `max_doublings` times.
1894 ///
1895 /// A task's retry interval starts at
1896 /// [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles
1897 /// `max_doublings` times, then increases linearly, and finally
1898 /// retries at intervals of
1899 /// [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to
1900 /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times.
1901 ///
1902 /// For example, if
1903 /// [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] is 10s,
1904 /// [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] is 300s, and
1905 /// `max_doublings` is 3, then the a task will first be retried in
1906 /// 10s. The retry interval will double three times, and then
1907 /// increase linearly by 2^3 * 10s. Finally, the task will retry at
1908 /// intervals of [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff]
1909 /// until the task has been attempted
1910 /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times. Thus,
1911 /// the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....
1912 ///
1913 /// If unspecified when the queue is created, Cloud Tasks will pick the
1914 /// default.
1915 ///
1916 /// This field has the same meaning as
1917 /// [max_doublings in
1918 /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
1919 ///
1920 /// [google.cloud.tasks.v2.RetryConfig.max_attempts]: crate::model::RetryConfig::max_attempts
1921 /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
1922 /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
1923 pub max_doublings: i32,
1924
1925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1926}
1927
1928impl RetryConfig {
1929 /// Creates a new default instance.
1930 pub fn new() -> Self {
1931 std::default::Default::default()
1932 }
1933
1934 /// Sets the value of [max_attempts][crate::model::RetryConfig::max_attempts].
1935 ///
1936 /// # Example
1937 /// ```ignore,no_run
1938 /// # use google_cloud_tasks_v2::model::RetryConfig;
1939 /// let x = RetryConfig::new().set_max_attempts(42);
1940 /// ```
1941 pub fn set_max_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1942 self.max_attempts = v.into();
1943 self
1944 }
1945
1946 /// Sets the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
1947 ///
1948 /// # Example
1949 /// ```ignore,no_run
1950 /// # use google_cloud_tasks_v2::model::RetryConfig;
1951 /// use wkt::Duration;
1952 /// let x = RetryConfig::new().set_max_retry_duration(Duration::default()/* use setters */);
1953 /// ```
1954 pub fn set_max_retry_duration<T>(mut self, v: T) -> Self
1955 where
1956 T: std::convert::Into<wkt::Duration>,
1957 {
1958 self.max_retry_duration = std::option::Option::Some(v.into());
1959 self
1960 }
1961
1962 /// Sets or clears the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
1963 ///
1964 /// # Example
1965 /// ```ignore,no_run
1966 /// # use google_cloud_tasks_v2::model::RetryConfig;
1967 /// use wkt::Duration;
1968 /// let x = RetryConfig::new().set_or_clear_max_retry_duration(Some(Duration::default()/* use setters */));
1969 /// let x = RetryConfig::new().set_or_clear_max_retry_duration(None::<Duration>);
1970 /// ```
1971 pub fn set_or_clear_max_retry_duration<T>(mut self, v: std::option::Option<T>) -> Self
1972 where
1973 T: std::convert::Into<wkt::Duration>,
1974 {
1975 self.max_retry_duration = v.map(|x| x.into());
1976 self
1977 }
1978
1979 /// Sets the value of [min_backoff][crate::model::RetryConfig::min_backoff].
1980 ///
1981 /// # Example
1982 /// ```ignore,no_run
1983 /// # use google_cloud_tasks_v2::model::RetryConfig;
1984 /// use wkt::Duration;
1985 /// let x = RetryConfig::new().set_min_backoff(Duration::default()/* use setters */);
1986 /// ```
1987 pub fn set_min_backoff<T>(mut self, v: T) -> Self
1988 where
1989 T: std::convert::Into<wkt::Duration>,
1990 {
1991 self.min_backoff = std::option::Option::Some(v.into());
1992 self
1993 }
1994
1995 /// Sets or clears the value of [min_backoff][crate::model::RetryConfig::min_backoff].
1996 ///
1997 /// # Example
1998 /// ```ignore,no_run
1999 /// # use google_cloud_tasks_v2::model::RetryConfig;
2000 /// use wkt::Duration;
2001 /// let x = RetryConfig::new().set_or_clear_min_backoff(Some(Duration::default()/* use setters */));
2002 /// let x = RetryConfig::new().set_or_clear_min_backoff(None::<Duration>);
2003 /// ```
2004 pub fn set_or_clear_min_backoff<T>(mut self, v: std::option::Option<T>) -> Self
2005 where
2006 T: std::convert::Into<wkt::Duration>,
2007 {
2008 self.min_backoff = v.map(|x| x.into());
2009 self
2010 }
2011
2012 /// Sets the value of [max_backoff][crate::model::RetryConfig::max_backoff].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_tasks_v2::model::RetryConfig;
2017 /// use wkt::Duration;
2018 /// let x = RetryConfig::new().set_max_backoff(Duration::default()/* use setters */);
2019 /// ```
2020 pub fn set_max_backoff<T>(mut self, v: T) -> Self
2021 where
2022 T: std::convert::Into<wkt::Duration>,
2023 {
2024 self.max_backoff = std::option::Option::Some(v.into());
2025 self
2026 }
2027
2028 /// Sets or clears the value of [max_backoff][crate::model::RetryConfig::max_backoff].
2029 ///
2030 /// # Example
2031 /// ```ignore,no_run
2032 /// # use google_cloud_tasks_v2::model::RetryConfig;
2033 /// use wkt::Duration;
2034 /// let x = RetryConfig::new().set_or_clear_max_backoff(Some(Duration::default()/* use setters */));
2035 /// let x = RetryConfig::new().set_or_clear_max_backoff(None::<Duration>);
2036 /// ```
2037 pub fn set_or_clear_max_backoff<T>(mut self, v: std::option::Option<T>) -> Self
2038 where
2039 T: std::convert::Into<wkt::Duration>,
2040 {
2041 self.max_backoff = v.map(|x| x.into());
2042 self
2043 }
2044
2045 /// Sets the value of [max_doublings][crate::model::RetryConfig::max_doublings].
2046 ///
2047 /// # Example
2048 /// ```ignore,no_run
2049 /// # use google_cloud_tasks_v2::model::RetryConfig;
2050 /// let x = RetryConfig::new().set_max_doublings(42);
2051 /// ```
2052 pub fn set_max_doublings<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2053 self.max_doublings = v.into();
2054 self
2055 }
2056}
2057
2058impl wkt::message::Message for RetryConfig {
2059 fn typename() -> &'static str {
2060 "type.googleapis.com/google.cloud.tasks.v2.RetryConfig"
2061 }
2062}
2063
2064/// Configuration options for writing logs to
2065/// [Stackdriver Logging](https://cloud.google.com/logging/docs/).
2066#[derive(Clone, Default, PartialEq)]
2067#[non_exhaustive]
2068pub struct StackdriverLoggingConfig {
2069 /// Specifies the fraction of operations to write to
2070 /// [Stackdriver Logging](https://cloud.google.com/logging/docs/).
2071 /// This field may contain any value between 0.0 and 1.0, inclusive.
2072 /// 0.0 is the default and means that no operations are logged.
2073 pub sampling_ratio: f64,
2074
2075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2076}
2077
2078impl StackdriverLoggingConfig {
2079 /// Creates a new default instance.
2080 pub fn new() -> Self {
2081 std::default::Default::default()
2082 }
2083
2084 /// Sets the value of [sampling_ratio][crate::model::StackdriverLoggingConfig::sampling_ratio].
2085 ///
2086 /// # Example
2087 /// ```ignore,no_run
2088 /// # use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
2089 /// let x = StackdriverLoggingConfig::new().set_sampling_ratio(42.0);
2090 /// ```
2091 pub fn set_sampling_ratio<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2092 self.sampling_ratio = v.into();
2093 self
2094 }
2095}
2096
2097impl wkt::message::Message for StackdriverLoggingConfig {
2098 fn typename() -> &'static str {
2099 "type.googleapis.com/google.cloud.tasks.v2.StackdriverLoggingConfig"
2100 }
2101}
2102
2103/// HTTP request.
2104///
2105/// The task will be pushed to the worker as an HTTP request. If the worker
2106/// or the redirected worker acknowledges the task by returning a successful HTTP
2107/// response code ([`200` - `299`]), the task will be removed from the queue. If
2108/// any other HTTP response code is returned or no response is received, the
2109/// task will be retried according to the following:
2110///
2111/// * User-specified throttling: [retry
2112/// configuration][google.cloud.tasks.v2.Queue.retry_config],
2113/// [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's
2114/// state][google.cloud.tasks.v2.Queue.state].
2115///
2116/// * System throttling: To prevent the worker from overloading, Cloud Tasks may
2117/// temporarily reduce the queue's effective rate. User-specified settings
2118/// will not be changed.
2119///
2120///
2121/// System throttling happens because:
2122///
2123/// * Cloud Tasks backs off on all errors. Normally the backoff specified in
2124/// [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But
2125/// if the worker returns `429` (Too Many Requests), `503` (Service
2126/// Unavailable), or the rate of errors is high, Cloud Tasks will use a
2127/// higher backoff rate. The retry specified in the `Retry-After` HTTP
2128/// response header is considered.
2129///
2130/// * To prevent traffic spikes and to smooth sudden increases in traffic,
2131/// dispatches ramp up slowly when the queue is newly created or idle and
2132/// if large numbers of tasks suddenly become available to dispatch (due to
2133/// spikes in create task rates, the queue being unpaused, or many tasks
2134/// that are scheduled at the same time).
2135///
2136///
2137/// [google.cloud.tasks.v2.Queue.rate_limits]: crate::model::Queue::rate_limits
2138/// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
2139/// [google.cloud.tasks.v2.Queue.state]: crate::model::Queue::state
2140#[derive(Clone, Default, PartialEq)]
2141#[non_exhaustive]
2142pub struct HttpRequest {
2143 /// Required. The full url path that the request will be sent to.
2144 ///
2145 /// This string must begin with either "http://" or "https://". Some examples
2146 /// are: `<http://acme.com>` and `<https://acme.com/sales:8080>`. Cloud Tasks will
2147 /// encode some characters for safety and compatibility. The maximum allowed
2148 /// URL length is 2083 characters after encoding.
2149 ///
2150 /// The `Location` header response from a redirect response [`300` - `399`]
2151 /// may be followed. The redirect is not counted as a separate attempt.
2152 pub url: std::string::String,
2153
2154 /// The HTTP method to use for the request. The default is POST.
2155 pub http_method: crate::model::HttpMethod,
2156
2157 /// HTTP request headers.
2158 ///
2159 /// This map contains the header field names and values.
2160 /// Headers can be set when the
2161 /// [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
2162 ///
2163 /// These headers represent a subset of the headers that will accompany the
2164 /// task's HTTP request. Some HTTP request headers will be ignored or replaced.
2165 ///
2166 /// A partial list of headers that will be ignored or replaced is:
2167 ///
2168 /// * Host: This will be computed by Cloud Tasks and derived from
2169 /// [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url].
2170 /// * Content-Length: This will be computed by Cloud Tasks.
2171 /// * User-Agent: This will be set to `"Google-Cloud-Tasks"`.
2172 /// * `X-Google-*`: Google use only.
2173 /// * `X-AppEngine-*`: Google use only.
2174 ///
2175 /// `Content-Type` won't be set by Cloud Tasks. You can explicitly set
2176 /// `Content-Type` to a media type when the
2177 /// [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
2178 /// For example, `Content-Type` can be set to `"application/octet-stream"` or
2179 /// `"application/json"`.
2180 ///
2181 /// Headers which can have multiple values (according to RFC2616) can be
2182 /// specified using comma-separated values.
2183 ///
2184 /// The size of the headers must be less than 80KB.
2185 ///
2186 /// [google.cloud.tasks.v2.HttpRequest.url]: crate::model::HttpRequest::url
2187 pub headers: std::collections::HashMap<std::string::String, std::string::String>,
2188
2189 /// HTTP request body.
2190 ///
2191 /// A request body is allowed only if the
2192 /// [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT,
2193 /// or PATCH. It is an error to set body on a task with an incompatible
2194 /// [HttpMethod][google.cloud.tasks.v2.HttpMethod].
2195 ///
2196 /// [google.cloud.tasks.v2.HttpMethod]: crate::model::HttpMethod
2197 /// [google.cloud.tasks.v2.HttpRequest.http_method]: crate::model::HttpRequest::http_method
2198 pub body: ::bytes::Bytes,
2199
2200 /// The mode for generating an `Authorization` header for HTTP requests.
2201 ///
2202 /// If specified, all `Authorization` headers in the
2203 /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field will
2204 /// be overridden.
2205 ///
2206 /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
2207 pub authorization_header: std::option::Option<crate::model::http_request::AuthorizationHeader>,
2208
2209 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2210}
2211
2212impl HttpRequest {
2213 /// Creates a new default instance.
2214 pub fn new() -> Self {
2215 std::default::Default::default()
2216 }
2217
2218 /// Sets the value of [url][crate::model::HttpRequest::url].
2219 ///
2220 /// # Example
2221 /// ```ignore,no_run
2222 /// # use google_cloud_tasks_v2::model::HttpRequest;
2223 /// let x = HttpRequest::new().set_url("example");
2224 /// ```
2225 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2226 self.url = v.into();
2227 self
2228 }
2229
2230 /// Sets the value of [http_method][crate::model::HttpRequest::http_method].
2231 ///
2232 /// # Example
2233 /// ```ignore,no_run
2234 /// # use google_cloud_tasks_v2::model::HttpRequest;
2235 /// use google_cloud_tasks_v2::model::HttpMethod;
2236 /// let x0 = HttpRequest::new().set_http_method(HttpMethod::Post);
2237 /// let x1 = HttpRequest::new().set_http_method(HttpMethod::Get);
2238 /// let x2 = HttpRequest::new().set_http_method(HttpMethod::Head);
2239 /// ```
2240 pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
2241 mut self,
2242 v: T,
2243 ) -> Self {
2244 self.http_method = v.into();
2245 self
2246 }
2247
2248 /// Sets the value of [headers][crate::model::HttpRequest::headers].
2249 ///
2250 /// # Example
2251 /// ```ignore,no_run
2252 /// # use google_cloud_tasks_v2::model::HttpRequest;
2253 /// let x = HttpRequest::new().set_headers([
2254 /// ("key0", "abc"),
2255 /// ("key1", "xyz"),
2256 /// ]);
2257 /// ```
2258 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
2259 where
2260 T: std::iter::IntoIterator<Item = (K, V)>,
2261 K: std::convert::Into<std::string::String>,
2262 V: std::convert::Into<std::string::String>,
2263 {
2264 use std::iter::Iterator;
2265 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2266 self
2267 }
2268
2269 /// Sets the value of [body][crate::model::HttpRequest::body].
2270 ///
2271 /// # Example
2272 /// ```ignore,no_run
2273 /// # use google_cloud_tasks_v2::model::HttpRequest;
2274 /// let x = HttpRequest::new().set_body(bytes::Bytes::from_static(b"example"));
2275 /// ```
2276 pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2277 self.body = v.into();
2278 self
2279 }
2280
2281 /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header].
2282 ///
2283 /// Note that all the setters affecting `authorization_header` are mutually
2284 /// exclusive.
2285 ///
2286 /// # Example
2287 /// ```ignore,no_run
2288 /// # use google_cloud_tasks_v2::model::HttpRequest;
2289 /// use google_cloud_tasks_v2::model::OAuthToken;
2290 /// let x = HttpRequest::new().set_authorization_header(Some(
2291 /// google_cloud_tasks_v2::model::http_request::AuthorizationHeader::OauthToken(OAuthToken::default().into())));
2292 /// ```
2293 pub fn set_authorization_header<
2294 T: std::convert::Into<std::option::Option<crate::model::http_request::AuthorizationHeader>>,
2295 >(
2296 mut self,
2297 v: T,
2298 ) -> Self {
2299 self.authorization_header = v.into();
2300 self
2301 }
2302
2303 /// The value of [authorization_header][crate::model::HttpRequest::authorization_header]
2304 /// if it holds a `OauthToken`, `None` if the field is not set or
2305 /// holds a different branch.
2306 pub fn oauth_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OAuthToken>> {
2307 #[allow(unreachable_patterns)]
2308 self.authorization_header.as_ref().and_then(|v| match v {
2309 crate::model::http_request::AuthorizationHeader::OauthToken(v) => {
2310 std::option::Option::Some(v)
2311 }
2312 _ => std::option::Option::None,
2313 })
2314 }
2315
2316 /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header]
2317 /// to hold a `OauthToken`.
2318 ///
2319 /// Note that all the setters affecting `authorization_header` are
2320 /// mutually exclusive.
2321 ///
2322 /// # Example
2323 /// ```ignore,no_run
2324 /// # use google_cloud_tasks_v2::model::HttpRequest;
2325 /// use google_cloud_tasks_v2::model::OAuthToken;
2326 /// let x = HttpRequest::new().set_oauth_token(OAuthToken::default()/* use setters */);
2327 /// assert!(x.oauth_token().is_some());
2328 /// assert!(x.oidc_token().is_none());
2329 /// ```
2330 pub fn set_oauth_token<T: std::convert::Into<std::boxed::Box<crate::model::OAuthToken>>>(
2331 mut self,
2332 v: T,
2333 ) -> Self {
2334 self.authorization_header = std::option::Option::Some(
2335 crate::model::http_request::AuthorizationHeader::OauthToken(v.into()),
2336 );
2337 self
2338 }
2339
2340 /// The value of [authorization_header][crate::model::HttpRequest::authorization_header]
2341 /// if it holds a `OidcToken`, `None` if the field is not set or
2342 /// holds a different branch.
2343 pub fn oidc_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OidcToken>> {
2344 #[allow(unreachable_patterns)]
2345 self.authorization_header.as_ref().and_then(|v| match v {
2346 crate::model::http_request::AuthorizationHeader::OidcToken(v) => {
2347 std::option::Option::Some(v)
2348 }
2349 _ => std::option::Option::None,
2350 })
2351 }
2352
2353 /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header]
2354 /// to hold a `OidcToken`.
2355 ///
2356 /// Note that all the setters affecting `authorization_header` are
2357 /// mutually exclusive.
2358 ///
2359 /// # Example
2360 /// ```ignore,no_run
2361 /// # use google_cloud_tasks_v2::model::HttpRequest;
2362 /// use google_cloud_tasks_v2::model::OidcToken;
2363 /// let x = HttpRequest::new().set_oidc_token(OidcToken::default()/* use setters */);
2364 /// assert!(x.oidc_token().is_some());
2365 /// assert!(x.oauth_token().is_none());
2366 /// ```
2367 pub fn set_oidc_token<T: std::convert::Into<std::boxed::Box<crate::model::OidcToken>>>(
2368 mut self,
2369 v: T,
2370 ) -> Self {
2371 self.authorization_header = std::option::Option::Some(
2372 crate::model::http_request::AuthorizationHeader::OidcToken(v.into()),
2373 );
2374 self
2375 }
2376}
2377
2378impl wkt::message::Message for HttpRequest {
2379 fn typename() -> &'static str {
2380 "type.googleapis.com/google.cloud.tasks.v2.HttpRequest"
2381 }
2382}
2383
2384/// Defines additional types related to [HttpRequest].
2385pub mod http_request {
2386 #[allow(unused_imports)]
2387 use super::*;
2388
2389 /// The mode for generating an `Authorization` header for HTTP requests.
2390 ///
2391 /// If specified, all `Authorization` headers in the
2392 /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field will
2393 /// be overridden.
2394 ///
2395 /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
2396 #[derive(Clone, Debug, PartialEq)]
2397 #[non_exhaustive]
2398 pub enum AuthorizationHeader {
2399 /// If specified, an
2400 /// [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
2401 /// will be generated and attached as an `Authorization` header in the HTTP
2402 /// request.
2403 ///
2404 /// This type of authorization should generally only be used when calling
2405 /// Google APIs hosted on *.googleapis.com.
2406 OauthToken(std::boxed::Box<crate::model::OAuthToken>),
2407 /// If specified, an
2408 /// [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
2409 /// token will be generated and attached as an `Authorization` header in the
2410 /// HTTP request.
2411 ///
2412 /// This type of authorization can be used for many scenarios, including
2413 /// calling Cloud Run, or endpoints where you intend to validate the token
2414 /// yourself.
2415 OidcToken(std::boxed::Box<crate::model::OidcToken>),
2416 }
2417}
2418
2419/// App Engine HTTP request.
2420///
2421/// The message defines the HTTP request that is sent to an App Engine app when
2422/// the task is dispatched.
2423///
2424/// Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest]
2425/// requires
2426/// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
2427/// Google IAM permission for the project
2428/// and the following scope:
2429///
2430/// `<https://www.googleapis.com/auth/cloud-platform>`
2431///
2432/// The task will be delivered to the App Engine app which belongs to the same
2433/// project as the queue. For more information, see
2434/// [How Requests are
2435/// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
2436/// and how routing is affected by
2437/// [dispatch
2438/// files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
2439/// Traffic is encrypted during transport and never leaves Google datacenters.
2440/// Because this traffic is carried over a communication mechanism internal to
2441/// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS).
2442/// The request to the handler, however, will appear to have used the HTTP
2443/// protocol.
2444///
2445/// The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to
2446/// construct the URL that the task is delivered to can be set at the queue-level
2447/// or task-level:
2448///
2449/// * If [app_engine_routing_override is set on the
2450/// queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this value
2451/// is used for all tasks in the queue, no matter what the setting is for the
2452/// [task-level
2453/// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
2454///
2455/// The `url` that the task will be sent to is:
2456///
2457/// * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+`
2458/// [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri]
2459///
2460/// Tasks can be dispatched to secure app handlers, unsecure app handlers, and
2461/// URIs restricted with
2462/// [`login:
2463/// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref).
2464/// Because tasks are not run as any user, they cannot be dispatched to URIs
2465/// restricted with
2466/// [`login:
2467/// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
2468/// Task dispatches also do not follow redirects.
2469///
2470/// The task attempt has succeeded if the app's request handler returns an HTTP
2471/// response code in the range [`200` - `299`]. The task attempt has failed if
2472/// the app's handler returns a non-2xx response code or Cloud Tasks does
2473/// not receive response before the
2474/// [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed tasks will
2475/// be retried according to the [retry
2476/// configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service
2477/// Unavailable) is considered an App Engine system error instead of an
2478/// application error and will cause Cloud Tasks' traffic congestion control to
2479/// temporarily throttle the queue's dispatches. Unlike other types of task
2480/// targets, a `429` (Too Many Requests) response from an app handler does not
2481/// cause traffic congestion control to throttle the queue.
2482///
2483/// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
2484/// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
2485/// [google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri]: crate::model::AppEngineHttpRequest::relative_uri
2486/// [google.cloud.tasks.v2.AppEngineRouting]: crate::model::AppEngineRouting
2487/// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
2488/// [google.cloud.tasks.v2.Queue.app_engine_routing_override]: crate::model::Queue::app_engine_routing_override
2489/// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
2490/// [google.cloud.tasks.v2.Task.dispatch_deadline]: crate::model::Task::dispatch_deadline
2491#[derive(Clone, Default, PartialEq)]
2492#[non_exhaustive]
2493pub struct AppEngineHttpRequest {
2494 /// The HTTP method to use for the request. The default is POST.
2495 ///
2496 /// The app's request handler for the task's target URL must be able to handle
2497 /// HTTP requests with this http_method, otherwise the task attempt fails with
2498 /// error code 405 (Method Not Allowed). See [Writing a push task request
2499 /// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
2500 /// and the App Engine documentation for your runtime on [How Requests are
2501 /// Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled).
2502 pub http_method: crate::model::HttpMethod,
2503
2504 /// Task-level setting for App Engine routing.
2505 ///
2506 /// * If [app_engine_routing_override is set on the
2507 /// queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this
2508 /// value is used for all tasks in the queue, no matter what the setting is
2509 /// for the [task-level
2510 /// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
2511 ///
2512 /// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
2513 /// [google.cloud.tasks.v2.Queue.app_engine_routing_override]: crate::model::Queue::app_engine_routing_override
2514 pub app_engine_routing: std::option::Option<crate::model::AppEngineRouting>,
2515
2516 /// The relative URI.
2517 ///
2518 /// The relative URI must begin with "/" and must be a valid HTTP relative URI.
2519 /// It can contain a path and query string arguments.
2520 /// If the relative URI is empty, then the root path "/" will be used.
2521 /// No spaces are allowed, and the maximum length allowed is 2083 characters.
2522 pub relative_uri: std::string::String,
2523
2524 /// HTTP request headers.
2525 ///
2526 /// This map contains the header field names and values.
2527 /// Headers can be set when the
2528 /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
2529 /// Repeated headers are not supported but a header value can contain commas.
2530 ///
2531 /// Cloud Tasks sets some headers to default values:
2532 ///
2533 /// * `User-Agent`: By default, this header is
2534 /// `"AppEngine-Google; (+<http://code.google.com/appengine>)"`.
2535 /// This header can be modified, but Cloud Tasks will append
2536 /// `"AppEngine-Google; (+<http://code.google.com/appengine>)"` to the
2537 /// modified `User-Agent`.
2538 ///
2539 /// If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body],
2540 /// Cloud Tasks sets the following headers:
2541 ///
2542 /// * `Content-Type`: By default, the `Content-Type` header is set to
2543 /// `"application/octet-stream"`. The default can be overridden by explicitly
2544 /// setting `Content-Type` to a particular media type when the
2545 /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
2546 /// For example, `Content-Type` can be set to `"application/json"`.
2547 /// * `Content-Length`: This is computed by Cloud Tasks. This value is
2548 /// output only. It cannot be changed.
2549 ///
2550 /// The headers below cannot be set or overridden:
2551 ///
2552 /// * `Host`
2553 /// * `X-Google-*`
2554 /// * `X-AppEngine-*`
2555 ///
2556 /// In addition, Cloud Tasks sets some headers when the task is dispatched,
2557 /// such as headers containing information about the task; see
2558 /// [request
2559 /// headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers).
2560 /// These headers are set only when the task is dispatched, so they are not
2561 /// visible when the task is returned in a Cloud Tasks response.
2562 ///
2563 /// Although there is no specific limit for the maximum number of headers or
2564 /// the size, there is a limit on the maximum size of the
2565 /// [Task][google.cloud.tasks.v2.Task]. For more information, see the
2566 /// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation.
2567 ///
2568 /// [google.cloud.tasks.v2.AppEngineHttpRequest.body]: crate::model::AppEngineHttpRequest::body
2569 /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
2570 /// [google.cloud.tasks.v2.Task]: crate::model::Task
2571 pub headers: std::collections::HashMap<std::string::String, std::string::String>,
2572
2573 /// HTTP request body.
2574 ///
2575 /// A request body is allowed only if the HTTP method is POST or PUT. It is
2576 /// an error to set a body on a task with an incompatible
2577 /// [HttpMethod][google.cloud.tasks.v2.HttpMethod].
2578 ///
2579 /// [google.cloud.tasks.v2.HttpMethod]: crate::model::HttpMethod
2580 pub body: ::bytes::Bytes,
2581
2582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2583}
2584
2585impl AppEngineHttpRequest {
2586 /// Creates a new default instance.
2587 pub fn new() -> Self {
2588 std::default::Default::default()
2589 }
2590
2591 /// Sets the value of [http_method][crate::model::AppEngineHttpRequest::http_method].
2592 ///
2593 /// # Example
2594 /// ```ignore,no_run
2595 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2596 /// use google_cloud_tasks_v2::model::HttpMethod;
2597 /// let x0 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Post);
2598 /// let x1 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Get);
2599 /// let x2 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Head);
2600 /// ```
2601 pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
2602 mut self,
2603 v: T,
2604 ) -> Self {
2605 self.http_method = v.into();
2606 self
2607 }
2608
2609 /// Sets the value of [app_engine_routing][crate::model::AppEngineHttpRequest::app_engine_routing].
2610 ///
2611 /// # Example
2612 /// ```ignore,no_run
2613 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2614 /// use google_cloud_tasks_v2::model::AppEngineRouting;
2615 /// let x = AppEngineHttpRequest::new().set_app_engine_routing(AppEngineRouting::default()/* use setters */);
2616 /// ```
2617 pub fn set_app_engine_routing<T>(mut self, v: T) -> Self
2618 where
2619 T: std::convert::Into<crate::model::AppEngineRouting>,
2620 {
2621 self.app_engine_routing = std::option::Option::Some(v.into());
2622 self
2623 }
2624
2625 /// Sets or clears the value of [app_engine_routing][crate::model::AppEngineHttpRequest::app_engine_routing].
2626 ///
2627 /// # Example
2628 /// ```ignore,no_run
2629 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2630 /// use google_cloud_tasks_v2::model::AppEngineRouting;
2631 /// let x = AppEngineHttpRequest::new().set_or_clear_app_engine_routing(Some(AppEngineRouting::default()/* use setters */));
2632 /// let x = AppEngineHttpRequest::new().set_or_clear_app_engine_routing(None::<AppEngineRouting>);
2633 /// ```
2634 pub fn set_or_clear_app_engine_routing<T>(mut self, v: std::option::Option<T>) -> Self
2635 where
2636 T: std::convert::Into<crate::model::AppEngineRouting>,
2637 {
2638 self.app_engine_routing = v.map(|x| x.into());
2639 self
2640 }
2641
2642 /// Sets the value of [relative_uri][crate::model::AppEngineHttpRequest::relative_uri].
2643 ///
2644 /// # Example
2645 /// ```ignore,no_run
2646 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2647 /// let x = AppEngineHttpRequest::new().set_relative_uri("example");
2648 /// ```
2649 pub fn set_relative_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2650 self.relative_uri = v.into();
2651 self
2652 }
2653
2654 /// Sets the value of [headers][crate::model::AppEngineHttpRequest::headers].
2655 ///
2656 /// # Example
2657 /// ```ignore,no_run
2658 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2659 /// let x = AppEngineHttpRequest::new().set_headers([
2660 /// ("key0", "abc"),
2661 /// ("key1", "xyz"),
2662 /// ]);
2663 /// ```
2664 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
2665 where
2666 T: std::iter::IntoIterator<Item = (K, V)>,
2667 K: std::convert::Into<std::string::String>,
2668 V: std::convert::Into<std::string::String>,
2669 {
2670 use std::iter::Iterator;
2671 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2672 self
2673 }
2674
2675 /// Sets the value of [body][crate::model::AppEngineHttpRequest::body].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
2680 /// let x = AppEngineHttpRequest::new().set_body(bytes::Bytes::from_static(b"example"));
2681 /// ```
2682 pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2683 self.body = v.into();
2684 self
2685 }
2686}
2687
2688impl wkt::message::Message for AppEngineHttpRequest {
2689 fn typename() -> &'static str {
2690 "type.googleapis.com/google.cloud.tasks.v2.AppEngineHttpRequest"
2691 }
2692}
2693
2694/// App Engine Routing.
2695///
2696/// Defines routing characteristics specific to App Engine - service, version,
2697/// and instance.
2698///
2699/// For more information about services, versions, and instances see
2700/// [An Overview of App
2701/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
2702/// [Microservices Architecture on Google App
2703/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
2704/// [App Engine Standard request
2705/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
2706/// and [App Engine Flex request
2707/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
2708///
2709/// Using [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] requires
2710/// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
2711/// Google IAM permission for the project
2712/// and the following scope:
2713///
2714/// `<https://www.googleapis.com/auth/cloud-platform>`
2715///
2716/// [google.cloud.tasks.v2.AppEngineRouting]: crate::model::AppEngineRouting
2717#[derive(Clone, Default, PartialEq)]
2718#[non_exhaustive]
2719pub struct AppEngineRouting {
2720 /// App service.
2721 ///
2722 /// By default, the task is sent to the service which is the default
2723 /// service when the task is attempted.
2724 ///
2725 /// For some queues or tasks which were created using the App Engine
2726 /// Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not
2727 /// parsable into [service][google.cloud.tasks.v2.AppEngineRouting.service],
2728 /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
2729 /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example,
2730 /// some tasks which were created using the App Engine SDK use a custom domain
2731 /// name; custom domains are not parsed by Cloud Tasks. If
2732 /// [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then
2733 /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
2734 /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
2735 /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty
2736 /// string.
2737 ///
2738 /// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
2739 /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
2740 /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
2741 /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
2742 pub service: std::string::String,
2743
2744 /// App version.
2745 ///
2746 /// By default, the task is sent to the version which is the default
2747 /// version when the task is attempted.
2748 ///
2749 /// For some queues or tasks which were created using the App Engine
2750 /// Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not
2751 /// parsable into [service][google.cloud.tasks.v2.AppEngineRouting.service],
2752 /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
2753 /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example,
2754 /// some tasks which were created using the App Engine SDK use a custom domain
2755 /// name; custom domains are not parsed by Cloud Tasks. If
2756 /// [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then
2757 /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
2758 /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
2759 /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty
2760 /// string.
2761 ///
2762 /// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
2763 /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
2764 /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
2765 /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
2766 pub version: std::string::String,
2767
2768 /// App instance.
2769 ///
2770 /// By default, the task is sent to an instance which is available when
2771 /// the task is attempted.
2772 ///
2773 /// Requests can only be sent to a specific instance if
2774 /// [manual scaling is used in App Engine
2775 /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
2776 /// App Engine Flex does not support instances. For more information, see
2777 /// [App Engine Standard request
2778 /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
2779 /// and [App Engine Flex request
2780 /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
2781 pub instance: std::string::String,
2782
2783 /// Output only. The host that the task is sent to.
2784 ///
2785 /// The host is constructed from the domain name of the app associated with
2786 /// the queue's project ID (for example \<app-id\>.appspot.com), and the
2787 /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
2788 /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
2789 /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. Tasks which
2790 /// were created using the App Engine SDK might have a custom domain name.
2791 ///
2792 /// For more information, see
2793 /// [How Requests are
2794 /// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
2795 ///
2796 /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
2797 /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
2798 /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
2799 pub host: std::string::String,
2800
2801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2802}
2803
2804impl AppEngineRouting {
2805 /// Creates a new default instance.
2806 pub fn new() -> Self {
2807 std::default::Default::default()
2808 }
2809
2810 /// Sets the value of [service][crate::model::AppEngineRouting::service].
2811 ///
2812 /// # Example
2813 /// ```ignore,no_run
2814 /// # use google_cloud_tasks_v2::model::AppEngineRouting;
2815 /// let x = AppEngineRouting::new().set_service("example");
2816 /// ```
2817 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2818 self.service = v.into();
2819 self
2820 }
2821
2822 /// Sets the value of [version][crate::model::AppEngineRouting::version].
2823 ///
2824 /// # Example
2825 /// ```ignore,no_run
2826 /// # use google_cloud_tasks_v2::model::AppEngineRouting;
2827 /// let x = AppEngineRouting::new().set_version("example");
2828 /// ```
2829 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2830 self.version = v.into();
2831 self
2832 }
2833
2834 /// Sets the value of [instance][crate::model::AppEngineRouting::instance].
2835 ///
2836 /// # Example
2837 /// ```ignore,no_run
2838 /// # use google_cloud_tasks_v2::model::AppEngineRouting;
2839 /// let x = AppEngineRouting::new().set_instance("example");
2840 /// ```
2841 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2842 self.instance = v.into();
2843 self
2844 }
2845
2846 /// Sets the value of [host][crate::model::AppEngineRouting::host].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_tasks_v2::model::AppEngineRouting;
2851 /// let x = AppEngineRouting::new().set_host("example");
2852 /// ```
2853 pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.host = v.into();
2855 self
2856 }
2857}
2858
2859impl wkt::message::Message for AppEngineRouting {
2860 fn typename() -> &'static str {
2861 "type.googleapis.com/google.cloud.tasks.v2.AppEngineRouting"
2862 }
2863}
2864
2865/// Contains information needed for generating an
2866/// [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
2867/// This type of authorization should generally only be used when calling Google
2868/// APIs hosted on *.googleapis.com.
2869#[derive(Clone, Default, PartialEq)]
2870#[non_exhaustive]
2871pub struct OAuthToken {
2872 /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
2873 /// to be used for generating OAuth token.
2874 /// The service account must be within the same project as the queue. The
2875 /// caller must have iam.serviceAccounts.actAs permission for the service
2876 /// account.
2877 pub service_account_email: std::string::String,
2878
2879 /// OAuth scope to be used for generating OAuth access token.
2880 /// If not specified, `https://www.googleapis.com/auth/cloud-platform`
2881 /// will be used.
2882 pub scope: std::string::String,
2883
2884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2885}
2886
2887impl OAuthToken {
2888 /// Creates a new default instance.
2889 pub fn new() -> Self {
2890 std::default::Default::default()
2891 }
2892
2893 /// Sets the value of [service_account_email][crate::model::OAuthToken::service_account_email].
2894 ///
2895 /// # Example
2896 /// ```ignore,no_run
2897 /// # use google_cloud_tasks_v2::model::OAuthToken;
2898 /// let x = OAuthToken::new().set_service_account_email("example");
2899 /// ```
2900 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
2901 mut self,
2902 v: T,
2903 ) -> Self {
2904 self.service_account_email = v.into();
2905 self
2906 }
2907
2908 /// Sets the value of [scope][crate::model::OAuthToken::scope].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_tasks_v2::model::OAuthToken;
2913 /// let x = OAuthToken::new().set_scope("example");
2914 /// ```
2915 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2916 self.scope = v.into();
2917 self
2918 }
2919}
2920
2921impl wkt::message::Message for OAuthToken {
2922 fn typename() -> &'static str {
2923 "type.googleapis.com/google.cloud.tasks.v2.OAuthToken"
2924 }
2925}
2926
2927/// Contains information needed for generating an
2928/// [OpenID Connect
2929/// token](https://developers.google.com/identity/protocols/OpenIDConnect).
2930/// This type of authorization can be used for many scenarios, including
2931/// calling Cloud Run, or endpoints where you intend to validate the token
2932/// yourself.
2933#[derive(Clone, Default, PartialEq)]
2934#[non_exhaustive]
2935pub struct OidcToken {
2936 /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
2937 /// to be used for generating OIDC token.
2938 /// The service account must be within the same project as the queue. The
2939 /// caller must have iam.serviceAccounts.actAs permission for the service
2940 /// account.
2941 pub service_account_email: std::string::String,
2942
2943 /// Audience to be used when generating OIDC token. If not specified, the URI
2944 /// specified in target will be used.
2945 pub audience: std::string::String,
2946
2947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2948}
2949
2950impl OidcToken {
2951 /// Creates a new default instance.
2952 pub fn new() -> Self {
2953 std::default::Default::default()
2954 }
2955
2956 /// Sets the value of [service_account_email][crate::model::OidcToken::service_account_email].
2957 ///
2958 /// # Example
2959 /// ```ignore,no_run
2960 /// # use google_cloud_tasks_v2::model::OidcToken;
2961 /// let x = OidcToken::new().set_service_account_email("example");
2962 /// ```
2963 pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
2964 mut self,
2965 v: T,
2966 ) -> Self {
2967 self.service_account_email = v.into();
2968 self
2969 }
2970
2971 /// Sets the value of [audience][crate::model::OidcToken::audience].
2972 ///
2973 /// # Example
2974 /// ```ignore,no_run
2975 /// # use google_cloud_tasks_v2::model::OidcToken;
2976 /// let x = OidcToken::new().set_audience("example");
2977 /// ```
2978 pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2979 self.audience = v.into();
2980 self
2981 }
2982}
2983
2984impl wkt::message::Message for OidcToken {
2985 fn typename() -> &'static str {
2986 "type.googleapis.com/google.cloud.tasks.v2.OidcToken"
2987 }
2988}
2989
2990/// A unit of scheduled work.
2991#[derive(Clone, Default, PartialEq)]
2992#[non_exhaustive]
2993pub struct Task {
2994 /// Optionally caller-specified in
2995 /// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
2996 ///
2997 /// The task name.
2998 ///
2999 /// The task name must have the following format:
3000 /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
3001 ///
3002 /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
3003 /// hyphens (-), colons (:), or periods (.).
3004 /// For more information, see
3005 /// [Identifying
3006 /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
3007 /// * `LOCATION_ID` is the canonical ID for the task's location.
3008 /// The list of available locations can be obtained by calling
3009 /// [ListLocations][google.cloud.location.Locations.ListLocations].
3010 /// For more information, see <https://cloud.google.com/about/locations/>.
3011 /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
3012 /// hyphens (-). The maximum length is 100 characters.
3013 /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
3014 /// hyphens (-), or underscores (_). The maximum length is 500 characters.
3015 ///
3016 /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
3017 pub name: std::string::String,
3018
3019 /// The time when the task is scheduled to be attempted or retried.
3020 ///
3021 /// `schedule_time` will be truncated to the nearest microsecond.
3022 pub schedule_time: std::option::Option<wkt::Timestamp>,
3023
3024 /// Output only. The time that the task was created.
3025 ///
3026 /// `create_time` will be truncated to the nearest second.
3027 pub create_time: std::option::Option<wkt::Timestamp>,
3028
3029 /// The deadline for requests sent to the worker. If the worker does not
3030 /// respond by this deadline then the request is cancelled and the attempt
3031 /// is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the
3032 /// task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig].
3033 ///
3034 /// Note that when the request is cancelled, Cloud Tasks will stop listening
3035 /// for the response, but whether the worker stops processing depends on the
3036 /// worker. For example, if the worker is stuck, it may not react to cancelled
3037 /// requests.
3038 ///
3039 /// The default and maximum values depend on the type of request:
3040 ///
3041 /// * For [HTTP tasks][google.cloud.tasks.v2.HttpRequest], the default is 10
3042 /// minutes. The deadline
3043 /// must be in the interval [15 seconds, 30 minutes].
3044 ///
3045 /// * For [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest], 0
3046 /// indicates that the
3047 /// request has the default deadline. The default deadline depends on the
3048 /// [scaling
3049 /// type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling)
3050 /// of the service: 10 minutes for standard apps with automatic scaling, 24
3051 /// hours for standard apps with manual and basic scaling, and 60 minutes for
3052 /// flex apps. If the request deadline is set, it must be in the interval [15
3053 /// seconds, 24 hours 15 seconds]. Regardless of the task's
3054 /// `dispatch_deadline`, the app handler will not run for longer than than
3055 /// the service's timeout. We recommend setting the `dispatch_deadline` to
3056 /// at most a few seconds more than the app handler's timeout. For more
3057 /// information see
3058 /// [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts).
3059 ///
3060 ///
3061 /// `dispatch_deadline` will be truncated to the nearest millisecond. The
3062 /// deadline is an approximate deadline.
3063 ///
3064 /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
3065 /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
3066 /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
3067 pub dispatch_deadline: std::option::Option<wkt::Duration>,
3068
3069 /// Output only. The number of attempts dispatched.
3070 ///
3071 /// This count includes attempts which have been dispatched but haven't
3072 /// received a response.
3073 pub dispatch_count: i32,
3074
3075 /// Output only. The number of attempts which have received a response.
3076 pub response_count: i32,
3077
3078 /// Output only. The status of the task's first attempt.
3079 ///
3080 /// Only [dispatch_time][google.cloud.tasks.v2.Attempt.dispatch_time] will be
3081 /// set. The other [Attempt][google.cloud.tasks.v2.Attempt] information is not
3082 /// retained by Cloud Tasks.
3083 ///
3084 /// [google.cloud.tasks.v2.Attempt]: crate::model::Attempt
3085 /// [google.cloud.tasks.v2.Attempt.dispatch_time]: crate::model::Attempt::dispatch_time
3086 pub first_attempt: std::option::Option<crate::model::Attempt>,
3087
3088 /// Output only. The status of the task's last attempt.
3089 pub last_attempt: std::option::Option<crate::model::Attempt>,
3090
3091 /// Output only. The view specifies which subset of the
3092 /// [Task][google.cloud.tasks.v2.Task] has been returned.
3093 ///
3094 /// [google.cloud.tasks.v2.Task]: crate::model::Task
3095 pub view: crate::model::task::View,
3096
3097 /// Required. The message to send to the worker.
3098 pub message_type: std::option::Option<crate::model::task::MessageType>,
3099
3100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3101}
3102
3103impl Task {
3104 /// Creates a new default instance.
3105 pub fn new() -> Self {
3106 std::default::Default::default()
3107 }
3108
3109 /// Sets the value of [name][crate::model::Task::name].
3110 ///
3111 /// # Example
3112 /// ```ignore,no_run
3113 /// # use google_cloud_tasks_v2::model::Task;
3114 /// let x = Task::new().set_name("example");
3115 /// ```
3116 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3117 self.name = v.into();
3118 self
3119 }
3120
3121 /// Sets the value of [schedule_time][crate::model::Task::schedule_time].
3122 ///
3123 /// # Example
3124 /// ```ignore,no_run
3125 /// # use google_cloud_tasks_v2::model::Task;
3126 /// use wkt::Timestamp;
3127 /// let x = Task::new().set_schedule_time(Timestamp::default()/* use setters */);
3128 /// ```
3129 pub fn set_schedule_time<T>(mut self, v: T) -> Self
3130 where
3131 T: std::convert::Into<wkt::Timestamp>,
3132 {
3133 self.schedule_time = std::option::Option::Some(v.into());
3134 self
3135 }
3136
3137 /// Sets or clears the value of [schedule_time][crate::model::Task::schedule_time].
3138 ///
3139 /// # Example
3140 /// ```ignore,no_run
3141 /// # use google_cloud_tasks_v2::model::Task;
3142 /// use wkt::Timestamp;
3143 /// let x = Task::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
3144 /// let x = Task::new().set_or_clear_schedule_time(None::<Timestamp>);
3145 /// ```
3146 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
3147 where
3148 T: std::convert::Into<wkt::Timestamp>,
3149 {
3150 self.schedule_time = v.map(|x| x.into());
3151 self
3152 }
3153
3154 /// Sets the value of [create_time][crate::model::Task::create_time].
3155 ///
3156 /// # Example
3157 /// ```ignore,no_run
3158 /// # use google_cloud_tasks_v2::model::Task;
3159 /// use wkt::Timestamp;
3160 /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
3161 /// ```
3162 pub fn set_create_time<T>(mut self, v: T) -> Self
3163 where
3164 T: std::convert::Into<wkt::Timestamp>,
3165 {
3166 self.create_time = std::option::Option::Some(v.into());
3167 self
3168 }
3169
3170 /// Sets or clears the value of [create_time][crate::model::Task::create_time].
3171 ///
3172 /// # Example
3173 /// ```ignore,no_run
3174 /// # use google_cloud_tasks_v2::model::Task;
3175 /// use wkt::Timestamp;
3176 /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3177 /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
3178 /// ```
3179 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3180 where
3181 T: std::convert::Into<wkt::Timestamp>,
3182 {
3183 self.create_time = v.map(|x| x.into());
3184 self
3185 }
3186
3187 /// Sets the value of [dispatch_deadline][crate::model::Task::dispatch_deadline].
3188 ///
3189 /// # Example
3190 /// ```ignore,no_run
3191 /// # use google_cloud_tasks_v2::model::Task;
3192 /// use wkt::Duration;
3193 /// let x = Task::new().set_dispatch_deadline(Duration::default()/* use setters */);
3194 /// ```
3195 pub fn set_dispatch_deadline<T>(mut self, v: T) -> Self
3196 where
3197 T: std::convert::Into<wkt::Duration>,
3198 {
3199 self.dispatch_deadline = std::option::Option::Some(v.into());
3200 self
3201 }
3202
3203 /// Sets or clears the value of [dispatch_deadline][crate::model::Task::dispatch_deadline].
3204 ///
3205 /// # Example
3206 /// ```ignore,no_run
3207 /// # use google_cloud_tasks_v2::model::Task;
3208 /// use wkt::Duration;
3209 /// let x = Task::new().set_or_clear_dispatch_deadline(Some(Duration::default()/* use setters */));
3210 /// let x = Task::new().set_or_clear_dispatch_deadline(None::<Duration>);
3211 /// ```
3212 pub fn set_or_clear_dispatch_deadline<T>(mut self, v: std::option::Option<T>) -> Self
3213 where
3214 T: std::convert::Into<wkt::Duration>,
3215 {
3216 self.dispatch_deadline = v.map(|x| x.into());
3217 self
3218 }
3219
3220 /// Sets the value of [dispatch_count][crate::model::Task::dispatch_count].
3221 ///
3222 /// # Example
3223 /// ```ignore,no_run
3224 /// # use google_cloud_tasks_v2::model::Task;
3225 /// let x = Task::new().set_dispatch_count(42);
3226 /// ```
3227 pub fn set_dispatch_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3228 self.dispatch_count = v.into();
3229 self
3230 }
3231
3232 /// Sets the value of [response_count][crate::model::Task::response_count].
3233 ///
3234 /// # Example
3235 /// ```ignore,no_run
3236 /// # use google_cloud_tasks_v2::model::Task;
3237 /// let x = Task::new().set_response_count(42);
3238 /// ```
3239 pub fn set_response_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3240 self.response_count = v.into();
3241 self
3242 }
3243
3244 /// Sets the value of [first_attempt][crate::model::Task::first_attempt].
3245 ///
3246 /// # Example
3247 /// ```ignore,no_run
3248 /// # use google_cloud_tasks_v2::model::Task;
3249 /// use google_cloud_tasks_v2::model::Attempt;
3250 /// let x = Task::new().set_first_attempt(Attempt::default()/* use setters */);
3251 /// ```
3252 pub fn set_first_attempt<T>(mut self, v: T) -> Self
3253 where
3254 T: std::convert::Into<crate::model::Attempt>,
3255 {
3256 self.first_attempt = std::option::Option::Some(v.into());
3257 self
3258 }
3259
3260 /// Sets or clears the value of [first_attempt][crate::model::Task::first_attempt].
3261 ///
3262 /// # Example
3263 /// ```ignore,no_run
3264 /// # use google_cloud_tasks_v2::model::Task;
3265 /// use google_cloud_tasks_v2::model::Attempt;
3266 /// let x = Task::new().set_or_clear_first_attempt(Some(Attempt::default()/* use setters */));
3267 /// let x = Task::new().set_or_clear_first_attempt(None::<Attempt>);
3268 /// ```
3269 pub fn set_or_clear_first_attempt<T>(mut self, v: std::option::Option<T>) -> Self
3270 where
3271 T: std::convert::Into<crate::model::Attempt>,
3272 {
3273 self.first_attempt = v.map(|x| x.into());
3274 self
3275 }
3276
3277 /// Sets the value of [last_attempt][crate::model::Task::last_attempt].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_tasks_v2::model::Task;
3282 /// use google_cloud_tasks_v2::model::Attempt;
3283 /// let x = Task::new().set_last_attempt(Attempt::default()/* use setters */);
3284 /// ```
3285 pub fn set_last_attempt<T>(mut self, v: T) -> Self
3286 where
3287 T: std::convert::Into<crate::model::Attempt>,
3288 {
3289 self.last_attempt = std::option::Option::Some(v.into());
3290 self
3291 }
3292
3293 /// Sets or clears the value of [last_attempt][crate::model::Task::last_attempt].
3294 ///
3295 /// # Example
3296 /// ```ignore,no_run
3297 /// # use google_cloud_tasks_v2::model::Task;
3298 /// use google_cloud_tasks_v2::model::Attempt;
3299 /// let x = Task::new().set_or_clear_last_attempt(Some(Attempt::default()/* use setters */));
3300 /// let x = Task::new().set_or_clear_last_attempt(None::<Attempt>);
3301 /// ```
3302 pub fn set_or_clear_last_attempt<T>(mut self, v: std::option::Option<T>) -> Self
3303 where
3304 T: std::convert::Into<crate::model::Attempt>,
3305 {
3306 self.last_attempt = v.map(|x| x.into());
3307 self
3308 }
3309
3310 /// Sets the value of [view][crate::model::Task::view].
3311 ///
3312 /// # Example
3313 /// ```ignore,no_run
3314 /// # use google_cloud_tasks_v2::model::Task;
3315 /// use google_cloud_tasks_v2::model::task::View;
3316 /// let x0 = Task::new().set_view(View::Basic);
3317 /// let x1 = Task::new().set_view(View::Full);
3318 /// ```
3319 pub fn set_view<T: std::convert::Into<crate::model::task::View>>(mut self, v: T) -> Self {
3320 self.view = v.into();
3321 self
3322 }
3323
3324 /// Sets the value of [message_type][crate::model::Task::message_type].
3325 ///
3326 /// Note that all the setters affecting `message_type` are mutually
3327 /// exclusive.
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_tasks_v2::model::Task;
3332 /// use google_cloud_tasks_v2::model::AppEngineHttpRequest;
3333 /// let x = Task::new().set_message_type(Some(
3334 /// google_cloud_tasks_v2::model::task::MessageType::AppEngineHttpRequest(AppEngineHttpRequest::default().into())));
3335 /// ```
3336 pub fn set_message_type<
3337 T: std::convert::Into<std::option::Option<crate::model::task::MessageType>>,
3338 >(
3339 mut self,
3340 v: T,
3341 ) -> Self {
3342 self.message_type = v.into();
3343 self
3344 }
3345
3346 /// The value of [message_type][crate::model::Task::message_type]
3347 /// if it holds a `AppEngineHttpRequest`, `None` if the field is not set or
3348 /// holds a different branch.
3349 pub fn app_engine_http_request(
3350 &self,
3351 ) -> std::option::Option<&std::boxed::Box<crate::model::AppEngineHttpRequest>> {
3352 #[allow(unreachable_patterns)]
3353 self.message_type.as_ref().and_then(|v| match v {
3354 crate::model::task::MessageType::AppEngineHttpRequest(v) => {
3355 std::option::Option::Some(v)
3356 }
3357 _ => std::option::Option::None,
3358 })
3359 }
3360
3361 /// Sets the value of [message_type][crate::model::Task::message_type]
3362 /// to hold a `AppEngineHttpRequest`.
3363 ///
3364 /// Note that all the setters affecting `message_type` are
3365 /// mutually exclusive.
3366 ///
3367 /// # Example
3368 /// ```ignore,no_run
3369 /// # use google_cloud_tasks_v2::model::Task;
3370 /// use google_cloud_tasks_v2::model::AppEngineHttpRequest;
3371 /// let x = Task::new().set_app_engine_http_request(AppEngineHttpRequest::default()/* use setters */);
3372 /// assert!(x.app_engine_http_request().is_some());
3373 /// assert!(x.http_request().is_none());
3374 /// ```
3375 pub fn set_app_engine_http_request<
3376 T: std::convert::Into<std::boxed::Box<crate::model::AppEngineHttpRequest>>,
3377 >(
3378 mut self,
3379 v: T,
3380 ) -> Self {
3381 self.message_type = std::option::Option::Some(
3382 crate::model::task::MessageType::AppEngineHttpRequest(v.into()),
3383 );
3384 self
3385 }
3386
3387 /// The value of [message_type][crate::model::Task::message_type]
3388 /// if it holds a `HttpRequest`, `None` if the field is not set or
3389 /// holds a different branch.
3390 pub fn http_request(&self) -> std::option::Option<&std::boxed::Box<crate::model::HttpRequest>> {
3391 #[allow(unreachable_patterns)]
3392 self.message_type.as_ref().and_then(|v| match v {
3393 crate::model::task::MessageType::HttpRequest(v) => std::option::Option::Some(v),
3394 _ => std::option::Option::None,
3395 })
3396 }
3397
3398 /// Sets the value of [message_type][crate::model::Task::message_type]
3399 /// to hold a `HttpRequest`.
3400 ///
3401 /// Note that all the setters affecting `message_type` are
3402 /// mutually exclusive.
3403 ///
3404 /// # Example
3405 /// ```ignore,no_run
3406 /// # use google_cloud_tasks_v2::model::Task;
3407 /// use google_cloud_tasks_v2::model::HttpRequest;
3408 /// let x = Task::new().set_http_request(HttpRequest::default()/* use setters */);
3409 /// assert!(x.http_request().is_some());
3410 /// assert!(x.app_engine_http_request().is_none());
3411 /// ```
3412 pub fn set_http_request<T: std::convert::Into<std::boxed::Box<crate::model::HttpRequest>>>(
3413 mut self,
3414 v: T,
3415 ) -> Self {
3416 self.message_type =
3417 std::option::Option::Some(crate::model::task::MessageType::HttpRequest(v.into()));
3418 self
3419 }
3420}
3421
3422impl wkt::message::Message for Task {
3423 fn typename() -> &'static str {
3424 "type.googleapis.com/google.cloud.tasks.v2.Task"
3425 }
3426}
3427
3428/// Defines additional types related to [Task].
3429pub mod task {
3430 #[allow(unused_imports)]
3431 use super::*;
3432
3433 /// The view specifies a subset of [Task][google.cloud.tasks.v2.Task] data.
3434 ///
3435 /// When a task is returned in a response, not all
3436 /// information is retrieved by default because some data, such as
3437 /// payloads, might be desirable to return only when needed because
3438 /// of its large size or because of the sensitivity of data that it
3439 /// contains.
3440 ///
3441 /// [google.cloud.tasks.v2.Task]: crate::model::Task
3442 ///
3443 /// # Working with unknown values
3444 ///
3445 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3446 /// additional enum variants at any time. Adding new variants is not considered
3447 /// a breaking change. Applications should write their code in anticipation of:
3448 ///
3449 /// - New values appearing in future releases of the client library, **and**
3450 /// - New values received dynamically, without application changes.
3451 ///
3452 /// Please consult the [Working with enums] section in the user guide for some
3453 /// guidelines.
3454 ///
3455 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3456 #[derive(Clone, Debug, PartialEq)]
3457 #[non_exhaustive]
3458 pub enum View {
3459 /// Unspecified. Defaults to BASIC.
3460 Unspecified,
3461 /// The basic view omits fields which can be large or can contain
3462 /// sensitive data.
3463 ///
3464 /// This view does not include the
3465 /// [body in
3466 /// AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest.body].
3467 /// Bodies are desirable to return only when needed, because they
3468 /// can be large and because of the sensitivity of the data that you
3469 /// choose to store in it.
3470 ///
3471 /// [google.cloud.tasks.v2.AppEngineHttpRequest.body]: crate::model::AppEngineHttpRequest::body
3472 Basic,
3473 /// All information is returned.
3474 ///
3475 /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
3476 /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
3477 /// permission on the [Queue][google.cloud.tasks.v2.Queue] resource.
3478 ///
3479 /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
3480 /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
3481 Full,
3482 /// If set, the enum was initialized with an unknown value.
3483 ///
3484 /// Applications can examine the value using [View::value] or
3485 /// [View::name].
3486 UnknownValue(view::UnknownValue),
3487 }
3488
3489 #[doc(hidden)]
3490 pub mod view {
3491 #[allow(unused_imports)]
3492 use super::*;
3493 #[derive(Clone, Debug, PartialEq)]
3494 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3495 }
3496
3497 impl View {
3498 /// Gets the enum value.
3499 ///
3500 /// Returns `None` if the enum contains an unknown value deserialized from
3501 /// the string representation of enums.
3502 pub fn value(&self) -> std::option::Option<i32> {
3503 match self {
3504 Self::Unspecified => std::option::Option::Some(0),
3505 Self::Basic => std::option::Option::Some(1),
3506 Self::Full => std::option::Option::Some(2),
3507 Self::UnknownValue(u) => u.0.value(),
3508 }
3509 }
3510
3511 /// Gets the enum value as a string.
3512 ///
3513 /// Returns `None` if the enum contains an unknown value deserialized from
3514 /// the integer representation of enums.
3515 pub fn name(&self) -> std::option::Option<&str> {
3516 match self {
3517 Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
3518 Self::Basic => std::option::Option::Some("BASIC"),
3519 Self::Full => std::option::Option::Some("FULL"),
3520 Self::UnknownValue(u) => u.0.name(),
3521 }
3522 }
3523 }
3524
3525 impl std::default::Default for View {
3526 fn default() -> Self {
3527 use std::convert::From;
3528 Self::from(0)
3529 }
3530 }
3531
3532 impl std::fmt::Display for View {
3533 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3534 wkt::internal::display_enum(f, self.name(), self.value())
3535 }
3536 }
3537
3538 impl std::convert::From<i32> for View {
3539 fn from(value: i32) -> Self {
3540 match value {
3541 0 => Self::Unspecified,
3542 1 => Self::Basic,
3543 2 => Self::Full,
3544 _ => Self::UnknownValue(view::UnknownValue(
3545 wkt::internal::UnknownEnumValue::Integer(value),
3546 )),
3547 }
3548 }
3549 }
3550
3551 impl std::convert::From<&str> for View {
3552 fn from(value: &str) -> Self {
3553 use std::string::ToString;
3554 match value {
3555 "VIEW_UNSPECIFIED" => Self::Unspecified,
3556 "BASIC" => Self::Basic,
3557 "FULL" => Self::Full,
3558 _ => Self::UnknownValue(view::UnknownValue(
3559 wkt::internal::UnknownEnumValue::String(value.to_string()),
3560 )),
3561 }
3562 }
3563 }
3564
3565 impl serde::ser::Serialize for View {
3566 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3567 where
3568 S: serde::Serializer,
3569 {
3570 match self {
3571 Self::Unspecified => serializer.serialize_i32(0),
3572 Self::Basic => serializer.serialize_i32(1),
3573 Self::Full => serializer.serialize_i32(2),
3574 Self::UnknownValue(u) => u.0.serialize(serializer),
3575 }
3576 }
3577 }
3578
3579 impl<'de> serde::de::Deserialize<'de> for View {
3580 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3581 where
3582 D: serde::Deserializer<'de>,
3583 {
3584 deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
3585 ".google.cloud.tasks.v2.Task.View",
3586 ))
3587 }
3588 }
3589
3590 /// Required. The message to send to the worker.
3591 #[derive(Clone, Debug, PartialEq)]
3592 #[non_exhaustive]
3593 pub enum MessageType {
3594 /// HTTP request that is sent to the App Engine app handler.
3595 ///
3596 /// An App Engine task is a task that has
3597 /// [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set.
3598 ///
3599 /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
3600 AppEngineHttpRequest(std::boxed::Box<crate::model::AppEngineHttpRequest>),
3601 /// HTTP request that is sent to the worker.
3602 ///
3603 /// An HTTP task is a task that has
3604 /// [HttpRequest][google.cloud.tasks.v2.HttpRequest] set.
3605 ///
3606 /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
3607 HttpRequest(std::boxed::Box<crate::model::HttpRequest>),
3608 }
3609}
3610
3611/// The status of a task attempt.
3612#[derive(Clone, Default, PartialEq)]
3613#[non_exhaustive]
3614pub struct Attempt {
3615 /// Output only. The time that this attempt was scheduled.
3616 ///
3617 /// `schedule_time` will be truncated to the nearest microsecond.
3618 pub schedule_time: std::option::Option<wkt::Timestamp>,
3619
3620 /// Output only. The time that this attempt was dispatched.
3621 ///
3622 /// `dispatch_time` will be truncated to the nearest microsecond.
3623 pub dispatch_time: std::option::Option<wkt::Timestamp>,
3624
3625 /// Output only. The time that this attempt response was received.
3626 ///
3627 /// `response_time` will be truncated to the nearest microsecond.
3628 pub response_time: std::option::Option<wkt::Timestamp>,
3629
3630 /// Output only. The response from the worker for this attempt.
3631 ///
3632 /// If `response_time` is unset, then the task has not been attempted or is
3633 /// currently running and the `response_status` field is meaningless.
3634 pub response_status: std::option::Option<google_cloud_rpc::model::Status>,
3635
3636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3637}
3638
3639impl Attempt {
3640 /// Creates a new default instance.
3641 pub fn new() -> Self {
3642 std::default::Default::default()
3643 }
3644
3645 /// Sets the value of [schedule_time][crate::model::Attempt::schedule_time].
3646 ///
3647 /// # Example
3648 /// ```ignore,no_run
3649 /// # use google_cloud_tasks_v2::model::Attempt;
3650 /// use wkt::Timestamp;
3651 /// let x = Attempt::new().set_schedule_time(Timestamp::default()/* use setters */);
3652 /// ```
3653 pub fn set_schedule_time<T>(mut self, v: T) -> Self
3654 where
3655 T: std::convert::Into<wkt::Timestamp>,
3656 {
3657 self.schedule_time = std::option::Option::Some(v.into());
3658 self
3659 }
3660
3661 /// Sets or clears the value of [schedule_time][crate::model::Attempt::schedule_time].
3662 ///
3663 /// # Example
3664 /// ```ignore,no_run
3665 /// # use google_cloud_tasks_v2::model::Attempt;
3666 /// use wkt::Timestamp;
3667 /// let x = Attempt::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
3668 /// let x = Attempt::new().set_or_clear_schedule_time(None::<Timestamp>);
3669 /// ```
3670 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
3671 where
3672 T: std::convert::Into<wkt::Timestamp>,
3673 {
3674 self.schedule_time = v.map(|x| x.into());
3675 self
3676 }
3677
3678 /// Sets the value of [dispatch_time][crate::model::Attempt::dispatch_time].
3679 ///
3680 /// # Example
3681 /// ```ignore,no_run
3682 /// # use google_cloud_tasks_v2::model::Attempt;
3683 /// use wkt::Timestamp;
3684 /// let x = Attempt::new().set_dispatch_time(Timestamp::default()/* use setters */);
3685 /// ```
3686 pub fn set_dispatch_time<T>(mut self, v: T) -> Self
3687 where
3688 T: std::convert::Into<wkt::Timestamp>,
3689 {
3690 self.dispatch_time = std::option::Option::Some(v.into());
3691 self
3692 }
3693
3694 /// Sets or clears the value of [dispatch_time][crate::model::Attempt::dispatch_time].
3695 ///
3696 /// # Example
3697 /// ```ignore,no_run
3698 /// # use google_cloud_tasks_v2::model::Attempt;
3699 /// use wkt::Timestamp;
3700 /// let x = Attempt::new().set_or_clear_dispatch_time(Some(Timestamp::default()/* use setters */));
3701 /// let x = Attempt::new().set_or_clear_dispatch_time(None::<Timestamp>);
3702 /// ```
3703 pub fn set_or_clear_dispatch_time<T>(mut self, v: std::option::Option<T>) -> Self
3704 where
3705 T: std::convert::Into<wkt::Timestamp>,
3706 {
3707 self.dispatch_time = v.map(|x| x.into());
3708 self
3709 }
3710
3711 /// Sets the value of [response_time][crate::model::Attempt::response_time].
3712 ///
3713 /// # Example
3714 /// ```ignore,no_run
3715 /// # use google_cloud_tasks_v2::model::Attempt;
3716 /// use wkt::Timestamp;
3717 /// let x = Attempt::new().set_response_time(Timestamp::default()/* use setters */);
3718 /// ```
3719 pub fn set_response_time<T>(mut self, v: T) -> Self
3720 where
3721 T: std::convert::Into<wkt::Timestamp>,
3722 {
3723 self.response_time = std::option::Option::Some(v.into());
3724 self
3725 }
3726
3727 /// Sets or clears the value of [response_time][crate::model::Attempt::response_time].
3728 ///
3729 /// # Example
3730 /// ```ignore,no_run
3731 /// # use google_cloud_tasks_v2::model::Attempt;
3732 /// use wkt::Timestamp;
3733 /// let x = Attempt::new().set_or_clear_response_time(Some(Timestamp::default()/* use setters */));
3734 /// let x = Attempt::new().set_or_clear_response_time(None::<Timestamp>);
3735 /// ```
3736 pub fn set_or_clear_response_time<T>(mut self, v: std::option::Option<T>) -> Self
3737 where
3738 T: std::convert::Into<wkt::Timestamp>,
3739 {
3740 self.response_time = v.map(|x| x.into());
3741 self
3742 }
3743
3744 /// Sets the value of [response_status][crate::model::Attempt::response_status].
3745 ///
3746 /// # Example
3747 /// ```ignore,no_run
3748 /// # use google_cloud_tasks_v2::model::Attempt;
3749 /// use google_cloud_rpc::model::Status;
3750 /// let x = Attempt::new().set_response_status(Status::default()/* use setters */);
3751 /// ```
3752 pub fn set_response_status<T>(mut self, v: T) -> Self
3753 where
3754 T: std::convert::Into<google_cloud_rpc::model::Status>,
3755 {
3756 self.response_status = std::option::Option::Some(v.into());
3757 self
3758 }
3759
3760 /// Sets or clears the value of [response_status][crate::model::Attempt::response_status].
3761 ///
3762 /// # Example
3763 /// ```ignore,no_run
3764 /// # use google_cloud_tasks_v2::model::Attempt;
3765 /// use google_cloud_rpc::model::Status;
3766 /// let x = Attempt::new().set_or_clear_response_status(Some(Status::default()/* use setters */));
3767 /// let x = Attempt::new().set_or_clear_response_status(None::<Status>);
3768 /// ```
3769 pub fn set_or_clear_response_status<T>(mut self, v: std::option::Option<T>) -> Self
3770 where
3771 T: std::convert::Into<google_cloud_rpc::model::Status>,
3772 {
3773 self.response_status = v.map(|x| x.into());
3774 self
3775 }
3776}
3777
3778impl wkt::message::Message for Attempt {
3779 fn typename() -> &'static str {
3780 "type.googleapis.com/google.cloud.tasks.v2.Attempt"
3781 }
3782}
3783
3784/// The HTTP method used to deliver the task.
3785///
3786/// # Working with unknown values
3787///
3788/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3789/// additional enum variants at any time. Adding new variants is not considered
3790/// a breaking change. Applications should write their code in anticipation of:
3791///
3792/// - New values appearing in future releases of the client library, **and**
3793/// - New values received dynamically, without application changes.
3794///
3795/// Please consult the [Working with enums] section in the user guide for some
3796/// guidelines.
3797///
3798/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3799#[derive(Clone, Debug, PartialEq)]
3800#[non_exhaustive]
3801pub enum HttpMethod {
3802 /// HTTP method unspecified
3803 Unspecified,
3804 /// HTTP POST
3805 Post,
3806 /// HTTP GET
3807 Get,
3808 /// HTTP HEAD
3809 Head,
3810 /// HTTP PUT
3811 Put,
3812 /// HTTP DELETE
3813 Delete,
3814 /// HTTP PATCH
3815 Patch,
3816 /// HTTP OPTIONS
3817 Options,
3818 /// If set, the enum was initialized with an unknown value.
3819 ///
3820 /// Applications can examine the value using [HttpMethod::value] or
3821 /// [HttpMethod::name].
3822 UnknownValue(http_method::UnknownValue),
3823}
3824
3825#[doc(hidden)]
3826pub mod http_method {
3827 #[allow(unused_imports)]
3828 use super::*;
3829 #[derive(Clone, Debug, PartialEq)]
3830 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3831}
3832
3833impl HttpMethod {
3834 /// Gets the enum value.
3835 ///
3836 /// Returns `None` if the enum contains an unknown value deserialized from
3837 /// the string representation of enums.
3838 pub fn value(&self) -> std::option::Option<i32> {
3839 match self {
3840 Self::Unspecified => std::option::Option::Some(0),
3841 Self::Post => std::option::Option::Some(1),
3842 Self::Get => std::option::Option::Some(2),
3843 Self::Head => std::option::Option::Some(3),
3844 Self::Put => std::option::Option::Some(4),
3845 Self::Delete => std::option::Option::Some(5),
3846 Self::Patch => std::option::Option::Some(6),
3847 Self::Options => std::option::Option::Some(7),
3848 Self::UnknownValue(u) => u.0.value(),
3849 }
3850 }
3851
3852 /// Gets the enum value as a string.
3853 ///
3854 /// Returns `None` if the enum contains an unknown value deserialized from
3855 /// the integer representation of enums.
3856 pub fn name(&self) -> std::option::Option<&str> {
3857 match self {
3858 Self::Unspecified => std::option::Option::Some("HTTP_METHOD_UNSPECIFIED"),
3859 Self::Post => std::option::Option::Some("POST"),
3860 Self::Get => std::option::Option::Some("GET"),
3861 Self::Head => std::option::Option::Some("HEAD"),
3862 Self::Put => std::option::Option::Some("PUT"),
3863 Self::Delete => std::option::Option::Some("DELETE"),
3864 Self::Patch => std::option::Option::Some("PATCH"),
3865 Self::Options => std::option::Option::Some("OPTIONS"),
3866 Self::UnknownValue(u) => u.0.name(),
3867 }
3868 }
3869}
3870
3871impl std::default::Default for HttpMethod {
3872 fn default() -> Self {
3873 use std::convert::From;
3874 Self::from(0)
3875 }
3876}
3877
3878impl std::fmt::Display for HttpMethod {
3879 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3880 wkt::internal::display_enum(f, self.name(), self.value())
3881 }
3882}
3883
3884impl std::convert::From<i32> for HttpMethod {
3885 fn from(value: i32) -> Self {
3886 match value {
3887 0 => Self::Unspecified,
3888 1 => Self::Post,
3889 2 => Self::Get,
3890 3 => Self::Head,
3891 4 => Self::Put,
3892 5 => Self::Delete,
3893 6 => Self::Patch,
3894 7 => Self::Options,
3895 _ => Self::UnknownValue(http_method::UnknownValue(
3896 wkt::internal::UnknownEnumValue::Integer(value),
3897 )),
3898 }
3899 }
3900}
3901
3902impl std::convert::From<&str> for HttpMethod {
3903 fn from(value: &str) -> Self {
3904 use std::string::ToString;
3905 match value {
3906 "HTTP_METHOD_UNSPECIFIED" => Self::Unspecified,
3907 "POST" => Self::Post,
3908 "GET" => Self::Get,
3909 "HEAD" => Self::Head,
3910 "PUT" => Self::Put,
3911 "DELETE" => Self::Delete,
3912 "PATCH" => Self::Patch,
3913 "OPTIONS" => Self::Options,
3914 _ => Self::UnknownValue(http_method::UnknownValue(
3915 wkt::internal::UnknownEnumValue::String(value.to_string()),
3916 )),
3917 }
3918 }
3919}
3920
3921impl serde::ser::Serialize for HttpMethod {
3922 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3923 where
3924 S: serde::Serializer,
3925 {
3926 match self {
3927 Self::Unspecified => serializer.serialize_i32(0),
3928 Self::Post => serializer.serialize_i32(1),
3929 Self::Get => serializer.serialize_i32(2),
3930 Self::Head => serializer.serialize_i32(3),
3931 Self::Put => serializer.serialize_i32(4),
3932 Self::Delete => serializer.serialize_i32(5),
3933 Self::Patch => serializer.serialize_i32(6),
3934 Self::Options => serializer.serialize_i32(7),
3935 Self::UnknownValue(u) => u.0.serialize(serializer),
3936 }
3937 }
3938}
3939
3940impl<'de> serde::de::Deserialize<'de> for HttpMethod {
3941 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3942 where
3943 D: serde::Deserializer<'de>,
3944 {
3945 deserializer.deserialize_any(wkt::internal::EnumVisitor::<HttpMethod>::new(
3946 ".google.cloud.tasks.v2.HttpMethod",
3947 ))
3948 }
3949}