Skip to main content

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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_location;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate google_cloud_rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// Request message for
43/// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
44///
45/// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
46#[derive(Clone, Default, PartialEq)]
47#[non_exhaustive]
48pub struct ListQueuesRequest {
49    /// Required. The location name.
50    /// For example: `projects/PROJECT_ID/locations/LOCATION_ID`
51    pub parent: std::string::String,
52
53    /// `filter` can be used to specify a subset of queues. Any
54    /// [Queue][google.cloud.tasks.v2.Queue] field can be used as a filter and
55    /// several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
56    /// filter syntax is the same as described in [Stackdriver's Advanced Logs
57    /// Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
58    ///
59    /// Sample filter "state: PAUSED".
60    ///
61    /// Note that using filters might cause fewer queues than the
62    /// requested page_size to be returned.
63    ///
64    /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
65    pub filter: std::string::String,
66
67    /// Requested page size.
68    ///
69    /// The maximum page size is 9800. If unspecified, the page size will
70    /// be the maximum. Fewer queues than requested might be returned,
71    /// even if more queues exist; use the
72    /// [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
73    /// in the response to determine if more queues exist.
74    ///
75    /// [google.cloud.tasks.v2.ListQueuesResponse.next_page_token]: crate::model::ListQueuesResponse::next_page_token
76    pub page_size: i32,
77
78    /// A token identifying the page of results to return.
79    ///
80    /// To request the first page results, page_token must be empty. To
81    /// request the next page of results, page_token must be the value of
82    /// [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
83    /// returned from the previous call to
84    /// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] method. It is an
85    /// error to switch the value of the
86    /// [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating
87    /// through pages.
88    ///
89    /// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
90    /// [google.cloud.tasks.v2.ListQueuesRequest.filter]: crate::model::ListQueuesRequest::filter
91    /// [google.cloud.tasks.v2.ListQueuesResponse.next_page_token]: crate::model::ListQueuesResponse::next_page_token
92    pub page_token: std::string::String,
93
94    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
95}
96
97impl ListQueuesRequest {
98    /// Creates a new default instance.
99    pub fn new() -> Self {
100        std::default::Default::default()
101    }
102
103    /// Sets the value of [parent][crate::model::ListQueuesRequest::parent].
104    ///
105    /// # Example
106    /// ```ignore,no_run
107    /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
108    /// # let project_id = "project_id";
109    /// # let location_id = "location_id";
110    /// let x = ListQueuesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
111    /// ```
112    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
113        self.parent = v.into();
114        self
115    }
116
117    /// Sets the value of [filter][crate::model::ListQueuesRequest::filter].
118    ///
119    /// # Example
120    /// ```ignore,no_run
121    /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
122    /// let x = ListQueuesRequest::new().set_filter("example");
123    /// ```
124    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
125        self.filter = v.into();
126        self
127    }
128
129    /// Sets the value of [page_size][crate::model::ListQueuesRequest::page_size].
130    ///
131    /// # Example
132    /// ```ignore,no_run
133    /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
134    /// let x = ListQueuesRequest::new().set_page_size(42);
135    /// ```
136    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
137        self.page_size = v.into();
138        self
139    }
140
141    /// Sets the value of [page_token][crate::model::ListQueuesRequest::page_token].
142    ///
143    /// # Example
144    /// ```ignore,no_run
145    /// # use google_cloud_tasks_v2::model::ListQueuesRequest;
146    /// let x = ListQueuesRequest::new().set_page_token("example");
147    /// ```
148    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
149        self.page_token = v.into();
150        self
151    }
152}
153
154impl wkt::message::Message for ListQueuesRequest {
155    fn typename() -> &'static str {
156        "type.googleapis.com/google.cloud.tasks.v2.ListQueuesRequest"
157    }
158}
159
160/// Response message for
161/// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
162///
163/// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
164#[derive(Clone, Default, PartialEq)]
165#[non_exhaustive]
166pub struct ListQueuesResponse {
167    /// The list of queues.
168    pub queues: std::vec::Vec<crate::model::Queue>,
169
170    /// A token to retrieve next page of results.
171    ///
172    /// To return the next page of results, call
173    /// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] with this value
174    /// as the [page_token][google.cloud.tasks.v2.ListQueuesRequest.page_token].
175    ///
176    /// If the next_page_token is empty, there are no more results.
177    ///
178    /// The page token is valid for only 2 hours.
179    ///
180    /// [google.cloud.tasks.v2.CloudTasks.ListQueues]: crate::client::CloudTasks::list_queues
181    /// [google.cloud.tasks.v2.ListQueuesRequest.page_token]: crate::model::ListQueuesRequest::page_token
182    pub next_page_token: std::string::String,
183
184    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
185}
186
187impl ListQueuesResponse {
188    /// Creates a new default instance.
189    pub fn new() -> Self {
190        std::default::Default::default()
191    }
192
193    /// Sets the value of [queues][crate::model::ListQueuesResponse::queues].
194    ///
195    /// # Example
196    /// ```ignore,no_run
197    /// # use google_cloud_tasks_v2::model::ListQueuesResponse;
198    /// use google_cloud_tasks_v2::model::Queue;
199    /// let x = ListQueuesResponse::new()
200    ///     .set_queues([
201    ///         Queue::default()/* use setters */,
202    ///         Queue::default()/* use (different) setters */,
203    ///     ]);
204    /// ```
205    pub fn set_queues<T, V>(mut self, v: T) -> Self
206    where
207        T: std::iter::IntoIterator<Item = V>,
208        V: std::convert::Into<crate::model::Queue>,
209    {
210        use std::iter::Iterator;
211        self.queues = v.into_iter().map(|i| i.into()).collect();
212        self
213    }
214
215    /// Sets the value of [next_page_token][crate::model::ListQueuesResponse::next_page_token].
216    ///
217    /// # Example
218    /// ```ignore,no_run
219    /// # use google_cloud_tasks_v2::model::ListQueuesResponse;
220    /// let x = ListQueuesResponse::new().set_next_page_token("example");
221    /// ```
222    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
223        self.next_page_token = v.into();
224        self
225    }
226}
227
228impl wkt::message::Message for ListQueuesResponse {
229    fn typename() -> &'static str {
230        "type.googleapis.com/google.cloud.tasks.v2.ListQueuesResponse"
231    }
232}
233
234#[doc(hidden)]
235impl google_cloud_gax::paginator::internal::PageableResponse for ListQueuesResponse {
236    type PageItem = crate::model::Queue;
237
238    fn items(self) -> std::vec::Vec<Self::PageItem> {
239        self.queues
240    }
241
242    fn next_page_token(&self) -> std::string::String {
243        use std::clone::Clone;
244        self.next_page_token.clone()
245    }
246}
247
248/// Request message for [GetQueue][google.cloud.tasks.v2.CloudTasks.GetQueue].
249///
250/// [google.cloud.tasks.v2.CloudTasks.GetQueue]: crate::client::CloudTasks::get_queue
251#[derive(Clone, Default, PartialEq)]
252#[non_exhaustive]
253pub struct GetQueueRequest {
254    /// Required. The resource name of the queue. For example:
255    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
256    pub name: std::string::String,
257
258    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
259}
260
261impl GetQueueRequest {
262    /// Creates a new default instance.
263    pub fn new() -> Self {
264        std::default::Default::default()
265    }
266
267    /// Sets the value of [name][crate::model::GetQueueRequest::name].
268    ///
269    /// # Example
270    /// ```ignore,no_run
271    /// # use google_cloud_tasks_v2::model::GetQueueRequest;
272    /// # let project_id = "project_id";
273    /// # let location_id = "location_id";
274    /// # let queue_id = "queue_id";
275    /// let x = GetQueueRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
276    /// ```
277    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
278        self.name = v.into();
279        self
280    }
281}
282
283impl wkt::message::Message for GetQueueRequest {
284    fn typename() -> &'static str {
285        "type.googleapis.com/google.cloud.tasks.v2.GetQueueRequest"
286    }
287}
288
289/// Request message for
290/// [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue].
291///
292/// [google.cloud.tasks.v2.CloudTasks.CreateQueue]: crate::client::CloudTasks::create_queue
293#[derive(Clone, Default, PartialEq)]
294#[non_exhaustive]
295pub struct CreateQueueRequest {
296    /// Required. The location name in which the queue will be created.
297    /// For example: `projects/PROJECT_ID/locations/LOCATION_ID`
298    ///
299    /// The list of allowed locations can be obtained by calling Cloud
300    /// Tasks' implementation of
301    /// [ListLocations][google.cloud.location.Locations.ListLocations].
302    pub parent: std::string::String,
303
304    /// Required. The queue to create.
305    ///
306    /// [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an
307    /// existing queue.
308    ///
309    /// [google.cloud.tasks.v2.Queue.name]: crate::model::Queue::name
310    pub queue: std::option::Option<crate::model::Queue>,
311
312    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
313}
314
315impl CreateQueueRequest {
316    /// Creates a new default instance.
317    pub fn new() -> Self {
318        std::default::Default::default()
319    }
320
321    /// Sets the value of [parent][crate::model::CreateQueueRequest::parent].
322    ///
323    /// # Example
324    /// ```ignore,no_run
325    /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
326    /// # let project_id = "project_id";
327    /// # let location_id = "location_id";
328    /// let x = CreateQueueRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
329    /// ```
330    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
331        self.parent = v.into();
332        self
333    }
334
335    /// Sets the value of [queue][crate::model::CreateQueueRequest::queue].
336    ///
337    /// # Example
338    /// ```ignore,no_run
339    /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
340    /// use google_cloud_tasks_v2::model::Queue;
341    /// let x = CreateQueueRequest::new().set_queue(Queue::default()/* use setters */);
342    /// ```
343    pub fn set_queue<T>(mut self, v: T) -> Self
344    where
345        T: std::convert::Into<crate::model::Queue>,
346    {
347        self.queue = std::option::Option::Some(v.into());
348        self
349    }
350
351    /// Sets or clears the value of [queue][crate::model::CreateQueueRequest::queue].
352    ///
353    /// # Example
354    /// ```ignore,no_run
355    /// # use google_cloud_tasks_v2::model::CreateQueueRequest;
356    /// use google_cloud_tasks_v2::model::Queue;
357    /// let x = CreateQueueRequest::new().set_or_clear_queue(Some(Queue::default()/* use setters */));
358    /// let x = CreateQueueRequest::new().set_or_clear_queue(None::<Queue>);
359    /// ```
360    pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
361    where
362        T: std::convert::Into<crate::model::Queue>,
363    {
364        self.queue = v.map(|x| x.into());
365        self
366    }
367}
368
369impl wkt::message::Message for CreateQueueRequest {
370    fn typename() -> &'static str {
371        "type.googleapis.com/google.cloud.tasks.v2.CreateQueueRequest"
372    }
373}
374
375/// Request message for
376/// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue].
377///
378/// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
379#[derive(Clone, Default, PartialEq)]
380#[non_exhaustive]
381pub struct UpdateQueueRequest {
382    /// Required. The queue to create or update.
383    ///
384    /// The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified.
385    ///
386    /// Output only fields cannot be modified using UpdateQueue.
387    /// Any value specified for an output only field will be ignored.
388    /// The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed.
389    ///
390    /// [google.cloud.tasks.v2.Queue.name]: crate::model::Queue::name
391    pub queue: std::option::Option<crate::model::Queue>,
392
393    /// A mask used to specify which fields of the queue are being updated.
394    ///
395    /// If empty, then all fields will be updated.
396    pub update_mask: std::option::Option<wkt::FieldMask>,
397
398    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
399}
400
401impl UpdateQueueRequest {
402    /// Creates a new default instance.
403    pub fn new() -> Self {
404        std::default::Default::default()
405    }
406
407    /// Sets the value of [queue][crate::model::UpdateQueueRequest::queue].
408    ///
409    /// # Example
410    /// ```ignore,no_run
411    /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
412    /// use google_cloud_tasks_v2::model::Queue;
413    /// let x = UpdateQueueRequest::new().set_queue(Queue::default()/* use setters */);
414    /// ```
415    pub fn set_queue<T>(mut self, v: T) -> Self
416    where
417        T: std::convert::Into<crate::model::Queue>,
418    {
419        self.queue = std::option::Option::Some(v.into());
420        self
421    }
422
423    /// Sets or clears the value of [queue][crate::model::UpdateQueueRequest::queue].
424    ///
425    /// # Example
426    /// ```ignore,no_run
427    /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
428    /// use google_cloud_tasks_v2::model::Queue;
429    /// let x = UpdateQueueRequest::new().set_or_clear_queue(Some(Queue::default()/* use setters */));
430    /// let x = UpdateQueueRequest::new().set_or_clear_queue(None::<Queue>);
431    /// ```
432    pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
433    where
434        T: std::convert::Into<crate::model::Queue>,
435    {
436        self.queue = v.map(|x| x.into());
437        self
438    }
439
440    /// Sets the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
441    ///
442    /// # Example
443    /// ```ignore,no_run
444    /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
445    /// use wkt::FieldMask;
446    /// let x = UpdateQueueRequest::new().set_update_mask(FieldMask::default()/* use setters */);
447    /// ```
448    pub fn set_update_mask<T>(mut self, v: T) -> Self
449    where
450        T: std::convert::Into<wkt::FieldMask>,
451    {
452        self.update_mask = std::option::Option::Some(v.into());
453        self
454    }
455
456    /// Sets or clears the value of [update_mask][crate::model::UpdateQueueRequest::update_mask].
457    ///
458    /// # Example
459    /// ```ignore,no_run
460    /// # use google_cloud_tasks_v2::model::UpdateQueueRequest;
461    /// use wkt::FieldMask;
462    /// let x = UpdateQueueRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
463    /// let x = UpdateQueueRequest::new().set_or_clear_update_mask(None::<FieldMask>);
464    /// ```
465    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
466    where
467        T: std::convert::Into<wkt::FieldMask>,
468    {
469        self.update_mask = v.map(|x| x.into());
470        self
471    }
472}
473
474impl wkt::message::Message for UpdateQueueRequest {
475    fn typename() -> &'static str {
476        "type.googleapis.com/google.cloud.tasks.v2.UpdateQueueRequest"
477    }
478}
479
480/// Request message for
481/// [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue].
482///
483/// [google.cloud.tasks.v2.CloudTasks.DeleteQueue]: crate::client::CloudTasks::delete_queue
484#[derive(Clone, Default, PartialEq)]
485#[non_exhaustive]
486pub struct DeleteQueueRequest {
487    /// Required. The queue name. For example:
488    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
489    pub name: std::string::String,
490
491    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
492}
493
494impl DeleteQueueRequest {
495    /// Creates a new default instance.
496    pub fn new() -> Self {
497        std::default::Default::default()
498    }
499
500    /// Sets the value of [name][crate::model::DeleteQueueRequest::name].
501    ///
502    /// # Example
503    /// ```ignore,no_run
504    /// # use google_cloud_tasks_v2::model::DeleteQueueRequest;
505    /// # let project_id = "project_id";
506    /// # let location_id = "location_id";
507    /// # let queue_id = "queue_id";
508    /// let x = DeleteQueueRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
509    /// ```
510    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
511        self.name = v.into();
512        self
513    }
514}
515
516impl wkt::message::Message for DeleteQueueRequest {
517    fn typename() -> &'static str {
518        "type.googleapis.com/google.cloud.tasks.v2.DeleteQueueRequest"
519    }
520}
521
522/// Request message for
523/// [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue].
524///
525/// [google.cloud.tasks.v2.CloudTasks.PurgeQueue]: crate::client::CloudTasks::purge_queue
526#[derive(Clone, Default, PartialEq)]
527#[non_exhaustive]
528pub struct PurgeQueueRequest {
529    /// Required. The queue name. For example:
530    /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
531    pub name: std::string::String,
532
533    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
534}
535
536impl PurgeQueueRequest {
537    /// Creates a new default instance.
538    pub fn new() -> Self {
539        std::default::Default::default()
540    }
541
542    /// Sets the value of [name][crate::model::PurgeQueueRequest::name].
543    ///
544    /// # Example
545    /// ```ignore,no_run
546    /// # use google_cloud_tasks_v2::model::PurgeQueueRequest;
547    /// # let project_id = "project_id";
548    /// # let location_id = "location_id";
549    /// # let queue_id = "queue_id";
550    /// let x = PurgeQueueRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
551    /// ```
552    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
553        self.name = v.into();
554        self
555    }
556}
557
558impl wkt::message::Message for PurgeQueueRequest {
559    fn typename() -> &'static str {
560        "type.googleapis.com/google.cloud.tasks.v2.PurgeQueueRequest"
561    }
562}
563
564/// Request message for
565/// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue].
566///
567/// [google.cloud.tasks.v2.CloudTasks.PauseQueue]: crate::client::CloudTasks::pause_queue
568#[derive(Clone, Default, PartialEq)]
569#[non_exhaustive]
570pub struct PauseQueueRequest {
571    /// Required. The queue name. For example:
572    /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
573    pub name: std::string::String,
574
575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
576}
577
578impl PauseQueueRequest {
579    /// Creates a new default instance.
580    pub fn new() -> Self {
581        std::default::Default::default()
582    }
583
584    /// Sets the value of [name][crate::model::PauseQueueRequest::name].
585    ///
586    /// # Example
587    /// ```ignore,no_run
588    /// # use google_cloud_tasks_v2::model::PauseQueueRequest;
589    /// # let project_id = "project_id";
590    /// # let location_id = "location_id";
591    /// # let queue_id = "queue_id";
592    /// let x = PauseQueueRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
593    /// ```
594    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
595        self.name = v.into();
596        self
597    }
598}
599
600impl wkt::message::Message for PauseQueueRequest {
601    fn typename() -> &'static str {
602        "type.googleapis.com/google.cloud.tasks.v2.PauseQueueRequest"
603    }
604}
605
606/// Request message for
607/// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue].
608///
609/// [google.cloud.tasks.v2.CloudTasks.ResumeQueue]: crate::client::CloudTasks::resume_queue
610#[derive(Clone, Default, PartialEq)]
611#[non_exhaustive]
612pub struct ResumeQueueRequest {
613    /// Required. The queue name. For example:
614    /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
615    pub name: std::string::String,
616
617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
618}
619
620impl ResumeQueueRequest {
621    /// Creates a new default instance.
622    pub fn new() -> Self {
623        std::default::Default::default()
624    }
625
626    /// Sets the value of [name][crate::model::ResumeQueueRequest::name].
627    ///
628    /// # Example
629    /// ```ignore,no_run
630    /// # use google_cloud_tasks_v2::model::ResumeQueueRequest;
631    /// # let project_id = "project_id";
632    /// # let location_id = "location_id";
633    /// # let queue_id = "queue_id";
634    /// let x = ResumeQueueRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
635    /// ```
636    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
637        self.name = v.into();
638        self
639    }
640}
641
642impl wkt::message::Message for ResumeQueueRequest {
643    fn typename() -> &'static str {
644        "type.googleapis.com/google.cloud.tasks.v2.ResumeQueueRequest"
645    }
646}
647
648/// Request message for listing tasks using
649/// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
650///
651/// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
652#[derive(Clone, Default, PartialEq)]
653#[non_exhaustive]
654pub struct ListTasksRequest {
655    /// Required. The queue name. For example:
656    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
657    pub parent: std::string::String,
658
659    /// The response_view specifies which subset of the
660    /// [Task][google.cloud.tasks.v2.Task] will be returned.
661    ///
662    /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
663    /// not all information is retrieved by default because some data, such as
664    /// payloads, might be desirable to return only when needed because
665    /// of its large size or because of the sensitivity of data that it
666    /// contains.
667    ///
668    /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
669    /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
670    /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
671    ///
672    /// [google.cloud.tasks.v2.Task]: crate::model::Task
673    /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
674    /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
675    pub response_view: crate::model::task::View,
676
677    /// Maximum page size.
678    ///
679    /// Fewer tasks than requested might be returned, even if more tasks exist; use
680    /// [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
681    /// in the response to determine if more tasks exist.
682    ///
683    /// The maximum page size is 1000. If unspecified, the page size will be the
684    /// maximum.
685    ///
686    /// [google.cloud.tasks.v2.ListTasksResponse.next_page_token]: crate::model::ListTasksResponse::next_page_token
687    pub page_size: i32,
688
689    /// A token identifying the page of results to return.
690    ///
691    /// To request the first page results, page_token must be empty. To
692    /// request the next page of results, page_token must be the value of
693    /// [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
694    /// returned from the previous call to
695    /// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] method.
696    ///
697    /// The page token is valid for only 2 hours.
698    ///
699    /// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
700    /// [google.cloud.tasks.v2.ListTasksResponse.next_page_token]: crate::model::ListTasksResponse::next_page_token
701    pub page_token: std::string::String,
702
703    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
704}
705
706impl ListTasksRequest {
707    /// Creates a new default instance.
708    pub fn new() -> Self {
709        std::default::Default::default()
710    }
711
712    /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
713    ///
714    /// # Example
715    /// ```ignore,no_run
716    /// # use google_cloud_tasks_v2::model::ListTasksRequest;
717    /// # let project_id = "project_id";
718    /// # let location_id = "location_id";
719    /// # let queue_id = "queue_id";
720    /// let x = ListTasksRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
721    /// ```
722    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
723        self.parent = v.into();
724        self
725    }
726
727    /// Sets the value of [response_view][crate::model::ListTasksRequest::response_view].
728    ///
729    /// # Example
730    /// ```ignore,no_run
731    /// # use google_cloud_tasks_v2::model::ListTasksRequest;
732    /// use google_cloud_tasks_v2::model::task::View;
733    /// let x0 = ListTasksRequest::new().set_response_view(View::Basic);
734    /// let x1 = ListTasksRequest::new().set_response_view(View::Full);
735    /// ```
736    pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
737        mut self,
738        v: T,
739    ) -> Self {
740        self.response_view = v.into();
741        self
742    }
743
744    /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
745    ///
746    /// # Example
747    /// ```ignore,no_run
748    /// # use google_cloud_tasks_v2::model::ListTasksRequest;
749    /// let x = ListTasksRequest::new().set_page_size(42);
750    /// ```
751    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
752        self.page_size = v.into();
753        self
754    }
755
756    /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
757    ///
758    /// # Example
759    /// ```ignore,no_run
760    /// # use google_cloud_tasks_v2::model::ListTasksRequest;
761    /// let x = ListTasksRequest::new().set_page_token("example");
762    /// ```
763    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
764        self.page_token = v.into();
765        self
766    }
767}
768
769impl wkt::message::Message for ListTasksRequest {
770    fn typename() -> &'static str {
771        "type.googleapis.com/google.cloud.tasks.v2.ListTasksRequest"
772    }
773}
774
775/// Response message for listing tasks using
776/// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
777///
778/// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
779#[derive(Clone, Default, PartialEq)]
780#[non_exhaustive]
781pub struct ListTasksResponse {
782    /// The list of tasks.
783    pub tasks: std::vec::Vec<crate::model::Task>,
784
785    /// A token to retrieve next page of results.
786    ///
787    /// To return the next page of results, call
788    /// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] with this value as
789    /// the [page_token][google.cloud.tasks.v2.ListTasksRequest.page_token].
790    ///
791    /// If the next_page_token is empty, there are no more results.
792    ///
793    /// [google.cloud.tasks.v2.CloudTasks.ListTasks]: crate::client::CloudTasks::list_tasks
794    /// [google.cloud.tasks.v2.ListTasksRequest.page_token]: crate::model::ListTasksRequest::page_token
795    pub next_page_token: std::string::String,
796
797    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
798}
799
800impl ListTasksResponse {
801    /// Creates a new default instance.
802    pub fn new() -> Self {
803        std::default::Default::default()
804    }
805
806    /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
807    ///
808    /// # Example
809    /// ```ignore,no_run
810    /// # use google_cloud_tasks_v2::model::ListTasksResponse;
811    /// use google_cloud_tasks_v2::model::Task;
812    /// let x = ListTasksResponse::new()
813    ///     .set_tasks([
814    ///         Task::default()/* use setters */,
815    ///         Task::default()/* use (different) setters */,
816    ///     ]);
817    /// ```
818    pub fn set_tasks<T, V>(mut self, v: T) -> Self
819    where
820        T: std::iter::IntoIterator<Item = V>,
821        V: std::convert::Into<crate::model::Task>,
822    {
823        use std::iter::Iterator;
824        self.tasks = v.into_iter().map(|i| i.into()).collect();
825        self
826    }
827
828    /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
829    ///
830    /// # Example
831    /// ```ignore,no_run
832    /// # use google_cloud_tasks_v2::model::ListTasksResponse;
833    /// let x = ListTasksResponse::new().set_next_page_token("example");
834    /// ```
835    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
836        self.next_page_token = v.into();
837        self
838    }
839}
840
841impl wkt::message::Message for ListTasksResponse {
842    fn typename() -> &'static str {
843        "type.googleapis.com/google.cloud.tasks.v2.ListTasksResponse"
844    }
845}
846
847#[doc(hidden)]
848impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
849    type PageItem = crate::model::Task;
850
851    fn items(self) -> std::vec::Vec<Self::PageItem> {
852        self.tasks
853    }
854
855    fn next_page_token(&self) -> std::string::String {
856        use std::clone::Clone;
857        self.next_page_token.clone()
858    }
859}
860
861/// Request message for getting a task using
862/// [GetTask][google.cloud.tasks.v2.CloudTasks.GetTask].
863///
864/// [google.cloud.tasks.v2.CloudTasks.GetTask]: crate::client::CloudTasks::get_task
865#[derive(Clone, Default, PartialEq)]
866#[non_exhaustive]
867pub struct GetTaskRequest {
868    /// Required. The task name. For example:
869    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
870    pub name: std::string::String,
871
872    /// The response_view specifies which subset of the
873    /// [Task][google.cloud.tasks.v2.Task] will be returned.
874    ///
875    /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
876    /// not all information is retrieved by default because some data, such as
877    /// payloads, might be desirable to return only when needed because
878    /// of its large size or because of the sensitivity of data that it
879    /// contains.
880    ///
881    /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
882    /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
883    /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
884    ///
885    /// [google.cloud.tasks.v2.Task]: crate::model::Task
886    /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
887    /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
888    pub response_view: crate::model::task::View,
889
890    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
891}
892
893impl GetTaskRequest {
894    /// Creates a new default instance.
895    pub fn new() -> Self {
896        std::default::Default::default()
897    }
898
899    /// Sets the value of [name][crate::model::GetTaskRequest::name].
900    ///
901    /// # Example
902    /// ```ignore,no_run
903    /// # use google_cloud_tasks_v2::model::GetTaskRequest;
904    /// # let project_id = "project_id";
905    /// # let location_id = "location_id";
906    /// # let queue_id = "queue_id";
907    /// # let task_id = "task_id";
908    /// let x = GetTaskRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}/tasks/{task_id}"));
909    /// ```
910    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
911        self.name = v.into();
912        self
913    }
914
915    /// Sets the value of [response_view][crate::model::GetTaskRequest::response_view].
916    ///
917    /// # Example
918    /// ```ignore,no_run
919    /// # use google_cloud_tasks_v2::model::GetTaskRequest;
920    /// use google_cloud_tasks_v2::model::task::View;
921    /// let x0 = GetTaskRequest::new().set_response_view(View::Basic);
922    /// let x1 = GetTaskRequest::new().set_response_view(View::Full);
923    /// ```
924    pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
925        mut self,
926        v: T,
927    ) -> Self {
928        self.response_view = v.into();
929        self
930    }
931}
932
933impl wkt::message::Message for GetTaskRequest {
934    fn typename() -> &'static str {
935        "type.googleapis.com/google.cloud.tasks.v2.GetTaskRequest"
936    }
937}
938
939/// Request message for
940/// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
941///
942/// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
943#[derive(Clone, Default, PartialEq)]
944#[non_exhaustive]
945pub struct CreateTaskRequest {
946    /// Required. The queue name. For example:
947    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
948    ///
949    /// The queue must already exist.
950    pub parent: std::string::String,
951
952    /// Required. The task to add.
953    ///
954    /// Task names have the following format:
955    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
956    /// The user can optionally specify a task
957    /// [name][google.cloud.tasks.v2.Task.name]. If a name is not specified then
958    /// the system will generate a random unique task id, which will be set in the
959    /// task returned in the [response][google.cloud.tasks.v2.Task.name].
960    ///
961    /// If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or
962    /// is in the past then Cloud Tasks will set it to the current time.
963    ///
964    /// Task De-duplication:
965    ///
966    /// Explicitly specifying a task ID enables task de-duplication.  If
967    /// a task's ID is identical to that of an existing task or a task
968    /// that was deleted or executed recently then the call will fail
969    /// with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
970    /// The IDs of deleted tasks are not immediately available for reuse.  It can
971    /// take up to 24 hours (or 9 days if the task's queue was created using a
972    /// queue.yaml or queue.xml) for the task ID to be released and made available
973    /// again.
974    ///
975    /// Because there is an extra lookup cost to identify duplicate task
976    /// names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]
977    /// calls have significantly increased latency. Using hashed strings for the
978    /// task id or for the prefix of the task id is recommended. Choosing task ids
979    /// that are sequential or have sequential prefixes, for example using a
980    /// timestamp, causes an increase in latency and error rates in all
981    /// task commands. The infrastructure relies on an approximately
982    /// uniform distribution of task ids to store and serve tasks
983    /// efficiently.
984    ///
985    /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
986    /// [google.cloud.tasks.v2.Task.name]: crate::model::Task::name
987    /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
988    pub task: std::option::Option<crate::model::Task>,
989
990    /// The response_view specifies which subset of the
991    /// [Task][google.cloud.tasks.v2.Task] will be returned.
992    ///
993    /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
994    /// not all information is retrieved by default because some data, such as
995    /// payloads, might be desirable to return only when needed because
996    /// of its large size or because of the sensitivity of data that it
997    /// contains.
998    ///
999    /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
1000    /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1001    /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
1002    ///
1003    /// [google.cloud.tasks.v2.Task]: crate::model::Task
1004    /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
1005    /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
1006    pub response_view: crate::model::task::View,
1007
1008    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1009}
1010
1011impl CreateTaskRequest {
1012    /// Creates a new default instance.
1013    pub fn new() -> Self {
1014        std::default::Default::default()
1015    }
1016
1017    /// Sets the value of [parent][crate::model::CreateTaskRequest::parent].
1018    ///
1019    /// # Example
1020    /// ```ignore,no_run
1021    /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1022    /// # let project_id = "project_id";
1023    /// # let location_id = "location_id";
1024    /// # let queue_id = "queue_id";
1025    /// let x = CreateTaskRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
1026    /// ```
1027    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1028        self.parent = v.into();
1029        self
1030    }
1031
1032    /// Sets the value of [task][crate::model::CreateTaskRequest::task].
1033    ///
1034    /// # Example
1035    /// ```ignore,no_run
1036    /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1037    /// use google_cloud_tasks_v2::model::Task;
1038    /// let x = CreateTaskRequest::new().set_task(Task::default()/* use setters */);
1039    /// ```
1040    pub fn set_task<T>(mut self, v: T) -> Self
1041    where
1042        T: std::convert::Into<crate::model::Task>,
1043    {
1044        self.task = std::option::Option::Some(v.into());
1045        self
1046    }
1047
1048    /// Sets or clears the value of [task][crate::model::CreateTaskRequest::task].
1049    ///
1050    /// # Example
1051    /// ```ignore,no_run
1052    /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1053    /// use google_cloud_tasks_v2::model::Task;
1054    /// let x = CreateTaskRequest::new().set_or_clear_task(Some(Task::default()/* use setters */));
1055    /// let x = CreateTaskRequest::new().set_or_clear_task(None::<Task>);
1056    /// ```
1057    pub fn set_or_clear_task<T>(mut self, v: std::option::Option<T>) -> Self
1058    where
1059        T: std::convert::Into<crate::model::Task>,
1060    {
1061        self.task = v.map(|x| x.into());
1062        self
1063    }
1064
1065    /// Sets the value of [response_view][crate::model::CreateTaskRequest::response_view].
1066    ///
1067    /// # Example
1068    /// ```ignore,no_run
1069    /// # use google_cloud_tasks_v2::model::CreateTaskRequest;
1070    /// use google_cloud_tasks_v2::model::task::View;
1071    /// let x0 = CreateTaskRequest::new().set_response_view(View::Basic);
1072    /// let x1 = CreateTaskRequest::new().set_response_view(View::Full);
1073    /// ```
1074    pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
1075        mut self,
1076        v: T,
1077    ) -> Self {
1078        self.response_view = v.into();
1079        self
1080    }
1081}
1082
1083impl wkt::message::Message for CreateTaskRequest {
1084    fn typename() -> &'static str {
1085        "type.googleapis.com/google.cloud.tasks.v2.CreateTaskRequest"
1086    }
1087}
1088
1089/// Request message for [BatchCreateTasks].
1090#[derive(Clone, Default, PartialEq)]
1091#[non_exhaustive]
1092pub struct BatchCreateTasksRequest {
1093    /// Required. The queue name. For example:
1094    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1095    ///
1096    /// The queue must already exist.
1097    pub parent: std::string::String,
1098
1099    /// Required. The list of requests to create tasks.
1100    /// The queue specified in parent field of each CreateTaskRequest will be
1101    /// the same. This validation happens on the client side as well as in the
1102    /// handler.
1103    /// BatchCreateTasksRequest.parent will also be the same value as the
1104    /// individual CreateTaskRequest.parent.
1105    /// The maximum number of requests is 100.
1106    pub requests: std::vec::Vec<crate::model::CreateTaskRequest>,
1107
1108    /// Optional. This field will be used to identify the long running operation,
1109    /// avoiding duplication when user retries. If not provided, then a UUID will
1110    /// be generated at server side.
1111    pub request_id: std::string::String,
1112
1113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1114}
1115
1116impl BatchCreateTasksRequest {
1117    /// Creates a new default instance.
1118    pub fn new() -> Self {
1119        std::default::Default::default()
1120    }
1121
1122    /// Sets the value of [parent][crate::model::BatchCreateTasksRequest::parent].
1123    ///
1124    /// # Example
1125    /// ```ignore,no_run
1126    /// # use google_cloud_tasks_v2::model::BatchCreateTasksRequest;
1127    /// # let project_id = "project_id";
1128    /// # let location_id = "location_id";
1129    /// # let queue_id = "queue_id";
1130    /// let x = BatchCreateTasksRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
1131    /// ```
1132    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1133        self.parent = v.into();
1134        self
1135    }
1136
1137    /// Sets the value of [requests][crate::model::BatchCreateTasksRequest::requests].
1138    ///
1139    /// # Example
1140    /// ```ignore,no_run
1141    /// # use google_cloud_tasks_v2::model::BatchCreateTasksRequest;
1142    /// use google_cloud_tasks_v2::model::CreateTaskRequest;
1143    /// let x = BatchCreateTasksRequest::new()
1144    ///     .set_requests([
1145    ///         CreateTaskRequest::default()/* use setters */,
1146    ///         CreateTaskRequest::default()/* use (different) setters */,
1147    ///     ]);
1148    /// ```
1149    pub fn set_requests<T, V>(mut self, v: T) -> Self
1150    where
1151        T: std::iter::IntoIterator<Item = V>,
1152        V: std::convert::Into<crate::model::CreateTaskRequest>,
1153    {
1154        use std::iter::Iterator;
1155        self.requests = v.into_iter().map(|i| i.into()).collect();
1156        self
1157    }
1158
1159    /// Sets the value of [request_id][crate::model::BatchCreateTasksRequest::request_id].
1160    ///
1161    /// # Example
1162    /// ```ignore,no_run
1163    /// # use google_cloud_tasks_v2::model::BatchCreateTasksRequest;
1164    /// let x = BatchCreateTasksRequest::new().set_request_id("example");
1165    /// ```
1166    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1167        self.request_id = v.into();
1168        self
1169    }
1170}
1171
1172impl wkt::message::Message for BatchCreateTasksRequest {
1173    fn typename() -> &'static str {
1174        "type.googleapis.com/google.cloud.tasks.v2.BatchCreateTasksRequest"
1175    }
1176}
1177
1178/// Request message for deleting a task using
1179/// [DeleteTask][google.cloud.tasks.v2.CloudTasks.DeleteTask].
1180///
1181/// [google.cloud.tasks.v2.CloudTasks.DeleteTask]: crate::client::CloudTasks::delete_task
1182#[derive(Clone, Default, PartialEq)]
1183#[non_exhaustive]
1184pub struct DeleteTaskRequest {
1185    /// Required. The task name. For example:
1186    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1187    pub name: std::string::String,
1188
1189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1190}
1191
1192impl DeleteTaskRequest {
1193    /// Creates a new default instance.
1194    pub fn new() -> Self {
1195        std::default::Default::default()
1196    }
1197
1198    /// Sets the value of [name][crate::model::DeleteTaskRequest::name].
1199    ///
1200    /// # Example
1201    /// ```ignore,no_run
1202    /// # use google_cloud_tasks_v2::model::DeleteTaskRequest;
1203    /// # let project_id = "project_id";
1204    /// # let location_id = "location_id";
1205    /// # let queue_id = "queue_id";
1206    /// # let task_id = "task_id";
1207    /// let x = DeleteTaskRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}/tasks/{task_id}"));
1208    /// ```
1209    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1210        self.name = v.into();
1211        self
1212    }
1213}
1214
1215impl wkt::message::Message for DeleteTaskRequest {
1216    fn typename() -> &'static str {
1217        "type.googleapis.com/google.cloud.tasks.v2.DeleteTaskRequest"
1218    }
1219}
1220
1221/// Request message for deleting a batch of tasks using
1222/// [BatchDeleteTasks][google.cloud.tasks.v2.CloudTasks.BatchDeleteTasks].
1223///
1224/// [google.cloud.tasks.v2.CloudTasks.BatchDeleteTasks]: crate::client::CloudTasks::batch_delete_tasks
1225#[derive(Clone, Default, PartialEq)]
1226#[non_exhaustive]
1227pub struct BatchDeleteTasksRequest {
1228    /// Required. The queue name. For example:
1229    /// Format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
1230    pub parent: std::string::String,
1231
1232    /// Required. The names of the tasks to delete.
1233    /// A maximum of 1000 tasks can be deleted in a batch.
1234    /// For example:
1235    /// Format:
1236    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1237    pub names: std::vec::Vec<std::string::String>,
1238
1239    /// Optional. This field will be used to identify the long running operation,
1240    /// avoiding duplication when user retries. If not provided, then a UUID will
1241    /// be generated at server side.
1242    pub request_id: std::string::String,
1243
1244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1245}
1246
1247impl BatchDeleteTasksRequest {
1248    /// Creates a new default instance.
1249    pub fn new() -> Self {
1250        std::default::Default::default()
1251    }
1252
1253    /// Sets the value of [parent][crate::model::BatchDeleteTasksRequest::parent].
1254    ///
1255    /// # Example
1256    /// ```ignore,no_run
1257    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksRequest;
1258    /// # let project_id = "project_id";
1259    /// # let location_id = "location_id";
1260    /// # let queue_id = "queue_id";
1261    /// let x = BatchDeleteTasksRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
1262    /// ```
1263    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1264        self.parent = v.into();
1265        self
1266    }
1267
1268    /// Sets the value of [names][crate::model::BatchDeleteTasksRequest::names].
1269    ///
1270    /// # Example
1271    /// ```ignore,no_run
1272    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksRequest;
1273    /// let x = BatchDeleteTasksRequest::new().set_names(["a", "b", "c"]);
1274    /// ```
1275    pub fn set_names<T, V>(mut self, v: T) -> Self
1276    where
1277        T: std::iter::IntoIterator<Item = V>,
1278        V: std::convert::Into<std::string::String>,
1279    {
1280        use std::iter::Iterator;
1281        self.names = v.into_iter().map(|i| i.into()).collect();
1282        self
1283    }
1284
1285    /// Sets the value of [request_id][crate::model::BatchDeleteTasksRequest::request_id].
1286    ///
1287    /// # Example
1288    /// ```ignore,no_run
1289    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksRequest;
1290    /// let x = BatchDeleteTasksRequest::new().set_request_id("example");
1291    /// ```
1292    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1293        self.request_id = v.into();
1294        self
1295    }
1296}
1297
1298impl wkt::message::Message for BatchDeleteTasksRequest {
1299    fn typename() -> &'static str {
1300        "type.googleapis.com/google.cloud.tasks.v2.BatchDeleteTasksRequest"
1301    }
1302}
1303
1304/// Metadata for the long-running operation returned by
1305/// [BatchDeleteTasks][google.cloud.tasks.v2.CloudTasks.BatchDeleteTasks].
1306/// This message is used to hold metadata information about the
1307/// batch delete tasks operation; that is, it is put in
1308/// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata].
1309///
1310/// [google.cloud.tasks.v2.CloudTasks.BatchDeleteTasks]: crate::client::CloudTasks::batch_delete_tasks
1311/// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1312#[derive(Clone, Default, PartialEq)]
1313#[non_exhaustive]
1314pub struct BatchDeleteTasksMetadata {
1315    /// Output only. The time when the batch delete started.
1316    pub start_time: std::option::Option<wkt::Timestamp>,
1317
1318    /// Output only. The time when the batch delete finished.
1319    pub end_time: std::option::Option<wkt::Timestamp>,
1320
1321    /// Output only. The state of the batch delete operation.
1322    pub state: crate::model::batch_delete_tasks_metadata::State,
1323
1324    /// Output only. A map of failed requests, where the key is the index of the
1325    /// request in BatchDeleteTasksRequest.names and the value is the error status.
1326    pub failed_requests: std::collections::HashMap<i32, google_cloud_rpc::model::Status>,
1327
1328    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1329}
1330
1331impl BatchDeleteTasksMetadata {
1332    /// Creates a new default instance.
1333    pub fn new() -> Self {
1334        std::default::Default::default()
1335    }
1336
1337    /// Sets the value of [start_time][crate::model::BatchDeleteTasksMetadata::start_time].
1338    ///
1339    /// # Example
1340    /// ```ignore,no_run
1341    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1342    /// use wkt::Timestamp;
1343    /// let x = BatchDeleteTasksMetadata::new().set_start_time(Timestamp::default()/* use setters */);
1344    /// ```
1345    pub fn set_start_time<T>(mut self, v: T) -> Self
1346    where
1347        T: std::convert::Into<wkt::Timestamp>,
1348    {
1349        self.start_time = std::option::Option::Some(v.into());
1350        self
1351    }
1352
1353    /// Sets or clears the value of [start_time][crate::model::BatchDeleteTasksMetadata::start_time].
1354    ///
1355    /// # Example
1356    /// ```ignore,no_run
1357    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1358    /// use wkt::Timestamp;
1359    /// let x = BatchDeleteTasksMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1360    /// let x = BatchDeleteTasksMetadata::new().set_or_clear_start_time(None::<Timestamp>);
1361    /// ```
1362    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1363    where
1364        T: std::convert::Into<wkt::Timestamp>,
1365    {
1366        self.start_time = v.map(|x| x.into());
1367        self
1368    }
1369
1370    /// Sets the value of [end_time][crate::model::BatchDeleteTasksMetadata::end_time].
1371    ///
1372    /// # Example
1373    /// ```ignore,no_run
1374    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1375    /// use wkt::Timestamp;
1376    /// let x = BatchDeleteTasksMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1377    /// ```
1378    pub fn set_end_time<T>(mut self, v: T) -> Self
1379    where
1380        T: std::convert::Into<wkt::Timestamp>,
1381    {
1382        self.end_time = std::option::Option::Some(v.into());
1383        self
1384    }
1385
1386    /// Sets or clears the value of [end_time][crate::model::BatchDeleteTasksMetadata::end_time].
1387    ///
1388    /// # Example
1389    /// ```ignore,no_run
1390    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1391    /// use wkt::Timestamp;
1392    /// let x = BatchDeleteTasksMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1393    /// let x = BatchDeleteTasksMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1394    /// ```
1395    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1396    where
1397        T: std::convert::Into<wkt::Timestamp>,
1398    {
1399        self.end_time = v.map(|x| x.into());
1400        self
1401    }
1402
1403    /// Sets the value of [state][crate::model::BatchDeleteTasksMetadata::state].
1404    ///
1405    /// # Example
1406    /// ```ignore,no_run
1407    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1408    /// use google_cloud_tasks_v2::model::batch_delete_tasks_metadata::State;
1409    /// let x0 = BatchDeleteTasksMetadata::new().set_state(State::Running);
1410    /// let x1 = BatchDeleteTasksMetadata::new().set_state(State::Succeeded);
1411    /// let x2 = BatchDeleteTasksMetadata::new().set_state(State::PartiallySucceeded);
1412    /// ```
1413    pub fn set_state<T: std::convert::Into<crate::model::batch_delete_tasks_metadata::State>>(
1414        mut self,
1415        v: T,
1416    ) -> Self {
1417        self.state = v.into();
1418        self
1419    }
1420
1421    /// Sets the value of [failed_requests][crate::model::BatchDeleteTasksMetadata::failed_requests].
1422    ///
1423    /// # Example
1424    /// ```ignore,no_run
1425    /// # use google_cloud_tasks_v2::model::BatchDeleteTasksMetadata;
1426    /// use google_cloud_rpc::model::Status;
1427    /// let x = BatchDeleteTasksMetadata::new().set_failed_requests([
1428    ///     (0, Status::default()/* use setters */),
1429    ///     (1, Status::default()/* use (different) setters */),
1430    /// ]);
1431    /// ```
1432    pub fn set_failed_requests<T, K, V>(mut self, v: T) -> Self
1433    where
1434        T: std::iter::IntoIterator<Item = (K, V)>,
1435        K: std::convert::Into<i32>,
1436        V: std::convert::Into<google_cloud_rpc::model::Status>,
1437    {
1438        use std::iter::Iterator;
1439        self.failed_requests = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1440        self
1441    }
1442}
1443
1444impl wkt::message::Message for BatchDeleteTasksMetadata {
1445    fn typename() -> &'static str {
1446        "type.googleapis.com/google.cloud.tasks.v2.BatchDeleteTasksMetadata"
1447    }
1448}
1449
1450/// Defines additional types related to [BatchDeleteTasksMetadata].
1451pub mod batch_delete_tasks_metadata {
1452    #[allow(unused_imports)]
1453    use super::*;
1454
1455    /// The state of the batch delete operation.
1456    /// This enum is not frozen and new values may be added in the future.
1457    ///
1458    /// # Working with unknown values
1459    ///
1460    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1461    /// additional enum variants at any time. Adding new variants is not considered
1462    /// a breaking change. Applications should write their code in anticipation of:
1463    ///
1464    /// - New values appearing in future releases of the client library, **and**
1465    /// - New values received dynamically, without application changes.
1466    ///
1467    /// Please consult the [Working with enums] section in the user guide for some
1468    /// guidelines.
1469    ///
1470    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1471    #[derive(Clone, Debug, PartialEq)]
1472    #[non_exhaustive]
1473    pub enum State {
1474        /// The default value. This value is used if the state is omitted.
1475        Unspecified,
1476        /// The batch delete is running.
1477        Running,
1478        /// The batch delete has finished and all tasks were successfully deleted.
1479        Succeeded,
1480        /// The batch delete has finished with partial success.
1481        /// The tasks that failed to be deleted are reported in
1482        /// [failed_requests][google.cloud.tasks.v2.BatchDeleteTasksMetadata.failed_requests].
1483        /// When all requests in the batch fail,
1484        /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
1485        /// will be set with `code` = `google.rpc.Code.ABORTED` and `message` = "None
1486        /// of the requests succeeded, refer to
1487        /// BatchDeleteTasksMetadata.failed_requests for individual error details".
1488        ///
1489        /// [google.cloud.tasks.v2.BatchDeleteTasksMetadata.failed_requests]: crate::model::BatchDeleteTasksMetadata::failed_requests
1490        /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
1491        PartiallySucceeded,
1492        /// The batch delete has failed.
1493        /// This means the overall batch delete operation failed to complete.
1494        /// This can happen due to an internal error preventing the operation from
1495        /// finishing.
1496        Failed,
1497        /// If set, the enum was initialized with an unknown value.
1498        ///
1499        /// Applications can examine the value using [State::value] or
1500        /// [State::name].
1501        UnknownValue(state::UnknownValue),
1502    }
1503
1504    #[doc(hidden)]
1505    pub mod state {
1506        #[allow(unused_imports)]
1507        use super::*;
1508        #[derive(Clone, Debug, PartialEq)]
1509        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1510    }
1511
1512    impl State {
1513        /// Gets the enum value.
1514        ///
1515        /// Returns `None` if the enum contains an unknown value deserialized from
1516        /// the string representation of enums.
1517        pub fn value(&self) -> std::option::Option<i32> {
1518            match self {
1519                Self::Unspecified => std::option::Option::Some(0),
1520                Self::Running => std::option::Option::Some(1),
1521                Self::Succeeded => std::option::Option::Some(2),
1522                Self::PartiallySucceeded => std::option::Option::Some(3),
1523                Self::Failed => std::option::Option::Some(4),
1524                Self::UnknownValue(u) => u.0.value(),
1525            }
1526        }
1527
1528        /// Gets the enum value as a string.
1529        ///
1530        /// Returns `None` if the enum contains an unknown value deserialized from
1531        /// the integer representation of enums.
1532        pub fn name(&self) -> std::option::Option<&str> {
1533            match self {
1534                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1535                Self::Running => std::option::Option::Some("RUNNING"),
1536                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1537                Self::PartiallySucceeded => std::option::Option::Some("PARTIALLY_SUCCEEDED"),
1538                Self::Failed => std::option::Option::Some("FAILED"),
1539                Self::UnknownValue(u) => u.0.name(),
1540            }
1541        }
1542    }
1543
1544    impl std::default::Default for State {
1545        fn default() -> Self {
1546            use std::convert::From;
1547            Self::from(0)
1548        }
1549    }
1550
1551    impl std::fmt::Display for State {
1552        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1553            wkt::internal::display_enum(f, self.name(), self.value())
1554        }
1555    }
1556
1557    impl std::convert::From<i32> for State {
1558        fn from(value: i32) -> Self {
1559            match value {
1560                0 => Self::Unspecified,
1561                1 => Self::Running,
1562                2 => Self::Succeeded,
1563                3 => Self::PartiallySucceeded,
1564                4 => Self::Failed,
1565                _ => Self::UnknownValue(state::UnknownValue(
1566                    wkt::internal::UnknownEnumValue::Integer(value),
1567                )),
1568            }
1569        }
1570    }
1571
1572    impl std::convert::From<&str> for State {
1573        fn from(value: &str) -> Self {
1574            use std::string::ToString;
1575            match value {
1576                "STATE_UNSPECIFIED" => Self::Unspecified,
1577                "RUNNING" => Self::Running,
1578                "SUCCEEDED" => Self::Succeeded,
1579                "PARTIALLY_SUCCEEDED" => Self::PartiallySucceeded,
1580                "FAILED" => Self::Failed,
1581                _ => Self::UnknownValue(state::UnknownValue(
1582                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1583                )),
1584            }
1585        }
1586    }
1587
1588    impl serde::ser::Serialize for State {
1589        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1590        where
1591            S: serde::Serializer,
1592        {
1593            match self {
1594                Self::Unspecified => serializer.serialize_i32(0),
1595                Self::Running => serializer.serialize_i32(1),
1596                Self::Succeeded => serializer.serialize_i32(2),
1597                Self::PartiallySucceeded => serializer.serialize_i32(3),
1598                Self::Failed => serializer.serialize_i32(4),
1599                Self::UnknownValue(u) => u.0.serialize(serializer),
1600            }
1601        }
1602    }
1603
1604    impl<'de> serde::de::Deserialize<'de> for State {
1605        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1606        where
1607            D: serde::Deserializer<'de>,
1608        {
1609            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1610                ".google.cloud.tasks.v2.BatchDeleteTasksMetadata.State",
1611            ))
1612        }
1613    }
1614}
1615
1616/// Request message for forcing a task to run now using
1617/// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask].
1618///
1619/// [google.cloud.tasks.v2.CloudTasks.RunTask]: crate::client::CloudTasks::run_task
1620#[derive(Clone, Default, PartialEq)]
1621#[non_exhaustive]
1622pub struct RunTaskRequest {
1623    /// Required. The task name. For example:
1624    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
1625    pub name: std::string::String,
1626
1627    /// The response_view specifies which subset of the
1628    /// [Task][google.cloud.tasks.v2.Task] will be returned.
1629    ///
1630    /// By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
1631    /// not all information is retrieved by default because some data, such as
1632    /// payloads, might be desirable to return only when needed because
1633    /// of its large size or because of the sensitivity of data that it
1634    /// contains.
1635    ///
1636    /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
1637    /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
1638    /// permission on the [Task][google.cloud.tasks.v2.Task] resource.
1639    ///
1640    /// [google.cloud.tasks.v2.Task]: crate::model::Task
1641    /// [google.cloud.tasks.v2.Task.View.BASIC]: crate::model::task::View::Basic
1642    /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
1643    pub response_view: crate::model::task::View,
1644
1645    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1646}
1647
1648impl RunTaskRequest {
1649    /// Creates a new default instance.
1650    pub fn new() -> Self {
1651        std::default::Default::default()
1652    }
1653
1654    /// Sets the value of [name][crate::model::RunTaskRequest::name].
1655    ///
1656    /// # Example
1657    /// ```ignore,no_run
1658    /// # use google_cloud_tasks_v2::model::RunTaskRequest;
1659    /// # let project_id = "project_id";
1660    /// # let location_id = "location_id";
1661    /// # let queue_id = "queue_id";
1662    /// # let task_id = "task_id";
1663    /// let x = RunTaskRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}/tasks/{task_id}"));
1664    /// ```
1665    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1666        self.name = v.into();
1667        self
1668    }
1669
1670    /// Sets the value of [response_view][crate::model::RunTaskRequest::response_view].
1671    ///
1672    /// # Example
1673    /// ```ignore,no_run
1674    /// # use google_cloud_tasks_v2::model::RunTaskRequest;
1675    /// use google_cloud_tasks_v2::model::task::View;
1676    /// let x0 = RunTaskRequest::new().set_response_view(View::Basic);
1677    /// let x1 = RunTaskRequest::new().set_response_view(View::Full);
1678    /// ```
1679    pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
1680        mut self,
1681        v: T,
1682    ) -> Self {
1683        self.response_view = v.into();
1684        self
1685    }
1686}
1687
1688impl wkt::message::Message for RunTaskRequest {
1689    fn typename() -> &'static str {
1690        "type.googleapis.com/google.cloud.tasks.v2.RunTaskRequest"
1691    }
1692}
1693
1694/// Request message for
1695/// [UpdateCmekConfig][google.cloud.tasks.v2.CloudTasks.UpdateCmekConfig].
1696///
1697/// [google.cloud.tasks.v2.CloudTasks.UpdateCmekConfig]: crate::client::CloudTasks::update_cmek_config
1698#[derive(Clone, Default, PartialEq)]
1699#[non_exhaustive]
1700pub struct UpdateCmekConfigRequest {
1701    /// Required. The config to update.  Its name attribute distinguishes it.
1702    pub cmek_config: std::option::Option<crate::model::CmekConfig>,
1703
1704    /// List of fields to be updated in this request.
1705    pub update_mask: std::option::Option<wkt::FieldMask>,
1706
1707    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1708}
1709
1710impl UpdateCmekConfigRequest {
1711    /// Creates a new default instance.
1712    pub fn new() -> Self {
1713        std::default::Default::default()
1714    }
1715
1716    /// Sets the value of [cmek_config][crate::model::UpdateCmekConfigRequest::cmek_config].
1717    ///
1718    /// # Example
1719    /// ```ignore,no_run
1720    /// # use google_cloud_tasks_v2::model::UpdateCmekConfigRequest;
1721    /// use google_cloud_tasks_v2::model::CmekConfig;
1722    /// let x = UpdateCmekConfigRequest::new().set_cmek_config(CmekConfig::default()/* use setters */);
1723    /// ```
1724    pub fn set_cmek_config<T>(mut self, v: T) -> Self
1725    where
1726        T: std::convert::Into<crate::model::CmekConfig>,
1727    {
1728        self.cmek_config = std::option::Option::Some(v.into());
1729        self
1730    }
1731
1732    /// Sets or clears the value of [cmek_config][crate::model::UpdateCmekConfigRequest::cmek_config].
1733    ///
1734    /// # Example
1735    /// ```ignore,no_run
1736    /// # use google_cloud_tasks_v2::model::UpdateCmekConfigRequest;
1737    /// use google_cloud_tasks_v2::model::CmekConfig;
1738    /// let x = UpdateCmekConfigRequest::new().set_or_clear_cmek_config(Some(CmekConfig::default()/* use setters */));
1739    /// let x = UpdateCmekConfigRequest::new().set_or_clear_cmek_config(None::<CmekConfig>);
1740    /// ```
1741    pub fn set_or_clear_cmek_config<T>(mut self, v: std::option::Option<T>) -> Self
1742    where
1743        T: std::convert::Into<crate::model::CmekConfig>,
1744    {
1745        self.cmek_config = v.map(|x| x.into());
1746        self
1747    }
1748
1749    /// Sets the value of [update_mask][crate::model::UpdateCmekConfigRequest::update_mask].
1750    ///
1751    /// # Example
1752    /// ```ignore,no_run
1753    /// # use google_cloud_tasks_v2::model::UpdateCmekConfigRequest;
1754    /// use wkt::FieldMask;
1755    /// let x = UpdateCmekConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1756    /// ```
1757    pub fn set_update_mask<T>(mut self, v: T) -> Self
1758    where
1759        T: std::convert::Into<wkt::FieldMask>,
1760    {
1761        self.update_mask = std::option::Option::Some(v.into());
1762        self
1763    }
1764
1765    /// Sets or clears the value of [update_mask][crate::model::UpdateCmekConfigRequest::update_mask].
1766    ///
1767    /// # Example
1768    /// ```ignore,no_run
1769    /// # use google_cloud_tasks_v2::model::UpdateCmekConfigRequest;
1770    /// use wkt::FieldMask;
1771    /// let x = UpdateCmekConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1772    /// let x = UpdateCmekConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1773    /// ```
1774    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1775    where
1776        T: std::convert::Into<wkt::FieldMask>,
1777    {
1778        self.update_mask = v.map(|x| x.into());
1779        self
1780    }
1781}
1782
1783impl wkt::message::Message for UpdateCmekConfigRequest {
1784    fn typename() -> &'static str {
1785        "type.googleapis.com/google.cloud.tasks.v2.UpdateCmekConfigRequest"
1786    }
1787}
1788
1789/// Request message for
1790/// [GetCmekConfig][google.cloud.tasks.v2.CloudTasks.GetCmekConfig].
1791///
1792/// [google.cloud.tasks.v2.CloudTasks.GetCmekConfig]: crate::client::CloudTasks::get_cmek_config
1793#[derive(Clone, Default, PartialEq)]
1794#[non_exhaustive]
1795pub struct GetCmekConfigRequest {
1796    /// Required. The config. For example:
1797    /// `projects/PROJECT_ID/locations/LOCATION_ID/CmekConfig`
1798    pub name: std::string::String,
1799
1800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1801}
1802
1803impl GetCmekConfigRequest {
1804    /// Creates a new default instance.
1805    pub fn new() -> Self {
1806        std::default::Default::default()
1807    }
1808
1809    /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
1810    ///
1811    /// # Example
1812    /// ```ignore,no_run
1813    /// # use google_cloud_tasks_v2::model::GetCmekConfigRequest;
1814    /// # let project_id = "project_id";
1815    /// # let location_id = "location_id";
1816    /// let x = GetCmekConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"));
1817    /// ```
1818    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1819        self.name = v.into();
1820        self
1821    }
1822}
1823
1824impl wkt::message::Message for GetCmekConfigRequest {
1825    fn typename() -> &'static str {
1826        "type.googleapis.com/google.cloud.tasks.v2.GetCmekConfigRequest"
1827    }
1828}
1829
1830/// Response message for [BatchCreateTasks].
1831#[derive(Clone, Default, PartialEq)]
1832#[non_exhaustive]
1833pub struct BatchCreateTasksResponse {
1834    /// The tasks that were successfully created.
1835    pub tasks: std::vec::Vec<crate::model::Task>,
1836
1837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1838}
1839
1840impl BatchCreateTasksResponse {
1841    /// Creates a new default instance.
1842    pub fn new() -> Self {
1843        std::default::Default::default()
1844    }
1845
1846    /// Sets the value of [tasks][crate::model::BatchCreateTasksResponse::tasks].
1847    ///
1848    /// # Example
1849    /// ```ignore,no_run
1850    /// # use google_cloud_tasks_v2::model::BatchCreateTasksResponse;
1851    /// use google_cloud_tasks_v2::model::Task;
1852    /// let x = BatchCreateTasksResponse::new()
1853    ///     .set_tasks([
1854    ///         Task::default()/* use setters */,
1855    ///         Task::default()/* use (different) setters */,
1856    ///     ]);
1857    /// ```
1858    pub fn set_tasks<T, V>(mut self, v: T) -> Self
1859    where
1860        T: std::iter::IntoIterator<Item = V>,
1861        V: std::convert::Into<crate::model::Task>,
1862    {
1863        use std::iter::Iterator;
1864        self.tasks = v.into_iter().map(|i| i.into()).collect();
1865        self
1866    }
1867}
1868
1869impl wkt::message::Message for BatchCreateTasksResponse {
1870    fn typename() -> &'static str {
1871        "type.googleapis.com/google.cloud.tasks.v2.BatchCreateTasksResponse"
1872    }
1873}
1874
1875/// Metadata message for [BatchCreateTasks].
1876#[derive(Clone, Default, PartialEq)]
1877#[non_exhaustive]
1878pub struct BatchCreateTasksMetadata {
1879    /// The time when the batch create started.
1880    pub start_time: std::option::Option<wkt::Timestamp>,
1881
1882    /// The time when the batch create finished.
1883    pub end_time: std::option::Option<wkt::Timestamp>,
1884
1885    /// Output only. The state of the batch create operation.
1886    pub state: crate::model::batch_create_tasks_metadata::State,
1887
1888    /// A map of failed requests, where the key is the index of the request in
1889    /// BatchCreateTasksRequest.requests and the value is the error status.
1890    pub failed_requests: std::collections::HashMap<i32, google_cloud_rpc::model::Status>,
1891
1892    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1893}
1894
1895impl BatchCreateTasksMetadata {
1896    /// Creates a new default instance.
1897    pub fn new() -> Self {
1898        std::default::Default::default()
1899    }
1900
1901    /// Sets the value of [start_time][crate::model::BatchCreateTasksMetadata::start_time].
1902    ///
1903    /// # Example
1904    /// ```ignore,no_run
1905    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1906    /// use wkt::Timestamp;
1907    /// let x = BatchCreateTasksMetadata::new().set_start_time(Timestamp::default()/* use setters */);
1908    /// ```
1909    pub fn set_start_time<T>(mut self, v: T) -> Self
1910    where
1911        T: std::convert::Into<wkt::Timestamp>,
1912    {
1913        self.start_time = std::option::Option::Some(v.into());
1914        self
1915    }
1916
1917    /// Sets or clears the value of [start_time][crate::model::BatchCreateTasksMetadata::start_time].
1918    ///
1919    /// # Example
1920    /// ```ignore,no_run
1921    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1922    /// use wkt::Timestamp;
1923    /// let x = BatchCreateTasksMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1924    /// let x = BatchCreateTasksMetadata::new().set_or_clear_start_time(None::<Timestamp>);
1925    /// ```
1926    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1927    where
1928        T: std::convert::Into<wkt::Timestamp>,
1929    {
1930        self.start_time = v.map(|x| x.into());
1931        self
1932    }
1933
1934    /// Sets the value of [end_time][crate::model::BatchCreateTasksMetadata::end_time].
1935    ///
1936    /// # Example
1937    /// ```ignore,no_run
1938    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1939    /// use wkt::Timestamp;
1940    /// let x = BatchCreateTasksMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1941    /// ```
1942    pub fn set_end_time<T>(mut self, v: T) -> Self
1943    where
1944        T: std::convert::Into<wkt::Timestamp>,
1945    {
1946        self.end_time = std::option::Option::Some(v.into());
1947        self
1948    }
1949
1950    /// Sets or clears the value of [end_time][crate::model::BatchCreateTasksMetadata::end_time].
1951    ///
1952    /// # Example
1953    /// ```ignore,no_run
1954    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1955    /// use wkt::Timestamp;
1956    /// let x = BatchCreateTasksMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1957    /// let x = BatchCreateTasksMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1958    /// ```
1959    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1960    where
1961        T: std::convert::Into<wkt::Timestamp>,
1962    {
1963        self.end_time = v.map(|x| x.into());
1964        self
1965    }
1966
1967    /// Sets the value of [state][crate::model::BatchCreateTasksMetadata::state].
1968    ///
1969    /// # Example
1970    /// ```ignore,no_run
1971    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1972    /// use google_cloud_tasks_v2::model::batch_create_tasks_metadata::State;
1973    /// let x0 = BatchCreateTasksMetadata::new().set_state(State::Running);
1974    /// let x1 = BatchCreateTasksMetadata::new().set_state(State::Succeeded);
1975    /// let x2 = BatchCreateTasksMetadata::new().set_state(State::PartiallySucceeded);
1976    /// ```
1977    pub fn set_state<T: std::convert::Into<crate::model::batch_create_tasks_metadata::State>>(
1978        mut self,
1979        v: T,
1980    ) -> Self {
1981        self.state = v.into();
1982        self
1983    }
1984
1985    /// Sets the value of [failed_requests][crate::model::BatchCreateTasksMetadata::failed_requests].
1986    ///
1987    /// # Example
1988    /// ```ignore,no_run
1989    /// # use google_cloud_tasks_v2::model::BatchCreateTasksMetadata;
1990    /// use google_cloud_rpc::model::Status;
1991    /// let x = BatchCreateTasksMetadata::new().set_failed_requests([
1992    ///     (0, Status::default()/* use setters */),
1993    ///     (1, Status::default()/* use (different) setters */),
1994    /// ]);
1995    /// ```
1996    pub fn set_failed_requests<T, K, V>(mut self, v: T) -> Self
1997    where
1998        T: std::iter::IntoIterator<Item = (K, V)>,
1999        K: std::convert::Into<i32>,
2000        V: std::convert::Into<google_cloud_rpc::model::Status>,
2001    {
2002        use std::iter::Iterator;
2003        self.failed_requests = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2004        self
2005    }
2006}
2007
2008impl wkt::message::Message for BatchCreateTasksMetadata {
2009    fn typename() -> &'static str {
2010        "type.googleapis.com/google.cloud.tasks.v2.BatchCreateTasksMetadata"
2011    }
2012}
2013
2014/// Defines additional types related to [BatchCreateTasksMetadata].
2015pub mod batch_create_tasks_metadata {
2016    #[allow(unused_imports)]
2017    use super::*;
2018
2019    /// The state of the batch create operation.
2020    ///
2021    /// # Working with unknown values
2022    ///
2023    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2024    /// additional enum variants at any time. Adding new variants is not considered
2025    /// a breaking change. Applications should write their code in anticipation of:
2026    ///
2027    /// - New values appearing in future releases of the client library, **and**
2028    /// - New values received dynamically, without application changes.
2029    ///
2030    /// Please consult the [Working with enums] section in the user guide for some
2031    /// guidelines.
2032    ///
2033    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2034    #[derive(Clone, Debug, PartialEq)]
2035    #[non_exhaustive]
2036    pub enum State {
2037        /// The default value. This value is used if the state is omitted.
2038        Unspecified,
2039        /// The batch create is running.
2040        Running,
2041        /// The batch create has finished.
2042        /// All tasks in the request were successfully created.
2043        Succeeded,
2044        /// The batch create has finished with partial success.
2045        /// The tasks that failed to be created are reported in
2046        /// [failed_requests][google.cloud.tasks.v2.BatchCreateTasksMetadata.failed_requests].
2047        ///
2048        /// [google.cloud.tasks.v2.BatchCreateTasksMetadata.failed_requests]: crate::model::BatchCreateTasksMetadata::failed_requests
2049        PartiallySucceeded,
2050        /// The batch create has failed.
2051        /// This means the overall batch create operation failed to complete.
2052        /// This can happen due to an internal error preventing the operation from
2053        /// finishing.
2054        Failed,
2055        /// The batch create was cancelled.
2056        Cancelled,
2057        /// If set, the enum was initialized with an unknown value.
2058        ///
2059        /// Applications can examine the value using [State::value] or
2060        /// [State::name].
2061        UnknownValue(state::UnknownValue),
2062    }
2063
2064    #[doc(hidden)]
2065    pub mod state {
2066        #[allow(unused_imports)]
2067        use super::*;
2068        #[derive(Clone, Debug, PartialEq)]
2069        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2070    }
2071
2072    impl State {
2073        /// Gets the enum value.
2074        ///
2075        /// Returns `None` if the enum contains an unknown value deserialized from
2076        /// the string representation of enums.
2077        pub fn value(&self) -> std::option::Option<i32> {
2078            match self {
2079                Self::Unspecified => std::option::Option::Some(0),
2080                Self::Running => std::option::Option::Some(1),
2081                Self::Succeeded => std::option::Option::Some(2),
2082                Self::PartiallySucceeded => std::option::Option::Some(5),
2083                Self::Failed => std::option::Option::Some(3),
2084                Self::Cancelled => std::option::Option::Some(4),
2085                Self::UnknownValue(u) => u.0.value(),
2086            }
2087        }
2088
2089        /// Gets the enum value as a string.
2090        ///
2091        /// Returns `None` if the enum contains an unknown value deserialized from
2092        /// the integer representation of enums.
2093        pub fn name(&self) -> std::option::Option<&str> {
2094            match self {
2095                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2096                Self::Running => std::option::Option::Some("RUNNING"),
2097                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2098                Self::PartiallySucceeded => std::option::Option::Some("PARTIALLY_SUCCEEDED"),
2099                Self::Failed => std::option::Option::Some("FAILED"),
2100                Self::Cancelled => std::option::Option::Some("CANCELLED"),
2101                Self::UnknownValue(u) => u.0.name(),
2102            }
2103        }
2104    }
2105
2106    impl std::default::Default for State {
2107        fn default() -> Self {
2108            use std::convert::From;
2109            Self::from(0)
2110        }
2111    }
2112
2113    impl std::fmt::Display for State {
2114        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2115            wkt::internal::display_enum(f, self.name(), self.value())
2116        }
2117    }
2118
2119    impl std::convert::From<i32> for State {
2120        fn from(value: i32) -> Self {
2121            match value {
2122                0 => Self::Unspecified,
2123                1 => Self::Running,
2124                2 => Self::Succeeded,
2125                3 => Self::Failed,
2126                4 => Self::Cancelled,
2127                5 => Self::PartiallySucceeded,
2128                _ => Self::UnknownValue(state::UnknownValue(
2129                    wkt::internal::UnknownEnumValue::Integer(value),
2130                )),
2131            }
2132        }
2133    }
2134
2135    impl std::convert::From<&str> for State {
2136        fn from(value: &str) -> Self {
2137            use std::string::ToString;
2138            match value {
2139                "STATE_UNSPECIFIED" => Self::Unspecified,
2140                "RUNNING" => Self::Running,
2141                "SUCCEEDED" => Self::Succeeded,
2142                "PARTIALLY_SUCCEEDED" => Self::PartiallySucceeded,
2143                "FAILED" => Self::Failed,
2144                "CANCELLED" => Self::Cancelled,
2145                _ => Self::UnknownValue(state::UnknownValue(
2146                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2147                )),
2148            }
2149        }
2150    }
2151
2152    impl serde::ser::Serialize for State {
2153        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2154        where
2155            S: serde::Serializer,
2156        {
2157            match self {
2158                Self::Unspecified => serializer.serialize_i32(0),
2159                Self::Running => serializer.serialize_i32(1),
2160                Self::Succeeded => serializer.serialize_i32(2),
2161                Self::PartiallySucceeded => serializer.serialize_i32(5),
2162                Self::Failed => serializer.serialize_i32(3),
2163                Self::Cancelled => serializer.serialize_i32(4),
2164                Self::UnknownValue(u) => u.0.serialize(serializer),
2165            }
2166        }
2167    }
2168
2169    impl<'de> serde::de::Deserialize<'de> for State {
2170        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2171        where
2172            D: serde::Deserializer<'de>,
2173        {
2174            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2175                ".google.cloud.tasks.v2.BatchCreateTasksMetadata.State",
2176            ))
2177        }
2178    }
2179}
2180
2181/// Describes the customer-managed encryption key (CMEK) configuration associated
2182/// with a project and location.
2183#[derive(Clone, Default, PartialEq)]
2184#[non_exhaustive]
2185pub struct CmekConfig {
2186    /// Output only. The config resource name which includes the project and
2187    /// location and must end in 'cmekConfig', in the format
2188    /// `projects/PROJECT_ID/locations/LOCATION_ID/cmekConfig`
2189    pub name: std::string::String,
2190
2191    /// Resource name of the Cloud KMS key, of the form
2192    /// `projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING_ID/cryptoKeys/KEY_ID`,
2193    /// that will be used to encrypt the Queues & Tasks in the region. Setting
2194    /// this as blank will turn off CMEK encryption.
2195    pub kms_key: std::string::String,
2196
2197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2198}
2199
2200impl CmekConfig {
2201    /// Creates a new default instance.
2202    pub fn new() -> Self {
2203        std::default::Default::default()
2204    }
2205
2206    /// Sets the value of [name][crate::model::CmekConfig::name].
2207    ///
2208    /// # Example
2209    /// ```ignore,no_run
2210    /// # use google_cloud_tasks_v2::model::CmekConfig;
2211    /// # let project_id = "project_id";
2212    /// # let location_id = "location_id";
2213    /// let x = CmekConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"));
2214    /// ```
2215    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2216        self.name = v.into();
2217        self
2218    }
2219
2220    /// Sets the value of [kms_key][crate::model::CmekConfig::kms_key].
2221    ///
2222    /// # Example
2223    /// ```ignore,no_run
2224    /// # use google_cloud_tasks_v2::model::CmekConfig;
2225    /// let x = CmekConfig::new().set_kms_key("example");
2226    /// ```
2227    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2228        self.kms_key = v.into();
2229        self
2230    }
2231}
2232
2233impl wkt::message::Message for CmekConfig {
2234    fn typename() -> &'static str {
2235        "type.googleapis.com/google.cloud.tasks.v2.CmekConfig"
2236    }
2237}
2238
2239/// A queue is a container of related tasks. Queues are configured to manage
2240/// how those tasks are dispatched. Configurable properties include rate limits,
2241/// retry options, queue types, and others.
2242#[derive(Clone, Default, PartialEq)]
2243#[non_exhaustive]
2244pub struct Queue {
2245    /// Caller-specified and required in
2246    /// [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue], after which it
2247    /// becomes output only.
2248    ///
2249    /// The queue name.
2250    ///
2251    /// The queue name must have the following format:
2252    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
2253    ///
2254    /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
2255    ///   hyphens (-), colons (:), or periods (.).
2256    ///   For more information, see
2257    ///   [Identifying
2258    ///   projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
2259    /// * `LOCATION_ID` is the canonical ID for the queue's location.
2260    ///   The list of available locations can be obtained by calling
2261    ///   [ListLocations][google.cloud.location.Locations.ListLocations].
2262    ///   For more information, see <https://cloud.google.com/about/locations/>.
2263    /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
2264    ///   hyphens (-). The maximum length is 100 characters.
2265    ///
2266    /// [google.cloud.tasks.v2.CloudTasks.CreateQueue]: crate::client::CloudTasks::create_queue
2267    pub name: std::string::String,
2268
2269    /// Overrides for
2270    /// [task-level
2271    /// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
2272    /// These settings apply only to
2273    /// [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in this
2274    /// queue. [Http tasks][google.cloud.tasks.v2.HttpRequest] are not affected.
2275    ///
2276    /// If set, `app_engine_routing_override` is used for all
2277    /// [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in the
2278    /// queue, no matter what the setting is for the [task-level
2279    /// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
2280    ///
2281    /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
2282    /// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
2283    /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
2284    pub app_engine_routing_override: std::option::Option<crate::model::AppEngineRouting>,
2285
2286    /// Modifies HTTP target for HTTP tasks.
2287    pub http_target: std::option::Option<crate::model::HttpTarget>,
2288
2289    /// Rate limits for task dispatches.
2290    ///
2291    /// [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] and
2292    /// [retry_config][google.cloud.tasks.v2.Queue.retry_config] are related
2293    /// because they both control task attempts. However they control task attempts
2294    /// in different ways:
2295    ///
2296    /// * [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] controls the total
2297    ///   rate of
2298    ///   dispatches from a queue (i.e. all traffic dispatched from the
2299    ///   queue, regardless of whether the dispatch is from a first
2300    ///   attempt or a retry).
2301    /// * [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls what
2302    ///   happens to a
2303    ///   particular task after its first attempt fails. That is,
2304    ///   [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls task
2305    ///   retries (the second attempt, third attempt, etc).
2306    ///
2307    /// The queue's actual dispatch rate is the result of:
2308    ///
2309    /// * Number of tasks in the queue
2310    /// * User-specified throttling:
2311    ///   [rate_limits][google.cloud.tasks.v2.Queue.rate_limits],
2312    ///   [retry_config][google.cloud.tasks.v2.Queue.retry_config], and the
2313    ///   [queue's state][google.cloud.tasks.v2.Queue.state].
2314    /// * System throttling due to `429` (Too Many Requests) or `503` (Service
2315    ///   Unavailable) responses from the worker, high error rates, or to smooth
2316    ///   sudden large traffic spikes.
2317    ///
2318    /// [google.cloud.tasks.v2.Queue.rate_limits]: crate::model::Queue::rate_limits
2319    /// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
2320    /// [google.cloud.tasks.v2.Queue.state]: crate::model::Queue::state
2321    pub rate_limits: std::option::Option<crate::model::RateLimits>,
2322
2323    /// Settings that determine the retry behavior.
2324    ///
2325    /// * For tasks created using Cloud Tasks: the queue-level retry settings
2326    ///   apply to all tasks in the queue that were created using Cloud Tasks.
2327    ///   Retry settings cannot be set on individual tasks.
2328    /// * For tasks created using the App Engine SDK: the queue-level retry
2329    ///   settings apply to all tasks in the queue which do not have retry settings
2330    ///   explicitly set on the task and were created by the App Engine SDK. See
2331    ///   [App Engine
2332    ///   documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks).
2333    pub retry_config: std::option::Option<crate::model::RetryConfig>,
2334
2335    /// Output only. The state of the queue.
2336    ///
2337    /// `state` can only be changed by calling
2338    /// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue],
2339    /// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue], or uploading
2340    /// [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref).
2341    /// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] cannot be used
2342    /// to change `state`.
2343    ///
2344    /// [google.cloud.tasks.v2.CloudTasks.PauseQueue]: crate::client::CloudTasks::pause_queue
2345    /// [google.cloud.tasks.v2.CloudTasks.ResumeQueue]: crate::client::CloudTasks::resume_queue
2346    /// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
2347    pub state: crate::model::queue::State,
2348
2349    /// Output only. The last time this queue was purged.
2350    ///
2351    /// All tasks that were [created][google.cloud.tasks.v2.Task.create_time]
2352    /// before this time were purged.
2353    ///
2354    /// A queue can be purged using
2355    /// [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue], the [App Engine
2356    /// Task Queue SDK, or the Cloud
2357    /// Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue).
2358    ///
2359    /// Purge time will be truncated to the nearest microsecond. Purge
2360    /// time will be unset if the queue has never been purged.
2361    ///
2362    /// [google.cloud.tasks.v2.CloudTasks.PurgeQueue]: crate::client::CloudTasks::purge_queue
2363    /// [google.cloud.tasks.v2.Task.create_time]: crate::model::Task::create_time
2364    pub purge_time: std::option::Option<wkt::Timestamp>,
2365
2366    /// Configuration options for writing logs to
2367    /// [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this
2368    /// field is unset, then no logs are written.
2369    pub stackdriver_logging_config: std::option::Option<crate::model::StackdriverLoggingConfig>,
2370
2371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2372}
2373
2374impl Queue {
2375    /// Creates a new default instance.
2376    pub fn new() -> Self {
2377        std::default::Default::default()
2378    }
2379
2380    /// Sets the value of [name][crate::model::Queue::name].
2381    ///
2382    /// # Example
2383    /// ```ignore,no_run
2384    /// # use google_cloud_tasks_v2::model::Queue;
2385    /// # let project_id = "project_id";
2386    /// # let location_id = "location_id";
2387    /// # let queue_id = "queue_id";
2388    /// let x = Queue::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}"));
2389    /// ```
2390    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2391        self.name = v.into();
2392        self
2393    }
2394
2395    /// Sets the value of [app_engine_routing_override][crate::model::Queue::app_engine_routing_override].
2396    ///
2397    /// # Example
2398    /// ```ignore,no_run
2399    /// # use google_cloud_tasks_v2::model::Queue;
2400    /// use google_cloud_tasks_v2::model::AppEngineRouting;
2401    /// let x = Queue::new().set_app_engine_routing_override(AppEngineRouting::default()/* use setters */);
2402    /// ```
2403    pub fn set_app_engine_routing_override<T>(mut self, v: T) -> Self
2404    where
2405        T: std::convert::Into<crate::model::AppEngineRouting>,
2406    {
2407        self.app_engine_routing_override = std::option::Option::Some(v.into());
2408        self
2409    }
2410
2411    /// Sets or clears the value of [app_engine_routing_override][crate::model::Queue::app_engine_routing_override].
2412    ///
2413    /// # Example
2414    /// ```ignore,no_run
2415    /// # use google_cloud_tasks_v2::model::Queue;
2416    /// use google_cloud_tasks_v2::model::AppEngineRouting;
2417    /// let x = Queue::new().set_or_clear_app_engine_routing_override(Some(AppEngineRouting::default()/* use setters */));
2418    /// let x = Queue::new().set_or_clear_app_engine_routing_override(None::<AppEngineRouting>);
2419    /// ```
2420    pub fn set_or_clear_app_engine_routing_override<T>(mut self, v: std::option::Option<T>) -> Self
2421    where
2422        T: std::convert::Into<crate::model::AppEngineRouting>,
2423    {
2424        self.app_engine_routing_override = v.map(|x| x.into());
2425        self
2426    }
2427
2428    /// Sets the value of [http_target][crate::model::Queue::http_target].
2429    ///
2430    /// # Example
2431    /// ```ignore,no_run
2432    /// # use google_cloud_tasks_v2::model::Queue;
2433    /// use google_cloud_tasks_v2::model::HttpTarget;
2434    /// let x = Queue::new().set_http_target(HttpTarget::default()/* use setters */);
2435    /// ```
2436    pub fn set_http_target<T>(mut self, v: T) -> Self
2437    where
2438        T: std::convert::Into<crate::model::HttpTarget>,
2439    {
2440        self.http_target = std::option::Option::Some(v.into());
2441        self
2442    }
2443
2444    /// Sets or clears the value of [http_target][crate::model::Queue::http_target].
2445    ///
2446    /// # Example
2447    /// ```ignore,no_run
2448    /// # use google_cloud_tasks_v2::model::Queue;
2449    /// use google_cloud_tasks_v2::model::HttpTarget;
2450    /// let x = Queue::new().set_or_clear_http_target(Some(HttpTarget::default()/* use setters */));
2451    /// let x = Queue::new().set_or_clear_http_target(None::<HttpTarget>);
2452    /// ```
2453    pub fn set_or_clear_http_target<T>(mut self, v: std::option::Option<T>) -> Self
2454    where
2455        T: std::convert::Into<crate::model::HttpTarget>,
2456    {
2457        self.http_target = v.map(|x| x.into());
2458        self
2459    }
2460
2461    /// Sets the value of [rate_limits][crate::model::Queue::rate_limits].
2462    ///
2463    /// # Example
2464    /// ```ignore,no_run
2465    /// # use google_cloud_tasks_v2::model::Queue;
2466    /// use google_cloud_tasks_v2::model::RateLimits;
2467    /// let x = Queue::new().set_rate_limits(RateLimits::default()/* use setters */);
2468    /// ```
2469    pub fn set_rate_limits<T>(mut self, v: T) -> Self
2470    where
2471        T: std::convert::Into<crate::model::RateLimits>,
2472    {
2473        self.rate_limits = std::option::Option::Some(v.into());
2474        self
2475    }
2476
2477    /// Sets or clears the value of [rate_limits][crate::model::Queue::rate_limits].
2478    ///
2479    /// # Example
2480    /// ```ignore,no_run
2481    /// # use google_cloud_tasks_v2::model::Queue;
2482    /// use google_cloud_tasks_v2::model::RateLimits;
2483    /// let x = Queue::new().set_or_clear_rate_limits(Some(RateLimits::default()/* use setters */));
2484    /// let x = Queue::new().set_or_clear_rate_limits(None::<RateLimits>);
2485    /// ```
2486    pub fn set_or_clear_rate_limits<T>(mut self, v: std::option::Option<T>) -> Self
2487    where
2488        T: std::convert::Into<crate::model::RateLimits>,
2489    {
2490        self.rate_limits = v.map(|x| x.into());
2491        self
2492    }
2493
2494    /// Sets the value of [retry_config][crate::model::Queue::retry_config].
2495    ///
2496    /// # Example
2497    /// ```ignore,no_run
2498    /// # use google_cloud_tasks_v2::model::Queue;
2499    /// use google_cloud_tasks_v2::model::RetryConfig;
2500    /// let x = Queue::new().set_retry_config(RetryConfig::default()/* use setters */);
2501    /// ```
2502    pub fn set_retry_config<T>(mut self, v: T) -> Self
2503    where
2504        T: std::convert::Into<crate::model::RetryConfig>,
2505    {
2506        self.retry_config = std::option::Option::Some(v.into());
2507        self
2508    }
2509
2510    /// Sets or clears the value of [retry_config][crate::model::Queue::retry_config].
2511    ///
2512    /// # Example
2513    /// ```ignore,no_run
2514    /// # use google_cloud_tasks_v2::model::Queue;
2515    /// use google_cloud_tasks_v2::model::RetryConfig;
2516    /// let x = Queue::new().set_or_clear_retry_config(Some(RetryConfig::default()/* use setters */));
2517    /// let x = Queue::new().set_or_clear_retry_config(None::<RetryConfig>);
2518    /// ```
2519    pub fn set_or_clear_retry_config<T>(mut self, v: std::option::Option<T>) -> Self
2520    where
2521        T: std::convert::Into<crate::model::RetryConfig>,
2522    {
2523        self.retry_config = v.map(|x| x.into());
2524        self
2525    }
2526
2527    /// Sets the value of [state][crate::model::Queue::state].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_tasks_v2::model::Queue;
2532    /// use google_cloud_tasks_v2::model::queue::State;
2533    /// let x0 = Queue::new().set_state(State::Running);
2534    /// let x1 = Queue::new().set_state(State::Paused);
2535    /// let x2 = Queue::new().set_state(State::Disabled);
2536    /// ```
2537    pub fn set_state<T: std::convert::Into<crate::model::queue::State>>(mut self, v: T) -> Self {
2538        self.state = v.into();
2539        self
2540    }
2541
2542    /// Sets the value of [purge_time][crate::model::Queue::purge_time].
2543    ///
2544    /// # Example
2545    /// ```ignore,no_run
2546    /// # use google_cloud_tasks_v2::model::Queue;
2547    /// use wkt::Timestamp;
2548    /// let x = Queue::new().set_purge_time(Timestamp::default()/* use setters */);
2549    /// ```
2550    pub fn set_purge_time<T>(mut self, v: T) -> Self
2551    where
2552        T: std::convert::Into<wkt::Timestamp>,
2553    {
2554        self.purge_time = std::option::Option::Some(v.into());
2555        self
2556    }
2557
2558    /// Sets or clears the value of [purge_time][crate::model::Queue::purge_time].
2559    ///
2560    /// # Example
2561    /// ```ignore,no_run
2562    /// # use google_cloud_tasks_v2::model::Queue;
2563    /// use wkt::Timestamp;
2564    /// let x = Queue::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
2565    /// let x = Queue::new().set_or_clear_purge_time(None::<Timestamp>);
2566    /// ```
2567    pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
2568    where
2569        T: std::convert::Into<wkt::Timestamp>,
2570    {
2571        self.purge_time = v.map(|x| x.into());
2572        self
2573    }
2574
2575    /// Sets the value of [stackdriver_logging_config][crate::model::Queue::stackdriver_logging_config].
2576    ///
2577    /// # Example
2578    /// ```ignore,no_run
2579    /// # use google_cloud_tasks_v2::model::Queue;
2580    /// use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
2581    /// let x = Queue::new().set_stackdriver_logging_config(StackdriverLoggingConfig::default()/* use setters */);
2582    /// ```
2583    pub fn set_stackdriver_logging_config<T>(mut self, v: T) -> Self
2584    where
2585        T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
2586    {
2587        self.stackdriver_logging_config = std::option::Option::Some(v.into());
2588        self
2589    }
2590
2591    /// Sets or clears the value of [stackdriver_logging_config][crate::model::Queue::stackdriver_logging_config].
2592    ///
2593    /// # Example
2594    /// ```ignore,no_run
2595    /// # use google_cloud_tasks_v2::model::Queue;
2596    /// use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
2597    /// let x = Queue::new().set_or_clear_stackdriver_logging_config(Some(StackdriverLoggingConfig::default()/* use setters */));
2598    /// let x = Queue::new().set_or_clear_stackdriver_logging_config(None::<StackdriverLoggingConfig>);
2599    /// ```
2600    pub fn set_or_clear_stackdriver_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
2601    where
2602        T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
2603    {
2604        self.stackdriver_logging_config = v.map(|x| x.into());
2605        self
2606    }
2607}
2608
2609impl wkt::message::Message for Queue {
2610    fn typename() -> &'static str {
2611        "type.googleapis.com/google.cloud.tasks.v2.Queue"
2612    }
2613}
2614
2615/// Defines additional types related to [Queue].
2616pub mod queue {
2617    #[allow(unused_imports)]
2618    use super::*;
2619
2620    /// State of the queue.
2621    ///
2622    /// # Working with unknown values
2623    ///
2624    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2625    /// additional enum variants at any time. Adding new variants is not considered
2626    /// a breaking change. Applications should write their code in anticipation of:
2627    ///
2628    /// - New values appearing in future releases of the client library, **and**
2629    /// - New values received dynamically, without application changes.
2630    ///
2631    /// Please consult the [Working with enums] section in the user guide for some
2632    /// guidelines.
2633    ///
2634    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2635    #[derive(Clone, Debug, PartialEq)]
2636    #[non_exhaustive]
2637    pub enum State {
2638        /// Unspecified state.
2639        Unspecified,
2640        /// The queue is running. Tasks can be dispatched.
2641        ///
2642        /// If the queue was created using Cloud Tasks and the queue has
2643        /// had no activity (method calls or task dispatches) for 30 days,
2644        /// the queue may take a few minutes to re-activate. Some method
2645        /// calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and
2646        /// tasks may not be dispatched for a few minutes until the queue
2647        /// has been re-activated.
2648        Running,
2649        /// Tasks are paused by the user. If the queue is paused then Cloud
2650        /// Tasks will stop delivering tasks from it, but more tasks can
2651        /// still be added to it by the user.
2652        Paused,
2653        /// The queue is disabled.
2654        ///
2655        /// A queue becomes `DISABLED` when
2656        /// [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref)
2657        /// or
2658        /// [queue.xml](https://cloud.google.com/appengine/docs/standard/java/config/queueref)
2659        /// is uploaded which does not contain the queue. You cannot directly disable
2660        /// a queue.
2661        ///
2662        /// When a queue is disabled, tasks can still be added to a queue
2663        /// but the tasks are not dispatched.
2664        ///
2665        /// To permanently delete this queue and all of its tasks, call
2666        /// [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue].
2667        ///
2668        /// [google.cloud.tasks.v2.CloudTasks.DeleteQueue]: crate::client::CloudTasks::delete_queue
2669        Disabled,
2670        /// If set, the enum was initialized with an unknown value.
2671        ///
2672        /// Applications can examine the value using [State::value] or
2673        /// [State::name].
2674        UnknownValue(state::UnknownValue),
2675    }
2676
2677    #[doc(hidden)]
2678    pub mod state {
2679        #[allow(unused_imports)]
2680        use super::*;
2681        #[derive(Clone, Debug, PartialEq)]
2682        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2683    }
2684
2685    impl State {
2686        /// Gets the enum value.
2687        ///
2688        /// Returns `None` if the enum contains an unknown value deserialized from
2689        /// the string representation of enums.
2690        pub fn value(&self) -> std::option::Option<i32> {
2691            match self {
2692                Self::Unspecified => std::option::Option::Some(0),
2693                Self::Running => std::option::Option::Some(1),
2694                Self::Paused => std::option::Option::Some(2),
2695                Self::Disabled => std::option::Option::Some(3),
2696                Self::UnknownValue(u) => u.0.value(),
2697            }
2698        }
2699
2700        /// Gets the enum value as a string.
2701        ///
2702        /// Returns `None` if the enum contains an unknown value deserialized from
2703        /// the integer representation of enums.
2704        pub fn name(&self) -> std::option::Option<&str> {
2705            match self {
2706                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2707                Self::Running => std::option::Option::Some("RUNNING"),
2708                Self::Paused => std::option::Option::Some("PAUSED"),
2709                Self::Disabled => std::option::Option::Some("DISABLED"),
2710                Self::UnknownValue(u) => u.0.name(),
2711            }
2712        }
2713    }
2714
2715    impl std::default::Default for State {
2716        fn default() -> Self {
2717            use std::convert::From;
2718            Self::from(0)
2719        }
2720    }
2721
2722    impl std::fmt::Display for State {
2723        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2724            wkt::internal::display_enum(f, self.name(), self.value())
2725        }
2726    }
2727
2728    impl std::convert::From<i32> for State {
2729        fn from(value: i32) -> Self {
2730            match value {
2731                0 => Self::Unspecified,
2732                1 => Self::Running,
2733                2 => Self::Paused,
2734                3 => Self::Disabled,
2735                _ => Self::UnknownValue(state::UnknownValue(
2736                    wkt::internal::UnknownEnumValue::Integer(value),
2737                )),
2738            }
2739        }
2740    }
2741
2742    impl std::convert::From<&str> for State {
2743        fn from(value: &str) -> Self {
2744            use std::string::ToString;
2745            match value {
2746                "STATE_UNSPECIFIED" => Self::Unspecified,
2747                "RUNNING" => Self::Running,
2748                "PAUSED" => Self::Paused,
2749                "DISABLED" => Self::Disabled,
2750                _ => Self::UnknownValue(state::UnknownValue(
2751                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2752                )),
2753            }
2754        }
2755    }
2756
2757    impl serde::ser::Serialize for State {
2758        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2759        where
2760            S: serde::Serializer,
2761        {
2762            match self {
2763                Self::Unspecified => serializer.serialize_i32(0),
2764                Self::Running => serializer.serialize_i32(1),
2765                Self::Paused => serializer.serialize_i32(2),
2766                Self::Disabled => serializer.serialize_i32(3),
2767                Self::UnknownValue(u) => u.0.serialize(serializer),
2768            }
2769        }
2770    }
2771
2772    impl<'de> serde::de::Deserialize<'de> for State {
2773        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2774        where
2775            D: serde::Deserializer<'de>,
2776        {
2777            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2778                ".google.cloud.tasks.v2.Queue.State",
2779            ))
2780        }
2781    }
2782}
2783
2784/// Rate limits.
2785///
2786/// This message determines the maximum rate that tasks can be dispatched by a
2787/// queue, regardless of whether the dispatch is a first task attempt or a retry.
2788///
2789/// Note: The debugging command,
2790/// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task even if
2791/// the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits].
2792///
2793/// [google.cloud.tasks.v2.CloudTasks.RunTask]: crate::client::CloudTasks::run_task
2794/// [google.cloud.tasks.v2.RateLimits]: crate::model::RateLimits
2795#[derive(Clone, Default, PartialEq)]
2796#[non_exhaustive]
2797pub struct RateLimits {
2798    /// The maximum rate at which tasks are dispatched from this queue.
2799    ///
2800    /// If unspecified when the queue is created, Cloud Tasks will pick the
2801    /// default.
2802    ///
2803    /// The maximum allowed value is 500.
2804    ///
2805    /// This field has the same meaning as
2806    /// [rate in
2807    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate).
2808    pub max_dispatches_per_second: f64,
2809
2810    /// Output only. The max burst size.
2811    ///
2812    /// Max burst size limits how fast tasks in queue are processed when
2813    /// many tasks are in the queue and the rate is high. This field
2814    /// allows the queue to have a high rate so processing starts shortly
2815    /// after a task is enqueued, but still limits resource usage when
2816    /// many tasks are enqueued in a short period of time.
2817    ///
2818    /// The [token bucket](https://wikipedia.org/wiki/Token_Bucket)
2819    /// algorithm is used to control the rate of task dispatches. Each
2820    /// queue has a token bucket that holds tokens, up to the maximum
2821    /// specified by `max_burst_size`. Each time a task is dispatched, a
2822    /// token is removed from the bucket. Tasks will be dispatched until
2823    /// the queue's bucket runs out of tokens. The bucket will be
2824    /// continuously refilled with new tokens based on
2825    /// `max_dispatches_per_second`.
2826    ///
2827    /// Cloud Tasks automatically sets an appropriate `max_burst_size` based
2828    /// on the value of `max_dispatches_per_second`. The value is dynamically
2829    /// optimized to ensure queue stability and throughput. It is generally at
2830    /// least equal to `max_dispatches_per_second` but might be higher to
2831    /// accommodate bursts of traffic.
2832    ///
2833    /// For queues that were created or updated using
2834    /// `queue.yaml/xml`, `max_burst_size` is equal to
2835    /// [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size).
2836    /// Since `max_burst_size` is output only, if
2837    /// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a
2838    /// queue created by `queue.yaml/xml`, `max_burst_size` will be reset based on
2839    /// the value of `max_dispatches_per_second`, regardless of whether
2840    /// `max_dispatches_per_second` is updated.
2841    ///
2842    /// [google.cloud.tasks.v2.CloudTasks.UpdateQueue]: crate::client::CloudTasks::update_queue
2843    pub max_burst_size: i32,
2844
2845    /// The maximum number of concurrent tasks that Cloud Tasks allows
2846    /// to be dispatched for this queue. After this threshold has been
2847    /// reached, Cloud Tasks stops dispatching tasks until the number of
2848    /// concurrent requests decreases.
2849    ///
2850    /// If unspecified when the queue is created, Cloud Tasks will pick the
2851    /// default.
2852    ///
2853    /// The maximum allowed value is 5,000.
2854    ///
2855    /// This field has the same meaning as
2856    /// [max_concurrent_requests in
2857    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests).
2858    pub max_concurrent_dispatches: i32,
2859
2860    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2861}
2862
2863impl RateLimits {
2864    /// Creates a new default instance.
2865    pub fn new() -> Self {
2866        std::default::Default::default()
2867    }
2868
2869    /// Sets the value of [max_dispatches_per_second][crate::model::RateLimits::max_dispatches_per_second].
2870    ///
2871    /// # Example
2872    /// ```ignore,no_run
2873    /// # use google_cloud_tasks_v2::model::RateLimits;
2874    /// let x = RateLimits::new().set_max_dispatches_per_second(42.0);
2875    /// ```
2876    pub fn set_max_dispatches_per_second<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2877        self.max_dispatches_per_second = v.into();
2878        self
2879    }
2880
2881    /// Sets the value of [max_burst_size][crate::model::RateLimits::max_burst_size].
2882    ///
2883    /// # Example
2884    /// ```ignore,no_run
2885    /// # use google_cloud_tasks_v2::model::RateLimits;
2886    /// let x = RateLimits::new().set_max_burst_size(42);
2887    /// ```
2888    pub fn set_max_burst_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2889        self.max_burst_size = v.into();
2890        self
2891    }
2892
2893    /// Sets the value of [max_concurrent_dispatches][crate::model::RateLimits::max_concurrent_dispatches].
2894    ///
2895    /// # Example
2896    /// ```ignore,no_run
2897    /// # use google_cloud_tasks_v2::model::RateLimits;
2898    /// let x = RateLimits::new().set_max_concurrent_dispatches(42);
2899    /// ```
2900    pub fn set_max_concurrent_dispatches<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2901        self.max_concurrent_dispatches = v.into();
2902        self
2903    }
2904}
2905
2906impl wkt::message::Message for RateLimits {
2907    fn typename() -> &'static str {
2908        "type.googleapis.com/google.cloud.tasks.v2.RateLimits"
2909    }
2910}
2911
2912/// Retry config.
2913///
2914/// These settings determine when a failed task attempt is retried.
2915#[derive(Clone, Default, PartialEq)]
2916#[non_exhaustive]
2917pub struct RetryConfig {
2918    /// Number of attempts per task, including the first attempt. (If the
2919    /// first attempt fails, there will be `max_attempts - 1` retries.)
2920    ///
2921    /// Must be greater than or equal to -1, which indicates unlimited attempts.
2922    ///
2923    /// Cloud Tasks stops retrying only when `max_attempts` and
2924    /// `max_retry_duration` are both satisfied, or when the task is successfully
2925    /// executed. When the task has been attempted
2926    /// `max_attempts` times and when the `max_retry_duration` time has passed, no
2927    /// further attempts are made, and the task is deleted. If `max_attempts` is
2928    /// set to -1 and `max_retry_duration` is set to 0, the task is retried
2929    /// until the [maximum task
2930    /// retention](https://docs.cloud.google.com/tasks/docs/quotas#limits) limit is
2931    /// reached.
2932    ///
2933    /// If unspecified when the queue is created, Cloud Tasks will pick the
2934    /// default.
2935    ///
2936    /// This field has the same meaning as
2937    /// [task_retry_limit in
2938    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
2939    pub max_attempts: i32,
2940
2941    /// If positive, `max_retry_duration` specifies the time limit for
2942    /// retrying a failed task, measured from when the task was first
2943    /// attempted. Once `max_retry_duration` time has passed *and* the
2944    /// task has been attempted
2945    /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times, no
2946    /// further attempts are made and the task is deleted.
2947    ///
2948    /// A zero (0) indicates an unlimited duration, up to the
2949    /// [maximum task
2950    /// retention](https://docs.cloud.google.com/tasks/docs/quotas#limits) limit.
2951    ///
2952    /// The value must be given as a string that indicates the length of time
2953    /// (in seconds) followed by `s` (for "seconds"). For the maximum possible
2954    /// value or the format, see the documentation for
2955    /// [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration).
2956    /// `max_retry_duration` will be truncated to the nearest second.
2957    ///
2958    /// If unspecified when the queue is created, Cloud Tasks will pick the
2959    /// default.
2960    ///
2961    /// This field has the same meaning as
2962    /// [task_age_limit in
2963    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
2964    ///
2965    /// [google.cloud.tasks.v2.RetryConfig.max_attempts]: crate::model::RetryConfig::max_attempts
2966    pub max_retry_duration: std::option::Option<wkt::Duration>,
2967
2968    /// A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
2969    /// retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
2970    /// and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
2971    /// after it fails, if the queue's
2972    /// [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
2973    /// should be retried.
2974    ///
2975    /// The value must be given as a string that indicates the length of time
2976    /// (in seconds) followed by `s` (for "seconds"). For more information on the
2977    /// format, see the documentation for
2978    /// [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration).
2979    /// `min_backoff` will be truncated to the nearest second.
2980    ///
2981    /// If unspecified when the queue is created, Cloud Tasks will pick the
2982    /// default.
2983    ///
2984    /// This field has the same meaning as
2985    /// [min_backoff_seconds in
2986    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
2987    ///
2988    /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
2989    /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
2990    /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
2991    /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
2992    pub min_backoff: std::option::Option<wkt::Duration>,
2993
2994    /// A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for
2995    /// retry between [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff]
2996    /// and [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration
2997    /// after it fails, if the queue's
2998    /// [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task
2999    /// should be retried.
3000    ///
3001    /// The value must be given as a string that indicates the length of time
3002    /// (in seconds) followed by `s` (for "seconds"). For more information on the
3003    /// format, see the documentation for
3004    /// [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration).
3005    /// `max_backoff` will be truncated to the nearest second.
3006    ///
3007    /// If unspecified when the queue is created, Cloud Tasks will pick the
3008    /// default.
3009    ///
3010    /// This field has the same meaning as
3011    /// [max_backoff_seconds in
3012    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
3013    ///
3014    /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
3015    /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
3016    /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
3017    /// [google.cloud.tasks.v2.Task.schedule_time]: crate::model::Task::schedule_time
3018    pub max_backoff: std::option::Option<wkt::Duration>,
3019
3020    /// The time between retries will double `max_doublings` times.
3021    ///
3022    /// A task's retry interval starts at
3023    /// [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles
3024    /// `max_doublings` times, then increases linearly, and finally
3025    /// retries at intervals of
3026    /// [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to
3027    /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times.
3028    ///
3029    /// For example, if
3030    /// [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] is 10s,
3031    /// [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] is 300s, and
3032    /// `max_doublings` is 3, then the a task will first be retried in
3033    /// 10s. The retry interval will double three times, and then
3034    /// increase linearly by 2^3 * 10s.  Finally, the task will retry at
3035    /// intervals of [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff]
3036    /// until the task has been attempted
3037    /// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times. Thus,
3038    /// the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....
3039    ///
3040    /// If unspecified when the queue is created, Cloud Tasks will pick the
3041    /// default.
3042    ///
3043    /// This field has the same meaning as
3044    /// [max_doublings in
3045    /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters).
3046    ///
3047    /// [google.cloud.tasks.v2.RetryConfig.max_attempts]: crate::model::RetryConfig::max_attempts
3048    /// [google.cloud.tasks.v2.RetryConfig.max_backoff]: crate::model::RetryConfig::max_backoff
3049    /// [google.cloud.tasks.v2.RetryConfig.min_backoff]: crate::model::RetryConfig::min_backoff
3050    pub max_doublings: i32,
3051
3052    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3053}
3054
3055impl RetryConfig {
3056    /// Creates a new default instance.
3057    pub fn new() -> Self {
3058        std::default::Default::default()
3059    }
3060
3061    /// Sets the value of [max_attempts][crate::model::RetryConfig::max_attempts].
3062    ///
3063    /// # Example
3064    /// ```ignore,no_run
3065    /// # use google_cloud_tasks_v2::model::RetryConfig;
3066    /// let x = RetryConfig::new().set_max_attempts(42);
3067    /// ```
3068    pub fn set_max_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3069        self.max_attempts = v.into();
3070        self
3071    }
3072
3073    /// Sets the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
3074    ///
3075    /// # Example
3076    /// ```ignore,no_run
3077    /// # use google_cloud_tasks_v2::model::RetryConfig;
3078    /// use wkt::Duration;
3079    /// let x = RetryConfig::new().set_max_retry_duration(Duration::default()/* use setters */);
3080    /// ```
3081    pub fn set_max_retry_duration<T>(mut self, v: T) -> Self
3082    where
3083        T: std::convert::Into<wkt::Duration>,
3084    {
3085        self.max_retry_duration = std::option::Option::Some(v.into());
3086        self
3087    }
3088
3089    /// Sets or clears the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
3090    ///
3091    /// # Example
3092    /// ```ignore,no_run
3093    /// # use google_cloud_tasks_v2::model::RetryConfig;
3094    /// use wkt::Duration;
3095    /// let x = RetryConfig::new().set_or_clear_max_retry_duration(Some(Duration::default()/* use setters */));
3096    /// let x = RetryConfig::new().set_or_clear_max_retry_duration(None::<Duration>);
3097    /// ```
3098    pub fn set_or_clear_max_retry_duration<T>(mut self, v: std::option::Option<T>) -> Self
3099    where
3100        T: std::convert::Into<wkt::Duration>,
3101    {
3102        self.max_retry_duration = v.map(|x| x.into());
3103        self
3104    }
3105
3106    /// Sets the value of [min_backoff][crate::model::RetryConfig::min_backoff].
3107    ///
3108    /// # Example
3109    /// ```ignore,no_run
3110    /// # use google_cloud_tasks_v2::model::RetryConfig;
3111    /// use wkt::Duration;
3112    /// let x = RetryConfig::new().set_min_backoff(Duration::default()/* use setters */);
3113    /// ```
3114    pub fn set_min_backoff<T>(mut self, v: T) -> Self
3115    where
3116        T: std::convert::Into<wkt::Duration>,
3117    {
3118        self.min_backoff = std::option::Option::Some(v.into());
3119        self
3120    }
3121
3122    /// Sets or clears the value of [min_backoff][crate::model::RetryConfig::min_backoff].
3123    ///
3124    /// # Example
3125    /// ```ignore,no_run
3126    /// # use google_cloud_tasks_v2::model::RetryConfig;
3127    /// use wkt::Duration;
3128    /// let x = RetryConfig::new().set_or_clear_min_backoff(Some(Duration::default()/* use setters */));
3129    /// let x = RetryConfig::new().set_or_clear_min_backoff(None::<Duration>);
3130    /// ```
3131    pub fn set_or_clear_min_backoff<T>(mut self, v: std::option::Option<T>) -> Self
3132    where
3133        T: std::convert::Into<wkt::Duration>,
3134    {
3135        self.min_backoff = v.map(|x| x.into());
3136        self
3137    }
3138
3139    /// Sets the value of [max_backoff][crate::model::RetryConfig::max_backoff].
3140    ///
3141    /// # Example
3142    /// ```ignore,no_run
3143    /// # use google_cloud_tasks_v2::model::RetryConfig;
3144    /// use wkt::Duration;
3145    /// let x = RetryConfig::new().set_max_backoff(Duration::default()/* use setters */);
3146    /// ```
3147    pub fn set_max_backoff<T>(mut self, v: T) -> Self
3148    where
3149        T: std::convert::Into<wkt::Duration>,
3150    {
3151        self.max_backoff = std::option::Option::Some(v.into());
3152        self
3153    }
3154
3155    /// Sets or clears the value of [max_backoff][crate::model::RetryConfig::max_backoff].
3156    ///
3157    /// # Example
3158    /// ```ignore,no_run
3159    /// # use google_cloud_tasks_v2::model::RetryConfig;
3160    /// use wkt::Duration;
3161    /// let x = RetryConfig::new().set_or_clear_max_backoff(Some(Duration::default()/* use setters */));
3162    /// let x = RetryConfig::new().set_or_clear_max_backoff(None::<Duration>);
3163    /// ```
3164    pub fn set_or_clear_max_backoff<T>(mut self, v: std::option::Option<T>) -> Self
3165    where
3166        T: std::convert::Into<wkt::Duration>,
3167    {
3168        self.max_backoff = v.map(|x| x.into());
3169        self
3170    }
3171
3172    /// Sets the value of [max_doublings][crate::model::RetryConfig::max_doublings].
3173    ///
3174    /// # Example
3175    /// ```ignore,no_run
3176    /// # use google_cloud_tasks_v2::model::RetryConfig;
3177    /// let x = RetryConfig::new().set_max_doublings(42);
3178    /// ```
3179    pub fn set_max_doublings<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3180        self.max_doublings = v.into();
3181        self
3182    }
3183}
3184
3185impl wkt::message::Message for RetryConfig {
3186    fn typename() -> &'static str {
3187        "type.googleapis.com/google.cloud.tasks.v2.RetryConfig"
3188    }
3189}
3190
3191/// Configuration options for writing logs to
3192/// [Stackdriver Logging](https://cloud.google.com/logging/docs/).
3193#[derive(Clone, Default, PartialEq)]
3194#[non_exhaustive]
3195pub struct StackdriverLoggingConfig {
3196    /// Specifies the fraction of operations to write to
3197    /// [Stackdriver Logging](https://cloud.google.com/logging/docs/).
3198    /// This field may contain any value between 0.0 and 1.0, inclusive.
3199    /// 0.0 is the default and means that no operations are logged.
3200    pub sampling_ratio: f64,
3201
3202    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3203}
3204
3205impl StackdriverLoggingConfig {
3206    /// Creates a new default instance.
3207    pub fn new() -> Self {
3208        std::default::Default::default()
3209    }
3210
3211    /// Sets the value of [sampling_ratio][crate::model::StackdriverLoggingConfig::sampling_ratio].
3212    ///
3213    /// # Example
3214    /// ```ignore,no_run
3215    /// # use google_cloud_tasks_v2::model::StackdriverLoggingConfig;
3216    /// let x = StackdriverLoggingConfig::new().set_sampling_ratio(42.0);
3217    /// ```
3218    pub fn set_sampling_ratio<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3219        self.sampling_ratio = v.into();
3220        self
3221    }
3222}
3223
3224impl wkt::message::Message for StackdriverLoggingConfig {
3225    fn typename() -> &'static str {
3226        "type.googleapis.com/google.cloud.tasks.v2.StackdriverLoggingConfig"
3227    }
3228}
3229
3230/// PathOverride.
3231///
3232/// Path message defines path override for HTTP targets.
3233#[derive(Clone, Default, PartialEq)]
3234#[non_exhaustive]
3235pub struct PathOverride {
3236    /// The URI path (e.g., /users/1234). Default is an empty string.
3237    pub path: std::string::String,
3238
3239    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3240}
3241
3242impl PathOverride {
3243    /// Creates a new default instance.
3244    pub fn new() -> Self {
3245        std::default::Default::default()
3246    }
3247
3248    /// Sets the value of [path][crate::model::PathOverride::path].
3249    ///
3250    /// # Example
3251    /// ```ignore,no_run
3252    /// # use google_cloud_tasks_v2::model::PathOverride;
3253    /// let x = PathOverride::new().set_path("example");
3254    /// ```
3255    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3256        self.path = v.into();
3257        self
3258    }
3259}
3260
3261impl wkt::message::Message for PathOverride {
3262    fn typename() -> &'static str {
3263        "type.googleapis.com/google.cloud.tasks.v2.PathOverride"
3264    }
3265}
3266
3267/// QueryOverride.
3268///
3269/// Query message defines query override for HTTP targets.
3270#[derive(Clone, Default, PartialEq)]
3271#[non_exhaustive]
3272pub struct QueryOverride {
3273    /// The query parameters (e.g., qparam1=123&qparam2=456). Default is an empty
3274    /// string.
3275    pub query_params: std::string::String,
3276
3277    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3278}
3279
3280impl QueryOverride {
3281    /// Creates a new default instance.
3282    pub fn new() -> Self {
3283        std::default::Default::default()
3284    }
3285
3286    /// Sets the value of [query_params][crate::model::QueryOverride::query_params].
3287    ///
3288    /// # Example
3289    /// ```ignore,no_run
3290    /// # use google_cloud_tasks_v2::model::QueryOverride;
3291    /// let x = QueryOverride::new().set_query_params("example");
3292    /// ```
3293    pub fn set_query_params<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3294        self.query_params = v.into();
3295        self
3296    }
3297}
3298
3299impl wkt::message::Message for QueryOverride {
3300    fn typename() -> &'static str {
3301        "type.googleapis.com/google.cloud.tasks.v2.QueryOverride"
3302    }
3303}
3304
3305/// URI Override.
3306///
3307/// When specified, all the HTTP tasks inside the queue will be partially or
3308/// fully overridden depending on the configured values.
3309#[derive(Clone, Default, PartialEq)]
3310#[non_exhaustive]
3311pub struct UriOverride {
3312    /// Scheme override.
3313    ///
3314    /// When specified, the task URI scheme is replaced by the provided value (HTTP
3315    /// or HTTPS).
3316    pub scheme: std::option::Option<crate::model::uri_override::Scheme>,
3317
3318    /// Host override.
3319    ///
3320    /// When specified, replaces the host part of the task URL. For example,
3321    /// if the task URL is "<https://www.google.com>," and host value is set to
3322    /// "example.net", the overridden URI will be changed to "<https://example.net>."
3323    /// Host value cannot be an empty string (INVALID_ARGUMENT).
3324    pub host: std::option::Option<std::string::String>,
3325
3326    /// Port override.
3327    ///
3328    /// When specified, replaces the port part of the task URI. For instance,
3329    /// for a URI `https://www.example.com/example` and port=123, the overridden
3330    /// URI becomes "<https://www.example.com>:123/example". Note that the port value
3331    /// must be a positive integer. Setting the port to 0 (Zero) clears the URI
3332    /// port.
3333    pub port: std::option::Option<i64>,
3334
3335    /// URI path.
3336    ///
3337    /// When specified, replaces the existing path of the task URL. Setting the
3338    /// path value to an empty string clears the URI path segment.
3339    pub path_override: std::option::Option<crate::model::PathOverride>,
3340
3341    /// URI query.
3342    ///
3343    /// When specified, replaces the query part of the task URI. Setting the
3344    /// query value to an empty string clears the URI query segment.
3345    pub query_override: std::option::Option<crate::model::QueryOverride>,
3346
3347    /// URI Override Enforce Mode
3348    ///
3349    /// When specified, determines the Target UriOverride mode. If not specified,
3350    /// it defaults to ALWAYS.
3351    pub uri_override_enforce_mode: crate::model::uri_override::UriOverrideEnforceMode,
3352
3353    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3354}
3355
3356impl UriOverride {
3357    /// Creates a new default instance.
3358    pub fn new() -> Self {
3359        std::default::Default::default()
3360    }
3361
3362    /// Sets the value of [scheme][crate::model::UriOverride::scheme].
3363    ///
3364    /// # Example
3365    /// ```ignore,no_run
3366    /// # use google_cloud_tasks_v2::model::UriOverride;
3367    /// use google_cloud_tasks_v2::model::uri_override::Scheme;
3368    /// let x0 = UriOverride::new().set_scheme(Scheme::Http);
3369    /// let x1 = UriOverride::new().set_scheme(Scheme::Https);
3370    /// ```
3371    pub fn set_scheme<T>(mut self, v: T) -> Self
3372    where
3373        T: std::convert::Into<crate::model::uri_override::Scheme>,
3374    {
3375        self.scheme = std::option::Option::Some(v.into());
3376        self
3377    }
3378
3379    /// Sets or clears the value of [scheme][crate::model::UriOverride::scheme].
3380    ///
3381    /// # Example
3382    /// ```ignore,no_run
3383    /// # use google_cloud_tasks_v2::model::UriOverride;
3384    /// use google_cloud_tasks_v2::model::uri_override::Scheme;
3385    /// let x0 = UriOverride::new().set_or_clear_scheme(Some(Scheme::Http));
3386    /// let x1 = UriOverride::new().set_or_clear_scheme(Some(Scheme::Https));
3387    /// let x_none = UriOverride::new().set_or_clear_scheme(None::<Scheme>);
3388    /// ```
3389    pub fn set_or_clear_scheme<T>(mut self, v: std::option::Option<T>) -> Self
3390    where
3391        T: std::convert::Into<crate::model::uri_override::Scheme>,
3392    {
3393        self.scheme = v.map(|x| x.into());
3394        self
3395    }
3396
3397    /// Sets the value of [host][crate::model::UriOverride::host].
3398    ///
3399    /// # Example
3400    /// ```ignore,no_run
3401    /// # use google_cloud_tasks_v2::model::UriOverride;
3402    /// let x = UriOverride::new().set_host("example");
3403    /// ```
3404    pub fn set_host<T>(mut self, v: T) -> Self
3405    where
3406        T: std::convert::Into<std::string::String>,
3407    {
3408        self.host = std::option::Option::Some(v.into());
3409        self
3410    }
3411
3412    /// Sets or clears the value of [host][crate::model::UriOverride::host].
3413    ///
3414    /// # Example
3415    /// ```ignore,no_run
3416    /// # use google_cloud_tasks_v2::model::UriOverride;
3417    /// let x = UriOverride::new().set_or_clear_host(Some("example"));
3418    /// let x = UriOverride::new().set_or_clear_host(None::<String>);
3419    /// ```
3420    pub fn set_or_clear_host<T>(mut self, v: std::option::Option<T>) -> Self
3421    where
3422        T: std::convert::Into<std::string::String>,
3423    {
3424        self.host = v.map(|x| x.into());
3425        self
3426    }
3427
3428    /// Sets the value of [port][crate::model::UriOverride::port].
3429    ///
3430    /// # Example
3431    /// ```ignore,no_run
3432    /// # use google_cloud_tasks_v2::model::UriOverride;
3433    /// let x = UriOverride::new().set_port(42);
3434    /// ```
3435    pub fn set_port<T>(mut self, v: T) -> Self
3436    where
3437        T: std::convert::Into<i64>,
3438    {
3439        self.port = std::option::Option::Some(v.into());
3440        self
3441    }
3442
3443    /// Sets or clears the value of [port][crate::model::UriOverride::port].
3444    ///
3445    /// # Example
3446    /// ```ignore,no_run
3447    /// # use google_cloud_tasks_v2::model::UriOverride;
3448    /// let x = UriOverride::new().set_or_clear_port(Some(42));
3449    /// let x = UriOverride::new().set_or_clear_port(None::<i32>);
3450    /// ```
3451    pub fn set_or_clear_port<T>(mut self, v: std::option::Option<T>) -> Self
3452    where
3453        T: std::convert::Into<i64>,
3454    {
3455        self.port = v.map(|x| x.into());
3456        self
3457    }
3458
3459    /// Sets the value of [path_override][crate::model::UriOverride::path_override].
3460    ///
3461    /// # Example
3462    /// ```ignore,no_run
3463    /// # use google_cloud_tasks_v2::model::UriOverride;
3464    /// use google_cloud_tasks_v2::model::PathOverride;
3465    /// let x = UriOverride::new().set_path_override(PathOverride::default()/* use setters */);
3466    /// ```
3467    pub fn set_path_override<T>(mut self, v: T) -> Self
3468    where
3469        T: std::convert::Into<crate::model::PathOverride>,
3470    {
3471        self.path_override = std::option::Option::Some(v.into());
3472        self
3473    }
3474
3475    /// Sets or clears the value of [path_override][crate::model::UriOverride::path_override].
3476    ///
3477    /// # Example
3478    /// ```ignore,no_run
3479    /// # use google_cloud_tasks_v2::model::UriOverride;
3480    /// use google_cloud_tasks_v2::model::PathOverride;
3481    /// let x = UriOverride::new().set_or_clear_path_override(Some(PathOverride::default()/* use setters */));
3482    /// let x = UriOverride::new().set_or_clear_path_override(None::<PathOverride>);
3483    /// ```
3484    pub fn set_or_clear_path_override<T>(mut self, v: std::option::Option<T>) -> Self
3485    where
3486        T: std::convert::Into<crate::model::PathOverride>,
3487    {
3488        self.path_override = v.map(|x| x.into());
3489        self
3490    }
3491
3492    /// Sets the value of [query_override][crate::model::UriOverride::query_override].
3493    ///
3494    /// # Example
3495    /// ```ignore,no_run
3496    /// # use google_cloud_tasks_v2::model::UriOverride;
3497    /// use google_cloud_tasks_v2::model::QueryOverride;
3498    /// let x = UriOverride::new().set_query_override(QueryOverride::default()/* use setters */);
3499    /// ```
3500    pub fn set_query_override<T>(mut self, v: T) -> Self
3501    where
3502        T: std::convert::Into<crate::model::QueryOverride>,
3503    {
3504        self.query_override = std::option::Option::Some(v.into());
3505        self
3506    }
3507
3508    /// Sets or clears the value of [query_override][crate::model::UriOverride::query_override].
3509    ///
3510    /// # Example
3511    /// ```ignore,no_run
3512    /// # use google_cloud_tasks_v2::model::UriOverride;
3513    /// use google_cloud_tasks_v2::model::QueryOverride;
3514    /// let x = UriOverride::new().set_or_clear_query_override(Some(QueryOverride::default()/* use setters */));
3515    /// let x = UriOverride::new().set_or_clear_query_override(None::<QueryOverride>);
3516    /// ```
3517    pub fn set_or_clear_query_override<T>(mut self, v: std::option::Option<T>) -> Self
3518    where
3519        T: std::convert::Into<crate::model::QueryOverride>,
3520    {
3521        self.query_override = v.map(|x| x.into());
3522        self
3523    }
3524
3525    /// Sets the value of [uri_override_enforce_mode][crate::model::UriOverride::uri_override_enforce_mode].
3526    ///
3527    /// # Example
3528    /// ```ignore,no_run
3529    /// # use google_cloud_tasks_v2::model::UriOverride;
3530    /// use google_cloud_tasks_v2::model::uri_override::UriOverrideEnforceMode;
3531    /// let x0 = UriOverride::new().set_uri_override_enforce_mode(UriOverrideEnforceMode::IfNotExists);
3532    /// let x1 = UriOverride::new().set_uri_override_enforce_mode(UriOverrideEnforceMode::Always);
3533    /// ```
3534    pub fn set_uri_override_enforce_mode<
3535        T: std::convert::Into<crate::model::uri_override::UriOverrideEnforceMode>,
3536    >(
3537        mut self,
3538        v: T,
3539    ) -> Self {
3540        self.uri_override_enforce_mode = v.into();
3541        self
3542    }
3543}
3544
3545impl wkt::message::Message for UriOverride {
3546    fn typename() -> &'static str {
3547        "type.googleapis.com/google.cloud.tasks.v2.UriOverride"
3548    }
3549}
3550
3551/// Defines additional types related to [UriOverride].
3552pub mod uri_override {
3553    #[allow(unused_imports)]
3554    use super::*;
3555
3556    /// The Scheme for an HTTP request. By default, it is HTTPS.
3557    ///
3558    /// # Working with unknown values
3559    ///
3560    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3561    /// additional enum variants at any time. Adding new variants is not considered
3562    /// a breaking change. Applications should write their code in anticipation of:
3563    ///
3564    /// - New values appearing in future releases of the client library, **and**
3565    /// - New values received dynamically, without application changes.
3566    ///
3567    /// Please consult the [Working with enums] section in the user guide for some
3568    /// guidelines.
3569    ///
3570    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3571    #[derive(Clone, Debug, PartialEq)]
3572    #[non_exhaustive]
3573    pub enum Scheme {
3574        /// Scheme unspecified. Defaults to HTTPS.
3575        Unspecified,
3576        /// Convert the scheme to HTTP, e.g., `https://www.example.com` will change
3577        /// to `http://www.example.com`.
3578        Http,
3579        /// Convert the scheme to HTTPS, e.g., `http://www.example.com` will change
3580        /// to `https://www.example.com`.
3581        Https,
3582        /// If set, the enum was initialized with an unknown value.
3583        ///
3584        /// Applications can examine the value using [Scheme::value] or
3585        /// [Scheme::name].
3586        UnknownValue(scheme::UnknownValue),
3587    }
3588
3589    #[doc(hidden)]
3590    pub mod scheme {
3591        #[allow(unused_imports)]
3592        use super::*;
3593        #[derive(Clone, Debug, PartialEq)]
3594        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3595    }
3596
3597    impl Scheme {
3598        /// Gets the enum value.
3599        ///
3600        /// Returns `None` if the enum contains an unknown value deserialized from
3601        /// the string representation of enums.
3602        pub fn value(&self) -> std::option::Option<i32> {
3603            match self {
3604                Self::Unspecified => std::option::Option::Some(0),
3605                Self::Http => std::option::Option::Some(1),
3606                Self::Https => std::option::Option::Some(2),
3607                Self::UnknownValue(u) => u.0.value(),
3608            }
3609        }
3610
3611        /// Gets the enum value as a string.
3612        ///
3613        /// Returns `None` if the enum contains an unknown value deserialized from
3614        /// the integer representation of enums.
3615        pub fn name(&self) -> std::option::Option<&str> {
3616            match self {
3617                Self::Unspecified => std::option::Option::Some("SCHEME_UNSPECIFIED"),
3618                Self::Http => std::option::Option::Some("HTTP"),
3619                Self::Https => std::option::Option::Some("HTTPS"),
3620                Self::UnknownValue(u) => u.0.name(),
3621            }
3622        }
3623    }
3624
3625    impl std::default::Default for Scheme {
3626        fn default() -> Self {
3627            use std::convert::From;
3628            Self::from(0)
3629        }
3630    }
3631
3632    impl std::fmt::Display for Scheme {
3633        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3634            wkt::internal::display_enum(f, self.name(), self.value())
3635        }
3636    }
3637
3638    impl std::convert::From<i32> for Scheme {
3639        fn from(value: i32) -> Self {
3640            match value {
3641                0 => Self::Unspecified,
3642                1 => Self::Http,
3643                2 => Self::Https,
3644                _ => Self::UnknownValue(scheme::UnknownValue(
3645                    wkt::internal::UnknownEnumValue::Integer(value),
3646                )),
3647            }
3648        }
3649    }
3650
3651    impl std::convert::From<&str> for Scheme {
3652        fn from(value: &str) -> Self {
3653            use std::string::ToString;
3654            match value {
3655                "SCHEME_UNSPECIFIED" => Self::Unspecified,
3656                "HTTP" => Self::Http,
3657                "HTTPS" => Self::Https,
3658                _ => Self::UnknownValue(scheme::UnknownValue(
3659                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3660                )),
3661            }
3662        }
3663    }
3664
3665    impl serde::ser::Serialize for Scheme {
3666        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3667        where
3668            S: serde::Serializer,
3669        {
3670            match self {
3671                Self::Unspecified => serializer.serialize_i32(0),
3672                Self::Http => serializer.serialize_i32(1),
3673                Self::Https => serializer.serialize_i32(2),
3674                Self::UnknownValue(u) => u.0.serialize(serializer),
3675            }
3676        }
3677    }
3678
3679    impl<'de> serde::de::Deserialize<'de> for Scheme {
3680        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3681        where
3682            D: serde::Deserializer<'de>,
3683        {
3684            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scheme>::new(
3685                ".google.cloud.tasks.v2.UriOverride.Scheme",
3686            ))
3687        }
3688    }
3689
3690    /// UriOverrideEnforceMode defines when the URI override is enforced.
3691    ///
3692    /// # Working with unknown values
3693    ///
3694    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3695    /// additional enum variants at any time. Adding new variants is not considered
3696    /// a breaking change. Applications should write their code in anticipation of:
3697    ///
3698    /// - New values appearing in future releases of the client library, **and**
3699    /// - New values received dynamically, without application changes.
3700    ///
3701    /// Please consult the [Working with enums] section in the user guide for some
3702    /// guidelines.
3703    ///
3704    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3705    #[derive(Clone, Debug, PartialEq)]
3706    #[non_exhaustive]
3707    pub enum UriOverrideEnforceMode {
3708        /// UriOverrideEnforceMode Unspecified. Defaults to ALWAYS.
3709        Unspecified,
3710        /// In the IF_NOT_EXISTS mode, queue-level configuration is only
3711        /// applied where task-level configuration does not exist.
3712        IfNotExists,
3713        /// In the ALWAYS mode, queue-level configuration overrides all
3714        /// task-level configuration
3715        Always,
3716        /// If set, the enum was initialized with an unknown value.
3717        ///
3718        /// Applications can examine the value using [UriOverrideEnforceMode::value] or
3719        /// [UriOverrideEnforceMode::name].
3720        UnknownValue(uri_override_enforce_mode::UnknownValue),
3721    }
3722
3723    #[doc(hidden)]
3724    pub mod uri_override_enforce_mode {
3725        #[allow(unused_imports)]
3726        use super::*;
3727        #[derive(Clone, Debug, PartialEq)]
3728        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3729    }
3730
3731    impl UriOverrideEnforceMode {
3732        /// Gets the enum value.
3733        ///
3734        /// Returns `None` if the enum contains an unknown value deserialized from
3735        /// the string representation of enums.
3736        pub fn value(&self) -> std::option::Option<i32> {
3737            match self {
3738                Self::Unspecified => std::option::Option::Some(0),
3739                Self::IfNotExists => std::option::Option::Some(1),
3740                Self::Always => std::option::Option::Some(2),
3741                Self::UnknownValue(u) => u.0.value(),
3742            }
3743        }
3744
3745        /// Gets the enum value as a string.
3746        ///
3747        /// Returns `None` if the enum contains an unknown value deserialized from
3748        /// the integer representation of enums.
3749        pub fn name(&self) -> std::option::Option<&str> {
3750            match self {
3751                Self::Unspecified => {
3752                    std::option::Option::Some("URI_OVERRIDE_ENFORCE_MODE_UNSPECIFIED")
3753                }
3754                Self::IfNotExists => std::option::Option::Some("IF_NOT_EXISTS"),
3755                Self::Always => std::option::Option::Some("ALWAYS"),
3756                Self::UnknownValue(u) => u.0.name(),
3757            }
3758        }
3759    }
3760
3761    impl std::default::Default for UriOverrideEnforceMode {
3762        fn default() -> Self {
3763            use std::convert::From;
3764            Self::from(0)
3765        }
3766    }
3767
3768    impl std::fmt::Display for UriOverrideEnforceMode {
3769        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3770            wkt::internal::display_enum(f, self.name(), self.value())
3771        }
3772    }
3773
3774    impl std::convert::From<i32> for UriOverrideEnforceMode {
3775        fn from(value: i32) -> Self {
3776            match value {
3777                0 => Self::Unspecified,
3778                1 => Self::IfNotExists,
3779                2 => Self::Always,
3780                _ => Self::UnknownValue(uri_override_enforce_mode::UnknownValue(
3781                    wkt::internal::UnknownEnumValue::Integer(value),
3782                )),
3783            }
3784        }
3785    }
3786
3787    impl std::convert::From<&str> for UriOverrideEnforceMode {
3788        fn from(value: &str) -> Self {
3789            use std::string::ToString;
3790            match value {
3791                "URI_OVERRIDE_ENFORCE_MODE_UNSPECIFIED" => Self::Unspecified,
3792                "IF_NOT_EXISTS" => Self::IfNotExists,
3793                "ALWAYS" => Self::Always,
3794                _ => Self::UnknownValue(uri_override_enforce_mode::UnknownValue(
3795                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3796                )),
3797            }
3798        }
3799    }
3800
3801    impl serde::ser::Serialize for UriOverrideEnforceMode {
3802        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3803        where
3804            S: serde::Serializer,
3805        {
3806            match self {
3807                Self::Unspecified => serializer.serialize_i32(0),
3808                Self::IfNotExists => serializer.serialize_i32(1),
3809                Self::Always => serializer.serialize_i32(2),
3810                Self::UnknownValue(u) => u.0.serialize(serializer),
3811            }
3812        }
3813    }
3814
3815    impl<'de> serde::de::Deserialize<'de> for UriOverrideEnforceMode {
3816        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3817        where
3818            D: serde::Deserializer<'de>,
3819        {
3820            deserializer.deserialize_any(wkt::internal::EnumVisitor::<UriOverrideEnforceMode>::new(
3821                ".google.cloud.tasks.v2.UriOverride.UriOverrideEnforceMode",
3822            ))
3823        }
3824    }
3825}
3826
3827/// HTTP target.
3828///
3829/// When specified at the [Queue][google.cloud.tasks.v2.Queue] level, all tasks
3830/// with [HttpRequest][google.cloud.tasks.v2.HttpRequest] are overridden
3831/// according to the target.
3832///
3833/// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
3834/// [google.cloud.tasks.v2.Queue]: crate::model::Queue
3835#[derive(Clone, Default, PartialEq)]
3836#[non_exhaustive]
3837pub struct HttpTarget {
3838    /// URI override.
3839    ///
3840    /// When specified, overrides the execution URI for all the tasks in the queue.
3841    pub uri_override: std::option::Option<crate::model::UriOverride>,
3842
3843    /// The HTTP method to use for the request.
3844    ///
3845    /// When specified, it overrides
3846    /// [HttpRequest][google.cloud.tasks.v2.HttpTarget.http_method] for the task.
3847    /// Note that if the value is set to [HttpMethod][GET] the [HttpRequest][body]
3848    /// of the task will be ignored at execution time.
3849    ///
3850    /// [google.cloud.tasks.v2.HttpTarget.http_method]: crate::model::HttpTarget::http_method
3851    pub http_method: crate::model::HttpMethod,
3852
3853    /// HTTP target headers.
3854    ///
3855    /// This map contains the header field names and values.
3856    /// Headers will be set when running the
3857    /// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] and/or
3858    /// [BufferTask][google.cloud.tasks.v2.CloudTasks.BufferTask].
3859    ///
3860    /// These headers represent a subset of the headers that will be configured for
3861    /// the task's HTTP request. Some HTTP request headers will be ignored or
3862    /// replaced.
3863    ///
3864    /// A partial list of headers that will be ignored or replaced is:
3865    ///
3866    /// * Several predefined headers, prefixed with "X-CloudTasks-", can
3867    ///   be used to define properties of the task.
3868    /// * Host: This will be computed by Cloud Tasks and derived from
3869    ///   [HttpRequest.url][google.cloud.tasks.v2.Target.HttpRequest.url].
3870    /// * Content-Length: This will be computed by Cloud Tasks.
3871    ///
3872    /// `Content-Type` won't be set by Cloud Tasks. You can explicitly set
3873    /// `Content-Type` to a media type when the
3874    /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
3875    /// For example, `Content-Type` can be set to `"application/octet-stream"` or
3876    /// `"application/json"`. The default value is set to `"application/json"`.
3877    ///
3878    /// * User-Agent: This will be set to `"Google-Cloud-Tasks"`.
3879    ///
3880    /// Headers which can have multiple values (according to RFC2616) can be
3881    /// specified using comma-separated values.
3882    ///
3883    /// The size of the headers must be less than 80KB.
3884    /// Queue-level headers to override headers of all the tasks in the queue.
3885    ///
3886    /// Do not put business sensitive or personally identifying data in the HTTP
3887    /// Header Override Configuration or other similar fields in accordance with
3888    /// Section 12 (Resource Fields) of the
3889    /// [Service Specific Terms](https://cloud.google.com/terms/service-terms).
3890    ///
3891    /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
3892    pub header_overrides: std::vec::Vec<crate::model::http_target::HeaderOverride>,
3893
3894    /// The mode for generating an `Authorization` header for HTTP requests.
3895    ///
3896    /// If specified, all `Authorization` headers in the
3897    /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field are
3898    /// overridden.
3899    ///
3900    /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
3901    pub authorization_header: std::option::Option<crate::model::http_target::AuthorizationHeader>,
3902
3903    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3904}
3905
3906impl HttpTarget {
3907    /// Creates a new default instance.
3908    pub fn new() -> Self {
3909        std::default::Default::default()
3910    }
3911
3912    /// Sets the value of [uri_override][crate::model::HttpTarget::uri_override].
3913    ///
3914    /// # Example
3915    /// ```ignore,no_run
3916    /// # use google_cloud_tasks_v2::model::HttpTarget;
3917    /// use google_cloud_tasks_v2::model::UriOverride;
3918    /// let x = HttpTarget::new().set_uri_override(UriOverride::default()/* use setters */);
3919    /// ```
3920    pub fn set_uri_override<T>(mut self, v: T) -> Self
3921    where
3922        T: std::convert::Into<crate::model::UriOverride>,
3923    {
3924        self.uri_override = std::option::Option::Some(v.into());
3925        self
3926    }
3927
3928    /// Sets or clears the value of [uri_override][crate::model::HttpTarget::uri_override].
3929    ///
3930    /// # Example
3931    /// ```ignore,no_run
3932    /// # use google_cloud_tasks_v2::model::HttpTarget;
3933    /// use google_cloud_tasks_v2::model::UriOverride;
3934    /// let x = HttpTarget::new().set_or_clear_uri_override(Some(UriOverride::default()/* use setters */));
3935    /// let x = HttpTarget::new().set_or_clear_uri_override(None::<UriOverride>);
3936    /// ```
3937    pub fn set_or_clear_uri_override<T>(mut self, v: std::option::Option<T>) -> Self
3938    where
3939        T: std::convert::Into<crate::model::UriOverride>,
3940    {
3941        self.uri_override = v.map(|x| x.into());
3942        self
3943    }
3944
3945    /// Sets the value of [http_method][crate::model::HttpTarget::http_method].
3946    ///
3947    /// # Example
3948    /// ```ignore,no_run
3949    /// # use google_cloud_tasks_v2::model::HttpTarget;
3950    /// use google_cloud_tasks_v2::model::HttpMethod;
3951    /// let x0 = HttpTarget::new().set_http_method(HttpMethod::Post);
3952    /// let x1 = HttpTarget::new().set_http_method(HttpMethod::Get);
3953    /// let x2 = HttpTarget::new().set_http_method(HttpMethod::Head);
3954    /// ```
3955    pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
3956        mut self,
3957        v: T,
3958    ) -> Self {
3959        self.http_method = v.into();
3960        self
3961    }
3962
3963    /// Sets the value of [header_overrides][crate::model::HttpTarget::header_overrides].
3964    ///
3965    /// # Example
3966    /// ```ignore,no_run
3967    /// # use google_cloud_tasks_v2::model::HttpTarget;
3968    /// use google_cloud_tasks_v2::model::http_target::HeaderOverride;
3969    /// let x = HttpTarget::new()
3970    ///     .set_header_overrides([
3971    ///         HeaderOverride::default()/* use setters */,
3972    ///         HeaderOverride::default()/* use (different) setters */,
3973    ///     ]);
3974    /// ```
3975    pub fn set_header_overrides<T, V>(mut self, v: T) -> Self
3976    where
3977        T: std::iter::IntoIterator<Item = V>,
3978        V: std::convert::Into<crate::model::http_target::HeaderOverride>,
3979    {
3980        use std::iter::Iterator;
3981        self.header_overrides = v.into_iter().map(|i| i.into()).collect();
3982        self
3983    }
3984
3985    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header].
3986    ///
3987    /// Note that all the setters affecting `authorization_header` are mutually
3988    /// exclusive.
3989    ///
3990    /// # Example
3991    /// ```ignore,no_run
3992    /// # use google_cloud_tasks_v2::model::HttpTarget;
3993    /// use google_cloud_tasks_v2::model::OAuthToken;
3994    /// let x = HttpTarget::new().set_authorization_header(Some(
3995    ///     google_cloud_tasks_v2::model::http_target::AuthorizationHeader::OauthToken(OAuthToken::default().into())));
3996    /// ```
3997    pub fn set_authorization_header<
3998        T: std::convert::Into<std::option::Option<crate::model::http_target::AuthorizationHeader>>,
3999    >(
4000        mut self,
4001        v: T,
4002    ) -> Self {
4003        self.authorization_header = v.into();
4004        self
4005    }
4006
4007    /// The value of [authorization_header][crate::model::HttpTarget::authorization_header]
4008    /// if it holds a `OauthToken`, `None` if the field is not set or
4009    /// holds a different branch.
4010    pub fn oauth_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OAuthToken>> {
4011        #[allow(unreachable_patterns)]
4012        self.authorization_header.as_ref().and_then(|v| match v {
4013            crate::model::http_target::AuthorizationHeader::OauthToken(v) => {
4014                std::option::Option::Some(v)
4015            }
4016            _ => std::option::Option::None,
4017        })
4018    }
4019
4020    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header]
4021    /// to hold a `OauthToken`.
4022    ///
4023    /// Note that all the setters affecting `authorization_header` are
4024    /// mutually exclusive.
4025    ///
4026    /// # Example
4027    /// ```ignore,no_run
4028    /// # use google_cloud_tasks_v2::model::HttpTarget;
4029    /// use google_cloud_tasks_v2::model::OAuthToken;
4030    /// let x = HttpTarget::new().set_oauth_token(OAuthToken::default()/* use setters */);
4031    /// assert!(x.oauth_token().is_some());
4032    /// assert!(x.oidc_token().is_none());
4033    /// ```
4034    pub fn set_oauth_token<T: std::convert::Into<std::boxed::Box<crate::model::OAuthToken>>>(
4035        mut self,
4036        v: T,
4037    ) -> Self {
4038        self.authorization_header = std::option::Option::Some(
4039            crate::model::http_target::AuthorizationHeader::OauthToken(v.into()),
4040        );
4041        self
4042    }
4043
4044    /// The value of [authorization_header][crate::model::HttpTarget::authorization_header]
4045    /// if it holds a `OidcToken`, `None` if the field is not set or
4046    /// holds a different branch.
4047    pub fn oidc_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OidcToken>> {
4048        #[allow(unreachable_patterns)]
4049        self.authorization_header.as_ref().and_then(|v| match v {
4050            crate::model::http_target::AuthorizationHeader::OidcToken(v) => {
4051                std::option::Option::Some(v)
4052            }
4053            _ => std::option::Option::None,
4054        })
4055    }
4056
4057    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header]
4058    /// to hold a `OidcToken`.
4059    ///
4060    /// Note that all the setters affecting `authorization_header` are
4061    /// mutually exclusive.
4062    ///
4063    /// # Example
4064    /// ```ignore,no_run
4065    /// # use google_cloud_tasks_v2::model::HttpTarget;
4066    /// use google_cloud_tasks_v2::model::OidcToken;
4067    /// let x = HttpTarget::new().set_oidc_token(OidcToken::default()/* use setters */);
4068    /// assert!(x.oidc_token().is_some());
4069    /// assert!(x.oauth_token().is_none());
4070    /// ```
4071    pub fn set_oidc_token<T: std::convert::Into<std::boxed::Box<crate::model::OidcToken>>>(
4072        mut self,
4073        v: T,
4074    ) -> Self {
4075        self.authorization_header = std::option::Option::Some(
4076            crate::model::http_target::AuthorizationHeader::OidcToken(v.into()),
4077        );
4078        self
4079    }
4080}
4081
4082impl wkt::message::Message for HttpTarget {
4083    fn typename() -> &'static str {
4084        "type.googleapis.com/google.cloud.tasks.v2.HttpTarget"
4085    }
4086}
4087
4088/// Defines additional types related to [HttpTarget].
4089pub mod http_target {
4090    #[allow(unused_imports)]
4091    use super::*;
4092
4093    /// Defines a header message. A header can have a key and a value.
4094    #[derive(Clone, Default, PartialEq)]
4095    #[non_exhaustive]
4096    pub struct Header {
4097        /// The Key of the header.
4098        pub key: std::string::String,
4099
4100        /// The Value of the header.
4101        pub value: std::string::String,
4102
4103        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4104    }
4105
4106    impl Header {
4107        /// Creates a new default instance.
4108        pub fn new() -> Self {
4109            std::default::Default::default()
4110        }
4111
4112        /// Sets the value of [key][crate::model::http_target::Header::key].
4113        ///
4114        /// # Example
4115        /// ```ignore,no_run
4116        /// # use google_cloud_tasks_v2::model::http_target::Header;
4117        /// let x = Header::new().set_key("example");
4118        /// ```
4119        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4120            self.key = v.into();
4121            self
4122        }
4123
4124        /// Sets the value of [value][crate::model::http_target::Header::value].
4125        ///
4126        /// # Example
4127        /// ```ignore,no_run
4128        /// # use google_cloud_tasks_v2::model::http_target::Header;
4129        /// let x = Header::new().set_value("example");
4130        /// ```
4131        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4132            self.value = v.into();
4133            self
4134        }
4135    }
4136
4137    impl wkt::message::Message for Header {
4138        fn typename() -> &'static str {
4139            "type.googleapis.com/google.cloud.tasks.v2.HttpTarget.Header"
4140        }
4141    }
4142
4143    /// Wraps the Header object.
4144    #[derive(Clone, Default, PartialEq)]
4145    #[non_exhaustive]
4146    pub struct HeaderOverride {
4147        /// Header embodying a key and a value.
4148        ///
4149        /// Do not put business sensitive or personally identifying data in the HTTP
4150        /// Header Override Configuration or other similar fields in accordance with
4151        /// Section 12 (Resource Fields) of the
4152        /// [Service Specific Terms](https://cloud.google.com/terms/service-terms).
4153        pub header: std::option::Option<crate::model::http_target::Header>,
4154
4155        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4156    }
4157
4158    impl HeaderOverride {
4159        /// Creates a new default instance.
4160        pub fn new() -> Self {
4161            std::default::Default::default()
4162        }
4163
4164        /// Sets the value of [header][crate::model::http_target::HeaderOverride::header].
4165        ///
4166        /// # Example
4167        /// ```ignore,no_run
4168        /// # use google_cloud_tasks_v2::model::http_target::HeaderOverride;
4169        /// use google_cloud_tasks_v2::model::http_target::Header;
4170        /// let x = HeaderOverride::new().set_header(Header::default()/* use setters */);
4171        /// ```
4172        pub fn set_header<T>(mut self, v: T) -> Self
4173        where
4174            T: std::convert::Into<crate::model::http_target::Header>,
4175        {
4176            self.header = std::option::Option::Some(v.into());
4177            self
4178        }
4179
4180        /// Sets or clears the value of [header][crate::model::http_target::HeaderOverride::header].
4181        ///
4182        /// # Example
4183        /// ```ignore,no_run
4184        /// # use google_cloud_tasks_v2::model::http_target::HeaderOverride;
4185        /// use google_cloud_tasks_v2::model::http_target::Header;
4186        /// let x = HeaderOverride::new().set_or_clear_header(Some(Header::default()/* use setters */));
4187        /// let x = HeaderOverride::new().set_or_clear_header(None::<Header>);
4188        /// ```
4189        pub fn set_or_clear_header<T>(mut self, v: std::option::Option<T>) -> Self
4190        where
4191            T: std::convert::Into<crate::model::http_target::Header>,
4192        {
4193            self.header = v.map(|x| x.into());
4194            self
4195        }
4196    }
4197
4198    impl wkt::message::Message for HeaderOverride {
4199        fn typename() -> &'static str {
4200            "type.googleapis.com/google.cloud.tasks.v2.HttpTarget.HeaderOverride"
4201        }
4202    }
4203
4204    /// The mode for generating an `Authorization` header for HTTP requests.
4205    ///
4206    /// If specified, all `Authorization` headers in the
4207    /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field are
4208    /// overridden.
4209    ///
4210    /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
4211    #[derive(Clone, Debug, PartialEq)]
4212    #[non_exhaustive]
4213    pub enum AuthorizationHeader {
4214        /// If specified, an
4215        /// [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
4216        /// is generated and attached as the `Authorization` header in the HTTP
4217        /// request.
4218        ///
4219        /// This type of authorization should generally be used only when calling
4220        /// Google APIs hosted on *.googleapis.com. Note that both the service
4221        /// account email and the scope MUST be specified when using the queue-level
4222        /// authorization override.
4223        OauthToken(std::boxed::Box<crate::model::OAuthToken>),
4224        /// If specified, an
4225        /// [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
4226        /// token is generated and attached as an `Authorization` header in the
4227        /// HTTP request.
4228        ///
4229        /// This type of authorization can be used for many scenarios, including
4230        /// calling Cloud Run, or endpoints where you intend to validate the token
4231        /// yourself. Note that both the service account email and the audience MUST
4232        /// be specified when using the queue-level authorization override.
4233        OidcToken(std::boxed::Box<crate::model::OidcToken>),
4234    }
4235}
4236
4237/// HTTP request.
4238///
4239/// The task will be pushed to the worker as an HTTP request. If the worker
4240/// or the redirected worker acknowledges the task by returning a successful HTTP
4241/// response code ([`200` - `299`]), the task will be removed from the queue. If
4242/// any other HTTP response code is returned or no response is received, the
4243/// task will be retried according to the following:
4244///
4245/// * User-specified throttling: [retry
4246///   configuration][google.cloud.tasks.v2.Queue.retry_config],
4247///   [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's
4248///   state][google.cloud.tasks.v2.Queue.state].
4249///
4250/// * System throttling: To prevent the worker from overloading, Cloud Tasks may
4251///   temporarily reduce the queue's effective rate. User-specified settings
4252///   will not be changed.
4253///
4254///
4255/// System throttling happens because:
4256///
4257/// * Cloud Tasks backs off on all errors. Normally the backoff specified in
4258///   [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But
4259///   if the worker returns `429` (Too Many Requests), `503` (Service
4260///   Unavailable), or the rate of errors is high, Cloud Tasks will use a
4261///   higher backoff rate. The retry specified in the `Retry-After` HTTP
4262///   response header is considered.
4263///
4264/// * To prevent traffic spikes and to smooth sudden increases in traffic,
4265///   dispatches ramp up slowly when the queue is newly created or idle and
4266///   if large numbers of tasks suddenly become available to dispatch (due to
4267///   spikes in create task rates, the queue being unpaused, or many tasks
4268///   that are scheduled at the same time).
4269///
4270///
4271/// [google.cloud.tasks.v2.Queue.rate_limits]: crate::model::Queue::rate_limits
4272/// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
4273/// [google.cloud.tasks.v2.Queue.state]: crate::model::Queue::state
4274#[derive(Clone, Default, PartialEq)]
4275#[non_exhaustive]
4276pub struct HttpRequest {
4277    /// Required. The full url path that the request will be sent to.
4278    ///
4279    /// This string must begin with either "http://" or "https://". Some examples
4280    /// are: `<http://acme.com>` and `<https://acme.com/sales:8080>`. Cloud Tasks will
4281    /// encode some characters for safety and compatibility. The maximum allowed
4282    /// URL length is 2083 characters after encoding.
4283    ///
4284    /// The `Location` header response from a redirect response [`300` - `399`]
4285    /// may be followed. The redirect is not counted as a separate attempt.
4286    pub url: std::string::String,
4287
4288    /// The HTTP method to use for the request. The default is POST.
4289    pub http_method: crate::model::HttpMethod,
4290
4291    /// HTTP request headers.
4292    ///
4293    /// This map contains the header field names and values.
4294    /// Headers can be set when the
4295    /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
4296    ///
4297    /// These headers represent a subset of the headers that will accompany the
4298    /// task's HTTP request. Some HTTP request headers will be ignored or replaced.
4299    ///
4300    /// A partial list of headers that will be ignored or replaced is:
4301    ///
4302    /// * Host: This will be computed by Cloud Tasks and derived from
4303    ///   [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url].
4304    /// * Content-Length: This will be computed by Cloud Tasks.
4305    /// * User-Agent: This will be set to `"Google-Cloud-Tasks"`.
4306    /// * `X-Google-*`: Google use only.
4307    /// * `X-AppEngine-*`: Google use only.
4308    ///
4309    /// `Content-Type` won't be set by Cloud Tasks. You can explicitly set
4310    /// `Content-Type` to a media type when the
4311    /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
4312    /// For example, `Content-Type` can be set to `"application/octet-stream"` or
4313    /// `"application/json"`.
4314    ///
4315    /// Headers which can have multiple values (according to RFC2616) can be
4316    /// specified using comma-separated values.
4317    ///
4318    /// The size of the headers must be less than 80KB.
4319    ///
4320    /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
4321    /// [google.cloud.tasks.v2.HttpRequest.url]: crate::model::HttpRequest::url
4322    pub headers: std::collections::HashMap<std::string::String, std::string::String>,
4323
4324    /// HTTP request body.
4325    ///
4326    /// A request body is allowed only if the
4327    /// [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT,
4328    /// or PATCH. It is an error to set body on a task with an incompatible
4329    /// [HttpMethod][google.cloud.tasks.v2.HttpMethod].
4330    ///
4331    /// [google.cloud.tasks.v2.HttpMethod]: crate::model::HttpMethod
4332    /// [google.cloud.tasks.v2.HttpRequest.http_method]: crate::model::HttpRequest::http_method
4333    pub body: ::bytes::Bytes,
4334
4335    /// The mode for generating an `Authorization` header for HTTP requests.
4336    ///
4337    /// If specified at the [Queue][google.cloud.tasks.v2.Queue] level, all
4338    /// `Authorization` headers in the
4339    /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field are
4340    /// overridden.
4341    ///
4342    /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
4343    /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
4344    pub authorization_header: std::option::Option<crate::model::http_request::AuthorizationHeader>,
4345
4346    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4347}
4348
4349impl HttpRequest {
4350    /// Creates a new default instance.
4351    pub fn new() -> Self {
4352        std::default::Default::default()
4353    }
4354
4355    /// Sets the value of [url][crate::model::HttpRequest::url].
4356    ///
4357    /// # Example
4358    /// ```ignore,no_run
4359    /// # use google_cloud_tasks_v2::model::HttpRequest;
4360    /// let x = HttpRequest::new().set_url("example");
4361    /// ```
4362    pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4363        self.url = v.into();
4364        self
4365    }
4366
4367    /// Sets the value of [http_method][crate::model::HttpRequest::http_method].
4368    ///
4369    /// # Example
4370    /// ```ignore,no_run
4371    /// # use google_cloud_tasks_v2::model::HttpRequest;
4372    /// use google_cloud_tasks_v2::model::HttpMethod;
4373    /// let x0 = HttpRequest::new().set_http_method(HttpMethod::Post);
4374    /// let x1 = HttpRequest::new().set_http_method(HttpMethod::Get);
4375    /// let x2 = HttpRequest::new().set_http_method(HttpMethod::Head);
4376    /// ```
4377    pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
4378        mut self,
4379        v: T,
4380    ) -> Self {
4381        self.http_method = v.into();
4382        self
4383    }
4384
4385    /// Sets the value of [headers][crate::model::HttpRequest::headers].
4386    ///
4387    /// # Example
4388    /// ```ignore,no_run
4389    /// # use google_cloud_tasks_v2::model::HttpRequest;
4390    /// let x = HttpRequest::new().set_headers([
4391    ///     ("key0", "abc"),
4392    ///     ("key1", "xyz"),
4393    /// ]);
4394    /// ```
4395    pub fn set_headers<T, K, V>(mut self, v: T) -> Self
4396    where
4397        T: std::iter::IntoIterator<Item = (K, V)>,
4398        K: std::convert::Into<std::string::String>,
4399        V: std::convert::Into<std::string::String>,
4400    {
4401        use std::iter::Iterator;
4402        self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4403        self
4404    }
4405
4406    /// Sets the value of [body][crate::model::HttpRequest::body].
4407    ///
4408    /// # Example
4409    /// ```ignore,no_run
4410    /// # use google_cloud_tasks_v2::model::HttpRequest;
4411    /// let x = HttpRequest::new().set_body(bytes::Bytes::from_static(b"example"));
4412    /// ```
4413    pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4414        self.body = v.into();
4415        self
4416    }
4417
4418    /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header].
4419    ///
4420    /// Note that all the setters affecting `authorization_header` are mutually
4421    /// exclusive.
4422    ///
4423    /// # Example
4424    /// ```ignore,no_run
4425    /// # use google_cloud_tasks_v2::model::HttpRequest;
4426    /// use google_cloud_tasks_v2::model::OAuthToken;
4427    /// let x = HttpRequest::new().set_authorization_header(Some(
4428    ///     google_cloud_tasks_v2::model::http_request::AuthorizationHeader::OauthToken(OAuthToken::default().into())));
4429    /// ```
4430    pub fn set_authorization_header<
4431        T: std::convert::Into<std::option::Option<crate::model::http_request::AuthorizationHeader>>,
4432    >(
4433        mut self,
4434        v: T,
4435    ) -> Self {
4436        self.authorization_header = v.into();
4437        self
4438    }
4439
4440    /// The value of [authorization_header][crate::model::HttpRequest::authorization_header]
4441    /// if it holds a `OauthToken`, `None` if the field is not set or
4442    /// holds a different branch.
4443    pub fn oauth_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OAuthToken>> {
4444        #[allow(unreachable_patterns)]
4445        self.authorization_header.as_ref().and_then(|v| match v {
4446            crate::model::http_request::AuthorizationHeader::OauthToken(v) => {
4447                std::option::Option::Some(v)
4448            }
4449            _ => std::option::Option::None,
4450        })
4451    }
4452
4453    /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header]
4454    /// to hold a `OauthToken`.
4455    ///
4456    /// Note that all the setters affecting `authorization_header` are
4457    /// mutually exclusive.
4458    ///
4459    /// # Example
4460    /// ```ignore,no_run
4461    /// # use google_cloud_tasks_v2::model::HttpRequest;
4462    /// use google_cloud_tasks_v2::model::OAuthToken;
4463    /// let x = HttpRequest::new().set_oauth_token(OAuthToken::default()/* use setters */);
4464    /// assert!(x.oauth_token().is_some());
4465    /// assert!(x.oidc_token().is_none());
4466    /// ```
4467    pub fn set_oauth_token<T: std::convert::Into<std::boxed::Box<crate::model::OAuthToken>>>(
4468        mut self,
4469        v: T,
4470    ) -> Self {
4471        self.authorization_header = std::option::Option::Some(
4472            crate::model::http_request::AuthorizationHeader::OauthToken(v.into()),
4473        );
4474        self
4475    }
4476
4477    /// The value of [authorization_header][crate::model::HttpRequest::authorization_header]
4478    /// if it holds a `OidcToken`, `None` if the field is not set or
4479    /// holds a different branch.
4480    pub fn oidc_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OidcToken>> {
4481        #[allow(unreachable_patterns)]
4482        self.authorization_header.as_ref().and_then(|v| match v {
4483            crate::model::http_request::AuthorizationHeader::OidcToken(v) => {
4484                std::option::Option::Some(v)
4485            }
4486            _ => std::option::Option::None,
4487        })
4488    }
4489
4490    /// Sets the value of [authorization_header][crate::model::HttpRequest::authorization_header]
4491    /// to hold a `OidcToken`.
4492    ///
4493    /// Note that all the setters affecting `authorization_header` are
4494    /// mutually exclusive.
4495    ///
4496    /// # Example
4497    /// ```ignore,no_run
4498    /// # use google_cloud_tasks_v2::model::HttpRequest;
4499    /// use google_cloud_tasks_v2::model::OidcToken;
4500    /// let x = HttpRequest::new().set_oidc_token(OidcToken::default()/* use setters */);
4501    /// assert!(x.oidc_token().is_some());
4502    /// assert!(x.oauth_token().is_none());
4503    /// ```
4504    pub fn set_oidc_token<T: std::convert::Into<std::boxed::Box<crate::model::OidcToken>>>(
4505        mut self,
4506        v: T,
4507    ) -> Self {
4508        self.authorization_header = std::option::Option::Some(
4509            crate::model::http_request::AuthorizationHeader::OidcToken(v.into()),
4510        );
4511        self
4512    }
4513}
4514
4515impl wkt::message::Message for HttpRequest {
4516    fn typename() -> &'static str {
4517        "type.googleapis.com/google.cloud.tasks.v2.HttpRequest"
4518    }
4519}
4520
4521/// Defines additional types related to [HttpRequest].
4522pub mod http_request {
4523    #[allow(unused_imports)]
4524    use super::*;
4525
4526    /// The mode for generating an `Authorization` header for HTTP requests.
4527    ///
4528    /// If specified at the [Queue][google.cloud.tasks.v2.Queue] level, all
4529    /// `Authorization` headers in the
4530    /// [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] field are
4531    /// overridden.
4532    ///
4533    /// [google.cloud.tasks.v2.HttpRequest.headers]: crate::model::HttpRequest::headers
4534    /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
4535    #[derive(Clone, Debug, PartialEq)]
4536    #[non_exhaustive]
4537    pub enum AuthorizationHeader {
4538        /// If specified, an
4539        /// [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
4540        /// will be generated and attached as an `Authorization` header in the HTTP
4541        /// request.
4542        ///
4543        /// This type of authorization should generally only be used when calling
4544        /// Google APIs hosted on *.googleapis.com.
4545        OauthToken(std::boxed::Box<crate::model::OAuthToken>),
4546        /// If specified, an
4547        /// [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
4548        /// token will be generated and attached as an `Authorization` header in the
4549        /// HTTP request.
4550        ///
4551        /// This type of authorization can be used for many scenarios, including
4552        /// calling Cloud Run, or endpoints where you intend to validate the token
4553        /// yourself.
4554        OidcToken(std::boxed::Box<crate::model::OidcToken>),
4555    }
4556}
4557
4558/// App Engine HTTP request.
4559///
4560/// The message defines the HTTP request that is sent to an App Engine app when
4561/// the task is dispatched.
4562///
4563/// Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest]
4564/// requires
4565/// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
4566/// Google IAM permission for the project
4567/// and the following scope:
4568///
4569/// `<https://www.googleapis.com/auth/cloud-platform>`
4570///
4571/// The task will be delivered to the App Engine app which belongs to the same
4572/// project as the queue. For more information, see
4573/// [How Requests are
4574/// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
4575/// and how routing is affected by
4576/// [dispatch
4577/// files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
4578/// Traffic is encrypted during transport and never leaves Google datacenters.
4579/// Because this traffic is carried over a communication mechanism internal to
4580/// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS).
4581/// The request to the handler, however, will appear to have used the HTTP
4582/// protocol.
4583///
4584/// The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to
4585/// construct the URL that the task is delivered to can be set at the queue-level
4586/// or task-level:
4587///
4588/// * If [app_engine_routing_override is set on the
4589///   queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this value
4590///   is used for all tasks in the queue, no matter what the setting is for the
4591///   [task-level
4592///   app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
4593///
4594/// The `url` that the task will be sent to is:
4595///
4596/// * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+`
4597///   [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri]
4598///
4599/// Tasks can be dispatched to secure app handlers, unsecure app handlers, and
4600/// URIs restricted with
4601/// [`login:
4602/// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref).
4603/// Because tasks are not run as any user, they cannot be dispatched to URIs
4604/// restricted with
4605/// [`login:
4606/// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
4607/// Task dispatches also do not follow redirects.
4608///
4609/// The task attempt has succeeded if the app's request handler returns an HTTP
4610/// response code in the range [`200` - `299`]. The task attempt has failed if
4611/// the app's handler returns a non-2xx response code or Cloud Tasks does
4612/// not receive response before the
4613/// [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed tasks will
4614/// be retried according to the [retry
4615/// configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service
4616/// Unavailable) is considered an App Engine system error instead of an
4617/// application error and will cause Cloud Tasks' traffic congestion control to
4618/// temporarily throttle the queue's dispatches. Unlike other types of task
4619/// targets, a `429` (Too Many Requests) response from an app handler does not
4620/// cause traffic congestion control to throttle the queue.
4621///
4622/// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
4623/// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
4624/// [google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri]: crate::model::AppEngineHttpRequest::relative_uri
4625/// [google.cloud.tasks.v2.AppEngineRouting]: crate::model::AppEngineRouting
4626/// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
4627/// [google.cloud.tasks.v2.Queue.app_engine_routing_override]: crate::model::Queue::app_engine_routing_override
4628/// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
4629/// [google.cloud.tasks.v2.Task.dispatch_deadline]: crate::model::Task::dispatch_deadline
4630#[derive(Clone, Default, PartialEq)]
4631#[non_exhaustive]
4632pub struct AppEngineHttpRequest {
4633    /// The HTTP method to use for the request. The default is POST.
4634    ///
4635    /// The app's request handler for the task's target URL must be able to handle
4636    /// HTTP requests with this http_method, otherwise the task attempt fails with
4637    /// error code 405 (Method Not Allowed). See [Writing a push task request
4638    /// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
4639    /// and the App Engine documentation for your runtime on [How Requests are
4640    /// Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled).
4641    pub http_method: crate::model::HttpMethod,
4642
4643    /// Task-level setting for App Engine routing.
4644    ///
4645    /// * If [app_engine_routing_override is set on the
4646    ///   queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this
4647    ///   value is used for all tasks in the queue, no matter what the setting is
4648    ///   for the [task-level
4649    ///   app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
4650    ///
4651    /// [google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]: crate::model::AppEngineHttpRequest::app_engine_routing
4652    /// [google.cloud.tasks.v2.Queue.app_engine_routing_override]: crate::model::Queue::app_engine_routing_override
4653    pub app_engine_routing: std::option::Option<crate::model::AppEngineRouting>,
4654
4655    /// The relative URI.
4656    ///
4657    /// The relative URI must begin with "/" and must be a valid HTTP relative URI.
4658    /// It can contain a path and query string arguments.
4659    /// If the relative URI is empty, then the root path "/" will be used.
4660    /// No spaces are allowed, and the maximum length allowed is 2083 characters.
4661    pub relative_uri: std::string::String,
4662
4663    /// HTTP request headers.
4664    ///
4665    /// This map contains the header field names and values.
4666    /// Headers can be set when the
4667    /// [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
4668    /// Repeated headers are not supported but a header value can contain commas.
4669    ///
4670    /// Cloud Tasks sets some headers to default values:
4671    ///
4672    /// * `User-Agent`: By default, this header is
4673    ///   `"AppEngine-Google; (+<http://code.google.com/appengine>)"`.
4674    ///   This header can be modified, but Cloud Tasks will append
4675    ///   `"AppEngine-Google; (+<http://code.google.com/appengine>)"` to the
4676    ///   modified `User-Agent`.
4677    ///
4678    /// If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body],
4679    /// Cloud Tasks sets the following headers:
4680    ///
4681    /// * `Content-Type`: By default, the `Content-Type` header is set to
4682    ///   `"application/octet-stream"`. The default can be overridden by explicitly
4683    ///   setting `Content-Type` to a particular media type when the
4684    ///   [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask].
4685    ///   For example, `Content-Type` can be set to `"application/json"`.
4686    /// * `Content-Length`: This is computed by Cloud Tasks. This value is
4687    ///   output only.   It cannot be changed.
4688    ///
4689    /// The headers below cannot be set or overridden:
4690    ///
4691    /// * `Host`
4692    /// * `X-Google-*`
4693    /// * `X-AppEngine-*`
4694    ///
4695    /// In addition, Cloud Tasks sets some headers when the task is dispatched,
4696    /// such as headers containing information about the task; see
4697    /// [request
4698    /// headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers).
4699    /// These headers are set only when the task is dispatched, so they are not
4700    /// visible when the task is returned in a Cloud Tasks response.
4701    ///
4702    /// Although there is no specific limit for the maximum number of headers or
4703    /// the size, there is a limit on the maximum size of the
4704    /// [Task][google.cloud.tasks.v2.Task]. For more information, see the
4705    /// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation.
4706    ///
4707    /// [google.cloud.tasks.v2.AppEngineHttpRequest.body]: crate::model::AppEngineHttpRequest::body
4708    /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
4709    /// [google.cloud.tasks.v2.Task]: crate::model::Task
4710    pub headers: std::collections::HashMap<std::string::String, std::string::String>,
4711
4712    /// HTTP request body.
4713    ///
4714    /// A request body is allowed only if the HTTP method is POST or PUT. It is
4715    /// an error to set a body on a task with an incompatible
4716    /// [HttpMethod][google.cloud.tasks.v2.HttpMethod].
4717    ///
4718    /// [google.cloud.tasks.v2.HttpMethod]: crate::model::HttpMethod
4719    pub body: ::bytes::Bytes,
4720
4721    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4722}
4723
4724impl AppEngineHttpRequest {
4725    /// Creates a new default instance.
4726    pub fn new() -> Self {
4727        std::default::Default::default()
4728    }
4729
4730    /// Sets the value of [http_method][crate::model::AppEngineHttpRequest::http_method].
4731    ///
4732    /// # Example
4733    /// ```ignore,no_run
4734    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4735    /// use google_cloud_tasks_v2::model::HttpMethod;
4736    /// let x0 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Post);
4737    /// let x1 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Get);
4738    /// let x2 = AppEngineHttpRequest::new().set_http_method(HttpMethod::Head);
4739    /// ```
4740    pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
4741        mut self,
4742        v: T,
4743    ) -> Self {
4744        self.http_method = v.into();
4745        self
4746    }
4747
4748    /// Sets the value of [app_engine_routing][crate::model::AppEngineHttpRequest::app_engine_routing].
4749    ///
4750    /// # Example
4751    /// ```ignore,no_run
4752    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4753    /// use google_cloud_tasks_v2::model::AppEngineRouting;
4754    /// let x = AppEngineHttpRequest::new().set_app_engine_routing(AppEngineRouting::default()/* use setters */);
4755    /// ```
4756    pub fn set_app_engine_routing<T>(mut self, v: T) -> Self
4757    where
4758        T: std::convert::Into<crate::model::AppEngineRouting>,
4759    {
4760        self.app_engine_routing = std::option::Option::Some(v.into());
4761        self
4762    }
4763
4764    /// Sets or clears the value of [app_engine_routing][crate::model::AppEngineHttpRequest::app_engine_routing].
4765    ///
4766    /// # Example
4767    /// ```ignore,no_run
4768    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4769    /// use google_cloud_tasks_v2::model::AppEngineRouting;
4770    /// let x = AppEngineHttpRequest::new().set_or_clear_app_engine_routing(Some(AppEngineRouting::default()/* use setters */));
4771    /// let x = AppEngineHttpRequest::new().set_or_clear_app_engine_routing(None::<AppEngineRouting>);
4772    /// ```
4773    pub fn set_or_clear_app_engine_routing<T>(mut self, v: std::option::Option<T>) -> Self
4774    where
4775        T: std::convert::Into<crate::model::AppEngineRouting>,
4776    {
4777        self.app_engine_routing = v.map(|x| x.into());
4778        self
4779    }
4780
4781    /// Sets the value of [relative_uri][crate::model::AppEngineHttpRequest::relative_uri].
4782    ///
4783    /// # Example
4784    /// ```ignore,no_run
4785    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4786    /// let x = AppEngineHttpRequest::new().set_relative_uri("example");
4787    /// ```
4788    pub fn set_relative_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4789        self.relative_uri = v.into();
4790        self
4791    }
4792
4793    /// Sets the value of [headers][crate::model::AppEngineHttpRequest::headers].
4794    ///
4795    /// # Example
4796    /// ```ignore,no_run
4797    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4798    /// let x = AppEngineHttpRequest::new().set_headers([
4799    ///     ("key0", "abc"),
4800    ///     ("key1", "xyz"),
4801    /// ]);
4802    /// ```
4803    pub fn set_headers<T, K, V>(mut self, v: T) -> Self
4804    where
4805        T: std::iter::IntoIterator<Item = (K, V)>,
4806        K: std::convert::Into<std::string::String>,
4807        V: std::convert::Into<std::string::String>,
4808    {
4809        use std::iter::Iterator;
4810        self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4811        self
4812    }
4813
4814    /// Sets the value of [body][crate::model::AppEngineHttpRequest::body].
4815    ///
4816    /// # Example
4817    /// ```ignore,no_run
4818    /// # use google_cloud_tasks_v2::model::AppEngineHttpRequest;
4819    /// let x = AppEngineHttpRequest::new().set_body(bytes::Bytes::from_static(b"example"));
4820    /// ```
4821    pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4822        self.body = v.into();
4823        self
4824    }
4825}
4826
4827impl wkt::message::Message for AppEngineHttpRequest {
4828    fn typename() -> &'static str {
4829        "type.googleapis.com/google.cloud.tasks.v2.AppEngineHttpRequest"
4830    }
4831}
4832
4833/// App Engine Routing.
4834///
4835/// Defines routing characteristics specific to App Engine - service, version,
4836/// and instance.
4837///
4838/// For more information about services, versions, and instances see
4839/// [An Overview of App
4840/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
4841/// [Microservices Architecture on Google App
4842/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
4843/// [App Engine Standard request
4844/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
4845/// and [App Engine Flex request
4846/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
4847///
4848/// Using [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] requires
4849/// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
4850/// Google IAM permission for the project
4851/// and the following scope:
4852///
4853/// `<https://www.googleapis.com/auth/cloud-platform>`
4854///
4855/// [google.cloud.tasks.v2.AppEngineRouting]: crate::model::AppEngineRouting
4856#[derive(Clone, Default, PartialEq)]
4857#[non_exhaustive]
4858pub struct AppEngineRouting {
4859    /// App service.
4860    ///
4861    /// By default, the task is sent to the service which is the default
4862    /// service when the task is attempted.
4863    ///
4864    /// For some queues or tasks which were created using the App Engine
4865    /// Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not
4866    /// parsable into [service][google.cloud.tasks.v2.AppEngineRouting.service],
4867    /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
4868    /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example,
4869    /// some tasks which were created using the App Engine SDK use a custom domain
4870    /// name; custom domains are not parsed by Cloud Tasks. If
4871    /// [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then
4872    /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
4873    /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
4874    /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty
4875    /// string.
4876    ///
4877    /// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
4878    /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
4879    /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
4880    /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
4881    pub service: std::string::String,
4882
4883    /// App version.
4884    ///
4885    /// By default, the task is sent to the version which is the default
4886    /// version when the task is attempted.
4887    ///
4888    /// For some queues or tasks which were created using the App Engine
4889    /// Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not
4890    /// parsable into [service][google.cloud.tasks.v2.AppEngineRouting.service],
4891    /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
4892    /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example,
4893    /// some tasks which were created using the App Engine SDK use a custom domain
4894    /// name; custom domains are not parsed by Cloud Tasks. If
4895    /// [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then
4896    /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
4897    /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
4898    /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty
4899    /// string.
4900    ///
4901    /// [google.cloud.tasks.v2.AppEngineRouting.host]: crate::model::AppEngineRouting::host
4902    /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
4903    /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
4904    /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
4905    pub version: std::string::String,
4906
4907    /// App instance.
4908    ///
4909    /// By default, the task is sent to an instance which is available when
4910    /// the task is attempted.
4911    ///
4912    /// Requests can only be sent to a specific instance if
4913    /// [manual scaling is used in App Engine
4914    /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
4915    /// App Engine Flex does not support instances. For more information, see
4916    /// [App Engine Standard request
4917    /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
4918    /// and [App Engine Flex request
4919    /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
4920    pub instance: std::string::String,
4921
4922    /// Output only. The host that the task is sent to.
4923    ///
4924    /// The host is constructed from the domain name of the app associated with
4925    /// the queue's project ID (for example \<app-id\>.appspot.com), and the
4926    /// [service][google.cloud.tasks.v2.AppEngineRouting.service],
4927    /// [version][google.cloud.tasks.v2.AppEngineRouting.version], and
4928    /// [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. Tasks which
4929    /// were created using the App Engine SDK might have a custom domain name.
4930    ///
4931    /// For more information, see
4932    /// [How Requests are
4933    /// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
4934    ///
4935    /// [google.cloud.tasks.v2.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
4936    /// [google.cloud.tasks.v2.AppEngineRouting.service]: crate::model::AppEngineRouting::service
4937    /// [google.cloud.tasks.v2.AppEngineRouting.version]: crate::model::AppEngineRouting::version
4938    pub host: std::string::String,
4939
4940    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4941}
4942
4943impl AppEngineRouting {
4944    /// Creates a new default instance.
4945    pub fn new() -> Self {
4946        std::default::Default::default()
4947    }
4948
4949    /// Sets the value of [service][crate::model::AppEngineRouting::service].
4950    ///
4951    /// # Example
4952    /// ```ignore,no_run
4953    /// # use google_cloud_tasks_v2::model::AppEngineRouting;
4954    /// let x = AppEngineRouting::new().set_service("example");
4955    /// ```
4956    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4957        self.service = v.into();
4958        self
4959    }
4960
4961    /// Sets the value of [version][crate::model::AppEngineRouting::version].
4962    ///
4963    /// # Example
4964    /// ```ignore,no_run
4965    /// # use google_cloud_tasks_v2::model::AppEngineRouting;
4966    /// let x = AppEngineRouting::new().set_version("example");
4967    /// ```
4968    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4969        self.version = v.into();
4970        self
4971    }
4972
4973    /// Sets the value of [instance][crate::model::AppEngineRouting::instance].
4974    ///
4975    /// # Example
4976    /// ```ignore,no_run
4977    /// # use google_cloud_tasks_v2::model::AppEngineRouting;
4978    /// let x = AppEngineRouting::new().set_instance("example");
4979    /// ```
4980    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4981        self.instance = v.into();
4982        self
4983    }
4984
4985    /// Sets the value of [host][crate::model::AppEngineRouting::host].
4986    ///
4987    /// # Example
4988    /// ```ignore,no_run
4989    /// # use google_cloud_tasks_v2::model::AppEngineRouting;
4990    /// let x = AppEngineRouting::new().set_host("example");
4991    /// ```
4992    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4993        self.host = v.into();
4994        self
4995    }
4996}
4997
4998impl wkt::message::Message for AppEngineRouting {
4999    fn typename() -> &'static str {
5000        "type.googleapis.com/google.cloud.tasks.v2.AppEngineRouting"
5001    }
5002}
5003
5004/// Contains information needed for generating an
5005/// [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
5006/// This type of authorization should generally only be used when calling Google
5007/// APIs hosted on *.googleapis.com.
5008#[derive(Clone, Default, PartialEq)]
5009#[non_exhaustive]
5010pub struct OAuthToken {
5011    /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
5012    /// to be used for generating OAuth token.
5013    /// The service account must be within the same project as the queue. The
5014    /// caller must have iam.serviceAccounts.actAs permission for the service
5015    /// account.
5016    pub service_account_email: std::string::String,
5017
5018    /// OAuth scope to be used for generating OAuth access token.
5019    /// If not specified, `https://www.googleapis.com/auth/cloud-platform`
5020    /// will be used.
5021    pub scope: std::string::String,
5022
5023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5024}
5025
5026impl OAuthToken {
5027    /// Creates a new default instance.
5028    pub fn new() -> Self {
5029        std::default::Default::default()
5030    }
5031
5032    /// Sets the value of [service_account_email][crate::model::OAuthToken::service_account_email].
5033    ///
5034    /// # Example
5035    /// ```ignore,no_run
5036    /// # use google_cloud_tasks_v2::model::OAuthToken;
5037    /// let x = OAuthToken::new().set_service_account_email("example");
5038    /// ```
5039    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
5040        mut self,
5041        v: T,
5042    ) -> Self {
5043        self.service_account_email = v.into();
5044        self
5045    }
5046
5047    /// Sets the value of [scope][crate::model::OAuthToken::scope].
5048    ///
5049    /// # Example
5050    /// ```ignore,no_run
5051    /// # use google_cloud_tasks_v2::model::OAuthToken;
5052    /// let x = OAuthToken::new().set_scope("example");
5053    /// ```
5054    pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5055        self.scope = v.into();
5056        self
5057    }
5058}
5059
5060impl wkt::message::Message for OAuthToken {
5061    fn typename() -> &'static str {
5062        "type.googleapis.com/google.cloud.tasks.v2.OAuthToken"
5063    }
5064}
5065
5066/// Contains information needed for generating an
5067/// [OpenID Connect
5068/// token](https://developers.google.com/identity/protocols/OpenIDConnect).
5069/// This type of authorization can be used for many scenarios, including
5070/// calling Cloud Run, or endpoints where you intend to validate the token
5071/// yourself.
5072#[derive(Clone, Default, PartialEq)]
5073#[non_exhaustive]
5074pub struct OidcToken {
5075    /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
5076    /// to be used for generating OIDC token.
5077    /// The service account must be within the same project as the queue. The
5078    /// caller must have iam.serviceAccounts.actAs permission for the service
5079    /// account.
5080    pub service_account_email: std::string::String,
5081
5082    /// Audience to be used when generating OIDC token. If not specified, the URI
5083    /// specified in target will be used.
5084    pub audience: std::string::String,
5085
5086    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5087}
5088
5089impl OidcToken {
5090    /// Creates a new default instance.
5091    pub fn new() -> Self {
5092        std::default::Default::default()
5093    }
5094
5095    /// Sets the value of [service_account_email][crate::model::OidcToken::service_account_email].
5096    ///
5097    /// # Example
5098    /// ```ignore,no_run
5099    /// # use google_cloud_tasks_v2::model::OidcToken;
5100    /// let x = OidcToken::new().set_service_account_email("example");
5101    /// ```
5102    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
5103        mut self,
5104        v: T,
5105    ) -> Self {
5106        self.service_account_email = v.into();
5107        self
5108    }
5109
5110    /// Sets the value of [audience][crate::model::OidcToken::audience].
5111    ///
5112    /// # Example
5113    /// ```ignore,no_run
5114    /// # use google_cloud_tasks_v2::model::OidcToken;
5115    /// let x = OidcToken::new().set_audience("example");
5116    /// ```
5117    pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5118        self.audience = v.into();
5119        self
5120    }
5121}
5122
5123impl wkt::message::Message for OidcToken {
5124    fn typename() -> &'static str {
5125        "type.googleapis.com/google.cloud.tasks.v2.OidcToken"
5126    }
5127}
5128
5129/// A unit of scheduled work.
5130#[derive(Clone, Default, PartialEq)]
5131#[non_exhaustive]
5132pub struct Task {
5133    /// Optionally caller-specified in
5134    /// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
5135    ///
5136    /// The task name.
5137    ///
5138    /// The task name must have the following format:
5139    /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
5140    ///
5141    /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
5142    ///   hyphens (-), colons (:), or periods (.).
5143    ///   For more information, see
5144    ///   [Identifying
5145    ///   projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
5146    /// * `LOCATION_ID` is the canonical ID for the task's location.
5147    ///   The list of available locations can be obtained by calling
5148    ///   [ListLocations][google.cloud.location.Locations.ListLocations].
5149    ///   For more information, see <https://cloud.google.com/about/locations/>.
5150    /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
5151    ///   hyphens (-). The maximum length is 100 characters.
5152    /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
5153    ///   hyphens (-), or underscores (_). The maximum length is 500 characters.
5154    ///
5155    /// [google.cloud.tasks.v2.CloudTasks.CreateTask]: crate::client::CloudTasks::create_task
5156    pub name: std::string::String,
5157
5158    /// The time when the task is scheduled to be attempted or retried.
5159    ///
5160    /// `schedule_time` will be truncated to the nearest microsecond.
5161    pub schedule_time: std::option::Option<wkt::Timestamp>,
5162
5163    /// Output only. The time that the task was created.
5164    ///
5165    /// `create_time` will be truncated to the nearest second.
5166    pub create_time: std::option::Option<wkt::Timestamp>,
5167
5168    /// The deadline for requests sent to the worker. If the worker does not
5169    /// respond by this deadline then the request is cancelled and the attempt
5170    /// is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the
5171    /// task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig].
5172    ///
5173    /// Note that when the request is cancelled, Cloud Tasks will stop listening
5174    /// for the response, but whether the worker stops processing depends on the
5175    /// worker. For example, if the worker is stuck, it may not react to cancelled
5176    /// requests.
5177    ///
5178    /// The default and maximum values depend on the type of request:
5179    ///
5180    /// * For [HTTP tasks][google.cloud.tasks.v2.HttpRequest], the default is 10
5181    ///   minutes. The deadline
5182    ///   must be in the interval [15 seconds, 30 minutes].
5183    ///
5184    /// * For [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest], 0
5185    ///   indicates that the
5186    ///   request has the default deadline. The default deadline depends on the
5187    ///   [scaling
5188    ///   type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling)
5189    ///   of the service: 10 minutes for standard apps with automatic scaling, 24
5190    ///   hours for standard apps with manual and basic scaling, and 60 minutes for
5191    ///   flex apps. If the request deadline is set, it must be in the interval [15
5192    ///   seconds, 24 hours 15 seconds]. Regardless of the task's
5193    ///   `dispatch_deadline`, the app handler will not run for longer than than
5194    ///   the service's timeout. We recommend setting the `dispatch_deadline` to
5195    ///   at most a few seconds more than the app handler's timeout. For more
5196    ///   information see
5197    ///   [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts).
5198    ///
5199    ///
5200    /// The value must be given as a string that indicates the length of time
5201    /// (in seconds) followed by `s` (for "seconds"). For more information on the
5202    /// format, see the documentation for
5203    /// [Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration).
5204    /// `dispatch_deadline` will be truncated to the nearest millisecond. The
5205    /// deadline is an approximate deadline.
5206    ///
5207    /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
5208    /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
5209    /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
5210    pub dispatch_deadline: std::option::Option<wkt::Duration>,
5211
5212    /// Output only. The number of attempts dispatched.
5213    ///
5214    /// This count includes attempts which have been dispatched but haven't
5215    /// received a response.
5216    pub dispatch_count: i32,
5217
5218    /// Output only. The number of attempts which have received a response.
5219    pub response_count: i32,
5220
5221    /// Output only. The status of the task's first attempt.
5222    ///
5223    /// Only [dispatch_time][google.cloud.tasks.v2.Attempt.dispatch_time] will be
5224    /// set. The other [Attempt][google.cloud.tasks.v2.Attempt] information is not
5225    /// retained by Cloud Tasks.
5226    ///
5227    /// [google.cloud.tasks.v2.Attempt]: crate::model::Attempt
5228    /// [google.cloud.tasks.v2.Attempt.dispatch_time]: crate::model::Attempt::dispatch_time
5229    pub first_attempt: std::option::Option<crate::model::Attempt>,
5230
5231    /// Output only. The status of the task's last attempt.
5232    pub last_attempt: std::option::Option<crate::model::Attempt>,
5233
5234    /// Output only. The view specifies which subset of the
5235    /// [Task][google.cloud.tasks.v2.Task] has been returned.
5236    ///
5237    /// [google.cloud.tasks.v2.Task]: crate::model::Task
5238    pub view: crate::model::task::View,
5239
5240    /// Optional. Specifies the task-level
5241    /// [RetryConfig][google.cloud.tasks.v2.RetryConfig].
5242    ///
5243    /// If present, this overrides the
5244    /// [Queue.retry_config][google.cloud.tasks.v2.Queue.retry_config] for this
5245    /// task.
5246    ///
5247    /// [google.cloud.tasks.v2.Queue.retry_config]: crate::model::Queue::retry_config
5248    /// [google.cloud.tasks.v2.RetryConfig]: crate::model::RetryConfig
5249    pub retry_config: std::option::Option<crate::model::RetryConfig>,
5250
5251    /// Required. The message to send to the worker.
5252    pub message_type: std::option::Option<crate::model::task::MessageType>,
5253
5254    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5255}
5256
5257impl Task {
5258    /// Creates a new default instance.
5259    pub fn new() -> Self {
5260        std::default::Default::default()
5261    }
5262
5263    /// Sets the value of [name][crate::model::Task::name].
5264    ///
5265    /// # Example
5266    /// ```ignore,no_run
5267    /// # use google_cloud_tasks_v2::model::Task;
5268    /// # let project_id = "project_id";
5269    /// # let location_id = "location_id";
5270    /// # let queue_id = "queue_id";
5271    /// # let task_id = "task_id";
5272    /// let x = Task::new().set_name(format!("projects/{project_id}/locations/{location_id}/queues/{queue_id}/tasks/{task_id}"));
5273    /// ```
5274    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5275        self.name = v.into();
5276        self
5277    }
5278
5279    /// Sets the value of [schedule_time][crate::model::Task::schedule_time].
5280    ///
5281    /// # Example
5282    /// ```ignore,no_run
5283    /// # use google_cloud_tasks_v2::model::Task;
5284    /// use wkt::Timestamp;
5285    /// let x = Task::new().set_schedule_time(Timestamp::default()/* use setters */);
5286    /// ```
5287    pub fn set_schedule_time<T>(mut self, v: T) -> Self
5288    where
5289        T: std::convert::Into<wkt::Timestamp>,
5290    {
5291        self.schedule_time = std::option::Option::Some(v.into());
5292        self
5293    }
5294
5295    /// Sets or clears the value of [schedule_time][crate::model::Task::schedule_time].
5296    ///
5297    /// # Example
5298    /// ```ignore,no_run
5299    /// # use google_cloud_tasks_v2::model::Task;
5300    /// use wkt::Timestamp;
5301    /// let x = Task::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
5302    /// let x = Task::new().set_or_clear_schedule_time(None::<Timestamp>);
5303    /// ```
5304    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
5305    where
5306        T: std::convert::Into<wkt::Timestamp>,
5307    {
5308        self.schedule_time = v.map(|x| x.into());
5309        self
5310    }
5311
5312    /// Sets the value of [create_time][crate::model::Task::create_time].
5313    ///
5314    /// # Example
5315    /// ```ignore,no_run
5316    /// # use google_cloud_tasks_v2::model::Task;
5317    /// use wkt::Timestamp;
5318    /// let x = Task::new().set_create_time(Timestamp::default()/* use setters */);
5319    /// ```
5320    pub fn set_create_time<T>(mut self, v: T) -> Self
5321    where
5322        T: std::convert::Into<wkt::Timestamp>,
5323    {
5324        self.create_time = std::option::Option::Some(v.into());
5325        self
5326    }
5327
5328    /// Sets or clears the value of [create_time][crate::model::Task::create_time].
5329    ///
5330    /// # Example
5331    /// ```ignore,no_run
5332    /// # use google_cloud_tasks_v2::model::Task;
5333    /// use wkt::Timestamp;
5334    /// let x = Task::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5335    /// let x = Task::new().set_or_clear_create_time(None::<Timestamp>);
5336    /// ```
5337    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5338    where
5339        T: std::convert::Into<wkt::Timestamp>,
5340    {
5341        self.create_time = v.map(|x| x.into());
5342        self
5343    }
5344
5345    /// Sets the value of [dispatch_deadline][crate::model::Task::dispatch_deadline].
5346    ///
5347    /// # Example
5348    /// ```ignore,no_run
5349    /// # use google_cloud_tasks_v2::model::Task;
5350    /// use wkt::Duration;
5351    /// let x = Task::new().set_dispatch_deadline(Duration::default()/* use setters */);
5352    /// ```
5353    pub fn set_dispatch_deadline<T>(mut self, v: T) -> Self
5354    where
5355        T: std::convert::Into<wkt::Duration>,
5356    {
5357        self.dispatch_deadline = std::option::Option::Some(v.into());
5358        self
5359    }
5360
5361    /// Sets or clears the value of [dispatch_deadline][crate::model::Task::dispatch_deadline].
5362    ///
5363    /// # Example
5364    /// ```ignore,no_run
5365    /// # use google_cloud_tasks_v2::model::Task;
5366    /// use wkt::Duration;
5367    /// let x = Task::new().set_or_clear_dispatch_deadline(Some(Duration::default()/* use setters */));
5368    /// let x = Task::new().set_or_clear_dispatch_deadline(None::<Duration>);
5369    /// ```
5370    pub fn set_or_clear_dispatch_deadline<T>(mut self, v: std::option::Option<T>) -> Self
5371    where
5372        T: std::convert::Into<wkt::Duration>,
5373    {
5374        self.dispatch_deadline = v.map(|x| x.into());
5375        self
5376    }
5377
5378    /// Sets the value of [dispatch_count][crate::model::Task::dispatch_count].
5379    ///
5380    /// # Example
5381    /// ```ignore,no_run
5382    /// # use google_cloud_tasks_v2::model::Task;
5383    /// let x = Task::new().set_dispatch_count(42);
5384    /// ```
5385    pub fn set_dispatch_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5386        self.dispatch_count = v.into();
5387        self
5388    }
5389
5390    /// Sets the value of [response_count][crate::model::Task::response_count].
5391    ///
5392    /// # Example
5393    /// ```ignore,no_run
5394    /// # use google_cloud_tasks_v2::model::Task;
5395    /// let x = Task::new().set_response_count(42);
5396    /// ```
5397    pub fn set_response_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5398        self.response_count = v.into();
5399        self
5400    }
5401
5402    /// Sets the value of [first_attempt][crate::model::Task::first_attempt].
5403    ///
5404    /// # Example
5405    /// ```ignore,no_run
5406    /// # use google_cloud_tasks_v2::model::Task;
5407    /// use google_cloud_tasks_v2::model::Attempt;
5408    /// let x = Task::new().set_first_attempt(Attempt::default()/* use setters */);
5409    /// ```
5410    pub fn set_first_attempt<T>(mut self, v: T) -> Self
5411    where
5412        T: std::convert::Into<crate::model::Attempt>,
5413    {
5414        self.first_attempt = std::option::Option::Some(v.into());
5415        self
5416    }
5417
5418    /// Sets or clears the value of [first_attempt][crate::model::Task::first_attempt].
5419    ///
5420    /// # Example
5421    /// ```ignore,no_run
5422    /// # use google_cloud_tasks_v2::model::Task;
5423    /// use google_cloud_tasks_v2::model::Attempt;
5424    /// let x = Task::new().set_or_clear_first_attempt(Some(Attempt::default()/* use setters */));
5425    /// let x = Task::new().set_or_clear_first_attempt(None::<Attempt>);
5426    /// ```
5427    pub fn set_or_clear_first_attempt<T>(mut self, v: std::option::Option<T>) -> Self
5428    where
5429        T: std::convert::Into<crate::model::Attempt>,
5430    {
5431        self.first_attempt = v.map(|x| x.into());
5432        self
5433    }
5434
5435    /// Sets the value of [last_attempt][crate::model::Task::last_attempt].
5436    ///
5437    /// # Example
5438    /// ```ignore,no_run
5439    /// # use google_cloud_tasks_v2::model::Task;
5440    /// use google_cloud_tasks_v2::model::Attempt;
5441    /// let x = Task::new().set_last_attempt(Attempt::default()/* use setters */);
5442    /// ```
5443    pub fn set_last_attempt<T>(mut self, v: T) -> Self
5444    where
5445        T: std::convert::Into<crate::model::Attempt>,
5446    {
5447        self.last_attempt = std::option::Option::Some(v.into());
5448        self
5449    }
5450
5451    /// Sets or clears the value of [last_attempt][crate::model::Task::last_attempt].
5452    ///
5453    /// # Example
5454    /// ```ignore,no_run
5455    /// # use google_cloud_tasks_v2::model::Task;
5456    /// use google_cloud_tasks_v2::model::Attempt;
5457    /// let x = Task::new().set_or_clear_last_attempt(Some(Attempt::default()/* use setters */));
5458    /// let x = Task::new().set_or_clear_last_attempt(None::<Attempt>);
5459    /// ```
5460    pub fn set_or_clear_last_attempt<T>(mut self, v: std::option::Option<T>) -> Self
5461    where
5462        T: std::convert::Into<crate::model::Attempt>,
5463    {
5464        self.last_attempt = v.map(|x| x.into());
5465        self
5466    }
5467
5468    /// Sets the value of [view][crate::model::Task::view].
5469    ///
5470    /// # Example
5471    /// ```ignore,no_run
5472    /// # use google_cloud_tasks_v2::model::Task;
5473    /// use google_cloud_tasks_v2::model::task::View;
5474    /// let x0 = Task::new().set_view(View::Basic);
5475    /// let x1 = Task::new().set_view(View::Full);
5476    /// ```
5477    pub fn set_view<T: std::convert::Into<crate::model::task::View>>(mut self, v: T) -> Self {
5478        self.view = v.into();
5479        self
5480    }
5481
5482    /// Sets the value of [retry_config][crate::model::Task::retry_config].
5483    ///
5484    /// # Example
5485    /// ```ignore,no_run
5486    /// # use google_cloud_tasks_v2::model::Task;
5487    /// use google_cloud_tasks_v2::model::RetryConfig;
5488    /// let x = Task::new().set_retry_config(RetryConfig::default()/* use setters */);
5489    /// ```
5490    pub fn set_retry_config<T>(mut self, v: T) -> Self
5491    where
5492        T: std::convert::Into<crate::model::RetryConfig>,
5493    {
5494        self.retry_config = std::option::Option::Some(v.into());
5495        self
5496    }
5497
5498    /// Sets or clears the value of [retry_config][crate::model::Task::retry_config].
5499    ///
5500    /// # Example
5501    /// ```ignore,no_run
5502    /// # use google_cloud_tasks_v2::model::Task;
5503    /// use google_cloud_tasks_v2::model::RetryConfig;
5504    /// let x = Task::new().set_or_clear_retry_config(Some(RetryConfig::default()/* use setters */));
5505    /// let x = Task::new().set_or_clear_retry_config(None::<RetryConfig>);
5506    /// ```
5507    pub fn set_or_clear_retry_config<T>(mut self, v: std::option::Option<T>) -> Self
5508    where
5509        T: std::convert::Into<crate::model::RetryConfig>,
5510    {
5511        self.retry_config = v.map(|x| x.into());
5512        self
5513    }
5514
5515    /// Sets the value of [message_type][crate::model::Task::message_type].
5516    ///
5517    /// Note that all the setters affecting `message_type` are mutually
5518    /// exclusive.
5519    ///
5520    /// # Example
5521    /// ```ignore,no_run
5522    /// # use google_cloud_tasks_v2::model::Task;
5523    /// use google_cloud_tasks_v2::model::AppEngineHttpRequest;
5524    /// let x = Task::new().set_message_type(Some(
5525    ///     google_cloud_tasks_v2::model::task::MessageType::AppEngineHttpRequest(AppEngineHttpRequest::default().into())));
5526    /// ```
5527    pub fn set_message_type<
5528        T: std::convert::Into<std::option::Option<crate::model::task::MessageType>>,
5529    >(
5530        mut self,
5531        v: T,
5532    ) -> Self {
5533        self.message_type = v.into();
5534        self
5535    }
5536
5537    /// The value of [message_type][crate::model::Task::message_type]
5538    /// if it holds a `AppEngineHttpRequest`, `None` if the field is not set or
5539    /// holds a different branch.
5540    pub fn app_engine_http_request(
5541        &self,
5542    ) -> std::option::Option<&std::boxed::Box<crate::model::AppEngineHttpRequest>> {
5543        #[allow(unreachable_patterns)]
5544        self.message_type.as_ref().and_then(|v| match v {
5545            crate::model::task::MessageType::AppEngineHttpRequest(v) => {
5546                std::option::Option::Some(v)
5547            }
5548            _ => std::option::Option::None,
5549        })
5550    }
5551
5552    /// Sets the value of [message_type][crate::model::Task::message_type]
5553    /// to hold a `AppEngineHttpRequest`.
5554    ///
5555    /// Note that all the setters affecting `message_type` are
5556    /// mutually exclusive.
5557    ///
5558    /// # Example
5559    /// ```ignore,no_run
5560    /// # use google_cloud_tasks_v2::model::Task;
5561    /// use google_cloud_tasks_v2::model::AppEngineHttpRequest;
5562    /// let x = Task::new().set_app_engine_http_request(AppEngineHttpRequest::default()/* use setters */);
5563    /// assert!(x.app_engine_http_request().is_some());
5564    /// assert!(x.http_request().is_none());
5565    /// ```
5566    pub fn set_app_engine_http_request<
5567        T: std::convert::Into<std::boxed::Box<crate::model::AppEngineHttpRequest>>,
5568    >(
5569        mut self,
5570        v: T,
5571    ) -> Self {
5572        self.message_type = std::option::Option::Some(
5573            crate::model::task::MessageType::AppEngineHttpRequest(v.into()),
5574        );
5575        self
5576    }
5577
5578    /// The value of [message_type][crate::model::Task::message_type]
5579    /// if it holds a `HttpRequest`, `None` if the field is not set or
5580    /// holds a different branch.
5581    pub fn http_request(&self) -> std::option::Option<&std::boxed::Box<crate::model::HttpRequest>> {
5582        #[allow(unreachable_patterns)]
5583        self.message_type.as_ref().and_then(|v| match v {
5584            crate::model::task::MessageType::HttpRequest(v) => std::option::Option::Some(v),
5585            _ => std::option::Option::None,
5586        })
5587    }
5588
5589    /// Sets the value of [message_type][crate::model::Task::message_type]
5590    /// to hold a `HttpRequest`.
5591    ///
5592    /// Note that all the setters affecting `message_type` are
5593    /// mutually exclusive.
5594    ///
5595    /// # Example
5596    /// ```ignore,no_run
5597    /// # use google_cloud_tasks_v2::model::Task;
5598    /// use google_cloud_tasks_v2::model::HttpRequest;
5599    /// let x = Task::new().set_http_request(HttpRequest::default()/* use setters */);
5600    /// assert!(x.http_request().is_some());
5601    /// assert!(x.app_engine_http_request().is_none());
5602    /// ```
5603    pub fn set_http_request<T: std::convert::Into<std::boxed::Box<crate::model::HttpRequest>>>(
5604        mut self,
5605        v: T,
5606    ) -> Self {
5607        self.message_type =
5608            std::option::Option::Some(crate::model::task::MessageType::HttpRequest(v.into()));
5609        self
5610    }
5611}
5612
5613impl wkt::message::Message for Task {
5614    fn typename() -> &'static str {
5615        "type.googleapis.com/google.cloud.tasks.v2.Task"
5616    }
5617}
5618
5619/// Defines additional types related to [Task].
5620pub mod task {
5621    #[allow(unused_imports)]
5622    use super::*;
5623
5624    /// The view specifies a subset of [Task][google.cloud.tasks.v2.Task] data.
5625    ///
5626    /// When a task is returned in a response, not all
5627    /// information is retrieved by default because some data, such as
5628    /// payloads, might be desirable to return only when needed because
5629    /// of its large size or because of the sensitivity of data that it
5630    /// contains.
5631    ///
5632    /// [google.cloud.tasks.v2.Task]: crate::model::Task
5633    ///
5634    /// # Working with unknown values
5635    ///
5636    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5637    /// additional enum variants at any time. Adding new variants is not considered
5638    /// a breaking change. Applications should write their code in anticipation of:
5639    ///
5640    /// - New values appearing in future releases of the client library, **and**
5641    /// - New values received dynamically, without application changes.
5642    ///
5643    /// Please consult the [Working with enums] section in the user guide for some
5644    /// guidelines.
5645    ///
5646    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5647    #[derive(Clone, Debug, PartialEq)]
5648    #[non_exhaustive]
5649    pub enum View {
5650        /// Unspecified. Defaults to BASIC.
5651        Unspecified,
5652        /// The basic view omits fields which can be large or can contain
5653        /// sensitive data.
5654        ///
5655        /// This view does not include the
5656        /// [body in
5657        /// AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest.body].
5658        /// Bodies are desirable to return only when needed, because they
5659        /// can be large and because of the sensitivity of the data that you
5660        /// choose to store in it.
5661        ///
5662        /// [google.cloud.tasks.v2.AppEngineHttpRequest.body]: crate::model::AppEngineHttpRequest::body
5663        Basic,
5664        /// All information is returned.
5665        ///
5666        /// Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
5667        /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
5668        /// permission on the [Queue][google.cloud.tasks.v2.Queue] resource.
5669        ///
5670        /// [google.cloud.tasks.v2.Queue]: crate::model::Queue
5671        /// [google.cloud.tasks.v2.Task.View.FULL]: crate::model::task::View::Full
5672        Full,
5673        /// If set, the enum was initialized with an unknown value.
5674        ///
5675        /// Applications can examine the value using [View::value] or
5676        /// [View::name].
5677        UnknownValue(view::UnknownValue),
5678    }
5679
5680    #[doc(hidden)]
5681    pub mod view {
5682        #[allow(unused_imports)]
5683        use super::*;
5684        #[derive(Clone, Debug, PartialEq)]
5685        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5686    }
5687
5688    impl View {
5689        /// Gets the enum value.
5690        ///
5691        /// Returns `None` if the enum contains an unknown value deserialized from
5692        /// the string representation of enums.
5693        pub fn value(&self) -> std::option::Option<i32> {
5694            match self {
5695                Self::Unspecified => std::option::Option::Some(0),
5696                Self::Basic => std::option::Option::Some(1),
5697                Self::Full => std::option::Option::Some(2),
5698                Self::UnknownValue(u) => u.0.value(),
5699            }
5700        }
5701
5702        /// Gets the enum value as a string.
5703        ///
5704        /// Returns `None` if the enum contains an unknown value deserialized from
5705        /// the integer representation of enums.
5706        pub fn name(&self) -> std::option::Option<&str> {
5707            match self {
5708                Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
5709                Self::Basic => std::option::Option::Some("BASIC"),
5710                Self::Full => std::option::Option::Some("FULL"),
5711                Self::UnknownValue(u) => u.0.name(),
5712            }
5713        }
5714    }
5715
5716    impl std::default::Default for View {
5717        fn default() -> Self {
5718            use std::convert::From;
5719            Self::from(0)
5720        }
5721    }
5722
5723    impl std::fmt::Display for View {
5724        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5725            wkt::internal::display_enum(f, self.name(), self.value())
5726        }
5727    }
5728
5729    impl std::convert::From<i32> for View {
5730        fn from(value: i32) -> Self {
5731            match value {
5732                0 => Self::Unspecified,
5733                1 => Self::Basic,
5734                2 => Self::Full,
5735                _ => Self::UnknownValue(view::UnknownValue(
5736                    wkt::internal::UnknownEnumValue::Integer(value),
5737                )),
5738            }
5739        }
5740    }
5741
5742    impl std::convert::From<&str> for View {
5743        fn from(value: &str) -> Self {
5744            use std::string::ToString;
5745            match value {
5746                "VIEW_UNSPECIFIED" => Self::Unspecified,
5747                "BASIC" => Self::Basic,
5748                "FULL" => Self::Full,
5749                _ => Self::UnknownValue(view::UnknownValue(
5750                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5751                )),
5752            }
5753        }
5754    }
5755
5756    impl serde::ser::Serialize for View {
5757        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5758        where
5759            S: serde::Serializer,
5760        {
5761            match self {
5762                Self::Unspecified => serializer.serialize_i32(0),
5763                Self::Basic => serializer.serialize_i32(1),
5764                Self::Full => serializer.serialize_i32(2),
5765                Self::UnknownValue(u) => u.0.serialize(serializer),
5766            }
5767        }
5768    }
5769
5770    impl<'de> serde::de::Deserialize<'de> for View {
5771        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5772        where
5773            D: serde::Deserializer<'de>,
5774        {
5775            deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
5776                ".google.cloud.tasks.v2.Task.View",
5777            ))
5778        }
5779    }
5780
5781    /// Required. The message to send to the worker.
5782    #[derive(Clone, Debug, PartialEq)]
5783    #[non_exhaustive]
5784    pub enum MessageType {
5785        /// HTTP request that is sent to the App Engine app handler.
5786        ///
5787        /// An App Engine task is a task that has
5788        /// [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set.
5789        ///
5790        /// [google.cloud.tasks.v2.AppEngineHttpRequest]: crate::model::AppEngineHttpRequest
5791        AppEngineHttpRequest(std::boxed::Box<crate::model::AppEngineHttpRequest>),
5792        /// HTTP request that is sent to the worker.
5793        ///
5794        /// An HTTP task is a task that has
5795        /// [HttpRequest][google.cloud.tasks.v2.HttpRequest] set.
5796        ///
5797        /// [google.cloud.tasks.v2.HttpRequest]: crate::model::HttpRequest
5798        HttpRequest(std::boxed::Box<crate::model::HttpRequest>),
5799    }
5800}
5801
5802/// The status of a task attempt.
5803#[derive(Clone, Default, PartialEq)]
5804#[non_exhaustive]
5805pub struct Attempt {
5806    /// Output only. The time that this attempt was scheduled.
5807    ///
5808    /// `schedule_time` will be truncated to the nearest microsecond.
5809    pub schedule_time: std::option::Option<wkt::Timestamp>,
5810
5811    /// Output only. The time that this attempt was dispatched.
5812    ///
5813    /// `dispatch_time` will be truncated to the nearest microsecond.
5814    pub dispatch_time: std::option::Option<wkt::Timestamp>,
5815
5816    /// Output only. The time that this attempt response was received.
5817    ///
5818    /// `response_time` will be truncated to the nearest microsecond.
5819    pub response_time: std::option::Option<wkt::Timestamp>,
5820
5821    /// Output only. The response from the worker for this attempt.
5822    ///
5823    /// If `response_time` is unset, then the task has not been attempted or is
5824    /// currently running and the `response_status` field is meaningless.
5825    pub response_status: std::option::Option<google_cloud_rpc::model::Status>,
5826
5827    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5828}
5829
5830impl Attempt {
5831    /// Creates a new default instance.
5832    pub fn new() -> Self {
5833        std::default::Default::default()
5834    }
5835
5836    /// Sets the value of [schedule_time][crate::model::Attempt::schedule_time].
5837    ///
5838    /// # Example
5839    /// ```ignore,no_run
5840    /// # use google_cloud_tasks_v2::model::Attempt;
5841    /// use wkt::Timestamp;
5842    /// let x = Attempt::new().set_schedule_time(Timestamp::default()/* use setters */);
5843    /// ```
5844    pub fn set_schedule_time<T>(mut self, v: T) -> Self
5845    where
5846        T: std::convert::Into<wkt::Timestamp>,
5847    {
5848        self.schedule_time = std::option::Option::Some(v.into());
5849        self
5850    }
5851
5852    /// Sets or clears the value of [schedule_time][crate::model::Attempt::schedule_time].
5853    ///
5854    /// # Example
5855    /// ```ignore,no_run
5856    /// # use google_cloud_tasks_v2::model::Attempt;
5857    /// use wkt::Timestamp;
5858    /// let x = Attempt::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
5859    /// let x = Attempt::new().set_or_clear_schedule_time(None::<Timestamp>);
5860    /// ```
5861    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
5862    where
5863        T: std::convert::Into<wkt::Timestamp>,
5864    {
5865        self.schedule_time = v.map(|x| x.into());
5866        self
5867    }
5868
5869    /// Sets the value of [dispatch_time][crate::model::Attempt::dispatch_time].
5870    ///
5871    /// # Example
5872    /// ```ignore,no_run
5873    /// # use google_cloud_tasks_v2::model::Attempt;
5874    /// use wkt::Timestamp;
5875    /// let x = Attempt::new().set_dispatch_time(Timestamp::default()/* use setters */);
5876    /// ```
5877    pub fn set_dispatch_time<T>(mut self, v: T) -> Self
5878    where
5879        T: std::convert::Into<wkt::Timestamp>,
5880    {
5881        self.dispatch_time = std::option::Option::Some(v.into());
5882        self
5883    }
5884
5885    /// Sets or clears the value of [dispatch_time][crate::model::Attempt::dispatch_time].
5886    ///
5887    /// # Example
5888    /// ```ignore,no_run
5889    /// # use google_cloud_tasks_v2::model::Attempt;
5890    /// use wkt::Timestamp;
5891    /// let x = Attempt::new().set_or_clear_dispatch_time(Some(Timestamp::default()/* use setters */));
5892    /// let x = Attempt::new().set_or_clear_dispatch_time(None::<Timestamp>);
5893    /// ```
5894    pub fn set_or_clear_dispatch_time<T>(mut self, v: std::option::Option<T>) -> Self
5895    where
5896        T: std::convert::Into<wkt::Timestamp>,
5897    {
5898        self.dispatch_time = v.map(|x| x.into());
5899        self
5900    }
5901
5902    /// Sets the value of [response_time][crate::model::Attempt::response_time].
5903    ///
5904    /// # Example
5905    /// ```ignore,no_run
5906    /// # use google_cloud_tasks_v2::model::Attempt;
5907    /// use wkt::Timestamp;
5908    /// let x = Attempt::new().set_response_time(Timestamp::default()/* use setters */);
5909    /// ```
5910    pub fn set_response_time<T>(mut self, v: T) -> Self
5911    where
5912        T: std::convert::Into<wkt::Timestamp>,
5913    {
5914        self.response_time = std::option::Option::Some(v.into());
5915        self
5916    }
5917
5918    /// Sets or clears the value of [response_time][crate::model::Attempt::response_time].
5919    ///
5920    /// # Example
5921    /// ```ignore,no_run
5922    /// # use google_cloud_tasks_v2::model::Attempt;
5923    /// use wkt::Timestamp;
5924    /// let x = Attempt::new().set_or_clear_response_time(Some(Timestamp::default()/* use setters */));
5925    /// let x = Attempt::new().set_or_clear_response_time(None::<Timestamp>);
5926    /// ```
5927    pub fn set_or_clear_response_time<T>(mut self, v: std::option::Option<T>) -> Self
5928    where
5929        T: std::convert::Into<wkt::Timestamp>,
5930    {
5931        self.response_time = v.map(|x| x.into());
5932        self
5933    }
5934
5935    /// Sets the value of [response_status][crate::model::Attempt::response_status].
5936    ///
5937    /// # Example
5938    /// ```ignore,no_run
5939    /// # use google_cloud_tasks_v2::model::Attempt;
5940    /// use google_cloud_rpc::model::Status;
5941    /// let x = Attempt::new().set_response_status(Status::default()/* use setters */);
5942    /// ```
5943    pub fn set_response_status<T>(mut self, v: T) -> Self
5944    where
5945        T: std::convert::Into<google_cloud_rpc::model::Status>,
5946    {
5947        self.response_status = std::option::Option::Some(v.into());
5948        self
5949    }
5950
5951    /// Sets or clears the value of [response_status][crate::model::Attempt::response_status].
5952    ///
5953    /// # Example
5954    /// ```ignore,no_run
5955    /// # use google_cloud_tasks_v2::model::Attempt;
5956    /// use google_cloud_rpc::model::Status;
5957    /// let x = Attempt::new().set_or_clear_response_status(Some(Status::default()/* use setters */));
5958    /// let x = Attempt::new().set_or_clear_response_status(None::<Status>);
5959    /// ```
5960    pub fn set_or_clear_response_status<T>(mut self, v: std::option::Option<T>) -> Self
5961    where
5962        T: std::convert::Into<google_cloud_rpc::model::Status>,
5963    {
5964        self.response_status = v.map(|x| x.into());
5965        self
5966    }
5967}
5968
5969impl wkt::message::Message for Attempt {
5970    fn typename() -> &'static str {
5971        "type.googleapis.com/google.cloud.tasks.v2.Attempt"
5972    }
5973}
5974
5975/// The HTTP method used to deliver the task.
5976///
5977/// # Working with unknown values
5978///
5979/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5980/// additional enum variants at any time. Adding new variants is not considered
5981/// a breaking change. Applications should write their code in anticipation of:
5982///
5983/// - New values appearing in future releases of the client library, **and**
5984/// - New values received dynamically, without application changes.
5985///
5986/// Please consult the [Working with enums] section in the user guide for some
5987/// guidelines.
5988///
5989/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5990#[derive(Clone, Debug, PartialEq)]
5991#[non_exhaustive]
5992pub enum HttpMethod {
5993    /// HTTP method unspecified
5994    Unspecified,
5995    /// HTTP POST
5996    Post,
5997    /// HTTP GET
5998    Get,
5999    /// HTTP HEAD
6000    Head,
6001    /// HTTP PUT
6002    Put,
6003    /// HTTP DELETE
6004    Delete,
6005    /// HTTP PATCH
6006    Patch,
6007    /// HTTP OPTIONS
6008    Options,
6009    /// If set, the enum was initialized with an unknown value.
6010    ///
6011    /// Applications can examine the value using [HttpMethod::value] or
6012    /// [HttpMethod::name].
6013    UnknownValue(http_method::UnknownValue),
6014}
6015
6016#[doc(hidden)]
6017pub mod http_method {
6018    #[allow(unused_imports)]
6019    use super::*;
6020    #[derive(Clone, Debug, PartialEq)]
6021    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6022}
6023
6024impl HttpMethod {
6025    /// Gets the enum value.
6026    ///
6027    /// Returns `None` if the enum contains an unknown value deserialized from
6028    /// the string representation of enums.
6029    pub fn value(&self) -> std::option::Option<i32> {
6030        match self {
6031            Self::Unspecified => std::option::Option::Some(0),
6032            Self::Post => std::option::Option::Some(1),
6033            Self::Get => std::option::Option::Some(2),
6034            Self::Head => std::option::Option::Some(3),
6035            Self::Put => std::option::Option::Some(4),
6036            Self::Delete => std::option::Option::Some(5),
6037            Self::Patch => std::option::Option::Some(6),
6038            Self::Options => std::option::Option::Some(7),
6039            Self::UnknownValue(u) => u.0.value(),
6040        }
6041    }
6042
6043    /// Gets the enum value as a string.
6044    ///
6045    /// Returns `None` if the enum contains an unknown value deserialized from
6046    /// the integer representation of enums.
6047    pub fn name(&self) -> std::option::Option<&str> {
6048        match self {
6049            Self::Unspecified => std::option::Option::Some("HTTP_METHOD_UNSPECIFIED"),
6050            Self::Post => std::option::Option::Some("POST"),
6051            Self::Get => std::option::Option::Some("GET"),
6052            Self::Head => std::option::Option::Some("HEAD"),
6053            Self::Put => std::option::Option::Some("PUT"),
6054            Self::Delete => std::option::Option::Some("DELETE"),
6055            Self::Patch => std::option::Option::Some("PATCH"),
6056            Self::Options => std::option::Option::Some("OPTIONS"),
6057            Self::UnknownValue(u) => u.0.name(),
6058        }
6059    }
6060}
6061
6062impl std::default::Default for HttpMethod {
6063    fn default() -> Self {
6064        use std::convert::From;
6065        Self::from(0)
6066    }
6067}
6068
6069impl std::fmt::Display for HttpMethod {
6070    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6071        wkt::internal::display_enum(f, self.name(), self.value())
6072    }
6073}
6074
6075impl std::convert::From<i32> for HttpMethod {
6076    fn from(value: i32) -> Self {
6077        match value {
6078            0 => Self::Unspecified,
6079            1 => Self::Post,
6080            2 => Self::Get,
6081            3 => Self::Head,
6082            4 => Self::Put,
6083            5 => Self::Delete,
6084            6 => Self::Patch,
6085            7 => Self::Options,
6086            _ => Self::UnknownValue(http_method::UnknownValue(
6087                wkt::internal::UnknownEnumValue::Integer(value),
6088            )),
6089        }
6090    }
6091}
6092
6093impl std::convert::From<&str> for HttpMethod {
6094    fn from(value: &str) -> Self {
6095        use std::string::ToString;
6096        match value {
6097            "HTTP_METHOD_UNSPECIFIED" => Self::Unspecified,
6098            "POST" => Self::Post,
6099            "GET" => Self::Get,
6100            "HEAD" => Self::Head,
6101            "PUT" => Self::Put,
6102            "DELETE" => Self::Delete,
6103            "PATCH" => Self::Patch,
6104            "OPTIONS" => Self::Options,
6105            _ => Self::UnknownValue(http_method::UnknownValue(
6106                wkt::internal::UnknownEnumValue::String(value.to_string()),
6107            )),
6108        }
6109    }
6110}
6111
6112impl serde::ser::Serialize for HttpMethod {
6113    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6114    where
6115        S: serde::Serializer,
6116    {
6117        match self {
6118            Self::Unspecified => serializer.serialize_i32(0),
6119            Self::Post => serializer.serialize_i32(1),
6120            Self::Get => serializer.serialize_i32(2),
6121            Self::Head => serializer.serialize_i32(3),
6122            Self::Put => serializer.serialize_i32(4),
6123            Self::Delete => serializer.serialize_i32(5),
6124            Self::Patch => serializer.serialize_i32(6),
6125            Self::Options => serializer.serialize_i32(7),
6126            Self::UnknownValue(u) => u.0.serialize(serializer),
6127        }
6128    }
6129}
6130
6131impl<'de> serde::de::Deserialize<'de> for HttpMethod {
6132    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6133    where
6134        D: serde::Deserializer<'de>,
6135    {
6136        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HttpMethod>::new(
6137            ".google.cloud.tasks.v2.HttpMethod",
6138        ))
6139    }
6140}