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, Debug, 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
570/// Defines additional types related to [Function].
571pub mod function {
572    #[allow(unused_imports)]
573    use super::*;
574
575    /// Describes the current state of the function.
576    ///
577    /// # Working with unknown values
578    ///
579    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
580    /// additional enum variants at any time. Adding new variants is not considered
581    /// a breaking change. Applications should write their code in anticipation of:
582    ///
583    /// - New values appearing in future releases of the client library, **and**
584    /// - New values received dynamically, without application changes.
585    ///
586    /// Please consult the [Working with enums] section in the user guide for some
587    /// guidelines.
588    ///
589    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
590    #[derive(Clone, Debug, PartialEq)]
591    #[non_exhaustive]
592    pub enum State {
593        /// Not specified. Invalid state.
594        Unspecified,
595        /// Function has been successfully deployed and is serving.
596        Active,
597        /// Function deployment failed and the function is not serving.
598        Failed,
599        /// Function is being created or updated.
600        Deploying,
601        /// Function is being deleted.
602        Deleting,
603        /// Function deployment failed and the function serving state is undefined.
604        /// The function should be updated or deleted to move it out of this state.
605        Unknown,
606        /// If set, the enum was initialized with an unknown value.
607        ///
608        /// Applications can examine the value using [State::value] or
609        /// [State::name].
610        UnknownValue(state::UnknownValue),
611    }
612
613    #[doc(hidden)]
614    pub mod state {
615        #[allow(unused_imports)]
616        use super::*;
617        #[derive(Clone, Debug, PartialEq)]
618        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
619    }
620
621    impl State {
622        /// Gets the enum value.
623        ///
624        /// Returns `None` if the enum contains an unknown value deserialized from
625        /// the string representation of enums.
626        pub fn value(&self) -> std::option::Option<i32> {
627            match self {
628                Self::Unspecified => std::option::Option::Some(0),
629                Self::Active => std::option::Option::Some(1),
630                Self::Failed => std::option::Option::Some(2),
631                Self::Deploying => std::option::Option::Some(3),
632                Self::Deleting => std::option::Option::Some(4),
633                Self::Unknown => std::option::Option::Some(5),
634                Self::UnknownValue(u) => u.0.value(),
635            }
636        }
637
638        /// Gets the enum value as a string.
639        ///
640        /// Returns `None` if the enum contains an unknown value deserialized from
641        /// the integer representation of enums.
642        pub fn name(&self) -> std::option::Option<&str> {
643            match self {
644                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
645                Self::Active => std::option::Option::Some("ACTIVE"),
646                Self::Failed => std::option::Option::Some("FAILED"),
647                Self::Deploying => std::option::Option::Some("DEPLOYING"),
648                Self::Deleting => std::option::Option::Some("DELETING"),
649                Self::Unknown => std::option::Option::Some("UNKNOWN"),
650                Self::UnknownValue(u) => u.0.name(),
651            }
652        }
653    }
654
655    impl std::default::Default for State {
656        fn default() -> Self {
657            use std::convert::From;
658            Self::from(0)
659        }
660    }
661
662    impl std::fmt::Display for State {
663        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
664            wkt::internal::display_enum(f, self.name(), self.value())
665        }
666    }
667
668    impl std::convert::From<i32> for State {
669        fn from(value: i32) -> Self {
670            match value {
671                0 => Self::Unspecified,
672                1 => Self::Active,
673                2 => Self::Failed,
674                3 => Self::Deploying,
675                4 => Self::Deleting,
676                5 => Self::Unknown,
677                _ => Self::UnknownValue(state::UnknownValue(
678                    wkt::internal::UnknownEnumValue::Integer(value),
679                )),
680            }
681        }
682    }
683
684    impl std::convert::From<&str> for State {
685        fn from(value: &str) -> Self {
686            use std::string::ToString;
687            match value {
688                "STATE_UNSPECIFIED" => Self::Unspecified,
689                "ACTIVE" => Self::Active,
690                "FAILED" => Self::Failed,
691                "DEPLOYING" => Self::Deploying,
692                "DELETING" => Self::Deleting,
693                "UNKNOWN" => Self::Unknown,
694                _ => Self::UnknownValue(state::UnknownValue(
695                    wkt::internal::UnknownEnumValue::String(value.to_string()),
696                )),
697            }
698        }
699    }
700
701    impl serde::ser::Serialize for State {
702        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
703        where
704            S: serde::Serializer,
705        {
706            match self {
707                Self::Unspecified => serializer.serialize_i32(0),
708                Self::Active => serializer.serialize_i32(1),
709                Self::Failed => serializer.serialize_i32(2),
710                Self::Deploying => serializer.serialize_i32(3),
711                Self::Deleting => serializer.serialize_i32(4),
712                Self::Unknown => serializer.serialize_i32(5),
713                Self::UnknownValue(u) => u.0.serialize(serializer),
714            }
715        }
716    }
717
718    impl<'de> serde::de::Deserialize<'de> for State {
719        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
720        where
721            D: serde::Deserializer<'de>,
722        {
723            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
724                ".google.cloud.functions.v2.Function.State",
725            ))
726        }
727    }
728}
729
730/// Informational messages about the state of the Cloud Function or Operation.
731#[derive(Clone, Debug, Default, PartialEq)]
732#[non_exhaustive]
733pub struct StateMessage {
734    /// Severity of the state message.
735    pub severity: crate::model::state_message::Severity,
736
737    /// One-word CamelCase type of the state message.
738    pub r#type: std::string::String,
739
740    /// The message.
741    pub message: std::string::String,
742
743    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
744}
745
746impl StateMessage {
747    pub fn new() -> Self {
748        std::default::Default::default()
749    }
750
751    /// Sets the value of [severity][crate::model::StateMessage::severity].
752    pub fn set_severity<T: std::convert::Into<crate::model::state_message::Severity>>(
753        mut self,
754        v: T,
755    ) -> Self {
756        self.severity = v.into();
757        self
758    }
759
760    /// Sets the value of [r#type][crate::model::StateMessage::type].
761    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
762        self.r#type = v.into();
763        self
764    }
765
766    /// Sets the value of [message][crate::model::StateMessage::message].
767    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
768        self.message = v.into();
769        self
770    }
771}
772
773impl wkt::message::Message for StateMessage {
774    fn typename() -> &'static str {
775        "type.googleapis.com/google.cloud.functions.v2.StateMessage"
776    }
777}
778
779#[doc(hidden)]
780impl<'de> serde::de::Deserialize<'de> for StateMessage {
781    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
782    where
783        D: serde::Deserializer<'de>,
784    {
785        #[allow(non_camel_case_types)]
786        #[doc(hidden)]
787        #[derive(PartialEq, Eq, Hash)]
788        enum __FieldTag {
789            __severity,
790            __type,
791            __message,
792            Unknown(std::string::String),
793        }
794        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
795            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
796            where
797                D: serde::Deserializer<'de>,
798            {
799                struct Visitor;
800                impl<'de> serde::de::Visitor<'de> for Visitor {
801                    type Value = __FieldTag;
802                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
803                        formatter.write_str("a field name for StateMessage")
804                    }
805                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
806                    where
807                        E: serde::de::Error,
808                    {
809                        use std::result::Result::Ok;
810                        use std::string::ToString;
811                        match value {
812                            "severity" => Ok(__FieldTag::__severity),
813                            "type" => Ok(__FieldTag::__type),
814                            "message" => Ok(__FieldTag::__message),
815                            _ => Ok(__FieldTag::Unknown(value.to_string())),
816                        }
817                    }
818                }
819                deserializer.deserialize_identifier(Visitor)
820            }
821        }
822        struct Visitor;
823        impl<'de> serde::de::Visitor<'de> for Visitor {
824            type Value = StateMessage;
825            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
826                formatter.write_str("struct StateMessage")
827            }
828            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
829            where
830                A: serde::de::MapAccess<'de>,
831            {
832                #[allow(unused_imports)]
833                use serde::de::Error;
834                use std::option::Option::Some;
835                let mut fields = std::collections::HashSet::new();
836                let mut result = Self::Value::new();
837                while let Some(tag) = map.next_key::<__FieldTag>()? {
838                    #[allow(clippy::match_single_binding)]
839                    match tag {
840                        __FieldTag::__severity => {
841                            if !fields.insert(__FieldTag::__severity) {
842                                return std::result::Result::Err(A::Error::duplicate_field(
843                                    "multiple values for severity",
844                                ));
845                            }
846                            result.severity = map.next_value::<std::option::Option<crate::model::state_message::Severity>>()?.unwrap_or_default();
847                        }
848                        __FieldTag::__type => {
849                            if !fields.insert(__FieldTag::__type) {
850                                return std::result::Result::Err(A::Error::duplicate_field(
851                                    "multiple values for type",
852                                ));
853                            }
854                            result.r#type = map
855                                .next_value::<std::option::Option<std::string::String>>()?
856                                .unwrap_or_default();
857                        }
858                        __FieldTag::__message => {
859                            if !fields.insert(__FieldTag::__message) {
860                                return std::result::Result::Err(A::Error::duplicate_field(
861                                    "multiple values for message",
862                                ));
863                            }
864                            result.message = map
865                                .next_value::<std::option::Option<std::string::String>>()?
866                                .unwrap_or_default();
867                        }
868                        __FieldTag::Unknown(key) => {
869                            let value = map.next_value::<serde_json::Value>()?;
870                            result._unknown_fields.insert(key, value);
871                        }
872                    }
873                }
874                std::result::Result::Ok(result)
875            }
876        }
877        deserializer.deserialize_any(Visitor)
878    }
879}
880
881#[doc(hidden)]
882impl serde::ser::Serialize for StateMessage {
883    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
884    where
885        S: serde::ser::Serializer,
886    {
887        use serde::ser::SerializeMap;
888        #[allow(unused_imports)]
889        use std::option::Option::Some;
890        let mut state = serializer.serialize_map(std::option::Option::None)?;
891        if !wkt::internal::is_default(&self.severity) {
892            state.serialize_entry("severity", &self.severity)?;
893        }
894        if !self.r#type.is_empty() {
895            state.serialize_entry("type", &self.r#type)?;
896        }
897        if !self.message.is_empty() {
898            state.serialize_entry("message", &self.message)?;
899        }
900        if !self._unknown_fields.is_empty() {
901            for (key, value) in self._unknown_fields.iter() {
902                state.serialize_entry(key, &value)?;
903            }
904        }
905        state.end()
906    }
907}
908
909/// Defines additional types related to [StateMessage].
910pub mod state_message {
911    #[allow(unused_imports)]
912    use super::*;
913
914    /// Severity of the state message.
915    ///
916    /// # Working with unknown values
917    ///
918    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
919    /// additional enum variants at any time. Adding new variants is not considered
920    /// a breaking change. Applications should write their code in anticipation of:
921    ///
922    /// - New values appearing in future releases of the client library, **and**
923    /// - New values received dynamically, without application changes.
924    ///
925    /// Please consult the [Working with enums] section in the user guide for some
926    /// guidelines.
927    ///
928    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
929    #[derive(Clone, Debug, PartialEq)]
930    #[non_exhaustive]
931    pub enum Severity {
932        /// Not specified. Invalid severity.
933        Unspecified,
934        /// ERROR-level severity.
935        Error,
936        /// WARNING-level severity.
937        Warning,
938        /// INFO-level severity.
939        Info,
940        /// If set, the enum was initialized with an unknown value.
941        ///
942        /// Applications can examine the value using [Severity::value] or
943        /// [Severity::name].
944        UnknownValue(severity::UnknownValue),
945    }
946
947    #[doc(hidden)]
948    pub mod severity {
949        #[allow(unused_imports)]
950        use super::*;
951        #[derive(Clone, Debug, PartialEq)]
952        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
953    }
954
955    impl Severity {
956        /// Gets the enum value.
957        ///
958        /// Returns `None` if the enum contains an unknown value deserialized from
959        /// the string representation of enums.
960        pub fn value(&self) -> std::option::Option<i32> {
961            match self {
962                Self::Unspecified => std::option::Option::Some(0),
963                Self::Error => std::option::Option::Some(1),
964                Self::Warning => std::option::Option::Some(2),
965                Self::Info => std::option::Option::Some(3),
966                Self::UnknownValue(u) => u.0.value(),
967            }
968        }
969
970        /// Gets the enum value as a string.
971        ///
972        /// Returns `None` if the enum contains an unknown value deserialized from
973        /// the integer representation of enums.
974        pub fn name(&self) -> std::option::Option<&str> {
975            match self {
976                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
977                Self::Error => std::option::Option::Some("ERROR"),
978                Self::Warning => std::option::Option::Some("WARNING"),
979                Self::Info => std::option::Option::Some("INFO"),
980                Self::UnknownValue(u) => u.0.name(),
981            }
982        }
983    }
984
985    impl std::default::Default for Severity {
986        fn default() -> Self {
987            use std::convert::From;
988            Self::from(0)
989        }
990    }
991
992    impl std::fmt::Display for Severity {
993        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
994            wkt::internal::display_enum(f, self.name(), self.value())
995        }
996    }
997
998    impl std::convert::From<i32> for Severity {
999        fn from(value: i32) -> Self {
1000            match value {
1001                0 => Self::Unspecified,
1002                1 => Self::Error,
1003                2 => Self::Warning,
1004                3 => Self::Info,
1005                _ => Self::UnknownValue(severity::UnknownValue(
1006                    wkt::internal::UnknownEnumValue::Integer(value),
1007                )),
1008            }
1009        }
1010    }
1011
1012    impl std::convert::From<&str> for Severity {
1013        fn from(value: &str) -> Self {
1014            use std::string::ToString;
1015            match value {
1016                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
1017                "ERROR" => Self::Error,
1018                "WARNING" => Self::Warning,
1019                "INFO" => Self::Info,
1020                _ => Self::UnknownValue(severity::UnknownValue(
1021                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1022                )),
1023            }
1024        }
1025    }
1026
1027    impl serde::ser::Serialize for Severity {
1028        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1029        where
1030            S: serde::Serializer,
1031        {
1032            match self {
1033                Self::Unspecified => serializer.serialize_i32(0),
1034                Self::Error => serializer.serialize_i32(1),
1035                Self::Warning => serializer.serialize_i32(2),
1036                Self::Info => serializer.serialize_i32(3),
1037                Self::UnknownValue(u) => u.0.serialize(serializer),
1038            }
1039        }
1040    }
1041
1042    impl<'de> serde::de::Deserialize<'de> for Severity {
1043        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1044        where
1045            D: serde::Deserializer<'de>,
1046        {
1047            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
1048                ".google.cloud.functions.v2.StateMessage.Severity",
1049            ))
1050        }
1051    }
1052}
1053
1054/// Location of the source in an archive file in Google Cloud Storage.
1055#[derive(Clone, Debug, Default, PartialEq)]
1056#[non_exhaustive]
1057pub struct StorageSource {
1058    /// Google Cloud Storage bucket containing the source (see
1059    /// [Bucket Name
1060    /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
1061    pub bucket: std::string::String,
1062
1063    /// Google Cloud Storage object containing the source.
1064    ///
1065    /// This object must be a gzipped archive file (`.tar.gz`) containing source to
1066    /// build.
1067    pub object: std::string::String,
1068
1069    /// Google Cloud Storage generation for the object. If the generation is
1070    /// omitted, the latest generation will be used.
1071    pub generation: i64,
1072
1073    /// When the specified storage bucket is a 1st gen function uploard url bucket,
1074    /// this field should be set as the generated upload url for 1st gen
1075    /// deployment.
1076    pub source_upload_url: std::string::String,
1077
1078    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1079}
1080
1081impl StorageSource {
1082    pub fn new() -> Self {
1083        std::default::Default::default()
1084    }
1085
1086    /// Sets the value of [bucket][crate::model::StorageSource::bucket].
1087    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1088        self.bucket = v.into();
1089        self
1090    }
1091
1092    /// Sets the value of [object][crate::model::StorageSource::object].
1093    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1094        self.object = v.into();
1095        self
1096    }
1097
1098    /// Sets the value of [generation][crate::model::StorageSource::generation].
1099    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1100        self.generation = v.into();
1101        self
1102    }
1103
1104    /// Sets the value of [source_upload_url][crate::model::StorageSource::source_upload_url].
1105    pub fn set_source_upload_url<T: std::convert::Into<std::string::String>>(
1106        mut self,
1107        v: T,
1108    ) -> Self {
1109        self.source_upload_url = v.into();
1110        self
1111    }
1112}
1113
1114impl wkt::message::Message for StorageSource {
1115    fn typename() -> &'static str {
1116        "type.googleapis.com/google.cloud.functions.v2.StorageSource"
1117    }
1118}
1119
1120#[doc(hidden)]
1121impl<'de> serde::de::Deserialize<'de> for StorageSource {
1122    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1123    where
1124        D: serde::Deserializer<'de>,
1125    {
1126        #[allow(non_camel_case_types)]
1127        #[doc(hidden)]
1128        #[derive(PartialEq, Eq, Hash)]
1129        enum __FieldTag {
1130            __bucket,
1131            __object,
1132            __generation,
1133            __source_upload_url,
1134            Unknown(std::string::String),
1135        }
1136        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1138            where
1139                D: serde::Deserializer<'de>,
1140            {
1141                struct Visitor;
1142                impl<'de> serde::de::Visitor<'de> for Visitor {
1143                    type Value = __FieldTag;
1144                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1145                        formatter.write_str("a field name for StorageSource")
1146                    }
1147                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1148                    where
1149                        E: serde::de::Error,
1150                    {
1151                        use std::result::Result::Ok;
1152                        use std::string::ToString;
1153                        match value {
1154                            "bucket" => Ok(__FieldTag::__bucket),
1155                            "object" => Ok(__FieldTag::__object),
1156                            "generation" => Ok(__FieldTag::__generation),
1157                            "sourceUploadUrl" => Ok(__FieldTag::__source_upload_url),
1158                            "source_upload_url" => Ok(__FieldTag::__source_upload_url),
1159                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1160                        }
1161                    }
1162                }
1163                deserializer.deserialize_identifier(Visitor)
1164            }
1165        }
1166        struct Visitor;
1167        impl<'de> serde::de::Visitor<'de> for Visitor {
1168            type Value = StorageSource;
1169            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1170                formatter.write_str("struct StorageSource")
1171            }
1172            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1173            where
1174                A: serde::de::MapAccess<'de>,
1175            {
1176                #[allow(unused_imports)]
1177                use serde::de::Error;
1178                use std::option::Option::Some;
1179                let mut fields = std::collections::HashSet::new();
1180                let mut result = Self::Value::new();
1181                while let Some(tag) = map.next_key::<__FieldTag>()? {
1182                    #[allow(clippy::match_single_binding)]
1183                    match tag {
1184                        __FieldTag::__bucket => {
1185                            if !fields.insert(__FieldTag::__bucket) {
1186                                return std::result::Result::Err(A::Error::duplicate_field(
1187                                    "multiple values for bucket",
1188                                ));
1189                            }
1190                            result.bucket = map
1191                                .next_value::<std::option::Option<std::string::String>>()?
1192                                .unwrap_or_default();
1193                        }
1194                        __FieldTag::__object => {
1195                            if !fields.insert(__FieldTag::__object) {
1196                                return std::result::Result::Err(A::Error::duplicate_field(
1197                                    "multiple values for object",
1198                                ));
1199                            }
1200                            result.object = map
1201                                .next_value::<std::option::Option<std::string::String>>()?
1202                                .unwrap_or_default();
1203                        }
1204                        __FieldTag::__generation => {
1205                            if !fields.insert(__FieldTag::__generation) {
1206                                return std::result::Result::Err(A::Error::duplicate_field(
1207                                    "multiple values for generation",
1208                                ));
1209                            }
1210                            struct __With(std::option::Option<i64>);
1211                            impl<'de> serde::de::Deserialize<'de> for __With {
1212                                fn deserialize<D>(
1213                                    deserializer: D,
1214                                ) -> std::result::Result<Self, D::Error>
1215                                where
1216                                    D: serde::de::Deserializer<'de>,
1217                                {
1218                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1219                                }
1220                            }
1221                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
1222                        }
1223                        __FieldTag::__source_upload_url => {
1224                            if !fields.insert(__FieldTag::__source_upload_url) {
1225                                return std::result::Result::Err(A::Error::duplicate_field(
1226                                    "multiple values for source_upload_url",
1227                                ));
1228                            }
1229                            result.source_upload_url = map
1230                                .next_value::<std::option::Option<std::string::String>>()?
1231                                .unwrap_or_default();
1232                        }
1233                        __FieldTag::Unknown(key) => {
1234                            let value = map.next_value::<serde_json::Value>()?;
1235                            result._unknown_fields.insert(key, value);
1236                        }
1237                    }
1238                }
1239                std::result::Result::Ok(result)
1240            }
1241        }
1242        deserializer.deserialize_any(Visitor)
1243    }
1244}
1245
1246#[doc(hidden)]
1247impl serde::ser::Serialize for StorageSource {
1248    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1249    where
1250        S: serde::ser::Serializer,
1251    {
1252        use serde::ser::SerializeMap;
1253        #[allow(unused_imports)]
1254        use std::option::Option::Some;
1255        let mut state = serializer.serialize_map(std::option::Option::None)?;
1256        if !self.bucket.is_empty() {
1257            state.serialize_entry("bucket", &self.bucket)?;
1258        }
1259        if !self.object.is_empty() {
1260            state.serialize_entry("object", &self.object)?;
1261        }
1262        if !wkt::internal::is_default(&self.generation) {
1263            struct __With<'a>(&'a i64);
1264            impl<'a> serde::ser::Serialize for __With<'a> {
1265                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1266                where
1267                    S: serde::ser::Serializer,
1268                {
1269                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1270                }
1271            }
1272            state.serialize_entry("generation", &__With(&self.generation))?;
1273        }
1274        if !self.source_upload_url.is_empty() {
1275            state.serialize_entry("sourceUploadUrl", &self.source_upload_url)?;
1276        }
1277        if !self._unknown_fields.is_empty() {
1278            for (key, value) in self._unknown_fields.iter() {
1279                state.serialize_entry(key, &value)?;
1280            }
1281        }
1282        state.end()
1283    }
1284}
1285
1286/// Location of the source in a Google Cloud Source Repository.
1287#[derive(Clone, Debug, Default, PartialEq)]
1288#[non_exhaustive]
1289pub struct RepoSource {
1290    /// ID of the project that owns the Cloud Source Repository. If omitted, the
1291    /// project ID requesting the build is assumed.
1292    pub project_id: std::string::String,
1293
1294    /// Name of the Cloud Source Repository.
1295    pub repo_name: std::string::String,
1296
1297    /// Directory, relative to the source root, in which to run the build.
1298    ///
1299    /// This must be a relative path. If a step's `dir` is specified and is an
1300    /// absolute path, this value is ignored for that step's execution.
1301    /// eg. helloworld (no leading slash allowed)
1302    pub dir: std::string::String,
1303
1304    /// Only trigger a build if the revision regex does NOT match the revision
1305    /// regex.
1306    pub invert_regex: bool,
1307
1308    /// A revision within the Cloud Source Repository must be specified in
1309    /// one of these ways.
1310    pub revision: std::option::Option<crate::model::repo_source::Revision>,
1311
1312    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1313}
1314
1315impl RepoSource {
1316    pub fn new() -> Self {
1317        std::default::Default::default()
1318    }
1319
1320    /// Sets the value of [project_id][crate::model::RepoSource::project_id].
1321    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1322        self.project_id = v.into();
1323        self
1324    }
1325
1326    /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
1327    pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1328        self.repo_name = v.into();
1329        self
1330    }
1331
1332    /// Sets the value of [dir][crate::model::RepoSource::dir].
1333    pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1334        self.dir = v.into();
1335        self
1336    }
1337
1338    /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
1339    pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1340        self.invert_regex = v.into();
1341        self
1342    }
1343
1344    /// Sets the value of [revision][crate::model::RepoSource::revision].
1345    ///
1346    /// Note that all the setters affecting `revision` are mutually
1347    /// exclusive.
1348    pub fn set_revision<
1349        T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
1350    >(
1351        mut self,
1352        v: T,
1353    ) -> Self {
1354        self.revision = v.into();
1355        self
1356    }
1357
1358    /// The value of [revision][crate::model::RepoSource::revision]
1359    /// if it holds a `BranchName`, `None` if the field is not set or
1360    /// holds a different branch.
1361    pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
1362        #[allow(unreachable_patterns)]
1363        self.revision.as_ref().and_then(|v| match v {
1364            crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
1365            _ => std::option::Option::None,
1366        })
1367    }
1368
1369    /// Sets the value of [revision][crate::model::RepoSource::revision]
1370    /// to hold a `BranchName`.
1371    ///
1372    /// Note that all the setters affecting `revision` are
1373    /// mutually exclusive.
1374    pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1375        self.revision =
1376            std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
1377        self
1378    }
1379
1380    /// The value of [revision][crate::model::RepoSource::revision]
1381    /// if it holds a `TagName`, `None` if the field is not set or
1382    /// holds a different branch.
1383    pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
1384        #[allow(unreachable_patterns)]
1385        self.revision.as_ref().and_then(|v| match v {
1386            crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
1387            _ => std::option::Option::None,
1388        })
1389    }
1390
1391    /// Sets the value of [revision][crate::model::RepoSource::revision]
1392    /// to hold a `TagName`.
1393    ///
1394    /// Note that all the setters affecting `revision` are
1395    /// mutually exclusive.
1396    pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1397        self.revision =
1398            std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
1399        self
1400    }
1401
1402    /// The value of [revision][crate::model::RepoSource::revision]
1403    /// if it holds a `CommitSha`, `None` if the field is not set or
1404    /// holds a different branch.
1405    pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
1406        #[allow(unreachable_patterns)]
1407        self.revision.as_ref().and_then(|v| match v {
1408            crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
1409            _ => std::option::Option::None,
1410        })
1411    }
1412
1413    /// Sets the value of [revision][crate::model::RepoSource::revision]
1414    /// to hold a `CommitSha`.
1415    ///
1416    /// Note that all the setters affecting `revision` are
1417    /// mutually exclusive.
1418    pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1419        self.revision =
1420            std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
1421        self
1422    }
1423}
1424
1425impl wkt::message::Message for RepoSource {
1426    fn typename() -> &'static str {
1427        "type.googleapis.com/google.cloud.functions.v2.RepoSource"
1428    }
1429}
1430
1431#[doc(hidden)]
1432impl<'de> serde::de::Deserialize<'de> for RepoSource {
1433    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1434    where
1435        D: serde::Deserializer<'de>,
1436    {
1437        #[allow(non_camel_case_types)]
1438        #[doc(hidden)]
1439        #[derive(PartialEq, Eq, Hash)]
1440        enum __FieldTag {
1441            __branch_name,
1442            __tag_name,
1443            __commit_sha,
1444            __project_id,
1445            __repo_name,
1446            __dir,
1447            __invert_regex,
1448            Unknown(std::string::String),
1449        }
1450        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1451            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1452            where
1453                D: serde::Deserializer<'de>,
1454            {
1455                struct Visitor;
1456                impl<'de> serde::de::Visitor<'de> for Visitor {
1457                    type Value = __FieldTag;
1458                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1459                        formatter.write_str("a field name for RepoSource")
1460                    }
1461                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1462                    where
1463                        E: serde::de::Error,
1464                    {
1465                        use std::result::Result::Ok;
1466                        use std::string::ToString;
1467                        match value {
1468                            "branchName" => Ok(__FieldTag::__branch_name),
1469                            "branch_name" => Ok(__FieldTag::__branch_name),
1470                            "tagName" => Ok(__FieldTag::__tag_name),
1471                            "tag_name" => Ok(__FieldTag::__tag_name),
1472                            "commitSha" => Ok(__FieldTag::__commit_sha),
1473                            "commit_sha" => Ok(__FieldTag::__commit_sha),
1474                            "projectId" => Ok(__FieldTag::__project_id),
1475                            "project_id" => Ok(__FieldTag::__project_id),
1476                            "repoName" => Ok(__FieldTag::__repo_name),
1477                            "repo_name" => Ok(__FieldTag::__repo_name),
1478                            "dir" => Ok(__FieldTag::__dir),
1479                            "invertRegex" => Ok(__FieldTag::__invert_regex),
1480                            "invert_regex" => Ok(__FieldTag::__invert_regex),
1481                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1482                        }
1483                    }
1484                }
1485                deserializer.deserialize_identifier(Visitor)
1486            }
1487        }
1488        struct Visitor;
1489        impl<'de> serde::de::Visitor<'de> for Visitor {
1490            type Value = RepoSource;
1491            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1492                formatter.write_str("struct RepoSource")
1493            }
1494            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1495            where
1496                A: serde::de::MapAccess<'de>,
1497            {
1498                #[allow(unused_imports)]
1499                use serde::de::Error;
1500                use std::option::Option::Some;
1501                let mut fields = std::collections::HashSet::new();
1502                let mut result = Self::Value::new();
1503                while let Some(tag) = map.next_key::<__FieldTag>()? {
1504                    #[allow(clippy::match_single_binding)]
1505                    match tag {
1506                        __FieldTag::__branch_name => {
1507                            if !fields.insert(__FieldTag::__branch_name) {
1508                                return std::result::Result::Err(A::Error::duplicate_field(
1509                                    "multiple values for branch_name",
1510                                ));
1511                            }
1512                            if result.revision.is_some() {
1513                                return std::result::Result::Err(A::Error::duplicate_field(
1514                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.branch_name, latest field was branchName",
1515                                ));
1516                            }
1517                            result.revision = std::option::Option::Some(
1518                                crate::model::repo_source::Revision::BranchName(
1519                                    map.next_value::<std::option::Option<std::string::String>>()?
1520                                        .unwrap_or_default(),
1521                                ),
1522                            );
1523                        }
1524                        __FieldTag::__tag_name => {
1525                            if !fields.insert(__FieldTag::__tag_name) {
1526                                return std::result::Result::Err(A::Error::duplicate_field(
1527                                    "multiple values for tag_name",
1528                                ));
1529                            }
1530                            if result.revision.is_some() {
1531                                return std::result::Result::Err(A::Error::duplicate_field(
1532                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.tag_name, latest field was tagName",
1533                                ));
1534                            }
1535                            result.revision = std::option::Option::Some(
1536                                crate::model::repo_source::Revision::TagName(
1537                                    map.next_value::<std::option::Option<std::string::String>>()?
1538                                        .unwrap_or_default(),
1539                                ),
1540                            );
1541                        }
1542                        __FieldTag::__commit_sha => {
1543                            if !fields.insert(__FieldTag::__commit_sha) {
1544                                return std::result::Result::Err(A::Error::duplicate_field(
1545                                    "multiple values for commit_sha",
1546                                ));
1547                            }
1548                            if result.revision.is_some() {
1549                                return std::result::Result::Err(A::Error::duplicate_field(
1550                                    "multiple values for `revision`, a oneof with full ID .google.cloud.functions.v2.RepoSource.commit_sha, latest field was commitSha",
1551                                ));
1552                            }
1553                            result.revision = std::option::Option::Some(
1554                                crate::model::repo_source::Revision::CommitSha(
1555                                    map.next_value::<std::option::Option<std::string::String>>()?
1556                                        .unwrap_or_default(),
1557                                ),
1558                            );
1559                        }
1560                        __FieldTag::__project_id => {
1561                            if !fields.insert(__FieldTag::__project_id) {
1562                                return std::result::Result::Err(A::Error::duplicate_field(
1563                                    "multiple values for project_id",
1564                                ));
1565                            }
1566                            result.project_id = map
1567                                .next_value::<std::option::Option<std::string::String>>()?
1568                                .unwrap_or_default();
1569                        }
1570                        __FieldTag::__repo_name => {
1571                            if !fields.insert(__FieldTag::__repo_name) {
1572                                return std::result::Result::Err(A::Error::duplicate_field(
1573                                    "multiple values for repo_name",
1574                                ));
1575                            }
1576                            result.repo_name = map
1577                                .next_value::<std::option::Option<std::string::String>>()?
1578                                .unwrap_or_default();
1579                        }
1580                        __FieldTag::__dir => {
1581                            if !fields.insert(__FieldTag::__dir) {
1582                                return std::result::Result::Err(A::Error::duplicate_field(
1583                                    "multiple values for dir",
1584                                ));
1585                            }
1586                            result.dir = map
1587                                .next_value::<std::option::Option<std::string::String>>()?
1588                                .unwrap_or_default();
1589                        }
1590                        __FieldTag::__invert_regex => {
1591                            if !fields.insert(__FieldTag::__invert_regex) {
1592                                return std::result::Result::Err(A::Error::duplicate_field(
1593                                    "multiple values for invert_regex",
1594                                ));
1595                            }
1596                            result.invert_regex = map
1597                                .next_value::<std::option::Option<bool>>()?
1598                                .unwrap_or_default();
1599                        }
1600                        __FieldTag::Unknown(key) => {
1601                            let value = map.next_value::<serde_json::Value>()?;
1602                            result._unknown_fields.insert(key, value);
1603                        }
1604                    }
1605                }
1606                std::result::Result::Ok(result)
1607            }
1608        }
1609        deserializer.deserialize_any(Visitor)
1610    }
1611}
1612
1613#[doc(hidden)]
1614impl serde::ser::Serialize for RepoSource {
1615    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1616    where
1617        S: serde::ser::Serializer,
1618    {
1619        use serde::ser::SerializeMap;
1620        #[allow(unused_imports)]
1621        use std::option::Option::Some;
1622        let mut state = serializer.serialize_map(std::option::Option::None)?;
1623        if let Some(value) = self.branch_name() {
1624            state.serialize_entry("branchName", value)?;
1625        }
1626        if let Some(value) = self.tag_name() {
1627            state.serialize_entry("tagName", value)?;
1628        }
1629        if let Some(value) = self.commit_sha() {
1630            state.serialize_entry("commitSha", value)?;
1631        }
1632        if !self.project_id.is_empty() {
1633            state.serialize_entry("projectId", &self.project_id)?;
1634        }
1635        if !self.repo_name.is_empty() {
1636            state.serialize_entry("repoName", &self.repo_name)?;
1637        }
1638        if !self.dir.is_empty() {
1639            state.serialize_entry("dir", &self.dir)?;
1640        }
1641        if !wkt::internal::is_default(&self.invert_regex) {
1642            state.serialize_entry("invertRegex", &self.invert_regex)?;
1643        }
1644        if !self._unknown_fields.is_empty() {
1645            for (key, value) in self._unknown_fields.iter() {
1646                state.serialize_entry(key, &value)?;
1647            }
1648        }
1649        state.end()
1650    }
1651}
1652
1653/// Defines additional types related to [RepoSource].
1654pub mod repo_source {
1655    #[allow(unused_imports)]
1656    use super::*;
1657
1658    /// A revision within the Cloud Source Repository must be specified in
1659    /// one of these ways.
1660    #[derive(Clone, Debug, PartialEq)]
1661    #[non_exhaustive]
1662    pub enum Revision {
1663        /// Regex matching branches to build.
1664        ///
1665        /// The syntax of the regular expressions accepted is the syntax accepted by
1666        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1667        BranchName(std::string::String),
1668        /// Regex matching tags to build.
1669        ///
1670        /// The syntax of the regular expressions accepted is the syntax accepted by
1671        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1672        TagName(std::string::String),
1673        /// Explicit commit SHA to build.
1674        CommitSha(std::string::String),
1675    }
1676}
1677
1678/// The location of the function source code.
1679#[derive(Clone, Debug, Default, PartialEq)]
1680#[non_exhaustive]
1681pub struct Source {
1682    /// Location of the source.
1683    /// At least one source needs to be provided for the deployment to succeed.
1684    pub source: std::option::Option<crate::model::source::Source>,
1685
1686    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1687}
1688
1689impl Source {
1690    pub fn new() -> Self {
1691        std::default::Default::default()
1692    }
1693
1694    /// Sets the value of [source][crate::model::Source::source].
1695    ///
1696    /// Note that all the setters affecting `source` are mutually
1697    /// exclusive.
1698    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1699        mut self,
1700        v: T,
1701    ) -> Self {
1702        self.source = v.into();
1703        self
1704    }
1705
1706    /// The value of [source][crate::model::Source::source]
1707    /// if it holds a `StorageSource`, `None` if the field is not set or
1708    /// holds a different branch.
1709    pub fn storage_source(
1710        &self,
1711    ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1712        #[allow(unreachable_patterns)]
1713        self.source.as_ref().and_then(|v| match v {
1714            crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1715            _ => std::option::Option::None,
1716        })
1717    }
1718
1719    /// Sets the value of [source][crate::model::Source::source]
1720    /// to hold a `StorageSource`.
1721    ///
1722    /// Note that all the setters affecting `source` are
1723    /// mutually exclusive.
1724    pub fn set_storage_source<
1725        T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1726    >(
1727        mut self,
1728        v: T,
1729    ) -> Self {
1730        self.source =
1731            std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1732        self
1733    }
1734
1735    /// The value of [source][crate::model::Source::source]
1736    /// if it holds a `RepoSource`, `None` if the field is not set or
1737    /// holds a different branch.
1738    pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1739        #[allow(unreachable_patterns)]
1740        self.source.as_ref().and_then(|v| match v {
1741            crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1742            _ => std::option::Option::None,
1743        })
1744    }
1745
1746    /// Sets the value of [source][crate::model::Source::source]
1747    /// to hold a `RepoSource`.
1748    ///
1749    /// Note that all the setters affecting `source` are
1750    /// mutually exclusive.
1751    pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1752        mut self,
1753        v: T,
1754    ) -> Self {
1755        self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1756        self
1757    }
1758
1759    /// The value of [source][crate::model::Source::source]
1760    /// if it holds a `GitUri`, `None` if the field is not set or
1761    /// holds a different branch.
1762    pub fn git_uri(&self) -> std::option::Option<&std::string::String> {
1763        #[allow(unreachable_patterns)]
1764        self.source.as_ref().and_then(|v| match v {
1765            crate::model::source::Source::GitUri(v) => std::option::Option::Some(v),
1766            _ => std::option::Option::None,
1767        })
1768    }
1769
1770    /// Sets the value of [source][crate::model::Source::source]
1771    /// to hold a `GitUri`.
1772    ///
1773    /// Note that all the setters affecting `source` are
1774    /// mutually exclusive.
1775    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1776        self.source = std::option::Option::Some(crate::model::source::Source::GitUri(v.into()));
1777        self
1778    }
1779}
1780
1781impl wkt::message::Message for Source {
1782    fn typename() -> &'static str {
1783        "type.googleapis.com/google.cloud.functions.v2.Source"
1784    }
1785}
1786
1787#[doc(hidden)]
1788impl<'de> serde::de::Deserialize<'de> for Source {
1789    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1790    where
1791        D: serde::Deserializer<'de>,
1792    {
1793        #[allow(non_camel_case_types)]
1794        #[doc(hidden)]
1795        #[derive(PartialEq, Eq, Hash)]
1796        enum __FieldTag {
1797            __storage_source,
1798            __repo_source,
1799            __git_uri,
1800            Unknown(std::string::String),
1801        }
1802        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1803            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1804            where
1805                D: serde::Deserializer<'de>,
1806            {
1807                struct Visitor;
1808                impl<'de> serde::de::Visitor<'de> for Visitor {
1809                    type Value = __FieldTag;
1810                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1811                        formatter.write_str("a field name for Source")
1812                    }
1813                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1814                    where
1815                        E: serde::de::Error,
1816                    {
1817                        use std::result::Result::Ok;
1818                        use std::string::ToString;
1819                        match value {
1820                            "storageSource" => Ok(__FieldTag::__storage_source),
1821                            "storage_source" => Ok(__FieldTag::__storage_source),
1822                            "repoSource" => Ok(__FieldTag::__repo_source),
1823                            "repo_source" => Ok(__FieldTag::__repo_source),
1824                            "gitUri" => Ok(__FieldTag::__git_uri),
1825                            "git_uri" => Ok(__FieldTag::__git_uri),
1826                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1827                        }
1828                    }
1829                }
1830                deserializer.deserialize_identifier(Visitor)
1831            }
1832        }
1833        struct Visitor;
1834        impl<'de> serde::de::Visitor<'de> for Visitor {
1835            type Value = Source;
1836            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1837                formatter.write_str("struct Source")
1838            }
1839            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1840            where
1841                A: serde::de::MapAccess<'de>,
1842            {
1843                #[allow(unused_imports)]
1844                use serde::de::Error;
1845                use std::option::Option::Some;
1846                let mut fields = std::collections::HashSet::new();
1847                let mut result = Self::Value::new();
1848                while let Some(tag) = map.next_key::<__FieldTag>()? {
1849                    #[allow(clippy::match_single_binding)]
1850                    match tag {
1851                        __FieldTag::__storage_source => {
1852                            if !fields.insert(__FieldTag::__storage_source) {
1853                                return std::result::Result::Err(A::Error::duplicate_field(
1854                                    "multiple values for storage_source",
1855                                ));
1856                            }
1857                            if result.source.is_some() {
1858                                return std::result::Result::Err(A::Error::duplicate_field(
1859                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.storage_source, latest field was storageSource",
1860                                ));
1861                            }
1862                            result.source = std::option::Option::Some(
1863                                crate::model::source::Source::StorageSource(
1864                                    map.next_value::<std::option::Option<
1865                                        std::boxed::Box<crate::model::StorageSource>,
1866                                    >>()?
1867                                    .unwrap_or_default(),
1868                                ),
1869                            );
1870                        }
1871                        __FieldTag::__repo_source => {
1872                            if !fields.insert(__FieldTag::__repo_source) {
1873                                return std::result::Result::Err(A::Error::duplicate_field(
1874                                    "multiple values for repo_source",
1875                                ));
1876                            }
1877                            if result.source.is_some() {
1878                                return std::result::Result::Err(A::Error::duplicate_field(
1879                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.repo_source, latest field was repoSource",
1880                                ));
1881                            }
1882                            result.source = std::option::Option::Some(
1883                                crate::model::source::Source::RepoSource(
1884                                    map.next_value::<std::option::Option<
1885                                        std::boxed::Box<crate::model::RepoSource>,
1886                                    >>()?
1887                                    .unwrap_or_default(),
1888                                ),
1889                            );
1890                        }
1891                        __FieldTag::__git_uri => {
1892                            if !fields.insert(__FieldTag::__git_uri) {
1893                                return std::result::Result::Err(A::Error::duplicate_field(
1894                                    "multiple values for git_uri",
1895                                ));
1896                            }
1897                            if result.source.is_some() {
1898                                return std::result::Result::Err(A::Error::duplicate_field(
1899                                    "multiple values for `source`, a oneof with full ID .google.cloud.functions.v2.Source.git_uri, latest field was gitUri",
1900                                ));
1901                            }
1902                            result.source =
1903                                std::option::Option::Some(crate::model::source::Source::GitUri(
1904                                    map.next_value::<std::option::Option<std::string::String>>()?
1905                                        .unwrap_or_default(),
1906                                ));
1907                        }
1908                        __FieldTag::Unknown(key) => {
1909                            let value = map.next_value::<serde_json::Value>()?;
1910                            result._unknown_fields.insert(key, value);
1911                        }
1912                    }
1913                }
1914                std::result::Result::Ok(result)
1915            }
1916        }
1917        deserializer.deserialize_any(Visitor)
1918    }
1919}
1920
1921#[doc(hidden)]
1922impl serde::ser::Serialize for Source {
1923    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1924    where
1925        S: serde::ser::Serializer,
1926    {
1927        use serde::ser::SerializeMap;
1928        #[allow(unused_imports)]
1929        use std::option::Option::Some;
1930        let mut state = serializer.serialize_map(std::option::Option::None)?;
1931        if let Some(value) = self.storage_source() {
1932            state.serialize_entry("storageSource", value)?;
1933        }
1934        if let Some(value) = self.repo_source() {
1935            state.serialize_entry("repoSource", value)?;
1936        }
1937        if let Some(value) = self.git_uri() {
1938            state.serialize_entry("gitUri", value)?;
1939        }
1940        if !self._unknown_fields.is_empty() {
1941            for (key, value) in self._unknown_fields.iter() {
1942                state.serialize_entry(key, &value)?;
1943            }
1944        }
1945        state.end()
1946    }
1947}
1948
1949/// Defines additional types related to [Source].
1950pub mod source {
1951    #[allow(unused_imports)]
1952    use super::*;
1953
1954    /// Location of the source.
1955    /// At least one source needs to be provided for the deployment to succeed.
1956    #[derive(Clone, Debug, PartialEq)]
1957    #[non_exhaustive]
1958    pub enum Source {
1959        /// If provided, get the source from this location in Google Cloud Storage.
1960        StorageSource(std::boxed::Box<crate::model::StorageSource>),
1961        /// If provided, get the source from this location in a Cloud Source
1962        /// Repository.
1963        RepoSource(std::boxed::Box<crate::model::RepoSource>),
1964        /// If provided, get the source from GitHub repository. This option is valid
1965        /// only for GCF 1st Gen function.
1966        /// Example: <https://github.com/>\<user\>/\<repo\>/blob/\<commit\>/\<path-to-code\>
1967        GitUri(std::string::String),
1968    }
1969}
1970
1971/// Provenance of the source. Ways to find the original source, or verify that
1972/// some source was used for this build.
1973#[derive(Clone, Debug, Default, PartialEq)]
1974#[non_exhaustive]
1975pub struct SourceProvenance {
1976    /// A copy of the build's `source.storage_source`, if exists, with any
1977    /// generations resolved.
1978    pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
1979
1980    /// A copy of the build's `source.repo_source`, if exists, with any
1981    /// revisions resolved.
1982    pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
1983
1984    /// A copy of the build's `source.git_uri`, if exists, with any commits
1985    /// resolved.
1986    pub git_uri: std::string::String,
1987
1988    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1989}
1990
1991impl SourceProvenance {
1992    pub fn new() -> Self {
1993        std::default::Default::default()
1994    }
1995
1996    /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
1997    pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
1998    where
1999        T: std::convert::Into<crate::model::StorageSource>,
2000    {
2001        self.resolved_storage_source = std::option::Option::Some(v.into());
2002        self
2003    }
2004
2005    /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
2006    pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
2007    where
2008        T: std::convert::Into<crate::model::StorageSource>,
2009    {
2010        self.resolved_storage_source = v.map(|x| x.into());
2011        self
2012    }
2013
2014    /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
2015    pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
2016    where
2017        T: std::convert::Into<crate::model::RepoSource>,
2018    {
2019        self.resolved_repo_source = std::option::Option::Some(v.into());
2020        self
2021    }
2022
2023    /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
2024    pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
2025    where
2026        T: std::convert::Into<crate::model::RepoSource>,
2027    {
2028        self.resolved_repo_source = v.map(|x| x.into());
2029        self
2030    }
2031
2032    /// Sets the value of [git_uri][crate::model::SourceProvenance::git_uri].
2033    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2034        self.git_uri = v.into();
2035        self
2036    }
2037}
2038
2039impl wkt::message::Message for SourceProvenance {
2040    fn typename() -> &'static str {
2041        "type.googleapis.com/google.cloud.functions.v2.SourceProvenance"
2042    }
2043}
2044
2045#[doc(hidden)]
2046impl<'de> serde::de::Deserialize<'de> for SourceProvenance {
2047    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2048    where
2049        D: serde::Deserializer<'de>,
2050    {
2051        #[allow(non_camel_case_types)]
2052        #[doc(hidden)]
2053        #[derive(PartialEq, Eq, Hash)]
2054        enum __FieldTag {
2055            __resolved_storage_source,
2056            __resolved_repo_source,
2057            __git_uri,
2058            Unknown(std::string::String),
2059        }
2060        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2061            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2062            where
2063                D: serde::Deserializer<'de>,
2064            {
2065                struct Visitor;
2066                impl<'de> serde::de::Visitor<'de> for Visitor {
2067                    type Value = __FieldTag;
2068                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2069                        formatter.write_str("a field name for SourceProvenance")
2070                    }
2071                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2072                    where
2073                        E: serde::de::Error,
2074                    {
2075                        use std::result::Result::Ok;
2076                        use std::string::ToString;
2077                        match value {
2078                            "resolvedStorageSource" => Ok(__FieldTag::__resolved_storage_source),
2079                            "resolved_storage_source" => Ok(__FieldTag::__resolved_storage_source),
2080                            "resolvedRepoSource" => Ok(__FieldTag::__resolved_repo_source),
2081                            "resolved_repo_source" => Ok(__FieldTag::__resolved_repo_source),
2082                            "gitUri" => Ok(__FieldTag::__git_uri),
2083                            "git_uri" => Ok(__FieldTag::__git_uri),
2084                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2085                        }
2086                    }
2087                }
2088                deserializer.deserialize_identifier(Visitor)
2089            }
2090        }
2091        struct Visitor;
2092        impl<'de> serde::de::Visitor<'de> for Visitor {
2093            type Value = SourceProvenance;
2094            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2095                formatter.write_str("struct SourceProvenance")
2096            }
2097            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2098            where
2099                A: serde::de::MapAccess<'de>,
2100            {
2101                #[allow(unused_imports)]
2102                use serde::de::Error;
2103                use std::option::Option::Some;
2104                let mut fields = std::collections::HashSet::new();
2105                let mut result = Self::Value::new();
2106                while let Some(tag) = map.next_key::<__FieldTag>()? {
2107                    #[allow(clippy::match_single_binding)]
2108                    match tag {
2109                        __FieldTag::__resolved_storage_source => {
2110                            if !fields.insert(__FieldTag::__resolved_storage_source) {
2111                                return std::result::Result::Err(A::Error::duplicate_field(
2112                                    "multiple values for resolved_storage_source",
2113                                ));
2114                            }
2115                            result.resolved_storage_source = map
2116                                .next_value::<std::option::Option<crate::model::StorageSource>>()?;
2117                        }
2118                        __FieldTag::__resolved_repo_source => {
2119                            if !fields.insert(__FieldTag::__resolved_repo_source) {
2120                                return std::result::Result::Err(A::Error::duplicate_field(
2121                                    "multiple values for resolved_repo_source",
2122                                ));
2123                            }
2124                            result.resolved_repo_source =
2125                                map.next_value::<std::option::Option<crate::model::RepoSource>>()?;
2126                        }
2127                        __FieldTag::__git_uri => {
2128                            if !fields.insert(__FieldTag::__git_uri) {
2129                                return std::result::Result::Err(A::Error::duplicate_field(
2130                                    "multiple values for git_uri",
2131                                ));
2132                            }
2133                            result.git_uri = map
2134                                .next_value::<std::option::Option<std::string::String>>()?
2135                                .unwrap_or_default();
2136                        }
2137                        __FieldTag::Unknown(key) => {
2138                            let value = map.next_value::<serde_json::Value>()?;
2139                            result._unknown_fields.insert(key, value);
2140                        }
2141                    }
2142                }
2143                std::result::Result::Ok(result)
2144            }
2145        }
2146        deserializer.deserialize_any(Visitor)
2147    }
2148}
2149
2150#[doc(hidden)]
2151impl serde::ser::Serialize for SourceProvenance {
2152    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2153    where
2154        S: serde::ser::Serializer,
2155    {
2156        use serde::ser::SerializeMap;
2157        #[allow(unused_imports)]
2158        use std::option::Option::Some;
2159        let mut state = serializer.serialize_map(std::option::Option::None)?;
2160        if self.resolved_storage_source.is_some() {
2161            state.serialize_entry("resolvedStorageSource", &self.resolved_storage_source)?;
2162        }
2163        if self.resolved_repo_source.is_some() {
2164            state.serialize_entry("resolvedRepoSource", &self.resolved_repo_source)?;
2165        }
2166        if !self.git_uri.is_empty() {
2167            state.serialize_entry("gitUri", &self.git_uri)?;
2168        }
2169        if !self._unknown_fields.is_empty() {
2170            for (key, value) in self._unknown_fields.iter() {
2171                state.serialize_entry(key, &value)?;
2172            }
2173        }
2174        state.end()
2175    }
2176}
2177
2178/// Describes the Build step of the function that builds a container from the
2179/// given source.
2180#[derive(Clone, Debug, Default, PartialEq)]
2181#[non_exhaustive]
2182pub struct BuildConfig {
2183    /// Output only. The Cloud Build name of the latest successful deployment of
2184    /// the function.
2185    pub build: std::string::String,
2186
2187    /// The runtime in which to run the function. Required when deploying a new
2188    /// function, optional when updating an existing function. For a complete
2189    /// list of possible choices, see the
2190    /// [`gcloud` command
2191    /// reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
2192    pub runtime: std::string::String,
2193
2194    /// The name of the function (as defined in source code) that will be
2195    /// executed. Defaults to the resource name suffix, if not specified. For
2196    /// backward compatibility, if function with given name is not found, then the
2197    /// system will try to use function named "function".
2198    /// For Node.js this is name of a function exported by the module specified
2199    /// in `source_location`.
2200    pub entry_point: std::string::String,
2201
2202    /// The location of the function source code.
2203    pub source: std::option::Option<crate::model::Source>,
2204
2205    /// Output only. A permanent fixed identifier for source.
2206    pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
2207
2208    /// Name of the Cloud Build Custom Worker Pool that should be used to build the
2209    /// function. The format of this field is
2210    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
2211    /// {project} and {region} are the project id and region respectively where the
2212    /// worker pool is defined and {workerPool} is the short name of the worker
2213    /// pool.
2214    ///
2215    /// If the project id is not the same as the function, then the Cloud
2216    /// Functions Service Agent
2217    /// (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
2218    /// granted the role Cloud Build Custom Workers Builder
2219    /// (roles/cloudbuild.customworkers.builder) in the project.
2220    pub worker_pool: std::string::String,
2221
2222    /// User-provided build-time environment variables for the function
2223    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
2224
2225    /// Docker Registry to use for this deployment. This configuration is only
2226    /// applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
2227    /// Registry.
2228    /// Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
2229    /// available in response to Container Registry's deprecation:
2230    /// <https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
2231    /// Please use Artifact Registry instead, which is the default choice.
2232    ///
2233    /// If unspecified, it defaults to `ARTIFACT_REGISTRY`.
2234    /// If `docker_repository` field is specified, this field should either be left
2235    /// unspecified or set to `ARTIFACT_REGISTRY`.
2236    #[deprecated]
2237    pub docker_registry: crate::model::build_config::DockerRegistry,
2238
2239    /// Repository in Artifact Registry to which the function docker image will be
2240    /// pushed after it is built by Cloud Build. If specified by user, it is
2241    /// created and managed by user with a customer managed encryption key.
2242    /// Otherwise, GCF will create and use a repository named 'gcf-artifacts'
2243    /// for every deployed region.
2244    ///
2245    /// It must match the pattern
2246    /// `projects/{project}/locations/{location}/repositories/{repository}`.
2247    /// Repository format must be 'DOCKER'.
2248    pub docker_repository: std::string::String,
2249
2250    /// Service account to be used for building the container. The format of this
2251    /// field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
2252    pub service_account: std::string::String,
2253
2254    /// This controls when security patches are applied to the runtime environment.
2255    pub runtime_update_policy: std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>,
2256
2257    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2258}
2259
2260impl BuildConfig {
2261    pub fn new() -> Self {
2262        std::default::Default::default()
2263    }
2264
2265    /// Sets the value of [build][crate::model::BuildConfig::build].
2266    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2267        self.build = v.into();
2268        self
2269    }
2270
2271    /// Sets the value of [runtime][crate::model::BuildConfig::runtime].
2272    pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2273        self.runtime = v.into();
2274        self
2275    }
2276
2277    /// Sets the value of [entry_point][crate::model::BuildConfig::entry_point].
2278    pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2279        self.entry_point = v.into();
2280        self
2281    }
2282
2283    /// Sets the value of [source][crate::model::BuildConfig::source].
2284    pub fn set_source<T>(mut self, v: T) -> Self
2285    where
2286        T: std::convert::Into<crate::model::Source>,
2287    {
2288        self.source = std::option::Option::Some(v.into());
2289        self
2290    }
2291
2292    /// Sets or clears the value of [source][crate::model::BuildConfig::source].
2293    pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
2294    where
2295        T: std::convert::Into<crate::model::Source>,
2296    {
2297        self.source = v.map(|x| x.into());
2298        self
2299    }
2300
2301    /// Sets the value of [source_provenance][crate::model::BuildConfig::source_provenance].
2302    pub fn set_source_provenance<T>(mut self, v: T) -> Self
2303    where
2304        T: std::convert::Into<crate::model::SourceProvenance>,
2305    {
2306        self.source_provenance = std::option::Option::Some(v.into());
2307        self
2308    }
2309
2310    /// Sets or clears the value of [source_provenance][crate::model::BuildConfig::source_provenance].
2311    pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2312    where
2313        T: std::convert::Into<crate::model::SourceProvenance>,
2314    {
2315        self.source_provenance = v.map(|x| x.into());
2316        self
2317    }
2318
2319    /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
2320    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2321        self.worker_pool = v.into();
2322        self
2323    }
2324
2325    /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
2326    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
2327    where
2328        T: std::iter::IntoIterator<Item = (K, V)>,
2329        K: std::convert::Into<std::string::String>,
2330        V: std::convert::Into<std::string::String>,
2331    {
2332        use std::iter::Iterator;
2333        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2334        self
2335    }
2336
2337    /// Sets the value of [docker_registry][crate::model::BuildConfig::docker_registry].
2338    #[deprecated]
2339    pub fn set_docker_registry<
2340        T: std::convert::Into<crate::model::build_config::DockerRegistry>,
2341    >(
2342        mut self,
2343        v: T,
2344    ) -> Self {
2345        self.docker_registry = v.into();
2346        self
2347    }
2348
2349    /// Sets the value of [docker_repository][crate::model::BuildConfig::docker_repository].
2350    pub fn set_docker_repository<T: std::convert::Into<std::string::String>>(
2351        mut self,
2352        v: T,
2353    ) -> Self {
2354        self.docker_repository = v.into();
2355        self
2356    }
2357
2358    /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
2359    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2360        self.service_account = v.into();
2361        self
2362    }
2363
2364    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy].
2365    ///
2366    /// Note that all the setters affecting `runtime_update_policy` are mutually
2367    /// exclusive.
2368    pub fn set_runtime_update_policy<
2369        T: std::convert::Into<std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>>,
2370    >(
2371        mut self,
2372        v: T,
2373    ) -> Self {
2374        self.runtime_update_policy = v.into();
2375        self
2376    }
2377
2378    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2379    /// if it holds a `AutomaticUpdatePolicy`, `None` if the field is not set or
2380    /// holds a different branch.
2381    pub fn automatic_update_policy(
2382        &self,
2383    ) -> std::option::Option<&std::boxed::Box<crate::model::AutomaticUpdatePolicy>> {
2384        #[allow(unreachable_patterns)]
2385        self.runtime_update_policy.as_ref().and_then(|v| match v {
2386            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v) => {
2387                std::option::Option::Some(v)
2388            }
2389            _ => std::option::Option::None,
2390        })
2391    }
2392
2393    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2394    /// to hold a `AutomaticUpdatePolicy`.
2395    ///
2396    /// Note that all the setters affecting `runtime_update_policy` are
2397    /// mutually exclusive.
2398    pub fn set_automatic_update_policy<
2399        T: std::convert::Into<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>,
2400    >(
2401        mut self,
2402        v: T,
2403    ) -> Self {
2404        self.runtime_update_policy = std::option::Option::Some(
2405            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v.into()),
2406        );
2407        self
2408    }
2409
2410    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2411    /// if it holds a `OnDeployUpdatePolicy`, `None` if the field is not set or
2412    /// holds a different branch.
2413    pub fn on_deploy_update_policy(
2414        &self,
2415    ) -> std::option::Option<&std::boxed::Box<crate::model::OnDeployUpdatePolicy>> {
2416        #[allow(unreachable_patterns)]
2417        self.runtime_update_policy.as_ref().and_then(|v| match v {
2418            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v) => {
2419                std::option::Option::Some(v)
2420            }
2421            _ => std::option::Option::None,
2422        })
2423    }
2424
2425    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
2426    /// to hold a `OnDeployUpdatePolicy`.
2427    ///
2428    /// Note that all the setters affecting `runtime_update_policy` are
2429    /// mutually exclusive.
2430    pub fn set_on_deploy_update_policy<
2431        T: std::convert::Into<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>,
2432    >(
2433        mut self,
2434        v: T,
2435    ) -> Self {
2436        self.runtime_update_policy = std::option::Option::Some(
2437            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v.into()),
2438        );
2439        self
2440    }
2441}
2442
2443impl wkt::message::Message for BuildConfig {
2444    fn typename() -> &'static str {
2445        "type.googleapis.com/google.cloud.functions.v2.BuildConfig"
2446    }
2447}
2448
2449#[doc(hidden)]
2450impl<'de> serde::de::Deserialize<'de> for BuildConfig {
2451    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2452    where
2453        D: serde::Deserializer<'de>,
2454    {
2455        #[allow(non_camel_case_types)]
2456        #[doc(hidden)]
2457        #[derive(PartialEq, Eq, Hash)]
2458        enum __FieldTag {
2459            __automatic_update_policy,
2460            __on_deploy_update_policy,
2461            __build,
2462            __runtime,
2463            __entry_point,
2464            __source,
2465            __source_provenance,
2466            __worker_pool,
2467            __environment_variables,
2468            __docker_registry,
2469            __docker_repository,
2470            __service_account,
2471            Unknown(std::string::String),
2472        }
2473        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2474            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2475            where
2476                D: serde::Deserializer<'de>,
2477            {
2478                struct Visitor;
2479                impl<'de> serde::de::Visitor<'de> for Visitor {
2480                    type Value = __FieldTag;
2481                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2482                        formatter.write_str("a field name for BuildConfig")
2483                    }
2484                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2485                    where
2486                        E: serde::de::Error,
2487                    {
2488                        use std::result::Result::Ok;
2489                        use std::string::ToString;
2490                        match value {
2491                            "automaticUpdatePolicy" => Ok(__FieldTag::__automatic_update_policy),
2492                            "automatic_update_policy" => Ok(__FieldTag::__automatic_update_policy),
2493                            "onDeployUpdatePolicy" => Ok(__FieldTag::__on_deploy_update_policy),
2494                            "on_deploy_update_policy" => Ok(__FieldTag::__on_deploy_update_policy),
2495                            "build" => Ok(__FieldTag::__build),
2496                            "runtime" => Ok(__FieldTag::__runtime),
2497                            "entryPoint" => Ok(__FieldTag::__entry_point),
2498                            "entry_point" => Ok(__FieldTag::__entry_point),
2499                            "source" => Ok(__FieldTag::__source),
2500                            "sourceProvenance" => Ok(__FieldTag::__source_provenance),
2501                            "source_provenance" => Ok(__FieldTag::__source_provenance),
2502                            "workerPool" => Ok(__FieldTag::__worker_pool),
2503                            "worker_pool" => Ok(__FieldTag::__worker_pool),
2504                            "environmentVariables" => Ok(__FieldTag::__environment_variables),
2505                            "environment_variables" => Ok(__FieldTag::__environment_variables),
2506                            "dockerRegistry" => Ok(__FieldTag::__docker_registry),
2507                            "docker_registry" => Ok(__FieldTag::__docker_registry),
2508                            "dockerRepository" => Ok(__FieldTag::__docker_repository),
2509                            "docker_repository" => Ok(__FieldTag::__docker_repository),
2510                            "serviceAccount" => Ok(__FieldTag::__service_account),
2511                            "service_account" => Ok(__FieldTag::__service_account),
2512                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2513                        }
2514                    }
2515                }
2516                deserializer.deserialize_identifier(Visitor)
2517            }
2518        }
2519        struct Visitor;
2520        impl<'de> serde::de::Visitor<'de> for Visitor {
2521            type Value = BuildConfig;
2522            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2523                formatter.write_str("struct BuildConfig")
2524            }
2525            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2526            where
2527                A: serde::de::MapAccess<'de>,
2528            {
2529                #[allow(unused_imports)]
2530                use serde::de::Error;
2531                use std::option::Option::Some;
2532                let mut fields = std::collections::HashSet::new();
2533                let mut result = Self::Value::new();
2534                while let Some(tag) = map.next_key::<__FieldTag>()? {
2535                    #[allow(clippy::match_single_binding)]
2536                    match tag {
2537                        __FieldTag::__automatic_update_policy => {
2538                            if !fields.insert(__FieldTag::__automatic_update_policy) {
2539                                return std::result::Result::Err(A::Error::duplicate_field(
2540                                    "multiple values for automatic_update_policy",
2541                                ));
2542                            }
2543                            if result.runtime_update_policy.is_some() {
2544                                return std::result::Result::Err(A::Error::duplicate_field(
2545                                    "multiple values for `runtime_update_policy`, a oneof with full ID .google.cloud.functions.v2.BuildConfig.automatic_update_policy, latest field was automaticUpdatePolicy",
2546                                ));
2547                            }
2548                            result.runtime_update_policy = std::option::Option::Some(
2549                                crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(
2550                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>>()?.unwrap_or_default()
2551                                ),
2552                            );
2553                        }
2554                        __FieldTag::__on_deploy_update_policy => {
2555                            if !fields.insert(__FieldTag::__on_deploy_update_policy) {
2556                                return std::result::Result::Err(A::Error::duplicate_field(
2557                                    "multiple values for on_deploy_update_policy",
2558                                ));
2559                            }
2560                            if result.runtime_update_policy.is_some() {
2561                                return std::result::Result::Err(A::Error::duplicate_field(
2562                                    "multiple values for `runtime_update_policy`, a oneof with full ID .google.cloud.functions.v2.BuildConfig.on_deploy_update_policy, latest field was onDeployUpdatePolicy",
2563                                ));
2564                            }
2565                            result.runtime_update_policy = std::option::Option::Some(
2566                                crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(
2567                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>>()?.unwrap_or_default()
2568                                ),
2569                            );
2570                        }
2571                        __FieldTag::__build => {
2572                            if !fields.insert(__FieldTag::__build) {
2573                                return std::result::Result::Err(A::Error::duplicate_field(
2574                                    "multiple values for build",
2575                                ));
2576                            }
2577                            result.build = map
2578                                .next_value::<std::option::Option<std::string::String>>()?
2579                                .unwrap_or_default();
2580                        }
2581                        __FieldTag::__runtime => {
2582                            if !fields.insert(__FieldTag::__runtime) {
2583                                return std::result::Result::Err(A::Error::duplicate_field(
2584                                    "multiple values for runtime",
2585                                ));
2586                            }
2587                            result.runtime = map
2588                                .next_value::<std::option::Option<std::string::String>>()?
2589                                .unwrap_or_default();
2590                        }
2591                        __FieldTag::__entry_point => {
2592                            if !fields.insert(__FieldTag::__entry_point) {
2593                                return std::result::Result::Err(A::Error::duplicate_field(
2594                                    "multiple values for entry_point",
2595                                ));
2596                            }
2597                            result.entry_point = map
2598                                .next_value::<std::option::Option<std::string::String>>()?
2599                                .unwrap_or_default();
2600                        }
2601                        __FieldTag::__source => {
2602                            if !fields.insert(__FieldTag::__source) {
2603                                return std::result::Result::Err(A::Error::duplicate_field(
2604                                    "multiple values for source",
2605                                ));
2606                            }
2607                            result.source =
2608                                map.next_value::<std::option::Option<crate::model::Source>>()?;
2609                        }
2610                        __FieldTag::__source_provenance => {
2611                            if !fields.insert(__FieldTag::__source_provenance) {
2612                                return std::result::Result::Err(A::Error::duplicate_field(
2613                                    "multiple values for source_provenance",
2614                                ));
2615                            }
2616                            result.source_provenance = map
2617                                .next_value::<std::option::Option<crate::model::SourceProvenance>>(
2618                                )?;
2619                        }
2620                        __FieldTag::__worker_pool => {
2621                            if !fields.insert(__FieldTag::__worker_pool) {
2622                                return std::result::Result::Err(A::Error::duplicate_field(
2623                                    "multiple values for worker_pool",
2624                                ));
2625                            }
2626                            result.worker_pool = map
2627                                .next_value::<std::option::Option<std::string::String>>()?
2628                                .unwrap_or_default();
2629                        }
2630                        __FieldTag::__environment_variables => {
2631                            if !fields.insert(__FieldTag::__environment_variables) {
2632                                return std::result::Result::Err(A::Error::duplicate_field(
2633                                    "multiple values for environment_variables",
2634                                ));
2635                            }
2636                            result.environment_variables = map
2637                                .next_value::<std::option::Option<
2638                                    std::collections::HashMap<
2639                                        std::string::String,
2640                                        std::string::String,
2641                                    >,
2642                                >>()?
2643                                .unwrap_or_default();
2644                        }
2645                        __FieldTag::__docker_registry => {
2646                            if !fields.insert(__FieldTag::__docker_registry) {
2647                                return std::result::Result::Err(A::Error::duplicate_field(
2648                                    "multiple values for docker_registry",
2649                                ));
2650                            }
2651                            result.docker_registry = map.next_value::<std::option::Option<crate::model::build_config::DockerRegistry>>()?.unwrap_or_default();
2652                        }
2653                        __FieldTag::__docker_repository => {
2654                            if !fields.insert(__FieldTag::__docker_repository) {
2655                                return std::result::Result::Err(A::Error::duplicate_field(
2656                                    "multiple values for docker_repository",
2657                                ));
2658                            }
2659                            result.docker_repository = map
2660                                .next_value::<std::option::Option<std::string::String>>()?
2661                                .unwrap_or_default();
2662                        }
2663                        __FieldTag::__service_account => {
2664                            if !fields.insert(__FieldTag::__service_account) {
2665                                return std::result::Result::Err(A::Error::duplicate_field(
2666                                    "multiple values for service_account",
2667                                ));
2668                            }
2669                            result.service_account = map
2670                                .next_value::<std::option::Option<std::string::String>>()?
2671                                .unwrap_or_default();
2672                        }
2673                        __FieldTag::Unknown(key) => {
2674                            let value = map.next_value::<serde_json::Value>()?;
2675                            result._unknown_fields.insert(key, value);
2676                        }
2677                    }
2678                }
2679                std::result::Result::Ok(result)
2680            }
2681        }
2682        deserializer.deserialize_any(Visitor)
2683    }
2684}
2685
2686#[doc(hidden)]
2687impl serde::ser::Serialize for BuildConfig {
2688    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2689    where
2690        S: serde::ser::Serializer,
2691    {
2692        use serde::ser::SerializeMap;
2693        #[allow(unused_imports)]
2694        use std::option::Option::Some;
2695        let mut state = serializer.serialize_map(std::option::Option::None)?;
2696        if let Some(value) = self.automatic_update_policy() {
2697            state.serialize_entry("automaticUpdatePolicy", value)?;
2698        }
2699        if let Some(value) = self.on_deploy_update_policy() {
2700            state.serialize_entry("onDeployUpdatePolicy", value)?;
2701        }
2702        if !self.build.is_empty() {
2703            state.serialize_entry("build", &self.build)?;
2704        }
2705        if !self.runtime.is_empty() {
2706            state.serialize_entry("runtime", &self.runtime)?;
2707        }
2708        if !self.entry_point.is_empty() {
2709            state.serialize_entry("entryPoint", &self.entry_point)?;
2710        }
2711        if self.source.is_some() {
2712            state.serialize_entry("source", &self.source)?;
2713        }
2714        if self.source_provenance.is_some() {
2715            state.serialize_entry("sourceProvenance", &self.source_provenance)?;
2716        }
2717        if !self.worker_pool.is_empty() {
2718            state.serialize_entry("workerPool", &self.worker_pool)?;
2719        }
2720        if !self.environment_variables.is_empty() {
2721            state.serialize_entry("environmentVariables", &self.environment_variables)?;
2722        }
2723        if !wkt::internal::is_default(&self.docker_registry) {
2724            state.serialize_entry("dockerRegistry", &self.docker_registry)?;
2725        }
2726        if !self.docker_repository.is_empty() {
2727            state.serialize_entry("dockerRepository", &self.docker_repository)?;
2728        }
2729        if !self.service_account.is_empty() {
2730            state.serialize_entry("serviceAccount", &self.service_account)?;
2731        }
2732        if !self._unknown_fields.is_empty() {
2733            for (key, value) in self._unknown_fields.iter() {
2734                state.serialize_entry(key, &value)?;
2735            }
2736        }
2737        state.end()
2738    }
2739}
2740
2741/// Defines additional types related to [BuildConfig].
2742pub mod build_config {
2743    #[allow(unused_imports)]
2744    use super::*;
2745
2746    /// Docker Registry to use for storing function Docker images.
2747    ///
2748    /// # Working with unknown values
2749    ///
2750    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2751    /// additional enum variants at any time. Adding new variants is not considered
2752    /// a breaking change. Applications should write their code in anticipation of:
2753    ///
2754    /// - New values appearing in future releases of the client library, **and**
2755    /// - New values received dynamically, without application changes.
2756    ///
2757    /// Please consult the [Working with enums] section in the user guide for some
2758    /// guidelines.
2759    ///
2760    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2761    #[derive(Clone, Debug, PartialEq)]
2762    #[non_exhaustive]
2763    pub enum DockerRegistry {
2764        /// Unspecified.
2765        Unspecified,
2766        /// Docker images will be stored in multi-regional Container Registry
2767        /// repositories named `gcf`.
2768        ContainerRegistry,
2769        /// Docker images will be stored in regional Artifact Registry repositories.
2770        /// By default, GCF will create and use repositories named `gcf-artifacts`
2771        /// in every region in which a function is deployed. But the repository to
2772        /// use can also be specified by the user using the `docker_repository`
2773        /// field.
2774        ArtifactRegistry,
2775        /// If set, the enum was initialized with an unknown value.
2776        ///
2777        /// Applications can examine the value using [DockerRegistry::value] or
2778        /// [DockerRegistry::name].
2779        UnknownValue(docker_registry::UnknownValue),
2780    }
2781
2782    #[doc(hidden)]
2783    pub mod docker_registry {
2784        #[allow(unused_imports)]
2785        use super::*;
2786        #[derive(Clone, Debug, PartialEq)]
2787        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2788    }
2789
2790    impl DockerRegistry {
2791        /// Gets the enum value.
2792        ///
2793        /// Returns `None` if the enum contains an unknown value deserialized from
2794        /// the string representation of enums.
2795        pub fn value(&self) -> std::option::Option<i32> {
2796            match self {
2797                Self::Unspecified => std::option::Option::Some(0),
2798                Self::ContainerRegistry => std::option::Option::Some(1),
2799                Self::ArtifactRegistry => std::option::Option::Some(2),
2800                Self::UnknownValue(u) => u.0.value(),
2801            }
2802        }
2803
2804        /// Gets the enum value as a string.
2805        ///
2806        /// Returns `None` if the enum contains an unknown value deserialized from
2807        /// the integer representation of enums.
2808        pub fn name(&self) -> std::option::Option<&str> {
2809            match self {
2810                Self::Unspecified => std::option::Option::Some("DOCKER_REGISTRY_UNSPECIFIED"),
2811                Self::ContainerRegistry => std::option::Option::Some("CONTAINER_REGISTRY"),
2812                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
2813                Self::UnknownValue(u) => u.0.name(),
2814            }
2815        }
2816    }
2817
2818    impl std::default::Default for DockerRegistry {
2819        fn default() -> Self {
2820            use std::convert::From;
2821            Self::from(0)
2822        }
2823    }
2824
2825    impl std::fmt::Display for DockerRegistry {
2826        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2827            wkt::internal::display_enum(f, self.name(), self.value())
2828        }
2829    }
2830
2831    impl std::convert::From<i32> for DockerRegistry {
2832        fn from(value: i32) -> Self {
2833            match value {
2834                0 => Self::Unspecified,
2835                1 => Self::ContainerRegistry,
2836                2 => Self::ArtifactRegistry,
2837                _ => Self::UnknownValue(docker_registry::UnknownValue(
2838                    wkt::internal::UnknownEnumValue::Integer(value),
2839                )),
2840            }
2841        }
2842    }
2843
2844    impl std::convert::From<&str> for DockerRegistry {
2845        fn from(value: &str) -> Self {
2846            use std::string::ToString;
2847            match value {
2848                "DOCKER_REGISTRY_UNSPECIFIED" => Self::Unspecified,
2849                "CONTAINER_REGISTRY" => Self::ContainerRegistry,
2850                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
2851                _ => Self::UnknownValue(docker_registry::UnknownValue(
2852                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2853                )),
2854            }
2855        }
2856    }
2857
2858    impl serde::ser::Serialize for DockerRegistry {
2859        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2860        where
2861            S: serde::Serializer,
2862        {
2863            match self {
2864                Self::Unspecified => serializer.serialize_i32(0),
2865                Self::ContainerRegistry => serializer.serialize_i32(1),
2866                Self::ArtifactRegistry => serializer.serialize_i32(2),
2867                Self::UnknownValue(u) => u.0.serialize(serializer),
2868            }
2869        }
2870    }
2871
2872    impl<'de> serde::de::Deserialize<'de> for DockerRegistry {
2873        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2874        where
2875            D: serde::Deserializer<'de>,
2876        {
2877            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DockerRegistry>::new(
2878                ".google.cloud.functions.v2.BuildConfig.DockerRegistry",
2879            ))
2880        }
2881    }
2882
2883    /// This controls when security patches are applied to the runtime environment.
2884    #[derive(Clone, Debug, PartialEq)]
2885    #[non_exhaustive]
2886    pub enum RuntimeUpdatePolicy {
2887        AutomaticUpdatePolicy(std::boxed::Box<crate::model::AutomaticUpdatePolicy>),
2888        OnDeployUpdatePolicy(std::boxed::Box<crate::model::OnDeployUpdatePolicy>),
2889    }
2890}
2891
2892/// Describes the Service being deployed.
2893/// Currently Supported : Cloud Run (fully managed).
2894#[derive(Clone, Debug, Default, PartialEq)]
2895#[non_exhaustive]
2896pub struct ServiceConfig {
2897    /// Output only. Name of the service associated with a Function.
2898    /// The format of this field is
2899    /// `projects/{project}/locations/{region}/services/{service}`
2900    pub service: std::string::String,
2901
2902    /// The function execution timeout. Execution is considered failed and
2903    /// can be terminated if the function is not completed at the end of the
2904    /// timeout period. Defaults to 60 seconds.
2905    pub timeout_seconds: i32,
2906
2907    /// The amount of memory available for a function.
2908    /// Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
2909    /// supplied the value is interpreted as bytes.
2910    /// See
2911    /// <https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
2912    /// a full description.
2913    pub available_memory: std::string::String,
2914
2915    /// The number of CPUs used in a single container instance.
2916    /// Default value is calculated from available memory.
2917    /// Supports the same values as Cloud Run, see
2918    /// <https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
2919    /// Example: "1" indicates 1 vCPU
2920    pub available_cpu: std::string::String,
2921
2922    /// Environment variables that shall be available during function execution.
2923    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
2924
2925    /// The limit on the maximum number of function instances that may coexist at a
2926    /// given time.
2927    ///
2928    /// In some cases, such as rapid traffic surges, Cloud Functions may, for a
2929    /// short period of time, create more instances than the specified max
2930    /// instances limit. If your function cannot tolerate this temporary behavior,
2931    /// you may want to factor in a safety margin and set a lower max instances
2932    /// value than your function can tolerate.
2933    ///
2934    /// See the [Max
2935    /// Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
2936    /// more details.
2937    pub max_instance_count: i32,
2938
2939    /// The limit on the minimum number of function instances that may coexist at a
2940    /// given time.
2941    ///
2942    /// Function instances are kept in idle state for a short period after they
2943    /// finished executing the request to reduce cold start time for subsequent
2944    /// requests. Setting a minimum instance count will ensure that the given
2945    /// number of instances are kept running in idle state always. This can help
2946    /// with cold start times when jump in incoming request count occurs after the
2947    /// idle instance would have been stopped in the default case.
2948    pub min_instance_count: i32,
2949
2950    /// The Serverless VPC Access connector that this cloud function can connect
2951    /// to. The format of this field is `projects/*/locations/*/connectors/*`.
2952    pub vpc_connector: std::string::String,
2953
2954    /// The egress settings for the connector, controlling what traffic is diverted
2955    /// through it.
2956    pub vpc_connector_egress_settings: crate::model::service_config::VpcConnectorEgressSettings,
2957
2958    /// The ingress settings for the function, controlling what traffic can reach
2959    /// it.
2960    pub ingress_settings: crate::model::service_config::IngressSettings,
2961
2962    /// Output only. URI of the Service deployed.
2963    pub uri: std::string::String,
2964
2965    /// The email of the service's service account. If empty, defaults to
2966    /// `{project_number}-compute@developer.gserviceaccount.com`.
2967    pub service_account_email: std::string::String,
2968
2969    /// Whether 100% of traffic is routed to the latest revision.
2970    /// On CreateFunction and UpdateFunction, when set to true, the revision being
2971    /// deployed will serve 100% of traffic, ignoring any traffic split settings,
2972    /// if any. On GetFunction, true will be returned if the latest revision is
2973    /// serving 100% of traffic.
2974    pub all_traffic_on_latest_revision: bool,
2975
2976    /// Secret environment variables configuration.
2977    pub secret_environment_variables: std::vec::Vec<crate::model::SecretEnvVar>,
2978
2979    /// Secret volumes configuration.
2980    pub secret_volumes: std::vec::Vec<crate::model::SecretVolume>,
2981
2982    /// Output only. The name of service revision.
2983    pub revision: std::string::String,
2984
2985    /// Sets the maximum number of concurrent requests that each instance
2986    /// can receive. Defaults to 1.
2987    pub max_instance_request_concurrency: i32,
2988
2989    /// Security level configure whether the function only accepts https.
2990    /// This configuration is only applicable to 1st Gen functions with Http
2991    /// trigger. By default https is optional for 1st Gen functions; 2nd Gen
2992    /// functions are https ONLY.
2993    pub security_level: crate::model::service_config::SecurityLevel,
2994
2995    /// Optional. The binary authorization policy to be checked when deploying the
2996    /// Cloud Run service.
2997    pub binary_authorization_policy: std::string::String,
2998
2999    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3000}
3001
3002impl ServiceConfig {
3003    pub fn new() -> Self {
3004        std::default::Default::default()
3005    }
3006
3007    /// Sets the value of [service][crate::model::ServiceConfig::service].
3008    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3009        self.service = v.into();
3010        self
3011    }
3012
3013    /// Sets the value of [timeout_seconds][crate::model::ServiceConfig::timeout_seconds].
3014    pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3015        self.timeout_seconds = v.into();
3016        self
3017    }
3018
3019    /// Sets the value of [available_memory][crate::model::ServiceConfig::available_memory].
3020    pub fn set_available_memory<T: std::convert::Into<std::string::String>>(
3021        mut self,
3022        v: T,
3023    ) -> Self {
3024        self.available_memory = v.into();
3025        self
3026    }
3027
3028    /// Sets the value of [available_cpu][crate::model::ServiceConfig::available_cpu].
3029    pub fn set_available_cpu<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3030        self.available_cpu = v.into();
3031        self
3032    }
3033
3034    /// Sets the value of [environment_variables][crate::model::ServiceConfig::environment_variables].
3035    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
3036    where
3037        T: std::iter::IntoIterator<Item = (K, V)>,
3038        K: std::convert::Into<std::string::String>,
3039        V: std::convert::Into<std::string::String>,
3040    {
3041        use std::iter::Iterator;
3042        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3043        self
3044    }
3045
3046    /// Sets the value of [max_instance_count][crate::model::ServiceConfig::max_instance_count].
3047    pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3048        self.max_instance_count = v.into();
3049        self
3050    }
3051
3052    /// Sets the value of [min_instance_count][crate::model::ServiceConfig::min_instance_count].
3053    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3054        self.min_instance_count = v.into();
3055        self
3056    }
3057
3058    /// Sets the value of [vpc_connector][crate::model::ServiceConfig::vpc_connector].
3059    pub fn set_vpc_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3060        self.vpc_connector = v.into();
3061        self
3062    }
3063
3064    /// Sets the value of [vpc_connector_egress_settings][crate::model::ServiceConfig::vpc_connector_egress_settings].
3065    pub fn set_vpc_connector_egress_settings<
3066        T: std::convert::Into<crate::model::service_config::VpcConnectorEgressSettings>,
3067    >(
3068        mut self,
3069        v: T,
3070    ) -> Self {
3071        self.vpc_connector_egress_settings = v.into();
3072        self
3073    }
3074
3075    /// Sets the value of [ingress_settings][crate::model::ServiceConfig::ingress_settings].
3076    pub fn set_ingress_settings<
3077        T: std::convert::Into<crate::model::service_config::IngressSettings>,
3078    >(
3079        mut self,
3080        v: T,
3081    ) -> Self {
3082        self.ingress_settings = v.into();
3083        self
3084    }
3085
3086    /// Sets the value of [uri][crate::model::ServiceConfig::uri].
3087    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3088        self.uri = v.into();
3089        self
3090    }
3091
3092    /// Sets the value of [service_account_email][crate::model::ServiceConfig::service_account_email].
3093    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
3094        mut self,
3095        v: T,
3096    ) -> Self {
3097        self.service_account_email = v.into();
3098        self
3099    }
3100
3101    /// Sets the value of [all_traffic_on_latest_revision][crate::model::ServiceConfig::all_traffic_on_latest_revision].
3102    pub fn set_all_traffic_on_latest_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3103        self.all_traffic_on_latest_revision = v.into();
3104        self
3105    }
3106
3107    /// Sets the value of [secret_environment_variables][crate::model::ServiceConfig::secret_environment_variables].
3108    pub fn set_secret_environment_variables<T, V>(mut self, v: T) -> Self
3109    where
3110        T: std::iter::IntoIterator<Item = V>,
3111        V: std::convert::Into<crate::model::SecretEnvVar>,
3112    {
3113        use std::iter::Iterator;
3114        self.secret_environment_variables = v.into_iter().map(|i| i.into()).collect();
3115        self
3116    }
3117
3118    /// Sets the value of [secret_volumes][crate::model::ServiceConfig::secret_volumes].
3119    pub fn set_secret_volumes<T, V>(mut self, v: T) -> Self
3120    where
3121        T: std::iter::IntoIterator<Item = V>,
3122        V: std::convert::Into<crate::model::SecretVolume>,
3123    {
3124        use std::iter::Iterator;
3125        self.secret_volumes = v.into_iter().map(|i| i.into()).collect();
3126        self
3127    }
3128
3129    /// Sets the value of [revision][crate::model::ServiceConfig::revision].
3130    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3131        self.revision = v.into();
3132        self
3133    }
3134
3135    /// Sets the value of [max_instance_request_concurrency][crate::model::ServiceConfig::max_instance_request_concurrency].
3136    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
3137        mut self,
3138        v: T,
3139    ) -> Self {
3140        self.max_instance_request_concurrency = v.into();
3141        self
3142    }
3143
3144    /// Sets the value of [security_level][crate::model::ServiceConfig::security_level].
3145    pub fn set_security_level<
3146        T: std::convert::Into<crate::model::service_config::SecurityLevel>,
3147    >(
3148        mut self,
3149        v: T,
3150    ) -> Self {
3151        self.security_level = v.into();
3152        self
3153    }
3154
3155    /// Sets the value of [binary_authorization_policy][crate::model::ServiceConfig::binary_authorization_policy].
3156    pub fn set_binary_authorization_policy<T: std::convert::Into<std::string::String>>(
3157        mut self,
3158        v: T,
3159    ) -> Self {
3160        self.binary_authorization_policy = v.into();
3161        self
3162    }
3163}
3164
3165impl wkt::message::Message for ServiceConfig {
3166    fn typename() -> &'static str {
3167        "type.googleapis.com/google.cloud.functions.v2.ServiceConfig"
3168    }
3169}
3170
3171#[doc(hidden)]
3172impl<'de> serde::de::Deserialize<'de> for ServiceConfig {
3173    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3174    where
3175        D: serde::Deserializer<'de>,
3176    {
3177        #[allow(non_camel_case_types)]
3178        #[doc(hidden)]
3179        #[derive(PartialEq, Eq, Hash)]
3180        enum __FieldTag {
3181            __service,
3182            __timeout_seconds,
3183            __available_memory,
3184            __available_cpu,
3185            __environment_variables,
3186            __max_instance_count,
3187            __min_instance_count,
3188            __vpc_connector,
3189            __vpc_connector_egress_settings,
3190            __ingress_settings,
3191            __uri,
3192            __service_account_email,
3193            __all_traffic_on_latest_revision,
3194            __secret_environment_variables,
3195            __secret_volumes,
3196            __revision,
3197            __max_instance_request_concurrency,
3198            __security_level,
3199            __binary_authorization_policy,
3200            Unknown(std::string::String),
3201        }
3202        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3203            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3204            where
3205                D: serde::Deserializer<'de>,
3206            {
3207                struct Visitor;
3208                impl<'de> serde::de::Visitor<'de> for Visitor {
3209                    type Value = __FieldTag;
3210                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3211                        formatter.write_str("a field name for ServiceConfig")
3212                    }
3213                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3214                    where
3215                        E: serde::de::Error,
3216                    {
3217                        use std::result::Result::Ok;
3218                        use std::string::ToString;
3219                        match value {
3220                            "service" => Ok(__FieldTag::__service),
3221                            "timeoutSeconds" => Ok(__FieldTag::__timeout_seconds),
3222                            "timeout_seconds" => Ok(__FieldTag::__timeout_seconds),
3223                            "availableMemory" => Ok(__FieldTag::__available_memory),
3224                            "available_memory" => Ok(__FieldTag::__available_memory),
3225                            "availableCpu" => Ok(__FieldTag::__available_cpu),
3226                            "available_cpu" => Ok(__FieldTag::__available_cpu),
3227                            "environmentVariables" => Ok(__FieldTag::__environment_variables),
3228                            "environment_variables" => Ok(__FieldTag::__environment_variables),
3229                            "maxInstanceCount" => Ok(__FieldTag::__max_instance_count),
3230                            "max_instance_count" => Ok(__FieldTag::__max_instance_count),
3231                            "minInstanceCount" => Ok(__FieldTag::__min_instance_count),
3232                            "min_instance_count" => Ok(__FieldTag::__min_instance_count),
3233                            "vpcConnector" => Ok(__FieldTag::__vpc_connector),
3234                            "vpc_connector" => Ok(__FieldTag::__vpc_connector),
3235                            "vpcConnectorEgressSettings" => {
3236                                Ok(__FieldTag::__vpc_connector_egress_settings)
3237                            }
3238                            "vpc_connector_egress_settings" => {
3239                                Ok(__FieldTag::__vpc_connector_egress_settings)
3240                            }
3241                            "ingressSettings" => Ok(__FieldTag::__ingress_settings),
3242                            "ingress_settings" => Ok(__FieldTag::__ingress_settings),
3243                            "uri" => Ok(__FieldTag::__uri),
3244                            "serviceAccountEmail" => Ok(__FieldTag::__service_account_email),
3245                            "service_account_email" => Ok(__FieldTag::__service_account_email),
3246                            "allTrafficOnLatestRevision" => {
3247                                Ok(__FieldTag::__all_traffic_on_latest_revision)
3248                            }
3249                            "all_traffic_on_latest_revision" => {
3250                                Ok(__FieldTag::__all_traffic_on_latest_revision)
3251                            }
3252                            "secretEnvironmentVariables" => {
3253                                Ok(__FieldTag::__secret_environment_variables)
3254                            }
3255                            "secret_environment_variables" => {
3256                                Ok(__FieldTag::__secret_environment_variables)
3257                            }
3258                            "secretVolumes" => Ok(__FieldTag::__secret_volumes),
3259                            "secret_volumes" => Ok(__FieldTag::__secret_volumes),
3260                            "revision" => Ok(__FieldTag::__revision),
3261                            "maxInstanceRequestConcurrency" => {
3262                                Ok(__FieldTag::__max_instance_request_concurrency)
3263                            }
3264                            "max_instance_request_concurrency" => {
3265                                Ok(__FieldTag::__max_instance_request_concurrency)
3266                            }
3267                            "securityLevel" => Ok(__FieldTag::__security_level),
3268                            "security_level" => Ok(__FieldTag::__security_level),
3269                            "binaryAuthorizationPolicy" => {
3270                                Ok(__FieldTag::__binary_authorization_policy)
3271                            }
3272                            "binary_authorization_policy" => {
3273                                Ok(__FieldTag::__binary_authorization_policy)
3274                            }
3275                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3276                        }
3277                    }
3278                }
3279                deserializer.deserialize_identifier(Visitor)
3280            }
3281        }
3282        struct Visitor;
3283        impl<'de> serde::de::Visitor<'de> for Visitor {
3284            type Value = ServiceConfig;
3285            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3286                formatter.write_str("struct ServiceConfig")
3287            }
3288            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3289            where
3290                A: serde::de::MapAccess<'de>,
3291            {
3292                #[allow(unused_imports)]
3293                use serde::de::Error;
3294                use std::option::Option::Some;
3295                let mut fields = std::collections::HashSet::new();
3296                let mut result = Self::Value::new();
3297                while let Some(tag) = map.next_key::<__FieldTag>()? {
3298                    #[allow(clippy::match_single_binding)]
3299                    match tag {
3300                        __FieldTag::__service => {
3301                            if !fields.insert(__FieldTag::__service) {
3302                                return std::result::Result::Err(A::Error::duplicate_field(
3303                                    "multiple values for service",
3304                                ));
3305                            }
3306                            result.service = map
3307                                .next_value::<std::option::Option<std::string::String>>()?
3308                                .unwrap_or_default();
3309                        }
3310                        __FieldTag::__timeout_seconds => {
3311                            if !fields.insert(__FieldTag::__timeout_seconds) {
3312                                return std::result::Result::Err(A::Error::duplicate_field(
3313                                    "multiple values for timeout_seconds",
3314                                ));
3315                            }
3316                            struct __With(std::option::Option<i32>);
3317                            impl<'de> serde::de::Deserialize<'de> for __With {
3318                                fn deserialize<D>(
3319                                    deserializer: D,
3320                                ) -> std::result::Result<Self, D::Error>
3321                                where
3322                                    D: serde::de::Deserializer<'de>,
3323                                {
3324                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3325                                }
3326                            }
3327                            result.timeout_seconds =
3328                                map.next_value::<__With>()?.0.unwrap_or_default();
3329                        }
3330                        __FieldTag::__available_memory => {
3331                            if !fields.insert(__FieldTag::__available_memory) {
3332                                return std::result::Result::Err(A::Error::duplicate_field(
3333                                    "multiple values for available_memory",
3334                                ));
3335                            }
3336                            result.available_memory = map
3337                                .next_value::<std::option::Option<std::string::String>>()?
3338                                .unwrap_or_default();
3339                        }
3340                        __FieldTag::__available_cpu => {
3341                            if !fields.insert(__FieldTag::__available_cpu) {
3342                                return std::result::Result::Err(A::Error::duplicate_field(
3343                                    "multiple values for available_cpu",
3344                                ));
3345                            }
3346                            result.available_cpu = map
3347                                .next_value::<std::option::Option<std::string::String>>()?
3348                                .unwrap_or_default();
3349                        }
3350                        __FieldTag::__environment_variables => {
3351                            if !fields.insert(__FieldTag::__environment_variables) {
3352                                return std::result::Result::Err(A::Error::duplicate_field(
3353                                    "multiple values for environment_variables",
3354                                ));
3355                            }
3356                            result.environment_variables = map
3357                                .next_value::<std::option::Option<
3358                                    std::collections::HashMap<
3359                                        std::string::String,
3360                                        std::string::String,
3361                                    >,
3362                                >>()?
3363                                .unwrap_or_default();
3364                        }
3365                        __FieldTag::__max_instance_count => {
3366                            if !fields.insert(__FieldTag::__max_instance_count) {
3367                                return std::result::Result::Err(A::Error::duplicate_field(
3368                                    "multiple values for max_instance_count",
3369                                ));
3370                            }
3371                            struct __With(std::option::Option<i32>);
3372                            impl<'de> serde::de::Deserialize<'de> for __With {
3373                                fn deserialize<D>(
3374                                    deserializer: D,
3375                                ) -> std::result::Result<Self, D::Error>
3376                                where
3377                                    D: serde::de::Deserializer<'de>,
3378                                {
3379                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3380                                }
3381                            }
3382                            result.max_instance_count =
3383                                map.next_value::<__With>()?.0.unwrap_or_default();
3384                        }
3385                        __FieldTag::__min_instance_count => {
3386                            if !fields.insert(__FieldTag::__min_instance_count) {
3387                                return std::result::Result::Err(A::Error::duplicate_field(
3388                                    "multiple values for min_instance_count",
3389                                ));
3390                            }
3391                            struct __With(std::option::Option<i32>);
3392                            impl<'de> serde::de::Deserialize<'de> for __With {
3393                                fn deserialize<D>(
3394                                    deserializer: D,
3395                                ) -> std::result::Result<Self, D::Error>
3396                                where
3397                                    D: serde::de::Deserializer<'de>,
3398                                {
3399                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3400                                }
3401                            }
3402                            result.min_instance_count =
3403                                map.next_value::<__With>()?.0.unwrap_or_default();
3404                        }
3405                        __FieldTag::__vpc_connector => {
3406                            if !fields.insert(__FieldTag::__vpc_connector) {
3407                                return std::result::Result::Err(A::Error::duplicate_field(
3408                                    "multiple values for vpc_connector",
3409                                ));
3410                            }
3411                            result.vpc_connector = map
3412                                .next_value::<std::option::Option<std::string::String>>()?
3413                                .unwrap_or_default();
3414                        }
3415                        __FieldTag::__vpc_connector_egress_settings => {
3416                            if !fields.insert(__FieldTag::__vpc_connector_egress_settings) {
3417                                return std::result::Result::Err(A::Error::duplicate_field(
3418                                    "multiple values for vpc_connector_egress_settings",
3419                                ));
3420                            }
3421                            result.vpc_connector_egress_settings = map
3422                                .next_value::<std::option::Option<
3423                                    crate::model::service_config::VpcConnectorEgressSettings,
3424                                >>()?
3425                                .unwrap_or_default();
3426                        }
3427                        __FieldTag::__ingress_settings => {
3428                            if !fields.insert(__FieldTag::__ingress_settings) {
3429                                return std::result::Result::Err(A::Error::duplicate_field(
3430                                    "multiple values for ingress_settings",
3431                                ));
3432                            }
3433                            result.ingress_settings =
3434                                map.next_value::<std::option::Option<
3435                                    crate::model::service_config::IngressSettings,
3436                                >>()?
3437                                .unwrap_or_default();
3438                        }
3439                        __FieldTag::__uri => {
3440                            if !fields.insert(__FieldTag::__uri) {
3441                                return std::result::Result::Err(A::Error::duplicate_field(
3442                                    "multiple values for uri",
3443                                ));
3444                            }
3445                            result.uri = map
3446                                .next_value::<std::option::Option<std::string::String>>()?
3447                                .unwrap_or_default();
3448                        }
3449                        __FieldTag::__service_account_email => {
3450                            if !fields.insert(__FieldTag::__service_account_email) {
3451                                return std::result::Result::Err(A::Error::duplicate_field(
3452                                    "multiple values for service_account_email",
3453                                ));
3454                            }
3455                            result.service_account_email = map
3456                                .next_value::<std::option::Option<std::string::String>>()?
3457                                .unwrap_or_default();
3458                        }
3459                        __FieldTag::__all_traffic_on_latest_revision => {
3460                            if !fields.insert(__FieldTag::__all_traffic_on_latest_revision) {
3461                                return std::result::Result::Err(A::Error::duplicate_field(
3462                                    "multiple values for all_traffic_on_latest_revision",
3463                                ));
3464                            }
3465                            result.all_traffic_on_latest_revision = map
3466                                .next_value::<std::option::Option<bool>>()?
3467                                .unwrap_or_default();
3468                        }
3469                        __FieldTag::__secret_environment_variables => {
3470                            if !fields.insert(__FieldTag::__secret_environment_variables) {
3471                                return std::result::Result::Err(A::Error::duplicate_field(
3472                                    "multiple values for secret_environment_variables",
3473                                ));
3474                            }
3475                            result.secret_environment_variables = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SecretEnvVar>>>()?.unwrap_or_default();
3476                        }
3477                        __FieldTag::__secret_volumes => {
3478                            if !fields.insert(__FieldTag::__secret_volumes) {
3479                                return std::result::Result::Err(A::Error::duplicate_field(
3480                                    "multiple values for secret_volumes",
3481                                ));
3482                            }
3483                            result.secret_volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SecretVolume>>>()?.unwrap_or_default();
3484                        }
3485                        __FieldTag::__revision => {
3486                            if !fields.insert(__FieldTag::__revision) {
3487                                return std::result::Result::Err(A::Error::duplicate_field(
3488                                    "multiple values for revision",
3489                                ));
3490                            }
3491                            result.revision = map
3492                                .next_value::<std::option::Option<std::string::String>>()?
3493                                .unwrap_or_default();
3494                        }
3495                        __FieldTag::__max_instance_request_concurrency => {
3496                            if !fields.insert(__FieldTag::__max_instance_request_concurrency) {
3497                                return std::result::Result::Err(A::Error::duplicate_field(
3498                                    "multiple values for max_instance_request_concurrency",
3499                                ));
3500                            }
3501                            struct __With(std::option::Option<i32>);
3502                            impl<'de> serde::de::Deserialize<'de> for __With {
3503                                fn deserialize<D>(
3504                                    deserializer: D,
3505                                ) -> std::result::Result<Self, D::Error>
3506                                where
3507                                    D: serde::de::Deserializer<'de>,
3508                                {
3509                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3510                                }
3511                            }
3512                            result.max_instance_request_concurrency =
3513                                map.next_value::<__With>()?.0.unwrap_or_default();
3514                        }
3515                        __FieldTag::__security_level => {
3516                            if !fields.insert(__FieldTag::__security_level) {
3517                                return std::result::Result::Err(A::Error::duplicate_field(
3518                                    "multiple values for security_level",
3519                                ));
3520                            }
3521                            result.security_level =
3522                                map.next_value::<std::option::Option<
3523                                    crate::model::service_config::SecurityLevel,
3524                                >>()?
3525                                .unwrap_or_default();
3526                        }
3527                        __FieldTag::__binary_authorization_policy => {
3528                            if !fields.insert(__FieldTag::__binary_authorization_policy) {
3529                                return std::result::Result::Err(A::Error::duplicate_field(
3530                                    "multiple values for binary_authorization_policy",
3531                                ));
3532                            }
3533                            result.binary_authorization_policy = map
3534                                .next_value::<std::option::Option<std::string::String>>()?
3535                                .unwrap_or_default();
3536                        }
3537                        __FieldTag::Unknown(key) => {
3538                            let value = map.next_value::<serde_json::Value>()?;
3539                            result._unknown_fields.insert(key, value);
3540                        }
3541                    }
3542                }
3543                std::result::Result::Ok(result)
3544            }
3545        }
3546        deserializer.deserialize_any(Visitor)
3547    }
3548}
3549
3550#[doc(hidden)]
3551impl serde::ser::Serialize for ServiceConfig {
3552    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3553    where
3554        S: serde::ser::Serializer,
3555    {
3556        use serde::ser::SerializeMap;
3557        #[allow(unused_imports)]
3558        use std::option::Option::Some;
3559        let mut state = serializer.serialize_map(std::option::Option::None)?;
3560        if !self.service.is_empty() {
3561            state.serialize_entry("service", &self.service)?;
3562        }
3563        if !wkt::internal::is_default(&self.timeout_seconds) {
3564            struct __With<'a>(&'a i32);
3565            impl<'a> serde::ser::Serialize for __With<'a> {
3566                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3567                where
3568                    S: serde::ser::Serializer,
3569                {
3570                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3571                }
3572            }
3573            state.serialize_entry("timeoutSeconds", &__With(&self.timeout_seconds))?;
3574        }
3575        if !self.available_memory.is_empty() {
3576            state.serialize_entry("availableMemory", &self.available_memory)?;
3577        }
3578        if !self.available_cpu.is_empty() {
3579            state.serialize_entry("availableCpu", &self.available_cpu)?;
3580        }
3581        if !self.environment_variables.is_empty() {
3582            state.serialize_entry("environmentVariables", &self.environment_variables)?;
3583        }
3584        if !wkt::internal::is_default(&self.max_instance_count) {
3585            struct __With<'a>(&'a i32);
3586            impl<'a> serde::ser::Serialize for __With<'a> {
3587                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3588                where
3589                    S: serde::ser::Serializer,
3590                {
3591                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3592                }
3593            }
3594            state.serialize_entry("maxInstanceCount", &__With(&self.max_instance_count))?;
3595        }
3596        if !wkt::internal::is_default(&self.min_instance_count) {
3597            struct __With<'a>(&'a i32);
3598            impl<'a> serde::ser::Serialize for __With<'a> {
3599                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3600                where
3601                    S: serde::ser::Serializer,
3602                {
3603                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3604                }
3605            }
3606            state.serialize_entry("minInstanceCount", &__With(&self.min_instance_count))?;
3607        }
3608        if !self.vpc_connector.is_empty() {
3609            state.serialize_entry("vpcConnector", &self.vpc_connector)?;
3610        }
3611        if !wkt::internal::is_default(&self.vpc_connector_egress_settings) {
3612            state.serialize_entry(
3613                "vpcConnectorEgressSettings",
3614                &self.vpc_connector_egress_settings,
3615            )?;
3616        }
3617        if !wkt::internal::is_default(&self.ingress_settings) {
3618            state.serialize_entry("ingressSettings", &self.ingress_settings)?;
3619        }
3620        if !self.uri.is_empty() {
3621            state.serialize_entry("uri", &self.uri)?;
3622        }
3623        if !self.service_account_email.is_empty() {
3624            state.serialize_entry("serviceAccountEmail", &self.service_account_email)?;
3625        }
3626        if !wkt::internal::is_default(&self.all_traffic_on_latest_revision) {
3627            state.serialize_entry(
3628                "allTrafficOnLatestRevision",
3629                &self.all_traffic_on_latest_revision,
3630            )?;
3631        }
3632        if !self.secret_environment_variables.is_empty() {
3633            state.serialize_entry(
3634                "secretEnvironmentVariables",
3635                &self.secret_environment_variables,
3636            )?;
3637        }
3638        if !self.secret_volumes.is_empty() {
3639            state.serialize_entry("secretVolumes", &self.secret_volumes)?;
3640        }
3641        if !self.revision.is_empty() {
3642            state.serialize_entry("revision", &self.revision)?;
3643        }
3644        if !wkt::internal::is_default(&self.max_instance_request_concurrency) {
3645            struct __With<'a>(&'a i32);
3646            impl<'a> serde::ser::Serialize for __With<'a> {
3647                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3648                where
3649                    S: serde::ser::Serializer,
3650                {
3651                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3652                }
3653            }
3654            state.serialize_entry(
3655                "maxInstanceRequestConcurrency",
3656                &__With(&self.max_instance_request_concurrency),
3657            )?;
3658        }
3659        if !wkt::internal::is_default(&self.security_level) {
3660            state.serialize_entry("securityLevel", &self.security_level)?;
3661        }
3662        if !self.binary_authorization_policy.is_empty() {
3663            state.serialize_entry(
3664                "binaryAuthorizationPolicy",
3665                &self.binary_authorization_policy,
3666            )?;
3667        }
3668        if !self._unknown_fields.is_empty() {
3669            for (key, value) in self._unknown_fields.iter() {
3670                state.serialize_entry(key, &value)?;
3671            }
3672        }
3673        state.end()
3674    }
3675}
3676
3677/// Defines additional types related to [ServiceConfig].
3678pub mod service_config {
3679    #[allow(unused_imports)]
3680    use super::*;
3681
3682    /// Available egress settings.
3683    ///
3684    /// This controls what traffic is diverted through the VPC Access Connector
3685    /// resource. By default PRIVATE_RANGES_ONLY will be used.
3686    ///
3687    /// # Working with unknown values
3688    ///
3689    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3690    /// additional enum variants at any time. Adding new variants is not considered
3691    /// a breaking change. Applications should write their code in anticipation of:
3692    ///
3693    /// - New values appearing in future releases of the client library, **and**
3694    /// - New values received dynamically, without application changes.
3695    ///
3696    /// Please consult the [Working with enums] section in the user guide for some
3697    /// guidelines.
3698    ///
3699    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3700    #[derive(Clone, Debug, PartialEq)]
3701    #[non_exhaustive]
3702    pub enum VpcConnectorEgressSettings {
3703        /// Unspecified.
3704        Unspecified,
3705        /// Use the VPC Access Connector only for private IP space from RFC1918.
3706        PrivateRangesOnly,
3707        /// Force the use of VPC Access Connector for all egress traffic from the
3708        /// function.
3709        AllTraffic,
3710        /// If set, the enum was initialized with an unknown value.
3711        ///
3712        /// Applications can examine the value using [VpcConnectorEgressSettings::value] or
3713        /// [VpcConnectorEgressSettings::name].
3714        UnknownValue(vpc_connector_egress_settings::UnknownValue),
3715    }
3716
3717    #[doc(hidden)]
3718    pub mod vpc_connector_egress_settings {
3719        #[allow(unused_imports)]
3720        use super::*;
3721        #[derive(Clone, Debug, PartialEq)]
3722        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3723    }
3724
3725    impl VpcConnectorEgressSettings {
3726        /// Gets the enum value.
3727        ///
3728        /// Returns `None` if the enum contains an unknown value deserialized from
3729        /// the string representation of enums.
3730        pub fn value(&self) -> std::option::Option<i32> {
3731            match self {
3732                Self::Unspecified => std::option::Option::Some(0),
3733                Self::PrivateRangesOnly => std::option::Option::Some(1),
3734                Self::AllTraffic => std::option::Option::Some(2),
3735                Self::UnknownValue(u) => u.0.value(),
3736            }
3737        }
3738
3739        /// Gets the enum value as a string.
3740        ///
3741        /// Returns `None` if the enum contains an unknown value deserialized from
3742        /// the integer representation of enums.
3743        pub fn name(&self) -> std::option::Option<&str> {
3744            match self {
3745                Self::Unspecified => {
3746                    std::option::Option::Some("VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED")
3747                }
3748                Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
3749                Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
3750                Self::UnknownValue(u) => u.0.name(),
3751            }
3752        }
3753    }
3754
3755    impl std::default::Default for VpcConnectorEgressSettings {
3756        fn default() -> Self {
3757            use std::convert::From;
3758            Self::from(0)
3759        }
3760    }
3761
3762    impl std::fmt::Display for VpcConnectorEgressSettings {
3763        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3764            wkt::internal::display_enum(f, self.name(), self.value())
3765        }
3766    }
3767
3768    impl std::convert::From<i32> for VpcConnectorEgressSettings {
3769        fn from(value: i32) -> Self {
3770            match value {
3771                0 => Self::Unspecified,
3772                1 => Self::PrivateRangesOnly,
3773                2 => Self::AllTraffic,
3774                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
3775                    wkt::internal::UnknownEnumValue::Integer(value),
3776                )),
3777            }
3778        }
3779    }
3780
3781    impl std::convert::From<&str> for VpcConnectorEgressSettings {
3782        fn from(value: &str) -> Self {
3783            use std::string::ToString;
3784            match value {
3785                "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
3786                "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
3787                "ALL_TRAFFIC" => Self::AllTraffic,
3788                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
3789                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3790                )),
3791            }
3792        }
3793    }
3794
3795    impl serde::ser::Serialize for VpcConnectorEgressSettings {
3796        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3797        where
3798            S: serde::Serializer,
3799        {
3800            match self {
3801                Self::Unspecified => serializer.serialize_i32(0),
3802                Self::PrivateRangesOnly => serializer.serialize_i32(1),
3803                Self::AllTraffic => serializer.serialize_i32(2),
3804                Self::UnknownValue(u) => u.0.serialize(serializer),
3805            }
3806        }
3807    }
3808
3809    impl<'de> serde::de::Deserialize<'de> for VpcConnectorEgressSettings {
3810        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3811        where
3812            D: serde::Deserializer<'de>,
3813        {
3814            deserializer.deserialize_any(
3815                wkt::internal::EnumVisitor::<VpcConnectorEgressSettings>::new(
3816                    ".google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings",
3817                ),
3818            )
3819        }
3820    }
3821
3822    /// Available ingress settings.
3823    ///
3824    /// This controls what traffic can reach the function.
3825    ///
3826    /// If unspecified, ALLOW_ALL will be used.
3827    ///
3828    /// # Working with unknown values
3829    ///
3830    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3831    /// additional enum variants at any time. Adding new variants is not considered
3832    /// a breaking change. Applications should write their code in anticipation of:
3833    ///
3834    /// - New values appearing in future releases of the client library, **and**
3835    /// - New values received dynamically, without application changes.
3836    ///
3837    /// Please consult the [Working with enums] section in the user guide for some
3838    /// guidelines.
3839    ///
3840    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3841    #[derive(Clone, Debug, PartialEq)]
3842    #[non_exhaustive]
3843    pub enum IngressSettings {
3844        /// Unspecified.
3845        Unspecified,
3846        /// Allow HTTP traffic from public and private sources.
3847        AllowAll,
3848        /// Allow HTTP traffic from only private VPC sources.
3849        AllowInternalOnly,
3850        /// Allow HTTP traffic from private VPC sources and through GCLB.
3851        AllowInternalAndGclb,
3852        /// If set, the enum was initialized with an unknown value.
3853        ///
3854        /// Applications can examine the value using [IngressSettings::value] or
3855        /// [IngressSettings::name].
3856        UnknownValue(ingress_settings::UnknownValue),
3857    }
3858
3859    #[doc(hidden)]
3860    pub mod ingress_settings {
3861        #[allow(unused_imports)]
3862        use super::*;
3863        #[derive(Clone, Debug, PartialEq)]
3864        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3865    }
3866
3867    impl IngressSettings {
3868        /// Gets the enum value.
3869        ///
3870        /// Returns `None` if the enum contains an unknown value deserialized from
3871        /// the string representation of enums.
3872        pub fn value(&self) -> std::option::Option<i32> {
3873            match self {
3874                Self::Unspecified => std::option::Option::Some(0),
3875                Self::AllowAll => std::option::Option::Some(1),
3876                Self::AllowInternalOnly => std::option::Option::Some(2),
3877                Self::AllowInternalAndGclb => std::option::Option::Some(3),
3878                Self::UnknownValue(u) => u.0.value(),
3879            }
3880        }
3881
3882        /// Gets the enum value as a string.
3883        ///
3884        /// Returns `None` if the enum contains an unknown value deserialized from
3885        /// the integer representation of enums.
3886        pub fn name(&self) -> std::option::Option<&str> {
3887            match self {
3888                Self::Unspecified => std::option::Option::Some("INGRESS_SETTINGS_UNSPECIFIED"),
3889                Self::AllowAll => std::option::Option::Some("ALLOW_ALL"),
3890                Self::AllowInternalOnly => std::option::Option::Some("ALLOW_INTERNAL_ONLY"),
3891                Self::AllowInternalAndGclb => std::option::Option::Some("ALLOW_INTERNAL_AND_GCLB"),
3892                Self::UnknownValue(u) => u.0.name(),
3893            }
3894        }
3895    }
3896
3897    impl std::default::Default for IngressSettings {
3898        fn default() -> Self {
3899            use std::convert::From;
3900            Self::from(0)
3901        }
3902    }
3903
3904    impl std::fmt::Display for IngressSettings {
3905        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3906            wkt::internal::display_enum(f, self.name(), self.value())
3907        }
3908    }
3909
3910    impl std::convert::From<i32> for IngressSettings {
3911        fn from(value: i32) -> Self {
3912            match value {
3913                0 => Self::Unspecified,
3914                1 => Self::AllowAll,
3915                2 => Self::AllowInternalOnly,
3916                3 => Self::AllowInternalAndGclb,
3917                _ => Self::UnknownValue(ingress_settings::UnknownValue(
3918                    wkt::internal::UnknownEnumValue::Integer(value),
3919                )),
3920            }
3921        }
3922    }
3923
3924    impl std::convert::From<&str> for IngressSettings {
3925        fn from(value: &str) -> Self {
3926            use std::string::ToString;
3927            match value {
3928                "INGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
3929                "ALLOW_ALL" => Self::AllowAll,
3930                "ALLOW_INTERNAL_ONLY" => Self::AllowInternalOnly,
3931                "ALLOW_INTERNAL_AND_GCLB" => Self::AllowInternalAndGclb,
3932                _ => Self::UnknownValue(ingress_settings::UnknownValue(
3933                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3934                )),
3935            }
3936        }
3937    }
3938
3939    impl serde::ser::Serialize for IngressSettings {
3940        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3941        where
3942            S: serde::Serializer,
3943        {
3944            match self {
3945                Self::Unspecified => serializer.serialize_i32(0),
3946                Self::AllowAll => serializer.serialize_i32(1),
3947                Self::AllowInternalOnly => serializer.serialize_i32(2),
3948                Self::AllowInternalAndGclb => serializer.serialize_i32(3),
3949                Self::UnknownValue(u) => u.0.serialize(serializer),
3950            }
3951        }
3952    }
3953
3954    impl<'de> serde::de::Deserialize<'de> for IngressSettings {
3955        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3956        where
3957            D: serde::Deserializer<'de>,
3958        {
3959            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressSettings>::new(
3960                ".google.cloud.functions.v2.ServiceConfig.IngressSettings",
3961            ))
3962        }
3963    }
3964
3965    /// Available security level settings.
3966    ///
3967    /// This enforces security protocol on function URL.
3968    ///
3969    /// Security level is only configurable for 1st Gen functions, If unspecified,
3970    /// SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY.
3971    ///
3972    /// # Working with unknown values
3973    ///
3974    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3975    /// additional enum variants at any time. Adding new variants is not considered
3976    /// a breaking change. Applications should write their code in anticipation of:
3977    ///
3978    /// - New values appearing in future releases of the client library, **and**
3979    /// - New values received dynamically, without application changes.
3980    ///
3981    /// Please consult the [Working with enums] section in the user guide for some
3982    /// guidelines.
3983    ///
3984    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3985    #[derive(Clone, Debug, PartialEq)]
3986    #[non_exhaustive]
3987    pub enum SecurityLevel {
3988        /// Unspecified.
3989        Unspecified,
3990        /// Requests for a URL that match this handler that do not use HTTPS are
3991        /// automatically redirected to the HTTPS URL with the same path. Query
3992        /// parameters are reserved for the redirect.
3993        SecureAlways,
3994        /// Both HTTP and HTTPS requests with URLs that match the handler succeed
3995        /// without redirects. The application can examine the request to determine
3996        /// which protocol was used and respond accordingly.
3997        SecureOptional,
3998        /// If set, the enum was initialized with an unknown value.
3999        ///
4000        /// Applications can examine the value using [SecurityLevel::value] or
4001        /// [SecurityLevel::name].
4002        UnknownValue(security_level::UnknownValue),
4003    }
4004
4005    #[doc(hidden)]
4006    pub mod security_level {
4007        #[allow(unused_imports)]
4008        use super::*;
4009        #[derive(Clone, Debug, PartialEq)]
4010        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4011    }
4012
4013    impl SecurityLevel {
4014        /// Gets the enum value.
4015        ///
4016        /// Returns `None` if the enum contains an unknown value deserialized from
4017        /// the string representation of enums.
4018        pub fn value(&self) -> std::option::Option<i32> {
4019            match self {
4020                Self::Unspecified => std::option::Option::Some(0),
4021                Self::SecureAlways => std::option::Option::Some(1),
4022                Self::SecureOptional => std::option::Option::Some(2),
4023                Self::UnknownValue(u) => u.0.value(),
4024            }
4025        }
4026
4027        /// Gets the enum value as a string.
4028        ///
4029        /// Returns `None` if the enum contains an unknown value deserialized from
4030        /// the integer representation of enums.
4031        pub fn name(&self) -> std::option::Option<&str> {
4032            match self {
4033                Self::Unspecified => std::option::Option::Some("SECURITY_LEVEL_UNSPECIFIED"),
4034                Self::SecureAlways => std::option::Option::Some("SECURE_ALWAYS"),
4035                Self::SecureOptional => std::option::Option::Some("SECURE_OPTIONAL"),
4036                Self::UnknownValue(u) => u.0.name(),
4037            }
4038        }
4039    }
4040
4041    impl std::default::Default for SecurityLevel {
4042        fn default() -> Self {
4043            use std::convert::From;
4044            Self::from(0)
4045        }
4046    }
4047
4048    impl std::fmt::Display for SecurityLevel {
4049        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4050            wkt::internal::display_enum(f, self.name(), self.value())
4051        }
4052    }
4053
4054    impl std::convert::From<i32> for SecurityLevel {
4055        fn from(value: i32) -> Self {
4056            match value {
4057                0 => Self::Unspecified,
4058                1 => Self::SecureAlways,
4059                2 => Self::SecureOptional,
4060                _ => Self::UnknownValue(security_level::UnknownValue(
4061                    wkt::internal::UnknownEnumValue::Integer(value),
4062                )),
4063            }
4064        }
4065    }
4066
4067    impl std::convert::From<&str> for SecurityLevel {
4068        fn from(value: &str) -> Self {
4069            use std::string::ToString;
4070            match value {
4071                "SECURITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
4072                "SECURE_ALWAYS" => Self::SecureAlways,
4073                "SECURE_OPTIONAL" => Self::SecureOptional,
4074                _ => Self::UnknownValue(security_level::UnknownValue(
4075                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4076                )),
4077            }
4078        }
4079    }
4080
4081    impl serde::ser::Serialize for SecurityLevel {
4082        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4083        where
4084            S: serde::Serializer,
4085        {
4086            match self {
4087                Self::Unspecified => serializer.serialize_i32(0),
4088                Self::SecureAlways => serializer.serialize_i32(1),
4089                Self::SecureOptional => serializer.serialize_i32(2),
4090                Self::UnknownValue(u) => u.0.serialize(serializer),
4091            }
4092        }
4093    }
4094
4095    impl<'de> serde::de::Deserialize<'de> for SecurityLevel {
4096        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4097        where
4098            D: serde::Deserializer<'de>,
4099        {
4100            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityLevel>::new(
4101                ".google.cloud.functions.v2.ServiceConfig.SecurityLevel",
4102            ))
4103        }
4104    }
4105}
4106
4107/// Configuration for a secret environment variable. It has the information
4108/// necessary to fetch the secret value from secret manager and expose it as an
4109/// environment variable.
4110#[derive(Clone, Debug, Default, PartialEq)]
4111#[non_exhaustive]
4112pub struct SecretEnvVar {
4113    /// Name of the environment variable.
4114    pub key: std::string::String,
4115
4116    /// Project identifier (preferably project number but can also be the
4117    /// project ID) of the project that contains the secret. If not set, it is
4118    /// assumed that the secret is in the same project as the function.
4119    pub project_id: std::string::String,
4120
4121    /// Name of the secret in secret manager (not the full resource name).
4122    pub secret: std::string::String,
4123
4124    /// Version of the secret (version number or the string 'latest'). It is
4125    /// recommended to use a numeric version for secret environment variables as
4126    /// any updates to the secret value is not reflected until new instances
4127    /// start.
4128    pub version: std::string::String,
4129
4130    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4131}
4132
4133impl SecretEnvVar {
4134    pub fn new() -> Self {
4135        std::default::Default::default()
4136    }
4137
4138    /// Sets the value of [key][crate::model::SecretEnvVar::key].
4139    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4140        self.key = v.into();
4141        self
4142    }
4143
4144    /// Sets the value of [project_id][crate::model::SecretEnvVar::project_id].
4145    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4146        self.project_id = v.into();
4147        self
4148    }
4149
4150    /// Sets the value of [secret][crate::model::SecretEnvVar::secret].
4151    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4152        self.secret = v.into();
4153        self
4154    }
4155
4156    /// Sets the value of [version][crate::model::SecretEnvVar::version].
4157    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4158        self.version = v.into();
4159        self
4160    }
4161}
4162
4163impl wkt::message::Message for SecretEnvVar {
4164    fn typename() -> &'static str {
4165        "type.googleapis.com/google.cloud.functions.v2.SecretEnvVar"
4166    }
4167}
4168
4169#[doc(hidden)]
4170impl<'de> serde::de::Deserialize<'de> for SecretEnvVar {
4171    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4172    where
4173        D: serde::Deserializer<'de>,
4174    {
4175        #[allow(non_camel_case_types)]
4176        #[doc(hidden)]
4177        #[derive(PartialEq, Eq, Hash)]
4178        enum __FieldTag {
4179            __key,
4180            __project_id,
4181            __secret,
4182            __version,
4183            Unknown(std::string::String),
4184        }
4185        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4186            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4187            where
4188                D: serde::Deserializer<'de>,
4189            {
4190                struct Visitor;
4191                impl<'de> serde::de::Visitor<'de> for Visitor {
4192                    type Value = __FieldTag;
4193                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4194                        formatter.write_str("a field name for SecretEnvVar")
4195                    }
4196                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4197                    where
4198                        E: serde::de::Error,
4199                    {
4200                        use std::result::Result::Ok;
4201                        use std::string::ToString;
4202                        match value {
4203                            "key" => Ok(__FieldTag::__key),
4204                            "projectId" => Ok(__FieldTag::__project_id),
4205                            "project_id" => Ok(__FieldTag::__project_id),
4206                            "secret" => Ok(__FieldTag::__secret),
4207                            "version" => Ok(__FieldTag::__version),
4208                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4209                        }
4210                    }
4211                }
4212                deserializer.deserialize_identifier(Visitor)
4213            }
4214        }
4215        struct Visitor;
4216        impl<'de> serde::de::Visitor<'de> for Visitor {
4217            type Value = SecretEnvVar;
4218            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4219                formatter.write_str("struct SecretEnvVar")
4220            }
4221            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4222            where
4223                A: serde::de::MapAccess<'de>,
4224            {
4225                #[allow(unused_imports)]
4226                use serde::de::Error;
4227                use std::option::Option::Some;
4228                let mut fields = std::collections::HashSet::new();
4229                let mut result = Self::Value::new();
4230                while let Some(tag) = map.next_key::<__FieldTag>()? {
4231                    #[allow(clippy::match_single_binding)]
4232                    match tag {
4233                        __FieldTag::__key => {
4234                            if !fields.insert(__FieldTag::__key) {
4235                                return std::result::Result::Err(A::Error::duplicate_field(
4236                                    "multiple values for key",
4237                                ));
4238                            }
4239                            result.key = map
4240                                .next_value::<std::option::Option<std::string::String>>()?
4241                                .unwrap_or_default();
4242                        }
4243                        __FieldTag::__project_id => {
4244                            if !fields.insert(__FieldTag::__project_id) {
4245                                return std::result::Result::Err(A::Error::duplicate_field(
4246                                    "multiple values for project_id",
4247                                ));
4248                            }
4249                            result.project_id = map
4250                                .next_value::<std::option::Option<std::string::String>>()?
4251                                .unwrap_or_default();
4252                        }
4253                        __FieldTag::__secret => {
4254                            if !fields.insert(__FieldTag::__secret) {
4255                                return std::result::Result::Err(A::Error::duplicate_field(
4256                                    "multiple values for secret",
4257                                ));
4258                            }
4259                            result.secret = map
4260                                .next_value::<std::option::Option<std::string::String>>()?
4261                                .unwrap_or_default();
4262                        }
4263                        __FieldTag::__version => {
4264                            if !fields.insert(__FieldTag::__version) {
4265                                return std::result::Result::Err(A::Error::duplicate_field(
4266                                    "multiple values for version",
4267                                ));
4268                            }
4269                            result.version = map
4270                                .next_value::<std::option::Option<std::string::String>>()?
4271                                .unwrap_or_default();
4272                        }
4273                        __FieldTag::Unknown(key) => {
4274                            let value = map.next_value::<serde_json::Value>()?;
4275                            result._unknown_fields.insert(key, value);
4276                        }
4277                    }
4278                }
4279                std::result::Result::Ok(result)
4280            }
4281        }
4282        deserializer.deserialize_any(Visitor)
4283    }
4284}
4285
4286#[doc(hidden)]
4287impl serde::ser::Serialize for SecretEnvVar {
4288    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4289    where
4290        S: serde::ser::Serializer,
4291    {
4292        use serde::ser::SerializeMap;
4293        #[allow(unused_imports)]
4294        use std::option::Option::Some;
4295        let mut state = serializer.serialize_map(std::option::Option::None)?;
4296        if !self.key.is_empty() {
4297            state.serialize_entry("key", &self.key)?;
4298        }
4299        if !self.project_id.is_empty() {
4300            state.serialize_entry("projectId", &self.project_id)?;
4301        }
4302        if !self.secret.is_empty() {
4303            state.serialize_entry("secret", &self.secret)?;
4304        }
4305        if !self.version.is_empty() {
4306            state.serialize_entry("version", &self.version)?;
4307        }
4308        if !self._unknown_fields.is_empty() {
4309            for (key, value) in self._unknown_fields.iter() {
4310                state.serialize_entry(key, &value)?;
4311            }
4312        }
4313        state.end()
4314    }
4315}
4316
4317/// Configuration for a secret volume. It has the information necessary to fetch
4318/// the secret value from secret manager and make it available as files mounted
4319/// at the requested paths within the application container.
4320#[derive(Clone, Debug, Default, PartialEq)]
4321#[non_exhaustive]
4322pub struct SecretVolume {
4323    /// The path within the container to mount the secret volume. For example,
4324    /// setting the mount_path as `/etc/secrets` would mount the secret value files
4325    /// under the `/etc/secrets` directory. This directory will also be completely
4326    /// shadowed and unavailable to mount any other secrets.
4327    /// Recommended mount path: /etc/secrets
4328    pub mount_path: std::string::String,
4329
4330    /// Project identifier (preferably project number but can also be the project
4331    /// ID) of the project that contains the secret. If not set, it is
4332    /// assumed that the secret is in the same project as the function.
4333    pub project_id: std::string::String,
4334
4335    /// Name of the secret in secret manager (not the full resource name).
4336    pub secret: std::string::String,
4337
4338    /// List of secret versions to mount for this secret. If empty, the `latest`
4339    /// version of the secret will be made available in a file named after the
4340    /// secret under the mount point.
4341    pub versions: std::vec::Vec<crate::model::secret_volume::SecretVersion>,
4342
4343    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4344}
4345
4346impl SecretVolume {
4347    pub fn new() -> Self {
4348        std::default::Default::default()
4349    }
4350
4351    /// Sets the value of [mount_path][crate::model::SecretVolume::mount_path].
4352    pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4353        self.mount_path = v.into();
4354        self
4355    }
4356
4357    /// Sets the value of [project_id][crate::model::SecretVolume::project_id].
4358    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4359        self.project_id = v.into();
4360        self
4361    }
4362
4363    /// Sets the value of [secret][crate::model::SecretVolume::secret].
4364    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4365        self.secret = v.into();
4366        self
4367    }
4368
4369    /// Sets the value of [versions][crate::model::SecretVolume::versions].
4370    pub fn set_versions<T, V>(mut self, v: T) -> Self
4371    where
4372        T: std::iter::IntoIterator<Item = V>,
4373        V: std::convert::Into<crate::model::secret_volume::SecretVersion>,
4374    {
4375        use std::iter::Iterator;
4376        self.versions = v.into_iter().map(|i| i.into()).collect();
4377        self
4378    }
4379}
4380
4381impl wkt::message::Message for SecretVolume {
4382    fn typename() -> &'static str {
4383        "type.googleapis.com/google.cloud.functions.v2.SecretVolume"
4384    }
4385}
4386
4387#[doc(hidden)]
4388impl<'de> serde::de::Deserialize<'de> for SecretVolume {
4389    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4390    where
4391        D: serde::Deserializer<'de>,
4392    {
4393        #[allow(non_camel_case_types)]
4394        #[doc(hidden)]
4395        #[derive(PartialEq, Eq, Hash)]
4396        enum __FieldTag {
4397            __mount_path,
4398            __project_id,
4399            __secret,
4400            __versions,
4401            Unknown(std::string::String),
4402        }
4403        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4404            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4405            where
4406                D: serde::Deserializer<'de>,
4407            {
4408                struct Visitor;
4409                impl<'de> serde::de::Visitor<'de> for Visitor {
4410                    type Value = __FieldTag;
4411                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4412                        formatter.write_str("a field name for SecretVolume")
4413                    }
4414                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4415                    where
4416                        E: serde::de::Error,
4417                    {
4418                        use std::result::Result::Ok;
4419                        use std::string::ToString;
4420                        match value {
4421                            "mountPath" => Ok(__FieldTag::__mount_path),
4422                            "mount_path" => Ok(__FieldTag::__mount_path),
4423                            "projectId" => Ok(__FieldTag::__project_id),
4424                            "project_id" => Ok(__FieldTag::__project_id),
4425                            "secret" => Ok(__FieldTag::__secret),
4426                            "versions" => Ok(__FieldTag::__versions),
4427                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4428                        }
4429                    }
4430                }
4431                deserializer.deserialize_identifier(Visitor)
4432            }
4433        }
4434        struct Visitor;
4435        impl<'de> serde::de::Visitor<'de> for Visitor {
4436            type Value = SecretVolume;
4437            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4438                formatter.write_str("struct SecretVolume")
4439            }
4440            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4441            where
4442                A: serde::de::MapAccess<'de>,
4443            {
4444                #[allow(unused_imports)]
4445                use serde::de::Error;
4446                use std::option::Option::Some;
4447                let mut fields = std::collections::HashSet::new();
4448                let mut result = Self::Value::new();
4449                while let Some(tag) = map.next_key::<__FieldTag>()? {
4450                    #[allow(clippy::match_single_binding)]
4451                    match tag {
4452                        __FieldTag::__mount_path => {
4453                            if !fields.insert(__FieldTag::__mount_path) {
4454                                return std::result::Result::Err(A::Error::duplicate_field(
4455                                    "multiple values for mount_path",
4456                                ));
4457                            }
4458                            result.mount_path = map
4459                                .next_value::<std::option::Option<std::string::String>>()?
4460                                .unwrap_or_default();
4461                        }
4462                        __FieldTag::__project_id => {
4463                            if !fields.insert(__FieldTag::__project_id) {
4464                                return std::result::Result::Err(A::Error::duplicate_field(
4465                                    "multiple values for project_id",
4466                                ));
4467                            }
4468                            result.project_id = map
4469                                .next_value::<std::option::Option<std::string::String>>()?
4470                                .unwrap_or_default();
4471                        }
4472                        __FieldTag::__secret => {
4473                            if !fields.insert(__FieldTag::__secret) {
4474                                return std::result::Result::Err(A::Error::duplicate_field(
4475                                    "multiple values for secret",
4476                                ));
4477                            }
4478                            result.secret = map
4479                                .next_value::<std::option::Option<std::string::String>>()?
4480                                .unwrap_or_default();
4481                        }
4482                        __FieldTag::__versions => {
4483                            if !fields.insert(__FieldTag::__versions) {
4484                                return std::result::Result::Err(A::Error::duplicate_field(
4485                                    "multiple values for versions",
4486                                ));
4487                            }
4488                            result.versions = map
4489                                .next_value::<std::option::Option<
4490                                    std::vec::Vec<crate::model::secret_volume::SecretVersion>,
4491                                >>()?
4492                                .unwrap_or_default();
4493                        }
4494                        __FieldTag::Unknown(key) => {
4495                            let value = map.next_value::<serde_json::Value>()?;
4496                            result._unknown_fields.insert(key, value);
4497                        }
4498                    }
4499                }
4500                std::result::Result::Ok(result)
4501            }
4502        }
4503        deserializer.deserialize_any(Visitor)
4504    }
4505}
4506
4507#[doc(hidden)]
4508impl serde::ser::Serialize for SecretVolume {
4509    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4510    where
4511        S: serde::ser::Serializer,
4512    {
4513        use serde::ser::SerializeMap;
4514        #[allow(unused_imports)]
4515        use std::option::Option::Some;
4516        let mut state = serializer.serialize_map(std::option::Option::None)?;
4517        if !self.mount_path.is_empty() {
4518            state.serialize_entry("mountPath", &self.mount_path)?;
4519        }
4520        if !self.project_id.is_empty() {
4521            state.serialize_entry("projectId", &self.project_id)?;
4522        }
4523        if !self.secret.is_empty() {
4524            state.serialize_entry("secret", &self.secret)?;
4525        }
4526        if !self.versions.is_empty() {
4527            state.serialize_entry("versions", &self.versions)?;
4528        }
4529        if !self._unknown_fields.is_empty() {
4530            for (key, value) in self._unknown_fields.iter() {
4531                state.serialize_entry(key, &value)?;
4532            }
4533        }
4534        state.end()
4535    }
4536}
4537
4538/// Defines additional types related to [SecretVolume].
4539pub mod secret_volume {
4540    #[allow(unused_imports)]
4541    use super::*;
4542
4543    /// Configuration for a single version.
4544    #[derive(Clone, Debug, Default, PartialEq)]
4545    #[non_exhaustive]
4546    pub struct SecretVersion {
4547        /// Version of the secret (version number or the string 'latest'). It is
4548        /// preferable to use `latest` version with secret volumes as secret value
4549        /// changes are reflected immediately.
4550        pub version: std::string::String,
4551
4552        /// Relative path of the file under the mount path where the secret value for
4553        /// this version will be fetched and made available. For example, setting the
4554        /// mount_path as '/etc/secrets' and path as `secret_foo` would mount the
4555        /// secret value file at `/etc/secrets/secret_foo`.
4556        pub path: std::string::String,
4557
4558        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4559    }
4560
4561    impl SecretVersion {
4562        pub fn new() -> Self {
4563            std::default::Default::default()
4564        }
4565
4566        /// Sets the value of [version][crate::model::secret_volume::SecretVersion::version].
4567        pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4568            self.version = v.into();
4569            self
4570        }
4571
4572        /// Sets the value of [path][crate::model::secret_volume::SecretVersion::path].
4573        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4574            self.path = v.into();
4575            self
4576        }
4577    }
4578
4579    impl wkt::message::Message for SecretVersion {
4580        fn typename() -> &'static str {
4581            "type.googleapis.com/google.cloud.functions.v2.SecretVolume.SecretVersion"
4582        }
4583    }
4584
4585    #[doc(hidden)]
4586    impl<'de> serde::de::Deserialize<'de> for SecretVersion {
4587        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4588        where
4589            D: serde::Deserializer<'de>,
4590        {
4591            #[allow(non_camel_case_types)]
4592            #[doc(hidden)]
4593            #[derive(PartialEq, Eq, Hash)]
4594            enum __FieldTag {
4595                __version,
4596                __path,
4597                Unknown(std::string::String),
4598            }
4599            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4600                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4601                where
4602                    D: serde::Deserializer<'de>,
4603                {
4604                    struct Visitor;
4605                    impl<'de> serde::de::Visitor<'de> for Visitor {
4606                        type Value = __FieldTag;
4607                        fn expecting(
4608                            &self,
4609                            formatter: &mut std::fmt::Formatter,
4610                        ) -> std::fmt::Result {
4611                            formatter.write_str("a field name for SecretVersion")
4612                        }
4613                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4614                        where
4615                            E: serde::de::Error,
4616                        {
4617                            use std::result::Result::Ok;
4618                            use std::string::ToString;
4619                            match value {
4620                                "version" => Ok(__FieldTag::__version),
4621                                "path" => Ok(__FieldTag::__path),
4622                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4623                            }
4624                        }
4625                    }
4626                    deserializer.deserialize_identifier(Visitor)
4627                }
4628            }
4629            struct Visitor;
4630            impl<'de> serde::de::Visitor<'de> for Visitor {
4631                type Value = SecretVersion;
4632                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4633                    formatter.write_str("struct SecretVersion")
4634                }
4635                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4636                where
4637                    A: serde::de::MapAccess<'de>,
4638                {
4639                    #[allow(unused_imports)]
4640                    use serde::de::Error;
4641                    use std::option::Option::Some;
4642                    let mut fields = std::collections::HashSet::new();
4643                    let mut result = Self::Value::new();
4644                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4645                        #[allow(clippy::match_single_binding)]
4646                        match tag {
4647                            __FieldTag::__version => {
4648                                if !fields.insert(__FieldTag::__version) {
4649                                    return std::result::Result::Err(A::Error::duplicate_field(
4650                                        "multiple values for version",
4651                                    ));
4652                                }
4653                                result.version = map
4654                                    .next_value::<std::option::Option<std::string::String>>()?
4655                                    .unwrap_or_default();
4656                            }
4657                            __FieldTag::__path => {
4658                                if !fields.insert(__FieldTag::__path) {
4659                                    return std::result::Result::Err(A::Error::duplicate_field(
4660                                        "multiple values for path",
4661                                    ));
4662                                }
4663                                result.path = map
4664                                    .next_value::<std::option::Option<std::string::String>>()?
4665                                    .unwrap_or_default();
4666                            }
4667                            __FieldTag::Unknown(key) => {
4668                                let value = map.next_value::<serde_json::Value>()?;
4669                                result._unknown_fields.insert(key, value);
4670                            }
4671                        }
4672                    }
4673                    std::result::Result::Ok(result)
4674                }
4675            }
4676            deserializer.deserialize_any(Visitor)
4677        }
4678    }
4679
4680    #[doc(hidden)]
4681    impl serde::ser::Serialize for SecretVersion {
4682        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4683        where
4684            S: serde::ser::Serializer,
4685        {
4686            use serde::ser::SerializeMap;
4687            #[allow(unused_imports)]
4688            use std::option::Option::Some;
4689            let mut state = serializer.serialize_map(std::option::Option::None)?;
4690            if !self.version.is_empty() {
4691                state.serialize_entry("version", &self.version)?;
4692            }
4693            if !self.path.is_empty() {
4694                state.serialize_entry("path", &self.path)?;
4695            }
4696            if !self._unknown_fields.is_empty() {
4697                for (key, value) in self._unknown_fields.iter() {
4698                    state.serialize_entry(key, &value)?;
4699                }
4700            }
4701            state.end()
4702        }
4703    }
4704}
4705
4706/// Describes EventTrigger, used to request events to be sent from another
4707/// service.
4708#[derive(Clone, Debug, Default, PartialEq)]
4709#[non_exhaustive]
4710pub struct EventTrigger {
4711    /// Output only. The resource name of the Eventarc trigger. The format of this
4712    /// field is `projects/{project}/locations/{region}/triggers/{trigger}`.
4713    pub trigger: std::string::String,
4714
4715    /// The region that the trigger will be in. The trigger will only receive
4716    /// events originating in this region. It can be the same
4717    /// region as the function, a different region or multi-region, or the global
4718    /// region. If not provided, defaults to the same region as the function.
4719    pub trigger_region: std::string::String,
4720
4721    /// Required. The type of event to observe. For example:
4722    /// `google.cloud.audit.log.v1.written` or
4723    /// `google.cloud.pubsub.topic.v1.messagePublished`.
4724    pub event_type: std::string::String,
4725
4726    /// Criteria used to filter events.
4727    pub event_filters: std::vec::Vec<crate::model::EventFilter>,
4728
4729    /// Optional. The name of a Pub/Sub topic in the same project that will be used
4730    /// as the transport topic for the event delivery. Format:
4731    /// `projects/{project}/topics/{topic}`.
4732    ///
4733    /// This is only valid for events of type
4734    /// `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
4735    /// will not be deleted at function deletion.
4736    pub pubsub_topic: std::string::String,
4737
4738    /// Optional. The email of the trigger's service account. The service account
4739    /// must have permission to invoke Cloud Run services, the permission is
4740    /// `run.routes.invoke`.
4741    /// If empty, defaults to the Compute Engine default service account:
4742    /// `{project_number}-compute@developer.gserviceaccount.com`.
4743    pub service_account_email: std::string::String,
4744
4745    /// Optional. If unset, then defaults to ignoring failures (i.e. not retrying
4746    /// them).
4747    pub retry_policy: crate::model::event_trigger::RetryPolicy,
4748
4749    /// Optional. The name of the channel associated with the trigger in
4750    /// `projects/{project}/locations/{location}/channels/{channel}` format.
4751    /// You must provide a channel to receive events from Eventarc SaaS partners.
4752    pub channel: std::string::String,
4753
4754    /// Optional. The hostname of the service that 1st Gen function should be
4755    /// observed.
4756    ///
4757    /// If no string is provided, the default service implementing the API will
4758    /// be used. For example, `storage.googleapis.com` is the default for all
4759    /// event types in the `google.storage` namespace.
4760    ///
4761    /// The field is only applicable to 1st Gen functions.
4762    pub service: std::string::String,
4763
4764    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4765}
4766
4767impl EventTrigger {
4768    pub fn new() -> Self {
4769        std::default::Default::default()
4770    }
4771
4772    /// Sets the value of [trigger][crate::model::EventTrigger::trigger].
4773    pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4774        self.trigger = v.into();
4775        self
4776    }
4777
4778    /// Sets the value of [trigger_region][crate::model::EventTrigger::trigger_region].
4779    pub fn set_trigger_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4780        self.trigger_region = v.into();
4781        self
4782    }
4783
4784    /// Sets the value of [event_type][crate::model::EventTrigger::event_type].
4785    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4786        self.event_type = v.into();
4787        self
4788    }
4789
4790    /// Sets the value of [event_filters][crate::model::EventTrigger::event_filters].
4791    pub fn set_event_filters<T, V>(mut self, v: T) -> Self
4792    where
4793        T: std::iter::IntoIterator<Item = V>,
4794        V: std::convert::Into<crate::model::EventFilter>,
4795    {
4796        use std::iter::Iterator;
4797        self.event_filters = v.into_iter().map(|i| i.into()).collect();
4798        self
4799    }
4800
4801    /// Sets the value of [pubsub_topic][crate::model::EventTrigger::pubsub_topic].
4802    pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4803        self.pubsub_topic = v.into();
4804        self
4805    }
4806
4807    /// Sets the value of [service_account_email][crate::model::EventTrigger::service_account_email].
4808    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
4809        mut self,
4810        v: T,
4811    ) -> Self {
4812        self.service_account_email = v.into();
4813        self
4814    }
4815
4816    /// Sets the value of [retry_policy][crate::model::EventTrigger::retry_policy].
4817    pub fn set_retry_policy<T: std::convert::Into<crate::model::event_trigger::RetryPolicy>>(
4818        mut self,
4819        v: T,
4820    ) -> Self {
4821        self.retry_policy = v.into();
4822        self
4823    }
4824
4825    /// Sets the value of [channel][crate::model::EventTrigger::channel].
4826    pub fn set_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4827        self.channel = v.into();
4828        self
4829    }
4830
4831    /// Sets the value of [service][crate::model::EventTrigger::service].
4832    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4833        self.service = v.into();
4834        self
4835    }
4836}
4837
4838impl wkt::message::Message for EventTrigger {
4839    fn typename() -> &'static str {
4840        "type.googleapis.com/google.cloud.functions.v2.EventTrigger"
4841    }
4842}
4843
4844#[doc(hidden)]
4845impl<'de> serde::de::Deserialize<'de> for EventTrigger {
4846    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4847    where
4848        D: serde::Deserializer<'de>,
4849    {
4850        #[allow(non_camel_case_types)]
4851        #[doc(hidden)]
4852        #[derive(PartialEq, Eq, Hash)]
4853        enum __FieldTag {
4854            __trigger,
4855            __trigger_region,
4856            __event_type,
4857            __event_filters,
4858            __pubsub_topic,
4859            __service_account_email,
4860            __retry_policy,
4861            __channel,
4862            __service,
4863            Unknown(std::string::String),
4864        }
4865        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4866            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4867            where
4868                D: serde::Deserializer<'de>,
4869            {
4870                struct Visitor;
4871                impl<'de> serde::de::Visitor<'de> for Visitor {
4872                    type Value = __FieldTag;
4873                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4874                        formatter.write_str("a field name for EventTrigger")
4875                    }
4876                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4877                    where
4878                        E: serde::de::Error,
4879                    {
4880                        use std::result::Result::Ok;
4881                        use std::string::ToString;
4882                        match value {
4883                            "trigger" => Ok(__FieldTag::__trigger),
4884                            "triggerRegion" => Ok(__FieldTag::__trigger_region),
4885                            "trigger_region" => Ok(__FieldTag::__trigger_region),
4886                            "eventType" => Ok(__FieldTag::__event_type),
4887                            "event_type" => Ok(__FieldTag::__event_type),
4888                            "eventFilters" => Ok(__FieldTag::__event_filters),
4889                            "event_filters" => Ok(__FieldTag::__event_filters),
4890                            "pubsubTopic" => Ok(__FieldTag::__pubsub_topic),
4891                            "pubsub_topic" => Ok(__FieldTag::__pubsub_topic),
4892                            "serviceAccountEmail" => Ok(__FieldTag::__service_account_email),
4893                            "service_account_email" => Ok(__FieldTag::__service_account_email),
4894                            "retryPolicy" => Ok(__FieldTag::__retry_policy),
4895                            "retry_policy" => Ok(__FieldTag::__retry_policy),
4896                            "channel" => Ok(__FieldTag::__channel),
4897                            "service" => Ok(__FieldTag::__service),
4898                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4899                        }
4900                    }
4901                }
4902                deserializer.deserialize_identifier(Visitor)
4903            }
4904        }
4905        struct Visitor;
4906        impl<'de> serde::de::Visitor<'de> for Visitor {
4907            type Value = EventTrigger;
4908            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4909                formatter.write_str("struct EventTrigger")
4910            }
4911            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4912            where
4913                A: serde::de::MapAccess<'de>,
4914            {
4915                #[allow(unused_imports)]
4916                use serde::de::Error;
4917                use std::option::Option::Some;
4918                let mut fields = std::collections::HashSet::new();
4919                let mut result = Self::Value::new();
4920                while let Some(tag) = map.next_key::<__FieldTag>()? {
4921                    #[allow(clippy::match_single_binding)]
4922                    match tag {
4923                        __FieldTag::__trigger => {
4924                            if !fields.insert(__FieldTag::__trigger) {
4925                                return std::result::Result::Err(A::Error::duplicate_field(
4926                                    "multiple values for trigger",
4927                                ));
4928                            }
4929                            result.trigger = map
4930                                .next_value::<std::option::Option<std::string::String>>()?
4931                                .unwrap_or_default();
4932                        }
4933                        __FieldTag::__trigger_region => {
4934                            if !fields.insert(__FieldTag::__trigger_region) {
4935                                return std::result::Result::Err(A::Error::duplicate_field(
4936                                    "multiple values for trigger_region",
4937                                ));
4938                            }
4939                            result.trigger_region = map
4940                                .next_value::<std::option::Option<std::string::String>>()?
4941                                .unwrap_or_default();
4942                        }
4943                        __FieldTag::__event_type => {
4944                            if !fields.insert(__FieldTag::__event_type) {
4945                                return std::result::Result::Err(A::Error::duplicate_field(
4946                                    "multiple values for event_type",
4947                                ));
4948                            }
4949                            result.event_type = map
4950                                .next_value::<std::option::Option<std::string::String>>()?
4951                                .unwrap_or_default();
4952                        }
4953                        __FieldTag::__event_filters => {
4954                            if !fields.insert(__FieldTag::__event_filters) {
4955                                return std::result::Result::Err(A::Error::duplicate_field(
4956                                    "multiple values for event_filters",
4957                                ));
4958                            }
4959                            result.event_filters = map.next_value::<std::option::Option<std::vec::Vec<crate::model::EventFilter>>>()?.unwrap_or_default();
4960                        }
4961                        __FieldTag::__pubsub_topic => {
4962                            if !fields.insert(__FieldTag::__pubsub_topic) {
4963                                return std::result::Result::Err(A::Error::duplicate_field(
4964                                    "multiple values for pubsub_topic",
4965                                ));
4966                            }
4967                            result.pubsub_topic = map
4968                                .next_value::<std::option::Option<std::string::String>>()?
4969                                .unwrap_or_default();
4970                        }
4971                        __FieldTag::__service_account_email => {
4972                            if !fields.insert(__FieldTag::__service_account_email) {
4973                                return std::result::Result::Err(A::Error::duplicate_field(
4974                                    "multiple values for service_account_email",
4975                                ));
4976                            }
4977                            result.service_account_email = map
4978                                .next_value::<std::option::Option<std::string::String>>()?
4979                                .unwrap_or_default();
4980                        }
4981                        __FieldTag::__retry_policy => {
4982                            if !fields.insert(__FieldTag::__retry_policy) {
4983                                return std::result::Result::Err(A::Error::duplicate_field(
4984                                    "multiple values for retry_policy",
4985                                ));
4986                            }
4987                            result.retry_policy = map.next_value::<std::option::Option<crate::model::event_trigger::RetryPolicy>>()?.unwrap_or_default();
4988                        }
4989                        __FieldTag::__channel => {
4990                            if !fields.insert(__FieldTag::__channel) {
4991                                return std::result::Result::Err(A::Error::duplicate_field(
4992                                    "multiple values for channel",
4993                                ));
4994                            }
4995                            result.channel = map
4996                                .next_value::<std::option::Option<std::string::String>>()?
4997                                .unwrap_or_default();
4998                        }
4999                        __FieldTag::__service => {
5000                            if !fields.insert(__FieldTag::__service) {
5001                                return std::result::Result::Err(A::Error::duplicate_field(
5002                                    "multiple values for service",
5003                                ));
5004                            }
5005                            result.service = map
5006                                .next_value::<std::option::Option<std::string::String>>()?
5007                                .unwrap_or_default();
5008                        }
5009                        __FieldTag::Unknown(key) => {
5010                            let value = map.next_value::<serde_json::Value>()?;
5011                            result._unknown_fields.insert(key, value);
5012                        }
5013                    }
5014                }
5015                std::result::Result::Ok(result)
5016            }
5017        }
5018        deserializer.deserialize_any(Visitor)
5019    }
5020}
5021
5022#[doc(hidden)]
5023impl serde::ser::Serialize for EventTrigger {
5024    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5025    where
5026        S: serde::ser::Serializer,
5027    {
5028        use serde::ser::SerializeMap;
5029        #[allow(unused_imports)]
5030        use std::option::Option::Some;
5031        let mut state = serializer.serialize_map(std::option::Option::None)?;
5032        if !self.trigger.is_empty() {
5033            state.serialize_entry("trigger", &self.trigger)?;
5034        }
5035        if !self.trigger_region.is_empty() {
5036            state.serialize_entry("triggerRegion", &self.trigger_region)?;
5037        }
5038        if !self.event_type.is_empty() {
5039            state.serialize_entry("eventType", &self.event_type)?;
5040        }
5041        if !self.event_filters.is_empty() {
5042            state.serialize_entry("eventFilters", &self.event_filters)?;
5043        }
5044        if !self.pubsub_topic.is_empty() {
5045            state.serialize_entry("pubsubTopic", &self.pubsub_topic)?;
5046        }
5047        if !self.service_account_email.is_empty() {
5048            state.serialize_entry("serviceAccountEmail", &self.service_account_email)?;
5049        }
5050        if !wkt::internal::is_default(&self.retry_policy) {
5051            state.serialize_entry("retryPolicy", &self.retry_policy)?;
5052        }
5053        if !self.channel.is_empty() {
5054            state.serialize_entry("channel", &self.channel)?;
5055        }
5056        if !self.service.is_empty() {
5057            state.serialize_entry("service", &self.service)?;
5058        }
5059        if !self._unknown_fields.is_empty() {
5060            for (key, value) in self._unknown_fields.iter() {
5061                state.serialize_entry(key, &value)?;
5062            }
5063        }
5064        state.end()
5065    }
5066}
5067
5068/// Defines additional types related to [EventTrigger].
5069pub mod event_trigger {
5070    #[allow(unused_imports)]
5071    use super::*;
5072
5073    /// Describes the retry policy in case of function's execution failure.
5074    /// Retried execution is charged as any other execution.
5075    ///
5076    /// # Working with unknown values
5077    ///
5078    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5079    /// additional enum variants at any time. Adding new variants is not considered
5080    /// a breaking change. Applications should write their code in anticipation of:
5081    ///
5082    /// - New values appearing in future releases of the client library, **and**
5083    /// - New values received dynamically, without application changes.
5084    ///
5085    /// Please consult the [Working with enums] section in the user guide for some
5086    /// guidelines.
5087    ///
5088    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5089    #[derive(Clone, Debug, PartialEq)]
5090    #[non_exhaustive]
5091    pub enum RetryPolicy {
5092        /// Not specified.
5093        Unspecified,
5094        /// Do not retry.
5095        DoNotRetry,
5096        /// Retry on any failure, retry up to 7 days with an exponential backoff
5097        /// (capped at 10 seconds).
5098        Retry,
5099        /// If set, the enum was initialized with an unknown value.
5100        ///
5101        /// Applications can examine the value using [RetryPolicy::value] or
5102        /// [RetryPolicy::name].
5103        UnknownValue(retry_policy::UnknownValue),
5104    }
5105
5106    #[doc(hidden)]
5107    pub mod retry_policy {
5108        #[allow(unused_imports)]
5109        use super::*;
5110        #[derive(Clone, Debug, PartialEq)]
5111        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5112    }
5113
5114    impl RetryPolicy {
5115        /// Gets the enum value.
5116        ///
5117        /// Returns `None` if the enum contains an unknown value deserialized from
5118        /// the string representation of enums.
5119        pub fn value(&self) -> std::option::Option<i32> {
5120            match self {
5121                Self::Unspecified => std::option::Option::Some(0),
5122                Self::DoNotRetry => std::option::Option::Some(1),
5123                Self::Retry => std::option::Option::Some(2),
5124                Self::UnknownValue(u) => u.0.value(),
5125            }
5126        }
5127
5128        /// Gets the enum value as a string.
5129        ///
5130        /// Returns `None` if the enum contains an unknown value deserialized from
5131        /// the integer representation of enums.
5132        pub fn name(&self) -> std::option::Option<&str> {
5133            match self {
5134                Self::Unspecified => std::option::Option::Some("RETRY_POLICY_UNSPECIFIED"),
5135                Self::DoNotRetry => std::option::Option::Some("RETRY_POLICY_DO_NOT_RETRY"),
5136                Self::Retry => std::option::Option::Some("RETRY_POLICY_RETRY"),
5137                Self::UnknownValue(u) => u.0.name(),
5138            }
5139        }
5140    }
5141
5142    impl std::default::Default for RetryPolicy {
5143        fn default() -> Self {
5144            use std::convert::From;
5145            Self::from(0)
5146        }
5147    }
5148
5149    impl std::fmt::Display for RetryPolicy {
5150        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5151            wkt::internal::display_enum(f, self.name(), self.value())
5152        }
5153    }
5154
5155    impl std::convert::From<i32> for RetryPolicy {
5156        fn from(value: i32) -> Self {
5157            match value {
5158                0 => Self::Unspecified,
5159                1 => Self::DoNotRetry,
5160                2 => Self::Retry,
5161                _ => Self::UnknownValue(retry_policy::UnknownValue(
5162                    wkt::internal::UnknownEnumValue::Integer(value),
5163                )),
5164            }
5165        }
5166    }
5167
5168    impl std::convert::From<&str> for RetryPolicy {
5169        fn from(value: &str) -> Self {
5170            use std::string::ToString;
5171            match value {
5172                "RETRY_POLICY_UNSPECIFIED" => Self::Unspecified,
5173                "RETRY_POLICY_DO_NOT_RETRY" => Self::DoNotRetry,
5174                "RETRY_POLICY_RETRY" => Self::Retry,
5175                _ => Self::UnknownValue(retry_policy::UnknownValue(
5176                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5177                )),
5178            }
5179        }
5180    }
5181
5182    impl serde::ser::Serialize for RetryPolicy {
5183        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5184        where
5185            S: serde::Serializer,
5186        {
5187            match self {
5188                Self::Unspecified => serializer.serialize_i32(0),
5189                Self::DoNotRetry => serializer.serialize_i32(1),
5190                Self::Retry => serializer.serialize_i32(2),
5191                Self::UnknownValue(u) => u.0.serialize(serializer),
5192            }
5193        }
5194    }
5195
5196    impl<'de> serde::de::Deserialize<'de> for RetryPolicy {
5197        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5198        where
5199            D: serde::Deserializer<'de>,
5200        {
5201            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetryPolicy>::new(
5202                ".google.cloud.functions.v2.EventTrigger.RetryPolicy",
5203            ))
5204        }
5205    }
5206}
5207
5208/// Filters events based on exact matches on the CloudEvents attributes.
5209#[derive(Clone, Debug, Default, PartialEq)]
5210#[non_exhaustive]
5211pub struct EventFilter {
5212    /// Required. The name of a CloudEvents attribute.
5213    pub attribute: std::string::String,
5214
5215    /// Required. The value for the attribute.
5216    pub value: std::string::String,
5217
5218    /// Optional. The operator used for matching the events with the value of the
5219    /// filter. If not specified, only events that have an exact key-value pair
5220    /// specified in the filter are matched. The only allowed value is
5221    /// `match-path-pattern`.
5222    pub operator: std::string::String,
5223
5224    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5225}
5226
5227impl EventFilter {
5228    pub fn new() -> Self {
5229        std::default::Default::default()
5230    }
5231
5232    /// Sets the value of [attribute][crate::model::EventFilter::attribute].
5233    pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5234        self.attribute = v.into();
5235        self
5236    }
5237
5238    /// Sets the value of [value][crate::model::EventFilter::value].
5239    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5240        self.value = v.into();
5241        self
5242    }
5243
5244    /// Sets the value of [operator][crate::model::EventFilter::operator].
5245    pub fn set_operator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5246        self.operator = v.into();
5247        self
5248    }
5249}
5250
5251impl wkt::message::Message for EventFilter {
5252    fn typename() -> &'static str {
5253        "type.googleapis.com/google.cloud.functions.v2.EventFilter"
5254    }
5255}
5256
5257#[doc(hidden)]
5258impl<'de> serde::de::Deserialize<'de> for EventFilter {
5259    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5260    where
5261        D: serde::Deserializer<'de>,
5262    {
5263        #[allow(non_camel_case_types)]
5264        #[doc(hidden)]
5265        #[derive(PartialEq, Eq, Hash)]
5266        enum __FieldTag {
5267            __attribute,
5268            __value,
5269            __operator,
5270            Unknown(std::string::String),
5271        }
5272        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5273            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5274            where
5275                D: serde::Deserializer<'de>,
5276            {
5277                struct Visitor;
5278                impl<'de> serde::de::Visitor<'de> for Visitor {
5279                    type Value = __FieldTag;
5280                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5281                        formatter.write_str("a field name for EventFilter")
5282                    }
5283                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5284                    where
5285                        E: serde::de::Error,
5286                    {
5287                        use std::result::Result::Ok;
5288                        use std::string::ToString;
5289                        match value {
5290                            "attribute" => Ok(__FieldTag::__attribute),
5291                            "value" => Ok(__FieldTag::__value),
5292                            "operator" => Ok(__FieldTag::__operator),
5293                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5294                        }
5295                    }
5296                }
5297                deserializer.deserialize_identifier(Visitor)
5298            }
5299        }
5300        struct Visitor;
5301        impl<'de> serde::de::Visitor<'de> for Visitor {
5302            type Value = EventFilter;
5303            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5304                formatter.write_str("struct EventFilter")
5305            }
5306            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5307            where
5308                A: serde::de::MapAccess<'de>,
5309            {
5310                #[allow(unused_imports)]
5311                use serde::de::Error;
5312                use std::option::Option::Some;
5313                let mut fields = std::collections::HashSet::new();
5314                let mut result = Self::Value::new();
5315                while let Some(tag) = map.next_key::<__FieldTag>()? {
5316                    #[allow(clippy::match_single_binding)]
5317                    match tag {
5318                        __FieldTag::__attribute => {
5319                            if !fields.insert(__FieldTag::__attribute) {
5320                                return std::result::Result::Err(A::Error::duplicate_field(
5321                                    "multiple values for attribute",
5322                                ));
5323                            }
5324                            result.attribute = map
5325                                .next_value::<std::option::Option<std::string::String>>()?
5326                                .unwrap_or_default();
5327                        }
5328                        __FieldTag::__value => {
5329                            if !fields.insert(__FieldTag::__value) {
5330                                return std::result::Result::Err(A::Error::duplicate_field(
5331                                    "multiple values for value",
5332                                ));
5333                            }
5334                            result.value = map
5335                                .next_value::<std::option::Option<std::string::String>>()?
5336                                .unwrap_or_default();
5337                        }
5338                        __FieldTag::__operator => {
5339                            if !fields.insert(__FieldTag::__operator) {
5340                                return std::result::Result::Err(A::Error::duplicate_field(
5341                                    "multiple values for operator",
5342                                ));
5343                            }
5344                            result.operator = map
5345                                .next_value::<std::option::Option<std::string::String>>()?
5346                                .unwrap_or_default();
5347                        }
5348                        __FieldTag::Unknown(key) => {
5349                            let value = map.next_value::<serde_json::Value>()?;
5350                            result._unknown_fields.insert(key, value);
5351                        }
5352                    }
5353                }
5354                std::result::Result::Ok(result)
5355            }
5356        }
5357        deserializer.deserialize_any(Visitor)
5358    }
5359}
5360
5361#[doc(hidden)]
5362impl serde::ser::Serialize for EventFilter {
5363    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5364    where
5365        S: serde::ser::Serializer,
5366    {
5367        use serde::ser::SerializeMap;
5368        #[allow(unused_imports)]
5369        use std::option::Option::Some;
5370        let mut state = serializer.serialize_map(std::option::Option::None)?;
5371        if !self.attribute.is_empty() {
5372            state.serialize_entry("attribute", &self.attribute)?;
5373        }
5374        if !self.value.is_empty() {
5375            state.serialize_entry("value", &self.value)?;
5376        }
5377        if !self.operator.is_empty() {
5378            state.serialize_entry("operator", &self.operator)?;
5379        }
5380        if !self._unknown_fields.is_empty() {
5381            for (key, value) in self._unknown_fields.iter() {
5382                state.serialize_entry(key, &value)?;
5383            }
5384        }
5385        state.end()
5386    }
5387}
5388
5389/// Request for the `GetFunction` method.
5390#[derive(Clone, Debug, Default, PartialEq)]
5391#[non_exhaustive]
5392pub struct GetFunctionRequest {
5393    /// Required. The name of the function which details should be obtained.
5394    pub name: std::string::String,
5395
5396    /// Optional. The optional version of the 1st gen function whose details should
5397    /// be obtained. The version of a 1st gen function is an integer that starts
5398    /// from 1 and gets incremented on redeployments. GCF may keep historical
5399    /// configs for old versions of 1st gen function. This field can be specified
5400    /// to fetch the historical configs. This field is valid only for GCF 1st gen
5401    /// function.
5402    pub revision: std::string::String,
5403
5404    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5405}
5406
5407impl GetFunctionRequest {
5408    pub fn new() -> Self {
5409        std::default::Default::default()
5410    }
5411
5412    /// Sets the value of [name][crate::model::GetFunctionRequest::name].
5413    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5414        self.name = v.into();
5415        self
5416    }
5417
5418    /// Sets the value of [revision][crate::model::GetFunctionRequest::revision].
5419    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5420        self.revision = v.into();
5421        self
5422    }
5423}
5424
5425impl wkt::message::Message for GetFunctionRequest {
5426    fn typename() -> &'static str {
5427        "type.googleapis.com/google.cloud.functions.v2.GetFunctionRequest"
5428    }
5429}
5430
5431#[doc(hidden)]
5432impl<'de> serde::de::Deserialize<'de> for GetFunctionRequest {
5433    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5434    where
5435        D: serde::Deserializer<'de>,
5436    {
5437        #[allow(non_camel_case_types)]
5438        #[doc(hidden)]
5439        #[derive(PartialEq, Eq, Hash)]
5440        enum __FieldTag {
5441            __name,
5442            __revision,
5443            Unknown(std::string::String),
5444        }
5445        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5446            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5447            where
5448                D: serde::Deserializer<'de>,
5449            {
5450                struct Visitor;
5451                impl<'de> serde::de::Visitor<'de> for Visitor {
5452                    type Value = __FieldTag;
5453                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5454                        formatter.write_str("a field name for GetFunctionRequest")
5455                    }
5456                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5457                    where
5458                        E: serde::de::Error,
5459                    {
5460                        use std::result::Result::Ok;
5461                        use std::string::ToString;
5462                        match value {
5463                            "name" => Ok(__FieldTag::__name),
5464                            "revision" => Ok(__FieldTag::__revision),
5465                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5466                        }
5467                    }
5468                }
5469                deserializer.deserialize_identifier(Visitor)
5470            }
5471        }
5472        struct Visitor;
5473        impl<'de> serde::de::Visitor<'de> for Visitor {
5474            type Value = GetFunctionRequest;
5475            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5476                formatter.write_str("struct GetFunctionRequest")
5477            }
5478            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5479            where
5480                A: serde::de::MapAccess<'de>,
5481            {
5482                #[allow(unused_imports)]
5483                use serde::de::Error;
5484                use std::option::Option::Some;
5485                let mut fields = std::collections::HashSet::new();
5486                let mut result = Self::Value::new();
5487                while let Some(tag) = map.next_key::<__FieldTag>()? {
5488                    #[allow(clippy::match_single_binding)]
5489                    match tag {
5490                        __FieldTag::__name => {
5491                            if !fields.insert(__FieldTag::__name) {
5492                                return std::result::Result::Err(A::Error::duplicate_field(
5493                                    "multiple values for name",
5494                                ));
5495                            }
5496                            result.name = map
5497                                .next_value::<std::option::Option<std::string::String>>()?
5498                                .unwrap_or_default();
5499                        }
5500                        __FieldTag::__revision => {
5501                            if !fields.insert(__FieldTag::__revision) {
5502                                return std::result::Result::Err(A::Error::duplicate_field(
5503                                    "multiple values for revision",
5504                                ));
5505                            }
5506                            result.revision = map
5507                                .next_value::<std::option::Option<std::string::String>>()?
5508                                .unwrap_or_default();
5509                        }
5510                        __FieldTag::Unknown(key) => {
5511                            let value = map.next_value::<serde_json::Value>()?;
5512                            result._unknown_fields.insert(key, value);
5513                        }
5514                    }
5515                }
5516                std::result::Result::Ok(result)
5517            }
5518        }
5519        deserializer.deserialize_any(Visitor)
5520    }
5521}
5522
5523#[doc(hidden)]
5524impl serde::ser::Serialize for GetFunctionRequest {
5525    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5526    where
5527        S: serde::ser::Serializer,
5528    {
5529        use serde::ser::SerializeMap;
5530        #[allow(unused_imports)]
5531        use std::option::Option::Some;
5532        let mut state = serializer.serialize_map(std::option::Option::None)?;
5533        if !self.name.is_empty() {
5534            state.serialize_entry("name", &self.name)?;
5535        }
5536        if !self.revision.is_empty() {
5537            state.serialize_entry("revision", &self.revision)?;
5538        }
5539        if !self._unknown_fields.is_empty() {
5540            for (key, value) in self._unknown_fields.iter() {
5541                state.serialize_entry(key, &value)?;
5542            }
5543        }
5544        state.end()
5545    }
5546}
5547
5548/// Request for the `ListFunctions` method.
5549#[derive(Clone, Debug, Default, PartialEq)]
5550#[non_exhaustive]
5551pub struct ListFunctionsRequest {
5552    /// Required. The project and location from which the function should be
5553    /// listed, specified in the format `projects/*/locations/*` If you want to
5554    /// list functions in all locations, use "-" in place of a location. When
5555    /// listing functions in all locations, if one or more location(s) are
5556    /// unreachable, the response will contain functions from all reachable
5557    /// locations along with the names of any unreachable locations.
5558    pub parent: std::string::String,
5559
5560    /// Maximum number of functions to return per call. The largest allowed
5561    /// page_size is 1,000, if the page_size is omitted or specified as greater
5562    /// than 1,000 then it will be replaced as 1,000. The size of the list
5563    /// response can be less than specified when used with filters.
5564    pub page_size: i32,
5565
5566    /// The value returned by the last
5567    /// `ListFunctionsResponse`; indicates that
5568    /// this is a continuation of a prior `ListFunctions` call, and that the
5569    /// system should return the next page of data.
5570    pub page_token: std::string::String,
5571
5572    /// The filter for Functions that match the filter expression,
5573    /// following the syntax outlined in <https://google.aip.dev/160>.
5574    pub filter: std::string::String,
5575
5576    /// The sorting order of the resources returned. Value should be a comma
5577    /// separated list of fields. The default sorting order is ascending.
5578    /// See <https://google.aip.dev/132#ordering>.
5579    pub order_by: std::string::String,
5580
5581    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5582}
5583
5584impl ListFunctionsRequest {
5585    pub fn new() -> Self {
5586        std::default::Default::default()
5587    }
5588
5589    /// Sets the value of [parent][crate::model::ListFunctionsRequest::parent].
5590    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5591        self.parent = v.into();
5592        self
5593    }
5594
5595    /// Sets the value of [page_size][crate::model::ListFunctionsRequest::page_size].
5596    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5597        self.page_size = v.into();
5598        self
5599    }
5600
5601    /// Sets the value of [page_token][crate::model::ListFunctionsRequest::page_token].
5602    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5603        self.page_token = v.into();
5604        self
5605    }
5606
5607    /// Sets the value of [filter][crate::model::ListFunctionsRequest::filter].
5608    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5609        self.filter = v.into();
5610        self
5611    }
5612
5613    /// Sets the value of [order_by][crate::model::ListFunctionsRequest::order_by].
5614    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5615        self.order_by = v.into();
5616        self
5617    }
5618}
5619
5620impl wkt::message::Message for ListFunctionsRequest {
5621    fn typename() -> &'static str {
5622        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsRequest"
5623    }
5624}
5625
5626#[doc(hidden)]
5627impl<'de> serde::de::Deserialize<'de> for ListFunctionsRequest {
5628    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5629    where
5630        D: serde::Deserializer<'de>,
5631    {
5632        #[allow(non_camel_case_types)]
5633        #[doc(hidden)]
5634        #[derive(PartialEq, Eq, Hash)]
5635        enum __FieldTag {
5636            __parent,
5637            __page_size,
5638            __page_token,
5639            __filter,
5640            __order_by,
5641            Unknown(std::string::String),
5642        }
5643        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5644            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5645            where
5646                D: serde::Deserializer<'de>,
5647            {
5648                struct Visitor;
5649                impl<'de> serde::de::Visitor<'de> for Visitor {
5650                    type Value = __FieldTag;
5651                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5652                        formatter.write_str("a field name for ListFunctionsRequest")
5653                    }
5654                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5655                    where
5656                        E: serde::de::Error,
5657                    {
5658                        use std::result::Result::Ok;
5659                        use std::string::ToString;
5660                        match value {
5661                            "parent" => Ok(__FieldTag::__parent),
5662                            "pageSize" => Ok(__FieldTag::__page_size),
5663                            "page_size" => Ok(__FieldTag::__page_size),
5664                            "pageToken" => Ok(__FieldTag::__page_token),
5665                            "page_token" => Ok(__FieldTag::__page_token),
5666                            "filter" => Ok(__FieldTag::__filter),
5667                            "orderBy" => Ok(__FieldTag::__order_by),
5668                            "order_by" => Ok(__FieldTag::__order_by),
5669                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5670                        }
5671                    }
5672                }
5673                deserializer.deserialize_identifier(Visitor)
5674            }
5675        }
5676        struct Visitor;
5677        impl<'de> serde::de::Visitor<'de> for Visitor {
5678            type Value = ListFunctionsRequest;
5679            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5680                formatter.write_str("struct ListFunctionsRequest")
5681            }
5682            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5683            where
5684                A: serde::de::MapAccess<'de>,
5685            {
5686                #[allow(unused_imports)]
5687                use serde::de::Error;
5688                use std::option::Option::Some;
5689                let mut fields = std::collections::HashSet::new();
5690                let mut result = Self::Value::new();
5691                while let Some(tag) = map.next_key::<__FieldTag>()? {
5692                    #[allow(clippy::match_single_binding)]
5693                    match tag {
5694                        __FieldTag::__parent => {
5695                            if !fields.insert(__FieldTag::__parent) {
5696                                return std::result::Result::Err(A::Error::duplicate_field(
5697                                    "multiple values for parent",
5698                                ));
5699                            }
5700                            result.parent = map
5701                                .next_value::<std::option::Option<std::string::String>>()?
5702                                .unwrap_or_default();
5703                        }
5704                        __FieldTag::__page_size => {
5705                            if !fields.insert(__FieldTag::__page_size) {
5706                                return std::result::Result::Err(A::Error::duplicate_field(
5707                                    "multiple values for page_size",
5708                                ));
5709                            }
5710                            struct __With(std::option::Option<i32>);
5711                            impl<'de> serde::de::Deserialize<'de> for __With {
5712                                fn deserialize<D>(
5713                                    deserializer: D,
5714                                ) -> std::result::Result<Self, D::Error>
5715                                where
5716                                    D: serde::de::Deserializer<'de>,
5717                                {
5718                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5719                                }
5720                            }
5721                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5722                        }
5723                        __FieldTag::__page_token => {
5724                            if !fields.insert(__FieldTag::__page_token) {
5725                                return std::result::Result::Err(A::Error::duplicate_field(
5726                                    "multiple values for page_token",
5727                                ));
5728                            }
5729                            result.page_token = map
5730                                .next_value::<std::option::Option<std::string::String>>()?
5731                                .unwrap_or_default();
5732                        }
5733                        __FieldTag::__filter => {
5734                            if !fields.insert(__FieldTag::__filter) {
5735                                return std::result::Result::Err(A::Error::duplicate_field(
5736                                    "multiple values for filter",
5737                                ));
5738                            }
5739                            result.filter = map
5740                                .next_value::<std::option::Option<std::string::String>>()?
5741                                .unwrap_or_default();
5742                        }
5743                        __FieldTag::__order_by => {
5744                            if !fields.insert(__FieldTag::__order_by) {
5745                                return std::result::Result::Err(A::Error::duplicate_field(
5746                                    "multiple values for order_by",
5747                                ));
5748                            }
5749                            result.order_by = map
5750                                .next_value::<std::option::Option<std::string::String>>()?
5751                                .unwrap_or_default();
5752                        }
5753                        __FieldTag::Unknown(key) => {
5754                            let value = map.next_value::<serde_json::Value>()?;
5755                            result._unknown_fields.insert(key, value);
5756                        }
5757                    }
5758                }
5759                std::result::Result::Ok(result)
5760            }
5761        }
5762        deserializer.deserialize_any(Visitor)
5763    }
5764}
5765
5766#[doc(hidden)]
5767impl serde::ser::Serialize for ListFunctionsRequest {
5768    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5769    where
5770        S: serde::ser::Serializer,
5771    {
5772        use serde::ser::SerializeMap;
5773        #[allow(unused_imports)]
5774        use std::option::Option::Some;
5775        let mut state = serializer.serialize_map(std::option::Option::None)?;
5776        if !self.parent.is_empty() {
5777            state.serialize_entry("parent", &self.parent)?;
5778        }
5779        if !wkt::internal::is_default(&self.page_size) {
5780            struct __With<'a>(&'a i32);
5781            impl<'a> serde::ser::Serialize for __With<'a> {
5782                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5783                where
5784                    S: serde::ser::Serializer,
5785                {
5786                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5787                }
5788            }
5789            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5790        }
5791        if !self.page_token.is_empty() {
5792            state.serialize_entry("pageToken", &self.page_token)?;
5793        }
5794        if !self.filter.is_empty() {
5795            state.serialize_entry("filter", &self.filter)?;
5796        }
5797        if !self.order_by.is_empty() {
5798            state.serialize_entry("orderBy", &self.order_by)?;
5799        }
5800        if !self._unknown_fields.is_empty() {
5801            for (key, value) in self._unknown_fields.iter() {
5802                state.serialize_entry(key, &value)?;
5803            }
5804        }
5805        state.end()
5806    }
5807}
5808
5809/// Response for the `ListFunctions` method.
5810#[derive(Clone, Debug, Default, PartialEq)]
5811#[non_exhaustive]
5812pub struct ListFunctionsResponse {
5813    /// The functions that match the request.
5814    pub functions: std::vec::Vec<crate::model::Function>,
5815
5816    /// A token, which can be sent as `page_token` to retrieve the next page.
5817    /// If this field is omitted, there are no subsequent pages.
5818    pub next_page_token: std::string::String,
5819
5820    /// Locations that could not be reached. The response does not include any
5821    /// functions from these locations.
5822    pub unreachable: std::vec::Vec<std::string::String>,
5823
5824    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5825}
5826
5827impl ListFunctionsResponse {
5828    pub fn new() -> Self {
5829        std::default::Default::default()
5830    }
5831
5832    /// Sets the value of [functions][crate::model::ListFunctionsResponse::functions].
5833    pub fn set_functions<T, V>(mut self, v: T) -> Self
5834    where
5835        T: std::iter::IntoIterator<Item = V>,
5836        V: std::convert::Into<crate::model::Function>,
5837    {
5838        use std::iter::Iterator;
5839        self.functions = v.into_iter().map(|i| i.into()).collect();
5840        self
5841    }
5842
5843    /// Sets the value of [next_page_token][crate::model::ListFunctionsResponse::next_page_token].
5844    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5845        self.next_page_token = v.into();
5846        self
5847    }
5848
5849    /// Sets the value of [unreachable][crate::model::ListFunctionsResponse::unreachable].
5850    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5851    where
5852        T: std::iter::IntoIterator<Item = V>,
5853        V: std::convert::Into<std::string::String>,
5854    {
5855        use std::iter::Iterator;
5856        self.unreachable = v.into_iter().map(|i| i.into()).collect();
5857        self
5858    }
5859}
5860
5861impl wkt::message::Message for ListFunctionsResponse {
5862    fn typename() -> &'static str {
5863        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsResponse"
5864    }
5865}
5866
5867#[doc(hidden)]
5868impl gax::paginator::internal::PageableResponse for ListFunctionsResponse {
5869    type PageItem = crate::model::Function;
5870
5871    fn items(self) -> std::vec::Vec<Self::PageItem> {
5872        self.functions
5873    }
5874
5875    fn next_page_token(&self) -> std::string::String {
5876        use std::clone::Clone;
5877        self.next_page_token.clone()
5878    }
5879}
5880
5881#[doc(hidden)]
5882impl<'de> serde::de::Deserialize<'de> for ListFunctionsResponse {
5883    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5884    where
5885        D: serde::Deserializer<'de>,
5886    {
5887        #[allow(non_camel_case_types)]
5888        #[doc(hidden)]
5889        #[derive(PartialEq, Eq, Hash)]
5890        enum __FieldTag {
5891            __functions,
5892            __next_page_token,
5893            __unreachable,
5894            Unknown(std::string::String),
5895        }
5896        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5897            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5898            where
5899                D: serde::Deserializer<'de>,
5900            {
5901                struct Visitor;
5902                impl<'de> serde::de::Visitor<'de> for Visitor {
5903                    type Value = __FieldTag;
5904                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5905                        formatter.write_str("a field name for ListFunctionsResponse")
5906                    }
5907                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5908                    where
5909                        E: serde::de::Error,
5910                    {
5911                        use std::result::Result::Ok;
5912                        use std::string::ToString;
5913                        match value {
5914                            "functions" => Ok(__FieldTag::__functions),
5915                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
5916                            "next_page_token" => Ok(__FieldTag::__next_page_token),
5917                            "unreachable" => Ok(__FieldTag::__unreachable),
5918                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5919                        }
5920                    }
5921                }
5922                deserializer.deserialize_identifier(Visitor)
5923            }
5924        }
5925        struct Visitor;
5926        impl<'de> serde::de::Visitor<'de> for Visitor {
5927            type Value = ListFunctionsResponse;
5928            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5929                formatter.write_str("struct ListFunctionsResponse")
5930            }
5931            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5932            where
5933                A: serde::de::MapAccess<'de>,
5934            {
5935                #[allow(unused_imports)]
5936                use serde::de::Error;
5937                use std::option::Option::Some;
5938                let mut fields = std::collections::HashSet::new();
5939                let mut result = Self::Value::new();
5940                while let Some(tag) = map.next_key::<__FieldTag>()? {
5941                    #[allow(clippy::match_single_binding)]
5942                    match tag {
5943                        __FieldTag::__functions => {
5944                            if !fields.insert(__FieldTag::__functions) {
5945                                return std::result::Result::Err(A::Error::duplicate_field(
5946                                    "multiple values for functions",
5947                                ));
5948                            }
5949                            result.functions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Function>>>()?.unwrap_or_default();
5950                        }
5951                        __FieldTag::__next_page_token => {
5952                            if !fields.insert(__FieldTag::__next_page_token) {
5953                                return std::result::Result::Err(A::Error::duplicate_field(
5954                                    "multiple values for next_page_token",
5955                                ));
5956                            }
5957                            result.next_page_token = map
5958                                .next_value::<std::option::Option<std::string::String>>()?
5959                                .unwrap_or_default();
5960                        }
5961                        __FieldTag::__unreachable => {
5962                            if !fields.insert(__FieldTag::__unreachable) {
5963                                return std::result::Result::Err(A::Error::duplicate_field(
5964                                    "multiple values for unreachable",
5965                                ));
5966                            }
5967                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
5968                        }
5969                        __FieldTag::Unknown(key) => {
5970                            let value = map.next_value::<serde_json::Value>()?;
5971                            result._unknown_fields.insert(key, value);
5972                        }
5973                    }
5974                }
5975                std::result::Result::Ok(result)
5976            }
5977        }
5978        deserializer.deserialize_any(Visitor)
5979    }
5980}
5981
5982#[doc(hidden)]
5983impl serde::ser::Serialize for ListFunctionsResponse {
5984    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5985    where
5986        S: serde::ser::Serializer,
5987    {
5988        use serde::ser::SerializeMap;
5989        #[allow(unused_imports)]
5990        use std::option::Option::Some;
5991        let mut state = serializer.serialize_map(std::option::Option::None)?;
5992        if !self.functions.is_empty() {
5993            state.serialize_entry("functions", &self.functions)?;
5994        }
5995        if !self.next_page_token.is_empty() {
5996            state.serialize_entry("nextPageToken", &self.next_page_token)?;
5997        }
5998        if !self.unreachable.is_empty() {
5999            state.serialize_entry("unreachable", &self.unreachable)?;
6000        }
6001        if !self._unknown_fields.is_empty() {
6002            for (key, value) in self._unknown_fields.iter() {
6003                state.serialize_entry(key, &value)?;
6004            }
6005        }
6006        state.end()
6007    }
6008}
6009
6010/// Request for the `CreateFunction` method.
6011#[derive(Clone, Debug, Default, PartialEq)]
6012#[non_exhaustive]
6013pub struct CreateFunctionRequest {
6014    /// Required. The project and location in which the function should be created,
6015    /// specified in the format `projects/*/locations/*`
6016    pub parent: std::string::String,
6017
6018    /// Required. Function to be created.
6019    pub function: std::option::Option<crate::model::Function>,
6020
6021    /// The ID to use for the function, which will become the final component of
6022    /// the function's resource name.
6023    ///
6024    /// This value should be 4-63 characters, and valid characters
6025    /// are /[a-z][0-9]-/.
6026    pub function_id: std::string::String,
6027
6028    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6029}
6030
6031impl CreateFunctionRequest {
6032    pub fn new() -> Self {
6033        std::default::Default::default()
6034    }
6035
6036    /// Sets the value of [parent][crate::model::CreateFunctionRequest::parent].
6037    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6038        self.parent = v.into();
6039        self
6040    }
6041
6042    /// Sets the value of [function][crate::model::CreateFunctionRequest::function].
6043    pub fn set_function<T>(mut self, v: T) -> Self
6044    where
6045        T: std::convert::Into<crate::model::Function>,
6046    {
6047        self.function = std::option::Option::Some(v.into());
6048        self
6049    }
6050
6051    /// Sets or clears the value of [function][crate::model::CreateFunctionRequest::function].
6052    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
6053    where
6054        T: std::convert::Into<crate::model::Function>,
6055    {
6056        self.function = v.map(|x| x.into());
6057        self
6058    }
6059
6060    /// Sets the value of [function_id][crate::model::CreateFunctionRequest::function_id].
6061    pub fn set_function_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6062        self.function_id = v.into();
6063        self
6064    }
6065}
6066
6067impl wkt::message::Message for CreateFunctionRequest {
6068    fn typename() -> &'static str {
6069        "type.googleapis.com/google.cloud.functions.v2.CreateFunctionRequest"
6070    }
6071}
6072
6073#[doc(hidden)]
6074impl<'de> serde::de::Deserialize<'de> for CreateFunctionRequest {
6075    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6076    where
6077        D: serde::Deserializer<'de>,
6078    {
6079        #[allow(non_camel_case_types)]
6080        #[doc(hidden)]
6081        #[derive(PartialEq, Eq, Hash)]
6082        enum __FieldTag {
6083            __parent,
6084            __function,
6085            __function_id,
6086            Unknown(std::string::String),
6087        }
6088        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6089            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6090            where
6091                D: serde::Deserializer<'de>,
6092            {
6093                struct Visitor;
6094                impl<'de> serde::de::Visitor<'de> for Visitor {
6095                    type Value = __FieldTag;
6096                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6097                        formatter.write_str("a field name for CreateFunctionRequest")
6098                    }
6099                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6100                    where
6101                        E: serde::de::Error,
6102                    {
6103                        use std::result::Result::Ok;
6104                        use std::string::ToString;
6105                        match value {
6106                            "parent" => Ok(__FieldTag::__parent),
6107                            "function" => Ok(__FieldTag::__function),
6108                            "functionId" => Ok(__FieldTag::__function_id),
6109                            "function_id" => Ok(__FieldTag::__function_id),
6110                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6111                        }
6112                    }
6113                }
6114                deserializer.deserialize_identifier(Visitor)
6115            }
6116        }
6117        struct Visitor;
6118        impl<'de> serde::de::Visitor<'de> for Visitor {
6119            type Value = CreateFunctionRequest;
6120            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6121                formatter.write_str("struct CreateFunctionRequest")
6122            }
6123            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6124            where
6125                A: serde::de::MapAccess<'de>,
6126            {
6127                #[allow(unused_imports)]
6128                use serde::de::Error;
6129                use std::option::Option::Some;
6130                let mut fields = std::collections::HashSet::new();
6131                let mut result = Self::Value::new();
6132                while let Some(tag) = map.next_key::<__FieldTag>()? {
6133                    #[allow(clippy::match_single_binding)]
6134                    match tag {
6135                        __FieldTag::__parent => {
6136                            if !fields.insert(__FieldTag::__parent) {
6137                                return std::result::Result::Err(A::Error::duplicate_field(
6138                                    "multiple values for parent",
6139                                ));
6140                            }
6141                            result.parent = map
6142                                .next_value::<std::option::Option<std::string::String>>()?
6143                                .unwrap_or_default();
6144                        }
6145                        __FieldTag::__function => {
6146                            if !fields.insert(__FieldTag::__function) {
6147                                return std::result::Result::Err(A::Error::duplicate_field(
6148                                    "multiple values for function",
6149                                ));
6150                            }
6151                            result.function =
6152                                map.next_value::<std::option::Option<crate::model::Function>>()?;
6153                        }
6154                        __FieldTag::__function_id => {
6155                            if !fields.insert(__FieldTag::__function_id) {
6156                                return std::result::Result::Err(A::Error::duplicate_field(
6157                                    "multiple values for function_id",
6158                                ));
6159                            }
6160                            result.function_id = map
6161                                .next_value::<std::option::Option<std::string::String>>()?
6162                                .unwrap_or_default();
6163                        }
6164                        __FieldTag::Unknown(key) => {
6165                            let value = map.next_value::<serde_json::Value>()?;
6166                            result._unknown_fields.insert(key, value);
6167                        }
6168                    }
6169                }
6170                std::result::Result::Ok(result)
6171            }
6172        }
6173        deserializer.deserialize_any(Visitor)
6174    }
6175}
6176
6177#[doc(hidden)]
6178impl serde::ser::Serialize for CreateFunctionRequest {
6179    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6180    where
6181        S: serde::ser::Serializer,
6182    {
6183        use serde::ser::SerializeMap;
6184        #[allow(unused_imports)]
6185        use std::option::Option::Some;
6186        let mut state = serializer.serialize_map(std::option::Option::None)?;
6187        if !self.parent.is_empty() {
6188            state.serialize_entry("parent", &self.parent)?;
6189        }
6190        if self.function.is_some() {
6191            state.serialize_entry("function", &self.function)?;
6192        }
6193        if !self.function_id.is_empty() {
6194            state.serialize_entry("functionId", &self.function_id)?;
6195        }
6196        if !self._unknown_fields.is_empty() {
6197            for (key, value) in self._unknown_fields.iter() {
6198                state.serialize_entry(key, &value)?;
6199            }
6200        }
6201        state.end()
6202    }
6203}
6204
6205/// Request for the `UpdateFunction` method.
6206#[derive(Clone, Debug, Default, PartialEq)]
6207#[non_exhaustive]
6208pub struct UpdateFunctionRequest {
6209    /// Required. New version of the function.
6210    pub function: std::option::Option<crate::model::Function>,
6211
6212    /// The list of fields to be updated.
6213    /// If no field mask is provided, all fields will be updated.
6214    pub update_mask: std::option::Option<wkt::FieldMask>,
6215
6216    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6217}
6218
6219impl UpdateFunctionRequest {
6220    pub fn new() -> Self {
6221        std::default::Default::default()
6222    }
6223
6224    /// Sets the value of [function][crate::model::UpdateFunctionRequest::function].
6225    pub fn set_function<T>(mut self, v: T) -> Self
6226    where
6227        T: std::convert::Into<crate::model::Function>,
6228    {
6229        self.function = std::option::Option::Some(v.into());
6230        self
6231    }
6232
6233    /// Sets or clears the value of [function][crate::model::UpdateFunctionRequest::function].
6234    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
6235    where
6236        T: std::convert::Into<crate::model::Function>,
6237    {
6238        self.function = v.map(|x| x.into());
6239        self
6240    }
6241
6242    /// Sets the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
6243    pub fn set_update_mask<T>(mut self, v: T) -> Self
6244    where
6245        T: std::convert::Into<wkt::FieldMask>,
6246    {
6247        self.update_mask = std::option::Option::Some(v.into());
6248        self
6249    }
6250
6251    /// Sets or clears the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
6252    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6253    where
6254        T: std::convert::Into<wkt::FieldMask>,
6255    {
6256        self.update_mask = v.map(|x| x.into());
6257        self
6258    }
6259}
6260
6261impl wkt::message::Message for UpdateFunctionRequest {
6262    fn typename() -> &'static str {
6263        "type.googleapis.com/google.cloud.functions.v2.UpdateFunctionRequest"
6264    }
6265}
6266
6267#[doc(hidden)]
6268impl<'de> serde::de::Deserialize<'de> for UpdateFunctionRequest {
6269    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6270    where
6271        D: serde::Deserializer<'de>,
6272    {
6273        #[allow(non_camel_case_types)]
6274        #[doc(hidden)]
6275        #[derive(PartialEq, Eq, Hash)]
6276        enum __FieldTag {
6277            __function,
6278            __update_mask,
6279            Unknown(std::string::String),
6280        }
6281        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6282            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6283            where
6284                D: serde::Deserializer<'de>,
6285            {
6286                struct Visitor;
6287                impl<'de> serde::de::Visitor<'de> for Visitor {
6288                    type Value = __FieldTag;
6289                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6290                        formatter.write_str("a field name for UpdateFunctionRequest")
6291                    }
6292                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6293                    where
6294                        E: serde::de::Error,
6295                    {
6296                        use std::result::Result::Ok;
6297                        use std::string::ToString;
6298                        match value {
6299                            "function" => Ok(__FieldTag::__function),
6300                            "updateMask" => Ok(__FieldTag::__update_mask),
6301                            "update_mask" => Ok(__FieldTag::__update_mask),
6302                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6303                        }
6304                    }
6305                }
6306                deserializer.deserialize_identifier(Visitor)
6307            }
6308        }
6309        struct Visitor;
6310        impl<'de> serde::de::Visitor<'de> for Visitor {
6311            type Value = UpdateFunctionRequest;
6312            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6313                formatter.write_str("struct UpdateFunctionRequest")
6314            }
6315            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6316            where
6317                A: serde::de::MapAccess<'de>,
6318            {
6319                #[allow(unused_imports)]
6320                use serde::de::Error;
6321                use std::option::Option::Some;
6322                let mut fields = std::collections::HashSet::new();
6323                let mut result = Self::Value::new();
6324                while let Some(tag) = map.next_key::<__FieldTag>()? {
6325                    #[allow(clippy::match_single_binding)]
6326                    match tag {
6327                        __FieldTag::__function => {
6328                            if !fields.insert(__FieldTag::__function) {
6329                                return std::result::Result::Err(A::Error::duplicate_field(
6330                                    "multiple values for function",
6331                                ));
6332                            }
6333                            result.function =
6334                                map.next_value::<std::option::Option<crate::model::Function>>()?;
6335                        }
6336                        __FieldTag::__update_mask => {
6337                            if !fields.insert(__FieldTag::__update_mask) {
6338                                return std::result::Result::Err(A::Error::duplicate_field(
6339                                    "multiple values for update_mask",
6340                                ));
6341                            }
6342                            result.update_mask =
6343                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6344                        }
6345                        __FieldTag::Unknown(key) => {
6346                            let value = map.next_value::<serde_json::Value>()?;
6347                            result._unknown_fields.insert(key, value);
6348                        }
6349                    }
6350                }
6351                std::result::Result::Ok(result)
6352            }
6353        }
6354        deserializer.deserialize_any(Visitor)
6355    }
6356}
6357
6358#[doc(hidden)]
6359impl serde::ser::Serialize for UpdateFunctionRequest {
6360    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6361    where
6362        S: serde::ser::Serializer,
6363    {
6364        use serde::ser::SerializeMap;
6365        #[allow(unused_imports)]
6366        use std::option::Option::Some;
6367        let mut state = serializer.serialize_map(std::option::Option::None)?;
6368        if self.function.is_some() {
6369            state.serialize_entry("function", &self.function)?;
6370        }
6371        if self.update_mask.is_some() {
6372            state.serialize_entry("updateMask", &self.update_mask)?;
6373        }
6374        if !self._unknown_fields.is_empty() {
6375            for (key, value) in self._unknown_fields.iter() {
6376                state.serialize_entry(key, &value)?;
6377            }
6378        }
6379        state.end()
6380    }
6381}
6382
6383/// Request for the `DeleteFunction` method.
6384#[derive(Clone, Debug, Default, PartialEq)]
6385#[non_exhaustive]
6386pub struct DeleteFunctionRequest {
6387    /// Required. The name of the function which should be deleted.
6388    pub name: std::string::String,
6389
6390    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6391}
6392
6393impl DeleteFunctionRequest {
6394    pub fn new() -> Self {
6395        std::default::Default::default()
6396    }
6397
6398    /// Sets the value of [name][crate::model::DeleteFunctionRequest::name].
6399    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6400        self.name = v.into();
6401        self
6402    }
6403}
6404
6405impl wkt::message::Message for DeleteFunctionRequest {
6406    fn typename() -> &'static str {
6407        "type.googleapis.com/google.cloud.functions.v2.DeleteFunctionRequest"
6408    }
6409}
6410
6411#[doc(hidden)]
6412impl<'de> serde::de::Deserialize<'de> for DeleteFunctionRequest {
6413    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6414    where
6415        D: serde::Deserializer<'de>,
6416    {
6417        #[allow(non_camel_case_types)]
6418        #[doc(hidden)]
6419        #[derive(PartialEq, Eq, Hash)]
6420        enum __FieldTag {
6421            __name,
6422            Unknown(std::string::String),
6423        }
6424        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6425            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6426            where
6427                D: serde::Deserializer<'de>,
6428            {
6429                struct Visitor;
6430                impl<'de> serde::de::Visitor<'de> for Visitor {
6431                    type Value = __FieldTag;
6432                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6433                        formatter.write_str("a field name for DeleteFunctionRequest")
6434                    }
6435                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6436                    where
6437                        E: serde::de::Error,
6438                    {
6439                        use std::result::Result::Ok;
6440                        use std::string::ToString;
6441                        match value {
6442                            "name" => Ok(__FieldTag::__name),
6443                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6444                        }
6445                    }
6446                }
6447                deserializer.deserialize_identifier(Visitor)
6448            }
6449        }
6450        struct Visitor;
6451        impl<'de> serde::de::Visitor<'de> for Visitor {
6452            type Value = DeleteFunctionRequest;
6453            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6454                formatter.write_str("struct DeleteFunctionRequest")
6455            }
6456            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6457            where
6458                A: serde::de::MapAccess<'de>,
6459            {
6460                #[allow(unused_imports)]
6461                use serde::de::Error;
6462                use std::option::Option::Some;
6463                let mut fields = std::collections::HashSet::new();
6464                let mut result = Self::Value::new();
6465                while let Some(tag) = map.next_key::<__FieldTag>()? {
6466                    #[allow(clippy::match_single_binding)]
6467                    match tag {
6468                        __FieldTag::__name => {
6469                            if !fields.insert(__FieldTag::__name) {
6470                                return std::result::Result::Err(A::Error::duplicate_field(
6471                                    "multiple values for name",
6472                                ));
6473                            }
6474                            result.name = map
6475                                .next_value::<std::option::Option<std::string::String>>()?
6476                                .unwrap_or_default();
6477                        }
6478                        __FieldTag::Unknown(key) => {
6479                            let value = map.next_value::<serde_json::Value>()?;
6480                            result._unknown_fields.insert(key, value);
6481                        }
6482                    }
6483                }
6484                std::result::Result::Ok(result)
6485            }
6486        }
6487        deserializer.deserialize_any(Visitor)
6488    }
6489}
6490
6491#[doc(hidden)]
6492impl serde::ser::Serialize for DeleteFunctionRequest {
6493    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6494    where
6495        S: serde::ser::Serializer,
6496    {
6497        use serde::ser::SerializeMap;
6498        #[allow(unused_imports)]
6499        use std::option::Option::Some;
6500        let mut state = serializer.serialize_map(std::option::Option::None)?;
6501        if !self.name.is_empty() {
6502            state.serialize_entry("name", &self.name)?;
6503        }
6504        if !self._unknown_fields.is_empty() {
6505            for (key, value) in self._unknown_fields.iter() {
6506                state.serialize_entry(key, &value)?;
6507            }
6508        }
6509        state.end()
6510    }
6511}
6512
6513/// Request of `GenerateSourceUploadUrl` method.
6514#[derive(Clone, Debug, Default, PartialEq)]
6515#[non_exhaustive]
6516pub struct GenerateUploadUrlRequest {
6517    /// Required. The project and location in which the Google Cloud Storage signed
6518    /// URL should be generated, specified in the format `projects/*/locations/*`.
6519    pub parent: std::string::String,
6520
6521    /// Resource name of a KMS crypto key (managed by the user) used to
6522    /// encrypt/decrypt function source code objects in intermediate Cloud Storage
6523    /// buckets. When you generate an upload url and upload your source code, it
6524    /// gets copied to an intermediate Cloud Storage bucket. The source code is
6525    /// then copied to a versioned directory in the sources bucket in the consumer
6526    /// project during the function deployment.
6527    ///
6528    /// It must match the pattern
6529    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
6530    ///
6531    /// The Google Cloud Functions service account
6532    /// (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
6533    /// granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
6534    /// (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
6535    /// Key/KeyRing/Project/Organization (least access preferred).
6536    pub kms_key_name: std::string::String,
6537
6538    /// The function environment the generated upload url will be used for.
6539    /// The upload url for 2nd Gen functions can also be used for 1st gen
6540    /// functions, but not vice versa. If not specified, 2nd generation-style
6541    /// upload URLs are generated.
6542    pub environment: crate::model::Environment,
6543
6544    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6545}
6546
6547impl GenerateUploadUrlRequest {
6548    pub fn new() -> Self {
6549        std::default::Default::default()
6550    }
6551
6552    /// Sets the value of [parent][crate::model::GenerateUploadUrlRequest::parent].
6553    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6554        self.parent = v.into();
6555        self
6556    }
6557
6558    /// Sets the value of [kms_key_name][crate::model::GenerateUploadUrlRequest::kms_key_name].
6559    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6560        self.kms_key_name = v.into();
6561        self
6562    }
6563
6564    /// Sets the value of [environment][crate::model::GenerateUploadUrlRequest::environment].
6565    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
6566        mut self,
6567        v: T,
6568    ) -> Self {
6569        self.environment = v.into();
6570        self
6571    }
6572}
6573
6574impl wkt::message::Message for GenerateUploadUrlRequest {
6575    fn typename() -> &'static str {
6576        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlRequest"
6577    }
6578}
6579
6580#[doc(hidden)]
6581impl<'de> serde::de::Deserialize<'de> for GenerateUploadUrlRequest {
6582    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6583    where
6584        D: serde::Deserializer<'de>,
6585    {
6586        #[allow(non_camel_case_types)]
6587        #[doc(hidden)]
6588        #[derive(PartialEq, Eq, Hash)]
6589        enum __FieldTag {
6590            __parent,
6591            __kms_key_name,
6592            __environment,
6593            Unknown(std::string::String),
6594        }
6595        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6596            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6597            where
6598                D: serde::Deserializer<'de>,
6599            {
6600                struct Visitor;
6601                impl<'de> serde::de::Visitor<'de> for Visitor {
6602                    type Value = __FieldTag;
6603                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6604                        formatter.write_str("a field name for GenerateUploadUrlRequest")
6605                    }
6606                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6607                    where
6608                        E: serde::de::Error,
6609                    {
6610                        use std::result::Result::Ok;
6611                        use std::string::ToString;
6612                        match value {
6613                            "parent" => Ok(__FieldTag::__parent),
6614                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
6615                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
6616                            "environment" => Ok(__FieldTag::__environment),
6617                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6618                        }
6619                    }
6620                }
6621                deserializer.deserialize_identifier(Visitor)
6622            }
6623        }
6624        struct Visitor;
6625        impl<'de> serde::de::Visitor<'de> for Visitor {
6626            type Value = GenerateUploadUrlRequest;
6627            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6628                formatter.write_str("struct GenerateUploadUrlRequest")
6629            }
6630            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6631            where
6632                A: serde::de::MapAccess<'de>,
6633            {
6634                #[allow(unused_imports)]
6635                use serde::de::Error;
6636                use std::option::Option::Some;
6637                let mut fields = std::collections::HashSet::new();
6638                let mut result = Self::Value::new();
6639                while let Some(tag) = map.next_key::<__FieldTag>()? {
6640                    #[allow(clippy::match_single_binding)]
6641                    match tag {
6642                        __FieldTag::__parent => {
6643                            if !fields.insert(__FieldTag::__parent) {
6644                                return std::result::Result::Err(A::Error::duplicate_field(
6645                                    "multiple values for parent",
6646                                ));
6647                            }
6648                            result.parent = map
6649                                .next_value::<std::option::Option<std::string::String>>()?
6650                                .unwrap_or_default();
6651                        }
6652                        __FieldTag::__kms_key_name => {
6653                            if !fields.insert(__FieldTag::__kms_key_name) {
6654                                return std::result::Result::Err(A::Error::duplicate_field(
6655                                    "multiple values for kms_key_name",
6656                                ));
6657                            }
6658                            result.kms_key_name = map
6659                                .next_value::<std::option::Option<std::string::String>>()?
6660                                .unwrap_or_default();
6661                        }
6662                        __FieldTag::__environment => {
6663                            if !fields.insert(__FieldTag::__environment) {
6664                                return std::result::Result::Err(A::Error::duplicate_field(
6665                                    "multiple values for environment",
6666                                ));
6667                            }
6668                            result.environment = map
6669                                .next_value::<std::option::Option<crate::model::Environment>>()?
6670                                .unwrap_or_default();
6671                        }
6672                        __FieldTag::Unknown(key) => {
6673                            let value = map.next_value::<serde_json::Value>()?;
6674                            result._unknown_fields.insert(key, value);
6675                        }
6676                    }
6677                }
6678                std::result::Result::Ok(result)
6679            }
6680        }
6681        deserializer.deserialize_any(Visitor)
6682    }
6683}
6684
6685#[doc(hidden)]
6686impl serde::ser::Serialize for GenerateUploadUrlRequest {
6687    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6688    where
6689        S: serde::ser::Serializer,
6690    {
6691        use serde::ser::SerializeMap;
6692        #[allow(unused_imports)]
6693        use std::option::Option::Some;
6694        let mut state = serializer.serialize_map(std::option::Option::None)?;
6695        if !self.parent.is_empty() {
6696            state.serialize_entry("parent", &self.parent)?;
6697        }
6698        if !self.kms_key_name.is_empty() {
6699            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
6700        }
6701        if !wkt::internal::is_default(&self.environment) {
6702            state.serialize_entry("environment", &self.environment)?;
6703        }
6704        if !self._unknown_fields.is_empty() {
6705            for (key, value) in self._unknown_fields.iter() {
6706                state.serialize_entry(key, &value)?;
6707            }
6708        }
6709        state.end()
6710    }
6711}
6712
6713/// Response of `GenerateSourceUploadUrl` method.
6714#[derive(Clone, Debug, Default, PartialEq)]
6715#[non_exhaustive]
6716pub struct GenerateUploadUrlResponse {
6717    /// The generated Google Cloud Storage signed URL that should be used for a
6718    /// function source code upload. The uploaded file should be a zip archive
6719    /// which contains a function.
6720    pub upload_url: std::string::String,
6721
6722    /// The location of the source code in the upload bucket.
6723    ///
6724    /// Once the archive is uploaded using the `upload_url` use this field to
6725    /// set the `function.build_config.source.storage_source`
6726    /// during CreateFunction and UpdateFunction.
6727    ///
6728    /// Generation defaults to 0, as Cloud Storage provides a new generation only
6729    /// upon uploading a new object or version of an object.
6730    pub storage_source: std::option::Option<crate::model::StorageSource>,
6731
6732    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6733}
6734
6735impl GenerateUploadUrlResponse {
6736    pub fn new() -> Self {
6737        std::default::Default::default()
6738    }
6739
6740    /// Sets the value of [upload_url][crate::model::GenerateUploadUrlResponse::upload_url].
6741    pub fn set_upload_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6742        self.upload_url = v.into();
6743        self
6744    }
6745
6746    /// Sets the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
6747    pub fn set_storage_source<T>(mut self, v: T) -> Self
6748    where
6749        T: std::convert::Into<crate::model::StorageSource>,
6750    {
6751        self.storage_source = std::option::Option::Some(v.into());
6752        self
6753    }
6754
6755    /// Sets or clears the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
6756    pub fn set_or_clear_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
6757    where
6758        T: std::convert::Into<crate::model::StorageSource>,
6759    {
6760        self.storage_source = v.map(|x| x.into());
6761        self
6762    }
6763}
6764
6765impl wkt::message::Message for GenerateUploadUrlResponse {
6766    fn typename() -> &'static str {
6767        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlResponse"
6768    }
6769}
6770
6771#[doc(hidden)]
6772impl<'de> serde::de::Deserialize<'de> for GenerateUploadUrlResponse {
6773    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6774    where
6775        D: serde::Deserializer<'de>,
6776    {
6777        #[allow(non_camel_case_types)]
6778        #[doc(hidden)]
6779        #[derive(PartialEq, Eq, Hash)]
6780        enum __FieldTag {
6781            __upload_url,
6782            __storage_source,
6783            Unknown(std::string::String),
6784        }
6785        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6786            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6787            where
6788                D: serde::Deserializer<'de>,
6789            {
6790                struct Visitor;
6791                impl<'de> serde::de::Visitor<'de> for Visitor {
6792                    type Value = __FieldTag;
6793                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6794                        formatter.write_str("a field name for GenerateUploadUrlResponse")
6795                    }
6796                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6797                    where
6798                        E: serde::de::Error,
6799                    {
6800                        use std::result::Result::Ok;
6801                        use std::string::ToString;
6802                        match value {
6803                            "uploadUrl" => Ok(__FieldTag::__upload_url),
6804                            "upload_url" => Ok(__FieldTag::__upload_url),
6805                            "storageSource" => Ok(__FieldTag::__storage_source),
6806                            "storage_source" => Ok(__FieldTag::__storage_source),
6807                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6808                        }
6809                    }
6810                }
6811                deserializer.deserialize_identifier(Visitor)
6812            }
6813        }
6814        struct Visitor;
6815        impl<'de> serde::de::Visitor<'de> for Visitor {
6816            type Value = GenerateUploadUrlResponse;
6817            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6818                formatter.write_str("struct GenerateUploadUrlResponse")
6819            }
6820            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6821            where
6822                A: serde::de::MapAccess<'de>,
6823            {
6824                #[allow(unused_imports)]
6825                use serde::de::Error;
6826                use std::option::Option::Some;
6827                let mut fields = std::collections::HashSet::new();
6828                let mut result = Self::Value::new();
6829                while let Some(tag) = map.next_key::<__FieldTag>()? {
6830                    #[allow(clippy::match_single_binding)]
6831                    match tag {
6832                        __FieldTag::__upload_url => {
6833                            if !fields.insert(__FieldTag::__upload_url) {
6834                                return std::result::Result::Err(A::Error::duplicate_field(
6835                                    "multiple values for upload_url",
6836                                ));
6837                            }
6838                            result.upload_url = map
6839                                .next_value::<std::option::Option<std::string::String>>()?
6840                                .unwrap_or_default();
6841                        }
6842                        __FieldTag::__storage_source => {
6843                            if !fields.insert(__FieldTag::__storage_source) {
6844                                return std::result::Result::Err(A::Error::duplicate_field(
6845                                    "multiple values for storage_source",
6846                                ));
6847                            }
6848                            result.storage_source = map
6849                                .next_value::<std::option::Option<crate::model::StorageSource>>()?;
6850                        }
6851                        __FieldTag::Unknown(key) => {
6852                            let value = map.next_value::<serde_json::Value>()?;
6853                            result._unknown_fields.insert(key, value);
6854                        }
6855                    }
6856                }
6857                std::result::Result::Ok(result)
6858            }
6859        }
6860        deserializer.deserialize_any(Visitor)
6861    }
6862}
6863
6864#[doc(hidden)]
6865impl serde::ser::Serialize for GenerateUploadUrlResponse {
6866    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6867    where
6868        S: serde::ser::Serializer,
6869    {
6870        use serde::ser::SerializeMap;
6871        #[allow(unused_imports)]
6872        use std::option::Option::Some;
6873        let mut state = serializer.serialize_map(std::option::Option::None)?;
6874        if !self.upload_url.is_empty() {
6875            state.serialize_entry("uploadUrl", &self.upload_url)?;
6876        }
6877        if self.storage_source.is_some() {
6878            state.serialize_entry("storageSource", &self.storage_source)?;
6879        }
6880        if !self._unknown_fields.is_empty() {
6881            for (key, value) in self._unknown_fields.iter() {
6882                state.serialize_entry(key, &value)?;
6883            }
6884        }
6885        state.end()
6886    }
6887}
6888
6889/// Request of `GenerateDownloadUrl` method.
6890#[derive(Clone, Debug, Default, PartialEq)]
6891#[non_exhaustive]
6892pub struct GenerateDownloadUrlRequest {
6893    /// Required. The name of function for which source code Google Cloud Storage
6894    /// signed URL should be generated.
6895    pub name: std::string::String,
6896
6897    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6898}
6899
6900impl GenerateDownloadUrlRequest {
6901    pub fn new() -> Self {
6902        std::default::Default::default()
6903    }
6904
6905    /// Sets the value of [name][crate::model::GenerateDownloadUrlRequest::name].
6906    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6907        self.name = v.into();
6908        self
6909    }
6910}
6911
6912impl wkt::message::Message for GenerateDownloadUrlRequest {
6913    fn typename() -> &'static str {
6914        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlRequest"
6915    }
6916}
6917
6918#[doc(hidden)]
6919impl<'de> serde::de::Deserialize<'de> for GenerateDownloadUrlRequest {
6920    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6921    where
6922        D: serde::Deserializer<'de>,
6923    {
6924        #[allow(non_camel_case_types)]
6925        #[doc(hidden)]
6926        #[derive(PartialEq, Eq, Hash)]
6927        enum __FieldTag {
6928            __name,
6929            Unknown(std::string::String),
6930        }
6931        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6932            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6933            where
6934                D: serde::Deserializer<'de>,
6935            {
6936                struct Visitor;
6937                impl<'de> serde::de::Visitor<'de> for Visitor {
6938                    type Value = __FieldTag;
6939                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6940                        formatter.write_str("a field name for GenerateDownloadUrlRequest")
6941                    }
6942                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6943                    where
6944                        E: serde::de::Error,
6945                    {
6946                        use std::result::Result::Ok;
6947                        use std::string::ToString;
6948                        match value {
6949                            "name" => Ok(__FieldTag::__name),
6950                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6951                        }
6952                    }
6953                }
6954                deserializer.deserialize_identifier(Visitor)
6955            }
6956        }
6957        struct Visitor;
6958        impl<'de> serde::de::Visitor<'de> for Visitor {
6959            type Value = GenerateDownloadUrlRequest;
6960            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6961                formatter.write_str("struct GenerateDownloadUrlRequest")
6962            }
6963            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6964            where
6965                A: serde::de::MapAccess<'de>,
6966            {
6967                #[allow(unused_imports)]
6968                use serde::de::Error;
6969                use std::option::Option::Some;
6970                let mut fields = std::collections::HashSet::new();
6971                let mut result = Self::Value::new();
6972                while let Some(tag) = map.next_key::<__FieldTag>()? {
6973                    #[allow(clippy::match_single_binding)]
6974                    match tag {
6975                        __FieldTag::__name => {
6976                            if !fields.insert(__FieldTag::__name) {
6977                                return std::result::Result::Err(A::Error::duplicate_field(
6978                                    "multiple values for name",
6979                                ));
6980                            }
6981                            result.name = map
6982                                .next_value::<std::option::Option<std::string::String>>()?
6983                                .unwrap_or_default();
6984                        }
6985                        __FieldTag::Unknown(key) => {
6986                            let value = map.next_value::<serde_json::Value>()?;
6987                            result._unknown_fields.insert(key, value);
6988                        }
6989                    }
6990                }
6991                std::result::Result::Ok(result)
6992            }
6993        }
6994        deserializer.deserialize_any(Visitor)
6995    }
6996}
6997
6998#[doc(hidden)]
6999impl serde::ser::Serialize for GenerateDownloadUrlRequest {
7000    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7001    where
7002        S: serde::ser::Serializer,
7003    {
7004        use serde::ser::SerializeMap;
7005        #[allow(unused_imports)]
7006        use std::option::Option::Some;
7007        let mut state = serializer.serialize_map(std::option::Option::None)?;
7008        if !self.name.is_empty() {
7009            state.serialize_entry("name", &self.name)?;
7010        }
7011        if !self._unknown_fields.is_empty() {
7012            for (key, value) in self._unknown_fields.iter() {
7013                state.serialize_entry(key, &value)?;
7014            }
7015        }
7016        state.end()
7017    }
7018}
7019
7020/// Response of `GenerateDownloadUrl` method.
7021#[derive(Clone, Debug, Default, PartialEq)]
7022#[non_exhaustive]
7023pub struct GenerateDownloadUrlResponse {
7024    /// The generated Google Cloud Storage signed URL that should be used for
7025    /// function source code download.
7026    pub download_url: std::string::String,
7027
7028    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7029}
7030
7031impl GenerateDownloadUrlResponse {
7032    pub fn new() -> Self {
7033        std::default::Default::default()
7034    }
7035
7036    /// Sets the value of [download_url][crate::model::GenerateDownloadUrlResponse::download_url].
7037    pub fn set_download_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7038        self.download_url = v.into();
7039        self
7040    }
7041}
7042
7043impl wkt::message::Message for GenerateDownloadUrlResponse {
7044    fn typename() -> &'static str {
7045        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlResponse"
7046    }
7047}
7048
7049#[doc(hidden)]
7050impl<'de> serde::de::Deserialize<'de> for GenerateDownloadUrlResponse {
7051    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7052    where
7053        D: serde::Deserializer<'de>,
7054    {
7055        #[allow(non_camel_case_types)]
7056        #[doc(hidden)]
7057        #[derive(PartialEq, Eq, Hash)]
7058        enum __FieldTag {
7059            __download_url,
7060            Unknown(std::string::String),
7061        }
7062        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7063            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7064            where
7065                D: serde::Deserializer<'de>,
7066            {
7067                struct Visitor;
7068                impl<'de> serde::de::Visitor<'de> for Visitor {
7069                    type Value = __FieldTag;
7070                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7071                        formatter.write_str("a field name for GenerateDownloadUrlResponse")
7072                    }
7073                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7074                    where
7075                        E: serde::de::Error,
7076                    {
7077                        use std::result::Result::Ok;
7078                        use std::string::ToString;
7079                        match value {
7080                            "downloadUrl" => Ok(__FieldTag::__download_url),
7081                            "download_url" => Ok(__FieldTag::__download_url),
7082                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7083                        }
7084                    }
7085                }
7086                deserializer.deserialize_identifier(Visitor)
7087            }
7088        }
7089        struct Visitor;
7090        impl<'de> serde::de::Visitor<'de> for Visitor {
7091            type Value = GenerateDownloadUrlResponse;
7092            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7093                formatter.write_str("struct GenerateDownloadUrlResponse")
7094            }
7095            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7096            where
7097                A: serde::de::MapAccess<'de>,
7098            {
7099                #[allow(unused_imports)]
7100                use serde::de::Error;
7101                use std::option::Option::Some;
7102                let mut fields = std::collections::HashSet::new();
7103                let mut result = Self::Value::new();
7104                while let Some(tag) = map.next_key::<__FieldTag>()? {
7105                    #[allow(clippy::match_single_binding)]
7106                    match tag {
7107                        __FieldTag::__download_url => {
7108                            if !fields.insert(__FieldTag::__download_url) {
7109                                return std::result::Result::Err(A::Error::duplicate_field(
7110                                    "multiple values for download_url",
7111                                ));
7112                            }
7113                            result.download_url = map
7114                                .next_value::<std::option::Option<std::string::String>>()?
7115                                .unwrap_or_default();
7116                        }
7117                        __FieldTag::Unknown(key) => {
7118                            let value = map.next_value::<serde_json::Value>()?;
7119                            result._unknown_fields.insert(key, value);
7120                        }
7121                    }
7122                }
7123                std::result::Result::Ok(result)
7124            }
7125        }
7126        deserializer.deserialize_any(Visitor)
7127    }
7128}
7129
7130#[doc(hidden)]
7131impl serde::ser::Serialize for GenerateDownloadUrlResponse {
7132    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7133    where
7134        S: serde::ser::Serializer,
7135    {
7136        use serde::ser::SerializeMap;
7137        #[allow(unused_imports)]
7138        use std::option::Option::Some;
7139        let mut state = serializer.serialize_map(std::option::Option::None)?;
7140        if !self.download_url.is_empty() {
7141            state.serialize_entry("downloadUrl", &self.download_url)?;
7142        }
7143        if !self._unknown_fields.is_empty() {
7144            for (key, value) in self._unknown_fields.iter() {
7145                state.serialize_entry(key, &value)?;
7146            }
7147        }
7148        state.end()
7149    }
7150}
7151
7152/// Request for the `ListRuntimes` method.
7153#[derive(Clone, Debug, Default, PartialEq)]
7154#[non_exhaustive]
7155pub struct ListRuntimesRequest {
7156    /// Required. The project and location from which the runtimes should be
7157    /// listed, specified in the format `projects/*/locations/*`
7158    pub parent: std::string::String,
7159
7160    /// The filter for Runtimes that match the filter expression,
7161    /// following the syntax outlined in <https://google.aip.dev/160>.
7162    pub filter: std::string::String,
7163
7164    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7165}
7166
7167impl ListRuntimesRequest {
7168    pub fn new() -> Self {
7169        std::default::Default::default()
7170    }
7171
7172    /// Sets the value of [parent][crate::model::ListRuntimesRequest::parent].
7173    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7174        self.parent = v.into();
7175        self
7176    }
7177
7178    /// Sets the value of [filter][crate::model::ListRuntimesRequest::filter].
7179    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7180        self.filter = v.into();
7181        self
7182    }
7183}
7184
7185impl wkt::message::Message for ListRuntimesRequest {
7186    fn typename() -> &'static str {
7187        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesRequest"
7188    }
7189}
7190
7191#[doc(hidden)]
7192impl<'de> serde::de::Deserialize<'de> for ListRuntimesRequest {
7193    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7194    where
7195        D: serde::Deserializer<'de>,
7196    {
7197        #[allow(non_camel_case_types)]
7198        #[doc(hidden)]
7199        #[derive(PartialEq, Eq, Hash)]
7200        enum __FieldTag {
7201            __parent,
7202            __filter,
7203            Unknown(std::string::String),
7204        }
7205        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7206            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7207            where
7208                D: serde::Deserializer<'de>,
7209            {
7210                struct Visitor;
7211                impl<'de> serde::de::Visitor<'de> for Visitor {
7212                    type Value = __FieldTag;
7213                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7214                        formatter.write_str("a field name for ListRuntimesRequest")
7215                    }
7216                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7217                    where
7218                        E: serde::de::Error,
7219                    {
7220                        use std::result::Result::Ok;
7221                        use std::string::ToString;
7222                        match value {
7223                            "parent" => Ok(__FieldTag::__parent),
7224                            "filter" => Ok(__FieldTag::__filter),
7225                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7226                        }
7227                    }
7228                }
7229                deserializer.deserialize_identifier(Visitor)
7230            }
7231        }
7232        struct Visitor;
7233        impl<'de> serde::de::Visitor<'de> for Visitor {
7234            type Value = ListRuntimesRequest;
7235            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7236                formatter.write_str("struct ListRuntimesRequest")
7237            }
7238            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7239            where
7240                A: serde::de::MapAccess<'de>,
7241            {
7242                #[allow(unused_imports)]
7243                use serde::de::Error;
7244                use std::option::Option::Some;
7245                let mut fields = std::collections::HashSet::new();
7246                let mut result = Self::Value::new();
7247                while let Some(tag) = map.next_key::<__FieldTag>()? {
7248                    #[allow(clippy::match_single_binding)]
7249                    match tag {
7250                        __FieldTag::__parent => {
7251                            if !fields.insert(__FieldTag::__parent) {
7252                                return std::result::Result::Err(A::Error::duplicate_field(
7253                                    "multiple values for parent",
7254                                ));
7255                            }
7256                            result.parent = map
7257                                .next_value::<std::option::Option<std::string::String>>()?
7258                                .unwrap_or_default();
7259                        }
7260                        __FieldTag::__filter => {
7261                            if !fields.insert(__FieldTag::__filter) {
7262                                return std::result::Result::Err(A::Error::duplicate_field(
7263                                    "multiple values for filter",
7264                                ));
7265                            }
7266                            result.filter = map
7267                                .next_value::<std::option::Option<std::string::String>>()?
7268                                .unwrap_or_default();
7269                        }
7270                        __FieldTag::Unknown(key) => {
7271                            let value = map.next_value::<serde_json::Value>()?;
7272                            result._unknown_fields.insert(key, value);
7273                        }
7274                    }
7275                }
7276                std::result::Result::Ok(result)
7277            }
7278        }
7279        deserializer.deserialize_any(Visitor)
7280    }
7281}
7282
7283#[doc(hidden)]
7284impl serde::ser::Serialize for ListRuntimesRequest {
7285    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7286    where
7287        S: serde::ser::Serializer,
7288    {
7289        use serde::ser::SerializeMap;
7290        #[allow(unused_imports)]
7291        use std::option::Option::Some;
7292        let mut state = serializer.serialize_map(std::option::Option::None)?;
7293        if !self.parent.is_empty() {
7294            state.serialize_entry("parent", &self.parent)?;
7295        }
7296        if !self.filter.is_empty() {
7297            state.serialize_entry("filter", &self.filter)?;
7298        }
7299        if !self._unknown_fields.is_empty() {
7300            for (key, value) in self._unknown_fields.iter() {
7301                state.serialize_entry(key, &value)?;
7302            }
7303        }
7304        state.end()
7305    }
7306}
7307
7308/// Response for the `ListRuntimes` method.
7309#[derive(Clone, Debug, Default, PartialEq)]
7310#[non_exhaustive]
7311pub struct ListRuntimesResponse {
7312    /// The runtimes that match the request.
7313    pub runtimes: std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
7314
7315    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7316}
7317
7318impl ListRuntimesResponse {
7319    pub fn new() -> Self {
7320        std::default::Default::default()
7321    }
7322
7323    /// Sets the value of [runtimes][crate::model::ListRuntimesResponse::runtimes].
7324    pub fn set_runtimes<T, V>(mut self, v: T) -> Self
7325    where
7326        T: std::iter::IntoIterator<Item = V>,
7327        V: std::convert::Into<crate::model::list_runtimes_response::Runtime>,
7328    {
7329        use std::iter::Iterator;
7330        self.runtimes = v.into_iter().map(|i| i.into()).collect();
7331        self
7332    }
7333}
7334
7335impl wkt::message::Message for ListRuntimesResponse {
7336    fn typename() -> &'static str {
7337        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse"
7338    }
7339}
7340
7341#[doc(hidden)]
7342impl<'de> serde::de::Deserialize<'de> for ListRuntimesResponse {
7343    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7344    where
7345        D: serde::Deserializer<'de>,
7346    {
7347        #[allow(non_camel_case_types)]
7348        #[doc(hidden)]
7349        #[derive(PartialEq, Eq, Hash)]
7350        enum __FieldTag {
7351            __runtimes,
7352            Unknown(std::string::String),
7353        }
7354        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7355            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7356            where
7357                D: serde::Deserializer<'de>,
7358            {
7359                struct Visitor;
7360                impl<'de> serde::de::Visitor<'de> for Visitor {
7361                    type Value = __FieldTag;
7362                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7363                        formatter.write_str("a field name for ListRuntimesResponse")
7364                    }
7365                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7366                    where
7367                        E: serde::de::Error,
7368                    {
7369                        use std::result::Result::Ok;
7370                        use std::string::ToString;
7371                        match value {
7372                            "runtimes" => Ok(__FieldTag::__runtimes),
7373                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7374                        }
7375                    }
7376                }
7377                deserializer.deserialize_identifier(Visitor)
7378            }
7379        }
7380        struct Visitor;
7381        impl<'de> serde::de::Visitor<'de> for Visitor {
7382            type Value = ListRuntimesResponse;
7383            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7384                formatter.write_str("struct ListRuntimesResponse")
7385            }
7386            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7387            where
7388                A: serde::de::MapAccess<'de>,
7389            {
7390                #[allow(unused_imports)]
7391                use serde::de::Error;
7392                use std::option::Option::Some;
7393                let mut fields = std::collections::HashSet::new();
7394                let mut result = Self::Value::new();
7395                while let Some(tag) = map.next_key::<__FieldTag>()? {
7396                    #[allow(clippy::match_single_binding)]
7397                    match tag {
7398                        __FieldTag::__runtimes => {
7399                            if !fields.insert(__FieldTag::__runtimes) {
7400                                return std::result::Result::Err(A::Error::duplicate_field(
7401                                    "multiple values for runtimes",
7402                                ));
7403                            }
7404                            result.runtimes = map
7405                                .next_value::<std::option::Option<
7406                                    std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
7407                                >>()?
7408                                .unwrap_or_default();
7409                        }
7410                        __FieldTag::Unknown(key) => {
7411                            let value = map.next_value::<serde_json::Value>()?;
7412                            result._unknown_fields.insert(key, value);
7413                        }
7414                    }
7415                }
7416                std::result::Result::Ok(result)
7417            }
7418        }
7419        deserializer.deserialize_any(Visitor)
7420    }
7421}
7422
7423#[doc(hidden)]
7424impl serde::ser::Serialize for ListRuntimesResponse {
7425    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7426    where
7427        S: serde::ser::Serializer,
7428    {
7429        use serde::ser::SerializeMap;
7430        #[allow(unused_imports)]
7431        use std::option::Option::Some;
7432        let mut state = serializer.serialize_map(std::option::Option::None)?;
7433        if !self.runtimes.is_empty() {
7434            state.serialize_entry("runtimes", &self.runtimes)?;
7435        }
7436        if !self._unknown_fields.is_empty() {
7437            for (key, value) in self._unknown_fields.iter() {
7438                state.serialize_entry(key, &value)?;
7439            }
7440        }
7441        state.end()
7442    }
7443}
7444
7445/// Defines additional types related to [ListRuntimesResponse].
7446pub mod list_runtimes_response {
7447    #[allow(unused_imports)]
7448    use super::*;
7449
7450    /// Describes a runtime and any special information (e.g., deprecation status)
7451    /// related to it.
7452    #[derive(Clone, Debug, Default, PartialEq)]
7453    #[non_exhaustive]
7454    pub struct Runtime {
7455        /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
7456        pub name: std::string::String,
7457
7458        /// The user facing name, eg 'Go 1.13', 'Node.js 12', etc.
7459        pub display_name: std::string::String,
7460
7461        /// The stage of life this runtime is in, e.g., BETA, GA, etc.
7462        pub stage: crate::model::list_runtimes_response::RuntimeStage,
7463
7464        /// Warning messages, e.g., a deprecation warning.
7465        pub warnings: std::vec::Vec<std::string::String>,
7466
7467        /// The environment for the runtime.
7468        pub environment: crate::model::Environment,
7469
7470        /// Deprecation date for the runtime.
7471        pub deprecation_date: std::option::Option<gtype::model::Date>,
7472
7473        /// Decommission date for the runtime.
7474        pub decommission_date: std::option::Option<gtype::model::Date>,
7475
7476        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7477    }
7478
7479    impl Runtime {
7480        pub fn new() -> Self {
7481            std::default::Default::default()
7482        }
7483
7484        /// Sets the value of [name][crate::model::list_runtimes_response::Runtime::name].
7485        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7486            self.name = v.into();
7487            self
7488        }
7489
7490        /// Sets the value of [display_name][crate::model::list_runtimes_response::Runtime::display_name].
7491        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
7492            mut self,
7493            v: T,
7494        ) -> Self {
7495            self.display_name = v.into();
7496            self
7497        }
7498
7499        /// Sets the value of [stage][crate::model::list_runtimes_response::Runtime::stage].
7500        pub fn set_stage<
7501            T: std::convert::Into<crate::model::list_runtimes_response::RuntimeStage>,
7502        >(
7503            mut self,
7504            v: T,
7505        ) -> Self {
7506            self.stage = v.into();
7507            self
7508        }
7509
7510        /// Sets the value of [warnings][crate::model::list_runtimes_response::Runtime::warnings].
7511        pub fn set_warnings<T, V>(mut self, v: T) -> Self
7512        where
7513            T: std::iter::IntoIterator<Item = V>,
7514            V: std::convert::Into<std::string::String>,
7515        {
7516            use std::iter::Iterator;
7517            self.warnings = v.into_iter().map(|i| i.into()).collect();
7518            self
7519        }
7520
7521        /// Sets the value of [environment][crate::model::list_runtimes_response::Runtime::environment].
7522        pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
7523            mut self,
7524            v: T,
7525        ) -> Self {
7526            self.environment = v.into();
7527            self
7528        }
7529
7530        /// Sets the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
7531        pub fn set_deprecation_date<T>(mut self, v: T) -> Self
7532        where
7533            T: std::convert::Into<gtype::model::Date>,
7534        {
7535            self.deprecation_date = std::option::Option::Some(v.into());
7536            self
7537        }
7538
7539        /// Sets or clears the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
7540        pub fn set_or_clear_deprecation_date<T>(mut self, v: std::option::Option<T>) -> Self
7541        where
7542            T: std::convert::Into<gtype::model::Date>,
7543        {
7544            self.deprecation_date = v.map(|x| x.into());
7545            self
7546        }
7547
7548        /// Sets the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
7549        pub fn set_decommission_date<T>(mut self, v: T) -> Self
7550        where
7551            T: std::convert::Into<gtype::model::Date>,
7552        {
7553            self.decommission_date = std::option::Option::Some(v.into());
7554            self
7555        }
7556
7557        /// Sets or clears the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
7558        pub fn set_or_clear_decommission_date<T>(mut self, v: std::option::Option<T>) -> Self
7559        where
7560            T: std::convert::Into<gtype::model::Date>,
7561        {
7562            self.decommission_date = v.map(|x| x.into());
7563            self
7564        }
7565    }
7566
7567    impl wkt::message::Message for Runtime {
7568        fn typename() -> &'static str {
7569            "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse.Runtime"
7570        }
7571    }
7572
7573    #[doc(hidden)]
7574    impl<'de> serde::de::Deserialize<'de> for Runtime {
7575        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7576        where
7577            D: serde::Deserializer<'de>,
7578        {
7579            #[allow(non_camel_case_types)]
7580            #[doc(hidden)]
7581            #[derive(PartialEq, Eq, Hash)]
7582            enum __FieldTag {
7583                __name,
7584                __display_name,
7585                __stage,
7586                __warnings,
7587                __environment,
7588                __deprecation_date,
7589                __decommission_date,
7590                Unknown(std::string::String),
7591            }
7592            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7593                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7594                where
7595                    D: serde::Deserializer<'de>,
7596                {
7597                    struct Visitor;
7598                    impl<'de> serde::de::Visitor<'de> for Visitor {
7599                        type Value = __FieldTag;
7600                        fn expecting(
7601                            &self,
7602                            formatter: &mut std::fmt::Formatter,
7603                        ) -> std::fmt::Result {
7604                            formatter.write_str("a field name for Runtime")
7605                        }
7606                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7607                        where
7608                            E: serde::de::Error,
7609                        {
7610                            use std::result::Result::Ok;
7611                            use std::string::ToString;
7612                            match value {
7613                                "name" => Ok(__FieldTag::__name),
7614                                "displayName" => Ok(__FieldTag::__display_name),
7615                                "display_name" => Ok(__FieldTag::__display_name),
7616                                "stage" => Ok(__FieldTag::__stage),
7617                                "warnings" => Ok(__FieldTag::__warnings),
7618                                "environment" => Ok(__FieldTag::__environment),
7619                                "deprecationDate" => Ok(__FieldTag::__deprecation_date),
7620                                "deprecation_date" => Ok(__FieldTag::__deprecation_date),
7621                                "decommissionDate" => Ok(__FieldTag::__decommission_date),
7622                                "decommission_date" => Ok(__FieldTag::__decommission_date),
7623                                _ => Ok(__FieldTag::Unknown(value.to_string())),
7624                            }
7625                        }
7626                    }
7627                    deserializer.deserialize_identifier(Visitor)
7628                }
7629            }
7630            struct Visitor;
7631            impl<'de> serde::de::Visitor<'de> for Visitor {
7632                type Value = Runtime;
7633                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7634                    formatter.write_str("struct Runtime")
7635                }
7636                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7637                where
7638                    A: serde::de::MapAccess<'de>,
7639                {
7640                    #[allow(unused_imports)]
7641                    use serde::de::Error;
7642                    use std::option::Option::Some;
7643                    let mut fields = std::collections::HashSet::new();
7644                    let mut result = Self::Value::new();
7645                    while let Some(tag) = map.next_key::<__FieldTag>()? {
7646                        #[allow(clippy::match_single_binding)]
7647                        match tag {
7648                            __FieldTag::__name => {
7649                                if !fields.insert(__FieldTag::__name) {
7650                                    return std::result::Result::Err(A::Error::duplicate_field(
7651                                        "multiple values for name",
7652                                    ));
7653                                }
7654                                result.name = map
7655                                    .next_value::<std::option::Option<std::string::String>>()?
7656                                    .unwrap_or_default();
7657                            }
7658                            __FieldTag::__display_name => {
7659                                if !fields.insert(__FieldTag::__display_name) {
7660                                    return std::result::Result::Err(A::Error::duplicate_field(
7661                                        "multiple values for display_name",
7662                                    ));
7663                                }
7664                                result.display_name = map
7665                                    .next_value::<std::option::Option<std::string::String>>()?
7666                                    .unwrap_or_default();
7667                            }
7668                            __FieldTag::__stage => {
7669                                if !fields.insert(__FieldTag::__stage) {
7670                                    return std::result::Result::Err(A::Error::duplicate_field(
7671                                        "multiple values for stage",
7672                                    ));
7673                                }
7674                                result.stage = map
7675                                    .next_value::<std::option::Option<
7676                                        crate::model::list_runtimes_response::RuntimeStage,
7677                                    >>()?
7678                                    .unwrap_or_default();
7679                            }
7680                            __FieldTag::__warnings => {
7681                                if !fields.insert(__FieldTag::__warnings) {
7682                                    return std::result::Result::Err(A::Error::duplicate_field(
7683                                        "multiple values for warnings",
7684                                    ));
7685                                }
7686                                result.warnings = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
7687                            }
7688                            __FieldTag::__environment => {
7689                                if !fields.insert(__FieldTag::__environment) {
7690                                    return std::result::Result::Err(A::Error::duplicate_field(
7691                                        "multiple values for environment",
7692                                    ));
7693                                }
7694                                result.environment = map
7695                                    .next_value::<std::option::Option<crate::model::Environment>>()?
7696                                    .unwrap_or_default();
7697                            }
7698                            __FieldTag::__deprecation_date => {
7699                                if !fields.insert(__FieldTag::__deprecation_date) {
7700                                    return std::result::Result::Err(A::Error::duplicate_field(
7701                                        "multiple values for deprecation_date",
7702                                    ));
7703                                }
7704                                result.deprecation_date =
7705                                    map.next_value::<std::option::Option<gtype::model::Date>>()?;
7706                            }
7707                            __FieldTag::__decommission_date => {
7708                                if !fields.insert(__FieldTag::__decommission_date) {
7709                                    return std::result::Result::Err(A::Error::duplicate_field(
7710                                        "multiple values for decommission_date",
7711                                    ));
7712                                }
7713                                result.decommission_date =
7714                                    map.next_value::<std::option::Option<gtype::model::Date>>()?;
7715                            }
7716                            __FieldTag::Unknown(key) => {
7717                                let value = map.next_value::<serde_json::Value>()?;
7718                                result._unknown_fields.insert(key, value);
7719                            }
7720                        }
7721                    }
7722                    std::result::Result::Ok(result)
7723                }
7724            }
7725            deserializer.deserialize_any(Visitor)
7726        }
7727    }
7728
7729    #[doc(hidden)]
7730    impl serde::ser::Serialize for Runtime {
7731        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7732        where
7733            S: serde::ser::Serializer,
7734        {
7735            use serde::ser::SerializeMap;
7736            #[allow(unused_imports)]
7737            use std::option::Option::Some;
7738            let mut state = serializer.serialize_map(std::option::Option::None)?;
7739            if !self.name.is_empty() {
7740                state.serialize_entry("name", &self.name)?;
7741            }
7742            if !self.display_name.is_empty() {
7743                state.serialize_entry("displayName", &self.display_name)?;
7744            }
7745            if !wkt::internal::is_default(&self.stage) {
7746                state.serialize_entry("stage", &self.stage)?;
7747            }
7748            if !self.warnings.is_empty() {
7749                state.serialize_entry("warnings", &self.warnings)?;
7750            }
7751            if !wkt::internal::is_default(&self.environment) {
7752                state.serialize_entry("environment", &self.environment)?;
7753            }
7754            if self.deprecation_date.is_some() {
7755                state.serialize_entry("deprecationDate", &self.deprecation_date)?;
7756            }
7757            if self.decommission_date.is_some() {
7758                state.serialize_entry("decommissionDate", &self.decommission_date)?;
7759            }
7760            if !self._unknown_fields.is_empty() {
7761                for (key, value) in self._unknown_fields.iter() {
7762                    state.serialize_entry(key, &value)?;
7763                }
7764            }
7765            state.end()
7766        }
7767    }
7768
7769    /// The various stages that a runtime can be in.
7770    ///
7771    /// # Working with unknown values
7772    ///
7773    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7774    /// additional enum variants at any time. Adding new variants is not considered
7775    /// a breaking change. Applications should write their code in anticipation of:
7776    ///
7777    /// - New values appearing in future releases of the client library, **and**
7778    /// - New values received dynamically, without application changes.
7779    ///
7780    /// Please consult the [Working with enums] section in the user guide for some
7781    /// guidelines.
7782    ///
7783    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7784    #[derive(Clone, Debug, PartialEq)]
7785    #[non_exhaustive]
7786    pub enum RuntimeStage {
7787        /// Not specified.
7788        Unspecified,
7789        /// The runtime is in development.
7790        Development,
7791        /// The runtime is in the Alpha stage.
7792        Alpha,
7793        /// The runtime is in the Beta stage.
7794        Beta,
7795        /// The runtime is generally available.
7796        Ga,
7797        /// The runtime is deprecated.
7798        Deprecated,
7799        /// The runtime is no longer supported.
7800        Decommissioned,
7801        /// If set, the enum was initialized with an unknown value.
7802        ///
7803        /// Applications can examine the value using [RuntimeStage::value] or
7804        /// [RuntimeStage::name].
7805        UnknownValue(runtime_stage::UnknownValue),
7806    }
7807
7808    #[doc(hidden)]
7809    pub mod runtime_stage {
7810        #[allow(unused_imports)]
7811        use super::*;
7812        #[derive(Clone, Debug, PartialEq)]
7813        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7814    }
7815
7816    impl RuntimeStage {
7817        /// Gets the enum value.
7818        ///
7819        /// Returns `None` if the enum contains an unknown value deserialized from
7820        /// the string representation of enums.
7821        pub fn value(&self) -> std::option::Option<i32> {
7822            match self {
7823                Self::Unspecified => std::option::Option::Some(0),
7824                Self::Development => std::option::Option::Some(1),
7825                Self::Alpha => std::option::Option::Some(2),
7826                Self::Beta => std::option::Option::Some(3),
7827                Self::Ga => std::option::Option::Some(4),
7828                Self::Deprecated => std::option::Option::Some(5),
7829                Self::Decommissioned => std::option::Option::Some(6),
7830                Self::UnknownValue(u) => u.0.value(),
7831            }
7832        }
7833
7834        /// Gets the enum value as a string.
7835        ///
7836        /// Returns `None` if the enum contains an unknown value deserialized from
7837        /// the integer representation of enums.
7838        pub fn name(&self) -> std::option::Option<&str> {
7839            match self {
7840                Self::Unspecified => std::option::Option::Some("RUNTIME_STAGE_UNSPECIFIED"),
7841                Self::Development => std::option::Option::Some("DEVELOPMENT"),
7842                Self::Alpha => std::option::Option::Some("ALPHA"),
7843                Self::Beta => std::option::Option::Some("BETA"),
7844                Self::Ga => std::option::Option::Some("GA"),
7845                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
7846                Self::Decommissioned => std::option::Option::Some("DECOMMISSIONED"),
7847                Self::UnknownValue(u) => u.0.name(),
7848            }
7849        }
7850    }
7851
7852    impl std::default::Default for RuntimeStage {
7853        fn default() -> Self {
7854            use std::convert::From;
7855            Self::from(0)
7856        }
7857    }
7858
7859    impl std::fmt::Display for RuntimeStage {
7860        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7861            wkt::internal::display_enum(f, self.name(), self.value())
7862        }
7863    }
7864
7865    impl std::convert::From<i32> for RuntimeStage {
7866        fn from(value: i32) -> Self {
7867            match value {
7868                0 => Self::Unspecified,
7869                1 => Self::Development,
7870                2 => Self::Alpha,
7871                3 => Self::Beta,
7872                4 => Self::Ga,
7873                5 => Self::Deprecated,
7874                6 => Self::Decommissioned,
7875                _ => Self::UnknownValue(runtime_stage::UnknownValue(
7876                    wkt::internal::UnknownEnumValue::Integer(value),
7877                )),
7878            }
7879        }
7880    }
7881
7882    impl std::convert::From<&str> for RuntimeStage {
7883        fn from(value: &str) -> Self {
7884            use std::string::ToString;
7885            match value {
7886                "RUNTIME_STAGE_UNSPECIFIED" => Self::Unspecified,
7887                "DEVELOPMENT" => Self::Development,
7888                "ALPHA" => Self::Alpha,
7889                "BETA" => Self::Beta,
7890                "GA" => Self::Ga,
7891                "DEPRECATED" => Self::Deprecated,
7892                "DECOMMISSIONED" => Self::Decommissioned,
7893                _ => Self::UnknownValue(runtime_stage::UnknownValue(
7894                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7895                )),
7896            }
7897        }
7898    }
7899
7900    impl serde::ser::Serialize for RuntimeStage {
7901        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7902        where
7903            S: serde::Serializer,
7904        {
7905            match self {
7906                Self::Unspecified => serializer.serialize_i32(0),
7907                Self::Development => serializer.serialize_i32(1),
7908                Self::Alpha => serializer.serialize_i32(2),
7909                Self::Beta => serializer.serialize_i32(3),
7910                Self::Ga => serializer.serialize_i32(4),
7911                Self::Deprecated => serializer.serialize_i32(5),
7912                Self::Decommissioned => serializer.serialize_i32(6),
7913                Self::UnknownValue(u) => u.0.serialize(serializer),
7914            }
7915        }
7916    }
7917
7918    impl<'de> serde::de::Deserialize<'de> for RuntimeStage {
7919        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7920        where
7921            D: serde::Deserializer<'de>,
7922        {
7923            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuntimeStage>::new(
7924                ".google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage",
7925            ))
7926        }
7927    }
7928}
7929
7930/// Security patches are applied automatically to the runtime without requiring
7931/// the function to be redeployed.
7932#[derive(Clone, Debug, Default, PartialEq)]
7933#[non_exhaustive]
7934pub struct AutomaticUpdatePolicy {
7935    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7936}
7937
7938impl AutomaticUpdatePolicy {
7939    pub fn new() -> Self {
7940        std::default::Default::default()
7941    }
7942}
7943
7944impl wkt::message::Message for AutomaticUpdatePolicy {
7945    fn typename() -> &'static str {
7946        "type.googleapis.com/google.cloud.functions.v2.AutomaticUpdatePolicy"
7947    }
7948}
7949
7950#[doc(hidden)]
7951impl<'de> serde::de::Deserialize<'de> for AutomaticUpdatePolicy {
7952    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7953    where
7954        D: serde::Deserializer<'de>,
7955    {
7956        #[allow(non_camel_case_types)]
7957        #[doc(hidden)]
7958        #[derive(PartialEq, Eq, Hash)]
7959        enum __FieldTag {
7960            Unknown(std::string::String),
7961        }
7962        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7963            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7964            where
7965                D: serde::Deserializer<'de>,
7966            {
7967                struct Visitor;
7968                impl<'de> serde::de::Visitor<'de> for Visitor {
7969                    type Value = __FieldTag;
7970                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7971                        formatter.write_str("a field name for AutomaticUpdatePolicy")
7972                    }
7973                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7974                    where
7975                        E: serde::de::Error,
7976                    {
7977                        use std::result::Result::Ok;
7978                        use std::string::ToString;
7979                        Ok(__FieldTag::Unknown(value.to_string()))
7980                    }
7981                }
7982                deserializer.deserialize_identifier(Visitor)
7983            }
7984        }
7985        struct Visitor;
7986        impl<'de> serde::de::Visitor<'de> for Visitor {
7987            type Value = AutomaticUpdatePolicy;
7988            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7989                formatter.write_str("struct AutomaticUpdatePolicy")
7990            }
7991            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7992            where
7993                A: serde::de::MapAccess<'de>,
7994            {
7995                #[allow(unused_imports)]
7996                use serde::de::Error;
7997                use std::option::Option::Some;
7998                let mut result = Self::Value::new();
7999                while let Some(tag) = map.next_key::<__FieldTag>()? {
8000                    #[allow(clippy::match_single_binding)]
8001                    match tag {
8002                        __FieldTag::Unknown(key) => {
8003                            let value = map.next_value::<serde_json::Value>()?;
8004                            result._unknown_fields.insert(key, value);
8005                        }
8006                    }
8007                }
8008                std::result::Result::Ok(result)
8009            }
8010        }
8011        deserializer.deserialize_any(Visitor)
8012    }
8013}
8014
8015#[doc(hidden)]
8016impl serde::ser::Serialize for AutomaticUpdatePolicy {
8017    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8018    where
8019        S: serde::ser::Serializer,
8020    {
8021        use serde::ser::SerializeMap;
8022        #[allow(unused_imports)]
8023        use std::option::Option::Some;
8024        let mut state = serializer.serialize_map(std::option::Option::None)?;
8025        if !self._unknown_fields.is_empty() {
8026            for (key, value) in self._unknown_fields.iter() {
8027                state.serialize_entry(key, &value)?;
8028            }
8029        }
8030        state.end()
8031    }
8032}
8033
8034/// Security patches are only applied when a function is redeployed.
8035#[derive(Clone, Debug, Default, PartialEq)]
8036#[non_exhaustive]
8037pub struct OnDeployUpdatePolicy {
8038    /// Output only. contains the runtime version which was used during latest
8039    /// function deployment.
8040    pub runtime_version: std::string::String,
8041
8042    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8043}
8044
8045impl OnDeployUpdatePolicy {
8046    pub fn new() -> Self {
8047        std::default::Default::default()
8048    }
8049
8050    /// Sets the value of [runtime_version][crate::model::OnDeployUpdatePolicy::runtime_version].
8051    pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8052        self.runtime_version = v.into();
8053        self
8054    }
8055}
8056
8057impl wkt::message::Message for OnDeployUpdatePolicy {
8058    fn typename() -> &'static str {
8059        "type.googleapis.com/google.cloud.functions.v2.OnDeployUpdatePolicy"
8060    }
8061}
8062
8063#[doc(hidden)]
8064impl<'de> serde::de::Deserialize<'de> for OnDeployUpdatePolicy {
8065    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8066    where
8067        D: serde::Deserializer<'de>,
8068    {
8069        #[allow(non_camel_case_types)]
8070        #[doc(hidden)]
8071        #[derive(PartialEq, Eq, Hash)]
8072        enum __FieldTag {
8073            __runtime_version,
8074            Unknown(std::string::String),
8075        }
8076        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8077            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8078            where
8079                D: serde::Deserializer<'de>,
8080            {
8081                struct Visitor;
8082                impl<'de> serde::de::Visitor<'de> for Visitor {
8083                    type Value = __FieldTag;
8084                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8085                        formatter.write_str("a field name for OnDeployUpdatePolicy")
8086                    }
8087                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8088                    where
8089                        E: serde::de::Error,
8090                    {
8091                        use std::result::Result::Ok;
8092                        use std::string::ToString;
8093                        match value {
8094                            "runtimeVersion" => Ok(__FieldTag::__runtime_version),
8095                            "runtime_version" => Ok(__FieldTag::__runtime_version),
8096                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8097                        }
8098                    }
8099                }
8100                deserializer.deserialize_identifier(Visitor)
8101            }
8102        }
8103        struct Visitor;
8104        impl<'de> serde::de::Visitor<'de> for Visitor {
8105            type Value = OnDeployUpdatePolicy;
8106            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8107                formatter.write_str("struct OnDeployUpdatePolicy")
8108            }
8109            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8110            where
8111                A: serde::de::MapAccess<'de>,
8112            {
8113                #[allow(unused_imports)]
8114                use serde::de::Error;
8115                use std::option::Option::Some;
8116                let mut fields = std::collections::HashSet::new();
8117                let mut result = Self::Value::new();
8118                while let Some(tag) = map.next_key::<__FieldTag>()? {
8119                    #[allow(clippy::match_single_binding)]
8120                    match tag {
8121                        __FieldTag::__runtime_version => {
8122                            if !fields.insert(__FieldTag::__runtime_version) {
8123                                return std::result::Result::Err(A::Error::duplicate_field(
8124                                    "multiple values for runtime_version",
8125                                ));
8126                            }
8127                            result.runtime_version = map
8128                                .next_value::<std::option::Option<std::string::String>>()?
8129                                .unwrap_or_default();
8130                        }
8131                        __FieldTag::Unknown(key) => {
8132                            let value = map.next_value::<serde_json::Value>()?;
8133                            result._unknown_fields.insert(key, value);
8134                        }
8135                    }
8136                }
8137                std::result::Result::Ok(result)
8138            }
8139        }
8140        deserializer.deserialize_any(Visitor)
8141    }
8142}
8143
8144#[doc(hidden)]
8145impl serde::ser::Serialize for OnDeployUpdatePolicy {
8146    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8147    where
8148        S: serde::ser::Serializer,
8149    {
8150        use serde::ser::SerializeMap;
8151        #[allow(unused_imports)]
8152        use std::option::Option::Some;
8153        let mut state = serializer.serialize_map(std::option::Option::None)?;
8154        if !self.runtime_version.is_empty() {
8155            state.serialize_entry("runtimeVersion", &self.runtime_version)?;
8156        }
8157        if !self._unknown_fields.is_empty() {
8158            for (key, value) in self._unknown_fields.iter() {
8159                state.serialize_entry(key, &value)?;
8160            }
8161        }
8162        state.end()
8163    }
8164}
8165
8166/// Represents the metadata of the long-running operation.
8167#[derive(Clone, Debug, Default, PartialEq)]
8168#[non_exhaustive]
8169pub struct OperationMetadata {
8170    /// The time the operation was created.
8171    pub create_time: std::option::Option<wkt::Timestamp>,
8172
8173    /// The time the operation finished running.
8174    pub end_time: std::option::Option<wkt::Timestamp>,
8175
8176    /// Server-defined resource path for the target of the operation.
8177    pub target: std::string::String,
8178
8179    /// Name of the verb executed by the operation.
8180    pub verb: std::string::String,
8181
8182    /// Human-readable status of the operation, if any.
8183    pub status_detail: std::string::String,
8184
8185    /// Identifies whether the user has requested cancellation
8186    /// of the operation. Operations that have successfully been cancelled
8187    /// have
8188    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
8189    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
8190    /// corresponding to `Code.CANCELLED`.
8191    ///
8192    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
8193    /// [google.rpc.Status.code]: rpc::model::Status::code
8194    pub cancel_requested: bool,
8195
8196    /// API version used to start the operation.
8197    pub api_version: std::string::String,
8198
8199    /// The original request that started the operation.
8200    pub request_resource: std::option::Option<wkt::Any>,
8201
8202    /// Mechanism for reporting in-progress stages
8203    pub stages: std::vec::Vec<crate::model::Stage>,
8204
8205    /// An identifier for Firebase function sources. Disclaimer: This field is only
8206    /// supported for Firebase function deployments.
8207    pub source_token: std::string::String,
8208
8209    /// The build name of the function for create and update operations.
8210    pub build_name: std::string::String,
8211
8212    /// The operation type.
8213    pub operation_type: crate::model::OperationType,
8214
8215    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8216}
8217
8218impl OperationMetadata {
8219    pub fn new() -> Self {
8220        std::default::Default::default()
8221    }
8222
8223    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
8224    pub fn set_create_time<T>(mut self, v: T) -> Self
8225    where
8226        T: std::convert::Into<wkt::Timestamp>,
8227    {
8228        self.create_time = std::option::Option::Some(v.into());
8229        self
8230    }
8231
8232    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
8233    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8234    where
8235        T: std::convert::Into<wkt::Timestamp>,
8236    {
8237        self.create_time = v.map(|x| x.into());
8238        self
8239    }
8240
8241    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
8242    pub fn set_end_time<T>(mut self, v: T) -> Self
8243    where
8244        T: std::convert::Into<wkt::Timestamp>,
8245    {
8246        self.end_time = std::option::Option::Some(v.into());
8247        self
8248    }
8249
8250    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
8251    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8252    where
8253        T: std::convert::Into<wkt::Timestamp>,
8254    {
8255        self.end_time = v.map(|x| x.into());
8256        self
8257    }
8258
8259    /// Sets the value of [target][crate::model::OperationMetadata::target].
8260    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8261        self.target = v.into();
8262        self
8263    }
8264
8265    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
8266    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8267        self.verb = v.into();
8268        self
8269    }
8270
8271    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
8272    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8273        self.status_detail = v.into();
8274        self
8275    }
8276
8277    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
8278    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8279        self.cancel_requested = v.into();
8280        self
8281    }
8282
8283    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
8284    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8285        self.api_version = v.into();
8286        self
8287    }
8288
8289    /// Sets the value of [request_resource][crate::model::OperationMetadata::request_resource].
8290    pub fn set_request_resource<T>(mut self, v: T) -> Self
8291    where
8292        T: std::convert::Into<wkt::Any>,
8293    {
8294        self.request_resource = std::option::Option::Some(v.into());
8295        self
8296    }
8297
8298    /// Sets or clears the value of [request_resource][crate::model::OperationMetadata::request_resource].
8299    pub fn set_or_clear_request_resource<T>(mut self, v: std::option::Option<T>) -> Self
8300    where
8301        T: std::convert::Into<wkt::Any>,
8302    {
8303        self.request_resource = v.map(|x| x.into());
8304        self
8305    }
8306
8307    /// Sets the value of [stages][crate::model::OperationMetadata::stages].
8308    pub fn set_stages<T, V>(mut self, v: T) -> Self
8309    where
8310        T: std::iter::IntoIterator<Item = V>,
8311        V: std::convert::Into<crate::model::Stage>,
8312    {
8313        use std::iter::Iterator;
8314        self.stages = v.into_iter().map(|i| i.into()).collect();
8315        self
8316    }
8317
8318    /// Sets the value of [source_token][crate::model::OperationMetadata::source_token].
8319    pub fn set_source_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8320        self.source_token = v.into();
8321        self
8322    }
8323
8324    /// Sets the value of [build_name][crate::model::OperationMetadata::build_name].
8325    pub fn set_build_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8326        self.build_name = v.into();
8327        self
8328    }
8329
8330    /// Sets the value of [operation_type][crate::model::OperationMetadata::operation_type].
8331    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
8332        mut self,
8333        v: T,
8334    ) -> Self {
8335        self.operation_type = v.into();
8336        self
8337    }
8338}
8339
8340impl wkt::message::Message for OperationMetadata {
8341    fn typename() -> &'static str {
8342        "type.googleapis.com/google.cloud.functions.v2.OperationMetadata"
8343    }
8344}
8345
8346#[doc(hidden)]
8347impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
8348    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8349    where
8350        D: serde::Deserializer<'de>,
8351    {
8352        #[allow(non_camel_case_types)]
8353        #[doc(hidden)]
8354        #[derive(PartialEq, Eq, Hash)]
8355        enum __FieldTag {
8356            __create_time,
8357            __end_time,
8358            __target,
8359            __verb,
8360            __status_detail,
8361            __cancel_requested,
8362            __api_version,
8363            __request_resource,
8364            __stages,
8365            __source_token,
8366            __build_name,
8367            __operation_type,
8368            Unknown(std::string::String),
8369        }
8370        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8371            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8372            where
8373                D: serde::Deserializer<'de>,
8374            {
8375                struct Visitor;
8376                impl<'de> serde::de::Visitor<'de> for Visitor {
8377                    type Value = __FieldTag;
8378                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8379                        formatter.write_str("a field name for OperationMetadata")
8380                    }
8381                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8382                    where
8383                        E: serde::de::Error,
8384                    {
8385                        use std::result::Result::Ok;
8386                        use std::string::ToString;
8387                        match value {
8388                            "createTime" => Ok(__FieldTag::__create_time),
8389                            "create_time" => Ok(__FieldTag::__create_time),
8390                            "endTime" => Ok(__FieldTag::__end_time),
8391                            "end_time" => Ok(__FieldTag::__end_time),
8392                            "target" => Ok(__FieldTag::__target),
8393                            "verb" => Ok(__FieldTag::__verb),
8394                            "statusDetail" => Ok(__FieldTag::__status_detail),
8395                            "status_detail" => Ok(__FieldTag::__status_detail),
8396                            "cancelRequested" => Ok(__FieldTag::__cancel_requested),
8397                            "cancel_requested" => Ok(__FieldTag::__cancel_requested),
8398                            "apiVersion" => Ok(__FieldTag::__api_version),
8399                            "api_version" => Ok(__FieldTag::__api_version),
8400                            "requestResource" => Ok(__FieldTag::__request_resource),
8401                            "request_resource" => Ok(__FieldTag::__request_resource),
8402                            "stages" => Ok(__FieldTag::__stages),
8403                            "sourceToken" => Ok(__FieldTag::__source_token),
8404                            "source_token" => Ok(__FieldTag::__source_token),
8405                            "buildName" => Ok(__FieldTag::__build_name),
8406                            "build_name" => Ok(__FieldTag::__build_name),
8407                            "operationType" => Ok(__FieldTag::__operation_type),
8408                            "operation_type" => Ok(__FieldTag::__operation_type),
8409                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8410                        }
8411                    }
8412                }
8413                deserializer.deserialize_identifier(Visitor)
8414            }
8415        }
8416        struct Visitor;
8417        impl<'de> serde::de::Visitor<'de> for Visitor {
8418            type Value = OperationMetadata;
8419            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8420                formatter.write_str("struct OperationMetadata")
8421            }
8422            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8423            where
8424                A: serde::de::MapAccess<'de>,
8425            {
8426                #[allow(unused_imports)]
8427                use serde::de::Error;
8428                use std::option::Option::Some;
8429                let mut fields = std::collections::HashSet::new();
8430                let mut result = Self::Value::new();
8431                while let Some(tag) = map.next_key::<__FieldTag>()? {
8432                    #[allow(clippy::match_single_binding)]
8433                    match tag {
8434                        __FieldTag::__create_time => {
8435                            if !fields.insert(__FieldTag::__create_time) {
8436                                return std::result::Result::Err(A::Error::duplicate_field(
8437                                    "multiple values for create_time",
8438                                ));
8439                            }
8440                            result.create_time =
8441                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8442                        }
8443                        __FieldTag::__end_time => {
8444                            if !fields.insert(__FieldTag::__end_time) {
8445                                return std::result::Result::Err(A::Error::duplicate_field(
8446                                    "multiple values for end_time",
8447                                ));
8448                            }
8449                            result.end_time =
8450                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8451                        }
8452                        __FieldTag::__target => {
8453                            if !fields.insert(__FieldTag::__target) {
8454                                return std::result::Result::Err(A::Error::duplicate_field(
8455                                    "multiple values for target",
8456                                ));
8457                            }
8458                            result.target = map
8459                                .next_value::<std::option::Option<std::string::String>>()?
8460                                .unwrap_or_default();
8461                        }
8462                        __FieldTag::__verb => {
8463                            if !fields.insert(__FieldTag::__verb) {
8464                                return std::result::Result::Err(A::Error::duplicate_field(
8465                                    "multiple values for verb",
8466                                ));
8467                            }
8468                            result.verb = map
8469                                .next_value::<std::option::Option<std::string::String>>()?
8470                                .unwrap_or_default();
8471                        }
8472                        __FieldTag::__status_detail => {
8473                            if !fields.insert(__FieldTag::__status_detail) {
8474                                return std::result::Result::Err(A::Error::duplicate_field(
8475                                    "multiple values for status_detail",
8476                                ));
8477                            }
8478                            result.status_detail = map
8479                                .next_value::<std::option::Option<std::string::String>>()?
8480                                .unwrap_or_default();
8481                        }
8482                        __FieldTag::__cancel_requested => {
8483                            if !fields.insert(__FieldTag::__cancel_requested) {
8484                                return std::result::Result::Err(A::Error::duplicate_field(
8485                                    "multiple values for cancel_requested",
8486                                ));
8487                            }
8488                            result.cancel_requested = map
8489                                .next_value::<std::option::Option<bool>>()?
8490                                .unwrap_or_default();
8491                        }
8492                        __FieldTag::__api_version => {
8493                            if !fields.insert(__FieldTag::__api_version) {
8494                                return std::result::Result::Err(A::Error::duplicate_field(
8495                                    "multiple values for api_version",
8496                                ));
8497                            }
8498                            result.api_version = map
8499                                .next_value::<std::option::Option<std::string::String>>()?
8500                                .unwrap_or_default();
8501                        }
8502                        __FieldTag::__request_resource => {
8503                            if !fields.insert(__FieldTag::__request_resource) {
8504                                return std::result::Result::Err(A::Error::duplicate_field(
8505                                    "multiple values for request_resource",
8506                                ));
8507                            }
8508                            result.request_resource =
8509                                map.next_value::<std::option::Option<wkt::Any>>()?;
8510                        }
8511                        __FieldTag::__stages => {
8512                            if !fields.insert(__FieldTag::__stages) {
8513                                return std::result::Result::Err(A::Error::duplicate_field(
8514                                    "multiple values for stages",
8515                                ));
8516                            }
8517                            result.stages = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Stage>>>()?.unwrap_or_default();
8518                        }
8519                        __FieldTag::__source_token => {
8520                            if !fields.insert(__FieldTag::__source_token) {
8521                                return std::result::Result::Err(A::Error::duplicate_field(
8522                                    "multiple values for source_token",
8523                                ));
8524                            }
8525                            result.source_token = map
8526                                .next_value::<std::option::Option<std::string::String>>()?
8527                                .unwrap_or_default();
8528                        }
8529                        __FieldTag::__build_name => {
8530                            if !fields.insert(__FieldTag::__build_name) {
8531                                return std::result::Result::Err(A::Error::duplicate_field(
8532                                    "multiple values for build_name",
8533                                ));
8534                            }
8535                            result.build_name = map
8536                                .next_value::<std::option::Option<std::string::String>>()?
8537                                .unwrap_or_default();
8538                        }
8539                        __FieldTag::__operation_type => {
8540                            if !fields.insert(__FieldTag::__operation_type) {
8541                                return std::result::Result::Err(A::Error::duplicate_field(
8542                                    "multiple values for operation_type",
8543                                ));
8544                            }
8545                            result.operation_type = map
8546                                .next_value::<std::option::Option<crate::model::OperationType>>()?
8547                                .unwrap_or_default();
8548                        }
8549                        __FieldTag::Unknown(key) => {
8550                            let value = map.next_value::<serde_json::Value>()?;
8551                            result._unknown_fields.insert(key, value);
8552                        }
8553                    }
8554                }
8555                std::result::Result::Ok(result)
8556            }
8557        }
8558        deserializer.deserialize_any(Visitor)
8559    }
8560}
8561
8562#[doc(hidden)]
8563impl serde::ser::Serialize for OperationMetadata {
8564    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8565    where
8566        S: serde::ser::Serializer,
8567    {
8568        use serde::ser::SerializeMap;
8569        #[allow(unused_imports)]
8570        use std::option::Option::Some;
8571        let mut state = serializer.serialize_map(std::option::Option::None)?;
8572        if self.create_time.is_some() {
8573            state.serialize_entry("createTime", &self.create_time)?;
8574        }
8575        if self.end_time.is_some() {
8576            state.serialize_entry("endTime", &self.end_time)?;
8577        }
8578        if !self.target.is_empty() {
8579            state.serialize_entry("target", &self.target)?;
8580        }
8581        if !self.verb.is_empty() {
8582            state.serialize_entry("verb", &self.verb)?;
8583        }
8584        if !self.status_detail.is_empty() {
8585            state.serialize_entry("statusDetail", &self.status_detail)?;
8586        }
8587        if !wkt::internal::is_default(&self.cancel_requested) {
8588            state.serialize_entry("cancelRequested", &self.cancel_requested)?;
8589        }
8590        if !self.api_version.is_empty() {
8591            state.serialize_entry("apiVersion", &self.api_version)?;
8592        }
8593        if self.request_resource.is_some() {
8594            state.serialize_entry("requestResource", &self.request_resource)?;
8595        }
8596        if !self.stages.is_empty() {
8597            state.serialize_entry("stages", &self.stages)?;
8598        }
8599        if !self.source_token.is_empty() {
8600            state.serialize_entry("sourceToken", &self.source_token)?;
8601        }
8602        if !self.build_name.is_empty() {
8603            state.serialize_entry("buildName", &self.build_name)?;
8604        }
8605        if !wkt::internal::is_default(&self.operation_type) {
8606            state.serialize_entry("operationType", &self.operation_type)?;
8607        }
8608        if !self._unknown_fields.is_empty() {
8609            for (key, value) in self._unknown_fields.iter() {
8610                state.serialize_entry(key, &value)?;
8611            }
8612        }
8613        state.end()
8614    }
8615}
8616
8617/// Extra GCF specific location information.
8618#[derive(Clone, Debug, Default, PartialEq)]
8619#[non_exhaustive]
8620pub struct LocationMetadata {
8621    /// The Cloud Function environments this location supports.
8622    pub environments: std::vec::Vec<crate::model::Environment>,
8623
8624    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8625}
8626
8627impl LocationMetadata {
8628    pub fn new() -> Self {
8629        std::default::Default::default()
8630    }
8631
8632    /// Sets the value of [environments][crate::model::LocationMetadata::environments].
8633    pub fn set_environments<T, V>(mut self, v: T) -> Self
8634    where
8635        T: std::iter::IntoIterator<Item = V>,
8636        V: std::convert::Into<crate::model::Environment>,
8637    {
8638        use std::iter::Iterator;
8639        self.environments = v.into_iter().map(|i| i.into()).collect();
8640        self
8641    }
8642}
8643
8644impl wkt::message::Message for LocationMetadata {
8645    fn typename() -> &'static str {
8646        "type.googleapis.com/google.cloud.functions.v2.LocationMetadata"
8647    }
8648}
8649
8650#[doc(hidden)]
8651impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
8652    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8653    where
8654        D: serde::Deserializer<'de>,
8655    {
8656        #[allow(non_camel_case_types)]
8657        #[doc(hidden)]
8658        #[derive(PartialEq, Eq, Hash)]
8659        enum __FieldTag {
8660            __environments,
8661            Unknown(std::string::String),
8662        }
8663        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8664            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8665            where
8666                D: serde::Deserializer<'de>,
8667            {
8668                struct Visitor;
8669                impl<'de> serde::de::Visitor<'de> for Visitor {
8670                    type Value = __FieldTag;
8671                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8672                        formatter.write_str("a field name for LocationMetadata")
8673                    }
8674                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8675                    where
8676                        E: serde::de::Error,
8677                    {
8678                        use std::result::Result::Ok;
8679                        use std::string::ToString;
8680                        match value {
8681                            "environments" => Ok(__FieldTag::__environments),
8682                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8683                        }
8684                    }
8685                }
8686                deserializer.deserialize_identifier(Visitor)
8687            }
8688        }
8689        struct Visitor;
8690        impl<'de> serde::de::Visitor<'de> for Visitor {
8691            type Value = LocationMetadata;
8692            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8693                formatter.write_str("struct LocationMetadata")
8694            }
8695            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8696            where
8697                A: serde::de::MapAccess<'de>,
8698            {
8699                #[allow(unused_imports)]
8700                use serde::de::Error;
8701                use std::option::Option::Some;
8702                let mut fields = std::collections::HashSet::new();
8703                let mut result = Self::Value::new();
8704                while let Some(tag) = map.next_key::<__FieldTag>()? {
8705                    #[allow(clippy::match_single_binding)]
8706                    match tag {
8707                        __FieldTag::__environments => {
8708                            if !fields.insert(__FieldTag::__environments) {
8709                                return std::result::Result::Err(A::Error::duplicate_field(
8710                                    "multiple values for environments",
8711                                ));
8712                            }
8713                            result.environments = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Environment>>>()?.unwrap_or_default();
8714                        }
8715                        __FieldTag::Unknown(key) => {
8716                            let value = map.next_value::<serde_json::Value>()?;
8717                            result._unknown_fields.insert(key, value);
8718                        }
8719                    }
8720                }
8721                std::result::Result::Ok(result)
8722            }
8723        }
8724        deserializer.deserialize_any(Visitor)
8725    }
8726}
8727
8728#[doc(hidden)]
8729impl serde::ser::Serialize for LocationMetadata {
8730    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8731    where
8732        S: serde::ser::Serializer,
8733    {
8734        use serde::ser::SerializeMap;
8735        #[allow(unused_imports)]
8736        use std::option::Option::Some;
8737        let mut state = serializer.serialize_map(std::option::Option::None)?;
8738        if !self.environments.is_empty() {
8739            state.serialize_entry("environments", &self.environments)?;
8740        }
8741        if !self._unknown_fields.is_empty() {
8742            for (key, value) in self._unknown_fields.iter() {
8743                state.serialize_entry(key, &value)?;
8744            }
8745        }
8746        state.end()
8747    }
8748}
8749
8750/// Each Stage of the deployment process
8751#[derive(Clone, Debug, Default, PartialEq)]
8752#[non_exhaustive]
8753pub struct Stage {
8754    /// Name of the Stage. This will be unique for each Stage.
8755    pub name: crate::model::stage::Name,
8756
8757    /// Message describing the Stage
8758    pub message: std::string::String,
8759
8760    /// Current state of the Stage
8761    pub state: crate::model::stage::State,
8762
8763    /// Resource of the Stage
8764    pub resource: std::string::String,
8765
8766    /// Link to the current Stage resource
8767    pub resource_uri: std::string::String,
8768
8769    /// State messages from the current Stage.
8770    pub state_messages: std::vec::Vec<crate::model::StateMessage>,
8771
8772    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8773}
8774
8775impl Stage {
8776    pub fn new() -> Self {
8777        std::default::Default::default()
8778    }
8779
8780    /// Sets the value of [name][crate::model::Stage::name].
8781    pub fn set_name<T: std::convert::Into<crate::model::stage::Name>>(mut self, v: T) -> Self {
8782        self.name = v.into();
8783        self
8784    }
8785
8786    /// Sets the value of [message][crate::model::Stage::message].
8787    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8788        self.message = v.into();
8789        self
8790    }
8791
8792    /// Sets the value of [state][crate::model::Stage::state].
8793    pub fn set_state<T: std::convert::Into<crate::model::stage::State>>(mut self, v: T) -> Self {
8794        self.state = v.into();
8795        self
8796    }
8797
8798    /// Sets the value of [resource][crate::model::Stage::resource].
8799    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8800        self.resource = v.into();
8801        self
8802    }
8803
8804    /// Sets the value of [resource_uri][crate::model::Stage::resource_uri].
8805    pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8806        self.resource_uri = v.into();
8807        self
8808    }
8809
8810    /// Sets the value of [state_messages][crate::model::Stage::state_messages].
8811    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
8812    where
8813        T: std::iter::IntoIterator<Item = V>,
8814        V: std::convert::Into<crate::model::StateMessage>,
8815    {
8816        use std::iter::Iterator;
8817        self.state_messages = v.into_iter().map(|i| i.into()).collect();
8818        self
8819    }
8820}
8821
8822impl wkt::message::Message for Stage {
8823    fn typename() -> &'static str {
8824        "type.googleapis.com/google.cloud.functions.v2.Stage"
8825    }
8826}
8827
8828#[doc(hidden)]
8829impl<'de> serde::de::Deserialize<'de> for Stage {
8830    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8831    where
8832        D: serde::Deserializer<'de>,
8833    {
8834        #[allow(non_camel_case_types)]
8835        #[doc(hidden)]
8836        #[derive(PartialEq, Eq, Hash)]
8837        enum __FieldTag {
8838            __name,
8839            __message,
8840            __state,
8841            __resource,
8842            __resource_uri,
8843            __state_messages,
8844            Unknown(std::string::String),
8845        }
8846        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8847            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8848            where
8849                D: serde::Deserializer<'de>,
8850            {
8851                struct Visitor;
8852                impl<'de> serde::de::Visitor<'de> for Visitor {
8853                    type Value = __FieldTag;
8854                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8855                        formatter.write_str("a field name for Stage")
8856                    }
8857                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8858                    where
8859                        E: serde::de::Error,
8860                    {
8861                        use std::result::Result::Ok;
8862                        use std::string::ToString;
8863                        match value {
8864                            "name" => Ok(__FieldTag::__name),
8865                            "message" => Ok(__FieldTag::__message),
8866                            "state" => Ok(__FieldTag::__state),
8867                            "resource" => Ok(__FieldTag::__resource),
8868                            "resourceUri" => Ok(__FieldTag::__resource_uri),
8869                            "resource_uri" => Ok(__FieldTag::__resource_uri),
8870                            "stateMessages" => Ok(__FieldTag::__state_messages),
8871                            "state_messages" => Ok(__FieldTag::__state_messages),
8872                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8873                        }
8874                    }
8875                }
8876                deserializer.deserialize_identifier(Visitor)
8877            }
8878        }
8879        struct Visitor;
8880        impl<'de> serde::de::Visitor<'de> for Visitor {
8881            type Value = Stage;
8882            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8883                formatter.write_str("struct Stage")
8884            }
8885            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8886            where
8887                A: serde::de::MapAccess<'de>,
8888            {
8889                #[allow(unused_imports)]
8890                use serde::de::Error;
8891                use std::option::Option::Some;
8892                let mut fields = std::collections::HashSet::new();
8893                let mut result = Self::Value::new();
8894                while let Some(tag) = map.next_key::<__FieldTag>()? {
8895                    #[allow(clippy::match_single_binding)]
8896                    match tag {
8897                        __FieldTag::__name => {
8898                            if !fields.insert(__FieldTag::__name) {
8899                                return std::result::Result::Err(A::Error::duplicate_field(
8900                                    "multiple values for name",
8901                                ));
8902                            }
8903                            result.name = map
8904                                .next_value::<std::option::Option<crate::model::stage::Name>>()?
8905                                .unwrap_or_default();
8906                        }
8907                        __FieldTag::__message => {
8908                            if !fields.insert(__FieldTag::__message) {
8909                                return std::result::Result::Err(A::Error::duplicate_field(
8910                                    "multiple values for message",
8911                                ));
8912                            }
8913                            result.message = map
8914                                .next_value::<std::option::Option<std::string::String>>()?
8915                                .unwrap_or_default();
8916                        }
8917                        __FieldTag::__state => {
8918                            if !fields.insert(__FieldTag::__state) {
8919                                return std::result::Result::Err(A::Error::duplicate_field(
8920                                    "multiple values for state",
8921                                ));
8922                            }
8923                            result.state = map
8924                                .next_value::<std::option::Option<crate::model::stage::State>>()?
8925                                .unwrap_or_default();
8926                        }
8927                        __FieldTag::__resource => {
8928                            if !fields.insert(__FieldTag::__resource) {
8929                                return std::result::Result::Err(A::Error::duplicate_field(
8930                                    "multiple values for resource",
8931                                ));
8932                            }
8933                            result.resource = map
8934                                .next_value::<std::option::Option<std::string::String>>()?
8935                                .unwrap_or_default();
8936                        }
8937                        __FieldTag::__resource_uri => {
8938                            if !fields.insert(__FieldTag::__resource_uri) {
8939                                return std::result::Result::Err(A::Error::duplicate_field(
8940                                    "multiple values for resource_uri",
8941                                ));
8942                            }
8943                            result.resource_uri = map
8944                                .next_value::<std::option::Option<std::string::String>>()?
8945                                .unwrap_or_default();
8946                        }
8947                        __FieldTag::__state_messages => {
8948                            if !fields.insert(__FieldTag::__state_messages) {
8949                                return std::result::Result::Err(A::Error::duplicate_field(
8950                                    "multiple values for state_messages",
8951                                ));
8952                            }
8953                            result.state_messages = map.next_value::<std::option::Option<std::vec::Vec<crate::model::StateMessage>>>()?.unwrap_or_default();
8954                        }
8955                        __FieldTag::Unknown(key) => {
8956                            let value = map.next_value::<serde_json::Value>()?;
8957                            result._unknown_fields.insert(key, value);
8958                        }
8959                    }
8960                }
8961                std::result::Result::Ok(result)
8962            }
8963        }
8964        deserializer.deserialize_any(Visitor)
8965    }
8966}
8967
8968#[doc(hidden)]
8969impl serde::ser::Serialize for Stage {
8970    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8971    where
8972        S: serde::ser::Serializer,
8973    {
8974        use serde::ser::SerializeMap;
8975        #[allow(unused_imports)]
8976        use std::option::Option::Some;
8977        let mut state = serializer.serialize_map(std::option::Option::None)?;
8978        if !wkt::internal::is_default(&self.name) {
8979            state.serialize_entry("name", &self.name)?;
8980        }
8981        if !self.message.is_empty() {
8982            state.serialize_entry("message", &self.message)?;
8983        }
8984        if !wkt::internal::is_default(&self.state) {
8985            state.serialize_entry("state", &self.state)?;
8986        }
8987        if !self.resource.is_empty() {
8988            state.serialize_entry("resource", &self.resource)?;
8989        }
8990        if !self.resource_uri.is_empty() {
8991            state.serialize_entry("resourceUri", &self.resource_uri)?;
8992        }
8993        if !self.state_messages.is_empty() {
8994            state.serialize_entry("stateMessages", &self.state_messages)?;
8995        }
8996        if !self._unknown_fields.is_empty() {
8997            for (key, value) in self._unknown_fields.iter() {
8998                state.serialize_entry(key, &value)?;
8999            }
9000        }
9001        state.end()
9002    }
9003}
9004
9005/// Defines additional types related to [Stage].
9006pub mod stage {
9007    #[allow(unused_imports)]
9008    use super::*;
9009
9010    /// Possible names for a Stage
9011    ///
9012    /// # Working with unknown values
9013    ///
9014    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9015    /// additional enum variants at any time. Adding new variants is not considered
9016    /// a breaking change. Applications should write their code in anticipation of:
9017    ///
9018    /// - New values appearing in future releases of the client library, **and**
9019    /// - New values received dynamically, without application changes.
9020    ///
9021    /// Please consult the [Working with enums] section in the user guide for some
9022    /// guidelines.
9023    ///
9024    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9025    #[derive(Clone, Debug, PartialEq)]
9026    #[non_exhaustive]
9027    pub enum Name {
9028        /// Not specified. Invalid name.
9029        Unspecified,
9030        /// Artifact Registry Stage
9031        ArtifactRegistry,
9032        /// Build Stage
9033        Build,
9034        /// Service Stage
9035        Service,
9036        /// Trigger Stage
9037        Trigger,
9038        /// Service Rollback Stage
9039        ServiceRollback,
9040        /// Trigger Rollback Stage
9041        TriggerRollback,
9042        /// If set, the enum was initialized with an unknown value.
9043        ///
9044        /// Applications can examine the value using [Name::value] or
9045        /// [Name::name].
9046        UnknownValue(name::UnknownValue),
9047    }
9048
9049    #[doc(hidden)]
9050    pub mod name {
9051        #[allow(unused_imports)]
9052        use super::*;
9053        #[derive(Clone, Debug, PartialEq)]
9054        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9055    }
9056
9057    impl Name {
9058        /// Gets the enum value.
9059        ///
9060        /// Returns `None` if the enum contains an unknown value deserialized from
9061        /// the string representation of enums.
9062        pub fn value(&self) -> std::option::Option<i32> {
9063            match self {
9064                Self::Unspecified => std::option::Option::Some(0),
9065                Self::ArtifactRegistry => std::option::Option::Some(1),
9066                Self::Build => std::option::Option::Some(2),
9067                Self::Service => std::option::Option::Some(3),
9068                Self::Trigger => std::option::Option::Some(4),
9069                Self::ServiceRollback => std::option::Option::Some(5),
9070                Self::TriggerRollback => std::option::Option::Some(6),
9071                Self::UnknownValue(u) => u.0.value(),
9072            }
9073        }
9074
9075        /// Gets the enum value as a string.
9076        ///
9077        /// Returns `None` if the enum contains an unknown value deserialized from
9078        /// the integer representation of enums.
9079        pub fn name(&self) -> std::option::Option<&str> {
9080            match self {
9081                Self::Unspecified => std::option::Option::Some("NAME_UNSPECIFIED"),
9082                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
9083                Self::Build => std::option::Option::Some("BUILD"),
9084                Self::Service => std::option::Option::Some("SERVICE"),
9085                Self::Trigger => std::option::Option::Some("TRIGGER"),
9086                Self::ServiceRollback => std::option::Option::Some("SERVICE_ROLLBACK"),
9087                Self::TriggerRollback => std::option::Option::Some("TRIGGER_ROLLBACK"),
9088                Self::UnknownValue(u) => u.0.name(),
9089            }
9090        }
9091    }
9092
9093    impl std::default::Default for Name {
9094        fn default() -> Self {
9095            use std::convert::From;
9096            Self::from(0)
9097        }
9098    }
9099
9100    impl std::fmt::Display for Name {
9101        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9102            wkt::internal::display_enum(f, self.name(), self.value())
9103        }
9104    }
9105
9106    impl std::convert::From<i32> for Name {
9107        fn from(value: i32) -> Self {
9108            match value {
9109                0 => Self::Unspecified,
9110                1 => Self::ArtifactRegistry,
9111                2 => Self::Build,
9112                3 => Self::Service,
9113                4 => Self::Trigger,
9114                5 => Self::ServiceRollback,
9115                6 => Self::TriggerRollback,
9116                _ => Self::UnknownValue(name::UnknownValue(
9117                    wkt::internal::UnknownEnumValue::Integer(value),
9118                )),
9119            }
9120        }
9121    }
9122
9123    impl std::convert::From<&str> for Name {
9124        fn from(value: &str) -> Self {
9125            use std::string::ToString;
9126            match value {
9127                "NAME_UNSPECIFIED" => Self::Unspecified,
9128                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
9129                "BUILD" => Self::Build,
9130                "SERVICE" => Self::Service,
9131                "TRIGGER" => Self::Trigger,
9132                "SERVICE_ROLLBACK" => Self::ServiceRollback,
9133                "TRIGGER_ROLLBACK" => Self::TriggerRollback,
9134                _ => Self::UnknownValue(name::UnknownValue(
9135                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9136                )),
9137            }
9138        }
9139    }
9140
9141    impl serde::ser::Serialize for Name {
9142        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9143        where
9144            S: serde::Serializer,
9145        {
9146            match self {
9147                Self::Unspecified => serializer.serialize_i32(0),
9148                Self::ArtifactRegistry => serializer.serialize_i32(1),
9149                Self::Build => serializer.serialize_i32(2),
9150                Self::Service => serializer.serialize_i32(3),
9151                Self::Trigger => serializer.serialize_i32(4),
9152                Self::ServiceRollback => serializer.serialize_i32(5),
9153                Self::TriggerRollback => serializer.serialize_i32(6),
9154                Self::UnknownValue(u) => u.0.serialize(serializer),
9155            }
9156        }
9157    }
9158
9159    impl<'de> serde::de::Deserialize<'de> for Name {
9160        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9161        where
9162            D: serde::Deserializer<'de>,
9163        {
9164            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Name>::new(
9165                ".google.cloud.functions.v2.Stage.Name",
9166            ))
9167        }
9168    }
9169
9170    /// Possible states for a Stage
9171    ///
9172    /// # Working with unknown values
9173    ///
9174    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9175    /// additional enum variants at any time. Adding new variants is not considered
9176    /// a breaking change. Applications should write their code in anticipation of:
9177    ///
9178    /// - New values appearing in future releases of the client library, **and**
9179    /// - New values received dynamically, without application changes.
9180    ///
9181    /// Please consult the [Working with enums] section in the user guide for some
9182    /// guidelines.
9183    ///
9184    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9185    #[derive(Clone, Debug, PartialEq)]
9186    #[non_exhaustive]
9187    pub enum State {
9188        /// Not specified. Invalid state.
9189        Unspecified,
9190        /// Stage has not started.
9191        NotStarted,
9192        /// Stage is in progress.
9193        InProgress,
9194        /// Stage has completed.
9195        Complete,
9196        /// If set, the enum was initialized with an unknown value.
9197        ///
9198        /// Applications can examine the value using [State::value] or
9199        /// [State::name].
9200        UnknownValue(state::UnknownValue),
9201    }
9202
9203    #[doc(hidden)]
9204    pub mod state {
9205        #[allow(unused_imports)]
9206        use super::*;
9207        #[derive(Clone, Debug, PartialEq)]
9208        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9209    }
9210
9211    impl State {
9212        /// Gets the enum value.
9213        ///
9214        /// Returns `None` if the enum contains an unknown value deserialized from
9215        /// the string representation of enums.
9216        pub fn value(&self) -> std::option::Option<i32> {
9217            match self {
9218                Self::Unspecified => std::option::Option::Some(0),
9219                Self::NotStarted => std::option::Option::Some(1),
9220                Self::InProgress => std::option::Option::Some(2),
9221                Self::Complete => std::option::Option::Some(3),
9222                Self::UnknownValue(u) => u.0.value(),
9223            }
9224        }
9225
9226        /// Gets the enum value as a string.
9227        ///
9228        /// Returns `None` if the enum contains an unknown value deserialized from
9229        /// the integer representation of enums.
9230        pub fn name(&self) -> std::option::Option<&str> {
9231            match self {
9232                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9233                Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
9234                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
9235                Self::Complete => std::option::Option::Some("COMPLETE"),
9236                Self::UnknownValue(u) => u.0.name(),
9237            }
9238        }
9239    }
9240
9241    impl std::default::Default for State {
9242        fn default() -> Self {
9243            use std::convert::From;
9244            Self::from(0)
9245        }
9246    }
9247
9248    impl std::fmt::Display for State {
9249        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9250            wkt::internal::display_enum(f, self.name(), self.value())
9251        }
9252    }
9253
9254    impl std::convert::From<i32> for State {
9255        fn from(value: i32) -> Self {
9256            match value {
9257                0 => Self::Unspecified,
9258                1 => Self::NotStarted,
9259                2 => Self::InProgress,
9260                3 => Self::Complete,
9261                _ => Self::UnknownValue(state::UnknownValue(
9262                    wkt::internal::UnknownEnumValue::Integer(value),
9263                )),
9264            }
9265        }
9266    }
9267
9268    impl std::convert::From<&str> for State {
9269        fn from(value: &str) -> Self {
9270            use std::string::ToString;
9271            match value {
9272                "STATE_UNSPECIFIED" => Self::Unspecified,
9273                "NOT_STARTED" => Self::NotStarted,
9274                "IN_PROGRESS" => Self::InProgress,
9275                "COMPLETE" => Self::Complete,
9276                _ => Self::UnknownValue(state::UnknownValue(
9277                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9278                )),
9279            }
9280        }
9281    }
9282
9283    impl serde::ser::Serialize for State {
9284        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9285        where
9286            S: serde::Serializer,
9287        {
9288            match self {
9289                Self::Unspecified => serializer.serialize_i32(0),
9290                Self::NotStarted => serializer.serialize_i32(1),
9291                Self::InProgress => serializer.serialize_i32(2),
9292                Self::Complete => serializer.serialize_i32(3),
9293                Self::UnknownValue(u) => u.0.serialize(serializer),
9294            }
9295        }
9296    }
9297
9298    impl<'de> serde::de::Deserialize<'de> for State {
9299        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9300        where
9301            D: serde::Deserializer<'de>,
9302        {
9303            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9304                ".google.cloud.functions.v2.Stage.State",
9305            ))
9306        }
9307    }
9308}
9309
9310/// The type of the long running operation.
9311///
9312/// # Working with unknown values
9313///
9314/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9315/// additional enum variants at any time. Adding new variants is not considered
9316/// a breaking change. Applications should write their code in anticipation of:
9317///
9318/// - New values appearing in future releases of the client library, **and**
9319/// - New values received dynamically, without application changes.
9320///
9321/// Please consult the [Working with enums] section in the user guide for some
9322/// guidelines.
9323///
9324/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9325#[derive(Clone, Debug, PartialEq)]
9326#[non_exhaustive]
9327pub enum OperationType {
9328    /// Unspecified
9329    OperationtypeUnspecified,
9330    /// CreateFunction
9331    CreateFunction,
9332    /// UpdateFunction
9333    UpdateFunction,
9334    /// DeleteFunction
9335    DeleteFunction,
9336    /// If set, the enum was initialized with an unknown value.
9337    ///
9338    /// Applications can examine the value using [OperationType::value] or
9339    /// [OperationType::name].
9340    UnknownValue(operation_type::UnknownValue),
9341}
9342
9343#[doc(hidden)]
9344pub mod operation_type {
9345    #[allow(unused_imports)]
9346    use super::*;
9347    #[derive(Clone, Debug, PartialEq)]
9348    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9349}
9350
9351impl OperationType {
9352    /// Gets the enum value.
9353    ///
9354    /// Returns `None` if the enum contains an unknown value deserialized from
9355    /// the string representation of enums.
9356    pub fn value(&self) -> std::option::Option<i32> {
9357        match self {
9358            Self::OperationtypeUnspecified => std::option::Option::Some(0),
9359            Self::CreateFunction => std::option::Option::Some(1),
9360            Self::UpdateFunction => std::option::Option::Some(2),
9361            Self::DeleteFunction => std::option::Option::Some(3),
9362            Self::UnknownValue(u) => u.0.value(),
9363        }
9364    }
9365
9366    /// Gets the enum value as a string.
9367    ///
9368    /// Returns `None` if the enum contains an unknown value deserialized from
9369    /// the integer representation of enums.
9370    pub fn name(&self) -> std::option::Option<&str> {
9371        match self {
9372            Self::OperationtypeUnspecified => {
9373                std::option::Option::Some("OPERATIONTYPE_UNSPECIFIED")
9374            }
9375            Self::CreateFunction => std::option::Option::Some("CREATE_FUNCTION"),
9376            Self::UpdateFunction => std::option::Option::Some("UPDATE_FUNCTION"),
9377            Self::DeleteFunction => std::option::Option::Some("DELETE_FUNCTION"),
9378            Self::UnknownValue(u) => u.0.name(),
9379        }
9380    }
9381}
9382
9383impl std::default::Default for OperationType {
9384    fn default() -> Self {
9385        use std::convert::From;
9386        Self::from(0)
9387    }
9388}
9389
9390impl std::fmt::Display for OperationType {
9391    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9392        wkt::internal::display_enum(f, self.name(), self.value())
9393    }
9394}
9395
9396impl std::convert::From<i32> for OperationType {
9397    fn from(value: i32) -> Self {
9398        match value {
9399            0 => Self::OperationtypeUnspecified,
9400            1 => Self::CreateFunction,
9401            2 => Self::UpdateFunction,
9402            3 => Self::DeleteFunction,
9403            _ => Self::UnknownValue(operation_type::UnknownValue(
9404                wkt::internal::UnknownEnumValue::Integer(value),
9405            )),
9406        }
9407    }
9408}
9409
9410impl std::convert::From<&str> for OperationType {
9411    fn from(value: &str) -> Self {
9412        use std::string::ToString;
9413        match value {
9414            "OPERATIONTYPE_UNSPECIFIED" => Self::OperationtypeUnspecified,
9415            "CREATE_FUNCTION" => Self::CreateFunction,
9416            "UPDATE_FUNCTION" => Self::UpdateFunction,
9417            "DELETE_FUNCTION" => Self::DeleteFunction,
9418            _ => Self::UnknownValue(operation_type::UnknownValue(
9419                wkt::internal::UnknownEnumValue::String(value.to_string()),
9420            )),
9421        }
9422    }
9423}
9424
9425impl serde::ser::Serialize for OperationType {
9426    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9427    where
9428        S: serde::Serializer,
9429    {
9430        match self {
9431            Self::OperationtypeUnspecified => serializer.serialize_i32(0),
9432            Self::CreateFunction => serializer.serialize_i32(1),
9433            Self::UpdateFunction => serializer.serialize_i32(2),
9434            Self::DeleteFunction => serializer.serialize_i32(3),
9435            Self::UnknownValue(u) => u.0.serialize(serializer),
9436        }
9437    }
9438}
9439
9440impl<'de> serde::de::Deserialize<'de> for OperationType {
9441    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9442    where
9443        D: serde::Deserializer<'de>,
9444    {
9445        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
9446            ".google.cloud.functions.v2.OperationType",
9447        ))
9448    }
9449}
9450
9451/// The environment the function is hosted on.
9452///
9453/// # Working with unknown values
9454///
9455/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9456/// additional enum variants at any time. Adding new variants is not considered
9457/// a breaking change. Applications should write their code in anticipation of:
9458///
9459/// - New values appearing in future releases of the client library, **and**
9460/// - New values received dynamically, without application changes.
9461///
9462/// Please consult the [Working with enums] section in the user guide for some
9463/// guidelines.
9464///
9465/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9466#[derive(Clone, Debug, PartialEq)]
9467#[non_exhaustive]
9468pub enum Environment {
9469    /// Unspecified
9470    Unspecified,
9471    /// Gen 1
9472    Gen1,
9473    /// Gen 2
9474    Gen2,
9475    /// If set, the enum was initialized with an unknown value.
9476    ///
9477    /// Applications can examine the value using [Environment::value] or
9478    /// [Environment::name].
9479    UnknownValue(environment::UnknownValue),
9480}
9481
9482#[doc(hidden)]
9483pub mod environment {
9484    #[allow(unused_imports)]
9485    use super::*;
9486    #[derive(Clone, Debug, PartialEq)]
9487    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9488}
9489
9490impl Environment {
9491    /// Gets the enum value.
9492    ///
9493    /// Returns `None` if the enum contains an unknown value deserialized from
9494    /// the string representation of enums.
9495    pub fn value(&self) -> std::option::Option<i32> {
9496        match self {
9497            Self::Unspecified => std::option::Option::Some(0),
9498            Self::Gen1 => std::option::Option::Some(1),
9499            Self::Gen2 => std::option::Option::Some(2),
9500            Self::UnknownValue(u) => u.0.value(),
9501        }
9502    }
9503
9504    /// Gets the enum value as a string.
9505    ///
9506    /// Returns `None` if the enum contains an unknown value deserialized from
9507    /// the integer representation of enums.
9508    pub fn name(&self) -> std::option::Option<&str> {
9509        match self {
9510            Self::Unspecified => std::option::Option::Some("ENVIRONMENT_UNSPECIFIED"),
9511            Self::Gen1 => std::option::Option::Some("GEN_1"),
9512            Self::Gen2 => std::option::Option::Some("GEN_2"),
9513            Self::UnknownValue(u) => u.0.name(),
9514        }
9515    }
9516}
9517
9518impl std::default::Default for Environment {
9519    fn default() -> Self {
9520        use std::convert::From;
9521        Self::from(0)
9522    }
9523}
9524
9525impl std::fmt::Display for Environment {
9526    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9527        wkt::internal::display_enum(f, self.name(), self.value())
9528    }
9529}
9530
9531impl std::convert::From<i32> for Environment {
9532    fn from(value: i32) -> Self {
9533        match value {
9534            0 => Self::Unspecified,
9535            1 => Self::Gen1,
9536            2 => Self::Gen2,
9537            _ => Self::UnknownValue(environment::UnknownValue(
9538                wkt::internal::UnknownEnumValue::Integer(value),
9539            )),
9540        }
9541    }
9542}
9543
9544impl std::convert::From<&str> for Environment {
9545    fn from(value: &str) -> Self {
9546        use std::string::ToString;
9547        match value {
9548            "ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
9549            "GEN_1" => Self::Gen1,
9550            "GEN_2" => Self::Gen2,
9551            _ => Self::UnknownValue(environment::UnknownValue(
9552                wkt::internal::UnknownEnumValue::String(value.to_string()),
9553            )),
9554        }
9555    }
9556}
9557
9558impl serde::ser::Serialize for Environment {
9559    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9560    where
9561        S: serde::Serializer,
9562    {
9563        match self {
9564            Self::Unspecified => serializer.serialize_i32(0),
9565            Self::Gen1 => serializer.serialize_i32(1),
9566            Self::Gen2 => serializer.serialize_i32(2),
9567            Self::UnknownValue(u) => u.0.serialize(serializer),
9568        }
9569    }
9570}
9571
9572impl<'de> serde::de::Deserialize<'de> for Environment {
9573    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9574    where
9575        D: serde::Deserializer<'de>,
9576    {
9577        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Environment>::new(
9578            ".google.cloud.functions.v2.Environment",
9579        ))
9580    }
9581}