Skip to main content

google_cloud_scheduler_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_rpc;
26extern crate lazy_static;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Request message for listing jobs using
39/// [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
40///
41/// [google.cloud.scheduler.v1.CloudScheduler.ListJobs]: crate::client::CloudScheduler::list_jobs
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct ListJobsRequest {
45    /// Required. The location name. For example:
46    /// `projects/PROJECT_ID/locations/LOCATION_ID`.
47    pub parent: std::string::String,
48
49    /// Requested page size.
50    ///
51    /// The maximum page size is 500. If unspecified, the page size will
52    /// be the maximum. Fewer jobs than requested might be returned,
53    /// even if more jobs exist; use next_page_token to determine if more
54    /// jobs exist.
55    pub page_size: i32,
56
57    /// A token identifying a page of results the server will return. To
58    /// request the first page results, page_token must be empty. To
59    /// request the next page of results, page_token must be the value of
60    /// [next_page_token][google.cloud.scheduler.v1.ListJobsResponse.next_page_token]
61    /// returned from the previous call to
62    /// [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
63    ///
64    /// [google.cloud.scheduler.v1.CloudScheduler.ListJobs]: crate::client::CloudScheduler::list_jobs
65    /// [google.cloud.scheduler.v1.ListJobsResponse.next_page_token]: crate::model::ListJobsResponse::next_page_token
66    pub page_token: std::string::String,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl ListJobsRequest {
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
77    ///
78    /// # Example
79    /// ```ignore,no_run
80    /// # use google_cloud_scheduler_v1::model::ListJobsRequest;
81    /// let x = ListJobsRequest::new().set_parent("example");
82    /// ```
83    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.parent = v.into();
85        self
86    }
87
88    /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_scheduler_v1::model::ListJobsRequest;
93    /// let x = ListJobsRequest::new().set_page_size(42);
94    /// ```
95    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
96        self.page_size = v.into();
97        self
98    }
99
100    /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
101    ///
102    /// # Example
103    /// ```ignore,no_run
104    /// # use google_cloud_scheduler_v1::model::ListJobsRequest;
105    /// let x = ListJobsRequest::new().set_page_token("example");
106    /// ```
107    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
108        self.page_token = v.into();
109        self
110    }
111}
112
113impl wkt::message::Message for ListJobsRequest {
114    fn typename() -> &'static str {
115        "type.googleapis.com/google.cloud.scheduler.v1.ListJobsRequest"
116    }
117}
118
119/// Response message for listing jobs using
120/// [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
121///
122/// [google.cloud.scheduler.v1.CloudScheduler.ListJobs]: crate::client::CloudScheduler::list_jobs
123#[derive(Clone, Default, PartialEq)]
124#[non_exhaustive]
125pub struct ListJobsResponse {
126    /// The list of jobs.
127    pub jobs: std::vec::Vec<crate::model::Job>,
128
129    /// A token to retrieve next page of results. Pass this value in the
130    /// [page_token][google.cloud.scheduler.v1.ListJobsRequest.page_token] field in
131    /// the subsequent call to
132    /// [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs] to retrieve
133    /// the next page of results. If this is empty it indicates that there are no
134    /// more results through which to paginate.
135    ///
136    /// The page token is valid for only 2 hours.
137    ///
138    /// [google.cloud.scheduler.v1.CloudScheduler.ListJobs]: crate::client::CloudScheduler::list_jobs
139    /// [google.cloud.scheduler.v1.ListJobsRequest.page_token]: crate::model::ListJobsRequest::page_token
140    pub next_page_token: std::string::String,
141
142    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
143}
144
145impl ListJobsResponse {
146    pub fn new() -> Self {
147        std::default::Default::default()
148    }
149
150    /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
151    ///
152    /// # Example
153    /// ```ignore,no_run
154    /// # use google_cloud_scheduler_v1::model::ListJobsResponse;
155    /// use google_cloud_scheduler_v1::model::Job;
156    /// let x = ListJobsResponse::new()
157    ///     .set_jobs([
158    ///         Job::default()/* use setters */,
159    ///         Job::default()/* use (different) setters */,
160    ///     ]);
161    /// ```
162    pub fn set_jobs<T, V>(mut self, v: T) -> Self
163    where
164        T: std::iter::IntoIterator<Item = V>,
165        V: std::convert::Into<crate::model::Job>,
166    {
167        use std::iter::Iterator;
168        self.jobs = v.into_iter().map(|i| i.into()).collect();
169        self
170    }
171
172    /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
173    ///
174    /// # Example
175    /// ```ignore,no_run
176    /// # use google_cloud_scheduler_v1::model::ListJobsResponse;
177    /// let x = ListJobsResponse::new().set_next_page_token("example");
178    /// ```
179    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
180        self.next_page_token = v.into();
181        self
182    }
183}
184
185impl wkt::message::Message for ListJobsResponse {
186    fn typename() -> &'static str {
187        "type.googleapis.com/google.cloud.scheduler.v1.ListJobsResponse"
188    }
189}
190
191#[doc(hidden)]
192impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
193    type PageItem = crate::model::Job;
194
195    fn items(self) -> std::vec::Vec<Self::PageItem> {
196        self.jobs
197    }
198
199    fn next_page_token(&self) -> std::string::String {
200        use std::clone::Clone;
201        self.next_page_token.clone()
202    }
203}
204
205/// Request message for
206/// [GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob].
207///
208/// [google.cloud.scheduler.v1.CloudScheduler.GetJob]: crate::client::CloudScheduler::get_job
209#[derive(Clone, Default, PartialEq)]
210#[non_exhaustive]
211pub struct GetJobRequest {
212    /// Required. The job name. For example:
213    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
214    pub name: std::string::String,
215
216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
217}
218
219impl GetJobRequest {
220    pub fn new() -> Self {
221        std::default::Default::default()
222    }
223
224    /// Sets the value of [name][crate::model::GetJobRequest::name].
225    ///
226    /// # Example
227    /// ```ignore,no_run
228    /// # use google_cloud_scheduler_v1::model::GetJobRequest;
229    /// let x = GetJobRequest::new().set_name("example");
230    /// ```
231    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
232        self.name = v.into();
233        self
234    }
235}
236
237impl wkt::message::Message for GetJobRequest {
238    fn typename() -> &'static str {
239        "type.googleapis.com/google.cloud.scheduler.v1.GetJobRequest"
240    }
241}
242
243/// Request message for
244/// [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob].
245///
246/// [google.cloud.scheduler.v1.CloudScheduler.CreateJob]: crate::client::CloudScheduler::create_job
247#[derive(Clone, Default, PartialEq)]
248#[non_exhaustive]
249pub struct CreateJobRequest {
250    /// Required. The location name. For example:
251    /// `projects/PROJECT_ID/locations/LOCATION_ID`.
252    pub parent: std::string::String,
253
254    /// Required. The job to add. The user can optionally specify a name for the
255    /// job in [name][google.cloud.scheduler.v1.Job.name].
256    /// [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an
257    /// existing job. If a name is not specified then the system will
258    /// generate a random unique name that will be returned
259    /// ([name][google.cloud.scheduler.v1.Job.name]) in the response.
260    ///
261    /// [google.cloud.scheduler.v1.Job.name]: crate::model::Job::name
262    pub job: std::option::Option<crate::model::Job>,
263
264    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
265}
266
267impl CreateJobRequest {
268    pub fn new() -> Self {
269        std::default::Default::default()
270    }
271
272    /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
273    ///
274    /// # Example
275    /// ```ignore,no_run
276    /// # use google_cloud_scheduler_v1::model::CreateJobRequest;
277    /// let x = CreateJobRequest::new().set_parent("example");
278    /// ```
279    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
280        self.parent = v.into();
281        self
282    }
283
284    /// Sets the value of [job][crate::model::CreateJobRequest::job].
285    ///
286    /// # Example
287    /// ```ignore,no_run
288    /// # use google_cloud_scheduler_v1::model::CreateJobRequest;
289    /// use google_cloud_scheduler_v1::model::Job;
290    /// let x = CreateJobRequest::new().set_job(Job::default()/* use setters */);
291    /// ```
292    pub fn set_job<T>(mut self, v: T) -> Self
293    where
294        T: std::convert::Into<crate::model::Job>,
295    {
296        self.job = std::option::Option::Some(v.into());
297        self
298    }
299
300    /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
301    ///
302    /// # Example
303    /// ```ignore,no_run
304    /// # use google_cloud_scheduler_v1::model::CreateJobRequest;
305    /// use google_cloud_scheduler_v1::model::Job;
306    /// let x = CreateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
307    /// let x = CreateJobRequest::new().set_or_clear_job(None::<Job>);
308    /// ```
309    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
310    where
311        T: std::convert::Into<crate::model::Job>,
312    {
313        self.job = v.map(|x| x.into());
314        self
315    }
316}
317
318impl wkt::message::Message for CreateJobRequest {
319    fn typename() -> &'static str {
320        "type.googleapis.com/google.cloud.scheduler.v1.CreateJobRequest"
321    }
322}
323
324/// Request message for
325/// [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
326///
327/// [google.cloud.scheduler.v1.CloudScheduler.UpdateJob]: crate::client::CloudScheduler::update_job
328#[derive(Clone, Default, PartialEq)]
329#[non_exhaustive]
330pub struct UpdateJobRequest {
331    /// Required. The new job properties.
332    /// [name][google.cloud.scheduler.v1.Job.name] must be specified.
333    ///
334    /// Output only fields cannot be modified using UpdateJob.
335    /// Any value specified for an output only field will be ignored.
336    ///
337    /// [google.cloud.scheduler.v1.Job.name]: crate::model::Job::name
338    pub job: std::option::Option<crate::model::Job>,
339
340    /// A  mask used to specify which fields of the job are being updated.
341    pub update_mask: std::option::Option<wkt::FieldMask>,
342
343    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
344}
345
346impl UpdateJobRequest {
347    pub fn new() -> Self {
348        std::default::Default::default()
349    }
350
351    /// Sets the value of [job][crate::model::UpdateJobRequest::job].
352    ///
353    /// # Example
354    /// ```ignore,no_run
355    /// # use google_cloud_scheduler_v1::model::UpdateJobRequest;
356    /// use google_cloud_scheduler_v1::model::Job;
357    /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
358    /// ```
359    pub fn set_job<T>(mut self, v: T) -> Self
360    where
361        T: std::convert::Into<crate::model::Job>,
362    {
363        self.job = std::option::Option::Some(v.into());
364        self
365    }
366
367    /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
368    ///
369    /// # Example
370    /// ```ignore,no_run
371    /// # use google_cloud_scheduler_v1::model::UpdateJobRequest;
372    /// use google_cloud_scheduler_v1::model::Job;
373    /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
374    /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
375    /// ```
376    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
377    where
378        T: std::convert::Into<crate::model::Job>,
379    {
380        self.job = v.map(|x| x.into());
381        self
382    }
383
384    /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
385    ///
386    /// # Example
387    /// ```ignore,no_run
388    /// # use google_cloud_scheduler_v1::model::UpdateJobRequest;
389    /// use wkt::FieldMask;
390    /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
391    /// ```
392    pub fn set_update_mask<T>(mut self, v: T) -> Self
393    where
394        T: std::convert::Into<wkt::FieldMask>,
395    {
396        self.update_mask = std::option::Option::Some(v.into());
397        self
398    }
399
400    /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
401    ///
402    /// # Example
403    /// ```ignore,no_run
404    /// # use google_cloud_scheduler_v1::model::UpdateJobRequest;
405    /// use wkt::FieldMask;
406    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
407    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
408    /// ```
409    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
410    where
411        T: std::convert::Into<wkt::FieldMask>,
412    {
413        self.update_mask = v.map(|x| x.into());
414        self
415    }
416}
417
418impl wkt::message::Message for UpdateJobRequest {
419    fn typename() -> &'static str {
420        "type.googleapis.com/google.cloud.scheduler.v1.UpdateJobRequest"
421    }
422}
423
424/// Request message for deleting a job using
425/// [DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob].
426///
427/// [google.cloud.scheduler.v1.CloudScheduler.DeleteJob]: crate::client::CloudScheduler::delete_job
428#[derive(Clone, Default, PartialEq)]
429#[non_exhaustive]
430pub struct DeleteJobRequest {
431    /// Required. The job name. For example:
432    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
433    pub name: std::string::String,
434
435    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
436}
437
438impl DeleteJobRequest {
439    pub fn new() -> Self {
440        std::default::Default::default()
441    }
442
443    /// Sets the value of [name][crate::model::DeleteJobRequest::name].
444    ///
445    /// # Example
446    /// ```ignore,no_run
447    /// # use google_cloud_scheduler_v1::model::DeleteJobRequest;
448    /// let x = DeleteJobRequest::new().set_name("example");
449    /// ```
450    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
451        self.name = v.into();
452        self
453    }
454}
455
456impl wkt::message::Message for DeleteJobRequest {
457    fn typename() -> &'static str {
458        "type.googleapis.com/google.cloud.scheduler.v1.DeleteJobRequest"
459    }
460}
461
462/// Request message for
463/// [PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob].
464///
465/// [google.cloud.scheduler.v1.CloudScheduler.PauseJob]: crate::client::CloudScheduler::pause_job
466#[derive(Clone, Default, PartialEq)]
467#[non_exhaustive]
468pub struct PauseJobRequest {
469    /// Required. The job name. For example:
470    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
471    pub name: std::string::String,
472
473    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
474}
475
476impl PauseJobRequest {
477    pub fn new() -> Self {
478        std::default::Default::default()
479    }
480
481    /// Sets the value of [name][crate::model::PauseJobRequest::name].
482    ///
483    /// # Example
484    /// ```ignore,no_run
485    /// # use google_cloud_scheduler_v1::model::PauseJobRequest;
486    /// let x = PauseJobRequest::new().set_name("example");
487    /// ```
488    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
489        self.name = v.into();
490        self
491    }
492}
493
494impl wkt::message::Message for PauseJobRequest {
495    fn typename() -> &'static str {
496        "type.googleapis.com/google.cloud.scheduler.v1.PauseJobRequest"
497    }
498}
499
500/// Request message for
501/// [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob].
502///
503/// [google.cloud.scheduler.v1.CloudScheduler.ResumeJob]: crate::client::CloudScheduler::resume_job
504#[derive(Clone, Default, PartialEq)]
505#[non_exhaustive]
506pub struct ResumeJobRequest {
507    /// Required. The job name. For example:
508    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
509    pub name: std::string::String,
510
511    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
512}
513
514impl ResumeJobRequest {
515    pub fn new() -> Self {
516        std::default::Default::default()
517    }
518
519    /// Sets the value of [name][crate::model::ResumeJobRequest::name].
520    ///
521    /// # Example
522    /// ```ignore,no_run
523    /// # use google_cloud_scheduler_v1::model::ResumeJobRequest;
524    /// let x = ResumeJobRequest::new().set_name("example");
525    /// ```
526    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
527        self.name = v.into();
528        self
529    }
530}
531
532impl wkt::message::Message for ResumeJobRequest {
533    fn typename() -> &'static str {
534        "type.googleapis.com/google.cloud.scheduler.v1.ResumeJobRequest"
535    }
536}
537
538/// Request message for forcing a job to run now using
539/// [RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob].
540///
541/// [google.cloud.scheduler.v1.CloudScheduler.RunJob]: crate::client::CloudScheduler::run_job
542#[derive(Clone, Default, PartialEq)]
543#[non_exhaustive]
544pub struct RunJobRequest {
545    /// Required. The job name. For example:
546    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
547    pub name: std::string::String,
548
549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
550}
551
552impl RunJobRequest {
553    pub fn new() -> Self {
554        std::default::Default::default()
555    }
556
557    /// Sets the value of [name][crate::model::RunJobRequest::name].
558    ///
559    /// # Example
560    /// ```ignore,no_run
561    /// # use google_cloud_scheduler_v1::model::RunJobRequest;
562    /// let x = RunJobRequest::new().set_name("example");
563    /// ```
564    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
565        self.name = v.into();
566        self
567    }
568}
569
570impl wkt::message::Message for RunJobRequest {
571    fn typename() -> &'static str {
572        "type.googleapis.com/google.cloud.scheduler.v1.RunJobRequest"
573    }
574}
575
576/// Configuration for a job.
577/// The maximum allowed size for a job is 1MB.
578#[derive(Clone, Default, PartialEq)]
579#[non_exhaustive]
580pub struct Job {
581    /// Optionally caller-specified in
582    /// [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob], after
583    /// which it becomes output only.
584    ///
585    /// The job name. For example:
586    /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
587    ///
588    /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
589    ///   hyphens (-), colons (:), or periods (.).
590    ///   For more information, see
591    ///   [Identifying
592    ///   projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
593    /// * `LOCATION_ID` is the canonical ID for the job's location.
594    ///   The list of available locations can be obtained by calling
595    ///   [ListLocations][google.cloud.location.Locations.ListLocations].
596    ///   For more information, see <https://cloud.google.com/about/locations/>.
597    /// * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
598    ///   hyphens (-), or underscores (_). The maximum length is 500 characters.
599    ///
600    /// [google.cloud.scheduler.v1.CloudScheduler.CreateJob]: crate::client::CloudScheduler::create_job
601    pub name: std::string::String,
602
603    /// Optionally caller-specified in
604    /// [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob] or
605    /// [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
606    ///
607    /// A human-readable description for the job. This string must not contain
608    /// more than 500 characters.
609    ///
610    /// [google.cloud.scheduler.v1.CloudScheduler.CreateJob]: crate::client::CloudScheduler::create_job
611    /// [google.cloud.scheduler.v1.CloudScheduler.UpdateJob]: crate::client::CloudScheduler::update_job
612    pub description: std::string::String,
613
614    /// Required, except when used with
615    /// [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
616    ///
617    /// Describes the schedule on which the job will be executed.
618    ///
619    /// The schedule can be either of the following types:
620    ///
621    /// * [Crontab](https://en.wikipedia.org/wiki/Cron#Overview)
622    /// * English-like
623    ///   [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules)
624    ///
625    /// As a general rule, execution `n + 1` of a job will not begin
626    /// until execution `n` has finished. Cloud Scheduler will never
627    /// allow two simultaneously outstanding executions. For example,
628    /// this implies that if the `n+1`th execution is scheduled to run at
629    /// 16:00 but the `n`th execution takes until 16:15, the `n+1`th
630    /// execution will not start until `16:15`.
631    /// A scheduled start time will be delayed if the previous
632    /// execution has not ended when its scheduled time occurs.
633    ///
634    /// If [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] > 0 and
635    /// a job attempt fails, the job will be tried a total of
636    /// [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times,
637    /// with exponential backoff, until the next scheduled start time. If
638    /// retry_count is 0, a job attempt will not be retried if it fails. Instead
639    /// the Cloud Scheduler system will wait for the next scheduled execution time.
640    /// Setting retry_count to 0 does not prevent failed jobs from running
641    /// according to schedule after the failure.
642    ///
643    /// [google.cloud.scheduler.v1.CloudScheduler.UpdateJob]: crate::client::CloudScheduler::update_job
644    /// [google.cloud.scheduler.v1.RetryConfig.retry_count]: crate::model::RetryConfig::retry_count
645    pub schedule: std::string::String,
646
647    /// Specifies the time zone to be used in interpreting
648    /// [schedule][google.cloud.scheduler.v1.Job.schedule]. The value of this field
649    /// must be a time zone name from the [tz
650    /// database](http://en.wikipedia.org/wiki/Tz_database).
651    ///
652    /// Note that some time zones include a provision for
653    /// daylight savings time. The rules for daylight saving time are
654    /// determined by the chosen tz. For UTC use the string "utc". If a
655    /// time zone is not specified, the default will be in UTC (also known
656    /// as GMT).
657    ///
658    /// [google.cloud.scheduler.v1.Job.schedule]: crate::model::Job::schedule
659    pub time_zone: std::string::String,
660
661    /// Output only. The creation time of the job.
662    pub user_update_time: std::option::Option<wkt::Timestamp>,
663
664    /// Output only. State of the job.
665    pub state: crate::model::job::State,
666
667    /// Output only. The response from the target for the last attempted execution.
668    pub status: std::option::Option<google_cloud_rpc::model::Status>,
669
670    /// Output only. The next time the job is scheduled. Note that this may be a
671    /// retry of a previously failed attempt or the next execution time
672    /// according to the schedule.
673    pub schedule_time: std::option::Option<wkt::Timestamp>,
674
675    /// Output only. The time the last job attempt started.
676    pub last_attempt_time: std::option::Option<wkt::Timestamp>,
677
678    /// Settings that determine the retry behavior.
679    pub retry_config: std::option::Option<crate::model::RetryConfig>,
680
681    /// The deadline for job attempts. If the request handler does not respond by
682    /// this deadline then the request is cancelled and the attempt is marked as a
683    /// `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in
684    /// execution logs. Cloud Scheduler will retry the job according
685    /// to the [RetryConfig][google.cloud.scheduler.v1.RetryConfig].
686    ///
687    /// The default and the allowed values depend on the type of target:
688    ///
689    /// * For [HTTP targets][google.cloud.scheduler.v1.Job.http_target], the
690    ///   default is 3 minutes. The deadline must be in the interval [15 seconds, 30
691    ///   minutes].
692    ///
693    /// * For [App Engine HTTP
694    ///   targets][google.cloud.scheduler.v1.Job.app_engine_http_target], 0 indicates
695    ///   that the request has the default deadline. The default deadline depends on
696    ///   the scaling type of the service: 10 minutes for standard apps with
697    ///   automatic scaling, 24 hours for standard apps with manual and basic
698    ///   scaling, and 60 minutes for flex apps. If the request deadline is set, it
699    ///   must be in the interval [15 seconds, 24 hours 15 seconds].
700    ///
701    /// * For [Pub/Sub targets][google.cloud.scheduler.v1.Job.pubsub_target], this
702    ///   field is ignored.
703    ///
704    ///
705    /// [google.cloud.scheduler.v1.Job.app_engine_http_target]: crate::model::Job::target
706    /// [google.cloud.scheduler.v1.Job.http_target]: crate::model::Job::target
707    /// [google.cloud.scheduler.v1.Job.pubsub_target]: crate::model::Job::target
708    /// [google.cloud.scheduler.v1.RetryConfig]: crate::model::RetryConfig
709    pub attempt_deadline: std::option::Option<wkt::Duration>,
710
711    /// Required.
712    ///
713    /// Delivery settings containing destination and parameters.
714    pub target: std::option::Option<crate::model::job::Target>,
715
716    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
717}
718
719impl Job {
720    pub fn new() -> Self {
721        std::default::Default::default()
722    }
723
724    /// Sets the value of [name][crate::model::Job::name].
725    ///
726    /// # Example
727    /// ```ignore,no_run
728    /// # use google_cloud_scheduler_v1::model::Job;
729    /// let x = Job::new().set_name("example");
730    /// ```
731    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
732        self.name = v.into();
733        self
734    }
735
736    /// Sets the value of [description][crate::model::Job::description].
737    ///
738    /// # Example
739    /// ```ignore,no_run
740    /// # use google_cloud_scheduler_v1::model::Job;
741    /// let x = Job::new().set_description("example");
742    /// ```
743    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
744        self.description = v.into();
745        self
746    }
747
748    /// Sets the value of [schedule][crate::model::Job::schedule].
749    ///
750    /// # Example
751    /// ```ignore,no_run
752    /// # use google_cloud_scheduler_v1::model::Job;
753    /// let x = Job::new().set_schedule("example");
754    /// ```
755    pub fn set_schedule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
756        self.schedule = v.into();
757        self
758    }
759
760    /// Sets the value of [time_zone][crate::model::Job::time_zone].
761    ///
762    /// # Example
763    /// ```ignore,no_run
764    /// # use google_cloud_scheduler_v1::model::Job;
765    /// let x = Job::new().set_time_zone("example");
766    /// ```
767    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
768        self.time_zone = v.into();
769        self
770    }
771
772    /// Sets the value of [user_update_time][crate::model::Job::user_update_time].
773    ///
774    /// # Example
775    /// ```ignore,no_run
776    /// # use google_cloud_scheduler_v1::model::Job;
777    /// use wkt::Timestamp;
778    /// let x = Job::new().set_user_update_time(Timestamp::default()/* use setters */);
779    /// ```
780    pub fn set_user_update_time<T>(mut self, v: T) -> Self
781    where
782        T: std::convert::Into<wkt::Timestamp>,
783    {
784        self.user_update_time = std::option::Option::Some(v.into());
785        self
786    }
787
788    /// Sets or clears the value of [user_update_time][crate::model::Job::user_update_time].
789    ///
790    /// # Example
791    /// ```ignore,no_run
792    /// # use google_cloud_scheduler_v1::model::Job;
793    /// use wkt::Timestamp;
794    /// let x = Job::new().set_or_clear_user_update_time(Some(Timestamp::default()/* use setters */));
795    /// let x = Job::new().set_or_clear_user_update_time(None::<Timestamp>);
796    /// ```
797    pub fn set_or_clear_user_update_time<T>(mut self, v: std::option::Option<T>) -> Self
798    where
799        T: std::convert::Into<wkt::Timestamp>,
800    {
801        self.user_update_time = v.map(|x| x.into());
802        self
803    }
804
805    /// Sets the value of [state][crate::model::Job::state].
806    ///
807    /// # Example
808    /// ```ignore,no_run
809    /// # use google_cloud_scheduler_v1::model::Job;
810    /// use google_cloud_scheduler_v1::model::job::State;
811    /// let x0 = Job::new().set_state(State::Enabled);
812    /// let x1 = Job::new().set_state(State::Paused);
813    /// let x2 = Job::new().set_state(State::Disabled);
814    /// ```
815    pub fn set_state<T: std::convert::Into<crate::model::job::State>>(mut self, v: T) -> Self {
816        self.state = v.into();
817        self
818    }
819
820    /// Sets the value of [status][crate::model::Job::status].
821    ///
822    /// # Example
823    /// ```ignore,no_run
824    /// # use google_cloud_scheduler_v1::model::Job;
825    /// use google_cloud_rpc::model::Status;
826    /// let x = Job::new().set_status(Status::default()/* use setters */);
827    /// ```
828    pub fn set_status<T>(mut self, v: T) -> Self
829    where
830        T: std::convert::Into<google_cloud_rpc::model::Status>,
831    {
832        self.status = std::option::Option::Some(v.into());
833        self
834    }
835
836    /// Sets or clears the value of [status][crate::model::Job::status].
837    ///
838    /// # Example
839    /// ```ignore,no_run
840    /// # use google_cloud_scheduler_v1::model::Job;
841    /// use google_cloud_rpc::model::Status;
842    /// let x = Job::new().set_or_clear_status(Some(Status::default()/* use setters */));
843    /// let x = Job::new().set_or_clear_status(None::<Status>);
844    /// ```
845    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
846    where
847        T: std::convert::Into<google_cloud_rpc::model::Status>,
848    {
849        self.status = v.map(|x| x.into());
850        self
851    }
852
853    /// Sets the value of [schedule_time][crate::model::Job::schedule_time].
854    ///
855    /// # Example
856    /// ```ignore,no_run
857    /// # use google_cloud_scheduler_v1::model::Job;
858    /// use wkt::Timestamp;
859    /// let x = Job::new().set_schedule_time(Timestamp::default()/* use setters */);
860    /// ```
861    pub fn set_schedule_time<T>(mut self, v: T) -> Self
862    where
863        T: std::convert::Into<wkt::Timestamp>,
864    {
865        self.schedule_time = std::option::Option::Some(v.into());
866        self
867    }
868
869    /// Sets or clears the value of [schedule_time][crate::model::Job::schedule_time].
870    ///
871    /// # Example
872    /// ```ignore,no_run
873    /// # use google_cloud_scheduler_v1::model::Job;
874    /// use wkt::Timestamp;
875    /// let x = Job::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
876    /// let x = Job::new().set_or_clear_schedule_time(None::<Timestamp>);
877    /// ```
878    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
879    where
880        T: std::convert::Into<wkt::Timestamp>,
881    {
882        self.schedule_time = v.map(|x| x.into());
883        self
884    }
885
886    /// Sets the value of [last_attempt_time][crate::model::Job::last_attempt_time].
887    ///
888    /// # Example
889    /// ```ignore,no_run
890    /// # use google_cloud_scheduler_v1::model::Job;
891    /// use wkt::Timestamp;
892    /// let x = Job::new().set_last_attempt_time(Timestamp::default()/* use setters */);
893    /// ```
894    pub fn set_last_attempt_time<T>(mut self, v: T) -> Self
895    where
896        T: std::convert::Into<wkt::Timestamp>,
897    {
898        self.last_attempt_time = std::option::Option::Some(v.into());
899        self
900    }
901
902    /// Sets or clears the value of [last_attempt_time][crate::model::Job::last_attempt_time].
903    ///
904    /// # Example
905    /// ```ignore,no_run
906    /// # use google_cloud_scheduler_v1::model::Job;
907    /// use wkt::Timestamp;
908    /// let x = Job::new().set_or_clear_last_attempt_time(Some(Timestamp::default()/* use setters */));
909    /// let x = Job::new().set_or_clear_last_attempt_time(None::<Timestamp>);
910    /// ```
911    pub fn set_or_clear_last_attempt_time<T>(mut self, v: std::option::Option<T>) -> Self
912    where
913        T: std::convert::Into<wkt::Timestamp>,
914    {
915        self.last_attempt_time = v.map(|x| x.into());
916        self
917    }
918
919    /// Sets the value of [retry_config][crate::model::Job::retry_config].
920    ///
921    /// # Example
922    /// ```ignore,no_run
923    /// # use google_cloud_scheduler_v1::model::Job;
924    /// use google_cloud_scheduler_v1::model::RetryConfig;
925    /// let x = Job::new().set_retry_config(RetryConfig::default()/* use setters */);
926    /// ```
927    pub fn set_retry_config<T>(mut self, v: T) -> Self
928    where
929        T: std::convert::Into<crate::model::RetryConfig>,
930    {
931        self.retry_config = std::option::Option::Some(v.into());
932        self
933    }
934
935    /// Sets or clears the value of [retry_config][crate::model::Job::retry_config].
936    ///
937    /// # Example
938    /// ```ignore,no_run
939    /// # use google_cloud_scheduler_v1::model::Job;
940    /// use google_cloud_scheduler_v1::model::RetryConfig;
941    /// let x = Job::new().set_or_clear_retry_config(Some(RetryConfig::default()/* use setters */));
942    /// let x = Job::new().set_or_clear_retry_config(None::<RetryConfig>);
943    /// ```
944    pub fn set_or_clear_retry_config<T>(mut self, v: std::option::Option<T>) -> Self
945    where
946        T: std::convert::Into<crate::model::RetryConfig>,
947    {
948        self.retry_config = v.map(|x| x.into());
949        self
950    }
951
952    /// Sets the value of [attempt_deadline][crate::model::Job::attempt_deadline].
953    ///
954    /// # Example
955    /// ```ignore,no_run
956    /// # use google_cloud_scheduler_v1::model::Job;
957    /// use wkt::Duration;
958    /// let x = Job::new().set_attempt_deadline(Duration::default()/* use setters */);
959    /// ```
960    pub fn set_attempt_deadline<T>(mut self, v: T) -> Self
961    where
962        T: std::convert::Into<wkt::Duration>,
963    {
964        self.attempt_deadline = std::option::Option::Some(v.into());
965        self
966    }
967
968    /// Sets or clears the value of [attempt_deadline][crate::model::Job::attempt_deadline].
969    ///
970    /// # Example
971    /// ```ignore,no_run
972    /// # use google_cloud_scheduler_v1::model::Job;
973    /// use wkt::Duration;
974    /// let x = Job::new().set_or_clear_attempt_deadline(Some(Duration::default()/* use setters */));
975    /// let x = Job::new().set_or_clear_attempt_deadline(None::<Duration>);
976    /// ```
977    pub fn set_or_clear_attempt_deadline<T>(mut self, v: std::option::Option<T>) -> Self
978    where
979        T: std::convert::Into<wkt::Duration>,
980    {
981        self.attempt_deadline = v.map(|x| x.into());
982        self
983    }
984
985    /// Sets the value of [target][crate::model::Job::target].
986    ///
987    /// Note that all the setters affecting `target` are mutually
988    /// exclusive.
989    ///
990    /// # Example
991    /// ```ignore,no_run
992    /// # use google_cloud_scheduler_v1::model::Job;
993    /// use google_cloud_scheduler_v1::model::PubsubTarget;
994    /// let x = Job::new().set_target(Some(
995    ///     google_cloud_scheduler_v1::model::job::Target::PubsubTarget(PubsubTarget::default().into())));
996    /// ```
997    pub fn set_target<T: std::convert::Into<std::option::Option<crate::model::job::Target>>>(
998        mut self,
999        v: T,
1000    ) -> Self {
1001        self.target = v.into();
1002        self
1003    }
1004
1005    /// The value of [target][crate::model::Job::target]
1006    /// if it holds a `PubsubTarget`, `None` if the field is not set or
1007    /// holds a different branch.
1008    pub fn pubsub_target(
1009        &self,
1010    ) -> std::option::Option<&std::boxed::Box<crate::model::PubsubTarget>> {
1011        #[allow(unreachable_patterns)]
1012        self.target.as_ref().and_then(|v| match v {
1013            crate::model::job::Target::PubsubTarget(v) => std::option::Option::Some(v),
1014            _ => std::option::Option::None,
1015        })
1016    }
1017
1018    /// Sets the value of [target][crate::model::Job::target]
1019    /// to hold a `PubsubTarget`.
1020    ///
1021    /// Note that all the setters affecting `target` are
1022    /// mutually exclusive.
1023    ///
1024    /// # Example
1025    /// ```ignore,no_run
1026    /// # use google_cloud_scheduler_v1::model::Job;
1027    /// use google_cloud_scheduler_v1::model::PubsubTarget;
1028    /// let x = Job::new().set_pubsub_target(PubsubTarget::default()/* use setters */);
1029    /// assert!(x.pubsub_target().is_some());
1030    /// assert!(x.app_engine_http_target().is_none());
1031    /// assert!(x.http_target().is_none());
1032    /// ```
1033    pub fn set_pubsub_target<T: std::convert::Into<std::boxed::Box<crate::model::PubsubTarget>>>(
1034        mut self,
1035        v: T,
1036    ) -> Self {
1037        self.target = std::option::Option::Some(crate::model::job::Target::PubsubTarget(v.into()));
1038        self
1039    }
1040
1041    /// The value of [target][crate::model::Job::target]
1042    /// if it holds a `AppEngineHttpTarget`, `None` if the field is not set or
1043    /// holds a different branch.
1044    pub fn app_engine_http_target(
1045        &self,
1046    ) -> std::option::Option<&std::boxed::Box<crate::model::AppEngineHttpTarget>> {
1047        #[allow(unreachable_patterns)]
1048        self.target.as_ref().and_then(|v| match v {
1049            crate::model::job::Target::AppEngineHttpTarget(v) => std::option::Option::Some(v),
1050            _ => std::option::Option::None,
1051        })
1052    }
1053
1054    /// Sets the value of [target][crate::model::Job::target]
1055    /// to hold a `AppEngineHttpTarget`.
1056    ///
1057    /// Note that all the setters affecting `target` are
1058    /// mutually exclusive.
1059    ///
1060    /// # Example
1061    /// ```ignore,no_run
1062    /// # use google_cloud_scheduler_v1::model::Job;
1063    /// use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1064    /// let x = Job::new().set_app_engine_http_target(AppEngineHttpTarget::default()/* use setters */);
1065    /// assert!(x.app_engine_http_target().is_some());
1066    /// assert!(x.pubsub_target().is_none());
1067    /// assert!(x.http_target().is_none());
1068    /// ```
1069    pub fn set_app_engine_http_target<
1070        T: std::convert::Into<std::boxed::Box<crate::model::AppEngineHttpTarget>>,
1071    >(
1072        mut self,
1073        v: T,
1074    ) -> Self {
1075        self.target =
1076            std::option::Option::Some(crate::model::job::Target::AppEngineHttpTarget(v.into()));
1077        self
1078    }
1079
1080    /// The value of [target][crate::model::Job::target]
1081    /// if it holds a `HttpTarget`, `None` if the field is not set or
1082    /// holds a different branch.
1083    pub fn http_target(&self) -> std::option::Option<&std::boxed::Box<crate::model::HttpTarget>> {
1084        #[allow(unreachable_patterns)]
1085        self.target.as_ref().and_then(|v| match v {
1086            crate::model::job::Target::HttpTarget(v) => std::option::Option::Some(v),
1087            _ => std::option::Option::None,
1088        })
1089    }
1090
1091    /// Sets the value of [target][crate::model::Job::target]
1092    /// to hold a `HttpTarget`.
1093    ///
1094    /// Note that all the setters affecting `target` are
1095    /// mutually exclusive.
1096    ///
1097    /// # Example
1098    /// ```ignore,no_run
1099    /// # use google_cloud_scheduler_v1::model::Job;
1100    /// use google_cloud_scheduler_v1::model::HttpTarget;
1101    /// let x = Job::new().set_http_target(HttpTarget::default()/* use setters */);
1102    /// assert!(x.http_target().is_some());
1103    /// assert!(x.pubsub_target().is_none());
1104    /// assert!(x.app_engine_http_target().is_none());
1105    /// ```
1106    pub fn set_http_target<T: std::convert::Into<std::boxed::Box<crate::model::HttpTarget>>>(
1107        mut self,
1108        v: T,
1109    ) -> Self {
1110        self.target = std::option::Option::Some(crate::model::job::Target::HttpTarget(v.into()));
1111        self
1112    }
1113}
1114
1115impl wkt::message::Message for Job {
1116    fn typename() -> &'static str {
1117        "type.googleapis.com/google.cloud.scheduler.v1.Job"
1118    }
1119}
1120
1121/// Defines additional types related to [Job].
1122pub mod job {
1123    #[allow(unused_imports)]
1124    use super::*;
1125
1126    /// State of the job.
1127    ///
1128    /// # Working with unknown values
1129    ///
1130    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1131    /// additional enum variants at any time. Adding new variants is not considered
1132    /// a breaking change. Applications should write their code in anticipation of:
1133    ///
1134    /// - New values appearing in future releases of the client library, **and**
1135    /// - New values received dynamically, without application changes.
1136    ///
1137    /// Please consult the [Working with enums] section in the user guide for some
1138    /// guidelines.
1139    ///
1140    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1141    #[derive(Clone, Debug, PartialEq)]
1142    #[non_exhaustive]
1143    pub enum State {
1144        /// Unspecified state.
1145        Unspecified,
1146        /// The job is executing normally.
1147        Enabled,
1148        /// The job is paused by the user. It will not execute. A user can
1149        /// intentionally pause the job using
1150        /// [PauseJobRequest][google.cloud.scheduler.v1.PauseJobRequest].
1151        ///
1152        /// [google.cloud.scheduler.v1.PauseJobRequest]: crate::model::PauseJobRequest
1153        Paused,
1154        /// The job is disabled by the system due to error. The user
1155        /// cannot directly set a job to be disabled.
1156        Disabled,
1157        /// The job state resulting from a failed
1158        /// [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]
1159        /// operation. To recover a job from this state, retry
1160        /// [CloudScheduler.UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob]
1161        /// until a successful response is received.
1162        ///
1163        /// [google.cloud.scheduler.v1.CloudScheduler.UpdateJob]: crate::client::CloudScheduler::update_job
1164        UpdateFailed,
1165        /// If set, the enum was initialized with an unknown value.
1166        ///
1167        /// Applications can examine the value using [State::value] or
1168        /// [State::name].
1169        UnknownValue(state::UnknownValue),
1170    }
1171
1172    #[doc(hidden)]
1173    pub mod state {
1174        #[allow(unused_imports)]
1175        use super::*;
1176        #[derive(Clone, Debug, PartialEq)]
1177        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1178    }
1179
1180    impl State {
1181        /// Gets the enum value.
1182        ///
1183        /// Returns `None` if the enum contains an unknown value deserialized from
1184        /// the string representation of enums.
1185        pub fn value(&self) -> std::option::Option<i32> {
1186            match self {
1187                Self::Unspecified => std::option::Option::Some(0),
1188                Self::Enabled => std::option::Option::Some(1),
1189                Self::Paused => std::option::Option::Some(2),
1190                Self::Disabled => std::option::Option::Some(3),
1191                Self::UpdateFailed => std::option::Option::Some(4),
1192                Self::UnknownValue(u) => u.0.value(),
1193            }
1194        }
1195
1196        /// Gets the enum value as a string.
1197        ///
1198        /// Returns `None` if the enum contains an unknown value deserialized from
1199        /// the integer representation of enums.
1200        pub fn name(&self) -> std::option::Option<&str> {
1201            match self {
1202                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1203                Self::Enabled => std::option::Option::Some("ENABLED"),
1204                Self::Paused => std::option::Option::Some("PAUSED"),
1205                Self::Disabled => std::option::Option::Some("DISABLED"),
1206                Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
1207                Self::UnknownValue(u) => u.0.name(),
1208            }
1209        }
1210    }
1211
1212    impl std::default::Default for State {
1213        fn default() -> Self {
1214            use std::convert::From;
1215            Self::from(0)
1216        }
1217    }
1218
1219    impl std::fmt::Display for State {
1220        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1221            wkt::internal::display_enum(f, self.name(), self.value())
1222        }
1223    }
1224
1225    impl std::convert::From<i32> for State {
1226        fn from(value: i32) -> Self {
1227            match value {
1228                0 => Self::Unspecified,
1229                1 => Self::Enabled,
1230                2 => Self::Paused,
1231                3 => Self::Disabled,
1232                4 => Self::UpdateFailed,
1233                _ => Self::UnknownValue(state::UnknownValue(
1234                    wkt::internal::UnknownEnumValue::Integer(value),
1235                )),
1236            }
1237        }
1238    }
1239
1240    impl std::convert::From<&str> for State {
1241        fn from(value: &str) -> Self {
1242            use std::string::ToString;
1243            match value {
1244                "STATE_UNSPECIFIED" => Self::Unspecified,
1245                "ENABLED" => Self::Enabled,
1246                "PAUSED" => Self::Paused,
1247                "DISABLED" => Self::Disabled,
1248                "UPDATE_FAILED" => Self::UpdateFailed,
1249                _ => Self::UnknownValue(state::UnknownValue(
1250                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1251                )),
1252            }
1253        }
1254    }
1255
1256    impl serde::ser::Serialize for State {
1257        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1258        where
1259            S: serde::Serializer,
1260        {
1261            match self {
1262                Self::Unspecified => serializer.serialize_i32(0),
1263                Self::Enabled => serializer.serialize_i32(1),
1264                Self::Paused => serializer.serialize_i32(2),
1265                Self::Disabled => serializer.serialize_i32(3),
1266                Self::UpdateFailed => serializer.serialize_i32(4),
1267                Self::UnknownValue(u) => u.0.serialize(serializer),
1268            }
1269        }
1270    }
1271
1272    impl<'de> serde::de::Deserialize<'de> for State {
1273        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1274        where
1275            D: serde::Deserializer<'de>,
1276        {
1277            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1278                ".google.cloud.scheduler.v1.Job.State",
1279            ))
1280        }
1281    }
1282
1283    /// Required.
1284    ///
1285    /// Delivery settings containing destination and parameters.
1286    #[derive(Clone, Debug, PartialEq)]
1287    #[non_exhaustive]
1288    pub enum Target {
1289        /// Pub/Sub target.
1290        PubsubTarget(std::boxed::Box<crate::model::PubsubTarget>),
1291        /// App Engine HTTP target.
1292        AppEngineHttpTarget(std::boxed::Box<crate::model::AppEngineHttpTarget>),
1293        /// HTTP target.
1294        HttpTarget(std::boxed::Box<crate::model::HttpTarget>),
1295    }
1296}
1297
1298/// Settings that determine the retry behavior.
1299///
1300/// By default, if a job does not complete successfully (meaning that
1301/// an acknowledgement is not received from the handler, then it will be retried
1302/// with exponential backoff according to the settings in
1303/// [RetryConfig][google.cloud.scheduler.v1.RetryConfig].
1304///
1305/// [google.cloud.scheduler.v1.RetryConfig]: crate::model::RetryConfig
1306#[derive(Clone, Default, PartialEq)]
1307#[non_exhaustive]
1308pub struct RetryConfig {
1309    /// The number of attempts that the system will make to run a job using the
1310    /// exponential backoff procedure described by
1311    /// [max_doublings][google.cloud.scheduler.v1.RetryConfig.max_doublings].
1312    ///
1313    /// The default value of retry_count is zero.
1314    ///
1315    /// If retry_count is 0, a job attempt will not be retried if
1316    /// it fails. Instead the Cloud Scheduler system will wait for the
1317    /// next scheduled execution time. Setting retry_count to 0 does not prevent
1318    /// failed jobs from running according to schedule after the failure.
1319    ///
1320    /// If retry_count is set to a non-zero number then Cloud Scheduler
1321    /// will retry failed attempts, using exponential backoff,
1322    /// retry_count times, or until the next scheduled execution time,
1323    /// whichever comes first.
1324    ///
1325    /// Values greater than 5 and negative values are not allowed.
1326    ///
1327    /// [google.cloud.scheduler.v1.RetryConfig.max_doublings]: crate::model::RetryConfig::max_doublings
1328    pub retry_count: i32,
1329
1330    /// The time limit for retrying a failed job, measured from time when an
1331    /// execution was first attempted. If specified with
1332    /// [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count], the job
1333    /// will be retried until both limits are reached.
1334    ///
1335    /// The default value for max_retry_duration is zero, which means retry
1336    /// duration is unlimited.
1337    ///
1338    /// [google.cloud.scheduler.v1.RetryConfig.retry_count]: crate::model::RetryConfig::retry_count
1339    pub max_retry_duration: std::option::Option<wkt::Duration>,
1340
1341    /// The minimum amount of time to wait before retrying a job after
1342    /// it fails.
1343    ///
1344    /// The default value of this field is 5 seconds.
1345    pub min_backoff_duration: std::option::Option<wkt::Duration>,
1346
1347    /// The maximum amount of time to wait before retrying a job after
1348    /// it fails.
1349    ///
1350    /// The default value of this field is 1 hour.
1351    pub max_backoff_duration: std::option::Option<wkt::Duration>,
1352
1353    /// The time between retries will double `max_doublings` times.
1354    ///
1355    /// A job's retry interval starts at
1356    /// [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration],
1357    /// then doubles `max_doublings` times, then increases linearly, and finally
1358    /// retries at intervals of
1359    /// [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration]
1360    /// up to [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count]
1361    /// times.
1362    ///
1363    /// For example, if
1364    /// [min_backoff_duration][google.cloud.scheduler.v1.RetryConfig.min_backoff_duration]
1365    /// is 10s,
1366    /// [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration]
1367    /// is 300s, and `max_doublings` is 3, then the job will first be retried in
1368    /// 10s. The retry interval will double three times, and then increase linearly
1369    /// by 2^3 * 10s.  Finally, the job will retry at intervals of
1370    /// [max_backoff_duration][google.cloud.scheduler.v1.RetryConfig.max_backoff_duration]
1371    /// until the job has been attempted
1372    /// [retry_count][google.cloud.scheduler.v1.RetryConfig.retry_count] times.
1373    /// Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s,
1374    /// 300s, ....
1375    ///
1376    /// The default value of this field is 5.
1377    ///
1378    /// [google.cloud.scheduler.v1.RetryConfig.max_backoff_duration]: crate::model::RetryConfig::max_backoff_duration
1379    /// [google.cloud.scheduler.v1.RetryConfig.min_backoff_duration]: crate::model::RetryConfig::min_backoff_duration
1380    /// [google.cloud.scheduler.v1.RetryConfig.retry_count]: crate::model::RetryConfig::retry_count
1381    pub max_doublings: i32,
1382
1383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1384}
1385
1386impl RetryConfig {
1387    pub fn new() -> Self {
1388        std::default::Default::default()
1389    }
1390
1391    /// Sets the value of [retry_count][crate::model::RetryConfig::retry_count].
1392    ///
1393    /// # Example
1394    /// ```ignore,no_run
1395    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1396    /// let x = RetryConfig::new().set_retry_count(42);
1397    /// ```
1398    pub fn set_retry_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1399        self.retry_count = v.into();
1400        self
1401    }
1402
1403    /// Sets the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
1404    ///
1405    /// # Example
1406    /// ```ignore,no_run
1407    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1408    /// use wkt::Duration;
1409    /// let x = RetryConfig::new().set_max_retry_duration(Duration::default()/* use setters */);
1410    /// ```
1411    pub fn set_max_retry_duration<T>(mut self, v: T) -> Self
1412    where
1413        T: std::convert::Into<wkt::Duration>,
1414    {
1415        self.max_retry_duration = std::option::Option::Some(v.into());
1416        self
1417    }
1418
1419    /// Sets or clears the value of [max_retry_duration][crate::model::RetryConfig::max_retry_duration].
1420    ///
1421    /// # Example
1422    /// ```ignore,no_run
1423    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1424    /// use wkt::Duration;
1425    /// let x = RetryConfig::new().set_or_clear_max_retry_duration(Some(Duration::default()/* use setters */));
1426    /// let x = RetryConfig::new().set_or_clear_max_retry_duration(None::<Duration>);
1427    /// ```
1428    pub fn set_or_clear_max_retry_duration<T>(mut self, v: std::option::Option<T>) -> Self
1429    where
1430        T: std::convert::Into<wkt::Duration>,
1431    {
1432        self.max_retry_duration = v.map(|x| x.into());
1433        self
1434    }
1435
1436    /// Sets the value of [min_backoff_duration][crate::model::RetryConfig::min_backoff_duration].
1437    ///
1438    /// # Example
1439    /// ```ignore,no_run
1440    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1441    /// use wkt::Duration;
1442    /// let x = RetryConfig::new().set_min_backoff_duration(Duration::default()/* use setters */);
1443    /// ```
1444    pub fn set_min_backoff_duration<T>(mut self, v: T) -> Self
1445    where
1446        T: std::convert::Into<wkt::Duration>,
1447    {
1448        self.min_backoff_duration = std::option::Option::Some(v.into());
1449        self
1450    }
1451
1452    /// Sets or clears the value of [min_backoff_duration][crate::model::RetryConfig::min_backoff_duration].
1453    ///
1454    /// # Example
1455    /// ```ignore,no_run
1456    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1457    /// use wkt::Duration;
1458    /// let x = RetryConfig::new().set_or_clear_min_backoff_duration(Some(Duration::default()/* use setters */));
1459    /// let x = RetryConfig::new().set_or_clear_min_backoff_duration(None::<Duration>);
1460    /// ```
1461    pub fn set_or_clear_min_backoff_duration<T>(mut self, v: std::option::Option<T>) -> Self
1462    where
1463        T: std::convert::Into<wkt::Duration>,
1464    {
1465        self.min_backoff_duration = v.map(|x| x.into());
1466        self
1467    }
1468
1469    /// Sets the value of [max_backoff_duration][crate::model::RetryConfig::max_backoff_duration].
1470    ///
1471    /// # Example
1472    /// ```ignore,no_run
1473    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1474    /// use wkt::Duration;
1475    /// let x = RetryConfig::new().set_max_backoff_duration(Duration::default()/* use setters */);
1476    /// ```
1477    pub fn set_max_backoff_duration<T>(mut self, v: T) -> Self
1478    where
1479        T: std::convert::Into<wkt::Duration>,
1480    {
1481        self.max_backoff_duration = std::option::Option::Some(v.into());
1482        self
1483    }
1484
1485    /// Sets or clears the value of [max_backoff_duration][crate::model::RetryConfig::max_backoff_duration].
1486    ///
1487    /// # Example
1488    /// ```ignore,no_run
1489    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1490    /// use wkt::Duration;
1491    /// let x = RetryConfig::new().set_or_clear_max_backoff_duration(Some(Duration::default()/* use setters */));
1492    /// let x = RetryConfig::new().set_or_clear_max_backoff_duration(None::<Duration>);
1493    /// ```
1494    pub fn set_or_clear_max_backoff_duration<T>(mut self, v: std::option::Option<T>) -> Self
1495    where
1496        T: std::convert::Into<wkt::Duration>,
1497    {
1498        self.max_backoff_duration = v.map(|x| x.into());
1499        self
1500    }
1501
1502    /// Sets the value of [max_doublings][crate::model::RetryConfig::max_doublings].
1503    ///
1504    /// # Example
1505    /// ```ignore,no_run
1506    /// # use google_cloud_scheduler_v1::model::RetryConfig;
1507    /// let x = RetryConfig::new().set_max_doublings(42);
1508    /// ```
1509    pub fn set_max_doublings<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1510        self.max_doublings = v.into();
1511        self
1512    }
1513}
1514
1515impl wkt::message::Message for RetryConfig {
1516    fn typename() -> &'static str {
1517        "type.googleapis.com/google.cloud.scheduler.v1.RetryConfig"
1518    }
1519}
1520
1521/// Http target. The job will be pushed to the job handler by means of
1522/// an HTTP request via an
1523/// [http_method][google.cloud.scheduler.v1.HttpTarget.http_method] such as HTTP
1524/// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP
1525/// response code in the range [200 - 299]. A failure to receive a response
1526/// constitutes a failed execution. For a redirected request, the response
1527/// returned by the redirected request is considered.
1528///
1529/// [google.cloud.scheduler.v1.HttpTarget.http_method]: crate::model::HttpTarget::http_method
1530#[derive(Clone, Default, PartialEq)]
1531#[non_exhaustive]
1532pub struct HttpTarget {
1533    /// Required. The full URI path that the request will be sent to. This string
1534    /// must begin with either "http://" or "https://". Some examples of
1535    /// valid values for [uri][google.cloud.scheduler.v1.HttpTarget.uri] are:
1536    /// `<http://acme.com>` and `<https://acme.com/sales:8080>`. Cloud Scheduler will
1537    /// encode some characters for safety and compatibility. The maximum allowed
1538    /// URL length is 2083 characters after encoding.
1539    ///
1540    /// [google.cloud.scheduler.v1.HttpTarget.uri]: crate::model::HttpTarget::uri
1541    pub uri: std::string::String,
1542
1543    /// Which HTTP method to use for the request.
1544    pub http_method: crate::model::HttpMethod,
1545
1546    /// HTTP request headers.
1547    ///
1548    /// This map contains the header field names and values.
1549    ///
1550    /// The user can specify HTTP request headers to send with the job's
1551    /// HTTP request. Repeated headers are not supported, but a header value can
1552    /// contain commas.
1553    ///
1554    /// The following headers represent a subset of the headers
1555    /// that accompany the job's HTTP request. Some HTTP request
1556    /// headers are ignored or replaced. A partial list of headers that
1557    /// are ignored or replaced is below:
1558    ///
1559    /// * Host: This will be computed by Cloud Scheduler and derived from
1560    ///   [uri][google.cloud.scheduler.v1.HttpTarget.uri].
1561    /// * `Content-Length`: This will be computed by Cloud Scheduler.
1562    /// * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`.
1563    /// * `X-Google-*`: Google internal use only.
1564    /// * `X-AppEngine-*`: Google internal use only.
1565    /// * `X-CloudScheduler`: This header will be set to true.
1566    /// * `X-CloudScheduler-JobName`: This header will contain the job name.
1567    /// * `X-CloudScheduler-ScheduleTime`: For Cloud Scheduler jobs specified in
1568    ///   the unix-cron format, this header will contain the job schedule as an
1569    ///   offset of UTC parsed according to RFC3339.
1570    ///
1571    /// If the job has a [body][google.cloud.scheduler.v1.HttpTarget.body] and the
1572    /// following headers are not set by the user, Cloud Scheduler sets default
1573    /// values:
1574    ///
1575    /// * `Content-Type`: This will be set to `"application/octet-stream"`. You
1576    ///   can override this default by explicitly setting `Content-Type` to a
1577    ///   particular media type when creating the job. For example, you can set
1578    ///   `Content-Type` to `"application/json"`.
1579    ///
1580    /// The total size of headers must be less than 80KB.
1581    ///
1582    /// [google.cloud.scheduler.v1.HttpTarget.body]: crate::model::HttpTarget::body
1583    /// [google.cloud.scheduler.v1.HttpTarget.uri]: crate::model::HttpTarget::uri
1584    pub headers: std::collections::HashMap<std::string::String, std::string::String>,
1585
1586    /// HTTP request body. A request body is allowed only if the HTTP
1587    /// method is POST, PUT, or PATCH. It is an error to set body on a job with an
1588    /// incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod].
1589    ///
1590    /// [google.cloud.scheduler.v1.HttpMethod]: crate::model::HttpMethod
1591    pub body: ::bytes::Bytes,
1592
1593    /// The mode for generating an `Authorization` header for HTTP requests.
1594    ///
1595    /// If specified, all `Authorization` headers in the
1596    /// [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers] field
1597    /// will be overridden.
1598    ///
1599    /// [google.cloud.scheduler.v1.HttpTarget.headers]: crate::model::HttpTarget::headers
1600    pub authorization_header: std::option::Option<crate::model::http_target::AuthorizationHeader>,
1601
1602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl HttpTarget {
1606    pub fn new() -> Self {
1607        std::default::Default::default()
1608    }
1609
1610    /// Sets the value of [uri][crate::model::HttpTarget::uri].
1611    ///
1612    /// # Example
1613    /// ```ignore,no_run
1614    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1615    /// let x = HttpTarget::new().set_uri("example");
1616    /// ```
1617    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1618        self.uri = v.into();
1619        self
1620    }
1621
1622    /// Sets the value of [http_method][crate::model::HttpTarget::http_method].
1623    ///
1624    /// # Example
1625    /// ```ignore,no_run
1626    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1627    /// use google_cloud_scheduler_v1::model::HttpMethod;
1628    /// let x0 = HttpTarget::new().set_http_method(HttpMethod::Post);
1629    /// let x1 = HttpTarget::new().set_http_method(HttpMethod::Get);
1630    /// let x2 = HttpTarget::new().set_http_method(HttpMethod::Head);
1631    /// ```
1632    pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
1633        mut self,
1634        v: T,
1635    ) -> Self {
1636        self.http_method = v.into();
1637        self
1638    }
1639
1640    /// Sets the value of [headers][crate::model::HttpTarget::headers].
1641    ///
1642    /// # Example
1643    /// ```ignore,no_run
1644    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1645    /// let x = HttpTarget::new().set_headers([
1646    ///     ("key0", "abc"),
1647    ///     ("key1", "xyz"),
1648    /// ]);
1649    /// ```
1650    pub fn set_headers<T, K, V>(mut self, v: T) -> Self
1651    where
1652        T: std::iter::IntoIterator<Item = (K, V)>,
1653        K: std::convert::Into<std::string::String>,
1654        V: std::convert::Into<std::string::String>,
1655    {
1656        use std::iter::Iterator;
1657        self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1658        self
1659    }
1660
1661    /// Sets the value of [body][crate::model::HttpTarget::body].
1662    ///
1663    /// # Example
1664    /// ```ignore,no_run
1665    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1666    /// let x = HttpTarget::new().set_body(bytes::Bytes::from_static(b"example"));
1667    /// ```
1668    pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1669        self.body = v.into();
1670        self
1671    }
1672
1673    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header].
1674    ///
1675    /// Note that all the setters affecting `authorization_header` are mutually
1676    /// exclusive.
1677    ///
1678    /// # Example
1679    /// ```ignore,no_run
1680    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1681    /// use google_cloud_scheduler_v1::model::OAuthToken;
1682    /// let x = HttpTarget::new().set_authorization_header(Some(
1683    ///     google_cloud_scheduler_v1::model::http_target::AuthorizationHeader::OauthToken(OAuthToken::default().into())));
1684    /// ```
1685    pub fn set_authorization_header<
1686        T: std::convert::Into<std::option::Option<crate::model::http_target::AuthorizationHeader>>,
1687    >(
1688        mut self,
1689        v: T,
1690    ) -> Self {
1691        self.authorization_header = v.into();
1692        self
1693    }
1694
1695    /// The value of [authorization_header][crate::model::HttpTarget::authorization_header]
1696    /// if it holds a `OauthToken`, `None` if the field is not set or
1697    /// holds a different branch.
1698    pub fn oauth_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OAuthToken>> {
1699        #[allow(unreachable_patterns)]
1700        self.authorization_header.as_ref().and_then(|v| match v {
1701            crate::model::http_target::AuthorizationHeader::OauthToken(v) => {
1702                std::option::Option::Some(v)
1703            }
1704            _ => std::option::Option::None,
1705        })
1706    }
1707
1708    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header]
1709    /// to hold a `OauthToken`.
1710    ///
1711    /// Note that all the setters affecting `authorization_header` are
1712    /// mutually exclusive.
1713    ///
1714    /// # Example
1715    /// ```ignore,no_run
1716    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1717    /// use google_cloud_scheduler_v1::model::OAuthToken;
1718    /// let x = HttpTarget::new().set_oauth_token(OAuthToken::default()/* use setters */);
1719    /// assert!(x.oauth_token().is_some());
1720    /// assert!(x.oidc_token().is_none());
1721    /// ```
1722    pub fn set_oauth_token<T: std::convert::Into<std::boxed::Box<crate::model::OAuthToken>>>(
1723        mut self,
1724        v: T,
1725    ) -> Self {
1726        self.authorization_header = std::option::Option::Some(
1727            crate::model::http_target::AuthorizationHeader::OauthToken(v.into()),
1728        );
1729        self
1730    }
1731
1732    /// The value of [authorization_header][crate::model::HttpTarget::authorization_header]
1733    /// if it holds a `OidcToken`, `None` if the field is not set or
1734    /// holds a different branch.
1735    pub fn oidc_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OidcToken>> {
1736        #[allow(unreachable_patterns)]
1737        self.authorization_header.as_ref().and_then(|v| match v {
1738            crate::model::http_target::AuthorizationHeader::OidcToken(v) => {
1739                std::option::Option::Some(v)
1740            }
1741            _ => std::option::Option::None,
1742        })
1743    }
1744
1745    /// Sets the value of [authorization_header][crate::model::HttpTarget::authorization_header]
1746    /// to hold a `OidcToken`.
1747    ///
1748    /// Note that all the setters affecting `authorization_header` are
1749    /// mutually exclusive.
1750    ///
1751    /// # Example
1752    /// ```ignore,no_run
1753    /// # use google_cloud_scheduler_v1::model::HttpTarget;
1754    /// use google_cloud_scheduler_v1::model::OidcToken;
1755    /// let x = HttpTarget::new().set_oidc_token(OidcToken::default()/* use setters */);
1756    /// assert!(x.oidc_token().is_some());
1757    /// assert!(x.oauth_token().is_none());
1758    /// ```
1759    pub fn set_oidc_token<T: std::convert::Into<std::boxed::Box<crate::model::OidcToken>>>(
1760        mut self,
1761        v: T,
1762    ) -> Self {
1763        self.authorization_header = std::option::Option::Some(
1764            crate::model::http_target::AuthorizationHeader::OidcToken(v.into()),
1765        );
1766        self
1767    }
1768}
1769
1770impl wkt::message::Message for HttpTarget {
1771    fn typename() -> &'static str {
1772        "type.googleapis.com/google.cloud.scheduler.v1.HttpTarget"
1773    }
1774}
1775
1776/// Defines additional types related to [HttpTarget].
1777pub mod http_target {
1778    #[allow(unused_imports)]
1779    use super::*;
1780
1781    /// The mode for generating an `Authorization` header for HTTP requests.
1782    ///
1783    /// If specified, all `Authorization` headers in the
1784    /// [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers] field
1785    /// will be overridden.
1786    ///
1787    /// [google.cloud.scheduler.v1.HttpTarget.headers]: crate::model::HttpTarget::headers
1788    #[derive(Clone, Debug, PartialEq)]
1789    #[non_exhaustive]
1790    pub enum AuthorizationHeader {
1791        /// If specified, an
1792        /// [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
1793        /// will be generated and attached as an `Authorization` header in the HTTP
1794        /// request.
1795        ///
1796        /// This type of authorization should generally only be used when calling
1797        /// Google APIs hosted on *.googleapis.com.
1798        OauthToken(std::boxed::Box<crate::model::OAuthToken>),
1799        /// If specified, an
1800        /// [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
1801        /// token will be generated and attached as an `Authorization` header in the
1802        /// HTTP request.
1803        ///
1804        /// This type of authorization can be used for many scenarios, including
1805        /// calling Cloud Run, or endpoints where you intend to validate the token
1806        /// yourself.
1807        OidcToken(std::boxed::Box<crate::model::OidcToken>),
1808    }
1809}
1810
1811/// App Engine target. The job will be pushed to a job handler by means
1812/// of an HTTP request via an
1813/// [http_method][google.cloud.scheduler.v1.AppEngineHttpTarget.http_method] such
1814/// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an
1815/// HTTP response code in the range [200 - 299]. Error 503 is
1816/// considered an App Engine system error instead of an application
1817/// error. Requests returning error 503 will be retried regardless of
1818/// retry configuration and not counted against retry counts. Any other
1819/// response code, or a failure to receive a response before the
1820/// deadline, constitutes a failed attempt.
1821///
1822/// [google.cloud.scheduler.v1.AppEngineHttpTarget.http_method]: crate::model::AppEngineHttpTarget::http_method
1823#[derive(Clone, Default, PartialEq)]
1824#[non_exhaustive]
1825pub struct AppEngineHttpTarget {
1826    /// The HTTP method to use for the request. PATCH and OPTIONS are not
1827    /// permitted.
1828    pub http_method: crate::model::HttpMethod,
1829
1830    /// App Engine Routing setting for the job.
1831    pub app_engine_routing: std::option::Option<crate::model::AppEngineRouting>,
1832
1833    /// The relative URI.
1834    ///
1835    /// The relative URL must begin with "/" and must be a valid HTTP relative URL.
1836    /// It can contain a path, query string arguments, and `#` fragments.
1837    /// If the relative URL is empty, then the root path "/" will be used.
1838    /// No spaces are allowed, and the maximum length allowed is 2083 characters.
1839    pub relative_uri: std::string::String,
1840
1841    /// HTTP request headers.
1842    ///
1843    /// This map contains the header field names and values. Headers can be set
1844    /// when the job is created.
1845    ///
1846    /// Cloud Scheduler sets some headers to default values:
1847    ///
1848    /// * `User-Agent`: By default, this header is
1849    ///   `"AppEngine-Google; (+<http://code.google.com/appengine>)"`.
1850    ///   This header can be modified, but Cloud Scheduler will append
1851    ///   `"AppEngine-Google; (+<http://code.google.com/appengine>)"` to the
1852    ///   modified `User-Agent`.
1853    /// * `X-CloudScheduler`: This header will be set to true.
1854    /// * `X-CloudScheduler-JobName`: This header will contain the job name.
1855    /// * `X-CloudScheduler-ScheduleTime`: For Cloud Scheduler jobs specified in
1856    ///   the unix-cron format, this header will contain the job schedule as an
1857    ///   offset of UTC parsed according to RFC3339.
1858    ///
1859    /// If the job has a [body][google.cloud.scheduler.v1.AppEngineHttpTarget.body]
1860    /// and the following headers are not set by the user, Cloud Scheduler sets
1861    /// default values:
1862    ///
1863    /// * `Content-Type`: This will be set to `"application/octet-stream"`. You
1864    ///   can override this default by explicitly setting `Content-Type` to a
1865    ///   particular media type when creating the job. For example, you can set
1866    ///   `Content-Type` to `"application/json"`.
1867    ///
1868    /// The headers below are output only. They cannot be set or overridden:
1869    ///
1870    /// * `Content-Length`: This is computed by Cloud Scheduler.
1871    /// * `X-Google-*`: For Google internal use only.
1872    /// * `X-AppEngine-*`: For Google internal use only.
1873    ///
1874    /// In addition, some App Engine headers, which contain
1875    /// job-specific information, are also be sent to the job handler.
1876    ///
1877    /// [google.cloud.scheduler.v1.AppEngineHttpTarget.body]: crate::model::AppEngineHttpTarget::body
1878    pub headers: std::collections::HashMap<std::string::String, std::string::String>,
1879
1880    /// Body.
1881    ///
1882    /// HTTP request body. A request body is allowed only if the HTTP method is
1883    /// POST or PUT. It will result in invalid argument error to set a body on a
1884    /// job with an incompatible
1885    /// [HttpMethod][google.cloud.scheduler.v1.HttpMethod].
1886    ///
1887    /// [google.cloud.scheduler.v1.HttpMethod]: crate::model::HttpMethod
1888    pub body: ::bytes::Bytes,
1889
1890    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1891}
1892
1893impl AppEngineHttpTarget {
1894    pub fn new() -> Self {
1895        std::default::Default::default()
1896    }
1897
1898    /// Sets the value of [http_method][crate::model::AppEngineHttpTarget::http_method].
1899    ///
1900    /// # Example
1901    /// ```ignore,no_run
1902    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1903    /// use google_cloud_scheduler_v1::model::HttpMethod;
1904    /// let x0 = AppEngineHttpTarget::new().set_http_method(HttpMethod::Post);
1905    /// let x1 = AppEngineHttpTarget::new().set_http_method(HttpMethod::Get);
1906    /// let x2 = AppEngineHttpTarget::new().set_http_method(HttpMethod::Head);
1907    /// ```
1908    pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
1909        mut self,
1910        v: T,
1911    ) -> Self {
1912        self.http_method = v.into();
1913        self
1914    }
1915
1916    /// Sets the value of [app_engine_routing][crate::model::AppEngineHttpTarget::app_engine_routing].
1917    ///
1918    /// # Example
1919    /// ```ignore,no_run
1920    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1921    /// use google_cloud_scheduler_v1::model::AppEngineRouting;
1922    /// let x = AppEngineHttpTarget::new().set_app_engine_routing(AppEngineRouting::default()/* use setters */);
1923    /// ```
1924    pub fn set_app_engine_routing<T>(mut self, v: T) -> Self
1925    where
1926        T: std::convert::Into<crate::model::AppEngineRouting>,
1927    {
1928        self.app_engine_routing = std::option::Option::Some(v.into());
1929        self
1930    }
1931
1932    /// Sets or clears the value of [app_engine_routing][crate::model::AppEngineHttpTarget::app_engine_routing].
1933    ///
1934    /// # Example
1935    /// ```ignore,no_run
1936    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1937    /// use google_cloud_scheduler_v1::model::AppEngineRouting;
1938    /// let x = AppEngineHttpTarget::new().set_or_clear_app_engine_routing(Some(AppEngineRouting::default()/* use setters */));
1939    /// let x = AppEngineHttpTarget::new().set_or_clear_app_engine_routing(None::<AppEngineRouting>);
1940    /// ```
1941    pub fn set_or_clear_app_engine_routing<T>(mut self, v: std::option::Option<T>) -> Self
1942    where
1943        T: std::convert::Into<crate::model::AppEngineRouting>,
1944    {
1945        self.app_engine_routing = v.map(|x| x.into());
1946        self
1947    }
1948
1949    /// Sets the value of [relative_uri][crate::model::AppEngineHttpTarget::relative_uri].
1950    ///
1951    /// # Example
1952    /// ```ignore,no_run
1953    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1954    /// let x = AppEngineHttpTarget::new().set_relative_uri("example");
1955    /// ```
1956    pub fn set_relative_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1957        self.relative_uri = v.into();
1958        self
1959    }
1960
1961    /// Sets the value of [headers][crate::model::AppEngineHttpTarget::headers].
1962    ///
1963    /// # Example
1964    /// ```ignore,no_run
1965    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1966    /// let x = AppEngineHttpTarget::new().set_headers([
1967    ///     ("key0", "abc"),
1968    ///     ("key1", "xyz"),
1969    /// ]);
1970    /// ```
1971    pub fn set_headers<T, K, V>(mut self, v: T) -> Self
1972    where
1973        T: std::iter::IntoIterator<Item = (K, V)>,
1974        K: std::convert::Into<std::string::String>,
1975        V: std::convert::Into<std::string::String>,
1976    {
1977        use std::iter::Iterator;
1978        self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1979        self
1980    }
1981
1982    /// Sets the value of [body][crate::model::AppEngineHttpTarget::body].
1983    ///
1984    /// # Example
1985    /// ```ignore,no_run
1986    /// # use google_cloud_scheduler_v1::model::AppEngineHttpTarget;
1987    /// let x = AppEngineHttpTarget::new().set_body(bytes::Bytes::from_static(b"example"));
1988    /// ```
1989    pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1990        self.body = v.into();
1991        self
1992    }
1993}
1994
1995impl wkt::message::Message for AppEngineHttpTarget {
1996    fn typename() -> &'static str {
1997        "type.googleapis.com/google.cloud.scheduler.v1.AppEngineHttpTarget"
1998    }
1999}
2000
2001/// Pub/Sub target. The job will be delivered by publishing a message to
2002/// the given Pub/Sub topic.
2003#[derive(Clone, Default, PartialEq)]
2004#[non_exhaustive]
2005pub struct PubsubTarget {
2006    /// Required. The name of the Cloud Pub/Sub topic to which messages will
2007    /// be published when a job is delivered. The topic name must be in the
2008    /// same format as required by Pub/Sub's
2009    /// [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest),
2010    /// for example `projects/PROJECT_ID/topics/TOPIC_ID`.
2011    ///
2012    /// The topic must be in the same project as the Cloud Scheduler job.
2013    pub topic_name: std::string::String,
2014
2015    /// The message payload for PubsubMessage.
2016    ///
2017    /// Pubsub message must contain either non-empty data, or at least one
2018    /// attribute.
2019    pub data: ::bytes::Bytes,
2020
2021    /// Attributes for PubsubMessage.
2022    ///
2023    /// Pubsub message must contain either non-empty data, or at least one
2024    /// attribute.
2025    pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
2026
2027    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2028}
2029
2030impl PubsubTarget {
2031    pub fn new() -> Self {
2032        std::default::Default::default()
2033    }
2034
2035    /// Sets the value of [topic_name][crate::model::PubsubTarget::topic_name].
2036    ///
2037    /// # Example
2038    /// ```ignore,no_run
2039    /// # use google_cloud_scheduler_v1::model::PubsubTarget;
2040    /// let x = PubsubTarget::new().set_topic_name("example");
2041    /// ```
2042    pub fn set_topic_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2043        self.topic_name = v.into();
2044        self
2045    }
2046
2047    /// Sets the value of [data][crate::model::PubsubTarget::data].
2048    ///
2049    /// # Example
2050    /// ```ignore,no_run
2051    /// # use google_cloud_scheduler_v1::model::PubsubTarget;
2052    /// let x = PubsubTarget::new().set_data(bytes::Bytes::from_static(b"example"));
2053    /// ```
2054    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2055        self.data = v.into();
2056        self
2057    }
2058
2059    /// Sets the value of [attributes][crate::model::PubsubTarget::attributes].
2060    ///
2061    /// # Example
2062    /// ```ignore,no_run
2063    /// # use google_cloud_scheduler_v1::model::PubsubTarget;
2064    /// let x = PubsubTarget::new().set_attributes([
2065    ///     ("key0", "abc"),
2066    ///     ("key1", "xyz"),
2067    /// ]);
2068    /// ```
2069    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
2070    where
2071        T: std::iter::IntoIterator<Item = (K, V)>,
2072        K: std::convert::Into<std::string::String>,
2073        V: std::convert::Into<std::string::String>,
2074    {
2075        use std::iter::Iterator;
2076        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2077        self
2078    }
2079}
2080
2081impl wkt::message::Message for PubsubTarget {
2082    fn typename() -> &'static str {
2083        "type.googleapis.com/google.cloud.scheduler.v1.PubsubTarget"
2084    }
2085}
2086
2087/// App Engine Routing.
2088///
2089/// For more information about services, versions, and instances see
2090/// [An Overview of App
2091/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
2092/// [Microservices Architecture on Google App
2093/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
2094/// [App Engine Standard request
2095/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
2096/// and [App Engine Flex request
2097/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
2098#[derive(Clone, Default, PartialEq)]
2099#[non_exhaustive]
2100pub struct AppEngineRouting {
2101    /// App service.
2102    ///
2103    /// By default, the job is sent to the service which is the default
2104    /// service when the job is attempted.
2105    pub service: std::string::String,
2106
2107    /// App version.
2108    ///
2109    /// By default, the job is sent to the version which is the default
2110    /// version when the job is attempted.
2111    pub version: std::string::String,
2112
2113    /// App instance.
2114    ///
2115    /// By default, the job is sent to an instance which is available when
2116    /// the job is attempted.
2117    ///
2118    /// Requests can only be sent to a specific instance if
2119    /// [manual scaling is used in App Engine
2120    /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?#scaling_types_and_instance_classes).
2121    /// App Engine Flex does not support instances. For more information, see
2122    /// [App Engine Standard request
2123    /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
2124    /// and [App Engine Flex request
2125    /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
2126    pub instance: std::string::String,
2127
2128    /// Output only. The host that the job is sent to.
2129    ///
2130    /// For more information about how App Engine requests are routed, see
2131    /// [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
2132    ///
2133    /// The host is constructed as:
2134    ///
2135    /// * `host = [application_domain_name]`\</br\>
2136    ///   `| [service] + '.' + [application_domain_name]`\</br\>
2137    ///   `| [version] + '.' + [application_domain_name]`\</br\>
2138    ///   `| [version_dot_service]+ '.' + [application_domain_name]`\</br\>
2139    ///   `| [instance] + '.' + [application_domain_name]`\</br\>
2140    ///   `| [instance_dot_service] + '.' + [application_domain_name]`\</br\>
2141    ///   `| [instance_dot_version] + '.' + [application_domain_name]`\</br\>
2142    ///   `| [instance_dot_version_dot_service] + '.' + [application_domain_name]`
2143    ///
2144    /// * `application_domain_name` = The domain name of the app, for
2145    ///   example \<app-id\>.appspot.com, which is associated with the
2146    ///   job's project ID.
2147    ///
2148    /// * `service =` [service][google.cloud.scheduler.v1.AppEngineRouting.service]
2149    ///
2150    /// * `version =` [version][google.cloud.scheduler.v1.AppEngineRouting.version]
2151    ///
2152    /// * `version_dot_service =`
2153    ///   [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +`
2154    ///   [service][google.cloud.scheduler.v1.AppEngineRouting.service]
2155    ///
2156    /// * `instance =`
2157    ///   [instance][google.cloud.scheduler.v1.AppEngineRouting.instance]
2158    ///
2159    /// * `instance_dot_service =`
2160    ///   [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
2161    ///   [service][google.cloud.scheduler.v1.AppEngineRouting.service]
2162    ///
2163    /// * `instance_dot_version =`
2164    ///   [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
2165    ///   [version][google.cloud.scheduler.v1.AppEngineRouting.version]
2166    ///
2167    /// * `instance_dot_version_dot_service =`
2168    ///   [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] `+ '.' +`
2169    ///   [version][google.cloud.scheduler.v1.AppEngineRouting.version] `+ '.' +`
2170    ///   [service][google.cloud.scheduler.v1.AppEngineRouting.service]
2171    ///
2172    ///
2173    /// If [service][google.cloud.scheduler.v1.AppEngineRouting.service] is empty,
2174    /// then the job will be sent to the service which is the default service when
2175    /// the job is attempted.
2176    ///
2177    /// If [version][google.cloud.scheduler.v1.AppEngineRouting.version] is empty,
2178    /// then the job will be sent to the version which is the default version when
2179    /// the job is attempted.
2180    ///
2181    /// If [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is
2182    /// empty, then the job will be sent to an instance which is available when the
2183    /// job is attempted.
2184    ///
2185    /// If [service][google.cloud.scheduler.v1.AppEngineRouting.service],
2186    /// [version][google.cloud.scheduler.v1.AppEngineRouting.version], or
2187    /// [instance][google.cloud.scheduler.v1.AppEngineRouting.instance] is invalid,
2188    /// then the job will be sent to the default version of the default service
2189    /// when the job is attempted.
2190    ///
2191    /// [google.cloud.scheduler.v1.AppEngineRouting.instance]: crate::model::AppEngineRouting::instance
2192    /// [google.cloud.scheduler.v1.AppEngineRouting.service]: crate::model::AppEngineRouting::service
2193    /// [google.cloud.scheduler.v1.AppEngineRouting.version]: crate::model::AppEngineRouting::version
2194    pub host: std::string::String,
2195
2196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2197}
2198
2199impl AppEngineRouting {
2200    pub fn new() -> Self {
2201        std::default::Default::default()
2202    }
2203
2204    /// Sets the value of [service][crate::model::AppEngineRouting::service].
2205    ///
2206    /// # Example
2207    /// ```ignore,no_run
2208    /// # use google_cloud_scheduler_v1::model::AppEngineRouting;
2209    /// let x = AppEngineRouting::new().set_service("example");
2210    /// ```
2211    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2212        self.service = v.into();
2213        self
2214    }
2215
2216    /// Sets the value of [version][crate::model::AppEngineRouting::version].
2217    ///
2218    /// # Example
2219    /// ```ignore,no_run
2220    /// # use google_cloud_scheduler_v1::model::AppEngineRouting;
2221    /// let x = AppEngineRouting::new().set_version("example");
2222    /// ```
2223    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2224        self.version = v.into();
2225        self
2226    }
2227
2228    /// Sets the value of [instance][crate::model::AppEngineRouting::instance].
2229    ///
2230    /// # Example
2231    /// ```ignore,no_run
2232    /// # use google_cloud_scheduler_v1::model::AppEngineRouting;
2233    /// let x = AppEngineRouting::new().set_instance("example");
2234    /// ```
2235    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2236        self.instance = v.into();
2237        self
2238    }
2239
2240    /// Sets the value of [host][crate::model::AppEngineRouting::host].
2241    ///
2242    /// # Example
2243    /// ```ignore,no_run
2244    /// # use google_cloud_scheduler_v1::model::AppEngineRouting;
2245    /// let x = AppEngineRouting::new().set_host("example");
2246    /// ```
2247    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2248        self.host = v.into();
2249        self
2250    }
2251}
2252
2253impl wkt::message::Message for AppEngineRouting {
2254    fn typename() -> &'static str {
2255        "type.googleapis.com/google.cloud.scheduler.v1.AppEngineRouting"
2256    }
2257}
2258
2259/// Contains information needed for generating an
2260/// [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
2261/// This type of authorization should generally only be used when calling Google
2262/// APIs hosted on *.googleapis.com.
2263#[derive(Clone, Default, PartialEq)]
2264#[non_exhaustive]
2265pub struct OAuthToken {
2266    /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
2267    /// to be used for generating OAuth token.
2268    /// The service account must be within the same project as the job. The caller
2269    /// must have iam.serviceAccounts.actAs permission for the service account.
2270    pub service_account_email: std::string::String,
2271
2272    /// OAuth scope to be used for generating OAuth access token.
2273    /// If not specified, `https://www.googleapis.com/auth/cloud-platform`
2274    /// will be used.
2275    pub scope: std::string::String,
2276
2277    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2278}
2279
2280impl OAuthToken {
2281    pub fn new() -> Self {
2282        std::default::Default::default()
2283    }
2284
2285    /// Sets the value of [service_account_email][crate::model::OAuthToken::service_account_email].
2286    ///
2287    /// # Example
2288    /// ```ignore,no_run
2289    /// # use google_cloud_scheduler_v1::model::OAuthToken;
2290    /// let x = OAuthToken::new().set_service_account_email("example");
2291    /// ```
2292    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
2293        mut self,
2294        v: T,
2295    ) -> Self {
2296        self.service_account_email = v.into();
2297        self
2298    }
2299
2300    /// Sets the value of [scope][crate::model::OAuthToken::scope].
2301    ///
2302    /// # Example
2303    /// ```ignore,no_run
2304    /// # use google_cloud_scheduler_v1::model::OAuthToken;
2305    /// let x = OAuthToken::new().set_scope("example");
2306    /// ```
2307    pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2308        self.scope = v.into();
2309        self
2310    }
2311}
2312
2313impl wkt::message::Message for OAuthToken {
2314    fn typename() -> &'static str {
2315        "type.googleapis.com/google.cloud.scheduler.v1.OAuthToken"
2316    }
2317}
2318
2319/// Contains information needed for generating an
2320/// [OpenID Connect
2321/// token](https://developers.google.com/identity/protocols/OpenIDConnect).
2322/// This type of authorization can be used for many scenarios, including
2323/// calling Cloud Run, or endpoints where you intend to validate the token
2324/// yourself.
2325#[derive(Clone, Default, PartialEq)]
2326#[non_exhaustive]
2327pub struct OidcToken {
2328    /// [Service account email](https://cloud.google.com/iam/docs/service-accounts)
2329    /// to be used for generating OIDC token.
2330    /// The service account must be within the same project as the job. The caller
2331    /// must have iam.serviceAccounts.actAs permission for the service account.
2332    pub service_account_email: std::string::String,
2333
2334    /// Audience to be used when generating OIDC token. If not specified, the URI
2335    /// specified in target will be used.
2336    pub audience: std::string::String,
2337
2338    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2339}
2340
2341impl OidcToken {
2342    pub fn new() -> Self {
2343        std::default::Default::default()
2344    }
2345
2346    /// Sets the value of [service_account_email][crate::model::OidcToken::service_account_email].
2347    ///
2348    /// # Example
2349    /// ```ignore,no_run
2350    /// # use google_cloud_scheduler_v1::model::OidcToken;
2351    /// let x = OidcToken::new().set_service_account_email("example");
2352    /// ```
2353    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
2354        mut self,
2355        v: T,
2356    ) -> Self {
2357        self.service_account_email = v.into();
2358        self
2359    }
2360
2361    /// Sets the value of [audience][crate::model::OidcToken::audience].
2362    ///
2363    /// # Example
2364    /// ```ignore,no_run
2365    /// # use google_cloud_scheduler_v1::model::OidcToken;
2366    /// let x = OidcToken::new().set_audience("example");
2367    /// ```
2368    pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2369        self.audience = v.into();
2370        self
2371    }
2372}
2373
2374impl wkt::message::Message for OidcToken {
2375    fn typename() -> &'static str {
2376        "type.googleapis.com/google.cloud.scheduler.v1.OidcToken"
2377    }
2378}
2379
2380/// The HTTP method used to execute the job.
2381///
2382/// # Working with unknown values
2383///
2384/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2385/// additional enum variants at any time. Adding new variants is not considered
2386/// a breaking change. Applications should write their code in anticipation of:
2387///
2388/// - New values appearing in future releases of the client library, **and**
2389/// - New values received dynamically, without application changes.
2390///
2391/// Please consult the [Working with enums] section in the user guide for some
2392/// guidelines.
2393///
2394/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2395#[derive(Clone, Debug, PartialEq)]
2396#[non_exhaustive]
2397pub enum HttpMethod {
2398    /// HTTP method unspecified. Defaults to POST.
2399    Unspecified,
2400    /// HTTP POST
2401    Post,
2402    /// HTTP GET
2403    Get,
2404    /// HTTP HEAD
2405    Head,
2406    /// HTTP PUT
2407    Put,
2408    /// HTTP DELETE
2409    Delete,
2410    /// HTTP PATCH
2411    Patch,
2412    /// HTTP OPTIONS
2413    Options,
2414    /// If set, the enum was initialized with an unknown value.
2415    ///
2416    /// Applications can examine the value using [HttpMethod::value] or
2417    /// [HttpMethod::name].
2418    UnknownValue(http_method::UnknownValue),
2419}
2420
2421#[doc(hidden)]
2422pub mod http_method {
2423    #[allow(unused_imports)]
2424    use super::*;
2425    #[derive(Clone, Debug, PartialEq)]
2426    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2427}
2428
2429impl HttpMethod {
2430    /// Gets the enum value.
2431    ///
2432    /// Returns `None` if the enum contains an unknown value deserialized from
2433    /// the string representation of enums.
2434    pub fn value(&self) -> std::option::Option<i32> {
2435        match self {
2436            Self::Unspecified => std::option::Option::Some(0),
2437            Self::Post => std::option::Option::Some(1),
2438            Self::Get => std::option::Option::Some(2),
2439            Self::Head => std::option::Option::Some(3),
2440            Self::Put => std::option::Option::Some(4),
2441            Self::Delete => std::option::Option::Some(5),
2442            Self::Patch => std::option::Option::Some(6),
2443            Self::Options => std::option::Option::Some(7),
2444            Self::UnknownValue(u) => u.0.value(),
2445        }
2446    }
2447
2448    /// Gets the enum value as a string.
2449    ///
2450    /// Returns `None` if the enum contains an unknown value deserialized from
2451    /// the integer representation of enums.
2452    pub fn name(&self) -> std::option::Option<&str> {
2453        match self {
2454            Self::Unspecified => std::option::Option::Some("HTTP_METHOD_UNSPECIFIED"),
2455            Self::Post => std::option::Option::Some("POST"),
2456            Self::Get => std::option::Option::Some("GET"),
2457            Self::Head => std::option::Option::Some("HEAD"),
2458            Self::Put => std::option::Option::Some("PUT"),
2459            Self::Delete => std::option::Option::Some("DELETE"),
2460            Self::Patch => std::option::Option::Some("PATCH"),
2461            Self::Options => std::option::Option::Some("OPTIONS"),
2462            Self::UnknownValue(u) => u.0.name(),
2463        }
2464    }
2465}
2466
2467impl std::default::Default for HttpMethod {
2468    fn default() -> Self {
2469        use std::convert::From;
2470        Self::from(0)
2471    }
2472}
2473
2474impl std::fmt::Display for HttpMethod {
2475    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2476        wkt::internal::display_enum(f, self.name(), self.value())
2477    }
2478}
2479
2480impl std::convert::From<i32> for HttpMethod {
2481    fn from(value: i32) -> Self {
2482        match value {
2483            0 => Self::Unspecified,
2484            1 => Self::Post,
2485            2 => Self::Get,
2486            3 => Self::Head,
2487            4 => Self::Put,
2488            5 => Self::Delete,
2489            6 => Self::Patch,
2490            7 => Self::Options,
2491            _ => Self::UnknownValue(http_method::UnknownValue(
2492                wkt::internal::UnknownEnumValue::Integer(value),
2493            )),
2494        }
2495    }
2496}
2497
2498impl std::convert::From<&str> for HttpMethod {
2499    fn from(value: &str) -> Self {
2500        use std::string::ToString;
2501        match value {
2502            "HTTP_METHOD_UNSPECIFIED" => Self::Unspecified,
2503            "POST" => Self::Post,
2504            "GET" => Self::Get,
2505            "HEAD" => Self::Head,
2506            "PUT" => Self::Put,
2507            "DELETE" => Self::Delete,
2508            "PATCH" => Self::Patch,
2509            "OPTIONS" => Self::Options,
2510            _ => Self::UnknownValue(http_method::UnknownValue(
2511                wkt::internal::UnknownEnumValue::String(value.to_string()),
2512            )),
2513        }
2514    }
2515}
2516
2517impl serde::ser::Serialize for HttpMethod {
2518    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2519    where
2520        S: serde::Serializer,
2521    {
2522        match self {
2523            Self::Unspecified => serializer.serialize_i32(0),
2524            Self::Post => serializer.serialize_i32(1),
2525            Self::Get => serializer.serialize_i32(2),
2526            Self::Head => serializer.serialize_i32(3),
2527            Self::Put => serializer.serialize_i32(4),
2528            Self::Delete => serializer.serialize_i32(5),
2529            Self::Patch => serializer.serialize_i32(6),
2530            Self::Options => serializer.serialize_i32(7),
2531            Self::UnknownValue(u) => u.0.serialize(serializer),
2532        }
2533    }
2534}
2535
2536impl<'de> serde::de::Deserialize<'de> for HttpMethod {
2537    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2538    where
2539        D: serde::Deserializer<'de>,
2540    {
2541        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HttpMethod>::new(
2542            ".google.cloud.scheduler.v1.HttpMethod",
2543        ))
2544    }
2545}