Skip to main content

google_cloud_workflows_executions_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 serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// A running instance of a
36/// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
37#[derive(Clone, Default, PartialEq)]
38#[non_exhaustive]
39pub struct Execution {
40    /// Output only. The resource name of the execution.
41    /// Format:
42    /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
43    pub name: std::string::String,
44
45    /// Output only. Marks the beginning of execution.
46    pub start_time: std::option::Option<wkt::Timestamp>,
47
48    /// Output only. Marks the end of execution, successful or not.
49    pub end_time: std::option::Option<wkt::Timestamp>,
50
51    /// Output only. Measures the duration of the execution.
52    pub duration: std::option::Option<wkt::Duration>,
53
54    /// Output only. Current state of the execution.
55    pub state: crate::model::execution::State,
56
57    /// Input parameters of the execution represented as a JSON string.
58    /// The size limit is 32KB.
59    ///
60    /// *Note*: If you are using the REST API directly to run your workflow, you
61    /// must escape any JSON string value of `argument`. Example:
62    /// `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
63    pub argument: std::string::String,
64
65    /// Output only. Output of the execution represented as a JSON string. The
66    /// value can only be present if the execution's state is `SUCCEEDED`.
67    pub result: std::string::String,
68
69    /// Output only. The error which caused the execution to finish prematurely.
70    /// The value is only present if the execution's state is `FAILED`
71    /// or `CANCELLED`.
72    pub error: std::option::Option<crate::model::execution::Error>,
73
74    /// Output only. Revision of the workflow this execution is using.
75    pub workflow_revision_id: std::string::String,
76
77    /// The call logging level associated to this execution.
78    pub call_log_level: crate::model::execution::CallLogLevel,
79
80    /// Output only. Status tracks the current steps and progress data of this
81    /// execution.
82    pub status: std::option::Option<crate::model::execution::Status>,
83
84    /// Labels associated with this execution.
85    /// Labels can contain at most 64 entries. Keys and values can be no longer
86    /// than 63 characters and can only contain lowercase letters, numeric
87    /// characters, underscores, and dashes. Label keys must start with a letter.
88    /// International characters are allowed.
89    /// By default, labels are inherited from the workflow but are overridden by
90    /// any labels associated with the execution.
91    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
92
93    /// Output only. Error regarding the state of the Execution resource. For
94    /// example, this field will have error details if the execution data is
95    /// unavailable due to revoked KMS key permissions.
96    pub state_error: std::option::Option<crate::model::execution::StateError>,
97
98    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
99}
100
101impl Execution {
102    /// Creates a new default instance.
103    pub fn new() -> Self {
104        std::default::Default::default()
105    }
106
107    /// Sets the value of [name][crate::model::Execution::name].
108    ///
109    /// # Example
110    /// ```ignore,no_run
111    /// # use google_cloud_workflows_executions_v1::model::Execution;
112    /// # let project_id = "project_id";
113    /// # let location_id = "location_id";
114    /// # let workflow_id = "workflow_id";
115    /// # let execution_id = "execution_id";
116    /// let x = Execution::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}/executions/{execution_id}"));
117    /// ```
118    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
119        self.name = v.into();
120        self
121    }
122
123    /// Sets the value of [start_time][crate::model::Execution::start_time].
124    ///
125    /// # Example
126    /// ```ignore,no_run
127    /// # use google_cloud_workflows_executions_v1::model::Execution;
128    /// use wkt::Timestamp;
129    /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
130    /// ```
131    pub fn set_start_time<T>(mut self, v: T) -> Self
132    where
133        T: std::convert::Into<wkt::Timestamp>,
134    {
135        self.start_time = std::option::Option::Some(v.into());
136        self
137    }
138
139    /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
140    ///
141    /// # Example
142    /// ```ignore,no_run
143    /// # use google_cloud_workflows_executions_v1::model::Execution;
144    /// use wkt::Timestamp;
145    /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
146    /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
147    /// ```
148    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
149    where
150        T: std::convert::Into<wkt::Timestamp>,
151    {
152        self.start_time = v.map(|x| x.into());
153        self
154    }
155
156    /// Sets the value of [end_time][crate::model::Execution::end_time].
157    ///
158    /// # Example
159    /// ```ignore,no_run
160    /// # use google_cloud_workflows_executions_v1::model::Execution;
161    /// use wkt::Timestamp;
162    /// let x = Execution::new().set_end_time(Timestamp::default()/* use setters */);
163    /// ```
164    pub fn set_end_time<T>(mut self, v: T) -> Self
165    where
166        T: std::convert::Into<wkt::Timestamp>,
167    {
168        self.end_time = std::option::Option::Some(v.into());
169        self
170    }
171
172    /// Sets or clears the value of [end_time][crate::model::Execution::end_time].
173    ///
174    /// # Example
175    /// ```ignore,no_run
176    /// # use google_cloud_workflows_executions_v1::model::Execution;
177    /// use wkt::Timestamp;
178    /// let x = Execution::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
179    /// let x = Execution::new().set_or_clear_end_time(None::<Timestamp>);
180    /// ```
181    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
182    where
183        T: std::convert::Into<wkt::Timestamp>,
184    {
185        self.end_time = v.map(|x| x.into());
186        self
187    }
188
189    /// Sets the value of [duration][crate::model::Execution::duration].
190    ///
191    /// # Example
192    /// ```ignore,no_run
193    /// # use google_cloud_workflows_executions_v1::model::Execution;
194    /// use wkt::Duration;
195    /// let x = Execution::new().set_duration(Duration::default()/* use setters */);
196    /// ```
197    pub fn set_duration<T>(mut self, v: T) -> Self
198    where
199        T: std::convert::Into<wkt::Duration>,
200    {
201        self.duration = std::option::Option::Some(v.into());
202        self
203    }
204
205    /// Sets or clears the value of [duration][crate::model::Execution::duration].
206    ///
207    /// # Example
208    /// ```ignore,no_run
209    /// # use google_cloud_workflows_executions_v1::model::Execution;
210    /// use wkt::Duration;
211    /// let x = Execution::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
212    /// let x = Execution::new().set_or_clear_duration(None::<Duration>);
213    /// ```
214    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
215    where
216        T: std::convert::Into<wkt::Duration>,
217    {
218        self.duration = v.map(|x| x.into());
219        self
220    }
221
222    /// Sets the value of [state][crate::model::Execution::state].
223    ///
224    /// # Example
225    /// ```ignore,no_run
226    /// # use google_cloud_workflows_executions_v1::model::Execution;
227    /// use google_cloud_workflows_executions_v1::model::execution::State;
228    /// let x0 = Execution::new().set_state(State::Active);
229    /// let x1 = Execution::new().set_state(State::Succeeded);
230    /// let x2 = Execution::new().set_state(State::Failed);
231    /// ```
232    pub fn set_state<T: std::convert::Into<crate::model::execution::State>>(
233        mut self,
234        v: T,
235    ) -> Self {
236        self.state = v.into();
237        self
238    }
239
240    /// Sets the value of [argument][crate::model::Execution::argument].
241    ///
242    /// # Example
243    /// ```ignore,no_run
244    /// # use google_cloud_workflows_executions_v1::model::Execution;
245    /// let x = Execution::new().set_argument("example");
246    /// ```
247    pub fn set_argument<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
248        self.argument = v.into();
249        self
250    }
251
252    /// Sets the value of [result][crate::model::Execution::result].
253    ///
254    /// # Example
255    /// ```ignore,no_run
256    /// # use google_cloud_workflows_executions_v1::model::Execution;
257    /// let x = Execution::new().set_result("example");
258    /// ```
259    pub fn set_result<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
260        self.result = v.into();
261        self
262    }
263
264    /// Sets the value of [error][crate::model::Execution::error].
265    ///
266    /// # Example
267    /// ```ignore,no_run
268    /// # use google_cloud_workflows_executions_v1::model::Execution;
269    /// use google_cloud_workflows_executions_v1::model::execution::Error;
270    /// let x = Execution::new().set_error(Error::default()/* use setters */);
271    /// ```
272    pub fn set_error<T>(mut self, v: T) -> Self
273    where
274        T: std::convert::Into<crate::model::execution::Error>,
275    {
276        self.error = std::option::Option::Some(v.into());
277        self
278    }
279
280    /// Sets or clears the value of [error][crate::model::Execution::error].
281    ///
282    /// # Example
283    /// ```ignore,no_run
284    /// # use google_cloud_workflows_executions_v1::model::Execution;
285    /// use google_cloud_workflows_executions_v1::model::execution::Error;
286    /// let x = Execution::new().set_or_clear_error(Some(Error::default()/* use setters */));
287    /// let x = Execution::new().set_or_clear_error(None::<Error>);
288    /// ```
289    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
290    where
291        T: std::convert::Into<crate::model::execution::Error>,
292    {
293        self.error = v.map(|x| x.into());
294        self
295    }
296
297    /// Sets the value of [workflow_revision_id][crate::model::Execution::workflow_revision_id].
298    ///
299    /// # Example
300    /// ```ignore,no_run
301    /// # use google_cloud_workflows_executions_v1::model::Execution;
302    /// let x = Execution::new().set_workflow_revision_id("example");
303    /// ```
304    pub fn set_workflow_revision_id<T: std::convert::Into<std::string::String>>(
305        mut self,
306        v: T,
307    ) -> Self {
308        self.workflow_revision_id = v.into();
309        self
310    }
311
312    /// Sets the value of [call_log_level][crate::model::Execution::call_log_level].
313    ///
314    /// # Example
315    /// ```ignore,no_run
316    /// # use google_cloud_workflows_executions_v1::model::Execution;
317    /// use google_cloud_workflows_executions_v1::model::execution::CallLogLevel;
318    /// let x0 = Execution::new().set_call_log_level(CallLogLevel::LogAllCalls);
319    /// let x1 = Execution::new().set_call_log_level(CallLogLevel::LogErrorsOnly);
320    /// let x2 = Execution::new().set_call_log_level(CallLogLevel::LogNone);
321    /// ```
322    pub fn set_call_log_level<T: std::convert::Into<crate::model::execution::CallLogLevel>>(
323        mut self,
324        v: T,
325    ) -> Self {
326        self.call_log_level = v.into();
327        self
328    }
329
330    /// Sets the value of [status][crate::model::Execution::status].
331    ///
332    /// # Example
333    /// ```ignore,no_run
334    /// # use google_cloud_workflows_executions_v1::model::Execution;
335    /// use google_cloud_workflows_executions_v1::model::execution::Status;
336    /// let x = Execution::new().set_status(Status::default()/* use setters */);
337    /// ```
338    pub fn set_status<T>(mut self, v: T) -> Self
339    where
340        T: std::convert::Into<crate::model::execution::Status>,
341    {
342        self.status = std::option::Option::Some(v.into());
343        self
344    }
345
346    /// Sets or clears the value of [status][crate::model::Execution::status].
347    ///
348    /// # Example
349    /// ```ignore,no_run
350    /// # use google_cloud_workflows_executions_v1::model::Execution;
351    /// use google_cloud_workflows_executions_v1::model::execution::Status;
352    /// let x = Execution::new().set_or_clear_status(Some(Status::default()/* use setters */));
353    /// let x = Execution::new().set_or_clear_status(None::<Status>);
354    /// ```
355    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
356    where
357        T: std::convert::Into<crate::model::execution::Status>,
358    {
359        self.status = v.map(|x| x.into());
360        self
361    }
362
363    /// Sets the value of [labels][crate::model::Execution::labels].
364    ///
365    /// # Example
366    /// ```ignore,no_run
367    /// # use google_cloud_workflows_executions_v1::model::Execution;
368    /// let x = Execution::new().set_labels([
369    ///     ("key0", "abc"),
370    ///     ("key1", "xyz"),
371    /// ]);
372    /// ```
373    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
374    where
375        T: std::iter::IntoIterator<Item = (K, V)>,
376        K: std::convert::Into<std::string::String>,
377        V: std::convert::Into<std::string::String>,
378    {
379        use std::iter::Iterator;
380        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
381        self
382    }
383
384    /// Sets the value of [state_error][crate::model::Execution::state_error].
385    ///
386    /// # Example
387    /// ```ignore,no_run
388    /// # use google_cloud_workflows_executions_v1::model::Execution;
389    /// use google_cloud_workflows_executions_v1::model::execution::StateError;
390    /// let x = Execution::new().set_state_error(StateError::default()/* use setters */);
391    /// ```
392    pub fn set_state_error<T>(mut self, v: T) -> Self
393    where
394        T: std::convert::Into<crate::model::execution::StateError>,
395    {
396        self.state_error = std::option::Option::Some(v.into());
397        self
398    }
399
400    /// Sets or clears the value of [state_error][crate::model::Execution::state_error].
401    ///
402    /// # Example
403    /// ```ignore,no_run
404    /// # use google_cloud_workflows_executions_v1::model::Execution;
405    /// use google_cloud_workflows_executions_v1::model::execution::StateError;
406    /// let x = Execution::new().set_or_clear_state_error(Some(StateError::default()/* use setters */));
407    /// let x = Execution::new().set_or_clear_state_error(None::<StateError>);
408    /// ```
409    pub fn set_or_clear_state_error<T>(mut self, v: std::option::Option<T>) -> Self
410    where
411        T: std::convert::Into<crate::model::execution::StateError>,
412    {
413        self.state_error = v.map(|x| x.into());
414        self
415    }
416}
417
418impl wkt::message::Message for Execution {
419    fn typename() -> &'static str {
420        "type.googleapis.com/google.cloud.workflows.executions.v1.Execution"
421    }
422}
423
424/// Defines additional types related to [Execution].
425pub mod execution {
426    #[allow(unused_imports)]
427    use super::*;
428
429    /// A single stack element (frame) where an error occurred.
430    #[derive(Clone, Default, PartialEq)]
431    #[non_exhaustive]
432    pub struct StackTraceElement {
433        /// The step the error occurred at.
434        pub step: std::string::String,
435
436        /// The routine where the error occurred.
437        pub routine: std::string::String,
438
439        /// The source position information of the stack trace element.
440        pub position: std::option::Option<crate::model::execution::stack_trace_element::Position>,
441
442        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
443    }
444
445    impl StackTraceElement {
446        /// Creates a new default instance.
447        pub fn new() -> Self {
448            std::default::Default::default()
449        }
450
451        /// Sets the value of [step][crate::model::execution::StackTraceElement::step].
452        ///
453        /// # Example
454        /// ```ignore,no_run
455        /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
456        /// let x = StackTraceElement::new().set_step("example");
457        /// ```
458        pub fn set_step<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
459            self.step = v.into();
460            self
461        }
462
463        /// Sets the value of [routine][crate::model::execution::StackTraceElement::routine].
464        ///
465        /// # Example
466        /// ```ignore,no_run
467        /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
468        /// let x = StackTraceElement::new().set_routine("example");
469        /// ```
470        pub fn set_routine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
471            self.routine = v.into();
472            self
473        }
474
475        /// Sets the value of [position][crate::model::execution::StackTraceElement::position].
476        ///
477        /// # Example
478        /// ```ignore,no_run
479        /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
480        /// use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
481        /// let x = StackTraceElement::new().set_position(Position::default()/* use setters */);
482        /// ```
483        pub fn set_position<T>(mut self, v: T) -> Self
484        where
485            T: std::convert::Into<crate::model::execution::stack_trace_element::Position>,
486        {
487            self.position = std::option::Option::Some(v.into());
488            self
489        }
490
491        /// Sets or clears the value of [position][crate::model::execution::StackTraceElement::position].
492        ///
493        /// # Example
494        /// ```ignore,no_run
495        /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
496        /// use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
497        /// let x = StackTraceElement::new().set_or_clear_position(Some(Position::default()/* use setters */));
498        /// let x = StackTraceElement::new().set_or_clear_position(None::<Position>);
499        /// ```
500        pub fn set_or_clear_position<T>(mut self, v: std::option::Option<T>) -> Self
501        where
502            T: std::convert::Into<crate::model::execution::stack_trace_element::Position>,
503        {
504            self.position = v.map(|x| x.into());
505            self
506        }
507    }
508
509    impl wkt::message::Message for StackTraceElement {
510        fn typename() -> &'static str {
511            "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTraceElement"
512        }
513    }
514
515    /// Defines additional types related to [StackTraceElement].
516    pub mod stack_trace_element {
517        #[allow(unused_imports)]
518        use super::*;
519
520        /// Position contains source position information about the stack trace
521        /// element such as line number, column number and length of the code block
522        /// in bytes.
523        #[derive(Clone, Default, PartialEq)]
524        #[non_exhaustive]
525        pub struct Position {
526            /// The source code line number the current instruction was generated from.
527            pub line: i64,
528
529            /// The source code column position (of the line) the current instruction
530            /// was generated from.
531            pub column: i64,
532
533            /// The number of bytes of source code making up this stack trace element.
534            pub length: i64,
535
536            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
537        }
538
539        impl Position {
540            /// Creates a new default instance.
541            pub fn new() -> Self {
542                std::default::Default::default()
543            }
544
545            /// Sets the value of [line][crate::model::execution::stack_trace_element::Position::line].
546            ///
547            /// # Example
548            /// ```ignore,no_run
549            /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
550            /// let x = Position::new().set_line(42);
551            /// ```
552            pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
553                self.line = v.into();
554                self
555            }
556
557            /// Sets the value of [column][crate::model::execution::stack_trace_element::Position::column].
558            ///
559            /// # Example
560            /// ```ignore,no_run
561            /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
562            /// let x = Position::new().set_column(42);
563            /// ```
564            pub fn set_column<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
565                self.column = v.into();
566                self
567            }
568
569            /// Sets the value of [length][crate::model::execution::stack_trace_element::Position::length].
570            ///
571            /// # Example
572            /// ```ignore,no_run
573            /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
574            /// let x = Position::new().set_length(42);
575            /// ```
576            pub fn set_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
577                self.length = v.into();
578                self
579            }
580        }
581
582        impl wkt::message::Message for Position {
583            fn typename() -> &'static str {
584                "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position"
585            }
586        }
587    }
588
589    /// A collection of stack elements (frames) where an error occurred.
590    #[derive(Clone, Default, PartialEq)]
591    #[non_exhaustive]
592    pub struct StackTrace {
593        /// An array of stack elements.
594        pub elements: std::vec::Vec<crate::model::execution::StackTraceElement>,
595
596        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
597    }
598
599    impl StackTrace {
600        /// Creates a new default instance.
601        pub fn new() -> Self {
602            std::default::Default::default()
603        }
604
605        /// Sets the value of [elements][crate::model::execution::StackTrace::elements].
606        ///
607        /// # Example
608        /// ```ignore,no_run
609        /// # use google_cloud_workflows_executions_v1::model::execution::StackTrace;
610        /// use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
611        /// let x = StackTrace::new()
612        ///     .set_elements([
613        ///         StackTraceElement::default()/* use setters */,
614        ///         StackTraceElement::default()/* use (different) setters */,
615        ///     ]);
616        /// ```
617        pub fn set_elements<T, V>(mut self, v: T) -> Self
618        where
619            T: std::iter::IntoIterator<Item = V>,
620            V: std::convert::Into<crate::model::execution::StackTraceElement>,
621        {
622            use std::iter::Iterator;
623            self.elements = v.into_iter().map(|i| i.into()).collect();
624            self
625        }
626    }
627
628    impl wkt::message::Message for StackTrace {
629        fn typename() -> &'static str {
630            "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTrace"
631        }
632    }
633
634    /// Error describes why the execution was abnormally terminated.
635    #[derive(Clone, Default, PartialEq)]
636    #[non_exhaustive]
637    pub struct Error {
638        /// Error message and data returned represented as a JSON string.
639        pub payload: std::string::String,
640
641        /// Human-readable stack trace string.
642        pub context: std::string::String,
643
644        /// Stack trace with detailed information of where error was generated.
645        pub stack_trace: std::option::Option<crate::model::execution::StackTrace>,
646
647        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
648    }
649
650    impl Error {
651        /// Creates a new default instance.
652        pub fn new() -> Self {
653            std::default::Default::default()
654        }
655
656        /// Sets the value of [payload][crate::model::execution::Error::payload].
657        ///
658        /// # Example
659        /// ```ignore,no_run
660        /// # use google_cloud_workflows_executions_v1::model::execution::Error;
661        /// let x = Error::new().set_payload("example");
662        /// ```
663        pub fn set_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
664            self.payload = v.into();
665            self
666        }
667
668        /// Sets the value of [context][crate::model::execution::Error::context].
669        ///
670        /// # Example
671        /// ```ignore,no_run
672        /// # use google_cloud_workflows_executions_v1::model::execution::Error;
673        /// let x = Error::new().set_context("example");
674        /// ```
675        pub fn set_context<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
676            self.context = v.into();
677            self
678        }
679
680        /// Sets the value of [stack_trace][crate::model::execution::Error::stack_trace].
681        ///
682        /// # Example
683        /// ```ignore,no_run
684        /// # use google_cloud_workflows_executions_v1::model::execution::Error;
685        /// use google_cloud_workflows_executions_v1::model::execution::StackTrace;
686        /// let x = Error::new().set_stack_trace(StackTrace::default()/* use setters */);
687        /// ```
688        pub fn set_stack_trace<T>(mut self, v: T) -> Self
689        where
690            T: std::convert::Into<crate::model::execution::StackTrace>,
691        {
692            self.stack_trace = std::option::Option::Some(v.into());
693            self
694        }
695
696        /// Sets or clears the value of [stack_trace][crate::model::execution::Error::stack_trace].
697        ///
698        /// # Example
699        /// ```ignore,no_run
700        /// # use google_cloud_workflows_executions_v1::model::execution::Error;
701        /// use google_cloud_workflows_executions_v1::model::execution::StackTrace;
702        /// let x = Error::new().set_or_clear_stack_trace(Some(StackTrace::default()/* use setters */));
703        /// let x = Error::new().set_or_clear_stack_trace(None::<StackTrace>);
704        /// ```
705        pub fn set_or_clear_stack_trace<T>(mut self, v: std::option::Option<T>) -> Self
706        where
707            T: std::convert::Into<crate::model::execution::StackTrace>,
708        {
709            self.stack_trace = v.map(|x| x.into());
710            self
711        }
712    }
713
714    impl wkt::message::Message for Error {
715        fn typename() -> &'static str {
716            "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Error"
717        }
718    }
719
720    /// Represents the current status of this execution.
721    #[derive(Clone, Default, PartialEq)]
722    #[non_exhaustive]
723    pub struct Status {
724        /// A list of currently executing or last executed step names for the
725        /// workflow execution currently running. If the workflow has succeeded or
726        /// failed, this is the last attempted or executed step. Presently, if the
727        /// current step is inside a subworkflow, the list only includes that step.
728        /// In the future, the list will contain items for each step in the call
729        /// stack, starting with the outermost step in the `main` subworkflow, and
730        /// ending with the most deeply nested step.
731        pub current_steps: std::vec::Vec<crate::model::execution::status::Step>,
732
733        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
734    }
735
736    impl Status {
737        /// Creates a new default instance.
738        pub fn new() -> Self {
739            std::default::Default::default()
740        }
741
742        /// Sets the value of [current_steps][crate::model::execution::Status::current_steps].
743        ///
744        /// # Example
745        /// ```ignore,no_run
746        /// # use google_cloud_workflows_executions_v1::model::execution::Status;
747        /// use google_cloud_workflows_executions_v1::model::execution::status::Step;
748        /// let x = Status::new()
749        ///     .set_current_steps([
750        ///         Step::default()/* use setters */,
751        ///         Step::default()/* use (different) setters */,
752        ///     ]);
753        /// ```
754        pub fn set_current_steps<T, V>(mut self, v: T) -> Self
755        where
756            T: std::iter::IntoIterator<Item = V>,
757            V: std::convert::Into<crate::model::execution::status::Step>,
758        {
759            use std::iter::Iterator;
760            self.current_steps = v.into_iter().map(|i| i.into()).collect();
761            self
762        }
763    }
764
765    impl wkt::message::Message for Status {
766        fn typename() -> &'static str {
767            "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Status"
768        }
769    }
770
771    /// Defines additional types related to [Status].
772    pub mod status {
773        #[allow(unused_imports)]
774        use super::*;
775
776        /// Represents a step of the workflow this execution is running.
777        #[derive(Clone, Default, PartialEq)]
778        #[non_exhaustive]
779        pub struct Step {
780            /// Name of a routine within the workflow.
781            pub routine: std::string::String,
782
783            /// Name of a step within the routine.
784            pub step: std::string::String,
785
786            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
787        }
788
789        impl Step {
790            /// Creates a new default instance.
791            pub fn new() -> Self {
792                std::default::Default::default()
793            }
794
795            /// Sets the value of [routine][crate::model::execution::status::Step::routine].
796            ///
797            /// # Example
798            /// ```ignore,no_run
799            /// # use google_cloud_workflows_executions_v1::model::execution::status::Step;
800            /// let x = Step::new().set_routine("example");
801            /// ```
802            pub fn set_routine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
803                self.routine = v.into();
804                self
805            }
806
807            /// Sets the value of [step][crate::model::execution::status::Step::step].
808            ///
809            /// # Example
810            /// ```ignore,no_run
811            /// # use google_cloud_workflows_executions_v1::model::execution::status::Step;
812            /// let x = Step::new().set_step("example");
813            /// ```
814            pub fn set_step<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
815                self.step = v.into();
816                self
817            }
818        }
819
820        impl wkt::message::Message for Step {
821            fn typename() -> &'static str {
822                "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Status.Step"
823            }
824        }
825    }
826
827    /// Describes an error related to the current state of the Execution resource.
828    #[derive(Clone, Default, PartialEq)]
829    #[non_exhaustive]
830    pub struct StateError {
831        /// Provides specifics about the error.
832        pub details: std::string::String,
833
834        /// The type of this state error.
835        pub r#type: crate::model::execution::state_error::Type,
836
837        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
838    }
839
840    impl StateError {
841        /// Creates a new default instance.
842        pub fn new() -> Self {
843            std::default::Default::default()
844        }
845
846        /// Sets the value of [details][crate::model::execution::StateError::details].
847        ///
848        /// # Example
849        /// ```ignore,no_run
850        /// # use google_cloud_workflows_executions_v1::model::execution::StateError;
851        /// let x = StateError::new().set_details("example");
852        /// ```
853        pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
854            self.details = v.into();
855            self
856        }
857
858        /// Sets the value of [r#type][crate::model::execution::StateError::type].
859        ///
860        /// # Example
861        /// ```ignore,no_run
862        /// # use google_cloud_workflows_executions_v1::model::execution::StateError;
863        /// use google_cloud_workflows_executions_v1::model::execution::state_error::Type;
864        /// let x0 = StateError::new().set_type(Type::KmsError);
865        /// ```
866        pub fn set_type<T: std::convert::Into<crate::model::execution::state_error::Type>>(
867            mut self,
868            v: T,
869        ) -> Self {
870            self.r#type = v.into();
871            self
872        }
873    }
874
875    impl wkt::message::Message for StateError {
876        fn typename() -> &'static str {
877            "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StateError"
878        }
879    }
880
881    /// Defines additional types related to [StateError].
882    pub mod state_error {
883        #[allow(unused_imports)]
884        use super::*;
885
886        /// Describes the possible types of a state error.
887        ///
888        /// # Working with unknown values
889        ///
890        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
891        /// additional enum variants at any time. Adding new variants is not considered
892        /// a breaking change. Applications should write their code in anticipation of:
893        ///
894        /// - New values appearing in future releases of the client library, **and**
895        /// - New values received dynamically, without application changes.
896        ///
897        /// Please consult the [Working with enums] section in the user guide for some
898        /// guidelines.
899        ///
900        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
901        #[derive(Clone, Debug, PartialEq)]
902        #[non_exhaustive]
903        pub enum Type {
904            /// No type specified.
905            Unspecified,
906            /// Caused by an issue with KMS.
907            KmsError,
908            /// If set, the enum was initialized with an unknown value.
909            ///
910            /// Applications can examine the value using [Type::value] or
911            /// [Type::name].
912            UnknownValue(r#type::UnknownValue),
913        }
914
915        #[doc(hidden)]
916        pub mod r#type {
917            #[allow(unused_imports)]
918            use super::*;
919            #[derive(Clone, Debug, PartialEq)]
920            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
921        }
922
923        impl Type {
924            /// Gets the enum value.
925            ///
926            /// Returns `None` if the enum contains an unknown value deserialized from
927            /// the string representation of enums.
928            pub fn value(&self) -> std::option::Option<i32> {
929                match self {
930                    Self::Unspecified => std::option::Option::Some(0),
931                    Self::KmsError => std::option::Option::Some(1),
932                    Self::UnknownValue(u) => u.0.value(),
933                }
934            }
935
936            /// Gets the enum value as a string.
937            ///
938            /// Returns `None` if the enum contains an unknown value deserialized from
939            /// the integer representation of enums.
940            pub fn name(&self) -> std::option::Option<&str> {
941                match self {
942                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
943                    Self::KmsError => std::option::Option::Some("KMS_ERROR"),
944                    Self::UnknownValue(u) => u.0.name(),
945                }
946            }
947        }
948
949        impl std::default::Default for Type {
950            fn default() -> Self {
951                use std::convert::From;
952                Self::from(0)
953            }
954        }
955
956        impl std::fmt::Display for Type {
957            fn fmt(
958                &self,
959                f: &mut std::fmt::Formatter<'_>,
960            ) -> std::result::Result<(), std::fmt::Error> {
961                wkt::internal::display_enum(f, self.name(), self.value())
962            }
963        }
964
965        impl std::convert::From<i32> for Type {
966            fn from(value: i32) -> Self {
967                match value {
968                    0 => Self::Unspecified,
969                    1 => Self::KmsError,
970                    _ => Self::UnknownValue(r#type::UnknownValue(
971                        wkt::internal::UnknownEnumValue::Integer(value),
972                    )),
973                }
974            }
975        }
976
977        impl std::convert::From<&str> for Type {
978            fn from(value: &str) -> Self {
979                use std::string::ToString;
980                match value {
981                    "TYPE_UNSPECIFIED" => Self::Unspecified,
982                    "KMS_ERROR" => Self::KmsError,
983                    _ => Self::UnknownValue(r#type::UnknownValue(
984                        wkt::internal::UnknownEnumValue::String(value.to_string()),
985                    )),
986                }
987            }
988        }
989
990        impl serde::ser::Serialize for Type {
991            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
992            where
993                S: serde::Serializer,
994            {
995                match self {
996                    Self::Unspecified => serializer.serialize_i32(0),
997                    Self::KmsError => serializer.serialize_i32(1),
998                    Self::UnknownValue(u) => u.0.serialize(serializer),
999                }
1000            }
1001        }
1002
1003        impl<'de> serde::de::Deserialize<'de> for Type {
1004            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1005            where
1006                D: serde::Deserializer<'de>,
1007            {
1008                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1009                    ".google.cloud.workflows.executions.v1.Execution.StateError.Type",
1010                ))
1011            }
1012        }
1013    }
1014
1015    /// Describes the current state of the execution. More states might be added
1016    /// in the future.
1017    ///
1018    /// # Working with unknown values
1019    ///
1020    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1021    /// additional enum variants at any time. Adding new variants is not considered
1022    /// a breaking change. Applications should write their code in anticipation of:
1023    ///
1024    /// - New values appearing in future releases of the client library, **and**
1025    /// - New values received dynamically, without application changes.
1026    ///
1027    /// Please consult the [Working with enums] section in the user guide for some
1028    /// guidelines.
1029    ///
1030    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1031    #[derive(Clone, Debug, PartialEq)]
1032    #[non_exhaustive]
1033    pub enum State {
1034        /// Invalid state.
1035        Unspecified,
1036        /// The execution is in progress.
1037        Active,
1038        /// The execution finished successfully.
1039        Succeeded,
1040        /// The execution failed with an error.
1041        Failed,
1042        /// The execution was stopped intentionally.
1043        Cancelled,
1044        /// Execution data is unavailable. See the `state_error` field.
1045        Unavailable,
1046        /// Request has been placed in the backlog for processing at a later time.
1047        Queued,
1048        /// If set, the enum was initialized with an unknown value.
1049        ///
1050        /// Applications can examine the value using [State::value] or
1051        /// [State::name].
1052        UnknownValue(state::UnknownValue),
1053    }
1054
1055    #[doc(hidden)]
1056    pub mod state {
1057        #[allow(unused_imports)]
1058        use super::*;
1059        #[derive(Clone, Debug, PartialEq)]
1060        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1061    }
1062
1063    impl State {
1064        /// Gets the enum value.
1065        ///
1066        /// Returns `None` if the enum contains an unknown value deserialized from
1067        /// the string representation of enums.
1068        pub fn value(&self) -> std::option::Option<i32> {
1069            match self {
1070                Self::Unspecified => std::option::Option::Some(0),
1071                Self::Active => std::option::Option::Some(1),
1072                Self::Succeeded => std::option::Option::Some(2),
1073                Self::Failed => std::option::Option::Some(3),
1074                Self::Cancelled => std::option::Option::Some(4),
1075                Self::Unavailable => std::option::Option::Some(5),
1076                Self::Queued => std::option::Option::Some(6),
1077                Self::UnknownValue(u) => u.0.value(),
1078            }
1079        }
1080
1081        /// Gets the enum value as a string.
1082        ///
1083        /// Returns `None` if the enum contains an unknown value deserialized from
1084        /// the integer representation of enums.
1085        pub fn name(&self) -> std::option::Option<&str> {
1086            match self {
1087                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1088                Self::Active => std::option::Option::Some("ACTIVE"),
1089                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1090                Self::Failed => std::option::Option::Some("FAILED"),
1091                Self::Cancelled => std::option::Option::Some("CANCELLED"),
1092                Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
1093                Self::Queued => std::option::Option::Some("QUEUED"),
1094                Self::UnknownValue(u) => u.0.name(),
1095            }
1096        }
1097    }
1098
1099    impl std::default::Default for State {
1100        fn default() -> Self {
1101            use std::convert::From;
1102            Self::from(0)
1103        }
1104    }
1105
1106    impl std::fmt::Display for State {
1107        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1108            wkt::internal::display_enum(f, self.name(), self.value())
1109        }
1110    }
1111
1112    impl std::convert::From<i32> for State {
1113        fn from(value: i32) -> Self {
1114            match value {
1115                0 => Self::Unspecified,
1116                1 => Self::Active,
1117                2 => Self::Succeeded,
1118                3 => Self::Failed,
1119                4 => Self::Cancelled,
1120                5 => Self::Unavailable,
1121                6 => Self::Queued,
1122                _ => Self::UnknownValue(state::UnknownValue(
1123                    wkt::internal::UnknownEnumValue::Integer(value),
1124                )),
1125            }
1126        }
1127    }
1128
1129    impl std::convert::From<&str> for State {
1130        fn from(value: &str) -> Self {
1131            use std::string::ToString;
1132            match value {
1133                "STATE_UNSPECIFIED" => Self::Unspecified,
1134                "ACTIVE" => Self::Active,
1135                "SUCCEEDED" => Self::Succeeded,
1136                "FAILED" => Self::Failed,
1137                "CANCELLED" => Self::Cancelled,
1138                "UNAVAILABLE" => Self::Unavailable,
1139                "QUEUED" => Self::Queued,
1140                _ => Self::UnknownValue(state::UnknownValue(
1141                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1142                )),
1143            }
1144        }
1145    }
1146
1147    impl serde::ser::Serialize for State {
1148        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1149        where
1150            S: serde::Serializer,
1151        {
1152            match self {
1153                Self::Unspecified => serializer.serialize_i32(0),
1154                Self::Active => serializer.serialize_i32(1),
1155                Self::Succeeded => serializer.serialize_i32(2),
1156                Self::Failed => serializer.serialize_i32(3),
1157                Self::Cancelled => serializer.serialize_i32(4),
1158                Self::Unavailable => serializer.serialize_i32(5),
1159                Self::Queued => serializer.serialize_i32(6),
1160                Self::UnknownValue(u) => u.0.serialize(serializer),
1161            }
1162        }
1163    }
1164
1165    impl<'de> serde::de::Deserialize<'de> for State {
1166        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1167        where
1168            D: serde::Deserializer<'de>,
1169        {
1170            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1171                ".google.cloud.workflows.executions.v1.Execution.State",
1172            ))
1173        }
1174    }
1175
1176    /// Describes the level of platform logging to apply to calls and call
1177    /// responses during workflow executions.
1178    ///
1179    /// # Working with unknown values
1180    ///
1181    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1182    /// additional enum variants at any time. Adding new variants is not considered
1183    /// a breaking change. Applications should write their code in anticipation of:
1184    ///
1185    /// - New values appearing in future releases of the client library, **and**
1186    /// - New values received dynamically, without application changes.
1187    ///
1188    /// Please consult the [Working with enums] section in the user guide for some
1189    /// guidelines.
1190    ///
1191    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1192    #[derive(Clone, Debug, PartialEq)]
1193    #[non_exhaustive]
1194    pub enum CallLogLevel {
1195        /// No call logging level specified.
1196        Unspecified,
1197        /// Log all call steps within workflows, all call returns, and all exceptions
1198        /// raised.
1199        LogAllCalls,
1200        /// Log only exceptions that are raised from call steps within workflows.
1201        LogErrorsOnly,
1202        /// Explicitly log nothing.
1203        LogNone,
1204        /// If set, the enum was initialized with an unknown value.
1205        ///
1206        /// Applications can examine the value using [CallLogLevel::value] or
1207        /// [CallLogLevel::name].
1208        UnknownValue(call_log_level::UnknownValue),
1209    }
1210
1211    #[doc(hidden)]
1212    pub mod call_log_level {
1213        #[allow(unused_imports)]
1214        use super::*;
1215        #[derive(Clone, Debug, PartialEq)]
1216        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1217    }
1218
1219    impl CallLogLevel {
1220        /// Gets the enum value.
1221        ///
1222        /// Returns `None` if the enum contains an unknown value deserialized from
1223        /// the string representation of enums.
1224        pub fn value(&self) -> std::option::Option<i32> {
1225            match self {
1226                Self::Unspecified => std::option::Option::Some(0),
1227                Self::LogAllCalls => std::option::Option::Some(1),
1228                Self::LogErrorsOnly => std::option::Option::Some(2),
1229                Self::LogNone => std::option::Option::Some(3),
1230                Self::UnknownValue(u) => u.0.value(),
1231            }
1232        }
1233
1234        /// Gets the enum value as a string.
1235        ///
1236        /// Returns `None` if the enum contains an unknown value deserialized from
1237        /// the integer representation of enums.
1238        pub fn name(&self) -> std::option::Option<&str> {
1239            match self {
1240                Self::Unspecified => std::option::Option::Some("CALL_LOG_LEVEL_UNSPECIFIED"),
1241                Self::LogAllCalls => std::option::Option::Some("LOG_ALL_CALLS"),
1242                Self::LogErrorsOnly => std::option::Option::Some("LOG_ERRORS_ONLY"),
1243                Self::LogNone => std::option::Option::Some("LOG_NONE"),
1244                Self::UnknownValue(u) => u.0.name(),
1245            }
1246        }
1247    }
1248
1249    impl std::default::Default for CallLogLevel {
1250        fn default() -> Self {
1251            use std::convert::From;
1252            Self::from(0)
1253        }
1254    }
1255
1256    impl std::fmt::Display for CallLogLevel {
1257        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1258            wkt::internal::display_enum(f, self.name(), self.value())
1259        }
1260    }
1261
1262    impl std::convert::From<i32> for CallLogLevel {
1263        fn from(value: i32) -> Self {
1264            match value {
1265                0 => Self::Unspecified,
1266                1 => Self::LogAllCalls,
1267                2 => Self::LogErrorsOnly,
1268                3 => Self::LogNone,
1269                _ => Self::UnknownValue(call_log_level::UnknownValue(
1270                    wkt::internal::UnknownEnumValue::Integer(value),
1271                )),
1272            }
1273        }
1274    }
1275
1276    impl std::convert::From<&str> for CallLogLevel {
1277        fn from(value: &str) -> Self {
1278            use std::string::ToString;
1279            match value {
1280                "CALL_LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
1281                "LOG_ALL_CALLS" => Self::LogAllCalls,
1282                "LOG_ERRORS_ONLY" => Self::LogErrorsOnly,
1283                "LOG_NONE" => Self::LogNone,
1284                _ => Self::UnknownValue(call_log_level::UnknownValue(
1285                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1286                )),
1287            }
1288        }
1289    }
1290
1291    impl serde::ser::Serialize for CallLogLevel {
1292        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1293        where
1294            S: serde::Serializer,
1295        {
1296            match self {
1297                Self::Unspecified => serializer.serialize_i32(0),
1298                Self::LogAllCalls => serializer.serialize_i32(1),
1299                Self::LogErrorsOnly => serializer.serialize_i32(2),
1300                Self::LogNone => serializer.serialize_i32(3),
1301                Self::UnknownValue(u) => u.0.serialize(serializer),
1302            }
1303        }
1304    }
1305
1306    impl<'de> serde::de::Deserialize<'de> for CallLogLevel {
1307        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1308        where
1309            D: serde::Deserializer<'de>,
1310        {
1311            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CallLogLevel>::new(
1312                ".google.cloud.workflows.executions.v1.Execution.CallLogLevel",
1313            ))
1314        }
1315    }
1316}
1317
1318/// Request for the
1319/// [ListExecutions][]
1320/// method.
1321#[derive(Clone, Default, PartialEq)]
1322#[non_exhaustive]
1323pub struct ListExecutionsRequest {
1324    /// Required. Name of the workflow for which the executions should be listed.
1325    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1326    pub parent: std::string::String,
1327
1328    /// Maximum number of executions to return per call.
1329    /// Max supported value depends on the selected Execution view: it's 1000 for
1330    /// BASIC and 100 for FULL. The default value used if the field is not
1331    /// specified is 100, regardless of the selected view. Values greater than
1332    /// the max value will be coerced down to it.
1333    pub page_size: i32,
1334
1335    /// A page token, received from a previous `ListExecutions` call.
1336    /// Provide this to retrieve the subsequent page.
1337    ///
1338    /// When paginating, all other parameters provided to `ListExecutions` must
1339    /// match the call that provided the page token.
1340    ///
1341    /// Note that pagination is applied to dynamic data. The list of executions
1342    /// returned can change between page requests.
1343    pub page_token: std::string::String,
1344
1345    /// Optional. A view defining which fields should be filled in the returned
1346    /// executions. The API will default to the BASIC view.
1347    pub view: crate::model::ExecutionView,
1348
1349    /// Optional. Filters applied to the [Executions.ListExecutions] results.
1350    /// The following fields are supported for filtering:
1351    /// executionID, state, startTime, endTime, duration, workflowRevisionID,
1352    /// stepName, and label.
1353    pub filter: std::string::String,
1354
1355    /// Optional. The ordering applied to the [Executions.ListExecutions] results.
1356    /// By default the ordering is based on descending start time.
1357    /// The following fields are supported for order by:
1358    /// executionID, startTime, endTime, duration, state, and workflowRevisionID.
1359    pub order_by: std::string::String,
1360
1361    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1362}
1363
1364impl ListExecutionsRequest {
1365    /// Creates a new default instance.
1366    pub fn new() -> Self {
1367        std::default::Default::default()
1368    }
1369
1370    /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
1371    ///
1372    /// # Example
1373    /// ```ignore,no_run
1374    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1375    /// let x = ListExecutionsRequest::new().set_parent("example");
1376    /// ```
1377    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1378        self.parent = v.into();
1379        self
1380    }
1381
1382    /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
1383    ///
1384    /// # Example
1385    /// ```ignore,no_run
1386    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1387    /// let x = ListExecutionsRequest::new().set_page_size(42);
1388    /// ```
1389    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1390        self.page_size = v.into();
1391        self
1392    }
1393
1394    /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
1395    ///
1396    /// # Example
1397    /// ```ignore,no_run
1398    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1399    /// let x = ListExecutionsRequest::new().set_page_token("example");
1400    /// ```
1401    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1402        self.page_token = v.into();
1403        self
1404    }
1405
1406    /// Sets the value of [view][crate::model::ListExecutionsRequest::view].
1407    ///
1408    /// # Example
1409    /// ```ignore,no_run
1410    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1411    /// use google_cloud_workflows_executions_v1::model::ExecutionView;
1412    /// let x0 = ListExecutionsRequest::new().set_view(ExecutionView::Basic);
1413    /// let x1 = ListExecutionsRequest::new().set_view(ExecutionView::Full);
1414    /// ```
1415    pub fn set_view<T: std::convert::Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
1416        self.view = v.into();
1417        self
1418    }
1419
1420    /// Sets the value of [filter][crate::model::ListExecutionsRequest::filter].
1421    ///
1422    /// # Example
1423    /// ```ignore,no_run
1424    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1425    /// let x = ListExecutionsRequest::new().set_filter("example");
1426    /// ```
1427    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1428        self.filter = v.into();
1429        self
1430    }
1431
1432    /// Sets the value of [order_by][crate::model::ListExecutionsRequest::order_by].
1433    ///
1434    /// # Example
1435    /// ```ignore,no_run
1436    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1437    /// let x = ListExecutionsRequest::new().set_order_by("example");
1438    /// ```
1439    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1440        self.order_by = v.into();
1441        self
1442    }
1443}
1444
1445impl wkt::message::Message for ListExecutionsRequest {
1446    fn typename() -> &'static str {
1447        "type.googleapis.com/google.cloud.workflows.executions.v1.ListExecutionsRequest"
1448    }
1449}
1450
1451/// Response for the
1452/// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions]
1453/// method.
1454///
1455/// [google.cloud.workflows.executions.v1.Executions.ListExecutions]: crate::client::Executions::list_executions
1456#[derive(Clone, Default, PartialEq)]
1457#[non_exhaustive]
1458pub struct ListExecutionsResponse {
1459    /// The executions which match the request.
1460    pub executions: std::vec::Vec<crate::model::Execution>,
1461
1462    /// A token, which can be sent as `page_token` to retrieve the next page.
1463    /// If this field is omitted, there are no subsequent pages.
1464    pub next_page_token: std::string::String,
1465
1466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1467}
1468
1469impl ListExecutionsResponse {
1470    /// Creates a new default instance.
1471    pub fn new() -> Self {
1472        std::default::Default::default()
1473    }
1474
1475    /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
1476    ///
1477    /// # Example
1478    /// ```ignore,no_run
1479    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsResponse;
1480    /// use google_cloud_workflows_executions_v1::model::Execution;
1481    /// let x = ListExecutionsResponse::new()
1482    ///     .set_executions([
1483    ///         Execution::default()/* use setters */,
1484    ///         Execution::default()/* use (different) setters */,
1485    ///     ]);
1486    /// ```
1487    pub fn set_executions<T, V>(mut self, v: T) -> Self
1488    where
1489        T: std::iter::IntoIterator<Item = V>,
1490        V: std::convert::Into<crate::model::Execution>,
1491    {
1492        use std::iter::Iterator;
1493        self.executions = v.into_iter().map(|i| i.into()).collect();
1494        self
1495    }
1496
1497    /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
1498    ///
1499    /// # Example
1500    /// ```ignore,no_run
1501    /// # use google_cloud_workflows_executions_v1::model::ListExecutionsResponse;
1502    /// let x = ListExecutionsResponse::new().set_next_page_token("example");
1503    /// ```
1504    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1505        self.next_page_token = v.into();
1506        self
1507    }
1508}
1509
1510impl wkt::message::Message for ListExecutionsResponse {
1511    fn typename() -> &'static str {
1512        "type.googleapis.com/google.cloud.workflows.executions.v1.ListExecutionsResponse"
1513    }
1514}
1515
1516#[doc(hidden)]
1517impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
1518    type PageItem = crate::model::Execution;
1519
1520    fn items(self) -> std::vec::Vec<Self::PageItem> {
1521        self.executions
1522    }
1523
1524    fn next_page_token(&self) -> std::string::String {
1525        use std::clone::Clone;
1526        self.next_page_token.clone()
1527    }
1528}
1529
1530/// Request for the
1531/// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution]
1532/// method.
1533///
1534/// [google.cloud.workflows.executions.v1.Executions.CreateExecution]: crate::client::Executions::create_execution
1535#[derive(Clone, Default, PartialEq)]
1536#[non_exhaustive]
1537pub struct CreateExecutionRequest {
1538    /// Required. Name of the workflow for which an execution should be created.
1539    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1540    /// The latest revision of the workflow will be used.
1541    pub parent: std::string::String,
1542
1543    /// Required. Execution to be created.
1544    pub execution: std::option::Option<crate::model::Execution>,
1545
1546    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1547}
1548
1549impl CreateExecutionRequest {
1550    /// Creates a new default instance.
1551    pub fn new() -> Self {
1552        std::default::Default::default()
1553    }
1554
1555    /// Sets the value of [parent][crate::model::CreateExecutionRequest::parent].
1556    ///
1557    /// # Example
1558    /// ```ignore,no_run
1559    /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1560    /// let x = CreateExecutionRequest::new().set_parent("example");
1561    /// ```
1562    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1563        self.parent = v.into();
1564        self
1565    }
1566
1567    /// Sets the value of [execution][crate::model::CreateExecutionRequest::execution].
1568    ///
1569    /// # Example
1570    /// ```ignore,no_run
1571    /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1572    /// use google_cloud_workflows_executions_v1::model::Execution;
1573    /// let x = CreateExecutionRequest::new().set_execution(Execution::default()/* use setters */);
1574    /// ```
1575    pub fn set_execution<T>(mut self, v: T) -> Self
1576    where
1577        T: std::convert::Into<crate::model::Execution>,
1578    {
1579        self.execution = std::option::Option::Some(v.into());
1580        self
1581    }
1582
1583    /// Sets or clears the value of [execution][crate::model::CreateExecutionRequest::execution].
1584    ///
1585    /// # Example
1586    /// ```ignore,no_run
1587    /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1588    /// use google_cloud_workflows_executions_v1::model::Execution;
1589    /// let x = CreateExecutionRequest::new().set_or_clear_execution(Some(Execution::default()/* use setters */));
1590    /// let x = CreateExecutionRequest::new().set_or_clear_execution(None::<Execution>);
1591    /// ```
1592    pub fn set_or_clear_execution<T>(mut self, v: std::option::Option<T>) -> Self
1593    where
1594        T: std::convert::Into<crate::model::Execution>,
1595    {
1596        self.execution = v.map(|x| x.into());
1597        self
1598    }
1599}
1600
1601impl wkt::message::Message for CreateExecutionRequest {
1602    fn typename() -> &'static str {
1603        "type.googleapis.com/google.cloud.workflows.executions.v1.CreateExecutionRequest"
1604    }
1605}
1606
1607/// Request for the
1608/// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution]
1609/// method.
1610///
1611/// [google.cloud.workflows.executions.v1.Executions.GetExecution]: crate::client::Executions::get_execution
1612#[derive(Clone, Default, PartialEq)]
1613#[non_exhaustive]
1614pub struct GetExecutionRequest {
1615    /// Required. Name of the execution to be retrieved.
1616    /// Format:
1617    /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
1618    pub name: std::string::String,
1619
1620    /// Optional. A view defining which fields should be filled in the returned
1621    /// execution. The API will default to the FULL view.
1622    pub view: crate::model::ExecutionView,
1623
1624    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1625}
1626
1627impl GetExecutionRequest {
1628    /// Creates a new default instance.
1629    pub fn new() -> Self {
1630        std::default::Default::default()
1631    }
1632
1633    /// Sets the value of [name][crate::model::GetExecutionRequest::name].
1634    ///
1635    /// # Example
1636    /// ```ignore,no_run
1637    /// # use google_cloud_workflows_executions_v1::model::GetExecutionRequest;
1638    /// # let project_id = "project_id";
1639    /// # let location_id = "location_id";
1640    /// # let workflow_id = "workflow_id";
1641    /// # let execution_id = "execution_id";
1642    /// let x = GetExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}/executions/{execution_id}"));
1643    /// ```
1644    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1645        self.name = v.into();
1646        self
1647    }
1648
1649    /// Sets the value of [view][crate::model::GetExecutionRequest::view].
1650    ///
1651    /// # Example
1652    /// ```ignore,no_run
1653    /// # use google_cloud_workflows_executions_v1::model::GetExecutionRequest;
1654    /// use google_cloud_workflows_executions_v1::model::ExecutionView;
1655    /// let x0 = GetExecutionRequest::new().set_view(ExecutionView::Basic);
1656    /// let x1 = GetExecutionRequest::new().set_view(ExecutionView::Full);
1657    /// ```
1658    pub fn set_view<T: std::convert::Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
1659        self.view = v.into();
1660        self
1661    }
1662}
1663
1664impl wkt::message::Message for GetExecutionRequest {
1665    fn typename() -> &'static str {
1666        "type.googleapis.com/google.cloud.workflows.executions.v1.GetExecutionRequest"
1667    }
1668}
1669
1670/// Request for the
1671/// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution]
1672/// method.
1673///
1674/// [google.cloud.workflows.executions.v1.Executions.CancelExecution]: crate::client::Executions::cancel_execution
1675#[derive(Clone, Default, PartialEq)]
1676#[non_exhaustive]
1677pub struct CancelExecutionRequest {
1678    /// Required. Name of the execution to be cancelled.
1679    /// Format:
1680    /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
1681    pub name: std::string::String,
1682
1683    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1684}
1685
1686impl CancelExecutionRequest {
1687    /// Creates a new default instance.
1688    pub fn new() -> Self {
1689        std::default::Default::default()
1690    }
1691
1692    /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
1693    ///
1694    /// # Example
1695    /// ```ignore,no_run
1696    /// # use google_cloud_workflows_executions_v1::model::CancelExecutionRequest;
1697    /// # let project_id = "project_id";
1698    /// # let location_id = "location_id";
1699    /// # let workflow_id = "workflow_id";
1700    /// # let execution_id = "execution_id";
1701    /// let x = CancelExecutionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}/executions/{execution_id}"));
1702    /// ```
1703    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1704        self.name = v.into();
1705        self
1706    }
1707}
1708
1709impl wkt::message::Message for CancelExecutionRequest {
1710    fn typename() -> &'static str {
1711        "type.googleapis.com/google.cloud.workflows.executions.v1.CancelExecutionRequest"
1712    }
1713}
1714
1715/// Defines possible views for execution resource.
1716///
1717/// # Working with unknown values
1718///
1719/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1720/// additional enum variants at any time. Adding new variants is not considered
1721/// a breaking change. Applications should write their code in anticipation of:
1722///
1723/// - New values appearing in future releases of the client library, **and**
1724/// - New values received dynamically, without application changes.
1725///
1726/// Please consult the [Working with enums] section in the user guide for some
1727/// guidelines.
1728///
1729/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1730#[derive(Clone, Debug, PartialEq)]
1731#[non_exhaustive]
1732pub enum ExecutionView {
1733    /// The default / unset value.
1734    Unspecified,
1735    /// Includes only basic metadata about the execution.
1736    /// The following fields are returned: name, start_time, end_time, duration,
1737    /// state, and workflow_revision_id.
1738    Basic,
1739    /// Includes all data.
1740    Full,
1741    /// If set, the enum was initialized with an unknown value.
1742    ///
1743    /// Applications can examine the value using [ExecutionView::value] or
1744    /// [ExecutionView::name].
1745    UnknownValue(execution_view::UnknownValue),
1746}
1747
1748#[doc(hidden)]
1749pub mod execution_view {
1750    #[allow(unused_imports)]
1751    use super::*;
1752    #[derive(Clone, Debug, PartialEq)]
1753    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1754}
1755
1756impl ExecutionView {
1757    /// Gets the enum value.
1758    ///
1759    /// Returns `None` if the enum contains an unknown value deserialized from
1760    /// the string representation of enums.
1761    pub fn value(&self) -> std::option::Option<i32> {
1762        match self {
1763            Self::Unspecified => std::option::Option::Some(0),
1764            Self::Basic => std::option::Option::Some(1),
1765            Self::Full => std::option::Option::Some(2),
1766            Self::UnknownValue(u) => u.0.value(),
1767        }
1768    }
1769
1770    /// Gets the enum value as a string.
1771    ///
1772    /// Returns `None` if the enum contains an unknown value deserialized from
1773    /// the integer representation of enums.
1774    pub fn name(&self) -> std::option::Option<&str> {
1775        match self {
1776            Self::Unspecified => std::option::Option::Some("EXECUTION_VIEW_UNSPECIFIED"),
1777            Self::Basic => std::option::Option::Some("BASIC"),
1778            Self::Full => std::option::Option::Some("FULL"),
1779            Self::UnknownValue(u) => u.0.name(),
1780        }
1781    }
1782}
1783
1784impl std::default::Default for ExecutionView {
1785    fn default() -> Self {
1786        use std::convert::From;
1787        Self::from(0)
1788    }
1789}
1790
1791impl std::fmt::Display for ExecutionView {
1792    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1793        wkt::internal::display_enum(f, self.name(), self.value())
1794    }
1795}
1796
1797impl std::convert::From<i32> for ExecutionView {
1798    fn from(value: i32) -> Self {
1799        match value {
1800            0 => Self::Unspecified,
1801            1 => Self::Basic,
1802            2 => Self::Full,
1803            _ => Self::UnknownValue(execution_view::UnknownValue(
1804                wkt::internal::UnknownEnumValue::Integer(value),
1805            )),
1806        }
1807    }
1808}
1809
1810impl std::convert::From<&str> for ExecutionView {
1811    fn from(value: &str) -> Self {
1812        use std::string::ToString;
1813        match value {
1814            "EXECUTION_VIEW_UNSPECIFIED" => Self::Unspecified,
1815            "BASIC" => Self::Basic,
1816            "FULL" => Self::Full,
1817            _ => Self::UnknownValue(execution_view::UnknownValue(
1818                wkt::internal::UnknownEnumValue::String(value.to_string()),
1819            )),
1820        }
1821    }
1822}
1823
1824impl serde::ser::Serialize for ExecutionView {
1825    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1826    where
1827        S: serde::Serializer,
1828    {
1829        match self {
1830            Self::Unspecified => serializer.serialize_i32(0),
1831            Self::Basic => serializer.serialize_i32(1),
1832            Self::Full => serializer.serialize_i32(2),
1833            Self::UnknownValue(u) => u.0.serialize(serializer),
1834        }
1835    }
1836}
1837
1838impl<'de> serde::de::Deserialize<'de> for ExecutionView {
1839    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1840    where
1841        D: serde::Deserializer<'de>,
1842    {
1843        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionView>::new(
1844            ".google.cloud.workflows.executions.v1.ExecutionView",
1845        ))
1846    }
1847}