google_cloud_workflows_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#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::bare_urls)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gax;
25extern crate gaxi;
26extern crate lazy_static;
27extern crate location;
28extern crate longrunning;
29extern crate lro;
30extern crate reqwest;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38/// Workflow program to be executed by Workflows.
39#[serde_with::serde_as]
40#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
41#[serde(default, rename_all = "camelCase")]
42#[non_exhaustive]
43pub struct Workflow {
44    /// The resource name of the workflow.
45    /// Format: projects/{project}/locations/{location}/workflows/{workflow}.
46    /// This is a workflow-wide field and is not tied to a specific revision.
47    #[serde(skip_serializing_if = "std::string::String::is_empty")]
48    pub name: std::string::String,
49
50    /// Description of the workflow provided by the user.
51    /// Must be at most 1000 Unicode characters long.
52    /// This is a workflow-wide field and is not tied to a specific revision.
53    #[serde(skip_serializing_if = "std::string::String::is_empty")]
54    pub description: std::string::String,
55
56    /// Output only. State of the workflow deployment.
57    pub state: crate::model::workflow::State,
58
59    /// Output only. The revision of the workflow.
60    /// A new revision of a workflow is created as a result of updating the
61    /// following properties of a workflow:
62    ///
63    /// - [Service account][google.cloud.workflows.v1.Workflow.service_account]
64    /// - [Workflow code to be
65    ///   executed][google.cloud.workflows.v1.Workflow.source_contents]
66    ///
67    /// The format is "000001-a4d", where the first six characters define
68    /// the zero-padded revision ordinal number. They are followed by a hyphen and
69    /// three hexadecimal random characters.
70    ///
71    /// [google.cloud.workflows.v1.Workflow.service_account]: crate::model::Workflow::service_account
72    /// [google.cloud.workflows.v1.Workflow.source_contents]: crate::model::Workflow::source_code
73    #[serde(skip_serializing_if = "std::string::String::is_empty")]
74    pub revision_id: std::string::String,
75
76    /// Output only. The timestamp for when the workflow was created.
77    /// This is a workflow-wide field and is not tied to a specific revision.
78    #[serde(skip_serializing_if = "std::option::Option::is_none")]
79    pub create_time: std::option::Option<wkt::Timestamp>,
80
81    /// Output only. The timestamp for when the workflow was last updated.
82    /// This is a workflow-wide field and is not tied to a specific revision.
83    #[serde(skip_serializing_if = "std::option::Option::is_none")]
84    pub update_time: std::option::Option<wkt::Timestamp>,
85
86    /// Output only. The timestamp for the latest revision of the workflow's
87    /// creation.
88    #[serde(skip_serializing_if = "std::option::Option::is_none")]
89    pub revision_create_time: std::option::Option<wkt::Timestamp>,
90
91    /// Labels associated with this workflow.
92    /// Labels can contain at most 64 entries. Keys and values can be no longer
93    /// than 63 characters and can only contain lowercase letters, numeric
94    /// characters, underscores, and dashes. Label keys must start with a letter.
95    /// International characters are allowed.
96    /// This is a workflow-wide field and is not tied to a specific revision.
97    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
98    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
99
100    /// The service account associated with the latest workflow version.
101    /// This service account represents the identity of the workflow and determines
102    /// what permissions the workflow has.
103    /// Format: projects/{project}/serviceAccounts/{account} or {account}
104    ///
105    /// Using `-` as a wildcard for the `{project}` or not providing one at all
106    /// will infer the project from the account. The `{account}` value can be the
107    /// `email` address or the `unique_id` of the service account.
108    ///
109    /// If not provided, workflow will use the project's default service account.
110    /// Modifying this field for an existing workflow results in a new workflow
111    /// revision.
112    #[serde(skip_serializing_if = "std::string::String::is_empty")]
113    pub service_account: std::string::String,
114
115    /// Optional. The resource name of a KMS crypto key used to encrypt or decrypt
116    /// the data associated with the workflow.
117    ///
118    /// Format:
119    /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
120    ///
121    /// Using `-` as a wildcard for the `{project}` or not providing one at all
122    /// will infer the project from the account.
123    ///
124    /// If not provided, data associated with the workflow will not be
125    /// CMEK-encrypted.
126    #[serde(skip_serializing_if = "std::string::String::is_empty")]
127    pub crypto_key_name: std::string::String,
128
129    /// Output only. Error regarding the state of the workflow. For example, this
130    /// field will have error details if the execution data is unavailable due to
131    /// revoked KMS key permissions.
132    #[serde(skip_serializing_if = "std::option::Option::is_none")]
133    pub state_error: std::option::Option<crate::model::workflow::StateError>,
134
135    /// Optional. Describes the level of platform logging to apply to calls and
136    /// call responses during executions of this workflow. If both the workflow and
137    /// the execution specify a logging level, the execution level takes
138    /// precedence.
139    pub call_log_level: crate::model::workflow::CallLogLevel,
140
141    /// Optional. User-defined environment variables associated with this workflow
142    /// revision. This map has a maximum length of 20. Each string can take up to
143    /// 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or
144    /// "WORKFLOWS".
145    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
146    pub user_env_vars: std::collections::HashMap<std::string::String, std::string::String>,
147
148    /// Optional. Describes the execution history level to apply to this workflow.
149    pub execution_history_level: crate::model::ExecutionHistoryLevel,
150
151    /// Output only. A list of all KMS crypto keys used to encrypt or decrypt the
152    /// data associated with the workflow.
153    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
154    pub all_kms_keys: std::vec::Vec<std::string::String>,
155
156    /// Output only. A list of all KMS crypto key versions used to encrypt or
157    /// decrypt the data associated with the workflow.
158    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
159    pub all_kms_keys_versions: std::vec::Vec<std::string::String>,
160
161    /// Output only. The resource name of a KMS crypto key version used to encrypt
162    /// or decrypt the data associated with the workflow.
163    ///
164    /// Format:
165    /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}
166    #[serde(skip_serializing_if = "std::string::String::is_empty")]
167    pub crypto_key_version: std::string::String,
168
169    /// Optional. Input only. Immutable. Tags associated with this workflow.
170    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
171    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
172
173    /// Required. Location of the workflow source code.
174    /// Modifying this field for an existing workflow results in a new workflow
175    /// revision.
176    #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
177    pub source_code: std::option::Option<crate::model::workflow::SourceCode>,
178
179    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
180    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
181}
182
183impl Workflow {
184    pub fn new() -> Self {
185        std::default::Default::default()
186    }
187
188    /// Sets the value of [name][crate::model::Workflow::name].
189    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
190        self.name = v.into();
191        self
192    }
193
194    /// Sets the value of [description][crate::model::Workflow::description].
195    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
196        self.description = v.into();
197        self
198    }
199
200    /// Sets the value of [state][crate::model::Workflow::state].
201    pub fn set_state<T: std::convert::Into<crate::model::workflow::State>>(mut self, v: T) -> Self {
202        self.state = v.into();
203        self
204    }
205
206    /// Sets the value of [revision_id][crate::model::Workflow::revision_id].
207    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
208        self.revision_id = v.into();
209        self
210    }
211
212    /// Sets the value of [create_time][crate::model::Workflow::create_time].
213    pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
214        mut self,
215        v: T,
216    ) -> Self {
217        self.create_time = v.into();
218        self
219    }
220
221    /// Sets the value of [update_time][crate::model::Workflow::update_time].
222    pub fn set_update_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
223        mut self,
224        v: T,
225    ) -> Self {
226        self.update_time = v.into();
227        self
228    }
229
230    /// Sets the value of [revision_create_time][crate::model::Workflow::revision_create_time].
231    pub fn set_revision_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
232        mut self,
233        v: T,
234    ) -> Self {
235        self.revision_create_time = v.into();
236        self
237    }
238
239    /// Sets the value of [labels][crate::model::Workflow::labels].
240    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
241    where
242        T: std::iter::IntoIterator<Item = (K, V)>,
243        K: std::convert::Into<std::string::String>,
244        V: std::convert::Into<std::string::String>,
245    {
246        use std::iter::Iterator;
247        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
248        self
249    }
250
251    /// Sets the value of [service_account][crate::model::Workflow::service_account].
252    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
253        self.service_account = v.into();
254        self
255    }
256
257    /// Sets the value of [crypto_key_name][crate::model::Workflow::crypto_key_name].
258    pub fn set_crypto_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259        self.crypto_key_name = v.into();
260        self
261    }
262
263    /// Sets the value of [state_error][crate::model::Workflow::state_error].
264    pub fn set_state_error<
265        T: std::convert::Into<std::option::Option<crate::model::workflow::StateError>>,
266    >(
267        mut self,
268        v: T,
269    ) -> Self {
270        self.state_error = v.into();
271        self
272    }
273
274    /// Sets the value of [call_log_level][crate::model::Workflow::call_log_level].
275    pub fn set_call_log_level<T: std::convert::Into<crate::model::workflow::CallLogLevel>>(
276        mut self,
277        v: T,
278    ) -> Self {
279        self.call_log_level = v.into();
280        self
281    }
282
283    /// Sets the value of [user_env_vars][crate::model::Workflow::user_env_vars].
284    pub fn set_user_env_vars<T, K, V>(mut self, v: T) -> Self
285    where
286        T: std::iter::IntoIterator<Item = (K, V)>,
287        K: std::convert::Into<std::string::String>,
288        V: std::convert::Into<std::string::String>,
289    {
290        use std::iter::Iterator;
291        self.user_env_vars = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
292        self
293    }
294
295    /// Sets the value of [execution_history_level][crate::model::Workflow::execution_history_level].
296    pub fn set_execution_history_level<
297        T: std::convert::Into<crate::model::ExecutionHistoryLevel>,
298    >(
299        mut self,
300        v: T,
301    ) -> Self {
302        self.execution_history_level = v.into();
303        self
304    }
305
306    /// Sets the value of [all_kms_keys][crate::model::Workflow::all_kms_keys].
307    pub fn set_all_kms_keys<T, V>(mut self, v: T) -> Self
308    where
309        T: std::iter::IntoIterator<Item = V>,
310        V: std::convert::Into<std::string::String>,
311    {
312        use std::iter::Iterator;
313        self.all_kms_keys = v.into_iter().map(|i| i.into()).collect();
314        self
315    }
316
317    /// Sets the value of [all_kms_keys_versions][crate::model::Workflow::all_kms_keys_versions].
318    pub fn set_all_kms_keys_versions<T, V>(mut self, v: T) -> Self
319    where
320        T: std::iter::IntoIterator<Item = V>,
321        V: std::convert::Into<std::string::String>,
322    {
323        use std::iter::Iterator;
324        self.all_kms_keys_versions = v.into_iter().map(|i| i.into()).collect();
325        self
326    }
327
328    /// Sets the value of [crypto_key_version][crate::model::Workflow::crypto_key_version].
329    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
330        mut self,
331        v: T,
332    ) -> Self {
333        self.crypto_key_version = v.into();
334        self
335    }
336
337    /// Sets the value of [tags][crate::model::Workflow::tags].
338    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
339    where
340        T: std::iter::IntoIterator<Item = (K, V)>,
341        K: std::convert::Into<std::string::String>,
342        V: std::convert::Into<std::string::String>,
343    {
344        use std::iter::Iterator;
345        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
346        self
347    }
348
349    /// Sets the value of [source_code][crate::model::Workflow::source_code].
350    ///
351    /// Note that all the setters affecting `source_code` are mutually
352    /// exclusive.
353    pub fn set_source_code<
354        T: std::convert::Into<std::option::Option<crate::model::workflow::SourceCode>>,
355    >(
356        mut self,
357        v: T,
358    ) -> Self {
359        self.source_code = v.into();
360        self
361    }
362
363    /// The value of [source_code][crate::model::Workflow::source_code]
364    /// if it holds a `SourceContents`, `None` if the field is not set or
365    /// holds a different branch.
366    pub fn source_contents(&self) -> std::option::Option<&std::string::String> {
367        #[allow(unreachable_patterns)]
368        self.source_code.as_ref().and_then(|v| match v {
369            crate::model::workflow::SourceCode::SourceContents(v) => std::option::Option::Some(v),
370            _ => std::option::Option::None,
371        })
372    }
373
374    /// Sets the value of [source_code][crate::model::Workflow::source_code]
375    /// to hold a `SourceContents`.
376    ///
377    /// Note that all the setters affecting `source_code` are
378    /// mutually exclusive.
379    pub fn set_source_contents<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
380        self.source_code =
381            std::option::Option::Some(crate::model::workflow::SourceCode::SourceContents(v.into()));
382        self
383    }
384}
385
386impl wkt::message::Message for Workflow {
387    fn typename() -> &'static str {
388        "type.googleapis.com/google.cloud.workflows.v1.Workflow"
389    }
390}
391
392/// Defines additional types related to [Workflow].
393pub mod workflow {
394    #[allow(unused_imports)]
395    use super::*;
396
397    /// Describes an error related to the current state of the workflow.
398    #[serde_with::serde_as]
399    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
400    #[serde(default, rename_all = "camelCase")]
401    #[non_exhaustive]
402    pub struct StateError {
403        /// Provides specifics about the error.
404        #[serde(skip_serializing_if = "std::string::String::is_empty")]
405        pub details: std::string::String,
406
407        /// The type of this state error.
408        #[serde(rename = "type")]
409        pub r#type: crate::model::workflow::state_error::Type,
410
411        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
412        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
413    }
414
415    impl StateError {
416        pub fn new() -> Self {
417            std::default::Default::default()
418        }
419
420        /// Sets the value of [details][crate::model::workflow::StateError::details].
421        pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
422            self.details = v.into();
423            self
424        }
425
426        /// Sets the value of [r#type][crate::model::workflow::StateError::type].
427        pub fn set_type<T: std::convert::Into<crate::model::workflow::state_error::Type>>(
428            mut self,
429            v: T,
430        ) -> Self {
431            self.r#type = v.into();
432            self
433        }
434    }
435
436    impl wkt::message::Message for StateError {
437        fn typename() -> &'static str {
438            "type.googleapis.com/google.cloud.workflows.v1.Workflow.StateError"
439        }
440    }
441
442    /// Defines additional types related to [StateError].
443    pub mod state_error {
444        #[allow(unused_imports)]
445        use super::*;
446
447        /// Describes the possibled types of a state error.
448        ///
449        /// # Working with unknown values
450        ///
451        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
452        /// additional enum variants at any time. Adding new variants is not considered
453        /// a breaking change. Applications should write their code in anticipation of:
454        ///
455        /// - New values appearing in future releases of the client library, **and**
456        /// - New values received dynamically, without application changes.
457        ///
458        /// Please consult the [Working with enums] section in the user guide for some
459        /// guidelines.
460        ///
461        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
462        #[derive(Clone, Debug, PartialEq)]
463        #[non_exhaustive]
464        pub enum Type {
465            /// No type specified.
466            Unspecified,
467            /// Caused by an issue with KMS.
468            KmsError,
469            /// If set, the enum was initialized with an unknown value.
470            ///
471            /// Applications can examine the value using [Type::value] or
472            /// [Type::name].
473            UnknownValue(r#type::UnknownValue),
474        }
475
476        #[doc(hidden)]
477        pub mod r#type {
478            #[allow(unused_imports)]
479            use super::*;
480            #[derive(Clone, Debug, PartialEq)]
481            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
482        }
483
484        impl Type {
485            /// Gets the enum value.
486            ///
487            /// Returns `None` if the enum contains an unknown value deserialized from
488            /// the string representation of enums.
489            pub fn value(&self) -> std::option::Option<i32> {
490                match self {
491                    Self::Unspecified => std::option::Option::Some(0),
492                    Self::KmsError => std::option::Option::Some(1),
493                    Self::UnknownValue(u) => u.0.value(),
494                }
495            }
496
497            /// Gets the enum value as a string.
498            ///
499            /// Returns `None` if the enum contains an unknown value deserialized from
500            /// the integer representation of enums.
501            pub fn name(&self) -> std::option::Option<&str> {
502                match self {
503                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
504                    Self::KmsError => std::option::Option::Some("KMS_ERROR"),
505                    Self::UnknownValue(u) => u.0.name(),
506                }
507            }
508        }
509
510        impl std::default::Default for Type {
511            fn default() -> Self {
512                use std::convert::From;
513                Self::from(0)
514            }
515        }
516
517        impl std::fmt::Display for Type {
518            fn fmt(
519                &self,
520                f: &mut std::fmt::Formatter<'_>,
521            ) -> std::result::Result<(), std::fmt::Error> {
522                wkt::internal::display_enum(f, self.name(), self.value())
523            }
524        }
525
526        impl std::convert::From<i32> for Type {
527            fn from(value: i32) -> Self {
528                match value {
529                    0 => Self::Unspecified,
530                    1 => Self::KmsError,
531                    _ => Self::UnknownValue(r#type::UnknownValue(
532                        wkt::internal::UnknownEnumValue::Integer(value),
533                    )),
534                }
535            }
536        }
537
538        impl std::convert::From<&str> for Type {
539            fn from(value: &str) -> Self {
540                use std::string::ToString;
541                match value {
542                    "TYPE_UNSPECIFIED" => Self::Unspecified,
543                    "KMS_ERROR" => Self::KmsError,
544                    _ => Self::UnknownValue(r#type::UnknownValue(
545                        wkt::internal::UnknownEnumValue::String(value.to_string()),
546                    )),
547                }
548            }
549        }
550
551        impl serde::ser::Serialize for Type {
552            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
553            where
554                S: serde::Serializer,
555            {
556                match self {
557                    Self::Unspecified => serializer.serialize_i32(0),
558                    Self::KmsError => serializer.serialize_i32(1),
559                    Self::UnknownValue(u) => u.0.serialize(serializer),
560                }
561            }
562        }
563
564        impl<'de> serde::de::Deserialize<'de> for Type {
565            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
566            where
567                D: serde::Deserializer<'de>,
568            {
569                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
570                    ".google.cloud.workflows.v1.Workflow.StateError.Type",
571                ))
572            }
573        }
574    }
575
576    /// Describes the current state of workflow deployment.
577    ///
578    /// # Working with unknown values
579    ///
580    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
581    /// additional enum variants at any time. Adding new variants is not considered
582    /// a breaking change. Applications should write their code in anticipation of:
583    ///
584    /// - New values appearing in future releases of the client library, **and**
585    /// - New values received dynamically, without application changes.
586    ///
587    /// Please consult the [Working with enums] section in the user guide for some
588    /// guidelines.
589    ///
590    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
591    #[derive(Clone, Debug, PartialEq)]
592    #[non_exhaustive]
593    pub enum State {
594        /// Invalid state.
595        Unspecified,
596        /// The workflow has been deployed successfully and is serving.
597        Active,
598        /// Workflow data is unavailable. See the `state_error` field.
599        Unavailable,
600        /// If set, the enum was initialized with an unknown value.
601        ///
602        /// Applications can examine the value using [State::value] or
603        /// [State::name].
604        UnknownValue(state::UnknownValue),
605    }
606
607    #[doc(hidden)]
608    pub mod state {
609        #[allow(unused_imports)]
610        use super::*;
611        #[derive(Clone, Debug, PartialEq)]
612        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
613    }
614
615    impl State {
616        /// Gets the enum value.
617        ///
618        /// Returns `None` if the enum contains an unknown value deserialized from
619        /// the string representation of enums.
620        pub fn value(&self) -> std::option::Option<i32> {
621            match self {
622                Self::Unspecified => std::option::Option::Some(0),
623                Self::Active => std::option::Option::Some(1),
624                Self::Unavailable => std::option::Option::Some(2),
625                Self::UnknownValue(u) => u.0.value(),
626            }
627        }
628
629        /// Gets the enum value as a string.
630        ///
631        /// Returns `None` if the enum contains an unknown value deserialized from
632        /// the integer representation of enums.
633        pub fn name(&self) -> std::option::Option<&str> {
634            match self {
635                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
636                Self::Active => std::option::Option::Some("ACTIVE"),
637                Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
638                Self::UnknownValue(u) => u.0.name(),
639            }
640        }
641    }
642
643    impl std::default::Default for State {
644        fn default() -> Self {
645            use std::convert::From;
646            Self::from(0)
647        }
648    }
649
650    impl std::fmt::Display for State {
651        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
652            wkt::internal::display_enum(f, self.name(), self.value())
653        }
654    }
655
656    impl std::convert::From<i32> for State {
657        fn from(value: i32) -> Self {
658            match value {
659                0 => Self::Unspecified,
660                1 => Self::Active,
661                2 => Self::Unavailable,
662                _ => Self::UnknownValue(state::UnknownValue(
663                    wkt::internal::UnknownEnumValue::Integer(value),
664                )),
665            }
666        }
667    }
668
669    impl std::convert::From<&str> for State {
670        fn from(value: &str) -> Self {
671            use std::string::ToString;
672            match value {
673                "STATE_UNSPECIFIED" => Self::Unspecified,
674                "ACTIVE" => Self::Active,
675                "UNAVAILABLE" => Self::Unavailable,
676                _ => Self::UnknownValue(state::UnknownValue(
677                    wkt::internal::UnknownEnumValue::String(value.to_string()),
678                )),
679            }
680        }
681    }
682
683    impl serde::ser::Serialize for State {
684        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
685        where
686            S: serde::Serializer,
687        {
688            match self {
689                Self::Unspecified => serializer.serialize_i32(0),
690                Self::Active => serializer.serialize_i32(1),
691                Self::Unavailable => serializer.serialize_i32(2),
692                Self::UnknownValue(u) => u.0.serialize(serializer),
693            }
694        }
695    }
696
697    impl<'de> serde::de::Deserialize<'de> for State {
698        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
699        where
700            D: serde::Deserializer<'de>,
701        {
702            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
703                ".google.cloud.workflows.v1.Workflow.State",
704            ))
705        }
706    }
707
708    /// Describes the level of platform logging to apply to calls and call
709    /// responses during workflow executions.
710    ///
711    /// # Working with unknown values
712    ///
713    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
714    /// additional enum variants at any time. Adding new variants is not considered
715    /// a breaking change. Applications should write their code in anticipation of:
716    ///
717    /// - New values appearing in future releases of the client library, **and**
718    /// - New values received dynamically, without application changes.
719    ///
720    /// Please consult the [Working with enums] section in the user guide for some
721    /// guidelines.
722    ///
723    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
724    #[derive(Clone, Debug, PartialEq)]
725    #[non_exhaustive]
726    pub enum CallLogLevel {
727        /// No call logging level specified.
728        Unspecified,
729        /// Log all call steps within workflows, all call returns, and all exceptions
730        /// raised.
731        LogAllCalls,
732        /// Log only exceptions that are raised from call steps within workflows.
733        LogErrorsOnly,
734        /// Explicitly log nothing.
735        LogNone,
736        /// If set, the enum was initialized with an unknown value.
737        ///
738        /// Applications can examine the value using [CallLogLevel::value] or
739        /// [CallLogLevel::name].
740        UnknownValue(call_log_level::UnknownValue),
741    }
742
743    #[doc(hidden)]
744    pub mod call_log_level {
745        #[allow(unused_imports)]
746        use super::*;
747        #[derive(Clone, Debug, PartialEq)]
748        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
749    }
750
751    impl CallLogLevel {
752        /// Gets the enum value.
753        ///
754        /// Returns `None` if the enum contains an unknown value deserialized from
755        /// the string representation of enums.
756        pub fn value(&self) -> std::option::Option<i32> {
757            match self {
758                Self::Unspecified => std::option::Option::Some(0),
759                Self::LogAllCalls => std::option::Option::Some(1),
760                Self::LogErrorsOnly => std::option::Option::Some(2),
761                Self::LogNone => std::option::Option::Some(3),
762                Self::UnknownValue(u) => u.0.value(),
763            }
764        }
765
766        /// Gets the enum value as a string.
767        ///
768        /// Returns `None` if the enum contains an unknown value deserialized from
769        /// the integer representation of enums.
770        pub fn name(&self) -> std::option::Option<&str> {
771            match self {
772                Self::Unspecified => std::option::Option::Some("CALL_LOG_LEVEL_UNSPECIFIED"),
773                Self::LogAllCalls => std::option::Option::Some("LOG_ALL_CALLS"),
774                Self::LogErrorsOnly => std::option::Option::Some("LOG_ERRORS_ONLY"),
775                Self::LogNone => std::option::Option::Some("LOG_NONE"),
776                Self::UnknownValue(u) => u.0.name(),
777            }
778        }
779    }
780
781    impl std::default::Default for CallLogLevel {
782        fn default() -> Self {
783            use std::convert::From;
784            Self::from(0)
785        }
786    }
787
788    impl std::fmt::Display for CallLogLevel {
789        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
790            wkt::internal::display_enum(f, self.name(), self.value())
791        }
792    }
793
794    impl std::convert::From<i32> for CallLogLevel {
795        fn from(value: i32) -> Self {
796            match value {
797                0 => Self::Unspecified,
798                1 => Self::LogAllCalls,
799                2 => Self::LogErrorsOnly,
800                3 => Self::LogNone,
801                _ => Self::UnknownValue(call_log_level::UnknownValue(
802                    wkt::internal::UnknownEnumValue::Integer(value),
803                )),
804            }
805        }
806    }
807
808    impl std::convert::From<&str> for CallLogLevel {
809        fn from(value: &str) -> Self {
810            use std::string::ToString;
811            match value {
812                "CALL_LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
813                "LOG_ALL_CALLS" => Self::LogAllCalls,
814                "LOG_ERRORS_ONLY" => Self::LogErrorsOnly,
815                "LOG_NONE" => Self::LogNone,
816                _ => Self::UnknownValue(call_log_level::UnknownValue(
817                    wkt::internal::UnknownEnumValue::String(value.to_string()),
818                )),
819            }
820        }
821    }
822
823    impl serde::ser::Serialize for CallLogLevel {
824        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
825        where
826            S: serde::Serializer,
827        {
828            match self {
829                Self::Unspecified => serializer.serialize_i32(0),
830                Self::LogAllCalls => serializer.serialize_i32(1),
831                Self::LogErrorsOnly => serializer.serialize_i32(2),
832                Self::LogNone => serializer.serialize_i32(3),
833                Self::UnknownValue(u) => u.0.serialize(serializer),
834            }
835        }
836    }
837
838    impl<'de> serde::de::Deserialize<'de> for CallLogLevel {
839        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
840        where
841            D: serde::Deserializer<'de>,
842        {
843            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CallLogLevel>::new(
844                ".google.cloud.workflows.v1.Workflow.CallLogLevel",
845            ))
846        }
847    }
848
849    /// Required. Location of the workflow source code.
850    /// Modifying this field for an existing workflow results in a new workflow
851    /// revision.
852    #[serde_with::serde_as]
853    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
854    #[serde(rename_all = "camelCase")]
855    #[non_exhaustive]
856    pub enum SourceCode {
857        /// Workflow code to be executed. The size limit is 128KB.
858        SourceContents(std::string::String),
859    }
860}
861
862/// Request for the
863/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
864/// method.
865///
866/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
867#[serde_with::serde_as]
868#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
869#[serde(default, rename_all = "camelCase")]
870#[non_exhaustive]
871pub struct ListWorkflowsRequest {
872    /// Required. Project and location from which the workflows should be listed.
873    /// Format: projects/{project}/locations/{location}
874    #[serde(skip_serializing_if = "std::string::String::is_empty")]
875    pub parent: std::string::String,
876
877    /// Maximum number of workflows to return per call. The service might return
878    /// fewer than this value even if not at the end of the collection. If a value
879    /// is not specified, a default value of 500 is used. The maximum permitted
880    /// value is 1000 and values greater than 1000 are coerced down to 1000.
881    #[serde(skip_serializing_if = "wkt::internal::is_default")]
882    pub page_size: i32,
883
884    /// A page token, received from a previous `ListWorkflows` call.
885    /// Provide this to retrieve the subsequent page.
886    ///
887    /// When paginating, all other parameters provided to `ListWorkflows` must
888    /// match the call that provided the page token.
889    #[serde(skip_serializing_if = "std::string::String::is_empty")]
890    pub page_token: std::string::String,
891
892    /// Filter to restrict results to specific workflows.
893    /// For details, see <a href="https://google.aip.dev/160"
894    /// class="external"\>AIP-160</a>.
895    ///
896    /// For example, if you are using the Google APIs Explorer:
897    ///
898    /// `state="SUCCEEDED"`
899    ///
900    /// or
901    ///
902    /// `createTime>"2023-08-01" AND state="FAILED"`
903    #[serde(skip_serializing_if = "std::string::String::is_empty")]
904    pub filter: std::string::String,
905
906    /// Comma-separated list of fields that specify the order of the results.
907    /// Default sorting order for a field is ascending. To specify descending order
908    /// for a field, append a "desc" suffix.
909    /// If not specified, the results are returned in an unspecified order.
910    #[serde(skip_serializing_if = "std::string::String::is_empty")]
911    pub order_by: std::string::String,
912
913    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
914    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
915}
916
917impl ListWorkflowsRequest {
918    pub fn new() -> Self {
919        std::default::Default::default()
920    }
921
922    /// Sets the value of [parent][crate::model::ListWorkflowsRequest::parent].
923    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
924        self.parent = v.into();
925        self
926    }
927
928    /// Sets the value of [page_size][crate::model::ListWorkflowsRequest::page_size].
929    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
930        self.page_size = v.into();
931        self
932    }
933
934    /// Sets the value of [page_token][crate::model::ListWorkflowsRequest::page_token].
935    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
936        self.page_token = v.into();
937        self
938    }
939
940    /// Sets the value of [filter][crate::model::ListWorkflowsRequest::filter].
941    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
942        self.filter = v.into();
943        self
944    }
945
946    /// Sets the value of [order_by][crate::model::ListWorkflowsRequest::order_by].
947    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
948        self.order_by = v.into();
949        self
950    }
951}
952
953impl wkt::message::Message for ListWorkflowsRequest {
954    fn typename() -> &'static str {
955        "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsRequest"
956    }
957}
958
959/// Response for the
960/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
961/// method.
962///
963/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
964#[serde_with::serde_as]
965#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
966#[serde(default, rename_all = "camelCase")]
967#[non_exhaustive]
968pub struct ListWorkflowsResponse {
969    /// The workflows that match the request.
970    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
971    pub workflows: std::vec::Vec<crate::model::Workflow>,
972
973    /// A token, which can be sent as `page_token` to retrieve the next page.
974    /// If this field is omitted, there are no subsequent pages.
975    #[serde(skip_serializing_if = "std::string::String::is_empty")]
976    pub next_page_token: std::string::String,
977
978    /// Unreachable resources.
979    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
980    pub unreachable: std::vec::Vec<std::string::String>,
981
982    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
983    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
984}
985
986impl ListWorkflowsResponse {
987    pub fn new() -> Self {
988        std::default::Default::default()
989    }
990
991    /// Sets the value of [workflows][crate::model::ListWorkflowsResponse::workflows].
992    pub fn set_workflows<T, V>(mut self, v: T) -> Self
993    where
994        T: std::iter::IntoIterator<Item = V>,
995        V: std::convert::Into<crate::model::Workflow>,
996    {
997        use std::iter::Iterator;
998        self.workflows = v.into_iter().map(|i| i.into()).collect();
999        self
1000    }
1001
1002    /// Sets the value of [next_page_token][crate::model::ListWorkflowsResponse::next_page_token].
1003    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1004        self.next_page_token = v.into();
1005        self
1006    }
1007
1008    /// Sets the value of [unreachable][crate::model::ListWorkflowsResponse::unreachable].
1009    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1010    where
1011        T: std::iter::IntoIterator<Item = V>,
1012        V: std::convert::Into<std::string::String>,
1013    {
1014        use std::iter::Iterator;
1015        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1016        self
1017    }
1018}
1019
1020impl wkt::message::Message for ListWorkflowsResponse {
1021    fn typename() -> &'static str {
1022        "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsResponse"
1023    }
1024}
1025
1026#[doc(hidden)]
1027impl gax::paginator::internal::PageableResponse for ListWorkflowsResponse {
1028    type PageItem = crate::model::Workflow;
1029
1030    fn items(self) -> std::vec::Vec<Self::PageItem> {
1031        self.workflows
1032    }
1033
1034    fn next_page_token(&self) -> std::string::String {
1035        use std::clone::Clone;
1036        self.next_page_token.clone()
1037    }
1038}
1039
1040/// Request for the
1041/// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
1042///
1043/// [google.cloud.workflows.v1.Workflows.GetWorkflow]: crate::client::Workflows::get_workflow
1044#[serde_with::serde_as]
1045#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1046#[serde(default, rename_all = "camelCase")]
1047#[non_exhaustive]
1048pub struct GetWorkflowRequest {
1049    /// Required. Name of the workflow for which information should be retrieved.
1050    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1051    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1052    pub name: std::string::String,
1053
1054    /// Optional. The revision of the workflow to retrieve. If the revision_id is
1055    /// empty, the latest revision is retrieved.
1056    /// The format is "000001-a4d", where the first six characters define
1057    /// the zero-padded decimal revision number. They are followed by a hyphen and
1058    /// three hexadecimal characters.
1059    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1060    pub revision_id: std::string::String,
1061
1062    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1063    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1064}
1065
1066impl GetWorkflowRequest {
1067    pub fn new() -> Self {
1068        std::default::Default::default()
1069    }
1070
1071    /// Sets the value of [name][crate::model::GetWorkflowRequest::name].
1072    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1073        self.name = v.into();
1074        self
1075    }
1076
1077    /// Sets the value of [revision_id][crate::model::GetWorkflowRequest::revision_id].
1078    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1079        self.revision_id = v.into();
1080        self
1081    }
1082}
1083
1084impl wkt::message::Message for GetWorkflowRequest {
1085    fn typename() -> &'static str {
1086        "type.googleapis.com/google.cloud.workflows.v1.GetWorkflowRequest"
1087    }
1088}
1089
1090/// Request for the
1091/// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
1092/// method.
1093///
1094/// [google.cloud.workflows.v1.Workflows.CreateWorkflow]: crate::client::Workflows::create_workflow
1095#[serde_with::serde_as]
1096#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1097#[serde(default, rename_all = "camelCase")]
1098#[non_exhaustive]
1099pub struct CreateWorkflowRequest {
1100    /// Required. Project and location in which the workflow should be created.
1101    /// Format:  projects/{project}/locations/{location}
1102    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1103    pub parent: std::string::String,
1104
1105    /// Required. Workflow to be created.
1106    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1107    pub workflow: std::option::Option<crate::model::Workflow>,
1108
1109    /// Required. The ID of the workflow to be created. It has to fulfill the
1110    /// following requirements:
1111    ///
1112    /// * Must contain only letters, numbers, underscores and hyphens.
1113    /// * Must start with a letter.
1114    /// * Must be between 1-64 characters.
1115    /// * Must end with a number or a letter.
1116    /// * Must be unique within the customer project and location.
1117    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1118    pub workflow_id: std::string::String,
1119
1120    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1121    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1122}
1123
1124impl CreateWorkflowRequest {
1125    pub fn new() -> Self {
1126        std::default::Default::default()
1127    }
1128
1129    /// Sets the value of [parent][crate::model::CreateWorkflowRequest::parent].
1130    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1131        self.parent = v.into();
1132        self
1133    }
1134
1135    /// Sets the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
1136    pub fn set_workflow<T: std::convert::Into<std::option::Option<crate::model::Workflow>>>(
1137        mut self,
1138        v: T,
1139    ) -> Self {
1140        self.workflow = v.into();
1141        self
1142    }
1143
1144    /// Sets the value of [workflow_id][crate::model::CreateWorkflowRequest::workflow_id].
1145    pub fn set_workflow_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1146        self.workflow_id = v.into();
1147        self
1148    }
1149}
1150
1151impl wkt::message::Message for CreateWorkflowRequest {
1152    fn typename() -> &'static str {
1153        "type.googleapis.com/google.cloud.workflows.v1.CreateWorkflowRequest"
1154    }
1155}
1156
1157/// Request for the
1158/// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
1159/// method.
1160///
1161/// [google.cloud.workflows.v1.Workflows.DeleteWorkflow]: crate::client::Workflows::delete_workflow
1162#[serde_with::serde_as]
1163#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1164#[serde(default, rename_all = "camelCase")]
1165#[non_exhaustive]
1166pub struct DeleteWorkflowRequest {
1167    /// Required. Name of the workflow to be deleted.
1168    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1169    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1170    pub name: std::string::String,
1171
1172    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1173    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1174}
1175
1176impl DeleteWorkflowRequest {
1177    pub fn new() -> Self {
1178        std::default::Default::default()
1179    }
1180
1181    /// Sets the value of [name][crate::model::DeleteWorkflowRequest::name].
1182    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1183        self.name = v.into();
1184        self
1185    }
1186}
1187
1188impl wkt::message::Message for DeleteWorkflowRequest {
1189    fn typename() -> &'static str {
1190        "type.googleapis.com/google.cloud.workflows.v1.DeleteWorkflowRequest"
1191    }
1192}
1193
1194/// Request for the
1195/// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
1196/// method.
1197///
1198/// [google.cloud.workflows.v1.Workflows.UpdateWorkflow]: crate::client::Workflows::update_workflow
1199#[serde_with::serde_as]
1200#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1201#[serde(default, rename_all = "camelCase")]
1202#[non_exhaustive]
1203pub struct UpdateWorkflowRequest {
1204    /// Required. Workflow to be updated.
1205    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1206    pub workflow: std::option::Option<crate::model::Workflow>,
1207
1208    /// List of fields to be updated. If not present, the entire workflow
1209    /// will be updated.
1210    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1211    pub update_mask: std::option::Option<wkt::FieldMask>,
1212
1213    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1214    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1215}
1216
1217impl UpdateWorkflowRequest {
1218    pub fn new() -> Self {
1219        std::default::Default::default()
1220    }
1221
1222    /// Sets the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
1223    pub fn set_workflow<T: std::convert::Into<std::option::Option<crate::model::Workflow>>>(
1224        mut self,
1225        v: T,
1226    ) -> Self {
1227        self.workflow = v.into();
1228        self
1229    }
1230
1231    /// Sets the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
1232    pub fn set_update_mask<T: std::convert::Into<std::option::Option<wkt::FieldMask>>>(
1233        mut self,
1234        v: T,
1235    ) -> Self {
1236        self.update_mask = v.into();
1237        self
1238    }
1239}
1240
1241impl wkt::message::Message for UpdateWorkflowRequest {
1242    fn typename() -> &'static str {
1243        "type.googleapis.com/google.cloud.workflows.v1.UpdateWorkflowRequest"
1244    }
1245}
1246
1247/// Represents the metadata of the long-running operation.
1248#[serde_with::serde_as]
1249#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1250#[serde(default, rename_all = "camelCase")]
1251#[non_exhaustive]
1252pub struct OperationMetadata {
1253    /// The time the operation was created.
1254    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1255    pub create_time: std::option::Option<wkt::Timestamp>,
1256
1257    /// The time the operation finished running.
1258    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1259    pub end_time: std::option::Option<wkt::Timestamp>,
1260
1261    /// Server-defined resource path for the target of the operation.
1262    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1263    pub target: std::string::String,
1264
1265    /// Name of the verb executed by the operation.
1266    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1267    pub verb: std::string::String,
1268
1269    /// API version used to start the operation.
1270    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1271    pub api_version: std::string::String,
1272
1273    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1274    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1275}
1276
1277impl OperationMetadata {
1278    pub fn new() -> Self {
1279        std::default::Default::default()
1280    }
1281
1282    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1283    pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1284        mut self,
1285        v: T,
1286    ) -> Self {
1287        self.create_time = v.into();
1288        self
1289    }
1290
1291    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1292    pub fn set_end_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
1293        mut self,
1294        v: T,
1295    ) -> Self {
1296        self.end_time = v.into();
1297        self
1298    }
1299
1300    /// Sets the value of [target][crate::model::OperationMetadata::target].
1301    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1302        self.target = v.into();
1303        self
1304    }
1305
1306    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1307    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1308        self.verb = v.into();
1309        self
1310    }
1311
1312    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1313    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314        self.api_version = v.into();
1315        self
1316    }
1317}
1318
1319impl wkt::message::Message for OperationMetadata {
1320    fn typename() -> &'static str {
1321        "type.googleapis.com/google.cloud.workflows.v1.OperationMetadata"
1322    }
1323}
1324
1325/// Request for the
1326/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1327/// method.
1328///
1329/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1330#[serde_with::serde_as]
1331#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1332#[serde(default, rename_all = "camelCase")]
1333#[non_exhaustive]
1334pub struct ListWorkflowRevisionsRequest {
1335    /// Required. Workflow for which the revisions should be listed.
1336    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1337    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1338    pub name: std::string::String,
1339
1340    /// The maximum number of revisions to return per page. If a value is not
1341    /// specified, a default value of 20 is used. The maximum permitted value is
1342    /// 100. Values greater than 100 are coerced down to 100.
1343    #[serde(skip_serializing_if = "wkt::internal::is_default")]
1344    pub page_size: i32,
1345
1346    /// The page token, received from a previous ListWorkflowRevisions call.
1347    /// Provide this to retrieve the subsequent page.
1348    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1349    pub page_token: std::string::String,
1350
1351    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1352    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1353}
1354
1355impl ListWorkflowRevisionsRequest {
1356    pub fn new() -> Self {
1357        std::default::Default::default()
1358    }
1359
1360    /// Sets the value of [name][crate::model::ListWorkflowRevisionsRequest::name].
1361    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1362        self.name = v.into();
1363        self
1364    }
1365
1366    /// Sets the value of [page_size][crate::model::ListWorkflowRevisionsRequest::page_size].
1367    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1368        self.page_size = v.into();
1369        self
1370    }
1371
1372    /// Sets the value of [page_token][crate::model::ListWorkflowRevisionsRequest::page_token].
1373    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1374        self.page_token = v.into();
1375        self
1376    }
1377}
1378
1379impl wkt::message::Message for ListWorkflowRevisionsRequest {
1380    fn typename() -> &'static str {
1381        "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsRequest"
1382    }
1383}
1384
1385/// Response for the
1386/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1387/// method.
1388///
1389/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1390#[serde_with::serde_as]
1391#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1392#[serde(default, rename_all = "camelCase")]
1393#[non_exhaustive]
1394pub struct ListWorkflowRevisionsResponse {
1395    /// The revisions of the workflow, ordered in reverse chronological order.
1396    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1397    pub workflows: std::vec::Vec<crate::model::Workflow>,
1398
1399    /// A token, which can be sent as `page_token` to retrieve the next page.
1400    /// If this field is omitted, there are no subsequent pages.
1401    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1402    pub next_page_token: std::string::String,
1403
1404    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1405    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1406}
1407
1408impl ListWorkflowRevisionsResponse {
1409    pub fn new() -> Self {
1410        std::default::Default::default()
1411    }
1412
1413    /// Sets the value of [workflows][crate::model::ListWorkflowRevisionsResponse::workflows].
1414    pub fn set_workflows<T, V>(mut self, v: T) -> Self
1415    where
1416        T: std::iter::IntoIterator<Item = V>,
1417        V: std::convert::Into<crate::model::Workflow>,
1418    {
1419        use std::iter::Iterator;
1420        self.workflows = v.into_iter().map(|i| i.into()).collect();
1421        self
1422    }
1423
1424    /// Sets the value of [next_page_token][crate::model::ListWorkflowRevisionsResponse::next_page_token].
1425    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426        self.next_page_token = v.into();
1427        self
1428    }
1429}
1430
1431impl wkt::message::Message for ListWorkflowRevisionsResponse {
1432    fn typename() -> &'static str {
1433        "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsResponse"
1434    }
1435}
1436
1437#[doc(hidden)]
1438impl gax::paginator::internal::PageableResponse for ListWorkflowRevisionsResponse {
1439    type PageItem = crate::model::Workflow;
1440
1441    fn items(self) -> std::vec::Vec<Self::PageItem> {
1442        self.workflows
1443    }
1444
1445    fn next_page_token(&self) -> std::string::String {
1446        use std::clone::Clone;
1447        self.next_page_token.clone()
1448    }
1449}
1450
1451/// Define possible options for enabling the execution history level.
1452///
1453/// # Working with unknown values
1454///
1455/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1456/// additional enum variants at any time. Adding new variants is not considered
1457/// a breaking change. Applications should write their code in anticipation of:
1458///
1459/// - New values appearing in future releases of the client library, **and**
1460/// - New values received dynamically, without application changes.
1461///
1462/// Please consult the [Working with enums] section in the user guide for some
1463/// guidelines.
1464///
1465/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1466#[derive(Clone, Debug, PartialEq)]
1467#[non_exhaustive]
1468pub enum ExecutionHistoryLevel {
1469    /// The default/unset value.
1470    Unspecified,
1471    /// Enable execution history basic feature.
1472    ExecutionHistoryBasic,
1473    /// Enable execution history detailed feature.
1474    ExecutionHistoryDetailed,
1475    /// If set, the enum was initialized with an unknown value.
1476    ///
1477    /// Applications can examine the value using [ExecutionHistoryLevel::value] or
1478    /// [ExecutionHistoryLevel::name].
1479    UnknownValue(execution_history_level::UnknownValue),
1480}
1481
1482#[doc(hidden)]
1483pub mod execution_history_level {
1484    #[allow(unused_imports)]
1485    use super::*;
1486    #[derive(Clone, Debug, PartialEq)]
1487    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1488}
1489
1490impl ExecutionHistoryLevel {
1491    /// Gets the enum value.
1492    ///
1493    /// Returns `None` if the enum contains an unknown value deserialized from
1494    /// the string representation of enums.
1495    pub fn value(&self) -> std::option::Option<i32> {
1496        match self {
1497            Self::Unspecified => std::option::Option::Some(0),
1498            Self::ExecutionHistoryBasic => std::option::Option::Some(1),
1499            Self::ExecutionHistoryDetailed => std::option::Option::Some(2),
1500            Self::UnknownValue(u) => u.0.value(),
1501        }
1502    }
1503
1504    /// Gets the enum value as a string.
1505    ///
1506    /// Returns `None` if the enum contains an unknown value deserialized from
1507    /// the integer representation of enums.
1508    pub fn name(&self) -> std::option::Option<&str> {
1509        match self {
1510            Self::Unspecified => std::option::Option::Some("EXECUTION_HISTORY_LEVEL_UNSPECIFIED"),
1511            Self::ExecutionHistoryBasic => std::option::Option::Some("EXECUTION_HISTORY_BASIC"),
1512            Self::ExecutionHistoryDetailed => {
1513                std::option::Option::Some("EXECUTION_HISTORY_DETAILED")
1514            }
1515            Self::UnknownValue(u) => u.0.name(),
1516        }
1517    }
1518}
1519
1520impl std::default::Default for ExecutionHistoryLevel {
1521    fn default() -> Self {
1522        use std::convert::From;
1523        Self::from(0)
1524    }
1525}
1526
1527impl std::fmt::Display for ExecutionHistoryLevel {
1528    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1529        wkt::internal::display_enum(f, self.name(), self.value())
1530    }
1531}
1532
1533impl std::convert::From<i32> for ExecutionHistoryLevel {
1534    fn from(value: i32) -> Self {
1535        match value {
1536            0 => Self::Unspecified,
1537            1 => Self::ExecutionHistoryBasic,
1538            2 => Self::ExecutionHistoryDetailed,
1539            _ => Self::UnknownValue(execution_history_level::UnknownValue(
1540                wkt::internal::UnknownEnumValue::Integer(value),
1541            )),
1542        }
1543    }
1544}
1545
1546impl std::convert::From<&str> for ExecutionHistoryLevel {
1547    fn from(value: &str) -> Self {
1548        use std::string::ToString;
1549        match value {
1550            "EXECUTION_HISTORY_LEVEL_UNSPECIFIED" => Self::Unspecified,
1551            "EXECUTION_HISTORY_BASIC" => Self::ExecutionHistoryBasic,
1552            "EXECUTION_HISTORY_DETAILED" => Self::ExecutionHistoryDetailed,
1553            _ => Self::UnknownValue(execution_history_level::UnknownValue(
1554                wkt::internal::UnknownEnumValue::String(value.to_string()),
1555            )),
1556        }
1557    }
1558}
1559
1560impl serde::ser::Serialize for ExecutionHistoryLevel {
1561    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1562    where
1563        S: serde::Serializer,
1564    {
1565        match self {
1566            Self::Unspecified => serializer.serialize_i32(0),
1567            Self::ExecutionHistoryBasic => serializer.serialize_i32(1),
1568            Self::ExecutionHistoryDetailed => serializer.serialize_i32(2),
1569            Self::UnknownValue(u) => u.0.serialize(serializer),
1570        }
1571    }
1572}
1573
1574impl<'de> serde::de::Deserialize<'de> for ExecutionHistoryLevel {
1575    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1576    where
1577        D: serde::Deserializer<'de>,
1578    {
1579        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionHistoryLevel>::new(
1580            ".google.cloud.workflows.v1.ExecutionHistoryLevel",
1581        ))
1582    }
1583}