google_cloud_functions_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate iam_v1;
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/// Describes a Cloud Function that contains user computation executed in
39/// response to an event. It encapsulates function and trigger configurations.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Function {
43    /// A user-defined name of the function. Function names must be unique
44    /// globally and match pattern `projects/*/locations/*/functions/*`
45    pub name: std::string::String,
46
47    /// User-provided description of a function.
48    pub description: std::string::String,
49
50    /// Describes the Build step of the function that builds a container from the
51    /// given source.
52    pub build_config: std::option::Option<crate::model::BuildConfig>,
53
54    /// Describes the Service being deployed. Currently deploys services to Cloud
55    /// Run (fully managed).
56    pub service_config: std::option::Option<crate::model::ServiceConfig>,
57
58    /// An Eventarc trigger managed by Google Cloud Functions that fires events in
59    /// response to a condition in another service.
60    pub event_trigger: std::option::Option<crate::model::EventTrigger>,
61
62    /// Output only. State of the function.
63    pub state: crate::model::function::State,
64
65    /// Output only. The last update timestamp of a Cloud Function.
66    pub update_time: std::option::Option<wkt::Timestamp>,
67
68    /// Labels associated with this Cloud Function.
69    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
70
71    /// Output only. State Messages for this Cloud Function.
72    pub state_messages: std::vec::Vec<crate::model::StateMessage>,
73
74    /// Describe whether the function is 1st Gen or 2nd Gen.
75    pub environment: crate::model::Environment,
76
77    /// Output only. The deployed url for the function.
78    pub url: std::string::String,
79
80    /// Resource name of a KMS crypto key (managed by the user) used to
81    /// encrypt/decrypt function resources.
82    ///
83    /// It must match the pattern
84    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
85    pub kms_key_name: std::string::String,
86
87    /// Output only. Reserved for future use.
88    pub satisfies_pzs: bool,
89
90    /// Output only. The create timestamp of a Cloud Function. This is only
91    /// applicable to 2nd Gen functions.
92    pub create_time: std::option::Option<wkt::Timestamp>,
93
94    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
95}
96
97impl Function {
98    pub fn new() -> Self {
99        std::default::Default::default()
100    }
101
102    /// Sets the value of [name][crate::model::Function::name].
103    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104        self.name = v.into();
105        self
106    }
107
108    /// Sets the value of [description][crate::model::Function::description].
109    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
110        self.description = v.into();
111        self
112    }
113
114    /// Sets the value of [build_config][crate::model::Function::build_config].
115    pub fn set_build_config<T>(mut self, v: T) -> Self
116    where
117        T: std::convert::Into<crate::model::BuildConfig>,
118    {
119        self.build_config = std::option::Option::Some(v.into());
120        self
121    }
122
123    /// Sets or clears the value of [build_config][crate::model::Function::build_config].
124    pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
125    where
126        T: std::convert::Into<crate::model::BuildConfig>,
127    {
128        self.build_config = v.map(|x| x.into());
129        self
130    }
131
132    /// Sets the value of [service_config][crate::model::Function::service_config].
133    pub fn set_service_config<T>(mut self, v: T) -> Self
134    where
135        T: std::convert::Into<crate::model::ServiceConfig>,
136    {
137        self.service_config = std::option::Option::Some(v.into());
138        self
139    }
140
141    /// Sets or clears the value of [service_config][crate::model::Function::service_config].
142    pub fn set_or_clear_service_config<T>(mut self, v: std::option::Option<T>) -> Self
143    where
144        T: std::convert::Into<crate::model::ServiceConfig>,
145    {
146        self.service_config = v.map(|x| x.into());
147        self
148    }
149
150    /// Sets the value of [event_trigger][crate::model::Function::event_trigger].
151    pub fn set_event_trigger<T>(mut self, v: T) -> Self
152    where
153        T: std::convert::Into<crate::model::EventTrigger>,
154    {
155        self.event_trigger = std::option::Option::Some(v.into());
156        self
157    }
158
159    /// Sets or clears the value of [event_trigger][crate::model::Function::event_trigger].
160    pub fn set_or_clear_event_trigger<T>(mut self, v: std::option::Option<T>) -> Self
161    where
162        T: std::convert::Into<crate::model::EventTrigger>,
163    {
164        self.event_trigger = v.map(|x| x.into());
165        self
166    }
167
168    /// Sets the value of [state][crate::model::Function::state].
169    pub fn set_state<T: std::convert::Into<crate::model::function::State>>(mut self, v: T) -> Self {
170        self.state = v.into();
171        self
172    }
173
174    /// Sets the value of [update_time][crate::model::Function::update_time].
175    pub fn set_update_time<T>(mut self, v: T) -> Self
176    where
177        T: std::convert::Into<wkt::Timestamp>,
178    {
179        self.update_time = std::option::Option::Some(v.into());
180        self
181    }
182
183    /// Sets or clears the value of [update_time][crate::model::Function::update_time].
184    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
185    where
186        T: std::convert::Into<wkt::Timestamp>,
187    {
188        self.update_time = v.map(|x| x.into());
189        self
190    }
191
192    /// Sets the value of [labels][crate::model::Function::labels].
193    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
194    where
195        T: std::iter::IntoIterator<Item = (K, V)>,
196        K: std::convert::Into<std::string::String>,
197        V: std::convert::Into<std::string::String>,
198    {
199        use std::iter::Iterator;
200        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
201        self
202    }
203
204    /// Sets the value of [state_messages][crate::model::Function::state_messages].
205    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
206    where
207        T: std::iter::IntoIterator<Item = V>,
208        V: std::convert::Into<crate::model::StateMessage>,
209    {
210        use std::iter::Iterator;
211        self.state_messages = v.into_iter().map(|i| i.into()).collect();
212        self
213    }
214
215    /// Sets the value of [environment][crate::model::Function::environment].
216    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
217        mut self,
218        v: T,
219    ) -> Self {
220        self.environment = v.into();
221        self
222    }
223
224    /// Sets the value of [url][crate::model::Function::url].
225    pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
226        self.url = v.into();
227        self
228    }
229
230    /// Sets the value of [kms_key_name][crate::model::Function::kms_key_name].
231    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
232        self.kms_key_name = v.into();
233        self
234    }
235
236    /// Sets the value of [satisfies_pzs][crate::model::Function::satisfies_pzs].
237    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
238        self.satisfies_pzs = v.into();
239        self
240    }
241
242    /// Sets the value of [create_time][crate::model::Function::create_time].
243    pub fn set_create_time<T>(mut self, v: T) -> Self
244    where
245        T: std::convert::Into<wkt::Timestamp>,
246    {
247        self.create_time = std::option::Option::Some(v.into());
248        self
249    }
250
251    /// Sets or clears the value of [create_time][crate::model::Function::create_time].
252    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
253    where
254        T: std::convert::Into<wkt::Timestamp>,
255    {
256        self.create_time = v.map(|x| x.into());
257        self
258    }
259}
260
261impl wkt::message::Message for Function {
262    fn typename() -> &'static str {
263        "type.googleapis.com/google.cloud.functions.v2.Function"
264    }
265}
266
267#[doc(hidden)]
268impl<'de> serde::de::Deserialize<'de> for Function {
269    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
270    where
271        D: serde::Deserializer<'de>,
272    {
273        #[allow(non_camel_case_types)]
274        #[doc(hidden)]
275        #[derive(PartialEq, Eq, Hash)]
276        enum __FieldTag {
277            __name,
278            __description,
279            __build_config,
280            __service_config,
281            __event_trigger,
282            __state,
283            __update_time,
284            __labels,
285            __state_messages,
286            __environment,
287            __url,
288            __kms_key_name,
289            __satisfies_pzs,
290            __create_time,
291            Unknown(std::string::String),
292        }
293        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
294            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
295            where
296                D: serde::Deserializer<'de>,
297            {
298                struct Visitor;
299                impl<'de> serde::de::Visitor<'de> for Visitor {
300                    type Value = __FieldTag;
301                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
302                        formatter.write_str("a field name for Function")
303                    }
304                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
305                    where
306                        E: serde::de::Error,
307                    {
308                        use std::result::Result::Ok;
309                        use std::string::ToString;
310                        match value {
311                            "name" => Ok(__FieldTag::__name),
312                            "description" => Ok(__FieldTag::__description),
313                            "buildConfig" => Ok(__FieldTag::__build_config),
314                            "build_config" => Ok(__FieldTag::__build_config),
315                            "serviceConfig" => Ok(__FieldTag::__service_config),
316                            "service_config" => Ok(__FieldTag::__service_config),
317                            "eventTrigger" => Ok(__FieldTag::__event_trigger),
318                            "event_trigger" => Ok(__FieldTag::__event_trigger),
319                            "state" => Ok(__FieldTag::__state),
320                            "updateTime" => Ok(__FieldTag::__update_time),
321                            "update_time" => Ok(__FieldTag::__update_time),
322                            "labels" => Ok(__FieldTag::__labels),
323                            "stateMessages" => Ok(__FieldTag::__state_messages),
324                            "state_messages" => Ok(__FieldTag::__state_messages),
325                            "environment" => Ok(__FieldTag::__environment),
326                            "url" => Ok(__FieldTag::__url),
327                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
328                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
329                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
330                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
331                            "createTime" => Ok(__FieldTag::__create_time),
332                            "create_time" => Ok(__FieldTag::__create_time),
333                            _ => Ok(__FieldTag::Unknown(value.to_string())),
334                        }
335                    }
336                }
337                deserializer.deserialize_identifier(Visitor)
338            }
339        }
340        struct Visitor;
341        impl<'de> serde::de::Visitor<'de> for Visitor {
342            type Value = Function;
343            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
344                formatter.write_str("struct Function")
345            }
346            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
347            where
348                A: serde::de::MapAccess<'de>,
349            {
350                #[allow(unused_imports)]
351                use serde::de::Error;
352                use std::option::Option::Some;
353                let mut fields = std::collections::HashSet::new();
354                let mut result = Self::Value::new();
355                while let Some(tag) = map.next_key::<__FieldTag>()? {
356                    #[allow(clippy::match_single_binding)]
357                    match tag {
358                        __FieldTag::__name => {
359                            if !fields.insert(__FieldTag::__name) {
360                                return std::result::Result::Err(A::Error::duplicate_field(
361                                    "multiple values for name",
362                                ));
363                            }
364                            result.name = map
365                                .next_value::<std::option::Option<std::string::String>>()?
366                                .unwrap_or_default();
367                        }
368                        __FieldTag::__description => {
369                            if !fields.insert(__FieldTag::__description) {
370                                return std::result::Result::Err(A::Error::duplicate_field(
371                                    "multiple values for description",
372                                ));
373                            }
374                            result.description = map
375                                .next_value::<std::option::Option<std::string::String>>()?
376                                .unwrap_or_default();
377                        }
378                        __FieldTag::__build_config => {
379                            if !fields.insert(__FieldTag::__build_config) {
380                                return std::result::Result::Err(A::Error::duplicate_field(
381                                    "multiple values for build_config",
382                                ));
383                            }
384                            result.build_config =
385                                map.next_value::<std::option::Option<crate::model::BuildConfig>>()?;
386                        }
387                        __FieldTag::__service_config => {
388                            if !fields.insert(__FieldTag::__service_config) {
389                                return std::result::Result::Err(A::Error::duplicate_field(
390                                    "multiple values for service_config",
391                                ));
392                            }
393                            result.service_config = map
394                                .next_value::<std::option::Option<crate::model::ServiceConfig>>()?;
395                        }
396                        __FieldTag::__event_trigger => {
397                            if !fields.insert(__FieldTag::__event_trigger) {
398                                return std::result::Result::Err(A::Error::duplicate_field(
399                                    "multiple values for event_trigger",
400                                ));
401                            }
402                            result.event_trigger = map
403                                .next_value::<std::option::Option<crate::model::EventTrigger>>()?;
404                        }
405                        __FieldTag::__state => {
406                            if !fields.insert(__FieldTag::__state) {
407                                return std::result::Result::Err(A::Error::duplicate_field(
408                                    "multiple values for state",
409                                ));
410                            }
411                            result.state = map
412                                .next_value::<std::option::Option<crate::model::function::State>>()?
413                                .unwrap_or_default();
414                        }
415                        __FieldTag::__update_time => {
416                            if !fields.insert(__FieldTag::__update_time) {
417                                return std::result::Result::Err(A::Error::duplicate_field(
418                                    "multiple values for update_time",
419                                ));
420                            }
421                            result.update_time =
422                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
423                        }
424                        __FieldTag::__labels => {
425                            if !fields.insert(__FieldTag::__labels) {
426                                return std::result::Result::Err(A::Error::duplicate_field(
427                                    "multiple values for labels",
428                                ));
429                            }
430                            result.labels = map
431                                .next_value::<std::option::Option<
432                                    std::collections::HashMap<
433                                        std::string::String,
434                                        std::string::String,
435                                    >,
436                                >>()?
437                                .unwrap_or_default();
438                        }
439                        __FieldTag::__state_messages => {
440                            if !fields.insert(__FieldTag::__state_messages) {
441                                return std::result::Result::Err(A::Error::duplicate_field(
442                                    "multiple values for state_messages",
443                                ));
444                            }
445                            result.state_messages = map.next_value::<std::option::Option<std::vec::Vec<crate::model::StateMessage>>>()?.unwrap_or_default();
446                        }
447                        __FieldTag::__environment => {
448                            if !fields.insert(__FieldTag::__environment) {
449                                return std::result::Result::Err(A::Error::duplicate_field(
450                                    "multiple values for environment",
451                                ));
452                            }
453                            result.environment = map
454                                .next_value::<std::option::Option<crate::model::Environment>>()?
455                                .unwrap_or_default();
456                        }
457                        __FieldTag::__url => {
458                            if !fields.insert(__FieldTag::__url) {
459                                return std::result::Result::Err(A::Error::duplicate_field(
460                                    "multiple values for url",
461                                ));
462                            }
463                            result.url = map
464                                .next_value::<std::option::Option<std::string::String>>()?
465                                .unwrap_or_default();
466                        }
467                        __FieldTag::__kms_key_name => {
468                            if !fields.insert(__FieldTag::__kms_key_name) {
469                                return std::result::Result::Err(A::Error::duplicate_field(
470                                    "multiple values for kms_key_name",
471                                ));
472                            }
473                            result.kms_key_name = map
474                                .next_value::<std::option::Option<std::string::String>>()?
475                                .unwrap_or_default();
476                        }
477                        __FieldTag::__satisfies_pzs => {
478                            if !fields.insert(__FieldTag::__satisfies_pzs) {
479                                return std::result::Result::Err(A::Error::duplicate_field(
480                                    "multiple values for satisfies_pzs",
481                                ));
482                            }
483                            result.satisfies_pzs = map
484                                .next_value::<std::option::Option<bool>>()?
485                                .unwrap_or_default();
486                        }
487                        __FieldTag::__create_time => {
488                            if !fields.insert(__FieldTag::__create_time) {
489                                return std::result::Result::Err(A::Error::duplicate_field(
490                                    "multiple values for create_time",
491                                ));
492                            }
493                            result.create_time =
494                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
495                        }
496                        __FieldTag::Unknown(key) => {
497                            let value = map.next_value::<serde_json::Value>()?;
498                            result._unknown_fields.insert(key, value);
499                        }
500                    }
501                }
502                std::result::Result::Ok(result)
503            }
504        }
505        deserializer.deserialize_any(Visitor)
506    }
507}
508
509#[doc(hidden)]
510impl serde::ser::Serialize for Function {
511    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
512    where
513        S: serde::ser::Serializer,
514    {
515        use serde::ser::SerializeMap;
516        #[allow(unused_imports)]
517        use std::option::Option::Some;
518        let mut state = serializer.serialize_map(std::option::Option::None)?;
519        if !self.name.is_empty() {
520            state.serialize_entry("name", &self.name)?;
521        }
522        if !self.description.is_empty() {
523            state.serialize_entry("description", &self.description)?;
524        }
525        if self.build_config.is_some() {
526            state.serialize_entry("buildConfig", &self.build_config)?;
527        }
528        if self.service_config.is_some() {
529            state.serialize_entry("serviceConfig", &self.service_config)?;
530        }
531        if self.event_trigger.is_some() {
532            state.serialize_entry("eventTrigger", &self.event_trigger)?;
533        }
534        if !wkt::internal::is_default(&self.state) {
535            state.serialize_entry("state", &self.state)?;
536        }
537        if self.update_time.is_some() {
538            state.serialize_entry("updateTime", &self.update_time)?;
539        }
540        if !self.labels.is_empty() {
541            state.serialize_entry("labels", &self.labels)?;
542        }
543        if !self.state_messages.is_empty() {
544            state.serialize_entry("stateMessages", &self.state_messages)?;
545        }
546        if !wkt::internal::is_default(&self.environment) {
547            state.serialize_entry("environment", &self.environment)?;
548        }
549        if !self.url.is_empty() {
550            state.serialize_entry("url", &self.url)?;
551        }
552        if !self.kms_key_name.is_empty() {
553            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
554        }
555        if !wkt::internal::is_default(&self.satisfies_pzs) {
556            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
557        }
558        if self.create_time.is_some() {
559            state.serialize_entry("createTime", &self.create_time)?;
560        }
561        if !self._unknown_fields.is_empty() {
562            for (key, value) in self._unknown_fields.iter() {
563                state.serialize_entry(key, &value)?;
564            }
565        }
566        state.end()
567    }
568}
569
570impl std::fmt::Debug for Function {
571    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
572        let mut debug_struct = f.debug_struct("Function");
573        debug_struct.field("name", &self.name);
574        debug_struct.field("description", &self.description);
575        debug_struct.field("build_config", &self.build_config);
576        debug_struct.field("service_config", &self.service_config);
577        debug_struct.field("event_trigger", &self.event_trigger);
578        debug_struct.field("state", &self.state);
579        debug_struct.field("update_time", &self.update_time);
580        debug_struct.field("labels", &self.labels);
581        debug_struct.field("state_messages", &self.state_messages);
582        debug_struct.field("environment", &self.environment);
583        debug_struct.field("url", &self.url);
584        debug_struct.field("kms_key_name", &self.kms_key_name);
585        debug_struct.field("satisfies_pzs", &self.satisfies_pzs);
586        debug_struct.field("create_time", &self.create_time);
587        if !self._unknown_fields.is_empty() {
588            debug_struct.field("_unknown_fields", &self._unknown_fields);
589        }
590        debug_struct.finish()
591    }
592}
593
594/// Defines additional types related to [Function].
595pub mod function {
596    #[allow(unused_imports)]
597    use super::*;
598
599    /// Describes the current state of the function.
600    ///
601    /// # Working with unknown values
602    ///
603    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
604    /// additional enum variants at any time. Adding new variants is not considered
605    /// a breaking change. Applications should write their code in anticipation of:
606    ///
607    /// - New values appearing in future releases of the client library, **and**
608    /// - New values received dynamically, without application changes.
609    ///
610    /// Please consult the [Working with enums] section in the user guide for some
611    /// guidelines.
612    ///
613    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
614    #[derive(Clone, Debug, PartialEq)]
615    #[non_exhaustive]
616    pub enum State {
617        /// Not specified. Invalid state.
618        Unspecified,
619        /// Function has been successfully deployed and is serving.
620        Active,
621        /// Function deployment failed and the function is not serving.
622        Failed,
623        /// Function is being created or updated.
624        Deploying,
625        /// Function is being deleted.
626        Deleting,
627        /// Function deployment failed and the function serving state is undefined.
628        /// The function should be updated or deleted to move it out of this state.
629        Unknown,
630        /// If set, the enum was initialized with an unknown value.
631        ///
632        /// Applications can examine the value using [State::value] or
633        /// [State::name].
634        UnknownValue(state::UnknownValue),
635    }
636
637    #[doc(hidden)]
638    pub mod state {
639        #[allow(unused_imports)]
640        use super::*;
641        #[derive(Clone, Debug, PartialEq)]
642        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
643    }
644
645    impl State {
646        /// Gets the enum value.
647        ///
648        /// Returns `None` if the enum contains an unknown value deserialized from
649        /// the string representation of enums.
650        pub fn value(&self) -> std::option::Option<i32> {
651            match self {
652                Self::Unspecified => std::option::Option::Some(0),
653                Self::Active => std::option::Option::Some(1),
654                Self::Failed => std::option::Option::Some(2),
655                Self::Deploying => std::option::Option::Some(3),
656                Self::Deleting => std::option::Option::Some(4),
657                Self::Unknown => std::option::Option::Some(5),
658                Self::UnknownValue(u) => u.0.value(),
659            }
660        }
661
662        /// Gets the enum value as a string.
663        ///
664        /// Returns `None` if the enum contains an unknown value deserialized from
665        /// the integer representation of enums.
666        pub fn name(&self) -> std::option::Option<&str> {
667            match self {
668                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
669                Self::Active => std::option::Option::Some("ACTIVE"),
670                Self::Failed => std::option::Option::Some("FAILED"),
671                Self::Deploying => std::option::Option::Some("DEPLOYING"),
672                Self::Deleting => std::option::Option::Some("DELETING"),
673                Self::Unknown => std::option::Option::Some("UNKNOWN"),
674                Self::UnknownValue(u) => u.0.name(),
675            }
676        }
677    }
678
679    impl std::default::Default for State {
680        fn default() -> Self {
681            use std::convert::From;
682            Self::from(0)
683        }
684    }
685
686    impl std::fmt::Display for State {
687        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
688            wkt::internal::display_enum(f, self.name(), self.value())
689        }
690    }
691
692    impl std::convert::From<i32> for State {
693        fn from(value: i32) -> Self {
694            match value {
695                0 => Self::Unspecified,
696                1 => Self::Active,
697                2 => Self::Failed,
698                3 => Self::Deploying,
699                4 => Self::Deleting,
700                5 => Self::Unknown,
701                _ => Self::UnknownValue(state::UnknownValue(
702                    wkt::internal::UnknownEnumValue::Integer(value),
703                )),
704            }
705        }
706    }
707
708    impl std::convert::From<&str> for State {
709        fn from(value: &str) -> Self {
710            use std::string::ToString;
711            match value {
712                "STATE_UNSPECIFIED" => Self::Unspecified,
713                "ACTIVE" => Self::Active,
714                "FAILED" => Self::Failed,
715                "DEPLOYING" => Self::Deploying,
716                "DELETING" => Self::Deleting,
717                "UNKNOWN" => Self::Unknown,
718                _ => Self::UnknownValue(state::UnknownValue(
719                    wkt::internal::UnknownEnumValue::String(value.to_string()),
720                )),
721            }
722        }
723    }
724
725    impl serde::ser::Serialize for State {
726        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
727        where
728            S: serde::Serializer,
729        {
730            match self {
731                Self::Unspecified => serializer.serialize_i32(0),
732                Self::Active => serializer.serialize_i32(1),
733                Self::Failed => serializer.serialize_i32(2),
734                Self::Deploying => serializer.serialize_i32(3),
735                Self::Deleting => serializer.serialize_i32(4),
736                Self::Unknown => serializer.serialize_i32(5),
737                Self::UnknownValue(u) => u.0.serialize(serializer),
738            }
739        }
740    }
741
742    impl<'de> serde::de::Deserialize<'de> for State {
743        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
744        where
745            D: serde::Deserializer<'de>,
746        {
747            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
748                ".google.cloud.functions.v2.Function.State",
749            ))
750        }
751    }
752}
753
754/// Informational messages about the state of the Cloud Function or Operation.
755#[derive(Clone, Default, PartialEq)]
756#[non_exhaustive]
757pub struct StateMessage {
758    /// Severity of the state message.
759    pub severity: crate::model::state_message::Severity,
760
761    /// One-word CamelCase type of the state message.
762    pub r#type: std::string::String,
763
764    /// The message.
765    pub message: std::string::String,
766
767    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
768}
769
770impl StateMessage {
771    pub fn new() -> Self {
772        std::default::Default::default()
773    }
774
775    /// Sets the value of [severity][crate::model::StateMessage::severity].
776    pub fn set_severity<T: std::convert::Into<crate::model::state_message::Severity>>(
777        mut self,
778        v: T,
779    ) -> Self {
780        self.severity = v.into();
781        self
782    }
783
784    /// Sets the value of [r#type][crate::model::StateMessage::type].
785    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
786        self.r#type = v.into();
787        self
788    }
789
790    /// Sets the value of [message][crate::model::StateMessage::message].
791    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
792        self.message = v.into();
793        self
794    }
795}
796
797impl wkt::message::Message for StateMessage {
798    fn typename() -> &'static str {
799        "type.googleapis.com/google.cloud.functions.v2.StateMessage"
800    }
801}
802
803#[doc(hidden)]
804impl<'de> serde::de::Deserialize<'de> for StateMessage {
805    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
806    where
807        D: serde::Deserializer<'de>,
808    {
809        #[allow(non_camel_case_types)]
810        #[doc(hidden)]
811        #[derive(PartialEq, Eq, Hash)]
812        enum __FieldTag {
813            __severity,
814            __type,
815            __message,
816            Unknown(std::string::String),
817        }
818        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
819            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
820            where
821                D: serde::Deserializer<'de>,
822            {
823                struct Visitor;
824                impl<'de> serde::de::Visitor<'de> for Visitor {
825                    type Value = __FieldTag;
826                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
827                        formatter.write_str("a field name for StateMessage")
828                    }
829                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
830                    where
831                        E: serde::de::Error,
832                    {
833                        use std::result::Result::Ok;
834                        use std::string::ToString;
835                        match value {
836                            "severity" => Ok(__FieldTag::__severity),
837                            "type" => Ok(__FieldTag::__type),
838                            "message" => Ok(__FieldTag::__message),
839                            _ => Ok(__FieldTag::Unknown(value.to_string())),
840                        }
841                    }
842                }
843                deserializer.deserialize_identifier(Visitor)
844            }
845        }
846        struct Visitor;
847        impl<'de> serde::de::Visitor<'de> for Visitor {
848            type Value = StateMessage;
849            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
850                formatter.write_str("struct StateMessage")
851            }
852            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
853            where
854                A: serde::de::MapAccess<'de>,
855            {
856                #[allow(unused_imports)]
857                use serde::de::Error;
858                use std::option::Option::Some;
859                let mut fields = std::collections::HashSet::new();
860                let mut result = Self::Value::new();
861                while let Some(tag) = map.next_key::<__FieldTag>()? {
862                    #[allow(clippy::match_single_binding)]
863                    match tag {
864                        __FieldTag::__severity => {
865                            if !fields.insert(__FieldTag::__severity) {
866                                return std::result::Result::Err(A::Error::duplicate_field(
867                                    "multiple values for severity",
868                                ));
869                            }
870                            result.severity = map.next_value::<std::option::Option<crate::model::state_message::Severity>>()?.unwrap_or_default();
871                        }
872                        __FieldTag::__type => {
873                            if !fields.insert(__FieldTag::__type) {
874                                return std::result::Result::Err(A::Error::duplicate_field(
875                                    "multiple values for type",
876                                ));
877                            }
878                            result.r#type = map
879                                .next_value::<std::option::Option<std::string::String>>()?
880                                .unwrap_or_default();
881                        }
882                        __FieldTag::__message => {
883                            if !fields.insert(__FieldTag::__message) {
884                                return std::result::Result::Err(A::Error::duplicate_field(
885                                    "multiple values for message",
886                                ));
887                            }
888                            result.message = map
889                                .next_value::<std::option::Option<std::string::String>>()?
890                                .unwrap_or_default();
891                        }
892                        __FieldTag::Unknown(key) => {
893                            let value = map.next_value::<serde_json::Value>()?;
894                            result._unknown_fields.insert(key, value);
895                        }
896                    }
897                }
898                std::result::Result::Ok(result)
899            }
900        }
901        deserializer.deserialize_any(Visitor)
902    }
903}
904
905#[doc(hidden)]
906impl serde::ser::Serialize for StateMessage {
907    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
908    where
909        S: serde::ser::Serializer,
910    {
911        use serde::ser::SerializeMap;
912        #[allow(unused_imports)]
913        use std::option::Option::Some;
914        let mut state = serializer.serialize_map(std::option::Option::None)?;
915        if !wkt::internal::is_default(&self.severity) {
916            state.serialize_entry("severity", &self.severity)?;
917        }
918        if !self.r#type.is_empty() {
919            state.serialize_entry("type", &self.r#type)?;
920        }
921        if !self.message.is_empty() {
922            state.serialize_entry("message", &self.message)?;
923        }
924        if !self._unknown_fields.is_empty() {
925            for (key, value) in self._unknown_fields.iter() {
926                state.serialize_entry(key, &value)?;
927            }
928        }
929        state.end()
930    }
931}
932
933impl std::fmt::Debug for StateMessage {
934    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
935        let mut debug_struct = f.debug_struct("StateMessage");
936        debug_struct.field("severity", &self.severity);
937        debug_struct.field("r#type", &self.r#type);
938        debug_struct.field("message", &self.message);
939        if !self._unknown_fields.is_empty() {
940            debug_struct.field("_unknown_fields", &self._unknown_fields);
941        }
942        debug_struct.finish()
943    }
944}
945
946/// Defines additional types related to [StateMessage].
947pub mod state_message {
948    #[allow(unused_imports)]
949    use super::*;
950
951    /// Severity of the state message.
952    ///
953    /// # Working with unknown values
954    ///
955    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
956    /// additional enum variants at any time. Adding new variants is not considered
957    /// a breaking change. Applications should write their code in anticipation of:
958    ///
959    /// - New values appearing in future releases of the client library, **and**
960    /// - New values received dynamically, without application changes.
961    ///
962    /// Please consult the [Working with enums] section in the user guide for some
963    /// guidelines.
964    ///
965    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
966    #[derive(Clone, Debug, PartialEq)]
967    #[non_exhaustive]
968    pub enum Severity {
969        /// Not specified. Invalid severity.
970        Unspecified,
971        /// ERROR-level severity.
972        Error,
973        /// WARNING-level severity.
974        Warning,
975        /// INFO-level severity.
976        Info,
977        /// If set, the enum was initialized with an unknown value.
978        ///
979        /// Applications can examine the value using [Severity::value] or
980        /// [Severity::name].
981        UnknownValue(severity::UnknownValue),
982    }
983
984    #[doc(hidden)]
985    pub mod severity {
986        #[allow(unused_imports)]
987        use super::*;
988        #[derive(Clone, Debug, PartialEq)]
989        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
990    }
991
992    impl Severity {
993        /// Gets the enum value.
994        ///
995        /// Returns `None` if the enum contains an unknown value deserialized from
996        /// the string representation of enums.
997        pub fn value(&self) -> std::option::Option<i32> {
998            match self {
999                Self::Unspecified => std::option::Option::Some(0),
1000                Self::Error => std::option::Option::Some(1),
1001                Self::Warning => std::option::Option::Some(2),
1002                Self::Info => std::option::Option::Some(3),
1003                Self::UnknownValue(u) => u.0.value(),
1004            }
1005        }
1006
1007        /// Gets the enum value as a string.
1008        ///
1009        /// Returns `None` if the enum contains an unknown value deserialized from
1010        /// the integer representation of enums.
1011        pub fn name(&self) -> std::option::Option<&str> {
1012            match self {
1013                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1014                Self::Error => std::option::Option::Some("ERROR"),
1015                Self::Warning => std::option::Option::Some("WARNING"),
1016                Self::Info => std::option::Option::Some("INFO"),
1017                Self::UnknownValue(u) => u.0.name(),
1018            }
1019        }
1020    }
1021
1022    impl std::default::Default for Severity {
1023        fn default() -> Self {
1024            use std::convert::From;
1025            Self::from(0)
1026        }
1027    }
1028
1029    impl std::fmt::Display for Severity {
1030        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1031            wkt::internal::display_enum(f, self.name(), self.value())
1032        }
1033    }
1034
1035    impl std::convert::From<i32> for Severity {
1036        fn from(value: i32) -> Self {
1037            match value {
1038                0 => Self::Unspecified,
1039                1 => Self::Error,
1040                2 => Self::Warning,
1041                3 => Self::Info,
1042                _ => Self::UnknownValue(severity::UnknownValue(
1043                    wkt::internal::UnknownEnumValue::Integer(value),
1044                )),
1045            }
1046        }
1047    }
1048
1049    impl std::convert::From<&str> for Severity {
1050        fn from(value: &str) -> Self {
1051            use std::string::ToString;
1052            match value {
1053                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1054                "ERROR" => Self::Error,
1055                "WARNING" => Self::Warning,
1056                "INFO" => Self::Info,
1057                _ => Self::UnknownValue(severity::UnknownValue(
1058                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1059                )),
1060            }
1061        }
1062    }
1063
1064    impl serde::ser::Serialize for Severity {
1065        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1066        where
1067            S: serde::Serializer,
1068        {
1069            match self {
1070                Self::Unspecified => serializer.serialize_i32(0),
1071                Self::Error => serializer.serialize_i32(1),
1072                Self::Warning => serializer.serialize_i32(2),
1073                Self::Info => serializer.serialize_i32(3),
1074                Self::UnknownValue(u) => u.0.serialize(serializer),
1075            }
1076        }
1077    }
1078
1079    impl<'de> serde::de::Deserialize<'de> for Severity {
1080        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1081        where
1082            D: serde::Deserializer<'de>,
1083        {
1084            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1085                ".google.cloud.functions.v2.StateMessage.Severity",
1086            ))
1087        }
1088    }
1089}
1090
1091/// Location of the source in an archive file in Google Cloud Storage.
1092#[derive(Clone, Default, PartialEq)]
1093#[non_exhaustive]
1094pub struct StorageSource {
1095    /// Google Cloud Storage bucket containing the source (see
1096    /// [Bucket Name
1097    /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
1098    pub bucket: std::string::String,
1099
1100    /// Google Cloud Storage object containing the source.
1101    ///
1102    /// This object must be a gzipped archive file (`.tar.gz`) containing source to
1103    /// build.
1104    pub object: std::string::String,
1105
1106    /// Google Cloud Storage generation for the object. If the generation is
1107    /// omitted, the latest generation will be used.
1108    pub generation: i64,
1109
1110    /// When the specified storage bucket is a 1st gen function uploard url bucket,
1111    /// this field should be set as the generated upload url for 1st gen
1112    /// deployment.
1113    pub source_upload_url: std::string::String,
1114
1115    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1116}
1117
1118impl StorageSource {
1119    pub fn new() -> Self {
1120        std::default::Default::default()
1121    }
1122
1123    /// Sets the value of [bucket][crate::model::StorageSource::bucket].
1124    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1125        self.bucket = v.into();
1126        self
1127    }
1128
1129    /// Sets the value of [object][crate::model::StorageSource::object].
1130    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1131        self.object = v.into();
1132        self
1133    }
1134
1135    /// Sets the value of [generation][crate::model::StorageSource::generation].
1136    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1137        self.generation = v.into();
1138        self
1139    }
1140
1141    /// Sets the value of [source_upload_url][crate::model::StorageSource::source_upload_url].
1142    pub fn set_source_upload_url<T: std::convert::Into<std::string::String>>(
1143        mut self,
1144        v: T,
1145    ) -> Self {
1146        self.source_upload_url = v.into();
1147        self
1148    }
1149}
1150
1151impl wkt::message::Message for StorageSource {
1152    fn typename() -> &'static str {
1153        "type.googleapis.com/google.cloud.functions.v2.StorageSource"
1154    }
1155}
1156
1157#[doc(hidden)]
1158impl<'de> serde::de::Deserialize<'de> for StorageSource {
1159    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1160    where
1161        D: serde::Deserializer<'de>,
1162    {
1163        #[allow(non_camel_case_types)]
1164        #[doc(hidden)]
1165        #[derive(PartialEq, Eq, Hash)]
1166        enum __FieldTag {
1167            __bucket,
1168            __object,
1169            __generation,
1170            __source_upload_url,
1171            Unknown(std::string::String),
1172        }
1173        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1174            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1175            where
1176                D: serde::Deserializer<'de>,
1177            {
1178                struct Visitor;
1179                impl<'de> serde::de::Visitor<'de> for Visitor {
1180                    type Value = __FieldTag;
1181                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1182                        formatter.write_str("a field name for StorageSource")
1183                    }
1184                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1185                    where
1186                        E: serde::de::Error,
1187                    {
1188                        use std::result::Result::Ok;
1189                        use std::string::ToString;
1190                        match value {
1191                            "bucket" => Ok(__FieldTag::__bucket),
1192                            "object" => Ok(__FieldTag::__object),
1193                            "generation" => Ok(__FieldTag::__generation),
1194                            "sourceUploadUrl" => Ok(__FieldTag::__source_upload_url),
1195                            "source_upload_url" => Ok(__FieldTag::__source_upload_url),
1196                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1197                        }
1198                    }
1199                }
1200                deserializer.deserialize_identifier(Visitor)
1201            }
1202        }
1203        struct Visitor;
1204        impl<'de> serde::de::Visitor<'de> for Visitor {
1205            type Value = StorageSource;
1206            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1207                formatter.write_str("struct StorageSource")
1208            }
1209            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1210            where
1211                A: serde::de::MapAccess<'de>,
1212            {
1213                #[allow(unused_imports)]
1214                use serde::de::Error;
1215                use std::option::Option::Some;
1216                let mut fields = std::collections::HashSet::new();
1217                let mut result = Self::Value::new();
1218                while let Some(tag) = map.next_key::<__FieldTag>()? {
1219                    #[allow(clippy::match_single_binding)]
1220                    match tag {
1221                        __FieldTag::__bucket => {
1222                            if !fields.insert(__FieldTag::__bucket) {
1223                                return std::result::Result::Err(A::Error::duplicate_field(
1224                                    "multiple values for bucket",
1225                                ));
1226                            }
1227                            result.bucket = map
1228                                .next_value::<std::option::Option<std::string::String>>()?
1229                                .unwrap_or_default();
1230                        }
1231                        __FieldTag::__object => {
1232                            if !fields.insert(__FieldTag::__object) {
1233                                return std::result::Result::Err(A::Error::duplicate_field(
1234                                    "multiple values for object",
1235                                ));
1236                            }
1237                            result.object = map
1238                                .next_value::<std::option::Option<std::string::String>>()?
1239                                .unwrap_or_default();
1240                        }
1241                        __FieldTag::__generation => {
1242                            if !fields.insert(__FieldTag::__generation) {
1243                                return std::result::Result::Err(A::Error::duplicate_field(
1244                                    "multiple values for generation",
1245                                ));
1246                            }
1247                            struct __With(std::option::Option<i64>);
1248                            impl<'de> serde::de::Deserialize<'de> for __With {
1249                                fn deserialize<D>(
1250                                    deserializer: D,
1251                                ) -> std::result::Result<Self, D::Error>
1252                                where
1253                                    D: serde::de::Deserializer<'de>,
1254                                {
1255                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1256                                }
1257                            }
1258                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
1259                        }
1260                        __FieldTag::__source_upload_url => {
1261                            if !fields.insert(__FieldTag::__source_upload_url) {
1262                                return std::result::Result::Err(A::Error::duplicate_field(
1263                                    "multiple values for source_upload_url",
1264                                ));
1265                            }
1266                            result.source_upload_url = map
1267                                .next_value::<std::option::Option<std::string::String>>()?
1268                                .unwrap_or_default();
1269                        }
1270                        __FieldTag::Unknown(key) => {
1271                            let value = map.next_value::<serde_json::Value>()?;
1272                            result._unknown_fields.insert(key, value);
1273                        }
1274                    }
1275                }
1276                std::result::Result::Ok(result)
1277            }
1278        }
1279        deserializer.deserialize_any(Visitor)
1280    }
1281}
1282
1283#[doc(hidden)]
1284impl serde::ser::Serialize for StorageSource {
1285    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1286    where
1287        S: serde::ser::Serializer,
1288    {
1289        use serde::ser::SerializeMap;
1290        #[allow(unused_imports)]
1291        use std::option::Option::Some;
1292        let mut state = serializer.serialize_map(std::option::Option::None)?;
1293        if !self.bucket.is_empty() {
1294            state.serialize_entry("bucket", &self.bucket)?;
1295        }
1296        if !self.object.is_empty() {
1297            state.serialize_entry("object", &self.object)?;
1298        }
1299        if !wkt::internal::is_default(&self.generation) {
1300            struct __With<'a>(&'a i64);
1301            impl<'a> serde::ser::Serialize for __With<'a> {
1302                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1303                where
1304                    S: serde::ser::Serializer,
1305                {
1306                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1307                }
1308            }
1309            state.serialize_entry("generation", &__With(&self.generation))?;
1310        }
1311        if !self.source_upload_url.is_empty() {
1312            state.serialize_entry("sourceUploadUrl", &self.source_upload_url)?;
1313        }
1314        if !self._unknown_fields.is_empty() {
1315            for (key, value) in self._unknown_fields.iter() {
1316                state.serialize_entry(key, &value)?;
1317            }
1318        }
1319        state.end()
1320    }
1321}
1322
1323impl std::fmt::Debug for StorageSource {
1324    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1325        let mut debug_struct = f.debug_struct("StorageSource");
1326        debug_struct.field("bucket", &self.bucket);
1327        debug_struct.field("object", &self.object);
1328        debug_struct.field("generation", &self.generation);
1329        debug_struct.field("source_upload_url", &self.source_upload_url);
1330        if !self._unknown_fields.is_empty() {
1331            debug_struct.field("_unknown_fields", &self._unknown_fields);
1332        }
1333        debug_struct.finish()
1334    }
1335}
1336
1337/// Location of the source in a Google Cloud Source Repository.
1338#[derive(Clone, Default, PartialEq)]
1339#[non_exhaustive]
1340pub struct RepoSource {
1341    /// ID of the project that owns the Cloud Source Repository. If omitted, the
1342    /// project ID requesting the build is assumed.
1343    pub project_id: std::string::String,
1344
1345    /// Name of the Cloud Source Repository.
1346    pub repo_name: std::string::String,
1347
1348    /// Directory, relative to the source root, in which to run the build.
1349    ///
1350    /// This must be a relative path. If a step's `dir` is specified and is an
1351    /// absolute path, this value is ignored for that step's execution.
1352    /// eg. helloworld (no leading slash allowed)
1353    pub dir: std::string::String,
1354
1355    /// Only trigger a build if the revision regex does NOT match the revision
1356    /// regex.
1357    pub invert_regex: bool,
1358
1359    /// A revision within the Cloud Source Repository must be specified in
1360    /// one of these ways.
1361    pub revision: std::option::Option<crate::model::repo_source::Revision>,
1362
1363    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1364}
1365
1366impl RepoSource {
1367    pub fn new() -> Self {
1368        std::default::Default::default()
1369    }
1370
1371    /// Sets the value of [project_id][crate::model::RepoSource::project_id].
1372    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1373        self.project_id = v.into();
1374        self
1375    }
1376
1377    /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
1378    pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1379        self.repo_name = v.into();
1380        self
1381    }
1382
1383    /// Sets the value of [dir][crate::model::RepoSource::dir].
1384    pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1385        self.dir = v.into();
1386        self
1387    }
1388
1389    /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
1390    pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1391        self.invert_regex = v.into();
1392        self
1393    }
1394
1395    /// Sets the value of [revision][crate::model::RepoSource::revision].
1396    ///
1397    /// Note that all the setters affecting `revision` are mutually
1398    /// exclusive.
1399    pub fn set_revision<
1400        T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
1401    >(
1402        mut self,
1403        v: T,
1404    ) -> Self {
1405        self.revision = v.into();
1406        self
1407    }
1408
1409    /// The value of [revision][crate::model::RepoSource::revision]
1410    /// if it holds a `BranchName`, `None` if the field is not set or
1411    /// holds a different branch.
1412    pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
1413        #[allow(unreachable_patterns)]
1414        self.revision.as_ref().and_then(|v| match v {
1415            crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
1416            _ => std::option::Option::None,
1417        })
1418    }
1419
1420    /// Sets the value of [revision][crate::model::RepoSource::revision]
1421    /// to hold a `BranchName`.
1422    ///
1423    /// Note that all the setters affecting `revision` are
1424    /// mutually exclusive.
1425    pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426        self.revision =
1427            std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
1428        self
1429    }
1430
1431    /// The value of [revision][crate::model::RepoSource::revision]
1432    /// if it holds a `TagName`, `None` if the field is not set or
1433    /// holds a different branch.
1434    pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
1435        #[allow(unreachable_patterns)]
1436        self.revision.as_ref().and_then(|v| match v {
1437            crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
1438            _ => std::option::Option::None,
1439        })
1440    }
1441
1442    /// Sets the value of [revision][crate::model::RepoSource::revision]
1443    /// to hold a `TagName`.
1444    ///
1445    /// Note that all the setters affecting `revision` are
1446    /// mutually exclusive.
1447    pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1448        self.revision =
1449            std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
1450        self
1451    }
1452
1453    /// The value of [revision][crate::model::RepoSource::revision]
1454    /// if it holds a `CommitSha`, `None` if the field is not set or
1455    /// holds a different branch.
1456    pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
1457        #[allow(unreachable_patterns)]
1458        self.revision.as_ref().and_then(|v| match v {
1459            crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
1460            _ => std::option::Option::None,
1461        })
1462    }
1463
1464    /// Sets the value of [revision][crate::model::RepoSource::revision]
1465    /// to hold a `CommitSha`.
1466    ///
1467    /// Note that all the setters affecting `revision` are
1468    /// mutually exclusive.
1469    pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1470        self.revision =
1471            std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
1472        self
1473    }
1474}
1475
1476impl wkt::message::Message for RepoSource {
1477    fn typename() -> &'static str {
1478        "type.googleapis.com/google.cloud.functions.v2.RepoSource"
1479    }
1480}
1481
1482#[doc(hidden)]
1483impl<'de> serde::de::Deserialize<'de> for RepoSource {
1484    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1485    where
1486        D: serde::Deserializer<'de>,
1487    {
1488        #[allow(non_camel_case_types)]
1489        #[doc(hidden)]
1490        #[derive(PartialEq, Eq, Hash)]
1491        enum __FieldTag {
1492            __branch_name,
1493            __tag_name,
1494            __commit_sha,
1495            __project_id,
1496            __repo_name,
1497            __dir,
1498            __invert_regex,
1499            Unknown(std::string::String),
1500        }
1501        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1502            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1503            where
1504                D: serde::Deserializer<'de>,
1505            {
1506                struct Visitor;
1507                impl<'de> serde::de::Visitor<'de> for Visitor {
1508                    type Value = __FieldTag;
1509                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1510                        formatter.write_str("a field name for RepoSource")
1511                    }
1512                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1513                    where
1514                        E: serde::de::Error,
1515                    {
1516                        use std::result::Result::Ok;
1517                        use std::string::ToString;
1518                        match value {
1519                            "branchName" => Ok(__FieldTag::__branch_name),
1520                            "branch_name" => Ok(__FieldTag::__branch_name),
1521                            "tagName" => Ok(__FieldTag::__tag_name),
1522                            "tag_name" => Ok(__FieldTag::__tag_name),
1523                            "commitSha" => Ok(__FieldTag::__commit_sha),
1524                            "commit_sha" => Ok(__FieldTag::__commit_sha),
1525                            "projectId" => Ok(__FieldTag::__project_id),
1526                            "project_id" => Ok(__FieldTag::__project_id),
1527                            "repoName" => Ok(__FieldTag::__repo_name),
1528                            "repo_name" => Ok(__FieldTag::__repo_name),
1529                            "dir" => Ok(__FieldTag::__dir),
1530                            "invertRegex" => Ok(__FieldTag::__invert_regex),
1531                            "invert_regex" => Ok(__FieldTag::__invert_regex),
1532                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1533                        }
1534                    }
1535                }
1536                deserializer.deserialize_identifier(Visitor)
1537            }
1538        }
1539        struct Visitor;
1540        impl<'de> serde::de::Visitor<'de> for Visitor {
1541            type Value = RepoSource;
1542            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1543                formatter.write_str("struct RepoSource")
1544            }
1545            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1546            where
1547                A: serde::de::MapAccess<'de>,
1548            {
1549                #[allow(unused_imports)]
1550                use serde::de::Error;
1551                use std::option::Option::Some;
1552                let mut fields = std::collections::HashSet::new();
1553                let mut result = Self::Value::new();
1554                while let Some(tag) = map.next_key::<__FieldTag>()? {
1555                    #[allow(clippy::match_single_binding)]
1556                    match tag {
1557                        __FieldTag::__branch_name => {
1558                            if !fields.insert(__FieldTag::__branch_name) {
1559                                return std::result::Result::Err(A::Error::duplicate_field(
1560                                    "multiple values for branch_name",
1561                                ));
1562                            }
1563                            if result.revision.is_some() {
1564                                return std::result::Result::Err(A::Error::duplicate_field(
1565                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.branch_name, latest field was branchName",
1566                                ));
1567                            }
1568                            result.revision = std::option::Option::Some(
1569                                crate::model::repo_source::Revision::BranchName(
1570                                    map.next_value::<std::option::Option<std::string::String>>()?
1571                                        .unwrap_or_default(),
1572                                ),
1573                            );
1574                        }
1575                        __FieldTag::__tag_name => {
1576                            if !fields.insert(__FieldTag::__tag_name) {
1577                                return std::result::Result::Err(A::Error::duplicate_field(
1578                                    "multiple values for tag_name",
1579                                ));
1580                            }
1581                            if result.revision.is_some() {
1582                                return std::result::Result::Err(A::Error::duplicate_field(
1583                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.tag_name, latest field was tagName",
1584                                ));
1585                            }
1586                            result.revision = std::option::Option::Some(
1587                                crate::model::repo_source::Revision::TagName(
1588                                    map.next_value::<std::option::Option<std::string::String>>()?
1589                                        .unwrap_or_default(),
1590                                ),
1591                            );
1592                        }
1593                        __FieldTag::__commit_sha => {
1594                            if !fields.insert(__FieldTag::__commit_sha) {
1595                                return std::result::Result::Err(A::Error::duplicate_field(
1596                                    "multiple values for commit_sha",
1597                                ));
1598                            }
1599                            if result.revision.is_some() {
1600                                return std::result::Result::Err(A::Error::duplicate_field(
1601                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.commit_sha, latest field was commitSha",
1602                                ));
1603                            }
1604                            result.revision = std::option::Option::Some(
1605                                crate::model::repo_source::Revision::CommitSha(
1606                                    map.next_value::<std::option::Option<std::string::String>>()?
1607                                        .unwrap_or_default(),
1608                                ),
1609                            );
1610                        }
1611                        __FieldTag::__project_id => {
1612                            if !fields.insert(__FieldTag::__project_id) {
1613                                return std::result::Result::Err(A::Error::duplicate_field(
1614                                    "multiple values for project_id",
1615                                ));
1616                            }
1617                            result.project_id = map
1618                                .next_value::<std::option::Option<std::string::String>>()?
1619                                .unwrap_or_default();
1620                        }
1621                        __FieldTag::__repo_name => {
1622                            if !fields.insert(__FieldTag::__repo_name) {
1623                                return std::result::Result::Err(A::Error::duplicate_field(
1624                                    "multiple values for repo_name",
1625                                ));
1626                            }
1627                            result.repo_name = map
1628                                .next_value::<std::option::Option<std::string::String>>()?
1629                                .unwrap_or_default();
1630                        }
1631                        __FieldTag::__dir => {
1632                            if !fields.insert(__FieldTag::__dir) {
1633                                return std::result::Result::Err(A::Error::duplicate_field(
1634                                    "multiple values for dir",
1635                                ));
1636                            }
1637                            result.dir = map
1638                                .next_value::<std::option::Option<std::string::String>>()?
1639                                .unwrap_or_default();
1640                        }
1641                        __FieldTag::__invert_regex => {
1642                            if !fields.insert(__FieldTag::__invert_regex) {
1643                                return std::result::Result::Err(A::Error::duplicate_field(
1644                                    "multiple values for invert_regex",
1645                                ));
1646                            }
1647                            result.invert_regex = map
1648                                .next_value::<std::option::Option<bool>>()?
1649                                .unwrap_or_default();
1650                        }
1651                        __FieldTag::Unknown(key) => {
1652                            let value = map.next_value::<serde_json::Value>()?;
1653                            result._unknown_fields.insert(key, value);
1654                        }
1655                    }
1656                }
1657                std::result::Result::Ok(result)
1658            }
1659        }
1660        deserializer.deserialize_any(Visitor)
1661    }
1662}
1663
1664#[doc(hidden)]
1665impl serde::ser::Serialize for RepoSource {
1666    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1667    where
1668        S: serde::ser::Serializer,
1669    {
1670        use serde::ser::SerializeMap;
1671        #[allow(unused_imports)]
1672        use std::option::Option::Some;
1673        let mut state = serializer.serialize_map(std::option::Option::None)?;
1674        if let Some(value) = self.branch_name() {
1675            state.serialize_entry("branchName", value)?;
1676        }
1677        if let Some(value) = self.tag_name() {
1678            state.serialize_entry("tagName", value)?;
1679        }
1680        if let Some(value) = self.commit_sha() {
1681            state.serialize_entry("commitSha", value)?;
1682        }
1683        if !self.project_id.is_empty() {
1684            state.serialize_entry("projectId", &self.project_id)?;
1685        }
1686        if !self.repo_name.is_empty() {
1687            state.serialize_entry("repoName", &self.repo_name)?;
1688        }
1689        if !self.dir.is_empty() {
1690            state.serialize_entry("dir", &self.dir)?;
1691        }
1692        if !wkt::internal::is_default(&self.invert_regex) {
1693            state.serialize_entry("invertRegex", &self.invert_regex)?;
1694        }
1695        if !self._unknown_fields.is_empty() {
1696            for (key, value) in self._unknown_fields.iter() {
1697                state.serialize_entry(key, &value)?;
1698            }
1699        }
1700        state.end()
1701    }
1702}
1703
1704impl std::fmt::Debug for RepoSource {
1705    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1706        let mut debug_struct = f.debug_struct("RepoSource");
1707        debug_struct.field("project_id", &self.project_id);
1708        debug_struct.field("repo_name", &self.repo_name);
1709        debug_struct.field("dir", &self.dir);
1710        debug_struct.field("invert_regex", &self.invert_regex);
1711        debug_struct.field("revision", &self.revision);
1712        if !self._unknown_fields.is_empty() {
1713            debug_struct.field("_unknown_fields", &self._unknown_fields);
1714        }
1715        debug_struct.finish()
1716    }
1717}
1718
1719/// Defines additional types related to [RepoSource].
1720pub mod repo_source {
1721    #[allow(unused_imports)]
1722    use super::*;
1723
1724    /// A revision within the Cloud Source Repository must be specified in
1725    /// one of these ways.
1726    #[derive(Clone, Debug, PartialEq)]
1727    #[non_exhaustive]
1728    pub enum Revision {
1729        /// Regex matching branches to build.
1730        ///
1731        /// The syntax of the regular expressions accepted is the syntax accepted by
1732        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1733        BranchName(std::string::String),
1734        /// Regex matching tags to build.
1735        ///
1736        /// The syntax of the regular expressions accepted is the syntax accepted by
1737        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1738        TagName(std::string::String),
1739        /// Explicit commit SHA to build.
1740        CommitSha(std::string::String),
1741    }
1742}
1743
1744/// The location of the function source code.
1745#[derive(Clone, Default, PartialEq)]
1746#[non_exhaustive]
1747pub struct Source {
1748    /// Location of the source.
1749    /// At least one source needs to be provided for the deployment to succeed.
1750    pub source: std::option::Option<crate::model::source::Source>,
1751
1752    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1753}
1754
1755impl Source {
1756    pub fn new() -> Self {
1757        std::default::Default::default()
1758    }
1759
1760    /// Sets the value of [source][crate::model::Source::source].
1761    ///
1762    /// Note that all the setters affecting `source` are mutually
1763    /// exclusive.
1764    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1765        mut self,
1766        v: T,
1767    ) -> Self {
1768        self.source = v.into();
1769        self
1770    }
1771
1772    /// The value of [source][crate::model::Source::source]
1773    /// if it holds a `StorageSource`, `None` if the field is not set or
1774    /// holds a different branch.
1775    pub fn storage_source(
1776        &self,
1777    ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1778        #[allow(unreachable_patterns)]
1779        self.source.as_ref().and_then(|v| match v {
1780            crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1781            _ => std::option::Option::None,
1782        })
1783    }
1784
1785    /// Sets the value of [source][crate::model::Source::source]
1786    /// to hold a `StorageSource`.
1787    ///
1788    /// Note that all the setters affecting `source` are
1789    /// mutually exclusive.
1790    pub fn set_storage_source<
1791        T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1792    >(
1793        mut self,
1794        v: T,
1795    ) -> Self {
1796        self.source =
1797            std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1798        self
1799    }
1800
1801    /// The value of [source][crate::model::Source::source]
1802    /// if it holds a `RepoSource`, `None` if the field is not set or
1803    /// holds a different branch.
1804    pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1805        #[allow(unreachable_patterns)]
1806        self.source.as_ref().and_then(|v| match v {
1807            crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1808            _ => std::option::Option::None,
1809        })
1810    }
1811
1812    /// Sets the value of [source][crate::model::Source::source]
1813    /// to hold a `RepoSource`.
1814    ///
1815    /// Note that all the setters affecting `source` are
1816    /// mutually exclusive.
1817    pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1818        mut self,
1819        v: T,
1820    ) -> Self {
1821        self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1822        self
1823    }
1824
1825    /// The value of [source][crate::model::Source::source]
1826    /// if it holds a `GitUri`, `None` if the field is not set or
1827    /// holds a different branch.
1828    pub fn git_uri(&self) -> std::option::Option<&std::string::String> {
1829        #[allow(unreachable_patterns)]
1830        self.source.as_ref().and_then(|v| match v {
1831            crate::model::source::Source::GitUri(v) => std::option::Option::Some(v),
1832            _ => std::option::Option::None,
1833        })
1834    }
1835
1836    /// Sets the value of [source][crate::model::Source::source]
1837    /// to hold a `GitUri`.
1838    ///
1839    /// Note that all the setters affecting `source` are
1840    /// mutually exclusive.
1841    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1842        self.source = std::option::Option::Some(crate::model::source::Source::GitUri(v.into()));
1843        self
1844    }
1845}
1846
1847impl wkt::message::Message for Source {
1848    fn typename() -> &'static str {
1849        "type.googleapis.com/google.cloud.functions.v2.Source"
1850    }
1851}
1852
1853#[doc(hidden)]
1854impl<'de> serde::de::Deserialize<'de> for Source {
1855    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1856    where
1857        D: serde::Deserializer<'de>,
1858    {
1859        #[allow(non_camel_case_types)]
1860        #[doc(hidden)]
1861        #[derive(PartialEq, Eq, Hash)]
1862        enum __FieldTag {
1863            __storage_source,
1864            __repo_source,
1865            __git_uri,
1866            Unknown(std::string::String),
1867        }
1868        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1869            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1870            where
1871                D: serde::Deserializer<'de>,
1872            {
1873                struct Visitor;
1874                impl<'de> serde::de::Visitor<'de> for Visitor {
1875                    type Value = __FieldTag;
1876                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1877                        formatter.write_str("a field name for Source")
1878                    }
1879                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1880                    where
1881                        E: serde::de::Error,
1882                    {
1883                        use std::result::Result::Ok;
1884                        use std::string::ToString;
1885                        match value {
1886                            "storageSource" => Ok(__FieldTag::__storage_source),
1887                            "storage_source" => Ok(__FieldTag::__storage_source),
1888                            "repoSource" => Ok(__FieldTag::__repo_source),
1889                            "repo_source" => Ok(__FieldTag::__repo_source),
1890                            "gitUri" => Ok(__FieldTag::__git_uri),
1891                            "git_uri" => Ok(__FieldTag::__git_uri),
1892                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1893                        }
1894                    }
1895                }
1896                deserializer.deserialize_identifier(Visitor)
1897            }
1898        }
1899        struct Visitor;
1900        impl<'de> serde::de::Visitor<'de> for Visitor {
1901            type Value = Source;
1902            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1903                formatter.write_str("struct Source")
1904            }
1905            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1906            where
1907                A: serde::de::MapAccess<'de>,
1908            {
1909                #[allow(unused_imports)]
1910                use serde::de::Error;
1911                use std::option::Option::Some;
1912                let mut fields = std::collections::HashSet::new();
1913                let mut result = Self::Value::new();
1914                while let Some(tag) = map.next_key::<__FieldTag>()? {
1915                    #[allow(clippy::match_single_binding)]
1916                    match tag {
1917                        __FieldTag::__storage_source => {
1918                            if !fields.insert(__FieldTag::__storage_source) {
1919                                return std::result::Result::Err(A::Error::duplicate_field(
1920                                    "multiple values for storage_source",
1921                                ));
1922                            }
1923                            if result.source.is_some() {
1924                                return std::result::Result::Err(A::Error::duplicate_field(
1925                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.storage_source, latest field was storageSource",
1926                                ));
1927                            }
1928                            result.source = std::option::Option::Some(
1929                                crate::model::source::Source::StorageSource(
1930                                    map.next_value::<std::option::Option<
1931                                        std::boxed::Box<crate::model::StorageSource>,
1932                                    >>()?
1933                                    .unwrap_or_default(),
1934                                ),
1935                            );
1936                        }
1937                        __FieldTag::__repo_source => {
1938                            if !fields.insert(__FieldTag::__repo_source) {
1939                                return std::result::Result::Err(A::Error::duplicate_field(
1940                                    "multiple values for repo_source",
1941                                ));
1942                            }
1943                            if result.source.is_some() {
1944                                return std::result::Result::Err(A::Error::duplicate_field(
1945                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.repo_source, latest field was repoSource",
1946                                ));
1947                            }
1948                            result.source = std::option::Option::Some(
1949                                crate::model::source::Source::RepoSource(
1950                                    map.next_value::<std::option::Option<
1951                                        std::boxed::Box<crate::model::RepoSource>,
1952                                    >>()?
1953                                    .unwrap_or_default(),
1954                                ),
1955                            );
1956                        }
1957                        __FieldTag::__git_uri => {
1958                            if !fields.insert(__FieldTag::__git_uri) {
1959                                return std::result::Result::Err(A::Error::duplicate_field(
1960                                    "multiple values for git_uri",
1961                                ));
1962                            }
1963                            if result.source.is_some() {
1964                                return std::result::Result::Err(A::Error::duplicate_field(
1965                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.git_uri, latest field was gitUri",
1966                                ));
1967                            }
1968                            result.source =
1969                                std::option::Option::Some(crate::model::source::Source::GitUri(
1970                                    map.next_value::<std::option::Option<std::string::String>>()?
1971                                        .unwrap_or_default(),
1972                                ));
1973                        }
1974                        __FieldTag::Unknown(key) => {
1975                            let value = map.next_value::<serde_json::Value>()?;
1976                            result._unknown_fields.insert(key, value);
1977                        }
1978                    }
1979                }
1980                std::result::Result::Ok(result)
1981            }
1982        }
1983        deserializer.deserialize_any(Visitor)
1984    }
1985}
1986
1987#[doc(hidden)]
1988impl serde::ser::Serialize for Source {
1989    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1990    where
1991        S: serde::ser::Serializer,
1992    {
1993        use serde::ser::SerializeMap;
1994        #[allow(unused_imports)]
1995        use std::option::Option::Some;
1996        let mut state = serializer.serialize_map(std::option::Option::None)?;
1997        if let Some(value) = self.storage_source() {
1998            state.serialize_entry("storageSource", value)?;
1999        }
2000        if let Some(value) = self.repo_source() {
2001            state.serialize_entry("repoSource", value)?;
2002        }
2003        if let Some(value) = self.git_uri() {
2004            state.serialize_entry("gitUri", value)?;
2005        }
2006        if !self._unknown_fields.is_empty() {
2007            for (key, value) in self._unknown_fields.iter() {
2008                state.serialize_entry(key, &value)?;
2009            }
2010        }
2011        state.end()
2012    }
2013}
2014
2015impl std::fmt::Debug for Source {
2016    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2017        let mut debug_struct = f.debug_struct("Source");
2018        debug_struct.field("source", &self.source);
2019        if !self._unknown_fields.is_empty() {
2020            debug_struct.field("_unknown_fields", &self._unknown_fields);
2021        }
2022        debug_struct.finish()
2023    }
2024}
2025
2026/// Defines additional types related to [Source].
2027pub mod source {
2028    #[allow(unused_imports)]
2029    use super::*;
2030
2031    /// Location of the source.
2032    /// At least one source needs to be provided for the deployment to succeed.
2033    #[derive(Clone, Debug, PartialEq)]
2034    #[non_exhaustive]
2035    pub enum Source {
2036        /// If provided, get the source from this location in Google Cloud Storage.
2037        StorageSource(std::boxed::Box<crate::model::StorageSource>),
2038        /// If provided, get the source from this location in a Cloud Source
2039        /// Repository.
2040        RepoSource(std::boxed::Box<crate::model::RepoSource>),
2041        /// If provided, get the source from GitHub repository. This option is valid
2042        /// only for GCF 1st Gen function.
2043        /// Example: <https://github.com/>\<user\>/\<repo\>/blob/\<commit\>/\<path-to-code\>
2044        GitUri(std::string::String),
2045    }
2046}
2047
2048/// Provenance of the source. Ways to find the original source, or verify that
2049/// some source was used for this build.
2050#[derive(Clone, Default, PartialEq)]
2051#[non_exhaustive]
2052pub struct SourceProvenance {
2053    /// A copy of the build's `source.storage_source`, if exists, with any
2054    /// generations resolved.
2055    pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
2056
2057    /// A copy of the build's `source.repo_source`, if exists, with any
2058    /// revisions resolved.
2059    pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
2060
2061    /// A copy of the build's `source.git_uri`, if exists, with any commits
2062    /// resolved.
2063    pub git_uri: std::string::String,
2064
2065    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2066}
2067
2068impl SourceProvenance {
2069    pub fn new() -> Self {
2070        std::default::Default::default()
2071    }
2072
2073    /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
2074    pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
2075    where
2076        T: std::convert::Into<crate::model::StorageSource>,
2077    {
2078        self.resolved_storage_source = std::option::Option::Some(v.into());
2079        self
2080    }
2081
2082    /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
2083    pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
2084    where
2085        T: std::convert::Into<crate::model::StorageSource>,
2086    {
2087        self.resolved_storage_source = v.map(|x| x.into());
2088        self
2089    }
2090
2091    /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
2092    pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
2093    where
2094        T: std::convert::Into<crate::model::RepoSource>,
2095    {
2096        self.resolved_repo_source = std::option::Option::Some(v.into());
2097        self
2098    }
2099
2100    /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
2101    pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
2102    where
2103        T: std::convert::Into<crate::model::RepoSource>,
2104    {
2105        self.resolved_repo_source = v.map(|x| x.into());
2106        self
2107    }
2108
2109    /// Sets the value of [git_uri][crate::model::SourceProvenance::git_uri].
2110    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2111        self.git_uri = v.into();
2112        self
2113    }
2114}
2115
2116impl wkt::message::Message for SourceProvenance {
2117    fn typename() -> &'static str {
2118        "type.googleapis.com/google.cloud.functions.v2.SourceProvenance"
2119    }
2120}
2121
2122#[doc(hidden)]
2123impl<'de> serde::de::Deserialize<'de> for SourceProvenance {
2124    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2125    where
2126        D: serde::Deserializer<'de>,
2127    {
2128        #[allow(non_camel_case_types)]
2129        #[doc(hidden)]
2130        #[derive(PartialEq, Eq, Hash)]
2131        enum __FieldTag {
2132            __resolved_storage_source,
2133            __resolved_repo_source,
2134            __git_uri,
2135            Unknown(std::string::String),
2136        }
2137        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2138            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2139            where
2140                D: serde::Deserializer<'de>,
2141            {
2142                struct Visitor;
2143                impl<'de> serde::de::Visitor<'de> for Visitor {
2144                    type Value = __FieldTag;
2145                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2146                        formatter.write_str("a field name for SourceProvenance")
2147                    }
2148                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2149                    where
2150                        E: serde::de::Error,
2151                    {
2152                        use std::result::Result::Ok;
2153                        use std::string::ToString;
2154                        match value {
2155                            "resolvedStorageSource" => Ok(__FieldTag::__resolved_storage_source),
2156                            "resolved_storage_source" => Ok(__FieldTag::__resolved_storage_source),
2157                            "resolvedRepoSource" => Ok(__FieldTag::__resolved_repo_source),
2158                            "resolved_repo_source" => Ok(__FieldTag::__resolved_repo_source),
2159                            "gitUri" => Ok(__FieldTag::__git_uri),
2160                            "git_uri" => Ok(__FieldTag::__git_uri),
2161                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2162                        }
2163                    }
2164                }
2165                deserializer.deserialize_identifier(Visitor)
2166            }
2167        }
2168        struct Visitor;
2169        impl<'de> serde::de::Visitor<'de> for Visitor {
2170            type Value = SourceProvenance;
2171            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2172                formatter.write_str("struct SourceProvenance")
2173            }
2174            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2175            where
2176                A: serde::de::MapAccess<'de>,
2177            {
2178                #[allow(unused_imports)]
2179                use serde::de::Error;
2180                use std::option::Option::Some;
2181                let mut fields = std::collections::HashSet::new();
2182                let mut result = Self::Value::new();
2183                while let Some(tag) = map.next_key::<__FieldTag>()? {
2184                    #[allow(clippy::match_single_binding)]
2185                    match tag {
2186                        __FieldTag::__resolved_storage_source => {
2187                            if !fields.insert(__FieldTag::__resolved_storage_source) {
2188                                return std::result::Result::Err(A::Error::duplicate_field(
2189                                    "multiple values for resolved_storage_source",
2190                                ));
2191                            }
2192                            result.resolved_storage_source = map
2193                                .next_value::<std::option::Option<crate::model::StorageSource>>()?;
2194                        }
2195                        __FieldTag::__resolved_repo_source => {
2196                            if !fields.insert(__FieldTag::__resolved_repo_source) {
2197                                return std::result::Result::Err(A::Error::duplicate_field(
2198                                    "multiple values for resolved_repo_source",
2199                                ));
2200                            }
2201                            result.resolved_repo_source =
2202                                map.next_value::<std::option::Option<crate::model::RepoSource>>()?;
2203                        }
2204                        __FieldTag::__git_uri => {
2205                            if !fields.insert(__FieldTag::__git_uri) {
2206                                return std::result::Result::Err(A::Error::duplicate_field(
2207                                    "multiple values for git_uri",
2208                                ));
2209                            }
2210                            result.git_uri = map
2211                                .next_value::<std::option::Option<std::string::String>>()?
2212                                .unwrap_or_default();
2213                        }
2214                        __FieldTag::Unknown(key) => {
2215                            let value = map.next_value::<serde_json::Value>()?;
2216                            result._unknown_fields.insert(key, value);
2217                        }
2218                    }
2219                }
2220                std::result::Result::Ok(result)
2221            }
2222        }
2223        deserializer.deserialize_any(Visitor)
2224    }
2225}
2226
2227#[doc(hidden)]
2228impl serde::ser::Serialize for SourceProvenance {
2229    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2230    where
2231        S: serde::ser::Serializer,
2232    {
2233        use serde::ser::SerializeMap;
2234        #[allow(unused_imports)]
2235        use std::option::Option::Some;
2236        let mut state = serializer.serialize_map(std::option::Option::None)?;
2237        if self.resolved_storage_source.is_some() {
2238            state.serialize_entry("resolvedStorageSource", &self.resolved_storage_source)?;
2239        }
2240        if self.resolved_repo_source.is_some() {
2241            state.serialize_entry("resolvedRepoSource", &self.resolved_repo_source)?;
2242        }
2243        if !self.git_uri.is_empty() {
2244            state.serialize_entry("gitUri", &self.git_uri)?;
2245        }
2246        if !self._unknown_fields.is_empty() {
2247            for (key, value) in self._unknown_fields.iter() {
2248                state.serialize_entry(key, &value)?;
2249            }
2250        }
2251        state.end()
2252    }
2253}
2254
2255impl std::fmt::Debug for SourceProvenance {
2256    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2257        let mut debug_struct = f.debug_struct("SourceProvenance");
2258        debug_struct.field("resolved_storage_source", &self.resolved_storage_source);
2259        debug_struct.field("resolved_repo_source", &self.resolved_repo_source);
2260        debug_struct.field("git_uri", &self.git_uri);
2261        if !self._unknown_fields.is_empty() {
2262            debug_struct.field("_unknown_fields", &self._unknown_fields);
2263        }
2264        debug_struct.finish()
2265    }
2266}
2267
2268/// Describes the Build step of the function that builds a container from the
2269/// given source.
2270#[derive(Clone, Default, PartialEq)]
2271#[non_exhaustive]
2272pub struct BuildConfig {
2273    /// Output only. The Cloud Build name of the latest successful deployment of
2274    /// the function.
2275    pub build: std::string::String,
2276
2277    /// The runtime in which to run the function. Required when deploying a new
2278    /// function, optional when updating an existing function. For a complete
2279    /// list of possible choices, see the
2280    /// [`gcloud` command
2281    /// reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
2282    pub runtime: std::string::String,
2283
2284    /// The name of the function (as defined in source code) that will be
2285    /// executed. Defaults to the resource name suffix, if not specified. For
2286    /// backward compatibility, if function with given name is not found, then the
2287    /// system will try to use function named "function".
2288    /// For Node.js this is name of a function exported by the module specified
2289    /// in `source_location`.
2290    pub entry_point: std::string::String,
2291
2292    /// The location of the function source code.
2293    pub source: std::option::Option<crate::model::Source>,
2294
2295    /// Output only. A permanent fixed identifier for source.
2296    pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2297
2298    /// Name of the Cloud Build Custom Worker Pool that should be used to build the
2299    /// function. The format of this field is
2300    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
2301    /// {project} and {region} are the project id and region respectively where the
2302    /// worker pool is defined and {workerPool} is the short name of the worker
2303    /// pool.
2304    ///
2305    /// If the project id is not the same as the function, then the Cloud
2306    /// Functions Service Agent
2307    /// (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
2308    /// granted the role Cloud Build Custom Workers Builder
2309    /// (roles/cloudbuild.customworkers.builder) in the project.
2310    pub worker_pool: std::string::String,
2311
2312    /// User-provided build-time environment variables for the function
2313    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
2314
2315    /// Docker Registry to use for this deployment. This configuration is only
2316    /// applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
2317    /// Registry.
2318    /// Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
2319    /// available in response to Container Registry's deprecation:
2320    /// <https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
2321    /// Please use Artifact Registry instead, which is the default choice.
2322    ///
2323    /// If unspecified, it defaults to `ARTIFACT_REGISTRY`.
2324    /// If `docker_repository` field is specified, this field should either be left
2325    /// unspecified or set to `ARTIFACT_REGISTRY`.
2326    #[deprecated]
2327    pub docker_registry: crate::model::build_config::DockerRegistry,
2328
2329    /// Repository in Artifact Registry to which the function docker image will be
2330    /// pushed after it is built by Cloud Build. If specified by user, it is
2331    /// created and managed by user with a customer managed encryption key.
2332    /// Otherwise, GCF will create and use a repository named 'gcf-artifacts'
2333    /// for every deployed region.
2334    ///
2335    /// It must match the pattern
2336    /// `projects/{project}/locations/{location}/repositories/{repository}`.
2337    /// Repository format must be 'DOCKER'.
2338    pub docker_repository: std::string::String,
2339
2340    /// Service account to be used for building the container. The format of this
2341    /// field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
2342    pub service_account: std::string::String,
2343
2344    /// This controls when security patches are applied to the runtime environment.
2345    pub runtime_update_policy: std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>,
2346
2347    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2348}
2349
2350impl BuildConfig {
2351    pub fn new() -> Self {
2352        std::default::Default::default()
2353    }
2354
2355    /// Sets the value of [build][crate::model::BuildConfig::build].
2356    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2357        self.build = v.into();
2358        self
2359    }
2360
2361    /// Sets the value of [runtime][crate::model::BuildConfig::runtime].
2362    pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2363        self.runtime = v.into();
2364        self
2365    }
2366
2367    /// Sets the value of [entry_point][crate::model::BuildConfig::entry_point].
2368    pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2369        self.entry_point = v.into();
2370        self
2371    }
2372
2373    /// Sets the value of [source][crate::model::BuildConfig::source].
2374    pub fn set_source<T>(mut self, v: T) -> Self
2375    where
2376        T: std::convert::Into<crate::model::Source>,
2377    {
2378        self.source = std::option::Option::Some(v.into());
2379        self
2380    }
2381
2382    /// Sets or clears the value of [source][crate::model::BuildConfig::source].
2383    pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
2384    where
2385        T: std::convert::Into<crate::model::Source>,
2386    {
2387        self.source = v.map(|x| x.into());
2388        self
2389    }
2390
2391    /// Sets the value of [source_provenance][crate::model::BuildConfig::source_provenance].
2392    pub fn set_source_provenance<T>(mut self, v: T) -> Self
2393    where
2394        T: std::convert::Into<crate::model::SourceProvenance>,
2395    {
2396        self.source_provenance = std::option::Option::Some(v.into());
2397        self
2398    }
2399
2400    /// Sets or clears the value of [source_provenance][crate::model::BuildConfig::source_provenance].
2401    pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2402    where
2403        T: std::convert::Into<crate::model::SourceProvenance>,
2404    {
2405        self.source_provenance = v.map(|x| x.into());
2406        self
2407    }
2408
2409    /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
2410    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2411        self.worker_pool = v.into();
2412        self
2413    }
2414
2415    /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
2416    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
2417    where
2418        T: std::iter::IntoIterator<Item = (K, V)>,
2419        K: std::convert::Into<std::string::String>,
2420        V: std::convert::Into<std::string::String>,
2421    {
2422        use std::iter::Iterator;
2423        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2424        self
2425    }
2426
2427    /// Sets the value of [docker_registry][crate::model::BuildConfig::docker_registry].
2428    #[deprecated]
2429    pub fn set_docker_registry<
2430        T: std::convert::Into<crate::model::build_config::DockerRegistry>,
2431    >(
2432        mut self,
2433        v: T,
2434    ) -> Self {
2435        self.docker_registry = v.into();
2436        self
2437    }
2438
2439    /// Sets the value of [docker_repository][crate::model::BuildConfig::docker_repository].
2440    pub fn set_docker_repository<T: std::convert::Into<std::string::String>>(
2441        mut self,
2442        v: T,
2443    ) -> Self {
2444        self.docker_repository = v.into();
2445        self
2446    }
2447
2448    /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
2449    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2450        self.service_account = v.into();
2451        self
2452    }
2453
2454    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy].
2455    ///
2456    /// Note that all the setters affecting `runtime_update_policy` are mutually
2457    /// exclusive.
2458    pub fn set_runtime_update_policy<
2459        T: std::convert::Into<std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>>,
2460    >(
2461        mut self,
2462        v: T,
2463    ) -> Self {
2464        self.runtime_update_policy = v.into();
2465        self
2466    }
2467
2468    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2469    /// if it holds a `AutomaticUpdatePolicy`, `None` if the field is not set or
2470    /// holds a different branch.
2471    pub fn automatic_update_policy(
2472        &self,
2473    ) -> std::option::Option<&std::boxed::Box<crate::model::AutomaticUpdatePolicy>> {
2474        #[allow(unreachable_patterns)]
2475        self.runtime_update_policy.as_ref().and_then(|v| match v {
2476            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v) => {
2477                std::option::Option::Some(v)
2478            }
2479            _ => std::option::Option::None,
2480        })
2481    }
2482
2483    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2484    /// to hold a `AutomaticUpdatePolicy`.
2485    ///
2486    /// Note that all the setters affecting `runtime_update_policy` are
2487    /// mutually exclusive.
2488    pub fn set_automatic_update_policy<
2489        T: std::convert::Into<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>,
2490    >(
2491        mut self,
2492        v: T,
2493    ) -> Self {
2494        self.runtime_update_policy = std::option::Option::Some(
2495            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v.into()),
2496        );
2497        self
2498    }
2499
2500    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2501    /// if it holds a `OnDeployUpdatePolicy`, `None` if the field is not set or
2502    /// holds a different branch.
2503    pub fn on_deploy_update_policy(
2504        &self,
2505    ) -> std::option::Option<&std::boxed::Box<crate::model::OnDeployUpdatePolicy>> {
2506        #[allow(unreachable_patterns)]
2507        self.runtime_update_policy.as_ref().and_then(|v| match v {
2508            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v) => {
2509                std::option::Option::Some(v)
2510            }
2511            _ => std::option::Option::None,
2512        })
2513    }
2514
2515    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2516    /// to hold a `OnDeployUpdatePolicy`.
2517    ///
2518    /// Note that all the setters affecting `runtime_update_policy` are
2519    /// mutually exclusive.
2520    pub fn set_on_deploy_update_policy<
2521        T: std::convert::Into<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>,
2522    >(
2523        mut self,
2524        v: T,
2525    ) -> Self {
2526        self.runtime_update_policy = std::option::Option::Some(
2527            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v.into()),
2528        );
2529        self
2530    }
2531}
2532
2533impl wkt::message::Message for BuildConfig {
2534    fn typename() -> &'static str {
2535        "type.googleapis.com/google.cloud.functions.v2.BuildConfig"
2536    }
2537}
2538
2539#[doc(hidden)]
2540impl<'de> serde::de::Deserialize<'de> for BuildConfig {
2541    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2542    where
2543        D: serde::Deserializer<'de>,
2544    {
2545        #[allow(non_camel_case_types)]
2546        #[doc(hidden)]
2547        #[derive(PartialEq, Eq, Hash)]
2548        enum __FieldTag {
2549            __automatic_update_policy,
2550            __on_deploy_update_policy,
2551            __build,
2552            __runtime,
2553            __entry_point,
2554            __source,
2555            __source_provenance,
2556            __worker_pool,
2557            __environment_variables,
2558            __docker_registry,
2559            __docker_repository,
2560            __service_account,
2561            Unknown(std::string::String),
2562        }
2563        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2564            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2565            where
2566                D: serde::Deserializer<'de>,
2567            {
2568                struct Visitor;
2569                impl<'de> serde::de::Visitor<'de> for Visitor {
2570                    type Value = __FieldTag;
2571                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2572                        formatter.write_str("a field name for BuildConfig")
2573                    }
2574                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2575                    where
2576                        E: serde::de::Error,
2577                    {
2578                        use std::result::Result::Ok;
2579                        use std::string::ToString;
2580                        match value {
2581                            "automaticUpdatePolicy" => Ok(__FieldTag::__automatic_update_policy),
2582                            "automatic_update_policy" => Ok(__FieldTag::__automatic_update_policy),
2583                            "onDeployUpdatePolicy" => Ok(__FieldTag::__on_deploy_update_policy),
2584                            "on_deploy_update_policy" => Ok(__FieldTag::__on_deploy_update_policy),
2585                            "build" => Ok(__FieldTag::__build),
2586                            "runtime" => Ok(__FieldTag::__runtime),
2587                            "entryPoint" => Ok(__FieldTag::__entry_point),
2588                            "entry_point" => Ok(__FieldTag::__entry_point),
2589                            "source" => Ok(__FieldTag::__source),
2590                            "sourceProvenance" => Ok(__FieldTag::__source_provenance),
2591                            "source_provenance" => Ok(__FieldTag::__source_provenance),
2592                            "workerPool" => Ok(__FieldTag::__worker_pool),
2593                            "worker_pool" => Ok(__FieldTag::__worker_pool),
2594                            "environmentVariables" => Ok(__FieldTag::__environment_variables),
2595                            "environment_variables" => Ok(__FieldTag::__environment_variables),
2596                            "dockerRegistry" => Ok(__FieldTag::__docker_registry),
2597                            "docker_registry" => Ok(__FieldTag::__docker_registry),
2598                            "dockerRepository" => Ok(__FieldTag::__docker_repository),
2599                            "docker_repository" => Ok(__FieldTag::__docker_repository),
2600                            "serviceAccount" => Ok(__FieldTag::__service_account),
2601                            "service_account" => Ok(__FieldTag::__service_account),
2602                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2603                        }
2604                    }
2605                }
2606                deserializer.deserialize_identifier(Visitor)
2607            }
2608        }
2609        struct Visitor;
2610        impl<'de> serde::de::Visitor<'de> for Visitor {
2611            type Value = BuildConfig;
2612            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2613                formatter.write_str("struct BuildConfig")
2614            }
2615            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2616            where
2617                A: serde::de::MapAccess<'de>,
2618            {
2619                #[allow(unused_imports)]
2620                use serde::de::Error;
2621                use std::option::Option::Some;
2622                let mut fields = std::collections::HashSet::new();
2623                let mut result = Self::Value::new();
2624                while let Some(tag) = map.next_key::<__FieldTag>()? {
2625                    #[allow(clippy::match_single_binding)]
2626                    match tag {
2627                        __FieldTag::__automatic_update_policy => {
2628                            if !fields.insert(__FieldTag::__automatic_update_policy) {
2629                                return std::result::Result::Err(A::Error::duplicate_field(
2630                                    "multiple values for automatic_update_policy",
2631                                ));
2632                            }
2633                            if result.runtime_update_policy.is_some() {
2634                                return std::result::Result::Err(A::Error::duplicate_field(
2635                                    "multiple values for `runtime_update_policy`, a oneof with full ID .google.cloud.functions.v2.BuildConfig.automatic_update_policy, latest field was automaticUpdatePolicy",
2636                                ));
2637                            }
2638                            result.runtime_update_policy = std::option::Option::Some(
2639                                crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(
2640                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>>()?.unwrap_or_default()
2641                                ),
2642                            );
2643                        }
2644                        __FieldTag::__on_deploy_update_policy => {
2645                            if !fields.insert(__FieldTag::__on_deploy_update_policy) {
2646                                return std::result::Result::Err(A::Error::duplicate_field(
2647                                    "multiple values for on_deploy_update_policy",
2648                                ));
2649                            }
2650                            if result.runtime_update_policy.is_some() {
2651                                return std::result::Result::Err(A::Error::duplicate_field(
2652                                    "multiple values for `runtime_update_policy`, a oneof with full ID .google.cloud.functions.v2.BuildConfig.on_deploy_update_policy, latest field was onDeployUpdatePolicy",
2653                                ));
2654                            }
2655                            result.runtime_update_policy = std::option::Option::Some(
2656                                crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(
2657                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>>()?.unwrap_or_default()
2658                                ),
2659                            );
2660                        }
2661                        __FieldTag::__build => {
2662                            if !fields.insert(__FieldTag::__build) {
2663                                return std::result::Result::Err(A::Error::duplicate_field(
2664                                    "multiple values for build",
2665                                ));
2666                            }
2667                            result.build = map
2668                                .next_value::<std::option::Option<std::string::String>>()?
2669                                .unwrap_or_default();
2670                        }
2671                        __FieldTag::__runtime => {
2672                            if !fields.insert(__FieldTag::__runtime) {
2673                                return std::result::Result::Err(A::Error::duplicate_field(
2674                                    "multiple values for runtime",
2675                                ));
2676                            }
2677                            result.runtime = map
2678                                .next_value::<std::option::Option<std::string::String>>()?
2679                                .unwrap_or_default();
2680                        }
2681                        __FieldTag::__entry_point => {
2682                            if !fields.insert(__FieldTag::__entry_point) {
2683                                return std::result::Result::Err(A::Error::duplicate_field(
2684                                    "multiple values for entry_point",
2685                                ));
2686                            }
2687                            result.entry_point = map
2688                                .next_value::<std::option::Option<std::string::String>>()?
2689                                .unwrap_or_default();
2690                        }
2691                        __FieldTag::__source => {
2692                            if !fields.insert(__FieldTag::__source) {
2693                                return std::result::Result::Err(A::Error::duplicate_field(
2694                                    "multiple values for source",
2695                                ));
2696                            }
2697                            result.source =
2698                                map.next_value::<std::option::Option<crate::model::Source>>()?;
2699                        }
2700                        __FieldTag::__source_provenance => {
2701                            if !fields.insert(__FieldTag::__source_provenance) {
2702                                return std::result::Result::Err(A::Error::duplicate_field(
2703                                    "multiple values for source_provenance",
2704                                ));
2705                            }
2706                            result.source_provenance = map
2707                                .next_value::<std::option::Option<crate::model::SourceProvenance>>(
2708                                )?;
2709                        }
2710                        __FieldTag::__worker_pool => {
2711                            if !fields.insert(__FieldTag::__worker_pool) {
2712                                return std::result::Result::Err(A::Error::duplicate_field(
2713                                    "multiple values for worker_pool",
2714                                ));
2715                            }
2716                            result.worker_pool = map
2717                                .next_value::<std::option::Option<std::string::String>>()?
2718                                .unwrap_or_default();
2719                        }
2720                        __FieldTag::__environment_variables => {
2721                            if !fields.insert(__FieldTag::__environment_variables) {
2722                                return std::result::Result::Err(A::Error::duplicate_field(
2723                                    "multiple values for environment_variables",
2724                                ));
2725                            }
2726                            result.environment_variables = map
2727                                .next_value::<std::option::Option<
2728                                    std::collections::HashMap<
2729                                        std::string::String,
2730                                        std::string::String,
2731                                    >,
2732                                >>()?
2733                                .unwrap_or_default();
2734                        }
2735                        __FieldTag::__docker_registry => {
2736                            if !fields.insert(__FieldTag::__docker_registry) {
2737                                return std::result::Result::Err(A::Error::duplicate_field(
2738                                    "multiple values for docker_registry",
2739                                ));
2740                            }
2741                            result.docker_registry = map.next_value::<std::option::Option<crate::model::build_config::DockerRegistry>>()?.unwrap_or_default();
2742                        }
2743                        __FieldTag::__docker_repository => {
2744                            if !fields.insert(__FieldTag::__docker_repository) {
2745                                return std::result::Result::Err(A::Error::duplicate_field(
2746                                    "multiple values for docker_repository",
2747                                ));
2748                            }
2749                            result.docker_repository = map
2750                                .next_value::<std::option::Option<std::string::String>>()?
2751                                .unwrap_or_default();
2752                        }
2753                        __FieldTag::__service_account => {
2754                            if !fields.insert(__FieldTag::__service_account) {
2755                                return std::result::Result::Err(A::Error::duplicate_field(
2756                                    "multiple values for service_account",
2757                                ));
2758                            }
2759                            result.service_account = map
2760                                .next_value::<std::option::Option<std::string::String>>()?
2761                                .unwrap_or_default();
2762                        }
2763                        __FieldTag::Unknown(key) => {
2764                            let value = map.next_value::<serde_json::Value>()?;
2765                            result._unknown_fields.insert(key, value);
2766                        }
2767                    }
2768                }
2769                std::result::Result::Ok(result)
2770            }
2771        }
2772        deserializer.deserialize_any(Visitor)
2773    }
2774}
2775
2776#[doc(hidden)]
2777impl serde::ser::Serialize for BuildConfig {
2778    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2779    where
2780        S: serde::ser::Serializer,
2781    {
2782        use serde::ser::SerializeMap;
2783        #[allow(unused_imports)]
2784        use std::option::Option::Some;
2785        let mut state = serializer.serialize_map(std::option::Option::None)?;
2786        if let Some(value) = self.automatic_update_policy() {
2787            state.serialize_entry("automaticUpdatePolicy", value)?;
2788        }
2789        if let Some(value) = self.on_deploy_update_policy() {
2790            state.serialize_entry("onDeployUpdatePolicy", value)?;
2791        }
2792        if !self.build.is_empty() {
2793            state.serialize_entry("build", &self.build)?;
2794        }
2795        if !self.runtime.is_empty() {
2796            state.serialize_entry("runtime", &self.runtime)?;
2797        }
2798        if !self.entry_point.is_empty() {
2799            state.serialize_entry("entryPoint", &self.entry_point)?;
2800        }
2801        if self.source.is_some() {
2802            state.serialize_entry("source", &self.source)?;
2803        }
2804        if self.source_provenance.is_some() {
2805            state.serialize_entry("sourceProvenance", &self.source_provenance)?;
2806        }
2807        if !self.worker_pool.is_empty() {
2808            state.serialize_entry("workerPool", &self.worker_pool)?;
2809        }
2810        if !self.environment_variables.is_empty() {
2811            state.serialize_entry("environmentVariables", &self.environment_variables)?;
2812        }
2813        if !wkt::internal::is_default(&self.docker_registry) {
2814            state.serialize_entry("dockerRegistry", &self.docker_registry)?;
2815        }
2816        if !self.docker_repository.is_empty() {
2817            state.serialize_entry("dockerRepository", &self.docker_repository)?;
2818        }
2819        if !self.service_account.is_empty() {
2820            state.serialize_entry("serviceAccount", &self.service_account)?;
2821        }
2822        if !self._unknown_fields.is_empty() {
2823            for (key, value) in self._unknown_fields.iter() {
2824                state.serialize_entry(key, &value)?;
2825            }
2826        }
2827        state.end()
2828    }
2829}
2830
2831impl std::fmt::Debug for BuildConfig {
2832    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2833        let mut debug_struct = f.debug_struct("BuildConfig");
2834        debug_struct.field("build", &self.build);
2835        debug_struct.field("runtime", &self.runtime);
2836        debug_struct.field("entry_point", &self.entry_point);
2837        debug_struct.field("source", &self.source);
2838        debug_struct.field("source_provenance", &self.source_provenance);
2839        debug_struct.field("worker_pool", &self.worker_pool);
2840        debug_struct.field("environment_variables", &self.environment_variables);
2841        debug_struct.field("docker_registry", &self.docker_registry);
2842        debug_struct.field("docker_repository", &self.docker_repository);
2843        debug_struct.field("service_account", &self.service_account);
2844        debug_struct.field("runtime_update_policy", &self.runtime_update_policy);
2845        if !self._unknown_fields.is_empty() {
2846            debug_struct.field("_unknown_fields", &self._unknown_fields);
2847        }
2848        debug_struct.finish()
2849    }
2850}
2851
2852/// Defines additional types related to [BuildConfig].
2853pub mod build_config {
2854    #[allow(unused_imports)]
2855    use super::*;
2856
2857    /// Docker Registry to use for storing function Docker images.
2858    ///
2859    /// # Working with unknown values
2860    ///
2861    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2862    /// additional enum variants at any time. Adding new variants is not considered
2863    /// a breaking change. Applications should write their code in anticipation of:
2864    ///
2865    /// - New values appearing in future releases of the client library, **and**
2866    /// - New values received dynamically, without application changes.
2867    ///
2868    /// Please consult the [Working with enums] section in the user guide for some
2869    /// guidelines.
2870    ///
2871    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2872    #[derive(Clone, Debug, PartialEq)]
2873    #[non_exhaustive]
2874    pub enum DockerRegistry {
2875        /// Unspecified.
2876        Unspecified,
2877        /// Docker images will be stored in multi-regional Container Registry
2878        /// repositories named `gcf`.
2879        ContainerRegistry,
2880        /// Docker images will be stored in regional Artifact Registry repositories.
2881        /// By default, GCF will create and use repositories named `gcf-artifacts`
2882        /// in every region in which a function is deployed. But the repository to
2883        /// use can also be specified by the user using the `docker_repository`
2884        /// field.
2885        ArtifactRegistry,
2886        /// If set, the enum was initialized with an unknown value.
2887        ///
2888        /// Applications can examine the value using [DockerRegistry::value] or
2889        /// [DockerRegistry::name].
2890        UnknownValue(docker_registry::UnknownValue),
2891    }
2892
2893    #[doc(hidden)]
2894    pub mod docker_registry {
2895        #[allow(unused_imports)]
2896        use super::*;
2897        #[derive(Clone, Debug, PartialEq)]
2898        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2899    }
2900
2901    impl DockerRegistry {
2902        /// Gets the enum value.
2903        ///
2904        /// Returns `None` if the enum contains an unknown value deserialized from
2905        /// the string representation of enums.
2906        pub fn value(&self) -> std::option::Option<i32> {
2907            match self {
2908                Self::Unspecified => std::option::Option::Some(0),
2909                Self::ContainerRegistry => std::option::Option::Some(1),
2910                Self::ArtifactRegistry => std::option::Option::Some(2),
2911                Self::UnknownValue(u) => u.0.value(),
2912            }
2913        }
2914
2915        /// Gets the enum value as a string.
2916        ///
2917        /// Returns `None` if the enum contains an unknown value deserialized from
2918        /// the integer representation of enums.
2919        pub fn name(&self) -> std::option::Option<&str> {
2920            match self {
2921                Self::Unspecified => std::option::Option::Some("DOCKER_REGISTRY_UNSPECIFIED"),
2922                Self::ContainerRegistry => std::option::Option::Some("CONTAINER_REGISTRY"),
2923                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
2924                Self::UnknownValue(u) => u.0.name(),
2925            }
2926        }
2927    }
2928
2929    impl std::default::Default for DockerRegistry {
2930        fn default() -> Self {
2931            use std::convert::From;
2932            Self::from(0)
2933        }
2934    }
2935
2936    impl std::fmt::Display for DockerRegistry {
2937        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2938            wkt::internal::display_enum(f, self.name(), self.value())
2939        }
2940    }
2941
2942    impl std::convert::From<i32> for DockerRegistry {
2943        fn from(value: i32) -> Self {
2944            match value {
2945                0 => Self::Unspecified,
2946                1 => Self::ContainerRegistry,
2947                2 => Self::ArtifactRegistry,
2948                _ => Self::UnknownValue(docker_registry::UnknownValue(
2949                    wkt::internal::UnknownEnumValue::Integer(value),
2950                )),
2951            }
2952        }
2953    }
2954
2955    impl std::convert::From<&str> for DockerRegistry {
2956        fn from(value: &str) -> Self {
2957            use std::string::ToString;
2958            match value {
2959                "DOCKER_REGISTRY_UNSPECIFIED" => Self::Unspecified,
2960                "CONTAINER_REGISTRY" => Self::ContainerRegistry,
2961                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
2962                _ => Self::UnknownValue(docker_registry::UnknownValue(
2963                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2964                )),
2965            }
2966        }
2967    }
2968
2969    impl serde::ser::Serialize for DockerRegistry {
2970        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2971        where
2972            S: serde::Serializer,
2973        {
2974            match self {
2975                Self::Unspecified => serializer.serialize_i32(0),
2976                Self::ContainerRegistry => serializer.serialize_i32(1),
2977                Self::ArtifactRegistry => serializer.serialize_i32(2),
2978                Self::UnknownValue(u) => u.0.serialize(serializer),
2979            }
2980        }
2981    }
2982
2983    impl<'de> serde::de::Deserialize<'de> for DockerRegistry {
2984        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2985        where
2986            D: serde::Deserializer<'de>,
2987        {
2988            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DockerRegistry>::new(
2989                ".google.cloud.functions.v2.BuildConfig.DockerRegistry",
2990            ))
2991        }
2992    }
2993
2994    /// This controls when security patches are applied to the runtime environment.
2995    #[derive(Clone, Debug, PartialEq)]
2996    #[non_exhaustive]
2997    pub enum RuntimeUpdatePolicy {
2998        AutomaticUpdatePolicy(std::boxed::Box<crate::model::AutomaticUpdatePolicy>),
2999        OnDeployUpdatePolicy(std::boxed::Box<crate::model::OnDeployUpdatePolicy>),
3000    }
3001}
3002
3003/// Describes the Service being deployed.
3004/// Currently Supported : Cloud Run (fully managed).
3005#[derive(Clone, Default, PartialEq)]
3006#[non_exhaustive]
3007pub struct ServiceConfig {
3008    /// Output only. Name of the service associated with a Function.
3009    /// The format of this field is
3010    /// `projects/{project}/locations/{region}/services/{service}`
3011    pub service: std::string::String,
3012
3013    /// The function execution timeout. Execution is considered failed and
3014    /// can be terminated if the function is not completed at the end of the
3015    /// timeout period. Defaults to 60 seconds.
3016    pub timeout_seconds: i32,
3017
3018    /// The amount of memory available for a function.
3019    /// Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
3020    /// supplied the value is interpreted as bytes.
3021    /// See
3022    /// <https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
3023    /// a full description.
3024    pub available_memory: std::string::String,
3025
3026    /// The number of CPUs used in a single container instance.
3027    /// Default value is calculated from available memory.
3028    /// Supports the same values as Cloud Run, see
3029    /// <https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
3030    /// Example: "1" indicates 1 vCPU
3031    pub available_cpu: std::string::String,
3032
3033    /// Environment variables that shall be available during function execution.
3034    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
3035
3036    /// The limit on the maximum number of function instances that may coexist at a
3037    /// given time.
3038    ///
3039    /// In some cases, such as rapid traffic surges, Cloud Functions may, for a
3040    /// short period of time, create more instances than the specified max
3041    /// instances limit. If your function cannot tolerate this temporary behavior,
3042    /// you may want to factor in a safety margin and set a lower max instances
3043    /// value than your function can tolerate.
3044    ///
3045    /// See the [Max
3046    /// Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
3047    /// more details.
3048    pub max_instance_count: i32,
3049
3050    /// The limit on the minimum number of function instances that may coexist at a
3051    /// given time.
3052    ///
3053    /// Function instances are kept in idle state for a short period after they
3054    /// finished executing the request to reduce cold start time for subsequent
3055    /// requests. Setting a minimum instance count will ensure that the given
3056    /// number of instances are kept running in idle state always. This can help
3057    /// with cold start times when jump in incoming request count occurs after the
3058    /// idle instance would have been stopped in the default case.
3059    pub min_instance_count: i32,
3060
3061    /// The Serverless VPC Access connector that this cloud function can connect
3062    /// to. The format of this field is `projects/*/locations/*/connectors/*`.
3063    pub vpc_connector: std::string::String,
3064
3065    /// The egress settings for the connector, controlling what traffic is diverted
3066    /// through it.
3067    pub vpc_connector_egress_settings: crate::model::service_config::VpcConnectorEgressSettings,
3068
3069    /// The ingress settings for the function, controlling what traffic can reach
3070    /// it.
3071    pub ingress_settings: crate::model::service_config::IngressSettings,
3072
3073    /// Output only. URI of the Service deployed.
3074    pub uri: std::string::String,
3075
3076    /// The email of the service's service account. If empty, defaults to
3077    /// `{project_number}-compute@developer.gserviceaccount.com`.
3078    pub service_account_email: std::string::String,
3079
3080    /// Whether 100% of traffic is routed to the latest revision.
3081    /// On CreateFunction and UpdateFunction, when set to true, the revision being
3082    /// deployed will serve 100% of traffic, ignoring any traffic split settings,
3083    /// if any. On GetFunction, true will be returned if the latest revision is
3084    /// serving 100% of traffic.
3085    pub all_traffic_on_latest_revision: bool,
3086
3087    /// Secret environment variables configuration.
3088    pub secret_environment_variables: std::vec::Vec<crate::model::SecretEnvVar>,
3089
3090    /// Secret volumes configuration.
3091    pub secret_volumes: std::vec::Vec<crate::model::SecretVolume>,
3092
3093    /// Output only. The name of service revision.
3094    pub revision: std::string::String,
3095
3096    /// Sets the maximum number of concurrent requests that each instance
3097    /// can receive. Defaults to 1.
3098    pub max_instance_request_concurrency: i32,
3099
3100    /// Security level configure whether the function only accepts https.
3101    /// This configuration is only applicable to 1st Gen functions with Http
3102    /// trigger. By default https is optional for 1st Gen functions; 2nd Gen
3103    /// functions are https ONLY.
3104    pub security_level: crate::model::service_config::SecurityLevel,
3105
3106    /// Optional. The binary authorization policy to be checked when deploying the
3107    /// Cloud Run service.
3108    pub binary_authorization_policy: std::string::String,
3109
3110    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3111}
3112
3113impl ServiceConfig {
3114    pub fn new() -> Self {
3115        std::default::Default::default()
3116    }
3117
3118    /// Sets the value of [service][crate::model::ServiceConfig::service].
3119    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3120        self.service = v.into();
3121        self
3122    }
3123
3124    /// Sets the value of [timeout_seconds][crate::model::ServiceConfig::timeout_seconds].
3125    pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3126        self.timeout_seconds = v.into();
3127        self
3128    }
3129
3130    /// Sets the value of [available_memory][crate::model::ServiceConfig::available_memory].
3131    pub fn set_available_memory<T: std::convert::Into<std::string::String>>(
3132        mut self,
3133        v: T,
3134    ) -> Self {
3135        self.available_memory = v.into();
3136        self
3137    }
3138
3139    /// Sets the value of [available_cpu][crate::model::ServiceConfig::available_cpu].
3140    pub fn set_available_cpu<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3141        self.available_cpu = v.into();
3142        self
3143    }
3144
3145    /// Sets the value of [environment_variables][crate::model::ServiceConfig::environment_variables].
3146    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
3147    where
3148        T: std::iter::IntoIterator<Item = (K, V)>,
3149        K: std::convert::Into<std::string::String>,
3150        V: std::convert::Into<std::string::String>,
3151    {
3152        use std::iter::Iterator;
3153        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3154        self
3155    }
3156
3157    /// Sets the value of [max_instance_count][crate::model::ServiceConfig::max_instance_count].
3158    pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3159        self.max_instance_count = v.into();
3160        self
3161    }
3162
3163    /// Sets the value of [min_instance_count][crate::model::ServiceConfig::min_instance_count].
3164    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3165        self.min_instance_count = v.into();
3166        self
3167    }
3168
3169    /// Sets the value of [vpc_connector][crate::model::ServiceConfig::vpc_connector].
3170    pub fn set_vpc_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3171        self.vpc_connector = v.into();
3172        self
3173    }
3174
3175    /// Sets the value of [vpc_connector_egress_settings][crate::model::ServiceConfig::vpc_connector_egress_settings].
3176    pub fn set_vpc_connector_egress_settings<
3177        T: std::convert::Into<crate::model::service_config::VpcConnectorEgressSettings>,
3178    >(
3179        mut self,
3180        v: T,
3181    ) -> Self {
3182        self.vpc_connector_egress_settings = v.into();
3183        self
3184    }
3185
3186    /// Sets the value of [ingress_settings][crate::model::ServiceConfig::ingress_settings].
3187    pub fn set_ingress_settings<
3188        T: std::convert::Into<crate::model::service_config::IngressSettings>,
3189    >(
3190        mut self,
3191        v: T,
3192    ) -> Self {
3193        self.ingress_settings = v.into();
3194        self
3195    }
3196
3197    /// Sets the value of [uri][crate::model::ServiceConfig::uri].
3198    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3199        self.uri = v.into();
3200        self
3201    }
3202
3203    /// Sets the value of [service_account_email][crate::model::ServiceConfig::service_account_email].
3204    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
3205        mut self,
3206        v: T,
3207    ) -> Self {
3208        self.service_account_email = v.into();
3209        self
3210    }
3211
3212    /// Sets the value of [all_traffic_on_latest_revision][crate::model::ServiceConfig::all_traffic_on_latest_revision].
3213    pub fn set_all_traffic_on_latest_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3214        self.all_traffic_on_latest_revision = v.into();
3215        self
3216    }
3217
3218    /// Sets the value of [secret_environment_variables][crate::model::ServiceConfig::secret_environment_variables].
3219    pub fn set_secret_environment_variables<T, V>(mut self, v: T) -> Self
3220    where
3221        T: std::iter::IntoIterator<Item = V>,
3222        V: std::convert::Into<crate::model::SecretEnvVar>,
3223    {
3224        use std::iter::Iterator;
3225        self.secret_environment_variables = v.into_iter().map(|i| i.into()).collect();
3226        self
3227    }
3228
3229    /// Sets the value of [secret_volumes][crate::model::ServiceConfig::secret_volumes].
3230    pub fn set_secret_volumes<T, V>(mut self, v: T) -> Self
3231    where
3232        T: std::iter::IntoIterator<Item = V>,
3233        V: std::convert::Into<crate::model::SecretVolume>,
3234    {
3235        use std::iter::Iterator;
3236        self.secret_volumes = v.into_iter().map(|i| i.into()).collect();
3237        self
3238    }
3239
3240    /// Sets the value of [revision][crate::model::ServiceConfig::revision].
3241    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3242        self.revision = v.into();
3243        self
3244    }
3245
3246    /// Sets the value of [max_instance_request_concurrency][crate::model::ServiceConfig::max_instance_request_concurrency].
3247    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
3248        mut self,
3249        v: T,
3250    ) -> Self {
3251        self.max_instance_request_concurrency = v.into();
3252        self
3253    }
3254
3255    /// Sets the value of [security_level][crate::model::ServiceConfig::security_level].
3256    pub fn set_security_level<
3257        T: std::convert::Into<crate::model::service_config::SecurityLevel>,
3258    >(
3259        mut self,
3260        v: T,
3261    ) -> Self {
3262        self.security_level = v.into();
3263        self
3264    }
3265
3266    /// Sets the value of [binary_authorization_policy][crate::model::ServiceConfig::binary_authorization_policy].
3267    pub fn set_binary_authorization_policy<T: std::convert::Into<std::string::String>>(
3268        mut self,
3269        v: T,
3270    ) -> Self {
3271        self.binary_authorization_policy = v.into();
3272        self
3273    }
3274}
3275
3276impl wkt::message::Message for ServiceConfig {
3277    fn typename() -> &'static str {
3278        "type.googleapis.com/google.cloud.functions.v2.ServiceConfig"
3279    }
3280}
3281
3282#[doc(hidden)]
3283impl<'de> serde::de::Deserialize<'de> for ServiceConfig {
3284    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3285    where
3286        D: serde::Deserializer<'de>,
3287    {
3288        #[allow(non_camel_case_types)]
3289        #[doc(hidden)]
3290        #[derive(PartialEq, Eq, Hash)]
3291        enum __FieldTag {
3292            __service,
3293            __timeout_seconds,
3294            __available_memory,
3295            __available_cpu,
3296            __environment_variables,
3297            __max_instance_count,
3298            __min_instance_count,
3299            __vpc_connector,
3300            __vpc_connector_egress_settings,
3301            __ingress_settings,
3302            __uri,
3303            __service_account_email,
3304            __all_traffic_on_latest_revision,
3305            __secret_environment_variables,
3306            __secret_volumes,
3307            __revision,
3308            __max_instance_request_concurrency,
3309            __security_level,
3310            __binary_authorization_policy,
3311            Unknown(std::string::String),
3312        }
3313        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3314            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3315            where
3316                D: serde::Deserializer<'de>,
3317            {
3318                struct Visitor;
3319                impl<'de> serde::de::Visitor<'de> for Visitor {
3320                    type Value = __FieldTag;
3321                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3322                        formatter.write_str("a field name for ServiceConfig")
3323                    }
3324                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3325                    where
3326                        E: serde::de::Error,
3327                    {
3328                        use std::result::Result::Ok;
3329                        use std::string::ToString;
3330                        match value {
3331                            "service" => Ok(__FieldTag::__service),
3332                            "timeoutSeconds" => Ok(__FieldTag::__timeout_seconds),
3333                            "timeout_seconds" => Ok(__FieldTag::__timeout_seconds),
3334                            "availableMemory" => Ok(__FieldTag::__available_memory),
3335                            "available_memory" => Ok(__FieldTag::__available_memory),
3336                            "availableCpu" => Ok(__FieldTag::__available_cpu),
3337                            "available_cpu" => Ok(__FieldTag::__available_cpu),
3338                            "environmentVariables" => Ok(__FieldTag::__environment_variables),
3339                            "environment_variables" => Ok(__FieldTag::__environment_variables),
3340                            "maxInstanceCount" => Ok(__FieldTag::__max_instance_count),
3341                            "max_instance_count" => Ok(__FieldTag::__max_instance_count),
3342                            "minInstanceCount" => Ok(__FieldTag::__min_instance_count),
3343                            "min_instance_count" => Ok(__FieldTag::__min_instance_count),
3344                            "vpcConnector" => Ok(__FieldTag::__vpc_connector),
3345                            "vpc_connector" => Ok(__FieldTag::__vpc_connector),
3346                            "vpcConnectorEgressSettings" => {
3347                                Ok(__FieldTag::__vpc_connector_egress_settings)
3348                            }
3349                            "vpc_connector_egress_settings" => {
3350                                Ok(__FieldTag::__vpc_connector_egress_settings)
3351                            }
3352                            "ingressSettings" => Ok(__FieldTag::__ingress_settings),
3353                            "ingress_settings" => Ok(__FieldTag::__ingress_settings),
3354                            "uri" => Ok(__FieldTag::__uri),
3355                            "serviceAccountEmail" => Ok(__FieldTag::__service_account_email),
3356                            "service_account_email" => Ok(__FieldTag::__service_account_email),
3357                            "allTrafficOnLatestRevision" => {
3358                                Ok(__FieldTag::__all_traffic_on_latest_revision)
3359                            }
3360                            "all_traffic_on_latest_revision" => {
3361                                Ok(__FieldTag::__all_traffic_on_latest_revision)
3362                            }
3363                            "secretEnvironmentVariables" => {
3364                                Ok(__FieldTag::__secret_environment_variables)
3365                            }
3366                            "secret_environment_variables" => {
3367                                Ok(__FieldTag::__secret_environment_variables)
3368                            }
3369                            "secretVolumes" => Ok(__FieldTag::__secret_volumes),
3370                            "secret_volumes" => Ok(__FieldTag::__secret_volumes),
3371                            "revision" => Ok(__FieldTag::__revision),
3372                            "maxInstanceRequestConcurrency" => {
3373                                Ok(__FieldTag::__max_instance_request_concurrency)
3374                            }
3375                            "max_instance_request_concurrency" => {
3376                                Ok(__FieldTag::__max_instance_request_concurrency)
3377                            }
3378                            "securityLevel" => Ok(__FieldTag::__security_level),
3379                            "security_level" => Ok(__FieldTag::__security_level),
3380                            "binaryAuthorizationPolicy" => {
3381                                Ok(__FieldTag::__binary_authorization_policy)
3382                            }
3383                            "binary_authorization_policy" => {
3384                                Ok(__FieldTag::__binary_authorization_policy)
3385                            }
3386                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3387                        }
3388                    }
3389                }
3390                deserializer.deserialize_identifier(Visitor)
3391            }
3392        }
3393        struct Visitor;
3394        impl<'de> serde::de::Visitor<'de> for Visitor {
3395            type Value = ServiceConfig;
3396            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3397                formatter.write_str("struct ServiceConfig")
3398            }
3399            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3400            where
3401                A: serde::de::MapAccess<'de>,
3402            {
3403                #[allow(unused_imports)]
3404                use serde::de::Error;
3405                use std::option::Option::Some;
3406                let mut fields = std::collections::HashSet::new();
3407                let mut result = Self::Value::new();
3408                while let Some(tag) = map.next_key::<__FieldTag>()? {
3409                    #[allow(clippy::match_single_binding)]
3410                    match tag {
3411                        __FieldTag::__service => {
3412                            if !fields.insert(__FieldTag::__service) {
3413                                return std::result::Result::Err(A::Error::duplicate_field(
3414                                    "multiple values for service",
3415                                ));
3416                            }
3417                            result.service = map
3418                                .next_value::<std::option::Option<std::string::String>>()?
3419                                .unwrap_or_default();
3420                        }
3421                        __FieldTag::__timeout_seconds => {
3422                            if !fields.insert(__FieldTag::__timeout_seconds) {
3423                                return std::result::Result::Err(A::Error::duplicate_field(
3424                                    "multiple values for timeout_seconds",
3425                                ));
3426                            }
3427                            struct __With(std::option::Option<i32>);
3428                            impl<'de> serde::de::Deserialize<'de> for __With {
3429                                fn deserialize<D>(
3430                                    deserializer: D,
3431                                ) -> std::result::Result<Self, D::Error>
3432                                where
3433                                    D: serde::de::Deserializer<'de>,
3434                                {
3435                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3436                                }
3437                            }
3438                            result.timeout_seconds =
3439                                map.next_value::<__With>()?.0.unwrap_or_default();
3440                        }
3441                        __FieldTag::__available_memory => {
3442                            if !fields.insert(__FieldTag::__available_memory) {
3443                                return std::result::Result::Err(A::Error::duplicate_field(
3444                                    "multiple values for available_memory",
3445                                ));
3446                            }
3447                            result.available_memory = map
3448                                .next_value::<std::option::Option<std::string::String>>()?
3449                                .unwrap_or_default();
3450                        }
3451                        __FieldTag::__available_cpu => {
3452                            if !fields.insert(__FieldTag::__available_cpu) {
3453                                return std::result::Result::Err(A::Error::duplicate_field(
3454                                    "multiple values for available_cpu",
3455                                ));
3456                            }
3457                            result.available_cpu = map
3458                                .next_value::<std::option::Option<std::string::String>>()?
3459                                .unwrap_or_default();
3460                        }
3461                        __FieldTag::__environment_variables => {
3462                            if !fields.insert(__FieldTag::__environment_variables) {
3463                                return std::result::Result::Err(A::Error::duplicate_field(
3464                                    "multiple values for environment_variables",
3465                                ));
3466                            }
3467                            result.environment_variables = map
3468                                .next_value::<std::option::Option<
3469                                    std::collections::HashMap<
3470                                        std::string::String,
3471                                        std::string::String,
3472                                    >,
3473                                >>()?
3474                                .unwrap_or_default();
3475                        }
3476                        __FieldTag::__max_instance_count => {
3477                            if !fields.insert(__FieldTag::__max_instance_count) {
3478                                return std::result::Result::Err(A::Error::duplicate_field(
3479                                    "multiple values for max_instance_count",
3480                                ));
3481                            }
3482                            struct __With(std::option::Option<i32>);
3483                            impl<'de> serde::de::Deserialize<'de> for __With {
3484                                fn deserialize<D>(
3485                                    deserializer: D,
3486                                ) -> std::result::Result<Self, D::Error>
3487                                where
3488                                    D: serde::de::Deserializer<'de>,
3489                                {
3490                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3491                                }
3492                            }
3493                            result.max_instance_count =
3494                                map.next_value::<__With>()?.0.unwrap_or_default();
3495                        }
3496                        __FieldTag::__min_instance_count => {
3497                            if !fields.insert(__FieldTag::__min_instance_count) {
3498                                return std::result::Result::Err(A::Error::duplicate_field(
3499                                    "multiple values for min_instance_count",
3500                                ));
3501                            }
3502                            struct __With(std::option::Option<i32>);
3503                            impl<'de> serde::de::Deserialize<'de> for __With {
3504                                fn deserialize<D>(
3505                                    deserializer: D,
3506                                ) -> std::result::Result<Self, D::Error>
3507                                where
3508                                    D: serde::de::Deserializer<'de>,
3509                                {
3510                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3511                                }
3512                            }
3513                            result.min_instance_count =
3514                                map.next_value::<__With>()?.0.unwrap_or_default();
3515                        }
3516                        __FieldTag::__vpc_connector => {
3517                            if !fields.insert(__FieldTag::__vpc_connector) {
3518                                return std::result::Result::Err(A::Error::duplicate_field(
3519                                    "multiple values for vpc_connector",
3520                                ));
3521                            }
3522                            result.vpc_connector = map
3523                                .next_value::<std::option::Option<std::string::String>>()?
3524                                .unwrap_or_default();
3525                        }
3526                        __FieldTag::__vpc_connector_egress_settings => {
3527                            if !fields.insert(__FieldTag::__vpc_connector_egress_settings) {
3528                                return std::result::Result::Err(A::Error::duplicate_field(
3529                                    "multiple values for vpc_connector_egress_settings",
3530                                ));
3531                            }
3532                            result.vpc_connector_egress_settings = map
3533                                .next_value::<std::option::Option<
3534                                    crate::model::service_config::VpcConnectorEgressSettings,
3535                                >>()?
3536                                .unwrap_or_default();
3537                        }
3538                        __FieldTag::__ingress_settings => {
3539                            if !fields.insert(__FieldTag::__ingress_settings) {
3540                                return std::result::Result::Err(A::Error::duplicate_field(
3541                                    "multiple values for ingress_settings",
3542                                ));
3543                            }
3544                            result.ingress_settings =
3545                                map.next_value::<std::option::Option<
3546                                    crate::model::service_config::IngressSettings,
3547                                >>()?
3548                                .unwrap_or_default();
3549                        }
3550                        __FieldTag::__uri => {
3551                            if !fields.insert(__FieldTag::__uri) {
3552                                return std::result::Result::Err(A::Error::duplicate_field(
3553                                    "multiple values for uri",
3554                                ));
3555                            }
3556                            result.uri = map
3557                                .next_value::<std::option::Option<std::string::String>>()?
3558                                .unwrap_or_default();
3559                        }
3560                        __FieldTag::__service_account_email => {
3561                            if !fields.insert(__FieldTag::__service_account_email) {
3562                                return std::result::Result::Err(A::Error::duplicate_field(
3563                                    "multiple values for service_account_email",
3564                                ));
3565                            }
3566                            result.service_account_email = map
3567                                .next_value::<std::option::Option<std::string::String>>()?
3568                                .unwrap_or_default();
3569                        }
3570                        __FieldTag::__all_traffic_on_latest_revision => {
3571                            if !fields.insert(__FieldTag::__all_traffic_on_latest_revision) {
3572                                return std::result::Result::Err(A::Error::duplicate_field(
3573                                    "multiple values for all_traffic_on_latest_revision",
3574                                ));
3575                            }
3576                            result.all_traffic_on_latest_revision = map
3577                                .next_value::<std::option::Option<bool>>()?
3578                                .unwrap_or_default();
3579                        }
3580                        __FieldTag::__secret_environment_variables => {
3581                            if !fields.insert(__FieldTag::__secret_environment_variables) {
3582                                return std::result::Result::Err(A::Error::duplicate_field(
3583                                    "multiple values for secret_environment_variables",
3584                                ));
3585                            }
3586                            result.secret_environment_variables = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SecretEnvVar>>>()?.unwrap_or_default();
3587                        }
3588                        __FieldTag::__secret_volumes => {
3589                            if !fields.insert(__FieldTag::__secret_volumes) {
3590                                return std::result::Result::Err(A::Error::duplicate_field(
3591                                    "multiple values for secret_volumes",
3592                                ));
3593                            }
3594                            result.secret_volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SecretVolume>>>()?.unwrap_or_default();
3595                        }
3596                        __FieldTag::__revision => {
3597                            if !fields.insert(__FieldTag::__revision) {
3598                                return std::result::Result::Err(A::Error::duplicate_field(
3599                                    "multiple values for revision",
3600                                ));
3601                            }
3602                            result.revision = map
3603                                .next_value::<std::option::Option<std::string::String>>()?
3604                                .unwrap_or_default();
3605                        }
3606                        __FieldTag::__max_instance_request_concurrency => {
3607                            if !fields.insert(__FieldTag::__max_instance_request_concurrency) {
3608                                return std::result::Result::Err(A::Error::duplicate_field(
3609                                    "multiple values for max_instance_request_concurrency",
3610                                ));
3611                            }
3612                            struct __With(std::option::Option<i32>);
3613                            impl<'de> serde::de::Deserialize<'de> for __With {
3614                                fn deserialize<D>(
3615                                    deserializer: D,
3616                                ) -> std::result::Result<Self, D::Error>
3617                                where
3618                                    D: serde::de::Deserializer<'de>,
3619                                {
3620                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3621                                }
3622                            }
3623                            result.max_instance_request_concurrency =
3624                                map.next_value::<__With>()?.0.unwrap_or_default();
3625                        }
3626                        __FieldTag::__security_level => {
3627                            if !fields.insert(__FieldTag::__security_level) {
3628                                return std::result::Result::Err(A::Error::duplicate_field(
3629                                    "multiple values for security_level",
3630                                ));
3631                            }
3632                            result.security_level =
3633                                map.next_value::<std::option::Option<
3634                                    crate::model::service_config::SecurityLevel,
3635                                >>()?
3636                                .unwrap_or_default();
3637                        }
3638                        __FieldTag::__binary_authorization_policy => {
3639                            if !fields.insert(__FieldTag::__binary_authorization_policy) {
3640                                return std::result::Result::Err(A::Error::duplicate_field(
3641                                    "multiple values for binary_authorization_policy",
3642                                ));
3643                            }
3644                            result.binary_authorization_policy = map
3645                                .next_value::<std::option::Option<std::string::String>>()?
3646                                .unwrap_or_default();
3647                        }
3648                        __FieldTag::Unknown(key) => {
3649                            let value = map.next_value::<serde_json::Value>()?;
3650                            result._unknown_fields.insert(key, value);
3651                        }
3652                    }
3653                }
3654                std::result::Result::Ok(result)
3655            }
3656        }
3657        deserializer.deserialize_any(Visitor)
3658    }
3659}
3660
3661#[doc(hidden)]
3662impl serde::ser::Serialize for ServiceConfig {
3663    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3664    where
3665        S: serde::ser::Serializer,
3666    {
3667        use serde::ser::SerializeMap;
3668        #[allow(unused_imports)]
3669        use std::option::Option::Some;
3670        let mut state = serializer.serialize_map(std::option::Option::None)?;
3671        if !self.service.is_empty() {
3672            state.serialize_entry("service", &self.service)?;
3673        }
3674        if !wkt::internal::is_default(&self.timeout_seconds) {
3675            struct __With<'a>(&'a i32);
3676            impl<'a> serde::ser::Serialize for __With<'a> {
3677                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3678                where
3679                    S: serde::ser::Serializer,
3680                {
3681                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3682                }
3683            }
3684            state.serialize_entry("timeoutSeconds", &__With(&self.timeout_seconds))?;
3685        }
3686        if !self.available_memory.is_empty() {
3687            state.serialize_entry("availableMemory", &self.available_memory)?;
3688        }
3689        if !self.available_cpu.is_empty() {
3690            state.serialize_entry("availableCpu", &self.available_cpu)?;
3691        }
3692        if !self.environment_variables.is_empty() {
3693            state.serialize_entry("environmentVariables", &self.environment_variables)?;
3694        }
3695        if !wkt::internal::is_default(&self.max_instance_count) {
3696            struct __With<'a>(&'a i32);
3697            impl<'a> serde::ser::Serialize for __With<'a> {
3698                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3699                where
3700                    S: serde::ser::Serializer,
3701                {
3702                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3703                }
3704            }
3705            state.serialize_entry("maxInstanceCount", &__With(&self.max_instance_count))?;
3706        }
3707        if !wkt::internal::is_default(&self.min_instance_count) {
3708            struct __With<'a>(&'a i32);
3709            impl<'a> serde::ser::Serialize for __With<'a> {
3710                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3711                where
3712                    S: serde::ser::Serializer,
3713                {
3714                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3715                }
3716            }
3717            state.serialize_entry("minInstanceCount", &__With(&self.min_instance_count))?;
3718        }
3719        if !self.vpc_connector.is_empty() {
3720            state.serialize_entry("vpcConnector", &self.vpc_connector)?;
3721        }
3722        if !wkt::internal::is_default(&self.vpc_connector_egress_settings) {
3723            state.serialize_entry(
3724                "vpcConnectorEgressSettings",
3725                &self.vpc_connector_egress_settings,
3726            )?;
3727        }
3728        if !wkt::internal::is_default(&self.ingress_settings) {
3729            state.serialize_entry("ingressSettings", &self.ingress_settings)?;
3730        }
3731        if !self.uri.is_empty() {
3732            state.serialize_entry("uri", &self.uri)?;
3733        }
3734        if !self.service_account_email.is_empty() {
3735            state.serialize_entry("serviceAccountEmail", &self.service_account_email)?;
3736        }
3737        if !wkt::internal::is_default(&self.all_traffic_on_latest_revision) {
3738            state.serialize_entry(
3739                "allTrafficOnLatestRevision",
3740                &self.all_traffic_on_latest_revision,
3741            )?;
3742        }
3743        if !self.secret_environment_variables.is_empty() {
3744            state.serialize_entry(
3745                "secretEnvironmentVariables",
3746                &self.secret_environment_variables,
3747            )?;
3748        }
3749        if !self.secret_volumes.is_empty() {
3750            state.serialize_entry("secretVolumes", &self.secret_volumes)?;
3751        }
3752        if !self.revision.is_empty() {
3753            state.serialize_entry("revision", &self.revision)?;
3754        }
3755        if !wkt::internal::is_default(&self.max_instance_request_concurrency) {
3756            struct __With<'a>(&'a i32);
3757            impl<'a> serde::ser::Serialize for __With<'a> {
3758                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3759                where
3760                    S: serde::ser::Serializer,
3761                {
3762                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3763                }
3764            }
3765            state.serialize_entry(
3766                "maxInstanceRequestConcurrency",
3767                &__With(&self.max_instance_request_concurrency),
3768            )?;
3769        }
3770        if !wkt::internal::is_default(&self.security_level) {
3771            state.serialize_entry("securityLevel", &self.security_level)?;
3772        }
3773        if !self.binary_authorization_policy.is_empty() {
3774            state.serialize_entry(
3775                "binaryAuthorizationPolicy",
3776                &self.binary_authorization_policy,
3777            )?;
3778        }
3779        if !self._unknown_fields.is_empty() {
3780            for (key, value) in self._unknown_fields.iter() {
3781                state.serialize_entry(key, &value)?;
3782            }
3783        }
3784        state.end()
3785    }
3786}
3787
3788impl std::fmt::Debug for ServiceConfig {
3789    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3790        let mut debug_struct = f.debug_struct("ServiceConfig");
3791        debug_struct.field("service", &self.service);
3792        debug_struct.field("timeout_seconds", &self.timeout_seconds);
3793        debug_struct.field("available_memory", &self.available_memory);
3794        debug_struct.field("available_cpu", &self.available_cpu);
3795        debug_struct.field("environment_variables", &self.environment_variables);
3796        debug_struct.field("max_instance_count", &self.max_instance_count);
3797        debug_struct.field("min_instance_count", &self.min_instance_count);
3798        debug_struct.field("vpc_connector", &self.vpc_connector);
3799        debug_struct.field(
3800            "vpc_connector_egress_settings",
3801            &self.vpc_connector_egress_settings,
3802        );
3803        debug_struct.field("ingress_settings", &self.ingress_settings);
3804        debug_struct.field("uri", &self.uri);
3805        debug_struct.field("service_account_email", &self.service_account_email);
3806        debug_struct.field(
3807            "all_traffic_on_latest_revision",
3808            &self.all_traffic_on_latest_revision,
3809        );
3810        debug_struct.field(
3811            "secret_environment_variables",
3812            &self.secret_environment_variables,
3813        );
3814        debug_struct.field("secret_volumes", &self.secret_volumes);
3815        debug_struct.field("revision", &self.revision);
3816        debug_struct.field(
3817            "max_instance_request_concurrency",
3818            &self.max_instance_request_concurrency,
3819        );
3820        debug_struct.field("security_level", &self.security_level);
3821        debug_struct.field(
3822            "binary_authorization_policy",
3823            &self.binary_authorization_policy,
3824        );
3825        if !self._unknown_fields.is_empty() {
3826            debug_struct.field("_unknown_fields", &self._unknown_fields);
3827        }
3828        debug_struct.finish()
3829    }
3830}
3831
3832/// Defines additional types related to [ServiceConfig].
3833pub mod service_config {
3834    #[allow(unused_imports)]
3835    use super::*;
3836
3837    /// Available egress settings.
3838    ///
3839    /// This controls what traffic is diverted through the VPC Access Connector
3840    /// resource. By default PRIVATE_RANGES_ONLY will be used.
3841    ///
3842    /// # Working with unknown values
3843    ///
3844    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3845    /// additional enum variants at any time. Adding new variants is not considered
3846    /// a breaking change. Applications should write their code in anticipation of:
3847    ///
3848    /// - New values appearing in future releases of the client library, **and**
3849    /// - New values received dynamically, without application changes.
3850    ///
3851    /// Please consult the [Working with enums] section in the user guide for some
3852    /// guidelines.
3853    ///
3854    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3855    #[derive(Clone, Debug, PartialEq)]
3856    #[non_exhaustive]
3857    pub enum VpcConnectorEgressSettings {
3858        /// Unspecified.
3859        Unspecified,
3860        /// Use the VPC Access Connector only for private IP space from RFC1918.
3861        PrivateRangesOnly,
3862        /// Force the use of VPC Access Connector for all egress traffic from the
3863        /// function.
3864        AllTraffic,
3865        /// If set, the enum was initialized with an unknown value.
3866        ///
3867        /// Applications can examine the value using [VpcConnectorEgressSettings::value] or
3868        /// [VpcConnectorEgressSettings::name].
3869        UnknownValue(vpc_connector_egress_settings::UnknownValue),
3870    }
3871
3872    #[doc(hidden)]
3873    pub mod vpc_connector_egress_settings {
3874        #[allow(unused_imports)]
3875        use super::*;
3876        #[derive(Clone, Debug, PartialEq)]
3877        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3878    }
3879
3880    impl VpcConnectorEgressSettings {
3881        /// Gets the enum value.
3882        ///
3883        /// Returns `None` if the enum contains an unknown value deserialized from
3884        /// the string representation of enums.
3885        pub fn value(&self) -> std::option::Option<i32> {
3886            match self {
3887                Self::Unspecified => std::option::Option::Some(0),
3888                Self::PrivateRangesOnly => std::option::Option::Some(1),
3889                Self::AllTraffic => std::option::Option::Some(2),
3890                Self::UnknownValue(u) => u.0.value(),
3891            }
3892        }
3893
3894        /// Gets the enum value as a string.
3895        ///
3896        /// Returns `None` if the enum contains an unknown value deserialized from
3897        /// the integer representation of enums.
3898        pub fn name(&self) -> std::option::Option<&str> {
3899            match self {
3900                Self::Unspecified => {
3901                    std::option::Option::Some("VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED")
3902                }
3903                Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
3904                Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
3905                Self::UnknownValue(u) => u.0.name(),
3906            }
3907        }
3908    }
3909
3910    impl std::default::Default for VpcConnectorEgressSettings {
3911        fn default() -> Self {
3912            use std::convert::From;
3913            Self::from(0)
3914        }
3915    }
3916
3917    impl std::fmt::Display for VpcConnectorEgressSettings {
3918        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3919            wkt::internal::display_enum(f, self.name(), self.value())
3920        }
3921    }
3922
3923    impl std::convert::From<i32> for VpcConnectorEgressSettings {
3924        fn from(value: i32) -> Self {
3925            match value {
3926                0 => Self::Unspecified,
3927                1 => Self::PrivateRangesOnly,
3928                2 => Self::AllTraffic,
3929                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
3930                    wkt::internal::UnknownEnumValue::Integer(value),
3931                )),
3932            }
3933        }
3934    }
3935
3936    impl std::convert::From<&str> for VpcConnectorEgressSettings {
3937        fn from(value: &str) -> Self {
3938            use std::string::ToString;
3939            match value {
3940                "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
3941                "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
3942                "ALL_TRAFFIC" => Self::AllTraffic,
3943                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
3944                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3945                )),
3946            }
3947        }
3948    }
3949
3950    impl serde::ser::Serialize for VpcConnectorEgressSettings {
3951        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3952        where
3953            S: serde::Serializer,
3954        {
3955            match self {
3956                Self::Unspecified => serializer.serialize_i32(0),
3957                Self::PrivateRangesOnly => serializer.serialize_i32(1),
3958                Self::AllTraffic => serializer.serialize_i32(2),
3959                Self::UnknownValue(u) => u.0.serialize(serializer),
3960            }
3961        }
3962    }
3963
3964    impl<'de> serde::de::Deserialize<'de> for VpcConnectorEgressSettings {
3965        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3966        where
3967            D: serde::Deserializer<'de>,
3968        {
3969            deserializer.deserialize_any(
3970                wkt::internal::EnumVisitor::<VpcConnectorEgressSettings>::new(
3971                    ".google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings",
3972                ),
3973            )
3974        }
3975    }
3976
3977    /// Available ingress settings.
3978    ///
3979    /// This controls what traffic can reach the function.
3980    ///
3981    /// If unspecified, ALLOW_ALL will be used.
3982    ///
3983    /// # Working with unknown values
3984    ///
3985    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3986    /// additional enum variants at any time. Adding new variants is not considered
3987    /// a breaking change. Applications should write their code in anticipation of:
3988    ///
3989    /// - New values appearing in future releases of the client library, **and**
3990    /// - New values received dynamically, without application changes.
3991    ///
3992    /// Please consult the [Working with enums] section in the user guide for some
3993    /// guidelines.
3994    ///
3995    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3996    #[derive(Clone, Debug, PartialEq)]
3997    #[non_exhaustive]
3998    pub enum IngressSettings {
3999        /// Unspecified.
4000        Unspecified,
4001        /// Allow HTTP traffic from public and private sources.
4002        AllowAll,
4003        /// Allow HTTP traffic from only private VPC sources.
4004        AllowInternalOnly,
4005        /// Allow HTTP traffic from private VPC sources and through GCLB.
4006        AllowInternalAndGclb,
4007        /// If set, the enum was initialized with an unknown value.
4008        ///
4009        /// Applications can examine the value using [IngressSettings::value] or
4010        /// [IngressSettings::name].
4011        UnknownValue(ingress_settings::UnknownValue),
4012    }
4013
4014    #[doc(hidden)]
4015    pub mod ingress_settings {
4016        #[allow(unused_imports)]
4017        use super::*;
4018        #[derive(Clone, Debug, PartialEq)]
4019        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4020    }
4021
4022    impl IngressSettings {
4023        /// Gets the enum value.
4024        ///
4025        /// Returns `None` if the enum contains an unknown value deserialized from
4026        /// the string representation of enums.
4027        pub fn value(&self) -> std::option::Option<i32> {
4028            match self {
4029                Self::Unspecified => std::option::Option::Some(0),
4030                Self::AllowAll => std::option::Option::Some(1),
4031                Self::AllowInternalOnly => std::option::Option::Some(2),
4032                Self::AllowInternalAndGclb => std::option::Option::Some(3),
4033                Self::UnknownValue(u) => u.0.value(),
4034            }
4035        }
4036
4037        /// Gets the enum value as a string.
4038        ///
4039        /// Returns `None` if the enum contains an unknown value deserialized from
4040        /// the integer representation of enums.
4041        pub fn name(&self) -> std::option::Option<&str> {
4042            match self {
4043                Self::Unspecified => std::option::Option::Some("INGRESS_SETTINGS_UNSPECIFIED"),
4044                Self::AllowAll => std::option::Option::Some("ALLOW_ALL"),
4045                Self::AllowInternalOnly => std::option::Option::Some("ALLOW_INTERNAL_ONLY"),
4046                Self::AllowInternalAndGclb => std::option::Option::Some("ALLOW_INTERNAL_AND_GCLB"),
4047                Self::UnknownValue(u) => u.0.name(),
4048            }
4049        }
4050    }
4051
4052    impl std::default::Default for IngressSettings {
4053        fn default() -> Self {
4054            use std::convert::From;
4055            Self::from(0)
4056        }
4057    }
4058
4059    impl std::fmt::Display for IngressSettings {
4060        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4061            wkt::internal::display_enum(f, self.name(), self.value())
4062        }
4063    }
4064
4065    impl std::convert::From<i32> for IngressSettings {
4066        fn from(value: i32) -> Self {
4067            match value {
4068                0 => Self::Unspecified,
4069                1 => Self::AllowAll,
4070                2 => Self::AllowInternalOnly,
4071                3 => Self::AllowInternalAndGclb,
4072                _ => Self::UnknownValue(ingress_settings::UnknownValue(
4073                    wkt::internal::UnknownEnumValue::Integer(value),
4074                )),
4075            }
4076        }
4077    }
4078
4079    impl std::convert::From<&str> for IngressSettings {
4080        fn from(value: &str) -> Self {
4081            use std::string::ToString;
4082            match value {
4083                "INGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
4084                "ALLOW_ALL" => Self::AllowAll,
4085                "ALLOW_INTERNAL_ONLY" => Self::AllowInternalOnly,
4086                "ALLOW_INTERNAL_AND_GCLB" => Self::AllowInternalAndGclb,
4087                _ => Self::UnknownValue(ingress_settings::UnknownValue(
4088                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4089                )),
4090            }
4091        }
4092    }
4093
4094    impl serde::ser::Serialize for IngressSettings {
4095        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4096        where
4097            S: serde::Serializer,
4098        {
4099            match self {
4100                Self::Unspecified => serializer.serialize_i32(0),
4101                Self::AllowAll => serializer.serialize_i32(1),
4102                Self::AllowInternalOnly => serializer.serialize_i32(2),
4103                Self::AllowInternalAndGclb => serializer.serialize_i32(3),
4104                Self::UnknownValue(u) => u.0.serialize(serializer),
4105            }
4106        }
4107    }
4108
4109    impl<'de> serde::de::Deserialize<'de> for IngressSettings {
4110        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4111        where
4112            D: serde::Deserializer<'de>,
4113        {
4114            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressSettings>::new(
4115                ".google.cloud.functions.v2.ServiceConfig.IngressSettings",
4116            ))
4117        }
4118    }
4119
4120    /// Available security level settings.
4121    ///
4122    /// This enforces security protocol on function URL.
4123    ///
4124    /// Security level is only configurable for 1st Gen functions, If unspecified,
4125    /// SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY.
4126    ///
4127    /// # Working with unknown values
4128    ///
4129    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4130    /// additional enum variants at any time. Adding new variants is not considered
4131    /// a breaking change. Applications should write their code in anticipation of:
4132    ///
4133    /// - New values appearing in future releases of the client library, **and**
4134    /// - New values received dynamically, without application changes.
4135    ///
4136    /// Please consult the [Working with enums] section in the user guide for some
4137    /// guidelines.
4138    ///
4139    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4140    #[derive(Clone, Debug, PartialEq)]
4141    #[non_exhaustive]
4142    pub enum SecurityLevel {
4143        /// Unspecified.
4144        Unspecified,
4145        /// Requests for a URL that match this handler that do not use HTTPS are
4146        /// automatically redirected to the HTTPS URL with the same path. Query
4147        /// parameters are reserved for the redirect.
4148        SecureAlways,
4149        /// Both HTTP and HTTPS requests with URLs that match the handler succeed
4150        /// without redirects. The application can examine the request to determine
4151        /// which protocol was used and respond accordingly.
4152        SecureOptional,
4153        /// If set, the enum was initialized with an unknown value.
4154        ///
4155        /// Applications can examine the value using [SecurityLevel::value] or
4156        /// [SecurityLevel::name].
4157        UnknownValue(security_level::UnknownValue),
4158    }
4159
4160    #[doc(hidden)]
4161    pub mod security_level {
4162        #[allow(unused_imports)]
4163        use super::*;
4164        #[derive(Clone, Debug, PartialEq)]
4165        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4166    }
4167
4168    impl SecurityLevel {
4169        /// Gets the enum value.
4170        ///
4171        /// Returns `None` if the enum contains an unknown value deserialized from
4172        /// the string representation of enums.
4173        pub fn value(&self) -> std::option::Option<i32> {
4174            match self {
4175                Self::Unspecified => std::option::Option::Some(0),
4176                Self::SecureAlways => std::option::Option::Some(1),
4177                Self::SecureOptional => std::option::Option::Some(2),
4178                Self::UnknownValue(u) => u.0.value(),
4179            }
4180        }
4181
4182        /// Gets the enum value as a string.
4183        ///
4184        /// Returns `None` if the enum contains an unknown value deserialized from
4185        /// the integer representation of enums.
4186        pub fn name(&self) -> std::option::Option<&str> {
4187            match self {
4188                Self::Unspecified => std::option::Option::Some("SECURITY_LEVEL_UNSPECIFIED"),
4189                Self::SecureAlways => std::option::Option::Some("SECURE_ALWAYS"),
4190                Self::SecureOptional => std::option::Option::Some("SECURE_OPTIONAL"),
4191                Self::UnknownValue(u) => u.0.name(),
4192            }
4193        }
4194    }
4195
4196    impl std::default::Default for SecurityLevel {
4197        fn default() -> Self {
4198            use std::convert::From;
4199            Self::from(0)
4200        }
4201    }
4202
4203    impl std::fmt::Display for SecurityLevel {
4204        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4205            wkt::internal::display_enum(f, self.name(), self.value())
4206        }
4207    }
4208
4209    impl std::convert::From<i32> for SecurityLevel {
4210        fn from(value: i32) -> Self {
4211            match value {
4212                0 => Self::Unspecified,
4213                1 => Self::SecureAlways,
4214                2 => Self::SecureOptional,
4215                _ => Self::UnknownValue(security_level::UnknownValue(
4216                    wkt::internal::UnknownEnumValue::Integer(value),
4217                )),
4218            }
4219        }
4220    }
4221
4222    impl std::convert::From<&str> for SecurityLevel {
4223        fn from(value: &str) -> Self {
4224            use std::string::ToString;
4225            match value {
4226                "SECURITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
4227                "SECURE_ALWAYS" => Self::SecureAlways,
4228                "SECURE_OPTIONAL" => Self::SecureOptional,
4229                _ => Self::UnknownValue(security_level::UnknownValue(
4230                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4231                )),
4232            }
4233        }
4234    }
4235
4236    impl serde::ser::Serialize for SecurityLevel {
4237        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4238        where
4239            S: serde::Serializer,
4240        {
4241            match self {
4242                Self::Unspecified => serializer.serialize_i32(0),
4243                Self::SecureAlways => serializer.serialize_i32(1),
4244                Self::SecureOptional => serializer.serialize_i32(2),
4245                Self::UnknownValue(u) => u.0.serialize(serializer),
4246            }
4247        }
4248    }
4249
4250    impl<'de> serde::de::Deserialize<'de> for SecurityLevel {
4251        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4252        where
4253            D: serde::Deserializer<'de>,
4254        {
4255            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityLevel>::new(
4256                ".google.cloud.functions.v2.ServiceConfig.SecurityLevel",
4257            ))
4258        }
4259    }
4260}
4261
4262/// Configuration for a secret environment variable. It has the information
4263/// necessary to fetch the secret value from secret manager and expose it as an
4264/// environment variable.
4265#[derive(Clone, Default, PartialEq)]
4266#[non_exhaustive]
4267pub struct SecretEnvVar {
4268    /// Name of the environment variable.
4269    pub key: std::string::String,
4270
4271    /// Project identifier (preferably project number but can also be the
4272    /// project ID) of the project that contains the secret. If not set, it is
4273    /// assumed that the secret is in the same project as the function.
4274    pub project_id: std::string::String,
4275
4276    /// Name of the secret in secret manager (not the full resource name).
4277    pub secret: std::string::String,
4278
4279    /// Version of the secret (version number or the string 'latest'). It is
4280    /// recommended to use a numeric version for secret environment variables as
4281    /// any updates to the secret value is not reflected until new instances
4282    /// start.
4283    pub version: std::string::String,
4284
4285    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4286}
4287
4288impl SecretEnvVar {
4289    pub fn new() -> Self {
4290        std::default::Default::default()
4291    }
4292
4293    /// Sets the value of [key][crate::model::SecretEnvVar::key].
4294    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4295        self.key = v.into();
4296        self
4297    }
4298
4299    /// Sets the value of [project_id][crate::model::SecretEnvVar::project_id].
4300    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4301        self.project_id = v.into();
4302        self
4303    }
4304
4305    /// Sets the value of [secret][crate::model::SecretEnvVar::secret].
4306    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4307        self.secret = v.into();
4308        self
4309    }
4310
4311    /// Sets the value of [version][crate::model::SecretEnvVar::version].
4312    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4313        self.version = v.into();
4314        self
4315    }
4316}
4317
4318impl wkt::message::Message for SecretEnvVar {
4319    fn typename() -> &'static str {
4320        "type.googleapis.com/google.cloud.functions.v2.SecretEnvVar"
4321    }
4322}
4323
4324#[doc(hidden)]
4325impl<'de> serde::de::Deserialize<'de> for SecretEnvVar {
4326    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4327    where
4328        D: serde::Deserializer<'de>,
4329    {
4330        #[allow(non_camel_case_types)]
4331        #[doc(hidden)]
4332        #[derive(PartialEq, Eq, Hash)]
4333        enum __FieldTag {
4334            __key,
4335            __project_id,
4336            __secret,
4337            __version,
4338            Unknown(std::string::String),
4339        }
4340        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4341            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4342            where
4343                D: serde::Deserializer<'de>,
4344            {
4345                struct Visitor;
4346                impl<'de> serde::de::Visitor<'de> for Visitor {
4347                    type Value = __FieldTag;
4348                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4349                        formatter.write_str("a field name for SecretEnvVar")
4350                    }
4351                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4352                    where
4353                        E: serde::de::Error,
4354                    {
4355                        use std::result::Result::Ok;
4356                        use std::string::ToString;
4357                        match value {
4358                            "key" => Ok(__FieldTag::__key),
4359                            "projectId" => Ok(__FieldTag::__project_id),
4360                            "project_id" => Ok(__FieldTag::__project_id),
4361                            "secret" => Ok(__FieldTag::__secret),
4362                            "version" => Ok(__FieldTag::__version),
4363                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4364                        }
4365                    }
4366                }
4367                deserializer.deserialize_identifier(Visitor)
4368            }
4369        }
4370        struct Visitor;
4371        impl<'de> serde::de::Visitor<'de> for Visitor {
4372            type Value = SecretEnvVar;
4373            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4374                formatter.write_str("struct SecretEnvVar")
4375            }
4376            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4377            where
4378                A: serde::de::MapAccess<'de>,
4379            {
4380                #[allow(unused_imports)]
4381                use serde::de::Error;
4382                use std::option::Option::Some;
4383                let mut fields = std::collections::HashSet::new();
4384                let mut result = Self::Value::new();
4385                while let Some(tag) = map.next_key::<__FieldTag>()? {
4386                    #[allow(clippy::match_single_binding)]
4387                    match tag {
4388                        __FieldTag::__key => {
4389                            if !fields.insert(__FieldTag::__key) {
4390                                return std::result::Result::Err(A::Error::duplicate_field(
4391                                    "multiple values for key",
4392                                ));
4393                            }
4394                            result.key = map
4395                                .next_value::<std::option::Option<std::string::String>>()?
4396                                .unwrap_or_default();
4397                        }
4398                        __FieldTag::__project_id => {
4399                            if !fields.insert(__FieldTag::__project_id) {
4400                                return std::result::Result::Err(A::Error::duplicate_field(
4401                                    "multiple values for project_id",
4402                                ));
4403                            }
4404                            result.project_id = map
4405                                .next_value::<std::option::Option<std::string::String>>()?
4406                                .unwrap_or_default();
4407                        }
4408                        __FieldTag::__secret => {
4409                            if !fields.insert(__FieldTag::__secret) {
4410                                return std::result::Result::Err(A::Error::duplicate_field(
4411                                    "multiple values for secret",
4412                                ));
4413                            }
4414                            result.secret = map
4415                                .next_value::<std::option::Option<std::string::String>>()?
4416                                .unwrap_or_default();
4417                        }
4418                        __FieldTag::__version => {
4419                            if !fields.insert(__FieldTag::__version) {
4420                                return std::result::Result::Err(A::Error::duplicate_field(
4421                                    "multiple values for version",
4422                                ));
4423                            }
4424                            result.version = map
4425                                .next_value::<std::option::Option<std::string::String>>()?
4426                                .unwrap_or_default();
4427                        }
4428                        __FieldTag::Unknown(key) => {
4429                            let value = map.next_value::<serde_json::Value>()?;
4430                            result._unknown_fields.insert(key, value);
4431                        }
4432                    }
4433                }
4434                std::result::Result::Ok(result)
4435            }
4436        }
4437        deserializer.deserialize_any(Visitor)
4438    }
4439}
4440
4441#[doc(hidden)]
4442impl serde::ser::Serialize for SecretEnvVar {
4443    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4444    where
4445        S: serde::ser::Serializer,
4446    {
4447        use serde::ser::SerializeMap;
4448        #[allow(unused_imports)]
4449        use std::option::Option::Some;
4450        let mut state = serializer.serialize_map(std::option::Option::None)?;
4451        if !self.key.is_empty() {
4452            state.serialize_entry("key", &self.key)?;
4453        }
4454        if !self.project_id.is_empty() {
4455            state.serialize_entry("projectId", &self.project_id)?;
4456        }
4457        if !self.secret.is_empty() {
4458            state.serialize_entry("secret", &self.secret)?;
4459        }
4460        if !self.version.is_empty() {
4461            state.serialize_entry("version", &self.version)?;
4462        }
4463        if !self._unknown_fields.is_empty() {
4464            for (key, value) in self._unknown_fields.iter() {
4465                state.serialize_entry(key, &value)?;
4466            }
4467        }
4468        state.end()
4469    }
4470}
4471
4472impl std::fmt::Debug for SecretEnvVar {
4473    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4474        let mut debug_struct = f.debug_struct("SecretEnvVar");
4475        debug_struct.field("key", &self.key);
4476        debug_struct.field("project_id", &self.project_id);
4477        debug_struct.field("secret", &self.secret);
4478        debug_struct.field("version", &self.version);
4479        if !self._unknown_fields.is_empty() {
4480            debug_struct.field("_unknown_fields", &self._unknown_fields);
4481        }
4482        debug_struct.finish()
4483    }
4484}
4485
4486/// Configuration for a secret volume. It has the information necessary to fetch
4487/// the secret value from secret manager and make it available as files mounted
4488/// at the requested paths within the application container.
4489#[derive(Clone, Default, PartialEq)]
4490#[non_exhaustive]
4491pub struct SecretVolume {
4492    /// The path within the container to mount the secret volume. For example,
4493    /// setting the mount_path as `/etc/secrets` would mount the secret value files
4494    /// under the `/etc/secrets` directory. This directory will also be completely
4495    /// shadowed and unavailable to mount any other secrets.
4496    /// Recommended mount path: /etc/secrets
4497    pub mount_path: std::string::String,
4498
4499    /// Project identifier (preferably project number but can also be the project
4500    /// ID) of the project that contains the secret. If not set, it is
4501    /// assumed that the secret is in the same project as the function.
4502    pub project_id: std::string::String,
4503
4504    /// Name of the secret in secret manager (not the full resource name).
4505    pub secret: std::string::String,
4506
4507    /// List of secret versions to mount for this secret. If empty, the `latest`
4508    /// version of the secret will be made available in a file named after the
4509    /// secret under the mount point.
4510    pub versions: std::vec::Vec<crate::model::secret_volume::SecretVersion>,
4511
4512    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4513}
4514
4515impl SecretVolume {
4516    pub fn new() -> Self {
4517        std::default::Default::default()
4518    }
4519
4520    /// Sets the value of [mount_path][crate::model::SecretVolume::mount_path].
4521    pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4522        self.mount_path = v.into();
4523        self
4524    }
4525
4526    /// Sets the value of [project_id][crate::model::SecretVolume::project_id].
4527    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4528        self.project_id = v.into();
4529        self
4530    }
4531
4532    /// Sets the value of [secret][crate::model::SecretVolume::secret].
4533    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4534        self.secret = v.into();
4535        self
4536    }
4537
4538    /// Sets the value of [versions][crate::model::SecretVolume::versions].
4539    pub fn set_versions<T, V>(mut self, v: T) -> Self
4540    where
4541        T: std::iter::IntoIterator<Item = V>,
4542        V: std::convert::Into<crate::model::secret_volume::SecretVersion>,
4543    {
4544        use std::iter::Iterator;
4545        self.versions = v.into_iter().map(|i| i.into()).collect();
4546        self
4547    }
4548}
4549
4550impl wkt::message::Message for SecretVolume {
4551    fn typename() -> &'static str {
4552        "type.googleapis.com/google.cloud.functions.v2.SecretVolume"
4553    }
4554}
4555
4556#[doc(hidden)]
4557impl<'de> serde::de::Deserialize<'de> for SecretVolume {
4558    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4559    where
4560        D: serde::Deserializer<'de>,
4561    {
4562        #[allow(non_camel_case_types)]
4563        #[doc(hidden)]
4564        #[derive(PartialEq, Eq, Hash)]
4565        enum __FieldTag {
4566            __mount_path,
4567            __project_id,
4568            __secret,
4569            __versions,
4570            Unknown(std::string::String),
4571        }
4572        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4573            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4574            where
4575                D: serde::Deserializer<'de>,
4576            {
4577                struct Visitor;
4578                impl<'de> serde::de::Visitor<'de> for Visitor {
4579                    type Value = __FieldTag;
4580                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4581                        formatter.write_str("a field name for SecretVolume")
4582                    }
4583                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4584                    where
4585                        E: serde::de::Error,
4586                    {
4587                        use std::result::Result::Ok;
4588                        use std::string::ToString;
4589                        match value {
4590                            "mountPath" => Ok(__FieldTag::__mount_path),
4591                            "mount_path" => Ok(__FieldTag::__mount_path),
4592                            "projectId" => Ok(__FieldTag::__project_id),
4593                            "project_id" => Ok(__FieldTag::__project_id),
4594                            "secret" => Ok(__FieldTag::__secret),
4595                            "versions" => Ok(__FieldTag::__versions),
4596                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4597                        }
4598                    }
4599                }
4600                deserializer.deserialize_identifier(Visitor)
4601            }
4602        }
4603        struct Visitor;
4604        impl<'de> serde::de::Visitor<'de> for Visitor {
4605            type Value = SecretVolume;
4606            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4607                formatter.write_str("struct SecretVolume")
4608            }
4609            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4610            where
4611                A: serde::de::MapAccess<'de>,
4612            {
4613                #[allow(unused_imports)]
4614                use serde::de::Error;
4615                use std::option::Option::Some;
4616                let mut fields = std::collections::HashSet::new();
4617                let mut result = Self::Value::new();
4618                while let Some(tag) = map.next_key::<__FieldTag>()? {
4619                    #[allow(clippy::match_single_binding)]
4620                    match tag {
4621                        __FieldTag::__mount_path => {
4622                            if !fields.insert(__FieldTag::__mount_path) {
4623                                return std::result::Result::Err(A::Error::duplicate_field(
4624                                    "multiple values for mount_path",
4625                                ));
4626                            }
4627                            result.mount_path = map
4628                                .next_value::<std::option::Option<std::string::String>>()?
4629                                .unwrap_or_default();
4630                        }
4631                        __FieldTag::__project_id => {
4632                            if !fields.insert(__FieldTag::__project_id) {
4633                                return std::result::Result::Err(A::Error::duplicate_field(
4634                                    "multiple values for project_id",
4635                                ));
4636                            }
4637                            result.project_id = map
4638                                .next_value::<std::option::Option<std::string::String>>()?
4639                                .unwrap_or_default();
4640                        }
4641                        __FieldTag::__secret => {
4642                            if !fields.insert(__FieldTag::__secret) {
4643                                return std::result::Result::Err(A::Error::duplicate_field(
4644                                    "multiple values for secret",
4645                                ));
4646                            }
4647                            result.secret = map
4648                                .next_value::<std::option::Option<std::string::String>>()?
4649                                .unwrap_or_default();
4650                        }
4651                        __FieldTag::__versions => {
4652                            if !fields.insert(__FieldTag::__versions) {
4653                                return std::result::Result::Err(A::Error::duplicate_field(
4654                                    "multiple values for versions",
4655                                ));
4656                            }
4657                            result.versions = map
4658                                .next_value::<std::option::Option<
4659                                    std::vec::Vec<crate::model::secret_volume::SecretVersion>,
4660                                >>()?
4661                                .unwrap_or_default();
4662                        }
4663                        __FieldTag::Unknown(key) => {
4664                            let value = map.next_value::<serde_json::Value>()?;
4665                            result._unknown_fields.insert(key, value);
4666                        }
4667                    }
4668                }
4669                std::result::Result::Ok(result)
4670            }
4671        }
4672        deserializer.deserialize_any(Visitor)
4673    }
4674}
4675
4676#[doc(hidden)]
4677impl serde::ser::Serialize for SecretVolume {
4678    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4679    where
4680        S: serde::ser::Serializer,
4681    {
4682        use serde::ser::SerializeMap;
4683        #[allow(unused_imports)]
4684        use std::option::Option::Some;
4685        let mut state = serializer.serialize_map(std::option::Option::None)?;
4686        if !self.mount_path.is_empty() {
4687            state.serialize_entry("mountPath", &self.mount_path)?;
4688        }
4689        if !self.project_id.is_empty() {
4690            state.serialize_entry("projectId", &self.project_id)?;
4691        }
4692        if !self.secret.is_empty() {
4693            state.serialize_entry("secret", &self.secret)?;
4694        }
4695        if !self.versions.is_empty() {
4696            state.serialize_entry("versions", &self.versions)?;
4697        }
4698        if !self._unknown_fields.is_empty() {
4699            for (key, value) in self._unknown_fields.iter() {
4700                state.serialize_entry(key, &value)?;
4701            }
4702        }
4703        state.end()
4704    }
4705}
4706
4707impl std::fmt::Debug for SecretVolume {
4708    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4709        let mut debug_struct = f.debug_struct("SecretVolume");
4710        debug_struct.field("mount_path", &self.mount_path);
4711        debug_struct.field("project_id", &self.project_id);
4712        debug_struct.field("secret", &self.secret);
4713        debug_struct.field("versions", &self.versions);
4714        if !self._unknown_fields.is_empty() {
4715            debug_struct.field("_unknown_fields", &self._unknown_fields);
4716        }
4717        debug_struct.finish()
4718    }
4719}
4720
4721/// Defines additional types related to [SecretVolume].
4722pub mod secret_volume {
4723    #[allow(unused_imports)]
4724    use super::*;
4725
4726    /// Configuration for a single version.
4727    #[derive(Clone, Default, PartialEq)]
4728    #[non_exhaustive]
4729    pub struct SecretVersion {
4730        /// Version of the secret (version number or the string 'latest'). It is
4731        /// preferable to use `latest` version with secret volumes as secret value
4732        /// changes are reflected immediately.
4733        pub version: std::string::String,
4734
4735        /// Relative path of the file under the mount path where the secret value for
4736        /// this version will be fetched and made available. For example, setting the
4737        /// mount_path as '/etc/secrets' and path as `secret_foo` would mount the
4738        /// secret value file at `/etc/secrets/secret_foo`.
4739        pub path: std::string::String,
4740
4741        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4742    }
4743
4744    impl SecretVersion {
4745        pub fn new() -> Self {
4746            std::default::Default::default()
4747        }
4748
4749        /// Sets the value of [version][crate::model::secret_volume::SecretVersion::version].
4750        pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4751            self.version = v.into();
4752            self
4753        }
4754
4755        /// Sets the value of [path][crate::model::secret_volume::SecretVersion::path].
4756        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4757            self.path = v.into();
4758            self
4759        }
4760    }
4761
4762    impl wkt::message::Message for SecretVersion {
4763        fn typename() -> &'static str {
4764            "type.googleapis.com/google.cloud.functions.v2.SecretVolume.SecretVersion"
4765        }
4766    }
4767
4768    #[doc(hidden)]
4769    impl<'de> serde::de::Deserialize<'de> for SecretVersion {
4770        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4771        where
4772            D: serde::Deserializer<'de>,
4773        {
4774            #[allow(non_camel_case_types)]
4775            #[doc(hidden)]
4776            #[derive(PartialEq, Eq, Hash)]
4777            enum __FieldTag {
4778                __version,
4779                __path,
4780                Unknown(std::string::String),
4781            }
4782            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4783                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4784                where
4785                    D: serde::Deserializer<'de>,
4786                {
4787                    struct Visitor;
4788                    impl<'de> serde::de::Visitor<'de> for Visitor {
4789                        type Value = __FieldTag;
4790                        fn expecting(
4791                            &self,
4792                            formatter: &mut std::fmt::Formatter,
4793                        ) -> std::fmt::Result {
4794                            formatter.write_str("a field name for SecretVersion")
4795                        }
4796                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4797                        where
4798                            E: serde::de::Error,
4799                        {
4800                            use std::result::Result::Ok;
4801                            use std::string::ToString;
4802                            match value {
4803                                "version" => Ok(__FieldTag::__version),
4804                                "path" => Ok(__FieldTag::__path),
4805                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4806                            }
4807                        }
4808                    }
4809                    deserializer.deserialize_identifier(Visitor)
4810                }
4811            }
4812            struct Visitor;
4813            impl<'de> serde::de::Visitor<'de> for Visitor {
4814                type Value = SecretVersion;
4815                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4816                    formatter.write_str("struct SecretVersion")
4817                }
4818                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4819                where
4820                    A: serde::de::MapAccess<'de>,
4821                {
4822                    #[allow(unused_imports)]
4823                    use serde::de::Error;
4824                    use std::option::Option::Some;
4825                    let mut fields = std::collections::HashSet::new();
4826                    let mut result = Self::Value::new();
4827                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4828                        #[allow(clippy::match_single_binding)]
4829                        match tag {
4830                            __FieldTag::__version => {
4831                                if !fields.insert(__FieldTag::__version) {
4832                                    return std::result::Result::Err(A::Error::duplicate_field(
4833                                        "multiple values for version",
4834                                    ));
4835                                }
4836                                result.version = map
4837                                    .next_value::<std::option::Option<std::string::String>>()?
4838                                    .unwrap_or_default();
4839                            }
4840                            __FieldTag::__path => {
4841                                if !fields.insert(__FieldTag::__path) {
4842                                    return std::result::Result::Err(A::Error::duplicate_field(
4843                                        "multiple values for path",
4844                                    ));
4845                                }
4846                                result.path = map
4847                                    .next_value::<std::option::Option<std::string::String>>()?
4848                                    .unwrap_or_default();
4849                            }
4850                            __FieldTag::Unknown(key) => {
4851                                let value = map.next_value::<serde_json::Value>()?;
4852                                result._unknown_fields.insert(key, value);
4853                            }
4854                        }
4855                    }
4856                    std::result::Result::Ok(result)
4857                }
4858            }
4859            deserializer.deserialize_any(Visitor)
4860        }
4861    }
4862
4863    #[doc(hidden)]
4864    impl serde::ser::Serialize for SecretVersion {
4865        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4866        where
4867            S: serde::ser::Serializer,
4868        {
4869            use serde::ser::SerializeMap;
4870            #[allow(unused_imports)]
4871            use std::option::Option::Some;
4872            let mut state = serializer.serialize_map(std::option::Option::None)?;
4873            if !self.version.is_empty() {
4874                state.serialize_entry("version", &self.version)?;
4875            }
4876            if !self.path.is_empty() {
4877                state.serialize_entry("path", &self.path)?;
4878            }
4879            if !self._unknown_fields.is_empty() {
4880                for (key, value) in self._unknown_fields.iter() {
4881                    state.serialize_entry(key, &value)?;
4882                }
4883            }
4884            state.end()
4885        }
4886    }
4887
4888    impl std::fmt::Debug for SecretVersion {
4889        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4890            let mut debug_struct = f.debug_struct("SecretVersion");
4891            debug_struct.field("version", &self.version);
4892            debug_struct.field("path", &self.path);
4893            if !self._unknown_fields.is_empty() {
4894                debug_struct.field("_unknown_fields", &self._unknown_fields);
4895            }
4896            debug_struct.finish()
4897        }
4898    }
4899}
4900
4901/// Describes EventTrigger, used to request events to be sent from another
4902/// service.
4903#[derive(Clone, Default, PartialEq)]
4904#[non_exhaustive]
4905pub struct EventTrigger {
4906    /// Output only. The resource name of the Eventarc trigger. The format of this
4907    /// field is `projects/{project}/locations/{region}/triggers/{trigger}`.
4908    pub trigger: std::string::String,
4909
4910    /// The region that the trigger will be in. The trigger will only receive
4911    /// events originating in this region. It can be the same
4912    /// region as the function, a different region or multi-region, or the global
4913    /// region. If not provided, defaults to the same region as the function.
4914    pub trigger_region: std::string::String,
4915
4916    /// Required. The type of event to observe. For example:
4917    /// `google.cloud.audit.log.v1.written` or
4918    /// `google.cloud.pubsub.topic.v1.messagePublished`.
4919    pub event_type: std::string::String,
4920
4921    /// Criteria used to filter events.
4922    pub event_filters: std::vec::Vec<crate::model::EventFilter>,
4923
4924    /// Optional. The name of a Pub/Sub topic in the same project that will be used
4925    /// as the transport topic for the event delivery. Format:
4926    /// `projects/{project}/topics/{topic}`.
4927    ///
4928    /// This is only valid for events of type
4929    /// `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
4930    /// will not be deleted at function deletion.
4931    pub pubsub_topic: std::string::String,
4932
4933    /// Optional. The email of the trigger's service account. The service account
4934    /// must have permission to invoke Cloud Run services, the permission is
4935    /// `run.routes.invoke`.
4936    /// If empty, defaults to the Compute Engine default service account:
4937    /// `{project_number}-compute@developer.gserviceaccount.com`.
4938    pub service_account_email: std::string::String,
4939
4940    /// Optional. If unset, then defaults to ignoring failures (i.e. not retrying
4941    /// them).
4942    pub retry_policy: crate::model::event_trigger::RetryPolicy,
4943
4944    /// Optional. The name of the channel associated with the trigger in
4945    /// `projects/{project}/locations/{location}/channels/{channel}` format.
4946    /// You must provide a channel to receive events from Eventarc SaaS partners.
4947    pub channel: std::string::String,
4948
4949    /// Optional. The hostname of the service that 1st Gen function should be
4950    /// observed.
4951    ///
4952    /// If no string is provided, the default service implementing the API will
4953    /// be used. For example, `storage.googleapis.com` is the default for all
4954    /// event types in the `google.storage` namespace.
4955    ///
4956    /// The field is only applicable to 1st Gen functions.
4957    pub service: std::string::String,
4958
4959    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4960}
4961
4962impl EventTrigger {
4963    pub fn new() -> Self {
4964        std::default::Default::default()
4965    }
4966
4967    /// Sets the value of [trigger][crate::model::EventTrigger::trigger].
4968    pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4969        self.trigger = v.into();
4970        self
4971    }
4972
4973    /// Sets the value of [trigger_region][crate::model::EventTrigger::trigger_region].
4974    pub fn set_trigger_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4975        self.trigger_region = v.into();
4976        self
4977    }
4978
4979    /// Sets the value of [event_type][crate::model::EventTrigger::event_type].
4980    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4981        self.event_type = v.into();
4982        self
4983    }
4984
4985    /// Sets the value of [event_filters][crate::model::EventTrigger::event_filters].
4986    pub fn set_event_filters<T, V>(mut self, v: T) -> Self
4987    where
4988        T: std::iter::IntoIterator<Item = V>,
4989        V: std::convert::Into<crate::model::EventFilter>,
4990    {
4991        use std::iter::Iterator;
4992        self.event_filters = v.into_iter().map(|i| i.into()).collect();
4993        self
4994    }
4995
4996    /// Sets the value of [pubsub_topic][crate::model::EventTrigger::pubsub_topic].
4997    pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4998        self.pubsub_topic = v.into();
4999        self
5000    }
5001
5002    /// Sets the value of [service_account_email][crate::model::EventTrigger::service_account_email].
5003    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
5004        mut self,
5005        v: T,
5006    ) -> Self {
5007        self.service_account_email = v.into();
5008        self
5009    }
5010
5011    /// Sets the value of [retry_policy][crate::model::EventTrigger::retry_policy].
5012    pub fn set_retry_policy<T: std::convert::Into<crate::model::event_trigger::RetryPolicy>>(
5013        mut self,
5014        v: T,
5015    ) -> Self {
5016        self.retry_policy = v.into();
5017        self
5018    }
5019
5020    /// Sets the value of [channel][crate::model::EventTrigger::channel].
5021    pub fn set_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5022        self.channel = v.into();
5023        self
5024    }
5025
5026    /// Sets the value of [service][crate::model::EventTrigger::service].
5027    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5028        self.service = v.into();
5029        self
5030    }
5031}
5032
5033impl wkt::message::Message for EventTrigger {
5034    fn typename() -> &'static str {
5035        "type.googleapis.com/google.cloud.functions.v2.EventTrigger"
5036    }
5037}
5038
5039#[doc(hidden)]
5040impl<'de> serde::de::Deserialize<'de> for EventTrigger {
5041    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5042    where
5043        D: serde::Deserializer<'de>,
5044    {
5045        #[allow(non_camel_case_types)]
5046        #[doc(hidden)]
5047        #[derive(PartialEq, Eq, Hash)]
5048        enum __FieldTag {
5049            __trigger,
5050            __trigger_region,
5051            __event_type,
5052            __event_filters,
5053            __pubsub_topic,
5054            __service_account_email,
5055            __retry_policy,
5056            __channel,
5057            __service,
5058            Unknown(std::string::String),
5059        }
5060        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5061            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5062            where
5063                D: serde::Deserializer<'de>,
5064            {
5065                struct Visitor;
5066                impl<'de> serde::de::Visitor<'de> for Visitor {
5067                    type Value = __FieldTag;
5068                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5069                        formatter.write_str("a field name for EventTrigger")
5070                    }
5071                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5072                    where
5073                        E: serde::de::Error,
5074                    {
5075                        use std::result::Result::Ok;
5076                        use std::string::ToString;
5077                        match value {
5078                            "trigger" => Ok(__FieldTag::__trigger),
5079                            "triggerRegion" => Ok(__FieldTag::__trigger_region),
5080                            "trigger_region" => Ok(__FieldTag::__trigger_region),
5081                            "eventType" => Ok(__FieldTag::__event_type),
5082                            "event_type" => Ok(__FieldTag::__event_type),
5083                            "eventFilters" => Ok(__FieldTag::__event_filters),
5084                            "event_filters" => Ok(__FieldTag::__event_filters),
5085                            "pubsubTopic" => Ok(__FieldTag::__pubsub_topic),
5086                            "pubsub_topic" => Ok(__FieldTag::__pubsub_topic),
5087                            "serviceAccountEmail" => Ok(__FieldTag::__service_account_email),
5088                            "service_account_email" => Ok(__FieldTag::__service_account_email),
5089                            "retryPolicy" => Ok(__FieldTag::__retry_policy),
5090                            "retry_policy" => Ok(__FieldTag::__retry_policy),
5091                            "channel" => Ok(__FieldTag::__channel),
5092                            "service" => Ok(__FieldTag::__service),
5093                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5094                        }
5095                    }
5096                }
5097                deserializer.deserialize_identifier(Visitor)
5098            }
5099        }
5100        struct Visitor;
5101        impl<'de> serde::de::Visitor<'de> for Visitor {
5102            type Value = EventTrigger;
5103            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5104                formatter.write_str("struct EventTrigger")
5105            }
5106            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5107            where
5108                A: serde::de::MapAccess<'de>,
5109            {
5110                #[allow(unused_imports)]
5111                use serde::de::Error;
5112                use std::option::Option::Some;
5113                let mut fields = std::collections::HashSet::new();
5114                let mut result = Self::Value::new();
5115                while let Some(tag) = map.next_key::<__FieldTag>()? {
5116                    #[allow(clippy::match_single_binding)]
5117                    match tag {
5118                        __FieldTag::__trigger => {
5119                            if !fields.insert(__FieldTag::__trigger) {
5120                                return std::result::Result::Err(A::Error::duplicate_field(
5121                                    "multiple values for trigger",
5122                                ));
5123                            }
5124                            result.trigger = map
5125                                .next_value::<std::option::Option<std::string::String>>()?
5126                                .unwrap_or_default();
5127                        }
5128                        __FieldTag::__trigger_region => {
5129                            if !fields.insert(__FieldTag::__trigger_region) {
5130                                return std::result::Result::Err(A::Error::duplicate_field(
5131                                    "multiple values for trigger_region",
5132                                ));
5133                            }
5134                            result.trigger_region = map
5135                                .next_value::<std::option::Option<std::string::String>>()?
5136                                .unwrap_or_default();
5137                        }
5138                        __FieldTag::__event_type => {
5139                            if !fields.insert(__FieldTag::__event_type) {
5140                                return std::result::Result::Err(A::Error::duplicate_field(
5141                                    "multiple values for event_type",
5142                                ));
5143                            }
5144                            result.event_type = map
5145                                .next_value::<std::option::Option<std::string::String>>()?
5146                                .unwrap_or_default();
5147                        }
5148                        __FieldTag::__event_filters => {
5149                            if !fields.insert(__FieldTag::__event_filters) {
5150                                return std::result::Result::Err(A::Error::duplicate_field(
5151                                    "multiple values for event_filters",
5152                                ));
5153                            }
5154                            result.event_filters = map.next_value::<std::option::Option<std::vec::Vec<crate::model::EventFilter>>>()?.unwrap_or_default();
5155                        }
5156                        __FieldTag::__pubsub_topic => {
5157                            if !fields.insert(__FieldTag::__pubsub_topic) {
5158                                return std::result::Result::Err(A::Error::duplicate_field(
5159                                    "multiple values for pubsub_topic",
5160                                ));
5161                            }
5162                            result.pubsub_topic = map
5163                                .next_value::<std::option::Option<std::string::String>>()?
5164                                .unwrap_or_default();
5165                        }
5166                        __FieldTag::__service_account_email => {
5167                            if !fields.insert(__FieldTag::__service_account_email) {
5168                                return std::result::Result::Err(A::Error::duplicate_field(
5169                                    "multiple values for service_account_email",
5170                                ));
5171                            }
5172                            result.service_account_email = map
5173                                .next_value::<std::option::Option<std::string::String>>()?
5174                                .unwrap_or_default();
5175                        }
5176                        __FieldTag::__retry_policy => {
5177                            if !fields.insert(__FieldTag::__retry_policy) {
5178                                return std::result::Result::Err(A::Error::duplicate_field(
5179                                    "multiple values for retry_policy",
5180                                ));
5181                            }
5182                            result.retry_policy = map.next_value::<std::option::Option<crate::model::event_trigger::RetryPolicy>>()?.unwrap_or_default();
5183                        }
5184                        __FieldTag::__channel => {
5185                            if !fields.insert(__FieldTag::__channel) {
5186                                return std::result::Result::Err(A::Error::duplicate_field(
5187                                    "multiple values for channel",
5188                                ));
5189                            }
5190                            result.channel = map
5191                                .next_value::<std::option::Option<std::string::String>>()?
5192                                .unwrap_or_default();
5193                        }
5194                        __FieldTag::__service => {
5195                            if !fields.insert(__FieldTag::__service) {
5196                                return std::result::Result::Err(A::Error::duplicate_field(
5197                                    "multiple values for service",
5198                                ));
5199                            }
5200                            result.service = map
5201                                .next_value::<std::option::Option<std::string::String>>()?
5202                                .unwrap_or_default();
5203                        }
5204                        __FieldTag::Unknown(key) => {
5205                            let value = map.next_value::<serde_json::Value>()?;
5206                            result._unknown_fields.insert(key, value);
5207                        }
5208                    }
5209                }
5210                std::result::Result::Ok(result)
5211            }
5212        }
5213        deserializer.deserialize_any(Visitor)
5214    }
5215}
5216
5217#[doc(hidden)]
5218impl serde::ser::Serialize for EventTrigger {
5219    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5220    where
5221        S: serde::ser::Serializer,
5222    {
5223        use serde::ser::SerializeMap;
5224        #[allow(unused_imports)]
5225        use std::option::Option::Some;
5226        let mut state = serializer.serialize_map(std::option::Option::None)?;
5227        if !self.trigger.is_empty() {
5228            state.serialize_entry("trigger", &self.trigger)?;
5229        }
5230        if !self.trigger_region.is_empty() {
5231            state.serialize_entry("triggerRegion", &self.trigger_region)?;
5232        }
5233        if !self.event_type.is_empty() {
5234            state.serialize_entry("eventType", &self.event_type)?;
5235        }
5236        if !self.event_filters.is_empty() {
5237            state.serialize_entry("eventFilters", &self.event_filters)?;
5238        }
5239        if !self.pubsub_topic.is_empty() {
5240            state.serialize_entry("pubsubTopic", &self.pubsub_topic)?;
5241        }
5242        if !self.service_account_email.is_empty() {
5243            state.serialize_entry("serviceAccountEmail", &self.service_account_email)?;
5244        }
5245        if !wkt::internal::is_default(&self.retry_policy) {
5246            state.serialize_entry("retryPolicy", &self.retry_policy)?;
5247        }
5248        if !self.channel.is_empty() {
5249            state.serialize_entry("channel", &self.channel)?;
5250        }
5251        if !self.service.is_empty() {
5252            state.serialize_entry("service", &self.service)?;
5253        }
5254        if !self._unknown_fields.is_empty() {
5255            for (key, value) in self._unknown_fields.iter() {
5256                state.serialize_entry(key, &value)?;
5257            }
5258        }
5259        state.end()
5260    }
5261}
5262
5263impl std::fmt::Debug for EventTrigger {
5264    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5265        let mut debug_struct = f.debug_struct("EventTrigger");
5266        debug_struct.field("trigger", &self.trigger);
5267        debug_struct.field("trigger_region", &self.trigger_region);
5268        debug_struct.field("event_type", &self.event_type);
5269        debug_struct.field("event_filters", &self.event_filters);
5270        debug_struct.field("pubsub_topic", &self.pubsub_topic);
5271        debug_struct.field("service_account_email", &self.service_account_email);
5272        debug_struct.field("retry_policy", &self.retry_policy);
5273        debug_struct.field("channel", &self.channel);
5274        debug_struct.field("service", &self.service);
5275        if !self._unknown_fields.is_empty() {
5276            debug_struct.field("_unknown_fields", &self._unknown_fields);
5277        }
5278        debug_struct.finish()
5279    }
5280}
5281
5282/// Defines additional types related to [EventTrigger].
5283pub mod event_trigger {
5284    #[allow(unused_imports)]
5285    use super::*;
5286
5287    /// Describes the retry policy in case of function's execution failure.
5288    /// Retried execution is charged as any other execution.
5289    ///
5290    /// # Working with unknown values
5291    ///
5292    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5293    /// additional enum variants at any time. Adding new variants is not considered
5294    /// a breaking change. Applications should write their code in anticipation of:
5295    ///
5296    /// - New values appearing in future releases of the client library, **and**
5297    /// - New values received dynamically, without application changes.
5298    ///
5299    /// Please consult the [Working with enums] section in the user guide for some
5300    /// guidelines.
5301    ///
5302    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5303    #[derive(Clone, Debug, PartialEq)]
5304    #[non_exhaustive]
5305    pub enum RetryPolicy {
5306        /// Not specified.
5307        Unspecified,
5308        /// Do not retry.
5309        DoNotRetry,
5310        /// Retry on any failure, retry up to 7 days with an exponential backoff
5311        /// (capped at 10 seconds).
5312        Retry,
5313        /// If set, the enum was initialized with an unknown value.
5314        ///
5315        /// Applications can examine the value using [RetryPolicy::value] or
5316        /// [RetryPolicy::name].
5317        UnknownValue(retry_policy::UnknownValue),
5318    }
5319
5320    #[doc(hidden)]
5321    pub mod retry_policy {
5322        #[allow(unused_imports)]
5323        use super::*;
5324        #[derive(Clone, Debug, PartialEq)]
5325        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5326    }
5327
5328    impl RetryPolicy {
5329        /// Gets the enum value.
5330        ///
5331        /// Returns `None` if the enum contains an unknown value deserialized from
5332        /// the string representation of enums.
5333        pub fn value(&self) -> std::option::Option<i32> {
5334            match self {
5335                Self::Unspecified => std::option::Option::Some(0),
5336                Self::DoNotRetry => std::option::Option::Some(1),
5337                Self::Retry => std::option::Option::Some(2),
5338                Self::UnknownValue(u) => u.0.value(),
5339            }
5340        }
5341
5342        /// Gets the enum value as a string.
5343        ///
5344        /// Returns `None` if the enum contains an unknown value deserialized from
5345        /// the integer representation of enums.
5346        pub fn name(&self) -> std::option::Option<&str> {
5347            match self {
5348                Self::Unspecified => std::option::Option::Some("RETRY_POLICY_UNSPECIFIED"),
5349                Self::DoNotRetry => std::option::Option::Some("RETRY_POLICY_DO_NOT_RETRY"),
5350                Self::Retry => std::option::Option::Some("RETRY_POLICY_RETRY"),
5351                Self::UnknownValue(u) => u.0.name(),
5352            }
5353        }
5354    }
5355
5356    impl std::default::Default for RetryPolicy {
5357        fn default() -> Self {
5358            use std::convert::From;
5359            Self::from(0)
5360        }
5361    }
5362
5363    impl std::fmt::Display for RetryPolicy {
5364        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5365            wkt::internal::display_enum(f, self.name(), self.value())
5366        }
5367    }
5368
5369    impl std::convert::From<i32> for RetryPolicy {
5370        fn from(value: i32) -> Self {
5371            match value {
5372                0 => Self::Unspecified,
5373                1 => Self::DoNotRetry,
5374                2 => Self::Retry,
5375                _ => Self::UnknownValue(retry_policy::UnknownValue(
5376                    wkt::internal::UnknownEnumValue::Integer(value),
5377                )),
5378            }
5379        }
5380    }
5381
5382    impl std::convert::From<&str> for RetryPolicy {
5383        fn from(value: &str) -> Self {
5384            use std::string::ToString;
5385            match value {
5386                "RETRY_POLICY_UNSPECIFIED" => Self::Unspecified,
5387                "RETRY_POLICY_DO_NOT_RETRY" => Self::DoNotRetry,
5388                "RETRY_POLICY_RETRY" => Self::Retry,
5389                _ => Self::UnknownValue(retry_policy::UnknownValue(
5390                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5391                )),
5392            }
5393        }
5394    }
5395
5396    impl serde::ser::Serialize for RetryPolicy {
5397        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5398        where
5399            S: serde::Serializer,
5400        {
5401            match self {
5402                Self::Unspecified => serializer.serialize_i32(0),
5403                Self::DoNotRetry => serializer.serialize_i32(1),
5404                Self::Retry => serializer.serialize_i32(2),
5405                Self::UnknownValue(u) => u.0.serialize(serializer),
5406            }
5407        }
5408    }
5409
5410    impl<'de> serde::de::Deserialize<'de> for RetryPolicy {
5411        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5412        where
5413            D: serde::Deserializer<'de>,
5414        {
5415            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetryPolicy>::new(
5416                ".google.cloud.functions.v2.EventTrigger.RetryPolicy",
5417            ))
5418        }
5419    }
5420}
5421
5422/// Filters events based on exact matches on the CloudEvents attributes.
5423#[derive(Clone, Default, PartialEq)]
5424#[non_exhaustive]
5425pub struct EventFilter {
5426    /// Required. The name of a CloudEvents attribute.
5427    pub attribute: std::string::String,
5428
5429    /// Required. The value for the attribute.
5430    pub value: std::string::String,
5431
5432    /// Optional. The operator used for matching the events with the value of the
5433    /// filter. If not specified, only events that have an exact key-value pair
5434    /// specified in the filter are matched. The only allowed value is
5435    /// `match-path-pattern`.
5436    pub operator: std::string::String,
5437
5438    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5439}
5440
5441impl EventFilter {
5442    pub fn new() -> Self {
5443        std::default::Default::default()
5444    }
5445
5446    /// Sets the value of [attribute][crate::model::EventFilter::attribute].
5447    pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5448        self.attribute = v.into();
5449        self
5450    }
5451
5452    /// Sets the value of [value][crate::model::EventFilter::value].
5453    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5454        self.value = v.into();
5455        self
5456    }
5457
5458    /// Sets the value of [operator][crate::model::EventFilter::operator].
5459    pub fn set_operator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5460        self.operator = v.into();
5461        self
5462    }
5463}
5464
5465impl wkt::message::Message for EventFilter {
5466    fn typename() -> &'static str {
5467        "type.googleapis.com/google.cloud.functions.v2.EventFilter"
5468    }
5469}
5470
5471#[doc(hidden)]
5472impl<'de> serde::de::Deserialize<'de> for EventFilter {
5473    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5474    where
5475        D: serde::Deserializer<'de>,
5476    {
5477        #[allow(non_camel_case_types)]
5478        #[doc(hidden)]
5479        #[derive(PartialEq, Eq, Hash)]
5480        enum __FieldTag {
5481            __attribute,
5482            __value,
5483            __operator,
5484            Unknown(std::string::String),
5485        }
5486        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5487            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5488            where
5489                D: serde::Deserializer<'de>,
5490            {
5491                struct Visitor;
5492                impl<'de> serde::de::Visitor<'de> for Visitor {
5493                    type Value = __FieldTag;
5494                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5495                        formatter.write_str("a field name for EventFilter")
5496                    }
5497                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5498                    where
5499                        E: serde::de::Error,
5500                    {
5501                        use std::result::Result::Ok;
5502                        use std::string::ToString;
5503                        match value {
5504                            "attribute" => Ok(__FieldTag::__attribute),
5505                            "value" => Ok(__FieldTag::__value),
5506                            "operator" => Ok(__FieldTag::__operator),
5507                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5508                        }
5509                    }
5510                }
5511                deserializer.deserialize_identifier(Visitor)
5512            }
5513        }
5514        struct Visitor;
5515        impl<'de> serde::de::Visitor<'de> for Visitor {
5516            type Value = EventFilter;
5517            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5518                formatter.write_str("struct EventFilter")
5519            }
5520            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5521            where
5522                A: serde::de::MapAccess<'de>,
5523            {
5524                #[allow(unused_imports)]
5525                use serde::de::Error;
5526                use std::option::Option::Some;
5527                let mut fields = std::collections::HashSet::new();
5528                let mut result = Self::Value::new();
5529                while let Some(tag) = map.next_key::<__FieldTag>()? {
5530                    #[allow(clippy::match_single_binding)]
5531                    match tag {
5532                        __FieldTag::__attribute => {
5533                            if !fields.insert(__FieldTag::__attribute) {
5534                                return std::result::Result::Err(A::Error::duplicate_field(
5535                                    "multiple values for attribute",
5536                                ));
5537                            }
5538                            result.attribute = map
5539                                .next_value::<std::option::Option<std::string::String>>()?
5540                                .unwrap_or_default();
5541                        }
5542                        __FieldTag::__value => {
5543                            if !fields.insert(__FieldTag::__value) {
5544                                return std::result::Result::Err(A::Error::duplicate_field(
5545                                    "multiple values for value",
5546                                ));
5547                            }
5548                            result.value = map
5549                                .next_value::<std::option::Option<std::string::String>>()?
5550                                .unwrap_or_default();
5551                        }
5552                        __FieldTag::__operator => {
5553                            if !fields.insert(__FieldTag::__operator) {
5554                                return std::result::Result::Err(A::Error::duplicate_field(
5555                                    "multiple values for operator",
5556                                ));
5557                            }
5558                            result.operator = map
5559                                .next_value::<std::option::Option<std::string::String>>()?
5560                                .unwrap_or_default();
5561                        }
5562                        __FieldTag::Unknown(key) => {
5563                            let value = map.next_value::<serde_json::Value>()?;
5564                            result._unknown_fields.insert(key, value);
5565                        }
5566                    }
5567                }
5568                std::result::Result::Ok(result)
5569            }
5570        }
5571        deserializer.deserialize_any(Visitor)
5572    }
5573}
5574
5575#[doc(hidden)]
5576impl serde::ser::Serialize for EventFilter {
5577    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5578    where
5579        S: serde::ser::Serializer,
5580    {
5581        use serde::ser::SerializeMap;
5582        #[allow(unused_imports)]
5583        use std::option::Option::Some;
5584        let mut state = serializer.serialize_map(std::option::Option::None)?;
5585        if !self.attribute.is_empty() {
5586            state.serialize_entry("attribute", &self.attribute)?;
5587        }
5588        if !self.value.is_empty() {
5589            state.serialize_entry("value", &self.value)?;
5590        }
5591        if !self.operator.is_empty() {
5592            state.serialize_entry("operator", &self.operator)?;
5593        }
5594        if !self._unknown_fields.is_empty() {
5595            for (key, value) in self._unknown_fields.iter() {
5596                state.serialize_entry(key, &value)?;
5597            }
5598        }
5599        state.end()
5600    }
5601}
5602
5603impl std::fmt::Debug for EventFilter {
5604    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5605        let mut debug_struct = f.debug_struct("EventFilter");
5606        debug_struct.field("attribute", &self.attribute);
5607        debug_struct.field("value", &self.value);
5608        debug_struct.field("operator", &self.operator);
5609        if !self._unknown_fields.is_empty() {
5610            debug_struct.field("_unknown_fields", &self._unknown_fields);
5611        }
5612        debug_struct.finish()
5613    }
5614}
5615
5616/// Request for the `GetFunction` method.
5617#[derive(Clone, Default, PartialEq)]
5618#[non_exhaustive]
5619pub struct GetFunctionRequest {
5620    /// Required. The name of the function which details should be obtained.
5621    pub name: std::string::String,
5622
5623    /// Optional. The optional version of the 1st gen function whose details should
5624    /// be obtained. The version of a 1st gen function is an integer that starts
5625    /// from 1 and gets incremented on redeployments. GCF may keep historical
5626    /// configs for old versions of 1st gen function. This field can be specified
5627    /// to fetch the historical configs. This field is valid only for GCF 1st gen
5628    /// function.
5629    pub revision: std::string::String,
5630
5631    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5632}
5633
5634impl GetFunctionRequest {
5635    pub fn new() -> Self {
5636        std::default::Default::default()
5637    }
5638
5639    /// Sets the value of [name][crate::model::GetFunctionRequest::name].
5640    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5641        self.name = v.into();
5642        self
5643    }
5644
5645    /// Sets the value of [revision][crate::model::GetFunctionRequest::revision].
5646    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5647        self.revision = v.into();
5648        self
5649    }
5650}
5651
5652impl wkt::message::Message for GetFunctionRequest {
5653    fn typename() -> &'static str {
5654        "type.googleapis.com/google.cloud.functions.v2.GetFunctionRequest"
5655    }
5656}
5657
5658#[doc(hidden)]
5659impl<'de> serde::de::Deserialize<'de> for GetFunctionRequest {
5660    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5661    where
5662        D: serde::Deserializer<'de>,
5663    {
5664        #[allow(non_camel_case_types)]
5665        #[doc(hidden)]
5666        #[derive(PartialEq, Eq, Hash)]
5667        enum __FieldTag {
5668            __name,
5669            __revision,
5670            Unknown(std::string::String),
5671        }
5672        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5673            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5674            where
5675                D: serde::Deserializer<'de>,
5676            {
5677                struct Visitor;
5678                impl<'de> serde::de::Visitor<'de> for Visitor {
5679                    type Value = __FieldTag;
5680                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5681                        formatter.write_str("a field name for GetFunctionRequest")
5682                    }
5683                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5684                    where
5685                        E: serde::de::Error,
5686                    {
5687                        use std::result::Result::Ok;
5688                        use std::string::ToString;
5689                        match value {
5690                            "name" => Ok(__FieldTag::__name),
5691                            "revision" => Ok(__FieldTag::__revision),
5692                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5693                        }
5694                    }
5695                }
5696                deserializer.deserialize_identifier(Visitor)
5697            }
5698        }
5699        struct Visitor;
5700        impl<'de> serde::de::Visitor<'de> for Visitor {
5701            type Value = GetFunctionRequest;
5702            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5703                formatter.write_str("struct GetFunctionRequest")
5704            }
5705            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5706            where
5707                A: serde::de::MapAccess<'de>,
5708            {
5709                #[allow(unused_imports)]
5710                use serde::de::Error;
5711                use std::option::Option::Some;
5712                let mut fields = std::collections::HashSet::new();
5713                let mut result = Self::Value::new();
5714                while let Some(tag) = map.next_key::<__FieldTag>()? {
5715                    #[allow(clippy::match_single_binding)]
5716                    match tag {
5717                        __FieldTag::__name => {
5718                            if !fields.insert(__FieldTag::__name) {
5719                                return std::result::Result::Err(A::Error::duplicate_field(
5720                                    "multiple values for name",
5721                                ));
5722                            }
5723                            result.name = map
5724                                .next_value::<std::option::Option<std::string::String>>()?
5725                                .unwrap_or_default();
5726                        }
5727                        __FieldTag::__revision => {
5728                            if !fields.insert(__FieldTag::__revision) {
5729                                return std::result::Result::Err(A::Error::duplicate_field(
5730                                    "multiple values for revision",
5731                                ));
5732                            }
5733                            result.revision = map
5734                                .next_value::<std::option::Option<std::string::String>>()?
5735                                .unwrap_or_default();
5736                        }
5737                        __FieldTag::Unknown(key) => {
5738                            let value = map.next_value::<serde_json::Value>()?;
5739                            result._unknown_fields.insert(key, value);
5740                        }
5741                    }
5742                }
5743                std::result::Result::Ok(result)
5744            }
5745        }
5746        deserializer.deserialize_any(Visitor)
5747    }
5748}
5749
5750#[doc(hidden)]
5751impl serde::ser::Serialize for GetFunctionRequest {
5752    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5753    where
5754        S: serde::ser::Serializer,
5755    {
5756        use serde::ser::SerializeMap;
5757        #[allow(unused_imports)]
5758        use std::option::Option::Some;
5759        let mut state = serializer.serialize_map(std::option::Option::None)?;
5760        if !self.name.is_empty() {
5761            state.serialize_entry("name", &self.name)?;
5762        }
5763        if !self.revision.is_empty() {
5764            state.serialize_entry("revision", &self.revision)?;
5765        }
5766        if !self._unknown_fields.is_empty() {
5767            for (key, value) in self._unknown_fields.iter() {
5768                state.serialize_entry(key, &value)?;
5769            }
5770        }
5771        state.end()
5772    }
5773}
5774
5775impl std::fmt::Debug for GetFunctionRequest {
5776    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5777        let mut debug_struct = f.debug_struct("GetFunctionRequest");
5778        debug_struct.field("name", &self.name);
5779        debug_struct.field("revision", &self.revision);
5780        if !self._unknown_fields.is_empty() {
5781            debug_struct.field("_unknown_fields", &self._unknown_fields);
5782        }
5783        debug_struct.finish()
5784    }
5785}
5786
5787/// Request for the `ListFunctions` method.
5788#[derive(Clone, Default, PartialEq)]
5789#[non_exhaustive]
5790pub struct ListFunctionsRequest {
5791    /// Required. The project and location from which the function should be
5792    /// listed, specified in the format `projects/*/locations/*` If you want to
5793    /// list functions in all locations, use "-" in place of a location. When
5794    /// listing functions in all locations, if one or more location(s) are
5795    /// unreachable, the response will contain functions from all reachable
5796    /// locations along with the names of any unreachable locations.
5797    pub parent: std::string::String,
5798
5799    /// Maximum number of functions to return per call. The largest allowed
5800    /// page_size is 1,000, if the page_size is omitted or specified as greater
5801    /// than 1,000 then it will be replaced as 1,000. The size of the list
5802    /// response can be less than specified when used with filters.
5803    pub page_size: i32,
5804
5805    /// The value returned by the last
5806    /// `ListFunctionsResponse`; indicates that
5807    /// this is a continuation of a prior `ListFunctions` call, and that the
5808    /// system should return the next page of data.
5809    pub page_token: std::string::String,
5810
5811    /// The filter for Functions that match the filter expression,
5812    /// following the syntax outlined in <https://google.aip.dev/160>.
5813    pub filter: std::string::String,
5814
5815    /// The sorting order of the resources returned. Value should be a comma
5816    /// separated list of fields. The default sorting order is ascending.
5817    /// See <https://google.aip.dev/132#ordering>.
5818    pub order_by: std::string::String,
5819
5820    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5821}
5822
5823impl ListFunctionsRequest {
5824    pub fn new() -> Self {
5825        std::default::Default::default()
5826    }
5827
5828    /// Sets the value of [parent][crate::model::ListFunctionsRequest::parent].
5829    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5830        self.parent = v.into();
5831        self
5832    }
5833
5834    /// Sets the value of [page_size][crate::model::ListFunctionsRequest::page_size].
5835    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5836        self.page_size = v.into();
5837        self
5838    }
5839
5840    /// Sets the value of [page_token][crate::model::ListFunctionsRequest::page_token].
5841    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5842        self.page_token = v.into();
5843        self
5844    }
5845
5846    /// Sets the value of [filter][crate::model::ListFunctionsRequest::filter].
5847    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5848        self.filter = v.into();
5849        self
5850    }
5851
5852    /// Sets the value of [order_by][crate::model::ListFunctionsRequest::order_by].
5853    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5854        self.order_by = v.into();
5855        self
5856    }
5857}
5858
5859impl wkt::message::Message for ListFunctionsRequest {
5860    fn typename() -> &'static str {
5861        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsRequest"
5862    }
5863}
5864
5865#[doc(hidden)]
5866impl<'de> serde::de::Deserialize<'de> for ListFunctionsRequest {
5867    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5868    where
5869        D: serde::Deserializer<'de>,
5870    {
5871        #[allow(non_camel_case_types)]
5872        #[doc(hidden)]
5873        #[derive(PartialEq, Eq, Hash)]
5874        enum __FieldTag {
5875            __parent,
5876            __page_size,
5877            __page_token,
5878            __filter,
5879            __order_by,
5880            Unknown(std::string::String),
5881        }
5882        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5883            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5884            where
5885                D: serde::Deserializer<'de>,
5886            {
5887                struct Visitor;
5888                impl<'de> serde::de::Visitor<'de> for Visitor {
5889                    type Value = __FieldTag;
5890                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5891                        formatter.write_str("a field name for ListFunctionsRequest")
5892                    }
5893                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5894                    where
5895                        E: serde::de::Error,
5896                    {
5897                        use std::result::Result::Ok;
5898                        use std::string::ToString;
5899                        match value {
5900                            "parent" => Ok(__FieldTag::__parent),
5901                            "pageSize" => Ok(__FieldTag::__page_size),
5902                            "page_size" => Ok(__FieldTag::__page_size),
5903                            "pageToken" => Ok(__FieldTag::__page_token),
5904                            "page_token" => Ok(__FieldTag::__page_token),
5905                            "filter" => Ok(__FieldTag::__filter),
5906                            "orderBy" => Ok(__FieldTag::__order_by),
5907                            "order_by" => Ok(__FieldTag::__order_by),
5908                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5909                        }
5910                    }
5911                }
5912                deserializer.deserialize_identifier(Visitor)
5913            }
5914        }
5915        struct Visitor;
5916        impl<'de> serde::de::Visitor<'de> for Visitor {
5917            type Value = ListFunctionsRequest;
5918            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5919                formatter.write_str("struct ListFunctionsRequest")
5920            }
5921            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5922            where
5923                A: serde::de::MapAccess<'de>,
5924            {
5925                #[allow(unused_imports)]
5926                use serde::de::Error;
5927                use std::option::Option::Some;
5928                let mut fields = std::collections::HashSet::new();
5929                let mut result = Self::Value::new();
5930                while let Some(tag) = map.next_key::<__FieldTag>()? {
5931                    #[allow(clippy::match_single_binding)]
5932                    match tag {
5933                        __FieldTag::__parent => {
5934                            if !fields.insert(__FieldTag::__parent) {
5935                                return std::result::Result::Err(A::Error::duplicate_field(
5936                                    "multiple values for parent",
5937                                ));
5938                            }
5939                            result.parent = map
5940                                .next_value::<std::option::Option<std::string::String>>()?
5941                                .unwrap_or_default();
5942                        }
5943                        __FieldTag::__page_size => {
5944                            if !fields.insert(__FieldTag::__page_size) {
5945                                return std::result::Result::Err(A::Error::duplicate_field(
5946                                    "multiple values for page_size",
5947                                ));
5948                            }
5949                            struct __With(std::option::Option<i32>);
5950                            impl<'de> serde::de::Deserialize<'de> for __With {
5951                                fn deserialize<D>(
5952                                    deserializer: D,
5953                                ) -> std::result::Result<Self, D::Error>
5954                                where
5955                                    D: serde::de::Deserializer<'de>,
5956                                {
5957                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5958                                }
5959                            }
5960                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5961                        }
5962                        __FieldTag::__page_token => {
5963                            if !fields.insert(__FieldTag::__page_token) {
5964                                return std::result::Result::Err(A::Error::duplicate_field(
5965                                    "multiple values for page_token",
5966                                ));
5967                            }
5968                            result.page_token = map
5969                                .next_value::<std::option::Option<std::string::String>>()?
5970                                .unwrap_or_default();
5971                        }
5972                        __FieldTag::__filter => {
5973                            if !fields.insert(__FieldTag::__filter) {
5974                                return std::result::Result::Err(A::Error::duplicate_field(
5975                                    "multiple values for filter",
5976                                ));
5977                            }
5978                            result.filter = map
5979                                .next_value::<std::option::Option<std::string::String>>()?
5980                                .unwrap_or_default();
5981                        }
5982                        __FieldTag::__order_by => {
5983                            if !fields.insert(__FieldTag::__order_by) {
5984                                return std::result::Result::Err(A::Error::duplicate_field(
5985                                    "multiple values for order_by",
5986                                ));
5987                            }
5988                            result.order_by = map
5989                                .next_value::<std::option::Option<std::string::String>>()?
5990                                .unwrap_or_default();
5991                        }
5992                        __FieldTag::Unknown(key) => {
5993                            let value = map.next_value::<serde_json::Value>()?;
5994                            result._unknown_fields.insert(key, value);
5995                        }
5996                    }
5997                }
5998                std::result::Result::Ok(result)
5999            }
6000        }
6001        deserializer.deserialize_any(Visitor)
6002    }
6003}
6004
6005#[doc(hidden)]
6006impl serde::ser::Serialize for ListFunctionsRequest {
6007    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6008    where
6009        S: serde::ser::Serializer,
6010    {
6011        use serde::ser::SerializeMap;
6012        #[allow(unused_imports)]
6013        use std::option::Option::Some;
6014        let mut state = serializer.serialize_map(std::option::Option::None)?;
6015        if !self.parent.is_empty() {
6016            state.serialize_entry("parent", &self.parent)?;
6017        }
6018        if !wkt::internal::is_default(&self.page_size) {
6019            struct __With<'a>(&'a i32);
6020            impl<'a> serde::ser::Serialize for __With<'a> {
6021                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6022                where
6023                    S: serde::ser::Serializer,
6024                {
6025                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6026                }
6027            }
6028            state.serialize_entry("pageSize", &__With(&self.page_size))?;
6029        }
6030        if !self.page_token.is_empty() {
6031            state.serialize_entry("pageToken", &self.page_token)?;
6032        }
6033        if !self.filter.is_empty() {
6034            state.serialize_entry("filter", &self.filter)?;
6035        }
6036        if !self.order_by.is_empty() {
6037            state.serialize_entry("orderBy", &self.order_by)?;
6038        }
6039        if !self._unknown_fields.is_empty() {
6040            for (key, value) in self._unknown_fields.iter() {
6041                state.serialize_entry(key, &value)?;
6042            }
6043        }
6044        state.end()
6045    }
6046}
6047
6048impl std::fmt::Debug for ListFunctionsRequest {
6049    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6050        let mut debug_struct = f.debug_struct("ListFunctionsRequest");
6051        debug_struct.field("parent", &self.parent);
6052        debug_struct.field("page_size", &self.page_size);
6053        debug_struct.field("page_token", &self.page_token);
6054        debug_struct.field("filter", &self.filter);
6055        debug_struct.field("order_by", &self.order_by);
6056        if !self._unknown_fields.is_empty() {
6057            debug_struct.field("_unknown_fields", &self._unknown_fields);
6058        }
6059        debug_struct.finish()
6060    }
6061}
6062
6063/// Response for the `ListFunctions` method.
6064#[derive(Clone, Default, PartialEq)]
6065#[non_exhaustive]
6066pub struct ListFunctionsResponse {
6067    /// The functions that match the request.
6068    pub functions: std::vec::Vec<crate::model::Function>,
6069
6070    /// A token, which can be sent as `page_token` to retrieve the next page.
6071    /// If this field is omitted, there are no subsequent pages.
6072    pub next_page_token: std::string::String,
6073
6074    /// Locations that could not be reached. The response does not include any
6075    /// functions from these locations.
6076    pub unreachable: std::vec::Vec<std::string::String>,
6077
6078    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6079}
6080
6081impl ListFunctionsResponse {
6082    pub fn new() -> Self {
6083        std::default::Default::default()
6084    }
6085
6086    /// Sets the value of [functions][crate::model::ListFunctionsResponse::functions].
6087    pub fn set_functions<T, V>(mut self, v: T) -> Self
6088    where
6089        T: std::iter::IntoIterator<Item = V>,
6090        V: std::convert::Into<crate::model::Function>,
6091    {
6092        use std::iter::Iterator;
6093        self.functions = v.into_iter().map(|i| i.into()).collect();
6094        self
6095    }
6096
6097    /// Sets the value of [next_page_token][crate::model::ListFunctionsResponse::next_page_token].
6098    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6099        self.next_page_token = v.into();
6100        self
6101    }
6102
6103    /// Sets the value of [unreachable][crate::model::ListFunctionsResponse::unreachable].
6104    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6105    where
6106        T: std::iter::IntoIterator<Item = V>,
6107        V: std::convert::Into<std::string::String>,
6108    {
6109        use std::iter::Iterator;
6110        self.unreachable = v.into_iter().map(|i| i.into()).collect();
6111        self
6112    }
6113}
6114
6115impl wkt::message::Message for ListFunctionsResponse {
6116    fn typename() -> &'static str {
6117        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsResponse"
6118    }
6119}
6120
6121#[doc(hidden)]
6122impl gax::paginator::internal::PageableResponse for ListFunctionsResponse {
6123    type PageItem = crate::model::Function;
6124
6125    fn items(self) -> std::vec::Vec<Self::PageItem> {
6126        self.functions
6127    }
6128
6129    fn next_page_token(&self) -> std::string::String {
6130        use std::clone::Clone;
6131        self.next_page_token.clone()
6132    }
6133}
6134
6135#[doc(hidden)]
6136impl<'de> serde::de::Deserialize<'de> for ListFunctionsResponse {
6137    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6138    where
6139        D: serde::Deserializer<'de>,
6140    {
6141        #[allow(non_camel_case_types)]
6142        #[doc(hidden)]
6143        #[derive(PartialEq, Eq, Hash)]
6144        enum __FieldTag {
6145            __functions,
6146            __next_page_token,
6147            __unreachable,
6148            Unknown(std::string::String),
6149        }
6150        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6151            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6152            where
6153                D: serde::Deserializer<'de>,
6154            {
6155                struct Visitor;
6156                impl<'de> serde::de::Visitor<'de> for Visitor {
6157                    type Value = __FieldTag;
6158                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6159                        formatter.write_str("a field name for ListFunctionsResponse")
6160                    }
6161                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6162                    where
6163                        E: serde::de::Error,
6164                    {
6165                        use std::result::Result::Ok;
6166                        use std::string::ToString;
6167                        match value {
6168                            "functions" => Ok(__FieldTag::__functions),
6169                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
6170                            "next_page_token" => Ok(__FieldTag::__next_page_token),
6171                            "unreachable" => Ok(__FieldTag::__unreachable),
6172                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6173                        }
6174                    }
6175                }
6176                deserializer.deserialize_identifier(Visitor)
6177            }
6178        }
6179        struct Visitor;
6180        impl<'de> serde::de::Visitor<'de> for Visitor {
6181            type Value = ListFunctionsResponse;
6182            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6183                formatter.write_str("struct ListFunctionsResponse")
6184            }
6185            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6186            where
6187                A: serde::de::MapAccess<'de>,
6188            {
6189                #[allow(unused_imports)]
6190                use serde::de::Error;
6191                use std::option::Option::Some;
6192                let mut fields = std::collections::HashSet::new();
6193                let mut result = Self::Value::new();
6194                while let Some(tag) = map.next_key::<__FieldTag>()? {
6195                    #[allow(clippy::match_single_binding)]
6196                    match tag {
6197                        __FieldTag::__functions => {
6198                            if !fields.insert(__FieldTag::__functions) {
6199                                return std::result::Result::Err(A::Error::duplicate_field(
6200                                    "multiple values for functions",
6201                                ));
6202                            }
6203                            result.functions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Function>>>()?.unwrap_or_default();
6204                        }
6205                        __FieldTag::__next_page_token => {
6206                            if !fields.insert(__FieldTag::__next_page_token) {
6207                                return std::result::Result::Err(A::Error::duplicate_field(
6208                                    "multiple values for next_page_token",
6209                                ));
6210                            }
6211                            result.next_page_token = map
6212                                .next_value::<std::option::Option<std::string::String>>()?
6213                                .unwrap_or_default();
6214                        }
6215                        __FieldTag::__unreachable => {
6216                            if !fields.insert(__FieldTag::__unreachable) {
6217                                return std::result::Result::Err(A::Error::duplicate_field(
6218                                    "multiple values for unreachable",
6219                                ));
6220                            }
6221                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6222                        }
6223                        __FieldTag::Unknown(key) => {
6224                            let value = map.next_value::<serde_json::Value>()?;
6225                            result._unknown_fields.insert(key, value);
6226                        }
6227                    }
6228                }
6229                std::result::Result::Ok(result)
6230            }
6231        }
6232        deserializer.deserialize_any(Visitor)
6233    }
6234}
6235
6236#[doc(hidden)]
6237impl serde::ser::Serialize for ListFunctionsResponse {
6238    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6239    where
6240        S: serde::ser::Serializer,
6241    {
6242        use serde::ser::SerializeMap;
6243        #[allow(unused_imports)]
6244        use std::option::Option::Some;
6245        let mut state = serializer.serialize_map(std::option::Option::None)?;
6246        if !self.functions.is_empty() {
6247            state.serialize_entry("functions", &self.functions)?;
6248        }
6249        if !self.next_page_token.is_empty() {
6250            state.serialize_entry("nextPageToken", &self.next_page_token)?;
6251        }
6252        if !self.unreachable.is_empty() {
6253            state.serialize_entry("unreachable", &self.unreachable)?;
6254        }
6255        if !self._unknown_fields.is_empty() {
6256            for (key, value) in self._unknown_fields.iter() {
6257                state.serialize_entry(key, &value)?;
6258            }
6259        }
6260        state.end()
6261    }
6262}
6263
6264impl std::fmt::Debug for ListFunctionsResponse {
6265    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6266        let mut debug_struct = f.debug_struct("ListFunctionsResponse");
6267        debug_struct.field("functions", &self.functions);
6268        debug_struct.field("next_page_token", &self.next_page_token);
6269        debug_struct.field("unreachable", &self.unreachable);
6270        if !self._unknown_fields.is_empty() {
6271            debug_struct.field("_unknown_fields", &self._unknown_fields);
6272        }
6273        debug_struct.finish()
6274    }
6275}
6276
6277/// Request for the `CreateFunction` method.
6278#[derive(Clone, Default, PartialEq)]
6279#[non_exhaustive]
6280pub struct CreateFunctionRequest {
6281    /// Required. The project and location in which the function should be created,
6282    /// specified in the format `projects/*/locations/*`
6283    pub parent: std::string::String,
6284
6285    /// Required. Function to be created.
6286    pub function: std::option::Option<crate::model::Function>,
6287
6288    /// The ID to use for the function, which will become the final component of
6289    /// the function's resource name.
6290    ///
6291    /// This value should be 4-63 characters, and valid characters
6292    /// are /[a-z][0-9]-/.
6293    pub function_id: std::string::String,
6294
6295    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6296}
6297
6298impl CreateFunctionRequest {
6299    pub fn new() -> Self {
6300        std::default::Default::default()
6301    }
6302
6303    /// Sets the value of [parent][crate::model::CreateFunctionRequest::parent].
6304    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6305        self.parent = v.into();
6306        self
6307    }
6308
6309    /// Sets the value of [function][crate::model::CreateFunctionRequest::function].
6310    pub fn set_function<T>(mut self, v: T) -> Self
6311    where
6312        T: std::convert::Into<crate::model::Function>,
6313    {
6314        self.function = std::option::Option::Some(v.into());
6315        self
6316    }
6317
6318    /// Sets or clears the value of [function][crate::model::CreateFunctionRequest::function].
6319    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
6320    where
6321        T: std::convert::Into<crate::model::Function>,
6322    {
6323        self.function = v.map(|x| x.into());
6324        self
6325    }
6326
6327    /// Sets the value of [function_id][crate::model::CreateFunctionRequest::function_id].
6328    pub fn set_function_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6329        self.function_id = v.into();
6330        self
6331    }
6332}
6333
6334impl wkt::message::Message for CreateFunctionRequest {
6335    fn typename() -> &'static str {
6336        "type.googleapis.com/google.cloud.functions.v2.CreateFunctionRequest"
6337    }
6338}
6339
6340#[doc(hidden)]
6341impl<'de> serde::de::Deserialize<'de> for CreateFunctionRequest {
6342    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6343    where
6344        D: serde::Deserializer<'de>,
6345    {
6346        #[allow(non_camel_case_types)]
6347        #[doc(hidden)]
6348        #[derive(PartialEq, Eq, Hash)]
6349        enum __FieldTag {
6350            __parent,
6351            __function,
6352            __function_id,
6353            Unknown(std::string::String),
6354        }
6355        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6356            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6357            where
6358                D: serde::Deserializer<'de>,
6359            {
6360                struct Visitor;
6361                impl<'de> serde::de::Visitor<'de> for Visitor {
6362                    type Value = __FieldTag;
6363                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6364                        formatter.write_str("a field name for CreateFunctionRequest")
6365                    }
6366                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6367                    where
6368                        E: serde::de::Error,
6369                    {
6370                        use std::result::Result::Ok;
6371                        use std::string::ToString;
6372                        match value {
6373                            "parent" => Ok(__FieldTag::__parent),
6374                            "function" => Ok(__FieldTag::__function),
6375                            "functionId" => Ok(__FieldTag::__function_id),
6376                            "function_id" => Ok(__FieldTag::__function_id),
6377                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6378                        }
6379                    }
6380                }
6381                deserializer.deserialize_identifier(Visitor)
6382            }
6383        }
6384        struct Visitor;
6385        impl<'de> serde::de::Visitor<'de> for Visitor {
6386            type Value = CreateFunctionRequest;
6387            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6388                formatter.write_str("struct CreateFunctionRequest")
6389            }
6390            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6391            where
6392                A: serde::de::MapAccess<'de>,
6393            {
6394                #[allow(unused_imports)]
6395                use serde::de::Error;
6396                use std::option::Option::Some;
6397                let mut fields = std::collections::HashSet::new();
6398                let mut result = Self::Value::new();
6399                while let Some(tag) = map.next_key::<__FieldTag>()? {
6400                    #[allow(clippy::match_single_binding)]
6401                    match tag {
6402                        __FieldTag::__parent => {
6403                            if !fields.insert(__FieldTag::__parent) {
6404                                return std::result::Result::Err(A::Error::duplicate_field(
6405                                    "multiple values for parent",
6406                                ));
6407                            }
6408                            result.parent = map
6409                                .next_value::<std::option::Option<std::string::String>>()?
6410                                .unwrap_or_default();
6411                        }
6412                        __FieldTag::__function => {
6413                            if !fields.insert(__FieldTag::__function) {
6414                                return std::result::Result::Err(A::Error::duplicate_field(
6415                                    "multiple values for function",
6416                                ));
6417                            }
6418                            result.function =
6419                                map.next_value::<std::option::Option<crate::model::Function>>()?;
6420                        }
6421                        __FieldTag::__function_id => {
6422                            if !fields.insert(__FieldTag::__function_id) {
6423                                return std::result::Result::Err(A::Error::duplicate_field(
6424                                    "multiple values for function_id",
6425                                ));
6426                            }
6427                            result.function_id = map
6428                                .next_value::<std::option::Option<std::string::String>>()?
6429                                .unwrap_or_default();
6430                        }
6431                        __FieldTag::Unknown(key) => {
6432                            let value = map.next_value::<serde_json::Value>()?;
6433                            result._unknown_fields.insert(key, value);
6434                        }
6435                    }
6436                }
6437                std::result::Result::Ok(result)
6438            }
6439        }
6440        deserializer.deserialize_any(Visitor)
6441    }
6442}
6443
6444#[doc(hidden)]
6445impl serde::ser::Serialize for CreateFunctionRequest {
6446    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6447    where
6448        S: serde::ser::Serializer,
6449    {
6450        use serde::ser::SerializeMap;
6451        #[allow(unused_imports)]
6452        use std::option::Option::Some;
6453        let mut state = serializer.serialize_map(std::option::Option::None)?;
6454        if !self.parent.is_empty() {
6455            state.serialize_entry("parent", &self.parent)?;
6456        }
6457        if self.function.is_some() {
6458            state.serialize_entry("function", &self.function)?;
6459        }
6460        if !self.function_id.is_empty() {
6461            state.serialize_entry("functionId", &self.function_id)?;
6462        }
6463        if !self._unknown_fields.is_empty() {
6464            for (key, value) in self._unknown_fields.iter() {
6465                state.serialize_entry(key, &value)?;
6466            }
6467        }
6468        state.end()
6469    }
6470}
6471
6472impl std::fmt::Debug for CreateFunctionRequest {
6473    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6474        let mut debug_struct = f.debug_struct("CreateFunctionRequest");
6475        debug_struct.field("parent", &self.parent);
6476        debug_struct.field("function", &self.function);
6477        debug_struct.field("function_id", &self.function_id);
6478        if !self._unknown_fields.is_empty() {
6479            debug_struct.field("_unknown_fields", &self._unknown_fields);
6480        }
6481        debug_struct.finish()
6482    }
6483}
6484
6485/// Request for the `UpdateFunction` method.
6486#[derive(Clone, Default, PartialEq)]
6487#[non_exhaustive]
6488pub struct UpdateFunctionRequest {
6489    /// Required. New version of the function.
6490    pub function: std::option::Option<crate::model::Function>,
6491
6492    /// The list of fields to be updated.
6493    /// If no field mask is provided, all fields will be updated.
6494    pub update_mask: std::option::Option<wkt::FieldMask>,
6495
6496    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6497}
6498
6499impl UpdateFunctionRequest {
6500    pub fn new() -> Self {
6501        std::default::Default::default()
6502    }
6503
6504    /// Sets the value of [function][crate::model::UpdateFunctionRequest::function].
6505    pub fn set_function<T>(mut self, v: T) -> Self
6506    where
6507        T: std::convert::Into<crate::model::Function>,
6508    {
6509        self.function = std::option::Option::Some(v.into());
6510        self
6511    }
6512
6513    /// Sets or clears the value of [function][crate::model::UpdateFunctionRequest::function].
6514    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
6515    where
6516        T: std::convert::Into<crate::model::Function>,
6517    {
6518        self.function = v.map(|x| x.into());
6519        self
6520    }
6521
6522    /// Sets the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
6523    pub fn set_update_mask<T>(mut self, v: T) -> Self
6524    where
6525        T: std::convert::Into<wkt::FieldMask>,
6526    {
6527        self.update_mask = std::option::Option::Some(v.into());
6528        self
6529    }
6530
6531    /// Sets or clears the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
6532    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6533    where
6534        T: std::convert::Into<wkt::FieldMask>,
6535    {
6536        self.update_mask = v.map(|x| x.into());
6537        self
6538    }
6539}
6540
6541impl wkt::message::Message for UpdateFunctionRequest {
6542    fn typename() -> &'static str {
6543        "type.googleapis.com/google.cloud.functions.v2.UpdateFunctionRequest"
6544    }
6545}
6546
6547#[doc(hidden)]
6548impl<'de> serde::de::Deserialize<'de> for UpdateFunctionRequest {
6549    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6550    where
6551        D: serde::Deserializer<'de>,
6552    {
6553        #[allow(non_camel_case_types)]
6554        #[doc(hidden)]
6555        #[derive(PartialEq, Eq, Hash)]
6556        enum __FieldTag {
6557            __function,
6558            __update_mask,
6559            Unknown(std::string::String),
6560        }
6561        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6562            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6563            where
6564                D: serde::Deserializer<'de>,
6565            {
6566                struct Visitor;
6567                impl<'de> serde::de::Visitor<'de> for Visitor {
6568                    type Value = __FieldTag;
6569                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6570                        formatter.write_str("a field name for UpdateFunctionRequest")
6571                    }
6572                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6573                    where
6574                        E: serde::de::Error,
6575                    {
6576                        use std::result::Result::Ok;
6577                        use std::string::ToString;
6578                        match value {
6579                            "function" => Ok(__FieldTag::__function),
6580                            "updateMask" => Ok(__FieldTag::__update_mask),
6581                            "update_mask" => Ok(__FieldTag::__update_mask),
6582                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6583                        }
6584                    }
6585                }
6586                deserializer.deserialize_identifier(Visitor)
6587            }
6588        }
6589        struct Visitor;
6590        impl<'de> serde::de::Visitor<'de> for Visitor {
6591            type Value = UpdateFunctionRequest;
6592            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6593                formatter.write_str("struct UpdateFunctionRequest")
6594            }
6595            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6596            where
6597                A: serde::de::MapAccess<'de>,
6598            {
6599                #[allow(unused_imports)]
6600                use serde::de::Error;
6601                use std::option::Option::Some;
6602                let mut fields = std::collections::HashSet::new();
6603                let mut result = Self::Value::new();
6604                while let Some(tag) = map.next_key::<__FieldTag>()? {
6605                    #[allow(clippy::match_single_binding)]
6606                    match tag {
6607                        __FieldTag::__function => {
6608                            if !fields.insert(__FieldTag::__function) {
6609                                return std::result::Result::Err(A::Error::duplicate_field(
6610                                    "multiple values for function",
6611                                ));
6612                            }
6613                            result.function =
6614                                map.next_value::<std::option::Option<crate::model::Function>>()?;
6615                        }
6616                        __FieldTag::__update_mask => {
6617                            if !fields.insert(__FieldTag::__update_mask) {
6618                                return std::result::Result::Err(A::Error::duplicate_field(
6619                                    "multiple values for update_mask",
6620                                ));
6621                            }
6622                            result.update_mask =
6623                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6624                        }
6625                        __FieldTag::Unknown(key) => {
6626                            let value = map.next_value::<serde_json::Value>()?;
6627                            result._unknown_fields.insert(key, value);
6628                        }
6629                    }
6630                }
6631                std::result::Result::Ok(result)
6632            }
6633        }
6634        deserializer.deserialize_any(Visitor)
6635    }
6636}
6637
6638#[doc(hidden)]
6639impl serde::ser::Serialize for UpdateFunctionRequest {
6640    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6641    where
6642        S: serde::ser::Serializer,
6643    {
6644        use serde::ser::SerializeMap;
6645        #[allow(unused_imports)]
6646        use std::option::Option::Some;
6647        let mut state = serializer.serialize_map(std::option::Option::None)?;
6648        if self.function.is_some() {
6649            state.serialize_entry("function", &self.function)?;
6650        }
6651        if self.update_mask.is_some() {
6652            state.serialize_entry("updateMask", &self.update_mask)?;
6653        }
6654        if !self._unknown_fields.is_empty() {
6655            for (key, value) in self._unknown_fields.iter() {
6656                state.serialize_entry(key, &value)?;
6657            }
6658        }
6659        state.end()
6660    }
6661}
6662
6663impl std::fmt::Debug for UpdateFunctionRequest {
6664    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6665        let mut debug_struct = f.debug_struct("UpdateFunctionRequest");
6666        debug_struct.field("function", &self.function);
6667        debug_struct.field("update_mask", &self.update_mask);
6668        if !self._unknown_fields.is_empty() {
6669            debug_struct.field("_unknown_fields", &self._unknown_fields);
6670        }
6671        debug_struct.finish()
6672    }
6673}
6674
6675/// Request for the `DeleteFunction` method.
6676#[derive(Clone, Default, PartialEq)]
6677#[non_exhaustive]
6678pub struct DeleteFunctionRequest {
6679    /// Required. The name of the function which should be deleted.
6680    pub name: std::string::String,
6681
6682    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6683}
6684
6685impl DeleteFunctionRequest {
6686    pub fn new() -> Self {
6687        std::default::Default::default()
6688    }
6689
6690    /// Sets the value of [name][crate::model::DeleteFunctionRequest::name].
6691    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6692        self.name = v.into();
6693        self
6694    }
6695}
6696
6697impl wkt::message::Message for DeleteFunctionRequest {
6698    fn typename() -> &'static str {
6699        "type.googleapis.com/google.cloud.functions.v2.DeleteFunctionRequest"
6700    }
6701}
6702
6703#[doc(hidden)]
6704impl<'de> serde::de::Deserialize<'de> for DeleteFunctionRequest {
6705    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6706    where
6707        D: serde::Deserializer<'de>,
6708    {
6709        #[allow(non_camel_case_types)]
6710        #[doc(hidden)]
6711        #[derive(PartialEq, Eq, Hash)]
6712        enum __FieldTag {
6713            __name,
6714            Unknown(std::string::String),
6715        }
6716        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6717            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6718            where
6719                D: serde::Deserializer<'de>,
6720            {
6721                struct Visitor;
6722                impl<'de> serde::de::Visitor<'de> for Visitor {
6723                    type Value = __FieldTag;
6724                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6725                        formatter.write_str("a field name for DeleteFunctionRequest")
6726                    }
6727                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6728                    where
6729                        E: serde::de::Error,
6730                    {
6731                        use std::result::Result::Ok;
6732                        use std::string::ToString;
6733                        match value {
6734                            "name" => Ok(__FieldTag::__name),
6735                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6736                        }
6737                    }
6738                }
6739                deserializer.deserialize_identifier(Visitor)
6740            }
6741        }
6742        struct Visitor;
6743        impl<'de> serde::de::Visitor<'de> for Visitor {
6744            type Value = DeleteFunctionRequest;
6745            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6746                formatter.write_str("struct DeleteFunctionRequest")
6747            }
6748            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6749            where
6750                A: serde::de::MapAccess<'de>,
6751            {
6752                #[allow(unused_imports)]
6753                use serde::de::Error;
6754                use std::option::Option::Some;
6755                let mut fields = std::collections::HashSet::new();
6756                let mut result = Self::Value::new();
6757                while let Some(tag) = map.next_key::<__FieldTag>()? {
6758                    #[allow(clippy::match_single_binding)]
6759                    match tag {
6760                        __FieldTag::__name => {
6761                            if !fields.insert(__FieldTag::__name) {
6762                                return std::result::Result::Err(A::Error::duplicate_field(
6763                                    "multiple values for name",
6764                                ));
6765                            }
6766                            result.name = map
6767                                .next_value::<std::option::Option<std::string::String>>()?
6768                                .unwrap_or_default();
6769                        }
6770                        __FieldTag::Unknown(key) => {
6771                            let value = map.next_value::<serde_json::Value>()?;
6772                            result._unknown_fields.insert(key, value);
6773                        }
6774                    }
6775                }
6776                std::result::Result::Ok(result)
6777            }
6778        }
6779        deserializer.deserialize_any(Visitor)
6780    }
6781}
6782
6783#[doc(hidden)]
6784impl serde::ser::Serialize for DeleteFunctionRequest {
6785    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6786    where
6787        S: serde::ser::Serializer,
6788    {
6789        use serde::ser::SerializeMap;
6790        #[allow(unused_imports)]
6791        use std::option::Option::Some;
6792        let mut state = serializer.serialize_map(std::option::Option::None)?;
6793        if !self.name.is_empty() {
6794            state.serialize_entry("name", &self.name)?;
6795        }
6796        if !self._unknown_fields.is_empty() {
6797            for (key, value) in self._unknown_fields.iter() {
6798                state.serialize_entry(key, &value)?;
6799            }
6800        }
6801        state.end()
6802    }
6803}
6804
6805impl std::fmt::Debug for DeleteFunctionRequest {
6806    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6807        let mut debug_struct = f.debug_struct("DeleteFunctionRequest");
6808        debug_struct.field("name", &self.name);
6809        if !self._unknown_fields.is_empty() {
6810            debug_struct.field("_unknown_fields", &self._unknown_fields);
6811        }
6812        debug_struct.finish()
6813    }
6814}
6815
6816/// Request of `GenerateSourceUploadUrl` method.
6817#[derive(Clone, Default, PartialEq)]
6818#[non_exhaustive]
6819pub struct GenerateUploadUrlRequest {
6820    /// Required. The project and location in which the Google Cloud Storage signed
6821    /// URL should be generated, specified in the format `projects/*/locations/*`.
6822    pub parent: std::string::String,
6823
6824    /// Resource name of a KMS crypto key (managed by the user) used to
6825    /// encrypt/decrypt function source code objects in intermediate Cloud Storage
6826    /// buckets. When you generate an upload url and upload your source code, it
6827    /// gets copied to an intermediate Cloud Storage bucket. The source code is
6828    /// then copied to a versioned directory in the sources bucket in the consumer
6829    /// project during the function deployment.
6830    ///
6831    /// It must match the pattern
6832    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
6833    ///
6834    /// The Google Cloud Functions service account
6835    /// (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
6836    /// granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
6837    /// (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
6838    /// Key/KeyRing/Project/Organization (least access preferred).
6839    pub kms_key_name: std::string::String,
6840
6841    /// The function environment the generated upload url will be used for.
6842    /// The upload url for 2nd Gen functions can also be used for 1st gen
6843    /// functions, but not vice versa. If not specified, 2nd generation-style
6844    /// upload URLs are generated.
6845    pub environment: crate::model::Environment,
6846
6847    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6848}
6849
6850impl GenerateUploadUrlRequest {
6851    pub fn new() -> Self {
6852        std::default::Default::default()
6853    }
6854
6855    /// Sets the value of [parent][crate::model::GenerateUploadUrlRequest::parent].
6856    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6857        self.parent = v.into();
6858        self
6859    }
6860
6861    /// Sets the value of [kms_key_name][crate::model::GenerateUploadUrlRequest::kms_key_name].
6862    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6863        self.kms_key_name = v.into();
6864        self
6865    }
6866
6867    /// Sets the value of [environment][crate::model::GenerateUploadUrlRequest::environment].
6868    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
6869        mut self,
6870        v: T,
6871    ) -> Self {
6872        self.environment = v.into();
6873        self
6874    }
6875}
6876
6877impl wkt::message::Message for GenerateUploadUrlRequest {
6878    fn typename() -> &'static str {
6879        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlRequest"
6880    }
6881}
6882
6883#[doc(hidden)]
6884impl<'de> serde::de::Deserialize<'de> for GenerateUploadUrlRequest {
6885    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6886    where
6887        D: serde::Deserializer<'de>,
6888    {
6889        #[allow(non_camel_case_types)]
6890        #[doc(hidden)]
6891        #[derive(PartialEq, Eq, Hash)]
6892        enum __FieldTag {
6893            __parent,
6894            __kms_key_name,
6895            __environment,
6896            Unknown(std::string::String),
6897        }
6898        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6899            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6900            where
6901                D: serde::Deserializer<'de>,
6902            {
6903                struct Visitor;
6904                impl<'de> serde::de::Visitor<'de> for Visitor {
6905                    type Value = __FieldTag;
6906                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6907                        formatter.write_str("a field name for GenerateUploadUrlRequest")
6908                    }
6909                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6910                    where
6911                        E: serde::de::Error,
6912                    {
6913                        use std::result::Result::Ok;
6914                        use std::string::ToString;
6915                        match value {
6916                            "parent" => Ok(__FieldTag::__parent),
6917                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
6918                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
6919                            "environment" => Ok(__FieldTag::__environment),
6920                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6921                        }
6922                    }
6923                }
6924                deserializer.deserialize_identifier(Visitor)
6925            }
6926        }
6927        struct Visitor;
6928        impl<'de> serde::de::Visitor<'de> for Visitor {
6929            type Value = GenerateUploadUrlRequest;
6930            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6931                formatter.write_str("struct GenerateUploadUrlRequest")
6932            }
6933            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6934            where
6935                A: serde::de::MapAccess<'de>,
6936            {
6937                #[allow(unused_imports)]
6938                use serde::de::Error;
6939                use std::option::Option::Some;
6940                let mut fields = std::collections::HashSet::new();
6941                let mut result = Self::Value::new();
6942                while let Some(tag) = map.next_key::<__FieldTag>()? {
6943                    #[allow(clippy::match_single_binding)]
6944                    match tag {
6945                        __FieldTag::__parent => {
6946                            if !fields.insert(__FieldTag::__parent) {
6947                                return std::result::Result::Err(A::Error::duplicate_field(
6948                                    "multiple values for parent",
6949                                ));
6950                            }
6951                            result.parent = map
6952                                .next_value::<std::option::Option<std::string::String>>()?
6953                                .unwrap_or_default();
6954                        }
6955                        __FieldTag::__kms_key_name => {
6956                            if !fields.insert(__FieldTag::__kms_key_name) {
6957                                return std::result::Result::Err(A::Error::duplicate_field(
6958                                    "multiple values for kms_key_name",
6959                                ));
6960                            }
6961                            result.kms_key_name = map
6962                                .next_value::<std::option::Option<std::string::String>>()?
6963                                .unwrap_or_default();
6964                        }
6965                        __FieldTag::__environment => {
6966                            if !fields.insert(__FieldTag::__environment) {
6967                                return std::result::Result::Err(A::Error::duplicate_field(
6968                                    "multiple values for environment",
6969                                ));
6970                            }
6971                            result.environment = map
6972                                .next_value::<std::option::Option<crate::model::Environment>>()?
6973                                .unwrap_or_default();
6974                        }
6975                        __FieldTag::Unknown(key) => {
6976                            let value = map.next_value::<serde_json::Value>()?;
6977                            result._unknown_fields.insert(key, value);
6978                        }
6979                    }
6980                }
6981                std::result::Result::Ok(result)
6982            }
6983        }
6984        deserializer.deserialize_any(Visitor)
6985    }
6986}
6987
6988#[doc(hidden)]
6989impl serde::ser::Serialize for GenerateUploadUrlRequest {
6990    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6991    where
6992        S: serde::ser::Serializer,
6993    {
6994        use serde::ser::SerializeMap;
6995        #[allow(unused_imports)]
6996        use std::option::Option::Some;
6997        let mut state = serializer.serialize_map(std::option::Option::None)?;
6998        if !self.parent.is_empty() {
6999            state.serialize_entry("parent", &self.parent)?;
7000        }
7001        if !self.kms_key_name.is_empty() {
7002            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
7003        }
7004        if !wkt::internal::is_default(&self.environment) {
7005            state.serialize_entry("environment", &self.environment)?;
7006        }
7007        if !self._unknown_fields.is_empty() {
7008            for (key, value) in self._unknown_fields.iter() {
7009                state.serialize_entry(key, &value)?;
7010            }
7011        }
7012        state.end()
7013    }
7014}
7015
7016impl std::fmt::Debug for GenerateUploadUrlRequest {
7017    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7018        let mut debug_struct = f.debug_struct("GenerateUploadUrlRequest");
7019        debug_struct.field("parent", &self.parent);
7020        debug_struct.field("kms_key_name", &self.kms_key_name);
7021        debug_struct.field("environment", &self.environment);
7022        if !self._unknown_fields.is_empty() {
7023            debug_struct.field("_unknown_fields", &self._unknown_fields);
7024        }
7025        debug_struct.finish()
7026    }
7027}
7028
7029/// Response of `GenerateSourceUploadUrl` method.
7030#[derive(Clone, Default, PartialEq)]
7031#[non_exhaustive]
7032pub struct GenerateUploadUrlResponse {
7033    /// The generated Google Cloud Storage signed URL that should be used for a
7034    /// function source code upload. The uploaded file should be a zip archive
7035    /// which contains a function.
7036    pub upload_url: std::string::String,
7037
7038    /// The location of the source code in the upload bucket.
7039    ///
7040    /// Once the archive is uploaded using the `upload_url` use this field to
7041    /// set the `function.build_config.source.storage_source`
7042    /// during CreateFunction and UpdateFunction.
7043    ///
7044    /// Generation defaults to 0, as Cloud Storage provides a new generation only
7045    /// upon uploading a new object or version of an object.
7046    pub storage_source: std::option::Option<crate::model::StorageSource>,
7047
7048    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7049}
7050
7051impl GenerateUploadUrlResponse {
7052    pub fn new() -> Self {
7053        std::default::Default::default()
7054    }
7055
7056    /// Sets the value of [upload_url][crate::model::GenerateUploadUrlResponse::upload_url].
7057    pub fn set_upload_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7058        self.upload_url = v.into();
7059        self
7060    }
7061
7062    /// Sets the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
7063    pub fn set_storage_source<T>(mut self, v: T) -> Self
7064    where
7065        T: std::convert::Into<crate::model::StorageSource>,
7066    {
7067        self.storage_source = std::option::Option::Some(v.into());
7068        self
7069    }
7070
7071    /// Sets or clears the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
7072    pub fn set_or_clear_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
7073    where
7074        T: std::convert::Into<crate::model::StorageSource>,
7075    {
7076        self.storage_source = v.map(|x| x.into());
7077        self
7078    }
7079}
7080
7081impl wkt::message::Message for GenerateUploadUrlResponse {
7082    fn typename() -> &'static str {
7083        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlResponse"
7084    }
7085}
7086
7087#[doc(hidden)]
7088impl<'de> serde::de::Deserialize<'de> for GenerateUploadUrlResponse {
7089    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7090    where
7091        D: serde::Deserializer<'de>,
7092    {
7093        #[allow(non_camel_case_types)]
7094        #[doc(hidden)]
7095        #[derive(PartialEq, Eq, Hash)]
7096        enum __FieldTag {
7097            __upload_url,
7098            __storage_source,
7099            Unknown(std::string::String),
7100        }
7101        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7102            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7103            where
7104                D: serde::Deserializer<'de>,
7105            {
7106                struct Visitor;
7107                impl<'de> serde::de::Visitor<'de> for Visitor {
7108                    type Value = __FieldTag;
7109                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7110                        formatter.write_str("a field name for GenerateUploadUrlResponse")
7111                    }
7112                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7113                    where
7114                        E: serde::de::Error,
7115                    {
7116                        use std::result::Result::Ok;
7117                        use std::string::ToString;
7118                        match value {
7119                            "uploadUrl" => Ok(__FieldTag::__upload_url),
7120                            "upload_url" => Ok(__FieldTag::__upload_url),
7121                            "storageSource" => Ok(__FieldTag::__storage_source),
7122                            "storage_source" => Ok(__FieldTag::__storage_source),
7123                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7124                        }
7125                    }
7126                }
7127                deserializer.deserialize_identifier(Visitor)
7128            }
7129        }
7130        struct Visitor;
7131        impl<'de> serde::de::Visitor<'de> for Visitor {
7132            type Value = GenerateUploadUrlResponse;
7133            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7134                formatter.write_str("struct GenerateUploadUrlResponse")
7135            }
7136            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7137            where
7138                A: serde::de::MapAccess<'de>,
7139            {
7140                #[allow(unused_imports)]
7141                use serde::de::Error;
7142                use std::option::Option::Some;
7143                let mut fields = std::collections::HashSet::new();
7144                let mut result = Self::Value::new();
7145                while let Some(tag) = map.next_key::<__FieldTag>()? {
7146                    #[allow(clippy::match_single_binding)]
7147                    match tag {
7148                        __FieldTag::__upload_url => {
7149                            if !fields.insert(__FieldTag::__upload_url) {
7150                                return std::result::Result::Err(A::Error::duplicate_field(
7151                                    "multiple values for upload_url",
7152                                ));
7153                            }
7154                            result.upload_url = map
7155                                .next_value::<std::option::Option<std::string::String>>()?
7156                                .unwrap_or_default();
7157                        }
7158                        __FieldTag::__storage_source => {
7159                            if !fields.insert(__FieldTag::__storage_source) {
7160                                return std::result::Result::Err(A::Error::duplicate_field(
7161                                    "multiple values for storage_source",
7162                                ));
7163                            }
7164                            result.storage_source = map
7165                                .next_value::<std::option::Option<crate::model::StorageSource>>()?;
7166                        }
7167                        __FieldTag::Unknown(key) => {
7168                            let value = map.next_value::<serde_json::Value>()?;
7169                            result._unknown_fields.insert(key, value);
7170                        }
7171                    }
7172                }
7173                std::result::Result::Ok(result)
7174            }
7175        }
7176        deserializer.deserialize_any(Visitor)
7177    }
7178}
7179
7180#[doc(hidden)]
7181impl serde::ser::Serialize for GenerateUploadUrlResponse {
7182    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7183    where
7184        S: serde::ser::Serializer,
7185    {
7186        use serde::ser::SerializeMap;
7187        #[allow(unused_imports)]
7188        use std::option::Option::Some;
7189        let mut state = serializer.serialize_map(std::option::Option::None)?;
7190        if !self.upload_url.is_empty() {
7191            state.serialize_entry("uploadUrl", &self.upload_url)?;
7192        }
7193        if self.storage_source.is_some() {
7194            state.serialize_entry("storageSource", &self.storage_source)?;
7195        }
7196        if !self._unknown_fields.is_empty() {
7197            for (key, value) in self._unknown_fields.iter() {
7198                state.serialize_entry(key, &value)?;
7199            }
7200        }
7201        state.end()
7202    }
7203}
7204
7205impl std::fmt::Debug for GenerateUploadUrlResponse {
7206    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7207        let mut debug_struct = f.debug_struct("GenerateUploadUrlResponse");
7208        debug_struct.field("upload_url", &self.upload_url);
7209        debug_struct.field("storage_source", &self.storage_source);
7210        if !self._unknown_fields.is_empty() {
7211            debug_struct.field("_unknown_fields", &self._unknown_fields);
7212        }
7213        debug_struct.finish()
7214    }
7215}
7216
7217/// Request of `GenerateDownloadUrl` method.
7218#[derive(Clone, Default, PartialEq)]
7219#[non_exhaustive]
7220pub struct GenerateDownloadUrlRequest {
7221    /// Required. The name of function for which source code Google Cloud Storage
7222    /// signed URL should be generated.
7223    pub name: std::string::String,
7224
7225    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7226}
7227
7228impl GenerateDownloadUrlRequest {
7229    pub fn new() -> Self {
7230        std::default::Default::default()
7231    }
7232
7233    /// Sets the value of [name][crate::model::GenerateDownloadUrlRequest::name].
7234    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7235        self.name = v.into();
7236        self
7237    }
7238}
7239
7240impl wkt::message::Message for GenerateDownloadUrlRequest {
7241    fn typename() -> &'static str {
7242        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlRequest"
7243    }
7244}
7245
7246#[doc(hidden)]
7247impl<'de> serde::de::Deserialize<'de> for GenerateDownloadUrlRequest {
7248    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7249    where
7250        D: serde::Deserializer<'de>,
7251    {
7252        #[allow(non_camel_case_types)]
7253        #[doc(hidden)]
7254        #[derive(PartialEq, Eq, Hash)]
7255        enum __FieldTag {
7256            __name,
7257            Unknown(std::string::String),
7258        }
7259        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7260            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7261            where
7262                D: serde::Deserializer<'de>,
7263            {
7264                struct Visitor;
7265                impl<'de> serde::de::Visitor<'de> for Visitor {
7266                    type Value = __FieldTag;
7267                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7268                        formatter.write_str("a field name for GenerateDownloadUrlRequest")
7269                    }
7270                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7271                    where
7272                        E: serde::de::Error,
7273                    {
7274                        use std::result::Result::Ok;
7275                        use std::string::ToString;
7276                        match value {
7277                            "name" => Ok(__FieldTag::__name),
7278                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7279                        }
7280                    }
7281                }
7282                deserializer.deserialize_identifier(Visitor)
7283            }
7284        }
7285        struct Visitor;
7286        impl<'de> serde::de::Visitor<'de> for Visitor {
7287            type Value = GenerateDownloadUrlRequest;
7288            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7289                formatter.write_str("struct GenerateDownloadUrlRequest")
7290            }
7291            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7292            where
7293                A: serde::de::MapAccess<'de>,
7294            {
7295                #[allow(unused_imports)]
7296                use serde::de::Error;
7297                use std::option::Option::Some;
7298                let mut fields = std::collections::HashSet::new();
7299                let mut result = Self::Value::new();
7300                while let Some(tag) = map.next_key::<__FieldTag>()? {
7301                    #[allow(clippy::match_single_binding)]
7302                    match tag {
7303                        __FieldTag::__name => {
7304                            if !fields.insert(__FieldTag::__name) {
7305                                return std::result::Result::Err(A::Error::duplicate_field(
7306                                    "multiple values for name",
7307                                ));
7308                            }
7309                            result.name = map
7310                                .next_value::<std::option::Option<std::string::String>>()?
7311                                .unwrap_or_default();
7312                        }
7313                        __FieldTag::Unknown(key) => {
7314                            let value = map.next_value::<serde_json::Value>()?;
7315                            result._unknown_fields.insert(key, value);
7316                        }
7317                    }
7318                }
7319                std::result::Result::Ok(result)
7320            }
7321        }
7322        deserializer.deserialize_any(Visitor)
7323    }
7324}
7325
7326#[doc(hidden)]
7327impl serde::ser::Serialize for GenerateDownloadUrlRequest {
7328    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7329    where
7330        S: serde::ser::Serializer,
7331    {
7332        use serde::ser::SerializeMap;
7333        #[allow(unused_imports)]
7334        use std::option::Option::Some;
7335        let mut state = serializer.serialize_map(std::option::Option::None)?;
7336        if !self.name.is_empty() {
7337            state.serialize_entry("name", &self.name)?;
7338        }
7339        if !self._unknown_fields.is_empty() {
7340            for (key, value) in self._unknown_fields.iter() {
7341                state.serialize_entry(key, &value)?;
7342            }
7343        }
7344        state.end()
7345    }
7346}
7347
7348impl std::fmt::Debug for GenerateDownloadUrlRequest {
7349    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7350        let mut debug_struct = f.debug_struct("GenerateDownloadUrlRequest");
7351        debug_struct.field("name", &self.name);
7352        if !self._unknown_fields.is_empty() {
7353            debug_struct.field("_unknown_fields", &self._unknown_fields);
7354        }
7355        debug_struct.finish()
7356    }
7357}
7358
7359/// Response of `GenerateDownloadUrl` method.
7360#[derive(Clone, Default, PartialEq)]
7361#[non_exhaustive]
7362pub struct GenerateDownloadUrlResponse {
7363    /// The generated Google Cloud Storage signed URL that should be used for
7364    /// function source code download.
7365    pub download_url: std::string::String,
7366
7367    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7368}
7369
7370impl GenerateDownloadUrlResponse {
7371    pub fn new() -> Self {
7372        std::default::Default::default()
7373    }
7374
7375    /// Sets the value of [download_url][crate::model::GenerateDownloadUrlResponse::download_url].
7376    pub fn set_download_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7377        self.download_url = v.into();
7378        self
7379    }
7380}
7381
7382impl wkt::message::Message for GenerateDownloadUrlResponse {
7383    fn typename() -> &'static str {
7384        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlResponse"
7385    }
7386}
7387
7388#[doc(hidden)]
7389impl<'de> serde::de::Deserialize<'de> for GenerateDownloadUrlResponse {
7390    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7391    where
7392        D: serde::Deserializer<'de>,
7393    {
7394        #[allow(non_camel_case_types)]
7395        #[doc(hidden)]
7396        #[derive(PartialEq, Eq, Hash)]
7397        enum __FieldTag {
7398            __download_url,
7399            Unknown(std::string::String),
7400        }
7401        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7402            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7403            where
7404                D: serde::Deserializer<'de>,
7405            {
7406                struct Visitor;
7407                impl<'de> serde::de::Visitor<'de> for Visitor {
7408                    type Value = __FieldTag;
7409                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7410                        formatter.write_str("a field name for GenerateDownloadUrlResponse")
7411                    }
7412                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7413                    where
7414                        E: serde::de::Error,
7415                    {
7416                        use std::result::Result::Ok;
7417                        use std::string::ToString;
7418                        match value {
7419                            "downloadUrl" => Ok(__FieldTag::__download_url),
7420                            "download_url" => Ok(__FieldTag::__download_url),
7421                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7422                        }
7423                    }
7424                }
7425                deserializer.deserialize_identifier(Visitor)
7426            }
7427        }
7428        struct Visitor;
7429        impl<'de> serde::de::Visitor<'de> for Visitor {
7430            type Value = GenerateDownloadUrlResponse;
7431            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7432                formatter.write_str("struct GenerateDownloadUrlResponse")
7433            }
7434            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7435            where
7436                A: serde::de::MapAccess<'de>,
7437            {
7438                #[allow(unused_imports)]
7439                use serde::de::Error;
7440                use std::option::Option::Some;
7441                let mut fields = std::collections::HashSet::new();
7442                let mut result = Self::Value::new();
7443                while let Some(tag) = map.next_key::<__FieldTag>()? {
7444                    #[allow(clippy::match_single_binding)]
7445                    match tag {
7446                        __FieldTag::__download_url => {
7447                            if !fields.insert(__FieldTag::__download_url) {
7448                                return std::result::Result::Err(A::Error::duplicate_field(
7449                                    "multiple values for download_url",
7450                                ));
7451                            }
7452                            result.download_url = map
7453                                .next_value::<std::option::Option<std::string::String>>()?
7454                                .unwrap_or_default();
7455                        }
7456                        __FieldTag::Unknown(key) => {
7457                            let value = map.next_value::<serde_json::Value>()?;
7458                            result._unknown_fields.insert(key, value);
7459                        }
7460                    }
7461                }
7462                std::result::Result::Ok(result)
7463            }
7464        }
7465        deserializer.deserialize_any(Visitor)
7466    }
7467}
7468
7469#[doc(hidden)]
7470impl serde::ser::Serialize for GenerateDownloadUrlResponse {
7471    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7472    where
7473        S: serde::ser::Serializer,
7474    {
7475        use serde::ser::SerializeMap;
7476        #[allow(unused_imports)]
7477        use std::option::Option::Some;
7478        let mut state = serializer.serialize_map(std::option::Option::None)?;
7479        if !self.download_url.is_empty() {
7480            state.serialize_entry("downloadUrl", &self.download_url)?;
7481        }
7482        if !self._unknown_fields.is_empty() {
7483            for (key, value) in self._unknown_fields.iter() {
7484                state.serialize_entry(key, &value)?;
7485            }
7486        }
7487        state.end()
7488    }
7489}
7490
7491impl std::fmt::Debug for GenerateDownloadUrlResponse {
7492    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7493        let mut debug_struct = f.debug_struct("GenerateDownloadUrlResponse");
7494        debug_struct.field("download_url", &self.download_url);
7495        if !self._unknown_fields.is_empty() {
7496            debug_struct.field("_unknown_fields", &self._unknown_fields);
7497        }
7498        debug_struct.finish()
7499    }
7500}
7501
7502/// Request for the `ListRuntimes` method.
7503#[derive(Clone, Default, PartialEq)]
7504#[non_exhaustive]
7505pub struct ListRuntimesRequest {
7506    /// Required. The project and location from which the runtimes should be
7507    /// listed, specified in the format `projects/*/locations/*`
7508    pub parent: std::string::String,
7509
7510    /// The filter for Runtimes that match the filter expression,
7511    /// following the syntax outlined in <https://google.aip.dev/160>.
7512    pub filter: std::string::String,
7513
7514    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7515}
7516
7517impl ListRuntimesRequest {
7518    pub fn new() -> Self {
7519        std::default::Default::default()
7520    }
7521
7522    /// Sets the value of [parent][crate::model::ListRuntimesRequest::parent].
7523    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7524        self.parent = v.into();
7525        self
7526    }
7527
7528    /// Sets the value of [filter][crate::model::ListRuntimesRequest::filter].
7529    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7530        self.filter = v.into();
7531        self
7532    }
7533}
7534
7535impl wkt::message::Message for ListRuntimesRequest {
7536    fn typename() -> &'static str {
7537        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesRequest"
7538    }
7539}
7540
7541#[doc(hidden)]
7542impl<'de> serde::de::Deserialize<'de> for ListRuntimesRequest {
7543    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7544    where
7545        D: serde::Deserializer<'de>,
7546    {
7547        #[allow(non_camel_case_types)]
7548        #[doc(hidden)]
7549        #[derive(PartialEq, Eq, Hash)]
7550        enum __FieldTag {
7551            __parent,
7552            __filter,
7553            Unknown(std::string::String),
7554        }
7555        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7556            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7557            where
7558                D: serde::Deserializer<'de>,
7559            {
7560                struct Visitor;
7561                impl<'de> serde::de::Visitor<'de> for Visitor {
7562                    type Value = __FieldTag;
7563                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7564                        formatter.write_str("a field name for ListRuntimesRequest")
7565                    }
7566                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7567                    where
7568                        E: serde::de::Error,
7569                    {
7570                        use std::result::Result::Ok;
7571                        use std::string::ToString;
7572                        match value {
7573                            "parent" => Ok(__FieldTag::__parent),
7574                            "filter" => Ok(__FieldTag::__filter),
7575                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7576                        }
7577                    }
7578                }
7579                deserializer.deserialize_identifier(Visitor)
7580            }
7581        }
7582        struct Visitor;
7583        impl<'de> serde::de::Visitor<'de> for Visitor {
7584            type Value = ListRuntimesRequest;
7585            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7586                formatter.write_str("struct ListRuntimesRequest")
7587            }
7588            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7589            where
7590                A: serde::de::MapAccess<'de>,
7591            {
7592                #[allow(unused_imports)]
7593                use serde::de::Error;
7594                use std::option::Option::Some;
7595                let mut fields = std::collections::HashSet::new();
7596                let mut result = Self::Value::new();
7597                while let Some(tag) = map.next_key::<__FieldTag>()? {
7598                    #[allow(clippy::match_single_binding)]
7599                    match tag {
7600                        __FieldTag::__parent => {
7601                            if !fields.insert(__FieldTag::__parent) {
7602                                return std::result::Result::Err(A::Error::duplicate_field(
7603                                    "multiple values for parent",
7604                                ));
7605                            }
7606                            result.parent = map
7607                                .next_value::<std::option::Option<std::string::String>>()?
7608                                .unwrap_or_default();
7609                        }
7610                        __FieldTag::__filter => {
7611                            if !fields.insert(__FieldTag::__filter) {
7612                                return std::result::Result::Err(A::Error::duplicate_field(
7613                                    "multiple values for filter",
7614                                ));
7615                            }
7616                            result.filter = map
7617                                .next_value::<std::option::Option<std::string::String>>()?
7618                                .unwrap_or_default();
7619                        }
7620                        __FieldTag::Unknown(key) => {
7621                            let value = map.next_value::<serde_json::Value>()?;
7622                            result._unknown_fields.insert(key, value);
7623                        }
7624                    }
7625                }
7626                std::result::Result::Ok(result)
7627            }
7628        }
7629        deserializer.deserialize_any(Visitor)
7630    }
7631}
7632
7633#[doc(hidden)]
7634impl serde::ser::Serialize for ListRuntimesRequest {
7635    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7636    where
7637        S: serde::ser::Serializer,
7638    {
7639        use serde::ser::SerializeMap;
7640        #[allow(unused_imports)]
7641        use std::option::Option::Some;
7642        let mut state = serializer.serialize_map(std::option::Option::None)?;
7643        if !self.parent.is_empty() {
7644            state.serialize_entry("parent", &self.parent)?;
7645        }
7646        if !self.filter.is_empty() {
7647            state.serialize_entry("filter", &self.filter)?;
7648        }
7649        if !self._unknown_fields.is_empty() {
7650            for (key, value) in self._unknown_fields.iter() {
7651                state.serialize_entry(key, &value)?;
7652            }
7653        }
7654        state.end()
7655    }
7656}
7657
7658impl std::fmt::Debug for ListRuntimesRequest {
7659    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7660        let mut debug_struct = f.debug_struct("ListRuntimesRequest");
7661        debug_struct.field("parent", &self.parent);
7662        debug_struct.field("filter", &self.filter);
7663        if !self._unknown_fields.is_empty() {
7664            debug_struct.field("_unknown_fields", &self._unknown_fields);
7665        }
7666        debug_struct.finish()
7667    }
7668}
7669
7670/// Response for the `ListRuntimes` method.
7671#[derive(Clone, Default, PartialEq)]
7672#[non_exhaustive]
7673pub struct ListRuntimesResponse {
7674    /// The runtimes that match the request.
7675    pub runtimes: std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
7676
7677    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7678}
7679
7680impl ListRuntimesResponse {
7681    pub fn new() -> Self {
7682        std::default::Default::default()
7683    }
7684
7685    /// Sets the value of [runtimes][crate::model::ListRuntimesResponse::runtimes].
7686    pub fn set_runtimes<T, V>(mut self, v: T) -> Self
7687    where
7688        T: std::iter::IntoIterator<Item = V>,
7689        V: std::convert::Into<crate::model::list_runtimes_response::Runtime>,
7690    {
7691        use std::iter::Iterator;
7692        self.runtimes = v.into_iter().map(|i| i.into()).collect();
7693        self
7694    }
7695}
7696
7697impl wkt::message::Message for ListRuntimesResponse {
7698    fn typename() -> &'static str {
7699        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse"
7700    }
7701}
7702
7703#[doc(hidden)]
7704impl<'de> serde::de::Deserialize<'de> for ListRuntimesResponse {
7705    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7706    where
7707        D: serde::Deserializer<'de>,
7708    {
7709        #[allow(non_camel_case_types)]
7710        #[doc(hidden)]
7711        #[derive(PartialEq, Eq, Hash)]
7712        enum __FieldTag {
7713            __runtimes,
7714            Unknown(std::string::String),
7715        }
7716        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7717            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7718            where
7719                D: serde::Deserializer<'de>,
7720            {
7721                struct Visitor;
7722                impl<'de> serde::de::Visitor<'de> for Visitor {
7723                    type Value = __FieldTag;
7724                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7725                        formatter.write_str("a field name for ListRuntimesResponse")
7726                    }
7727                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7728                    where
7729                        E: serde::de::Error,
7730                    {
7731                        use std::result::Result::Ok;
7732                        use std::string::ToString;
7733                        match value {
7734                            "runtimes" => Ok(__FieldTag::__runtimes),
7735                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7736                        }
7737                    }
7738                }
7739                deserializer.deserialize_identifier(Visitor)
7740            }
7741        }
7742        struct Visitor;
7743        impl<'de> serde::de::Visitor<'de> for Visitor {
7744            type Value = ListRuntimesResponse;
7745            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7746                formatter.write_str("struct ListRuntimesResponse")
7747            }
7748            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7749            where
7750                A: serde::de::MapAccess<'de>,
7751            {
7752                #[allow(unused_imports)]
7753                use serde::de::Error;
7754                use std::option::Option::Some;
7755                let mut fields = std::collections::HashSet::new();
7756                let mut result = Self::Value::new();
7757                while let Some(tag) = map.next_key::<__FieldTag>()? {
7758                    #[allow(clippy::match_single_binding)]
7759                    match tag {
7760                        __FieldTag::__runtimes => {
7761                            if !fields.insert(__FieldTag::__runtimes) {
7762                                return std::result::Result::Err(A::Error::duplicate_field(
7763                                    "multiple values for runtimes",
7764                                ));
7765                            }
7766                            result.runtimes = map
7767                                .next_value::<std::option::Option<
7768                                    std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
7769                                >>()?
7770                                .unwrap_or_default();
7771                        }
7772                        __FieldTag::Unknown(key) => {
7773                            let value = map.next_value::<serde_json::Value>()?;
7774                            result._unknown_fields.insert(key, value);
7775                        }
7776                    }
7777                }
7778                std::result::Result::Ok(result)
7779            }
7780        }
7781        deserializer.deserialize_any(Visitor)
7782    }
7783}
7784
7785#[doc(hidden)]
7786impl serde::ser::Serialize for ListRuntimesResponse {
7787    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7788    where
7789        S: serde::ser::Serializer,
7790    {
7791        use serde::ser::SerializeMap;
7792        #[allow(unused_imports)]
7793        use std::option::Option::Some;
7794        let mut state = serializer.serialize_map(std::option::Option::None)?;
7795        if !self.runtimes.is_empty() {
7796            state.serialize_entry("runtimes", &self.runtimes)?;
7797        }
7798        if !self._unknown_fields.is_empty() {
7799            for (key, value) in self._unknown_fields.iter() {
7800                state.serialize_entry(key, &value)?;
7801            }
7802        }
7803        state.end()
7804    }
7805}
7806
7807impl std::fmt::Debug for ListRuntimesResponse {
7808    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7809        let mut debug_struct = f.debug_struct("ListRuntimesResponse");
7810        debug_struct.field("runtimes", &self.runtimes);
7811        if !self._unknown_fields.is_empty() {
7812            debug_struct.field("_unknown_fields", &self._unknown_fields);
7813        }
7814        debug_struct.finish()
7815    }
7816}
7817
7818/// Defines additional types related to [ListRuntimesResponse].
7819pub mod list_runtimes_response {
7820    #[allow(unused_imports)]
7821    use super::*;
7822
7823    /// Describes a runtime and any special information (e.g., deprecation status)
7824    /// related to it.
7825    #[derive(Clone, Default, PartialEq)]
7826    #[non_exhaustive]
7827    pub struct Runtime {
7828        /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
7829        pub name: std::string::String,
7830
7831        /// The user facing name, eg 'Go 1.13', 'Node.js 12', etc.
7832        pub display_name: std::string::String,
7833
7834        /// The stage of life this runtime is in, e.g., BETA, GA, etc.
7835        pub stage: crate::model::list_runtimes_response::RuntimeStage,
7836
7837        /// Warning messages, e.g., a deprecation warning.
7838        pub warnings: std::vec::Vec<std::string::String>,
7839
7840        /// The environment for the runtime.
7841        pub environment: crate::model::Environment,
7842
7843        /// Deprecation date for the runtime.
7844        pub deprecation_date: std::option::Option<gtype::model::Date>,
7845
7846        /// Decommission date for the runtime.
7847        pub decommission_date: std::option::Option<gtype::model::Date>,
7848
7849        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7850    }
7851
7852    impl Runtime {
7853        pub fn new() -> Self {
7854            std::default::Default::default()
7855        }
7856
7857        /// Sets the value of [name][crate::model::list_runtimes_response::Runtime::name].
7858        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7859            self.name = v.into();
7860            self
7861        }
7862
7863        /// Sets the value of [display_name][crate::model::list_runtimes_response::Runtime::display_name].
7864        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
7865            mut self,
7866            v: T,
7867        ) -> Self {
7868            self.display_name = v.into();
7869            self
7870        }
7871
7872        /// Sets the value of [stage][crate::model::list_runtimes_response::Runtime::stage].
7873        pub fn set_stage<
7874            T: std::convert::Into<crate::model::list_runtimes_response::RuntimeStage>,
7875        >(
7876            mut self,
7877            v: T,
7878        ) -> Self {
7879            self.stage = v.into();
7880            self
7881        }
7882
7883        /// Sets the value of [warnings][crate::model::list_runtimes_response::Runtime::warnings].
7884        pub fn set_warnings<T, V>(mut self, v: T) -> Self
7885        where
7886            T: std::iter::IntoIterator<Item = V>,
7887            V: std::convert::Into<std::string::String>,
7888        {
7889            use std::iter::Iterator;
7890            self.warnings = v.into_iter().map(|i| i.into()).collect();
7891            self
7892        }
7893
7894        /// Sets the value of [environment][crate::model::list_runtimes_response::Runtime::environment].
7895        pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
7896            mut self,
7897            v: T,
7898        ) -> Self {
7899            self.environment = v.into();
7900            self
7901        }
7902
7903        /// Sets the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
7904        pub fn set_deprecation_date<T>(mut self, v: T) -> Self
7905        where
7906            T: std::convert::Into<gtype::model::Date>,
7907        {
7908            self.deprecation_date = std::option::Option::Some(v.into());
7909            self
7910        }
7911
7912        /// Sets or clears the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
7913        pub fn set_or_clear_deprecation_date<T>(mut self, v: std::option::Option<T>) -> Self
7914        where
7915            T: std::convert::Into<gtype::model::Date>,
7916        {
7917            self.deprecation_date = v.map(|x| x.into());
7918            self
7919        }
7920
7921        /// Sets the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
7922        pub fn set_decommission_date<T>(mut self, v: T) -> Self
7923        where
7924            T: std::convert::Into<gtype::model::Date>,
7925        {
7926            self.decommission_date = std::option::Option::Some(v.into());
7927            self
7928        }
7929
7930        /// Sets or clears the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
7931        pub fn set_or_clear_decommission_date<T>(mut self, v: std::option::Option<T>) -> Self
7932        where
7933            T: std::convert::Into<gtype::model::Date>,
7934        {
7935            self.decommission_date = v.map(|x| x.into());
7936            self
7937        }
7938    }
7939
7940    impl wkt::message::Message for Runtime {
7941        fn typename() -> &'static str {
7942            "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse.Runtime"
7943        }
7944    }
7945
7946    #[doc(hidden)]
7947    impl<'de> serde::de::Deserialize<'de> for Runtime {
7948        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7949        where
7950            D: serde::Deserializer<'de>,
7951        {
7952            #[allow(non_camel_case_types)]
7953            #[doc(hidden)]
7954            #[derive(PartialEq, Eq, Hash)]
7955            enum __FieldTag {
7956                __name,
7957                __display_name,
7958                __stage,
7959                __warnings,
7960                __environment,
7961                __deprecation_date,
7962                __decommission_date,
7963                Unknown(std::string::String),
7964            }
7965            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7966                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7967                where
7968                    D: serde::Deserializer<'de>,
7969                {
7970                    struct Visitor;
7971                    impl<'de> serde::de::Visitor<'de> for Visitor {
7972                        type Value = __FieldTag;
7973                        fn expecting(
7974                            &self,
7975                            formatter: &mut std::fmt::Formatter,
7976                        ) -> std::fmt::Result {
7977                            formatter.write_str("a field name for Runtime")
7978                        }
7979                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7980                        where
7981                            E: serde::de::Error,
7982                        {
7983                            use std::result::Result::Ok;
7984                            use std::string::ToString;
7985                            match value {
7986                                "name" => Ok(__FieldTag::__name),
7987                                "displayName" => Ok(__FieldTag::__display_name),
7988                                "display_name" => Ok(__FieldTag::__display_name),
7989                                "stage" => Ok(__FieldTag::__stage),
7990                                "warnings" => Ok(__FieldTag::__warnings),
7991                                "environment" => Ok(__FieldTag::__environment),
7992                                "deprecationDate" => Ok(__FieldTag::__deprecation_date),
7993                                "deprecation_date" => Ok(__FieldTag::__deprecation_date),
7994                                "decommissionDate" => Ok(__FieldTag::__decommission_date),
7995                                "decommission_date" => Ok(__FieldTag::__decommission_date),
7996                                _ => Ok(__FieldTag::Unknown(value.to_string())),
7997                            }
7998                        }
7999                    }
8000                    deserializer.deserialize_identifier(Visitor)
8001                }
8002            }
8003            struct Visitor;
8004            impl<'de> serde::de::Visitor<'de> for Visitor {
8005                type Value = Runtime;
8006                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8007                    formatter.write_str("struct Runtime")
8008                }
8009                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8010                where
8011                    A: serde::de::MapAccess<'de>,
8012                {
8013                    #[allow(unused_imports)]
8014                    use serde::de::Error;
8015                    use std::option::Option::Some;
8016                    let mut fields = std::collections::HashSet::new();
8017                    let mut result = Self::Value::new();
8018                    while let Some(tag) = map.next_key::<__FieldTag>()? {
8019                        #[allow(clippy::match_single_binding)]
8020                        match tag {
8021                            __FieldTag::__name => {
8022                                if !fields.insert(__FieldTag::__name) {
8023                                    return std::result::Result::Err(A::Error::duplicate_field(
8024                                        "multiple values for name",
8025                                    ));
8026                                }
8027                                result.name = map
8028                                    .next_value::<std::option::Option<std::string::String>>()?
8029                                    .unwrap_or_default();
8030                            }
8031                            __FieldTag::__display_name => {
8032                                if !fields.insert(__FieldTag::__display_name) {
8033                                    return std::result::Result::Err(A::Error::duplicate_field(
8034                                        "multiple values for display_name",
8035                                    ));
8036                                }
8037                                result.display_name = map
8038                                    .next_value::<std::option::Option<std::string::String>>()?
8039                                    .unwrap_or_default();
8040                            }
8041                            __FieldTag::__stage => {
8042                                if !fields.insert(__FieldTag::__stage) {
8043                                    return std::result::Result::Err(A::Error::duplicate_field(
8044                                        "multiple values for stage",
8045                                    ));
8046                                }
8047                                result.stage = map
8048                                    .next_value::<std::option::Option<
8049                                        crate::model::list_runtimes_response::RuntimeStage,
8050                                    >>()?
8051                                    .unwrap_or_default();
8052                            }
8053                            __FieldTag::__warnings => {
8054                                if !fields.insert(__FieldTag::__warnings) {
8055                                    return std::result::Result::Err(A::Error::duplicate_field(
8056                                        "multiple values for warnings",
8057                                    ));
8058                                }
8059                                result.warnings = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8060                            }
8061                            __FieldTag::__environment => {
8062                                if !fields.insert(__FieldTag::__environment) {
8063                                    return std::result::Result::Err(A::Error::duplicate_field(
8064                                        "multiple values for environment",
8065                                    ));
8066                                }
8067                                result.environment = map
8068                                    .next_value::<std::option::Option<crate::model::Environment>>()?
8069                                    .unwrap_or_default();
8070                            }
8071                            __FieldTag::__deprecation_date => {
8072                                if !fields.insert(__FieldTag::__deprecation_date) {
8073                                    return std::result::Result::Err(A::Error::duplicate_field(
8074                                        "multiple values for deprecation_date",
8075                                    ));
8076                                }
8077                                result.deprecation_date =
8078                                    map.next_value::<std::option::Option<gtype::model::Date>>()?;
8079                            }
8080                            __FieldTag::__decommission_date => {
8081                                if !fields.insert(__FieldTag::__decommission_date) {
8082                                    return std::result::Result::Err(A::Error::duplicate_field(
8083                                        "multiple values for decommission_date",
8084                                    ));
8085                                }
8086                                result.decommission_date =
8087                                    map.next_value::<std::option::Option<gtype::model::Date>>()?;
8088                            }
8089                            __FieldTag::Unknown(key) => {
8090                                let value = map.next_value::<serde_json::Value>()?;
8091                                result._unknown_fields.insert(key, value);
8092                            }
8093                        }
8094                    }
8095                    std::result::Result::Ok(result)
8096                }
8097            }
8098            deserializer.deserialize_any(Visitor)
8099        }
8100    }
8101
8102    #[doc(hidden)]
8103    impl serde::ser::Serialize for Runtime {
8104        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8105        where
8106            S: serde::ser::Serializer,
8107        {
8108            use serde::ser::SerializeMap;
8109            #[allow(unused_imports)]
8110            use std::option::Option::Some;
8111            let mut state = serializer.serialize_map(std::option::Option::None)?;
8112            if !self.name.is_empty() {
8113                state.serialize_entry("name", &self.name)?;
8114            }
8115            if !self.display_name.is_empty() {
8116                state.serialize_entry("displayName", &self.display_name)?;
8117            }
8118            if !wkt::internal::is_default(&self.stage) {
8119                state.serialize_entry("stage", &self.stage)?;
8120            }
8121            if !self.warnings.is_empty() {
8122                state.serialize_entry("warnings", &self.warnings)?;
8123            }
8124            if !wkt::internal::is_default(&self.environment) {
8125                state.serialize_entry("environment", &self.environment)?;
8126            }
8127            if self.deprecation_date.is_some() {
8128                state.serialize_entry("deprecationDate", &self.deprecation_date)?;
8129            }
8130            if self.decommission_date.is_some() {
8131                state.serialize_entry("decommissionDate", &self.decommission_date)?;
8132            }
8133            if !self._unknown_fields.is_empty() {
8134                for (key, value) in self._unknown_fields.iter() {
8135                    state.serialize_entry(key, &value)?;
8136                }
8137            }
8138            state.end()
8139        }
8140    }
8141
8142    impl std::fmt::Debug for Runtime {
8143        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8144            let mut debug_struct = f.debug_struct("Runtime");
8145            debug_struct.field("name", &self.name);
8146            debug_struct.field("display_name", &self.display_name);
8147            debug_struct.field("stage", &self.stage);
8148            debug_struct.field("warnings", &self.warnings);
8149            debug_struct.field("environment", &self.environment);
8150            debug_struct.field("deprecation_date", &self.deprecation_date);
8151            debug_struct.field("decommission_date", &self.decommission_date);
8152            if !self._unknown_fields.is_empty() {
8153                debug_struct.field("_unknown_fields", &self._unknown_fields);
8154            }
8155            debug_struct.finish()
8156        }
8157    }
8158
8159    /// The various stages that a runtime can be in.
8160    ///
8161    /// # Working with unknown values
8162    ///
8163    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8164    /// additional enum variants at any time. Adding new variants is not considered
8165    /// a breaking change. Applications should write their code in anticipation of:
8166    ///
8167    /// - New values appearing in future releases of the client library, **and**
8168    /// - New values received dynamically, without application changes.
8169    ///
8170    /// Please consult the [Working with enums] section in the user guide for some
8171    /// guidelines.
8172    ///
8173    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8174    #[derive(Clone, Debug, PartialEq)]
8175    #[non_exhaustive]
8176    pub enum RuntimeStage {
8177        /// Not specified.
8178        Unspecified,
8179        /// The runtime is in development.
8180        Development,
8181        /// The runtime is in the Alpha stage.
8182        Alpha,
8183        /// The runtime is in the Beta stage.
8184        Beta,
8185        /// The runtime is generally available.
8186        Ga,
8187        /// The runtime is deprecated.
8188        Deprecated,
8189        /// The runtime is no longer supported.
8190        Decommissioned,
8191        /// If set, the enum was initialized with an unknown value.
8192        ///
8193        /// Applications can examine the value using [RuntimeStage::value] or
8194        /// [RuntimeStage::name].
8195        UnknownValue(runtime_stage::UnknownValue),
8196    }
8197
8198    #[doc(hidden)]
8199    pub mod runtime_stage {
8200        #[allow(unused_imports)]
8201        use super::*;
8202        #[derive(Clone, Debug, PartialEq)]
8203        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8204    }
8205
8206    impl RuntimeStage {
8207        /// Gets the enum value.
8208        ///
8209        /// Returns `None` if the enum contains an unknown value deserialized from
8210        /// the string representation of enums.
8211        pub fn value(&self) -> std::option::Option<i32> {
8212            match self {
8213                Self::Unspecified => std::option::Option::Some(0),
8214                Self::Development => std::option::Option::Some(1),
8215                Self::Alpha => std::option::Option::Some(2),
8216                Self::Beta => std::option::Option::Some(3),
8217                Self::Ga => std::option::Option::Some(4),
8218                Self::Deprecated => std::option::Option::Some(5),
8219                Self::Decommissioned => std::option::Option::Some(6),
8220                Self::UnknownValue(u) => u.0.value(),
8221            }
8222        }
8223
8224        /// Gets the enum value as a string.
8225        ///
8226        /// Returns `None` if the enum contains an unknown value deserialized from
8227        /// the integer representation of enums.
8228        pub fn name(&self) -> std::option::Option<&str> {
8229            match self {
8230                Self::Unspecified => std::option::Option::Some("RUNTIME_STAGE_UNSPECIFIED"),
8231                Self::Development => std::option::Option::Some("DEVELOPMENT"),
8232                Self::Alpha => std::option::Option::Some("ALPHA"),
8233                Self::Beta => std::option::Option::Some("BETA"),
8234                Self::Ga => std::option::Option::Some("GA"),
8235                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
8236                Self::Decommissioned => std::option::Option::Some("DECOMMISSIONED"),
8237                Self::UnknownValue(u) => u.0.name(),
8238            }
8239        }
8240    }
8241
8242    impl std::default::Default for RuntimeStage {
8243        fn default() -> Self {
8244            use std::convert::From;
8245            Self::from(0)
8246        }
8247    }
8248
8249    impl std::fmt::Display for RuntimeStage {
8250        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8251            wkt::internal::display_enum(f, self.name(), self.value())
8252        }
8253    }
8254
8255    impl std::convert::From<i32> for RuntimeStage {
8256        fn from(value: i32) -> Self {
8257            match value {
8258                0 => Self::Unspecified,
8259                1 => Self::Development,
8260                2 => Self::Alpha,
8261                3 => Self::Beta,
8262                4 => Self::Ga,
8263                5 => Self::Deprecated,
8264                6 => Self::Decommissioned,
8265                _ => Self::UnknownValue(runtime_stage::UnknownValue(
8266                    wkt::internal::UnknownEnumValue::Integer(value),
8267                )),
8268            }
8269        }
8270    }
8271
8272    impl std::convert::From<&str> for RuntimeStage {
8273        fn from(value: &str) -> Self {
8274            use std::string::ToString;
8275            match value {
8276                "RUNTIME_STAGE_UNSPECIFIED" => Self::Unspecified,
8277                "DEVELOPMENT" => Self::Development,
8278                "ALPHA" => Self::Alpha,
8279                "BETA" => Self::Beta,
8280                "GA" => Self::Ga,
8281                "DEPRECATED" => Self::Deprecated,
8282                "DECOMMISSIONED" => Self::Decommissioned,
8283                _ => Self::UnknownValue(runtime_stage::UnknownValue(
8284                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8285                )),
8286            }
8287        }
8288    }
8289
8290    impl serde::ser::Serialize for RuntimeStage {
8291        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8292        where
8293            S: serde::Serializer,
8294        {
8295            match self {
8296                Self::Unspecified => serializer.serialize_i32(0),
8297                Self::Development => serializer.serialize_i32(1),
8298                Self::Alpha => serializer.serialize_i32(2),
8299                Self::Beta => serializer.serialize_i32(3),
8300                Self::Ga => serializer.serialize_i32(4),
8301                Self::Deprecated => serializer.serialize_i32(5),
8302                Self::Decommissioned => serializer.serialize_i32(6),
8303                Self::UnknownValue(u) => u.0.serialize(serializer),
8304            }
8305        }
8306    }
8307
8308    impl<'de> serde::de::Deserialize<'de> for RuntimeStage {
8309        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8310        where
8311            D: serde::Deserializer<'de>,
8312        {
8313            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuntimeStage>::new(
8314                ".google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage",
8315            ))
8316        }
8317    }
8318}
8319
8320/// Security patches are applied automatically to the runtime without requiring
8321/// the function to be redeployed.
8322#[derive(Clone, Default, PartialEq)]
8323#[non_exhaustive]
8324pub struct AutomaticUpdatePolicy {
8325    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8326}
8327
8328impl AutomaticUpdatePolicy {
8329    pub fn new() -> Self {
8330        std::default::Default::default()
8331    }
8332}
8333
8334impl wkt::message::Message for AutomaticUpdatePolicy {
8335    fn typename() -> &'static str {
8336        "type.googleapis.com/google.cloud.functions.v2.AutomaticUpdatePolicy"
8337    }
8338}
8339
8340#[doc(hidden)]
8341impl<'de> serde::de::Deserialize<'de> for AutomaticUpdatePolicy {
8342    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8343    where
8344        D: serde::Deserializer<'de>,
8345    {
8346        #[allow(non_camel_case_types)]
8347        #[doc(hidden)]
8348        #[derive(PartialEq, Eq, Hash)]
8349        enum __FieldTag {
8350            Unknown(std::string::String),
8351        }
8352        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8353            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8354            where
8355                D: serde::Deserializer<'de>,
8356            {
8357                struct Visitor;
8358                impl<'de> serde::de::Visitor<'de> for Visitor {
8359                    type Value = __FieldTag;
8360                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8361                        formatter.write_str("a field name for AutomaticUpdatePolicy")
8362                    }
8363                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8364                    where
8365                        E: serde::de::Error,
8366                    {
8367                        use std::result::Result::Ok;
8368                        use std::string::ToString;
8369                        Ok(__FieldTag::Unknown(value.to_string()))
8370                    }
8371                }
8372                deserializer.deserialize_identifier(Visitor)
8373            }
8374        }
8375        struct Visitor;
8376        impl<'de> serde::de::Visitor<'de> for Visitor {
8377            type Value = AutomaticUpdatePolicy;
8378            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8379                formatter.write_str("struct AutomaticUpdatePolicy")
8380            }
8381            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8382            where
8383                A: serde::de::MapAccess<'de>,
8384            {
8385                #[allow(unused_imports)]
8386                use serde::de::Error;
8387                use std::option::Option::Some;
8388                let mut result = Self::Value::new();
8389                while let Some(tag) = map.next_key::<__FieldTag>()? {
8390                    #[allow(clippy::match_single_binding)]
8391                    match tag {
8392                        __FieldTag::Unknown(key) => {
8393                            let value = map.next_value::<serde_json::Value>()?;
8394                            result._unknown_fields.insert(key, value);
8395                        }
8396                    }
8397                }
8398                std::result::Result::Ok(result)
8399            }
8400        }
8401        deserializer.deserialize_any(Visitor)
8402    }
8403}
8404
8405#[doc(hidden)]
8406impl serde::ser::Serialize for AutomaticUpdatePolicy {
8407    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8408    where
8409        S: serde::ser::Serializer,
8410    {
8411        use serde::ser::SerializeMap;
8412        #[allow(unused_imports)]
8413        use std::option::Option::Some;
8414        let mut state = serializer.serialize_map(std::option::Option::None)?;
8415        if !self._unknown_fields.is_empty() {
8416            for (key, value) in self._unknown_fields.iter() {
8417                state.serialize_entry(key, &value)?;
8418            }
8419        }
8420        state.end()
8421    }
8422}
8423
8424impl std::fmt::Debug for AutomaticUpdatePolicy {
8425    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8426        let mut debug_struct = f.debug_struct("AutomaticUpdatePolicy");
8427        if !self._unknown_fields.is_empty() {
8428            debug_struct.field("_unknown_fields", &self._unknown_fields);
8429        }
8430        debug_struct.finish()
8431    }
8432}
8433
8434/// Security patches are only applied when a function is redeployed.
8435#[derive(Clone, Default, PartialEq)]
8436#[non_exhaustive]
8437pub struct OnDeployUpdatePolicy {
8438    /// Output only. contains the runtime version which was used during latest
8439    /// function deployment.
8440    pub runtime_version: std::string::String,
8441
8442    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8443}
8444
8445impl OnDeployUpdatePolicy {
8446    pub fn new() -> Self {
8447        std::default::Default::default()
8448    }
8449
8450    /// Sets the value of [runtime_version][crate::model::OnDeployUpdatePolicy::runtime_version].
8451    pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8452        self.runtime_version = v.into();
8453        self
8454    }
8455}
8456
8457impl wkt::message::Message for OnDeployUpdatePolicy {
8458    fn typename() -> &'static str {
8459        "type.googleapis.com/google.cloud.functions.v2.OnDeployUpdatePolicy"
8460    }
8461}
8462
8463#[doc(hidden)]
8464impl<'de> serde::de::Deserialize<'de> for OnDeployUpdatePolicy {
8465    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8466    where
8467        D: serde::Deserializer<'de>,
8468    {
8469        #[allow(non_camel_case_types)]
8470        #[doc(hidden)]
8471        #[derive(PartialEq, Eq, Hash)]
8472        enum __FieldTag {
8473            __runtime_version,
8474            Unknown(std::string::String),
8475        }
8476        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8477            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8478            where
8479                D: serde::Deserializer<'de>,
8480            {
8481                struct Visitor;
8482                impl<'de> serde::de::Visitor<'de> for Visitor {
8483                    type Value = __FieldTag;
8484                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8485                        formatter.write_str("a field name for OnDeployUpdatePolicy")
8486                    }
8487                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8488                    where
8489                        E: serde::de::Error,
8490                    {
8491                        use std::result::Result::Ok;
8492                        use std::string::ToString;
8493                        match value {
8494                            "runtimeVersion" => Ok(__FieldTag::__runtime_version),
8495                            "runtime_version" => Ok(__FieldTag::__runtime_version),
8496                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8497                        }
8498                    }
8499                }
8500                deserializer.deserialize_identifier(Visitor)
8501            }
8502        }
8503        struct Visitor;
8504        impl<'de> serde::de::Visitor<'de> for Visitor {
8505            type Value = OnDeployUpdatePolicy;
8506            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8507                formatter.write_str("struct OnDeployUpdatePolicy")
8508            }
8509            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8510            where
8511                A: serde::de::MapAccess<'de>,
8512            {
8513                #[allow(unused_imports)]
8514                use serde::de::Error;
8515                use std::option::Option::Some;
8516                let mut fields = std::collections::HashSet::new();
8517                let mut result = Self::Value::new();
8518                while let Some(tag) = map.next_key::<__FieldTag>()? {
8519                    #[allow(clippy::match_single_binding)]
8520                    match tag {
8521                        __FieldTag::__runtime_version => {
8522                            if !fields.insert(__FieldTag::__runtime_version) {
8523                                return std::result::Result::Err(A::Error::duplicate_field(
8524                                    "multiple values for runtime_version",
8525                                ));
8526                            }
8527                            result.runtime_version = map
8528                                .next_value::<std::option::Option<std::string::String>>()?
8529                                .unwrap_or_default();
8530                        }
8531                        __FieldTag::Unknown(key) => {
8532                            let value = map.next_value::<serde_json::Value>()?;
8533                            result._unknown_fields.insert(key, value);
8534                        }
8535                    }
8536                }
8537                std::result::Result::Ok(result)
8538            }
8539        }
8540        deserializer.deserialize_any(Visitor)
8541    }
8542}
8543
8544#[doc(hidden)]
8545impl serde::ser::Serialize for OnDeployUpdatePolicy {
8546    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8547    where
8548        S: serde::ser::Serializer,
8549    {
8550        use serde::ser::SerializeMap;
8551        #[allow(unused_imports)]
8552        use std::option::Option::Some;
8553        let mut state = serializer.serialize_map(std::option::Option::None)?;
8554        if !self.runtime_version.is_empty() {
8555            state.serialize_entry("runtimeVersion", &self.runtime_version)?;
8556        }
8557        if !self._unknown_fields.is_empty() {
8558            for (key, value) in self._unknown_fields.iter() {
8559                state.serialize_entry(key, &value)?;
8560            }
8561        }
8562        state.end()
8563    }
8564}
8565
8566impl std::fmt::Debug for OnDeployUpdatePolicy {
8567    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8568        let mut debug_struct = f.debug_struct("OnDeployUpdatePolicy");
8569        debug_struct.field("runtime_version", &self.runtime_version);
8570        if !self._unknown_fields.is_empty() {
8571            debug_struct.field("_unknown_fields", &self._unknown_fields);
8572        }
8573        debug_struct.finish()
8574    }
8575}
8576
8577/// Represents the metadata of the long-running operation.
8578#[derive(Clone, Default, PartialEq)]
8579#[non_exhaustive]
8580pub struct OperationMetadata {
8581    /// The time the operation was created.
8582    pub create_time: std::option::Option<wkt::Timestamp>,
8583
8584    /// The time the operation finished running.
8585    pub end_time: std::option::Option<wkt::Timestamp>,
8586
8587    /// Server-defined resource path for the target of the operation.
8588    pub target: std::string::String,
8589
8590    /// Name of the verb executed by the operation.
8591    pub verb: std::string::String,
8592
8593    /// Human-readable status of the operation, if any.
8594    pub status_detail: std::string::String,
8595
8596    /// Identifies whether the user has requested cancellation
8597    /// of the operation. Operations that have successfully been cancelled
8598    /// have
8599    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
8600    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
8601    /// corresponding to `Code.CANCELLED`.
8602    ///
8603    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
8604    /// [google.rpc.Status.code]: rpc::model::Status::code
8605    pub cancel_requested: bool,
8606
8607    /// API version used to start the operation.
8608    pub api_version: std::string::String,
8609
8610    /// The original request that started the operation.
8611    pub request_resource: std::option::Option<wkt::Any>,
8612
8613    /// Mechanism for reporting in-progress stages
8614    pub stages: std::vec::Vec<crate::model::Stage>,
8615
8616    /// An identifier for Firebase function sources. Disclaimer: This field is only
8617    /// supported for Firebase function deployments.
8618    pub source_token: std::string::String,
8619
8620    /// The build name of the function for create and update operations.
8621    pub build_name: std::string::String,
8622
8623    /// The operation type.
8624    pub operation_type: crate::model::OperationType,
8625
8626    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8627}
8628
8629impl OperationMetadata {
8630    pub fn new() -> Self {
8631        std::default::Default::default()
8632    }
8633
8634    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
8635    pub fn set_create_time<T>(mut self, v: T) -> Self
8636    where
8637        T: std::convert::Into<wkt::Timestamp>,
8638    {
8639        self.create_time = std::option::Option::Some(v.into());
8640        self
8641    }
8642
8643    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
8644    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8645    where
8646        T: std::convert::Into<wkt::Timestamp>,
8647    {
8648        self.create_time = v.map(|x| x.into());
8649        self
8650    }
8651
8652    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
8653    pub fn set_end_time<T>(mut self, v: T) -> Self
8654    where
8655        T: std::convert::Into<wkt::Timestamp>,
8656    {
8657        self.end_time = std::option::Option::Some(v.into());
8658        self
8659    }
8660
8661    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
8662    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8663    where
8664        T: std::convert::Into<wkt::Timestamp>,
8665    {
8666        self.end_time = v.map(|x| x.into());
8667        self
8668    }
8669
8670    /// Sets the value of [target][crate::model::OperationMetadata::target].
8671    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8672        self.target = v.into();
8673        self
8674    }
8675
8676    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
8677    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8678        self.verb = v.into();
8679        self
8680    }
8681
8682    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
8683    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8684        self.status_detail = v.into();
8685        self
8686    }
8687
8688    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
8689    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8690        self.cancel_requested = v.into();
8691        self
8692    }
8693
8694    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
8695    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8696        self.api_version = v.into();
8697        self
8698    }
8699
8700    /// Sets the value of [request_resource][crate::model::OperationMetadata::request_resource].
8701    pub fn set_request_resource<T>(mut self, v: T) -> Self
8702    where
8703        T: std::convert::Into<wkt::Any>,
8704    {
8705        self.request_resource = std::option::Option::Some(v.into());
8706        self
8707    }
8708
8709    /// Sets or clears the value of [request_resource][crate::model::OperationMetadata::request_resource].
8710    pub fn set_or_clear_request_resource<T>(mut self, v: std::option::Option<T>) -> Self
8711    where
8712        T: std::convert::Into<wkt::Any>,
8713    {
8714        self.request_resource = v.map(|x| x.into());
8715        self
8716    }
8717
8718    /// Sets the value of [stages][crate::model::OperationMetadata::stages].
8719    pub fn set_stages<T, V>(mut self, v: T) -> Self
8720    where
8721        T: std::iter::IntoIterator<Item = V>,
8722        V: std::convert::Into<crate::model::Stage>,
8723    {
8724        use std::iter::Iterator;
8725        self.stages = v.into_iter().map(|i| i.into()).collect();
8726        self
8727    }
8728
8729    /// Sets the value of [source_token][crate::model::OperationMetadata::source_token].
8730    pub fn set_source_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8731        self.source_token = v.into();
8732        self
8733    }
8734
8735    /// Sets the value of [build_name][crate::model::OperationMetadata::build_name].
8736    pub fn set_build_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8737        self.build_name = v.into();
8738        self
8739    }
8740
8741    /// Sets the value of [operation_type][crate::model::OperationMetadata::operation_type].
8742    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
8743        mut self,
8744        v: T,
8745    ) -> Self {
8746        self.operation_type = v.into();
8747        self
8748    }
8749}
8750
8751impl wkt::message::Message for OperationMetadata {
8752    fn typename() -> &'static str {
8753        "type.googleapis.com/google.cloud.functions.v2.OperationMetadata"
8754    }
8755}
8756
8757#[doc(hidden)]
8758impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
8759    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8760    where
8761        D: serde::Deserializer<'de>,
8762    {
8763        #[allow(non_camel_case_types)]
8764        #[doc(hidden)]
8765        #[derive(PartialEq, Eq, Hash)]
8766        enum __FieldTag {
8767            __create_time,
8768            __end_time,
8769            __target,
8770            __verb,
8771            __status_detail,
8772            __cancel_requested,
8773            __api_version,
8774            __request_resource,
8775            __stages,
8776            __source_token,
8777            __build_name,
8778            __operation_type,
8779            Unknown(std::string::String),
8780        }
8781        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8782            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8783            where
8784                D: serde::Deserializer<'de>,
8785            {
8786                struct Visitor;
8787                impl<'de> serde::de::Visitor<'de> for Visitor {
8788                    type Value = __FieldTag;
8789                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8790                        formatter.write_str("a field name for OperationMetadata")
8791                    }
8792                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8793                    where
8794                        E: serde::de::Error,
8795                    {
8796                        use std::result::Result::Ok;
8797                        use std::string::ToString;
8798                        match value {
8799                            "createTime" => Ok(__FieldTag::__create_time),
8800                            "create_time" => Ok(__FieldTag::__create_time),
8801                            "endTime" => Ok(__FieldTag::__end_time),
8802                            "end_time" => Ok(__FieldTag::__end_time),
8803                            "target" => Ok(__FieldTag::__target),
8804                            "verb" => Ok(__FieldTag::__verb),
8805                            "statusDetail" => Ok(__FieldTag::__status_detail),
8806                            "status_detail" => Ok(__FieldTag::__status_detail),
8807                            "cancelRequested" => Ok(__FieldTag::__cancel_requested),
8808                            "cancel_requested" => Ok(__FieldTag::__cancel_requested),
8809                            "apiVersion" => Ok(__FieldTag::__api_version),
8810                            "api_version" => Ok(__FieldTag::__api_version),
8811                            "requestResource" => Ok(__FieldTag::__request_resource),
8812                            "request_resource" => Ok(__FieldTag::__request_resource),
8813                            "stages" => Ok(__FieldTag::__stages),
8814                            "sourceToken" => Ok(__FieldTag::__source_token),
8815                            "source_token" => Ok(__FieldTag::__source_token),
8816                            "buildName" => Ok(__FieldTag::__build_name),
8817                            "build_name" => Ok(__FieldTag::__build_name),
8818                            "operationType" => Ok(__FieldTag::__operation_type),
8819                            "operation_type" => Ok(__FieldTag::__operation_type),
8820                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8821                        }
8822                    }
8823                }
8824                deserializer.deserialize_identifier(Visitor)
8825            }
8826        }
8827        struct Visitor;
8828        impl<'de> serde::de::Visitor<'de> for Visitor {
8829            type Value = OperationMetadata;
8830            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8831                formatter.write_str("struct OperationMetadata")
8832            }
8833            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8834            where
8835                A: serde::de::MapAccess<'de>,
8836            {
8837                #[allow(unused_imports)]
8838                use serde::de::Error;
8839                use std::option::Option::Some;
8840                let mut fields = std::collections::HashSet::new();
8841                let mut result = Self::Value::new();
8842                while let Some(tag) = map.next_key::<__FieldTag>()? {
8843                    #[allow(clippy::match_single_binding)]
8844                    match tag {
8845                        __FieldTag::__create_time => {
8846                            if !fields.insert(__FieldTag::__create_time) {
8847                                return std::result::Result::Err(A::Error::duplicate_field(
8848                                    "multiple values for create_time",
8849                                ));
8850                            }
8851                            result.create_time =
8852                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8853                        }
8854                        __FieldTag::__end_time => {
8855                            if !fields.insert(__FieldTag::__end_time) {
8856                                return std::result::Result::Err(A::Error::duplicate_field(
8857                                    "multiple values for end_time",
8858                                ));
8859                            }
8860                            result.end_time =
8861                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8862                        }
8863                        __FieldTag::__target => {
8864                            if !fields.insert(__FieldTag::__target) {
8865                                return std::result::Result::Err(A::Error::duplicate_field(
8866                                    "multiple values for target",
8867                                ));
8868                            }
8869                            result.target = map
8870                                .next_value::<std::option::Option<std::string::String>>()?
8871                                .unwrap_or_default();
8872                        }
8873                        __FieldTag::__verb => {
8874                            if !fields.insert(__FieldTag::__verb) {
8875                                return std::result::Result::Err(A::Error::duplicate_field(
8876                                    "multiple values for verb",
8877                                ));
8878                            }
8879                            result.verb = map
8880                                .next_value::<std::option::Option<std::string::String>>()?
8881                                .unwrap_or_default();
8882                        }
8883                        __FieldTag::__status_detail => {
8884                            if !fields.insert(__FieldTag::__status_detail) {
8885                                return std::result::Result::Err(A::Error::duplicate_field(
8886                                    "multiple values for status_detail",
8887                                ));
8888                            }
8889                            result.status_detail = map
8890                                .next_value::<std::option::Option<std::string::String>>()?
8891                                .unwrap_or_default();
8892                        }
8893                        __FieldTag::__cancel_requested => {
8894                            if !fields.insert(__FieldTag::__cancel_requested) {
8895                                return std::result::Result::Err(A::Error::duplicate_field(
8896                                    "multiple values for cancel_requested",
8897                                ));
8898                            }
8899                            result.cancel_requested = map
8900                                .next_value::<std::option::Option<bool>>()?
8901                                .unwrap_or_default();
8902                        }
8903                        __FieldTag::__api_version => {
8904                            if !fields.insert(__FieldTag::__api_version) {
8905                                return std::result::Result::Err(A::Error::duplicate_field(
8906                                    "multiple values for api_version",
8907                                ));
8908                            }
8909                            result.api_version = map
8910                                .next_value::<std::option::Option<std::string::String>>()?
8911                                .unwrap_or_default();
8912                        }
8913                        __FieldTag::__request_resource => {
8914                            if !fields.insert(__FieldTag::__request_resource) {
8915                                return std::result::Result::Err(A::Error::duplicate_field(
8916                                    "multiple values for request_resource",
8917                                ));
8918                            }
8919                            result.request_resource =
8920                                map.next_value::<std::option::Option<wkt::Any>>()?;
8921                        }
8922                        __FieldTag::__stages => {
8923                            if !fields.insert(__FieldTag::__stages) {
8924                                return std::result::Result::Err(A::Error::duplicate_field(
8925                                    "multiple values for stages",
8926                                ));
8927                            }
8928                            result.stages = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Stage>>>()?.unwrap_or_default();
8929                        }
8930                        __FieldTag::__source_token => {
8931                            if !fields.insert(__FieldTag::__source_token) {
8932                                return std::result::Result::Err(A::Error::duplicate_field(
8933                                    "multiple values for source_token",
8934                                ));
8935                            }
8936                            result.source_token = map
8937                                .next_value::<std::option::Option<std::string::String>>()?
8938                                .unwrap_or_default();
8939                        }
8940                        __FieldTag::__build_name => {
8941                            if !fields.insert(__FieldTag::__build_name) {
8942                                return std::result::Result::Err(A::Error::duplicate_field(
8943                                    "multiple values for build_name",
8944                                ));
8945                            }
8946                            result.build_name = map
8947                                .next_value::<std::option::Option<std::string::String>>()?
8948                                .unwrap_or_default();
8949                        }
8950                        __FieldTag::__operation_type => {
8951                            if !fields.insert(__FieldTag::__operation_type) {
8952                                return std::result::Result::Err(A::Error::duplicate_field(
8953                                    "multiple values for operation_type",
8954                                ));
8955                            }
8956                            result.operation_type = map
8957                                .next_value::<std::option::Option<crate::model::OperationType>>()?
8958                                .unwrap_or_default();
8959                        }
8960                        __FieldTag::Unknown(key) => {
8961                            let value = map.next_value::<serde_json::Value>()?;
8962                            result._unknown_fields.insert(key, value);
8963                        }
8964                    }
8965                }
8966                std::result::Result::Ok(result)
8967            }
8968        }
8969        deserializer.deserialize_any(Visitor)
8970    }
8971}
8972
8973#[doc(hidden)]
8974impl serde::ser::Serialize for OperationMetadata {
8975    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8976    where
8977        S: serde::ser::Serializer,
8978    {
8979        use serde::ser::SerializeMap;
8980        #[allow(unused_imports)]
8981        use std::option::Option::Some;
8982        let mut state = serializer.serialize_map(std::option::Option::None)?;
8983        if self.create_time.is_some() {
8984            state.serialize_entry("createTime", &self.create_time)?;
8985        }
8986        if self.end_time.is_some() {
8987            state.serialize_entry("endTime", &self.end_time)?;
8988        }
8989        if !self.target.is_empty() {
8990            state.serialize_entry("target", &self.target)?;
8991        }
8992        if !self.verb.is_empty() {
8993            state.serialize_entry("verb", &self.verb)?;
8994        }
8995        if !self.status_detail.is_empty() {
8996            state.serialize_entry("statusDetail", &self.status_detail)?;
8997        }
8998        if !wkt::internal::is_default(&self.cancel_requested) {
8999            state.serialize_entry("cancelRequested", &self.cancel_requested)?;
9000        }
9001        if !self.api_version.is_empty() {
9002            state.serialize_entry("apiVersion", &self.api_version)?;
9003        }
9004        if self.request_resource.is_some() {
9005            state.serialize_entry("requestResource", &self.request_resource)?;
9006        }
9007        if !self.stages.is_empty() {
9008            state.serialize_entry("stages", &self.stages)?;
9009        }
9010        if !self.source_token.is_empty() {
9011            state.serialize_entry("sourceToken", &self.source_token)?;
9012        }
9013        if !self.build_name.is_empty() {
9014            state.serialize_entry("buildName", &self.build_name)?;
9015        }
9016        if !wkt::internal::is_default(&self.operation_type) {
9017            state.serialize_entry("operationType", &self.operation_type)?;
9018        }
9019        if !self._unknown_fields.is_empty() {
9020            for (key, value) in self._unknown_fields.iter() {
9021                state.serialize_entry(key, &value)?;
9022            }
9023        }
9024        state.end()
9025    }
9026}
9027
9028impl std::fmt::Debug for OperationMetadata {
9029    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9030        let mut debug_struct = f.debug_struct("OperationMetadata");
9031        debug_struct.field("create_time", &self.create_time);
9032        debug_struct.field("end_time", &self.end_time);
9033        debug_struct.field("target", &self.target);
9034        debug_struct.field("verb", &self.verb);
9035        debug_struct.field("status_detail", &self.status_detail);
9036        debug_struct.field("cancel_requested", &self.cancel_requested);
9037        debug_struct.field("api_version", &self.api_version);
9038        debug_struct.field("request_resource", &self.request_resource);
9039        debug_struct.field("stages", &self.stages);
9040        debug_struct.field("source_token", &self.source_token);
9041        debug_struct.field("build_name", &self.build_name);
9042        debug_struct.field("operation_type", &self.operation_type);
9043        if !self._unknown_fields.is_empty() {
9044            debug_struct.field("_unknown_fields", &self._unknown_fields);
9045        }
9046        debug_struct.finish()
9047    }
9048}
9049
9050/// Extra GCF specific location information.
9051#[derive(Clone, Default, PartialEq)]
9052#[non_exhaustive]
9053pub struct LocationMetadata {
9054    /// The Cloud Function environments this location supports.
9055    pub environments: std::vec::Vec<crate::model::Environment>,
9056
9057    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9058}
9059
9060impl LocationMetadata {
9061    pub fn new() -> Self {
9062        std::default::Default::default()
9063    }
9064
9065    /// Sets the value of [environments][crate::model::LocationMetadata::environments].
9066    pub fn set_environments<T, V>(mut self, v: T) -> Self
9067    where
9068        T: std::iter::IntoIterator<Item = V>,
9069        V: std::convert::Into<crate::model::Environment>,
9070    {
9071        use std::iter::Iterator;
9072        self.environments = v.into_iter().map(|i| i.into()).collect();
9073        self
9074    }
9075}
9076
9077impl wkt::message::Message for LocationMetadata {
9078    fn typename() -> &'static str {
9079        "type.googleapis.com/google.cloud.functions.v2.LocationMetadata"
9080    }
9081}
9082
9083#[doc(hidden)]
9084impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
9085    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9086    where
9087        D: serde::Deserializer<'de>,
9088    {
9089        #[allow(non_camel_case_types)]
9090        #[doc(hidden)]
9091        #[derive(PartialEq, Eq, Hash)]
9092        enum __FieldTag {
9093            __environments,
9094            Unknown(std::string::String),
9095        }
9096        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9097            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9098            where
9099                D: serde::Deserializer<'de>,
9100            {
9101                struct Visitor;
9102                impl<'de> serde::de::Visitor<'de> for Visitor {
9103                    type Value = __FieldTag;
9104                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9105                        formatter.write_str("a field name for LocationMetadata")
9106                    }
9107                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9108                    where
9109                        E: serde::de::Error,
9110                    {
9111                        use std::result::Result::Ok;
9112                        use std::string::ToString;
9113                        match value {
9114                            "environments" => Ok(__FieldTag::__environments),
9115                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9116                        }
9117                    }
9118                }
9119                deserializer.deserialize_identifier(Visitor)
9120            }
9121        }
9122        struct Visitor;
9123        impl<'de> serde::de::Visitor<'de> for Visitor {
9124            type Value = LocationMetadata;
9125            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9126                formatter.write_str("struct LocationMetadata")
9127            }
9128            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9129            where
9130                A: serde::de::MapAccess<'de>,
9131            {
9132                #[allow(unused_imports)]
9133                use serde::de::Error;
9134                use std::option::Option::Some;
9135                let mut fields = std::collections::HashSet::new();
9136                let mut result = Self::Value::new();
9137                while let Some(tag) = map.next_key::<__FieldTag>()? {
9138                    #[allow(clippy::match_single_binding)]
9139                    match tag {
9140                        __FieldTag::__environments => {
9141                            if !fields.insert(__FieldTag::__environments) {
9142                                return std::result::Result::Err(A::Error::duplicate_field(
9143                                    "multiple values for environments",
9144                                ));
9145                            }
9146                            result.environments = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Environment>>>()?.unwrap_or_default();
9147                        }
9148                        __FieldTag::Unknown(key) => {
9149                            let value = map.next_value::<serde_json::Value>()?;
9150                            result._unknown_fields.insert(key, value);
9151                        }
9152                    }
9153                }
9154                std::result::Result::Ok(result)
9155            }
9156        }
9157        deserializer.deserialize_any(Visitor)
9158    }
9159}
9160
9161#[doc(hidden)]
9162impl serde::ser::Serialize for LocationMetadata {
9163    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9164    where
9165        S: serde::ser::Serializer,
9166    {
9167        use serde::ser::SerializeMap;
9168        #[allow(unused_imports)]
9169        use std::option::Option::Some;
9170        let mut state = serializer.serialize_map(std::option::Option::None)?;
9171        if !self.environments.is_empty() {
9172            state.serialize_entry("environments", &self.environments)?;
9173        }
9174        if !self._unknown_fields.is_empty() {
9175            for (key, value) in self._unknown_fields.iter() {
9176                state.serialize_entry(key, &value)?;
9177            }
9178        }
9179        state.end()
9180    }
9181}
9182
9183impl std::fmt::Debug for LocationMetadata {
9184    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9185        let mut debug_struct = f.debug_struct("LocationMetadata");
9186        debug_struct.field("environments", &self.environments);
9187        if !self._unknown_fields.is_empty() {
9188            debug_struct.field("_unknown_fields", &self._unknown_fields);
9189        }
9190        debug_struct.finish()
9191    }
9192}
9193
9194/// Each Stage of the deployment process
9195#[derive(Clone, Default, PartialEq)]
9196#[non_exhaustive]
9197pub struct Stage {
9198    /// Name of the Stage. This will be unique for each Stage.
9199    pub name: crate::model::stage::Name,
9200
9201    /// Message describing the Stage
9202    pub message: std::string::String,
9203
9204    /// Current state of the Stage
9205    pub state: crate::model::stage::State,
9206
9207    /// Resource of the Stage
9208    pub resource: std::string::String,
9209
9210    /// Link to the current Stage resource
9211    pub resource_uri: std::string::String,
9212
9213    /// State messages from the current Stage.
9214    pub state_messages: std::vec::Vec<crate::model::StateMessage>,
9215
9216    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9217}
9218
9219impl Stage {
9220    pub fn new() -> Self {
9221        std::default::Default::default()
9222    }
9223
9224    /// Sets the value of [name][crate::model::Stage::name].
9225    pub fn set_name<T: std::convert::Into<crate::model::stage::Name>>(mut self, v: T) -> Self {
9226        self.name = v.into();
9227        self
9228    }
9229
9230    /// Sets the value of [message][crate::model::Stage::message].
9231    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9232        self.message = v.into();
9233        self
9234    }
9235
9236    /// Sets the value of [state][crate::model::Stage::state].
9237    pub fn set_state<T: std::convert::Into<crate::model::stage::State>>(mut self, v: T) -> Self {
9238        self.state = v.into();
9239        self
9240    }
9241
9242    /// Sets the value of [resource][crate::model::Stage::resource].
9243    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9244        self.resource = v.into();
9245        self
9246    }
9247
9248    /// Sets the value of [resource_uri][crate::model::Stage::resource_uri].
9249    pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9250        self.resource_uri = v.into();
9251        self
9252    }
9253
9254    /// Sets the value of [state_messages][crate::model::Stage::state_messages].
9255    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
9256    where
9257        T: std::iter::IntoIterator<Item = V>,
9258        V: std::convert::Into<crate::model::StateMessage>,
9259    {
9260        use std::iter::Iterator;
9261        self.state_messages = v.into_iter().map(|i| i.into()).collect();
9262        self
9263    }
9264}
9265
9266impl wkt::message::Message for Stage {
9267    fn typename() -> &'static str {
9268        "type.googleapis.com/google.cloud.functions.v2.Stage"
9269    }
9270}
9271
9272#[doc(hidden)]
9273impl<'de> serde::de::Deserialize<'de> for Stage {
9274    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9275    where
9276        D: serde::Deserializer<'de>,
9277    {
9278        #[allow(non_camel_case_types)]
9279        #[doc(hidden)]
9280        #[derive(PartialEq, Eq, Hash)]
9281        enum __FieldTag {
9282            __name,
9283            __message,
9284            __state,
9285            __resource,
9286            __resource_uri,
9287            __state_messages,
9288            Unknown(std::string::String),
9289        }
9290        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9291            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9292            where
9293                D: serde::Deserializer<'de>,
9294            {
9295                struct Visitor;
9296                impl<'de> serde::de::Visitor<'de> for Visitor {
9297                    type Value = __FieldTag;
9298                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9299                        formatter.write_str("a field name for Stage")
9300                    }
9301                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9302                    where
9303                        E: serde::de::Error,
9304                    {
9305                        use std::result::Result::Ok;
9306                        use std::string::ToString;
9307                        match value {
9308                            "name" => Ok(__FieldTag::__name),
9309                            "message" => Ok(__FieldTag::__message),
9310                            "state" => Ok(__FieldTag::__state),
9311                            "resource" => Ok(__FieldTag::__resource),
9312                            "resourceUri" => Ok(__FieldTag::__resource_uri),
9313                            "resource_uri" => Ok(__FieldTag::__resource_uri),
9314                            "stateMessages" => Ok(__FieldTag::__state_messages),
9315                            "state_messages" => Ok(__FieldTag::__state_messages),
9316                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9317                        }
9318                    }
9319                }
9320                deserializer.deserialize_identifier(Visitor)
9321            }
9322        }
9323        struct Visitor;
9324        impl<'de> serde::de::Visitor<'de> for Visitor {
9325            type Value = Stage;
9326            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9327                formatter.write_str("struct Stage")
9328            }
9329            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9330            where
9331                A: serde::de::MapAccess<'de>,
9332            {
9333                #[allow(unused_imports)]
9334                use serde::de::Error;
9335                use std::option::Option::Some;
9336                let mut fields = std::collections::HashSet::new();
9337                let mut result = Self::Value::new();
9338                while let Some(tag) = map.next_key::<__FieldTag>()? {
9339                    #[allow(clippy::match_single_binding)]
9340                    match tag {
9341                        __FieldTag::__name => {
9342                            if !fields.insert(__FieldTag::__name) {
9343                                return std::result::Result::Err(A::Error::duplicate_field(
9344                                    "multiple values for name",
9345                                ));
9346                            }
9347                            result.name = map
9348                                .next_value::<std::option::Option<crate::model::stage::Name>>()?
9349                                .unwrap_or_default();
9350                        }
9351                        __FieldTag::__message => {
9352                            if !fields.insert(__FieldTag::__message) {
9353                                return std::result::Result::Err(A::Error::duplicate_field(
9354                                    "multiple values for message",
9355                                ));
9356                            }
9357                            result.message = map
9358                                .next_value::<std::option::Option<std::string::String>>()?
9359                                .unwrap_or_default();
9360                        }
9361                        __FieldTag::__state => {
9362                            if !fields.insert(__FieldTag::__state) {
9363                                return std::result::Result::Err(A::Error::duplicate_field(
9364                                    "multiple values for state",
9365                                ));
9366                            }
9367                            result.state = map
9368                                .next_value::<std::option::Option<crate::model::stage::State>>()?
9369                                .unwrap_or_default();
9370                        }
9371                        __FieldTag::__resource => {
9372                            if !fields.insert(__FieldTag::__resource) {
9373                                return std::result::Result::Err(A::Error::duplicate_field(
9374                                    "multiple values for resource",
9375                                ));
9376                            }
9377                            result.resource = map
9378                                .next_value::<std::option::Option<std::string::String>>()?
9379                                .unwrap_or_default();
9380                        }
9381                        __FieldTag::__resource_uri => {
9382                            if !fields.insert(__FieldTag::__resource_uri) {
9383                                return std::result::Result::Err(A::Error::duplicate_field(
9384                                    "multiple values for resource_uri",
9385                                ));
9386                            }
9387                            result.resource_uri = map
9388                                .next_value::<std::option::Option<std::string::String>>()?
9389                                .unwrap_or_default();
9390                        }
9391                        __FieldTag::__state_messages => {
9392                            if !fields.insert(__FieldTag::__state_messages) {
9393                                return std::result::Result::Err(A::Error::duplicate_field(
9394                                    "multiple values for state_messages",
9395                                ));
9396                            }
9397                            result.state_messages = map.next_value::<std::option::Option<std::vec::Vec<crate::model::StateMessage>>>()?.unwrap_or_default();
9398                        }
9399                        __FieldTag::Unknown(key) => {
9400                            let value = map.next_value::<serde_json::Value>()?;
9401                            result._unknown_fields.insert(key, value);
9402                        }
9403                    }
9404                }
9405                std::result::Result::Ok(result)
9406            }
9407        }
9408        deserializer.deserialize_any(Visitor)
9409    }
9410}
9411
9412#[doc(hidden)]
9413impl serde::ser::Serialize for Stage {
9414    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9415    where
9416        S: serde::ser::Serializer,
9417    {
9418        use serde::ser::SerializeMap;
9419        #[allow(unused_imports)]
9420        use std::option::Option::Some;
9421        let mut state = serializer.serialize_map(std::option::Option::None)?;
9422        if !wkt::internal::is_default(&self.name) {
9423            state.serialize_entry("name", &self.name)?;
9424        }
9425        if !self.message.is_empty() {
9426            state.serialize_entry("message", &self.message)?;
9427        }
9428        if !wkt::internal::is_default(&self.state) {
9429            state.serialize_entry("state", &self.state)?;
9430        }
9431        if !self.resource.is_empty() {
9432            state.serialize_entry("resource", &self.resource)?;
9433        }
9434        if !self.resource_uri.is_empty() {
9435            state.serialize_entry("resourceUri", &self.resource_uri)?;
9436        }
9437        if !self.state_messages.is_empty() {
9438            state.serialize_entry("stateMessages", &self.state_messages)?;
9439        }
9440        if !self._unknown_fields.is_empty() {
9441            for (key, value) in self._unknown_fields.iter() {
9442                state.serialize_entry(key, &value)?;
9443            }
9444        }
9445        state.end()
9446    }
9447}
9448
9449impl std::fmt::Debug for Stage {
9450    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9451        let mut debug_struct = f.debug_struct("Stage");
9452        debug_struct.field("name", &self.name);
9453        debug_struct.field("message", &self.message);
9454        debug_struct.field("state", &self.state);
9455        debug_struct.field("resource", &self.resource);
9456        debug_struct.field("resource_uri", &self.resource_uri);
9457        debug_struct.field("state_messages", &self.state_messages);
9458        if !self._unknown_fields.is_empty() {
9459            debug_struct.field("_unknown_fields", &self._unknown_fields);
9460        }
9461        debug_struct.finish()
9462    }
9463}
9464
9465/// Defines additional types related to [Stage].
9466pub mod stage {
9467    #[allow(unused_imports)]
9468    use super::*;
9469
9470    /// Possible names for a Stage
9471    ///
9472    /// # Working with unknown values
9473    ///
9474    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9475    /// additional enum variants at any time. Adding new variants is not considered
9476    /// a breaking change. Applications should write their code in anticipation of:
9477    ///
9478    /// - New values appearing in future releases of the client library, **and**
9479    /// - New values received dynamically, without application changes.
9480    ///
9481    /// Please consult the [Working with enums] section in the user guide for some
9482    /// guidelines.
9483    ///
9484    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9485    #[derive(Clone, Debug, PartialEq)]
9486    #[non_exhaustive]
9487    pub enum Name {
9488        /// Not specified. Invalid name.
9489        Unspecified,
9490        /// Artifact Registry Stage
9491        ArtifactRegistry,
9492        /// Build Stage
9493        Build,
9494        /// Service Stage
9495        Service,
9496        /// Trigger Stage
9497        Trigger,
9498        /// Service Rollback Stage
9499        ServiceRollback,
9500        /// Trigger Rollback Stage
9501        TriggerRollback,
9502        /// If set, the enum was initialized with an unknown value.
9503        ///
9504        /// Applications can examine the value using [Name::value] or
9505        /// [Name::name].
9506        UnknownValue(name::UnknownValue),
9507    }
9508
9509    #[doc(hidden)]
9510    pub mod name {
9511        #[allow(unused_imports)]
9512        use super::*;
9513        #[derive(Clone, Debug, PartialEq)]
9514        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9515    }
9516
9517    impl Name {
9518        /// Gets the enum value.
9519        ///
9520        /// Returns `None` if the enum contains an unknown value deserialized from
9521        /// the string representation of enums.
9522        pub fn value(&self) -> std::option::Option<i32> {
9523            match self {
9524                Self::Unspecified => std::option::Option::Some(0),
9525                Self::ArtifactRegistry => std::option::Option::Some(1),
9526                Self::Build => std::option::Option::Some(2),
9527                Self::Service => std::option::Option::Some(3),
9528                Self::Trigger => std::option::Option::Some(4),
9529                Self::ServiceRollback => std::option::Option::Some(5),
9530                Self::TriggerRollback => std::option::Option::Some(6),
9531                Self::UnknownValue(u) => u.0.value(),
9532            }
9533        }
9534
9535        /// Gets the enum value as a string.
9536        ///
9537        /// Returns `None` if the enum contains an unknown value deserialized from
9538        /// the integer representation of enums.
9539        pub fn name(&self) -> std::option::Option<&str> {
9540            match self {
9541                Self::Unspecified => std::option::Option::Some("NAME_UNSPECIFIED"),
9542                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
9543                Self::Build => std::option::Option::Some("BUILD"),
9544                Self::Service => std::option::Option::Some("SERVICE"),
9545                Self::Trigger => std::option::Option::Some("TRIGGER"),
9546                Self::ServiceRollback => std::option::Option::Some("SERVICE_ROLLBACK"),
9547                Self::TriggerRollback => std::option::Option::Some("TRIGGER_ROLLBACK"),
9548                Self::UnknownValue(u) => u.0.name(),
9549            }
9550        }
9551    }
9552
9553    impl std::default::Default for Name {
9554        fn default() -> Self {
9555            use std::convert::From;
9556            Self::from(0)
9557        }
9558    }
9559
9560    impl std::fmt::Display for Name {
9561        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9562            wkt::internal::display_enum(f, self.name(), self.value())
9563        }
9564    }
9565
9566    impl std::convert::From<i32> for Name {
9567        fn from(value: i32) -> Self {
9568            match value {
9569                0 => Self::Unspecified,
9570                1 => Self::ArtifactRegistry,
9571                2 => Self::Build,
9572                3 => Self::Service,
9573                4 => Self::Trigger,
9574                5 => Self::ServiceRollback,
9575                6 => Self::TriggerRollback,
9576                _ => Self::UnknownValue(name::UnknownValue(
9577                    wkt::internal::UnknownEnumValue::Integer(value),
9578                )),
9579            }
9580        }
9581    }
9582
9583    impl std::convert::From<&str> for Name {
9584        fn from(value: &str) -> Self {
9585            use std::string::ToString;
9586            match value {
9587                "NAME_UNSPECIFIED" => Self::Unspecified,
9588                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
9589                "BUILD" => Self::Build,
9590                "SERVICE" => Self::Service,
9591                "TRIGGER" => Self::Trigger,
9592                "SERVICE_ROLLBACK" => Self::ServiceRollback,
9593                "TRIGGER_ROLLBACK" => Self::TriggerRollback,
9594                _ => Self::UnknownValue(name::UnknownValue(
9595                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9596                )),
9597            }
9598        }
9599    }
9600
9601    impl serde::ser::Serialize for Name {
9602        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9603        where
9604            S: serde::Serializer,
9605        {
9606            match self {
9607                Self::Unspecified => serializer.serialize_i32(0),
9608                Self::ArtifactRegistry => serializer.serialize_i32(1),
9609                Self::Build => serializer.serialize_i32(2),
9610                Self::Service => serializer.serialize_i32(3),
9611                Self::Trigger => serializer.serialize_i32(4),
9612                Self::ServiceRollback => serializer.serialize_i32(5),
9613                Self::TriggerRollback => serializer.serialize_i32(6),
9614                Self::UnknownValue(u) => u.0.serialize(serializer),
9615            }
9616        }
9617    }
9618
9619    impl<'de> serde::de::Deserialize<'de> for Name {
9620        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9621        where
9622            D: serde::Deserializer<'de>,
9623        {
9624            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Name>::new(
9625                ".google.cloud.functions.v2.Stage.Name",
9626            ))
9627        }
9628    }
9629
9630    /// Possible states for a Stage
9631    ///
9632    /// # Working with unknown values
9633    ///
9634    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9635    /// additional enum variants at any time. Adding new variants is not considered
9636    /// a breaking change. Applications should write their code in anticipation of:
9637    ///
9638    /// - New values appearing in future releases of the client library, **and**
9639    /// - New values received dynamically, without application changes.
9640    ///
9641    /// Please consult the [Working with enums] section in the user guide for some
9642    /// guidelines.
9643    ///
9644    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9645    #[derive(Clone, Debug, PartialEq)]
9646    #[non_exhaustive]
9647    pub enum State {
9648        /// Not specified. Invalid state.
9649        Unspecified,
9650        /// Stage has not started.
9651        NotStarted,
9652        /// Stage is in progress.
9653        InProgress,
9654        /// Stage has completed.
9655        Complete,
9656        /// If set, the enum was initialized with an unknown value.
9657        ///
9658        /// Applications can examine the value using [State::value] or
9659        /// [State::name].
9660        UnknownValue(state::UnknownValue),
9661    }
9662
9663    #[doc(hidden)]
9664    pub mod state {
9665        #[allow(unused_imports)]
9666        use super::*;
9667        #[derive(Clone, Debug, PartialEq)]
9668        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9669    }
9670
9671    impl State {
9672        /// Gets the enum value.
9673        ///
9674        /// Returns `None` if the enum contains an unknown value deserialized from
9675        /// the string representation of enums.
9676        pub fn value(&self) -> std::option::Option<i32> {
9677            match self {
9678                Self::Unspecified => std::option::Option::Some(0),
9679                Self::NotStarted => std::option::Option::Some(1),
9680                Self::InProgress => std::option::Option::Some(2),
9681                Self::Complete => std::option::Option::Some(3),
9682                Self::UnknownValue(u) => u.0.value(),
9683            }
9684        }
9685
9686        /// Gets the enum value as a string.
9687        ///
9688        /// Returns `None` if the enum contains an unknown value deserialized from
9689        /// the integer representation of enums.
9690        pub fn name(&self) -> std::option::Option<&str> {
9691            match self {
9692                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9693                Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
9694                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
9695                Self::Complete => std::option::Option::Some("COMPLETE"),
9696                Self::UnknownValue(u) => u.0.name(),
9697            }
9698        }
9699    }
9700
9701    impl std::default::Default for State {
9702        fn default() -> Self {
9703            use std::convert::From;
9704            Self::from(0)
9705        }
9706    }
9707
9708    impl std::fmt::Display for State {
9709        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9710            wkt::internal::display_enum(f, self.name(), self.value())
9711        }
9712    }
9713
9714    impl std::convert::From<i32> for State {
9715        fn from(value: i32) -> Self {
9716            match value {
9717                0 => Self::Unspecified,
9718                1 => Self::NotStarted,
9719                2 => Self::InProgress,
9720                3 => Self::Complete,
9721                _ => Self::UnknownValue(state::UnknownValue(
9722                    wkt::internal::UnknownEnumValue::Integer(value),
9723                )),
9724            }
9725        }
9726    }
9727
9728    impl std::convert::From<&str> for State {
9729        fn from(value: &str) -> Self {
9730            use std::string::ToString;
9731            match value {
9732                "STATE_UNSPECIFIED" => Self::Unspecified,
9733                "NOT_STARTED" => Self::NotStarted,
9734                "IN_PROGRESS" => Self::InProgress,
9735                "COMPLETE" => Self::Complete,
9736                _ => Self::UnknownValue(state::UnknownValue(
9737                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9738                )),
9739            }
9740        }
9741    }
9742
9743    impl serde::ser::Serialize for State {
9744        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9745        where
9746            S: serde::Serializer,
9747        {
9748            match self {
9749                Self::Unspecified => serializer.serialize_i32(0),
9750                Self::NotStarted => serializer.serialize_i32(1),
9751                Self::InProgress => serializer.serialize_i32(2),
9752                Self::Complete => serializer.serialize_i32(3),
9753                Self::UnknownValue(u) => u.0.serialize(serializer),
9754            }
9755        }
9756    }
9757
9758    impl<'de> serde::de::Deserialize<'de> for State {
9759        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9760        where
9761            D: serde::Deserializer<'de>,
9762        {
9763            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9764                ".google.cloud.functions.v2.Stage.State",
9765            ))
9766        }
9767    }
9768}
9769
9770/// The type of the long running operation.
9771///
9772/// # Working with unknown values
9773///
9774/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9775/// additional enum variants at any time. Adding new variants is not considered
9776/// a breaking change. Applications should write their code in anticipation of:
9777///
9778/// - New values appearing in future releases of the client library, **and**
9779/// - New values received dynamically, without application changes.
9780///
9781/// Please consult the [Working with enums] section in the user guide for some
9782/// guidelines.
9783///
9784/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9785#[derive(Clone, Debug, PartialEq)]
9786#[non_exhaustive]
9787pub enum OperationType {
9788    /// Unspecified
9789    OperationtypeUnspecified,
9790    /// CreateFunction
9791    CreateFunction,
9792    /// UpdateFunction
9793    UpdateFunction,
9794    /// DeleteFunction
9795    DeleteFunction,
9796    /// If set, the enum was initialized with an unknown value.
9797    ///
9798    /// Applications can examine the value using [OperationType::value] or
9799    /// [OperationType::name].
9800    UnknownValue(operation_type::UnknownValue),
9801}
9802
9803#[doc(hidden)]
9804pub mod operation_type {
9805    #[allow(unused_imports)]
9806    use super::*;
9807    #[derive(Clone, Debug, PartialEq)]
9808    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9809}
9810
9811impl OperationType {
9812    /// Gets the enum value.
9813    ///
9814    /// Returns `None` if the enum contains an unknown value deserialized from
9815    /// the string representation of enums.
9816    pub fn value(&self) -> std::option::Option<i32> {
9817        match self {
9818            Self::OperationtypeUnspecified => std::option::Option::Some(0),
9819            Self::CreateFunction => std::option::Option::Some(1),
9820            Self::UpdateFunction => std::option::Option::Some(2),
9821            Self::DeleteFunction => std::option::Option::Some(3),
9822            Self::UnknownValue(u) => u.0.value(),
9823        }
9824    }
9825
9826    /// Gets the enum value as a string.
9827    ///
9828    /// Returns `None` if the enum contains an unknown value deserialized from
9829    /// the integer representation of enums.
9830    pub fn name(&self) -> std::option::Option<&str> {
9831        match self {
9832            Self::OperationtypeUnspecified => {
9833                std::option::Option::Some("OPERATIONTYPE_UNSPECIFIED")
9834            }
9835            Self::CreateFunction => std::option::Option::Some("CREATE_FUNCTION"),
9836            Self::UpdateFunction => std::option::Option::Some("UPDATE_FUNCTION"),
9837            Self::DeleteFunction => std::option::Option::Some("DELETE_FUNCTION"),
9838            Self::UnknownValue(u) => u.0.name(),
9839        }
9840    }
9841}
9842
9843impl std::default::Default for OperationType {
9844    fn default() -> Self {
9845        use std::convert::From;
9846        Self::from(0)
9847    }
9848}
9849
9850impl std::fmt::Display for OperationType {
9851    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9852        wkt::internal::display_enum(f, self.name(), self.value())
9853    }
9854}
9855
9856impl std::convert::From<i32> for OperationType {
9857    fn from(value: i32) -> Self {
9858        match value {
9859            0 => Self::OperationtypeUnspecified,
9860            1 => Self::CreateFunction,
9861            2 => Self::UpdateFunction,
9862            3 => Self::DeleteFunction,
9863            _ => Self::UnknownValue(operation_type::UnknownValue(
9864                wkt::internal::UnknownEnumValue::Integer(value),
9865            )),
9866        }
9867    }
9868}
9869
9870impl std::convert::From<&str> for OperationType {
9871    fn from(value: &str) -> Self {
9872        use std::string::ToString;
9873        match value {
9874            "OPERATIONTYPE_UNSPECIFIED" => Self::OperationtypeUnspecified,
9875            "CREATE_FUNCTION" => Self::CreateFunction,
9876            "UPDATE_FUNCTION" => Self::UpdateFunction,
9877            "DELETE_FUNCTION" => Self::DeleteFunction,
9878            _ => Self::UnknownValue(operation_type::UnknownValue(
9879                wkt::internal::UnknownEnumValue::String(value.to_string()),
9880            )),
9881        }
9882    }
9883}
9884
9885impl serde::ser::Serialize for OperationType {
9886    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9887    where
9888        S: serde::Serializer,
9889    {
9890        match self {
9891            Self::OperationtypeUnspecified => serializer.serialize_i32(0),
9892            Self::CreateFunction => serializer.serialize_i32(1),
9893            Self::UpdateFunction => serializer.serialize_i32(2),
9894            Self::DeleteFunction => serializer.serialize_i32(3),
9895            Self::UnknownValue(u) => u.0.serialize(serializer),
9896        }
9897    }
9898}
9899
9900impl<'de> serde::de::Deserialize<'de> for OperationType {
9901    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9902    where
9903        D: serde::Deserializer<'de>,
9904    {
9905        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
9906            ".google.cloud.functions.v2.OperationType",
9907        ))
9908    }
9909}
9910
9911/// The environment the function is hosted on.
9912///
9913/// # Working with unknown values
9914///
9915/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9916/// additional enum variants at any time. Adding new variants is not considered
9917/// a breaking change. Applications should write their code in anticipation of:
9918///
9919/// - New values appearing in future releases of the client library, **and**
9920/// - New values received dynamically, without application changes.
9921///
9922/// Please consult the [Working with enums] section in the user guide for some
9923/// guidelines.
9924///
9925/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9926#[derive(Clone, Debug, PartialEq)]
9927#[non_exhaustive]
9928pub enum Environment {
9929    /// Unspecified
9930    Unspecified,
9931    /// Gen 1
9932    Gen1,
9933    /// Gen 2
9934    Gen2,
9935    /// If set, the enum was initialized with an unknown value.
9936    ///
9937    /// Applications can examine the value using [Environment::value] or
9938    /// [Environment::name].
9939    UnknownValue(environment::UnknownValue),
9940}
9941
9942#[doc(hidden)]
9943pub mod environment {
9944    #[allow(unused_imports)]
9945    use super::*;
9946    #[derive(Clone, Debug, PartialEq)]
9947    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9948}
9949
9950impl Environment {
9951    /// Gets the enum value.
9952    ///
9953    /// Returns `None` if the enum contains an unknown value deserialized from
9954    /// the string representation of enums.
9955    pub fn value(&self) -> std::option::Option<i32> {
9956        match self {
9957            Self::Unspecified => std::option::Option::Some(0),
9958            Self::Gen1 => std::option::Option::Some(1),
9959            Self::Gen2 => std::option::Option::Some(2),
9960            Self::UnknownValue(u) => u.0.value(),
9961        }
9962    }
9963
9964    /// Gets the enum value as a string.
9965    ///
9966    /// Returns `None` if the enum contains an unknown value deserialized from
9967    /// the integer representation of enums.
9968    pub fn name(&self) -> std::option::Option<&str> {
9969        match self {
9970            Self::Unspecified => std::option::Option::Some("ENVIRONMENT_UNSPECIFIED"),
9971            Self::Gen1 => std::option::Option::Some("GEN_1"),
9972            Self::Gen2 => std::option::Option::Some("GEN_2"),
9973            Self::UnknownValue(u) => u.0.name(),
9974        }
9975    }
9976}
9977
9978impl std::default::Default for Environment {
9979    fn default() -> Self {
9980        use std::convert::From;
9981        Self::from(0)
9982    }
9983}
9984
9985impl std::fmt::Display for Environment {
9986    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9987        wkt::internal::display_enum(f, self.name(), self.value())
9988    }
9989}
9990
9991impl std::convert::From<i32> for Environment {
9992    fn from(value: i32) -> Self {
9993        match value {
9994            0 => Self::Unspecified,
9995            1 => Self::Gen1,
9996            2 => Self::Gen2,
9997            _ => Self::UnknownValue(environment::UnknownValue(
9998                wkt::internal::UnknownEnumValue::Integer(value),
9999            )),
10000        }
10001    }
10002}
10003
10004impl std::convert::From<&str> for Environment {
10005    fn from(value: &str) -> Self {
10006        use std::string::ToString;
10007        match value {
10008            "ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
10009            "GEN_1" => Self::Gen1,
10010            "GEN_2" => Self::Gen2,
10011            _ => Self::UnknownValue(environment::UnknownValue(
10012                wkt::internal::UnknownEnumValue::String(value.to_string()),
10013            )),
10014        }
10015    }
10016}
10017
10018impl serde::ser::Serialize for Environment {
10019    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10020    where
10021        S: serde::Serializer,
10022    {
10023        match self {
10024            Self::Unspecified => serializer.serialize_i32(0),
10025            Self::Gen1 => serializer.serialize_i32(1),
10026            Self::Gen2 => serializer.serialize_i32(2),
10027            Self::UnknownValue(u) => u.0.serialize(serializer),
10028        }
10029    }
10030}
10031
10032impl<'de> serde::de::Deserialize<'de> for Environment {
10033    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10034    where
10035        D: serde::Deserializer<'de>,
10036    {
10037        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Environment>::new(
10038            ".google.cloud.functions.v2.Environment",
10039        ))
10040    }
10041}