Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_type;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Describes a Cloud Function that contains user computation executed in
41/// response to an event. It encapsulates function and trigger configurations.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Function {
45    /// A user-defined name of the function. Function names must be unique
46    /// globally and match pattern `projects/*/locations/*/functions/*`
47    pub name: std::string::String,
48
49    /// User-provided description of a function.
50    pub description: std::string::String,
51
52    /// Describes the Build step of the function that builds a container from the
53    /// given source.
54    pub build_config: std::option::Option<crate::model::BuildConfig>,
55
56    /// Describes the Service being deployed. Currently deploys services to Cloud
57    /// Run (fully managed).
58    pub service_config: std::option::Option<crate::model::ServiceConfig>,
59
60    /// An Eventarc trigger managed by Google Cloud Functions that fires events in
61    /// response to a condition in another service.
62    pub event_trigger: std::option::Option<crate::model::EventTrigger>,
63
64    /// Output only. State of the function.
65    pub state: crate::model::function::State,
66
67    /// Output only. The last update timestamp of a Cloud Function.
68    pub update_time: std::option::Option<wkt::Timestamp>,
69
70    /// Labels associated with this Cloud Function.
71    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
72
73    /// Output only. State Messages for this Cloud Function.
74    pub state_messages: std::vec::Vec<crate::model::StateMessage>,
75
76    /// Describe whether the function is 1st Gen or 2nd Gen.
77    pub environment: crate::model::Environment,
78
79    /// Output only. The deployed url for the function.
80    pub url: std::string::String,
81
82    /// Resource name of a KMS crypto key (managed by the user) used to
83    /// encrypt/decrypt function resources.
84    ///
85    /// It must match the pattern
86    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
87    pub kms_key_name: std::string::String,
88
89    /// Output only. Reserved for future use.
90    pub satisfies_pzs: bool,
91
92    /// Output only. The create timestamp of a Cloud Function. This is only
93    /// applicable to 2nd Gen functions.
94    pub create_time: std::option::Option<wkt::Timestamp>,
95
96    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
97}
98
99impl Function {
100    /// Creates a new default instance.
101    pub fn new() -> Self {
102        std::default::Default::default()
103    }
104
105    /// Sets the value of [name][crate::model::Function::name].
106    ///
107    /// # Example
108    /// ```ignore,no_run
109    /// # use google_cloud_functions_v2::model::Function;
110    /// let x = Function::new().set_name("example");
111    /// ```
112    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
113        self.name = v.into();
114        self
115    }
116
117    /// Sets the value of [description][crate::model::Function::description].
118    ///
119    /// # Example
120    /// ```ignore,no_run
121    /// # use google_cloud_functions_v2::model::Function;
122    /// let x = Function::new().set_description("example");
123    /// ```
124    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
125        self.description = v.into();
126        self
127    }
128
129    /// Sets the value of [build_config][crate::model::Function::build_config].
130    ///
131    /// # Example
132    /// ```ignore,no_run
133    /// # use google_cloud_functions_v2::model::Function;
134    /// use google_cloud_functions_v2::model::BuildConfig;
135    /// let x = Function::new().set_build_config(BuildConfig::default()/* use setters */);
136    /// ```
137    pub fn set_build_config<T>(mut self, v: T) -> Self
138    where
139        T: std::convert::Into<crate::model::BuildConfig>,
140    {
141        self.build_config = std::option::Option::Some(v.into());
142        self
143    }
144
145    /// Sets or clears the value of [build_config][crate::model::Function::build_config].
146    ///
147    /// # Example
148    /// ```ignore,no_run
149    /// # use google_cloud_functions_v2::model::Function;
150    /// use google_cloud_functions_v2::model::BuildConfig;
151    /// let x = Function::new().set_or_clear_build_config(Some(BuildConfig::default()/* use setters */));
152    /// let x = Function::new().set_or_clear_build_config(None::<BuildConfig>);
153    /// ```
154    pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
155    where
156        T: std::convert::Into<crate::model::BuildConfig>,
157    {
158        self.build_config = v.map(|x| x.into());
159        self
160    }
161
162    /// Sets the value of [service_config][crate::model::Function::service_config].
163    ///
164    /// # Example
165    /// ```ignore,no_run
166    /// # use google_cloud_functions_v2::model::Function;
167    /// use google_cloud_functions_v2::model::ServiceConfig;
168    /// let x = Function::new().set_service_config(ServiceConfig::default()/* use setters */);
169    /// ```
170    pub fn set_service_config<T>(mut self, v: T) -> Self
171    where
172        T: std::convert::Into<crate::model::ServiceConfig>,
173    {
174        self.service_config = std::option::Option::Some(v.into());
175        self
176    }
177
178    /// Sets or clears the value of [service_config][crate::model::Function::service_config].
179    ///
180    /// # Example
181    /// ```ignore,no_run
182    /// # use google_cloud_functions_v2::model::Function;
183    /// use google_cloud_functions_v2::model::ServiceConfig;
184    /// let x = Function::new().set_or_clear_service_config(Some(ServiceConfig::default()/* use setters */));
185    /// let x = Function::new().set_or_clear_service_config(None::<ServiceConfig>);
186    /// ```
187    pub fn set_or_clear_service_config<T>(mut self, v: std::option::Option<T>) -> Self
188    where
189        T: std::convert::Into<crate::model::ServiceConfig>,
190    {
191        self.service_config = v.map(|x| x.into());
192        self
193    }
194
195    /// Sets the value of [event_trigger][crate::model::Function::event_trigger].
196    ///
197    /// # Example
198    /// ```ignore,no_run
199    /// # use google_cloud_functions_v2::model::Function;
200    /// use google_cloud_functions_v2::model::EventTrigger;
201    /// let x = Function::new().set_event_trigger(EventTrigger::default()/* use setters */);
202    /// ```
203    pub fn set_event_trigger<T>(mut self, v: T) -> Self
204    where
205        T: std::convert::Into<crate::model::EventTrigger>,
206    {
207        self.event_trigger = std::option::Option::Some(v.into());
208        self
209    }
210
211    /// Sets or clears the value of [event_trigger][crate::model::Function::event_trigger].
212    ///
213    /// # Example
214    /// ```ignore,no_run
215    /// # use google_cloud_functions_v2::model::Function;
216    /// use google_cloud_functions_v2::model::EventTrigger;
217    /// let x = Function::new().set_or_clear_event_trigger(Some(EventTrigger::default()/* use setters */));
218    /// let x = Function::new().set_or_clear_event_trigger(None::<EventTrigger>);
219    /// ```
220    pub fn set_or_clear_event_trigger<T>(mut self, v: std::option::Option<T>) -> Self
221    where
222        T: std::convert::Into<crate::model::EventTrigger>,
223    {
224        self.event_trigger = v.map(|x| x.into());
225        self
226    }
227
228    /// Sets the value of [state][crate::model::Function::state].
229    ///
230    /// # Example
231    /// ```ignore,no_run
232    /// # use google_cloud_functions_v2::model::Function;
233    /// use google_cloud_functions_v2::model::function::State;
234    /// let x0 = Function::new().set_state(State::Active);
235    /// let x1 = Function::new().set_state(State::Failed);
236    /// let x2 = Function::new().set_state(State::Deploying);
237    /// ```
238    pub fn set_state<T: std::convert::Into<crate::model::function::State>>(mut self, v: T) -> Self {
239        self.state = v.into();
240        self
241    }
242
243    /// Sets the value of [update_time][crate::model::Function::update_time].
244    ///
245    /// # Example
246    /// ```ignore,no_run
247    /// # use google_cloud_functions_v2::model::Function;
248    /// use wkt::Timestamp;
249    /// let x = Function::new().set_update_time(Timestamp::default()/* use setters */);
250    /// ```
251    pub fn set_update_time<T>(mut self, v: T) -> Self
252    where
253        T: std::convert::Into<wkt::Timestamp>,
254    {
255        self.update_time = std::option::Option::Some(v.into());
256        self
257    }
258
259    /// Sets or clears the value of [update_time][crate::model::Function::update_time].
260    ///
261    /// # Example
262    /// ```ignore,no_run
263    /// # use google_cloud_functions_v2::model::Function;
264    /// use wkt::Timestamp;
265    /// let x = Function::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
266    /// let x = Function::new().set_or_clear_update_time(None::<Timestamp>);
267    /// ```
268    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
269    where
270        T: std::convert::Into<wkt::Timestamp>,
271    {
272        self.update_time = v.map(|x| x.into());
273        self
274    }
275
276    /// Sets the value of [labels][crate::model::Function::labels].
277    ///
278    /// # Example
279    /// ```ignore,no_run
280    /// # use google_cloud_functions_v2::model::Function;
281    /// let x = Function::new().set_labels([
282    ///     ("key0", "abc"),
283    ///     ("key1", "xyz"),
284    /// ]);
285    /// ```
286    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
287    where
288        T: std::iter::IntoIterator<Item = (K, V)>,
289        K: std::convert::Into<std::string::String>,
290        V: std::convert::Into<std::string::String>,
291    {
292        use std::iter::Iterator;
293        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
294        self
295    }
296
297    /// Sets the value of [state_messages][crate::model::Function::state_messages].
298    ///
299    /// # Example
300    /// ```ignore,no_run
301    /// # use google_cloud_functions_v2::model::Function;
302    /// use google_cloud_functions_v2::model::StateMessage;
303    /// let x = Function::new()
304    ///     .set_state_messages([
305    ///         StateMessage::default()/* use setters */,
306    ///         StateMessage::default()/* use (different) setters */,
307    ///     ]);
308    /// ```
309    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
310    where
311        T: std::iter::IntoIterator<Item = V>,
312        V: std::convert::Into<crate::model::StateMessage>,
313    {
314        use std::iter::Iterator;
315        self.state_messages = v.into_iter().map(|i| i.into()).collect();
316        self
317    }
318
319    /// Sets the value of [environment][crate::model::Function::environment].
320    ///
321    /// # Example
322    /// ```ignore,no_run
323    /// # use google_cloud_functions_v2::model::Function;
324    /// use google_cloud_functions_v2::model::Environment;
325    /// let x0 = Function::new().set_environment(Environment::Gen1);
326    /// let x1 = Function::new().set_environment(Environment::Gen2);
327    /// ```
328    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
329        mut self,
330        v: T,
331    ) -> Self {
332        self.environment = v.into();
333        self
334    }
335
336    /// Sets the value of [url][crate::model::Function::url].
337    ///
338    /// # Example
339    /// ```ignore,no_run
340    /// # use google_cloud_functions_v2::model::Function;
341    /// let x = Function::new().set_url("example");
342    /// ```
343    pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
344        self.url = v.into();
345        self
346    }
347
348    /// Sets the value of [kms_key_name][crate::model::Function::kms_key_name].
349    ///
350    /// # Example
351    /// ```ignore,no_run
352    /// # use google_cloud_functions_v2::model::Function;
353    /// let x = Function::new().set_kms_key_name("example");
354    /// ```
355    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
356        self.kms_key_name = v.into();
357        self
358    }
359
360    /// Sets the value of [satisfies_pzs][crate::model::Function::satisfies_pzs].
361    ///
362    /// # Example
363    /// ```ignore,no_run
364    /// # use google_cloud_functions_v2::model::Function;
365    /// let x = Function::new().set_satisfies_pzs(true);
366    /// ```
367    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
368        self.satisfies_pzs = v.into();
369        self
370    }
371
372    /// Sets the value of [create_time][crate::model::Function::create_time].
373    ///
374    /// # Example
375    /// ```ignore,no_run
376    /// # use google_cloud_functions_v2::model::Function;
377    /// use wkt::Timestamp;
378    /// let x = Function::new().set_create_time(Timestamp::default()/* use setters */);
379    /// ```
380    pub fn set_create_time<T>(mut self, v: T) -> Self
381    where
382        T: std::convert::Into<wkt::Timestamp>,
383    {
384        self.create_time = std::option::Option::Some(v.into());
385        self
386    }
387
388    /// Sets or clears the value of [create_time][crate::model::Function::create_time].
389    ///
390    /// # Example
391    /// ```ignore,no_run
392    /// # use google_cloud_functions_v2::model::Function;
393    /// use wkt::Timestamp;
394    /// let x = Function::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
395    /// let x = Function::new().set_or_clear_create_time(None::<Timestamp>);
396    /// ```
397    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
398    where
399        T: std::convert::Into<wkt::Timestamp>,
400    {
401        self.create_time = v.map(|x| x.into());
402        self
403    }
404}
405
406impl wkt::message::Message for Function {
407    fn typename() -> &'static str {
408        "type.googleapis.com/google.cloud.functions.v2.Function"
409    }
410}
411
412/// Defines additional types related to [Function].
413pub mod function {
414    #[allow(unused_imports)]
415    use super::*;
416
417    /// Describes the current state of the function.
418    ///
419    /// # Working with unknown values
420    ///
421    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
422    /// additional enum variants at any time. Adding new variants is not considered
423    /// a breaking change. Applications should write their code in anticipation of:
424    ///
425    /// - New values appearing in future releases of the client library, **and**
426    /// - New values received dynamically, without application changes.
427    ///
428    /// Please consult the [Working with enums] section in the user guide for some
429    /// guidelines.
430    ///
431    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
432    #[derive(Clone, Debug, PartialEq)]
433    #[non_exhaustive]
434    pub enum State {
435        /// Not specified. Invalid state.
436        Unspecified,
437        /// Function has been successfully deployed and is serving.
438        Active,
439        /// Function deployment failed and the function is not serving.
440        Failed,
441        /// Function is being created or updated.
442        Deploying,
443        /// Function is being deleted.
444        Deleting,
445        /// Function deployment failed and the function serving state is undefined.
446        /// The function should be updated or deleted to move it out of this state.
447        Unknown,
448        /// If set, the enum was initialized with an unknown value.
449        ///
450        /// Applications can examine the value using [State::value] or
451        /// [State::name].
452        UnknownValue(state::UnknownValue),
453    }
454
455    #[doc(hidden)]
456    pub mod state {
457        #[allow(unused_imports)]
458        use super::*;
459        #[derive(Clone, Debug, PartialEq)]
460        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
461    }
462
463    impl State {
464        /// Gets the enum value.
465        ///
466        /// Returns `None` if the enum contains an unknown value deserialized from
467        /// the string representation of enums.
468        pub fn value(&self) -> std::option::Option<i32> {
469            match self {
470                Self::Unspecified => std::option::Option::Some(0),
471                Self::Active => std::option::Option::Some(1),
472                Self::Failed => std::option::Option::Some(2),
473                Self::Deploying => std::option::Option::Some(3),
474                Self::Deleting => std::option::Option::Some(4),
475                Self::Unknown => std::option::Option::Some(5),
476                Self::UnknownValue(u) => u.0.value(),
477            }
478        }
479
480        /// Gets the enum value as a string.
481        ///
482        /// Returns `None` if the enum contains an unknown value deserialized from
483        /// the integer representation of enums.
484        pub fn name(&self) -> std::option::Option<&str> {
485            match self {
486                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
487                Self::Active => std::option::Option::Some("ACTIVE"),
488                Self::Failed => std::option::Option::Some("FAILED"),
489                Self::Deploying => std::option::Option::Some("DEPLOYING"),
490                Self::Deleting => std::option::Option::Some("DELETING"),
491                Self::Unknown => std::option::Option::Some("UNKNOWN"),
492                Self::UnknownValue(u) => u.0.name(),
493            }
494        }
495    }
496
497    impl std::default::Default for State {
498        fn default() -> Self {
499            use std::convert::From;
500            Self::from(0)
501        }
502    }
503
504    impl std::fmt::Display for State {
505        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
506            wkt::internal::display_enum(f, self.name(), self.value())
507        }
508    }
509
510    impl std::convert::From<i32> for State {
511        fn from(value: i32) -> Self {
512            match value {
513                0 => Self::Unspecified,
514                1 => Self::Active,
515                2 => Self::Failed,
516                3 => Self::Deploying,
517                4 => Self::Deleting,
518                5 => Self::Unknown,
519                _ => Self::UnknownValue(state::UnknownValue(
520                    wkt::internal::UnknownEnumValue::Integer(value),
521                )),
522            }
523        }
524    }
525
526    impl std::convert::From<&str> for State {
527        fn from(value: &str) -> Self {
528            use std::string::ToString;
529            match value {
530                "STATE_UNSPECIFIED" => Self::Unspecified,
531                "ACTIVE" => Self::Active,
532                "FAILED" => Self::Failed,
533                "DEPLOYING" => Self::Deploying,
534                "DELETING" => Self::Deleting,
535                "UNKNOWN" => Self::Unknown,
536                _ => Self::UnknownValue(state::UnknownValue(
537                    wkt::internal::UnknownEnumValue::String(value.to_string()),
538                )),
539            }
540        }
541    }
542
543    impl serde::ser::Serialize for State {
544        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
545        where
546            S: serde::Serializer,
547        {
548            match self {
549                Self::Unspecified => serializer.serialize_i32(0),
550                Self::Active => serializer.serialize_i32(1),
551                Self::Failed => serializer.serialize_i32(2),
552                Self::Deploying => serializer.serialize_i32(3),
553                Self::Deleting => serializer.serialize_i32(4),
554                Self::Unknown => serializer.serialize_i32(5),
555                Self::UnknownValue(u) => u.0.serialize(serializer),
556            }
557        }
558    }
559
560    impl<'de> serde::de::Deserialize<'de> for State {
561        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
562        where
563            D: serde::Deserializer<'de>,
564        {
565            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
566                ".google.cloud.functions.v2.Function.State",
567            ))
568        }
569    }
570}
571
572/// Informational messages about the state of the Cloud Function or Operation.
573#[derive(Clone, Default, PartialEq)]
574#[non_exhaustive]
575pub struct StateMessage {
576    /// Severity of the state message.
577    pub severity: crate::model::state_message::Severity,
578
579    /// One-word CamelCase type of the state message.
580    pub r#type: std::string::String,
581
582    /// The message.
583    pub message: std::string::String,
584
585    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
586}
587
588impl StateMessage {
589    /// Creates a new default instance.
590    pub fn new() -> Self {
591        std::default::Default::default()
592    }
593
594    /// Sets the value of [severity][crate::model::StateMessage::severity].
595    ///
596    /// # Example
597    /// ```ignore,no_run
598    /// # use google_cloud_functions_v2::model::StateMessage;
599    /// use google_cloud_functions_v2::model::state_message::Severity;
600    /// let x0 = StateMessage::new().set_severity(Severity::Error);
601    /// let x1 = StateMessage::new().set_severity(Severity::Warning);
602    /// let x2 = StateMessage::new().set_severity(Severity::Info);
603    /// ```
604    pub fn set_severity<T: std::convert::Into<crate::model::state_message::Severity>>(
605        mut self,
606        v: T,
607    ) -> Self {
608        self.severity = v.into();
609        self
610    }
611
612    /// Sets the value of [r#type][crate::model::StateMessage::type].
613    ///
614    /// # Example
615    /// ```ignore,no_run
616    /// # use google_cloud_functions_v2::model::StateMessage;
617    /// let x = StateMessage::new().set_type("example");
618    /// ```
619    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
620        self.r#type = v.into();
621        self
622    }
623
624    /// Sets the value of [message][crate::model::StateMessage::message].
625    ///
626    /// # Example
627    /// ```ignore,no_run
628    /// # use google_cloud_functions_v2::model::StateMessage;
629    /// let x = StateMessage::new().set_message("example");
630    /// ```
631    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
632        self.message = v.into();
633        self
634    }
635}
636
637impl wkt::message::Message for StateMessage {
638    fn typename() -> &'static str {
639        "type.googleapis.com/google.cloud.functions.v2.StateMessage"
640    }
641}
642
643/// Defines additional types related to [StateMessage].
644pub mod state_message {
645    #[allow(unused_imports)]
646    use super::*;
647
648    /// Severity of the state message.
649    ///
650    /// # Working with unknown values
651    ///
652    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
653    /// additional enum variants at any time. Adding new variants is not considered
654    /// a breaking change. Applications should write their code in anticipation of:
655    ///
656    /// - New values appearing in future releases of the client library, **and**
657    /// - New values received dynamically, without application changes.
658    ///
659    /// Please consult the [Working with enums] section in the user guide for some
660    /// guidelines.
661    ///
662    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
663    #[derive(Clone, Debug, PartialEq)]
664    #[non_exhaustive]
665    pub enum Severity {
666        /// Not specified. Invalid severity.
667        Unspecified,
668        /// ERROR-level severity.
669        Error,
670        /// WARNING-level severity.
671        Warning,
672        /// INFO-level severity.
673        Info,
674        /// If set, the enum was initialized with an unknown value.
675        ///
676        /// Applications can examine the value using [Severity::value] or
677        /// [Severity::name].
678        UnknownValue(severity::UnknownValue),
679    }
680
681    #[doc(hidden)]
682    pub mod severity {
683        #[allow(unused_imports)]
684        use super::*;
685        #[derive(Clone, Debug, PartialEq)]
686        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
687    }
688
689    impl Severity {
690        /// Gets the enum value.
691        ///
692        /// Returns `None` if the enum contains an unknown value deserialized from
693        /// the string representation of enums.
694        pub fn value(&self) -> std::option::Option<i32> {
695            match self {
696                Self::Unspecified => std::option::Option::Some(0),
697                Self::Error => std::option::Option::Some(1),
698                Self::Warning => std::option::Option::Some(2),
699                Self::Info => std::option::Option::Some(3),
700                Self::UnknownValue(u) => u.0.value(),
701            }
702        }
703
704        /// Gets the enum value as a string.
705        ///
706        /// Returns `None` if the enum contains an unknown value deserialized from
707        /// the integer representation of enums.
708        pub fn name(&self) -> std::option::Option<&str> {
709            match self {
710                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
711                Self::Error => std::option::Option::Some("ERROR"),
712                Self::Warning => std::option::Option::Some("WARNING"),
713                Self::Info => std::option::Option::Some("INFO"),
714                Self::UnknownValue(u) => u.0.name(),
715            }
716        }
717    }
718
719    impl std::default::Default for Severity {
720        fn default() -> Self {
721            use std::convert::From;
722            Self::from(0)
723        }
724    }
725
726    impl std::fmt::Display for Severity {
727        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
728            wkt::internal::display_enum(f, self.name(), self.value())
729        }
730    }
731
732    impl std::convert::From<i32> for Severity {
733        fn from(value: i32) -> Self {
734            match value {
735                0 => Self::Unspecified,
736                1 => Self::Error,
737                2 => Self::Warning,
738                3 => Self::Info,
739                _ => Self::UnknownValue(severity::UnknownValue(
740                    wkt::internal::UnknownEnumValue::Integer(value),
741                )),
742            }
743        }
744    }
745
746    impl std::convert::From<&str> for Severity {
747        fn from(value: &str) -> Self {
748            use std::string::ToString;
749            match value {
750                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
751                "ERROR" => Self::Error,
752                "WARNING" => Self::Warning,
753                "INFO" => Self::Info,
754                _ => Self::UnknownValue(severity::UnknownValue(
755                    wkt::internal::UnknownEnumValue::String(value.to_string()),
756                )),
757            }
758        }
759    }
760
761    impl serde::ser::Serialize for Severity {
762        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
763        where
764            S: serde::Serializer,
765        {
766            match self {
767                Self::Unspecified => serializer.serialize_i32(0),
768                Self::Error => serializer.serialize_i32(1),
769                Self::Warning => serializer.serialize_i32(2),
770                Self::Info => serializer.serialize_i32(3),
771                Self::UnknownValue(u) => u.0.serialize(serializer),
772            }
773        }
774    }
775
776    impl<'de> serde::de::Deserialize<'de> for Severity {
777        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
778        where
779            D: serde::Deserializer<'de>,
780        {
781            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
782                ".google.cloud.functions.v2.StateMessage.Severity",
783            ))
784        }
785    }
786}
787
788/// Location of the source in an archive file in Google Cloud Storage.
789#[derive(Clone, Default, PartialEq)]
790#[non_exhaustive]
791pub struct StorageSource {
792    /// Google Cloud Storage bucket containing the source (see
793    /// [Bucket Name
794    /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
795    pub bucket: std::string::String,
796
797    /// Google Cloud Storage object containing the source.
798    ///
799    /// This object must be a gzipped archive file (`.tar.gz`) containing source to
800    /// build.
801    pub object: std::string::String,
802
803    /// Google Cloud Storage generation for the object. If the generation is
804    /// omitted, the latest generation will be used.
805    pub generation: i64,
806
807    /// When the specified storage bucket is a 1st gen function uploard url bucket,
808    /// this field should be set as the generated upload url for 1st gen
809    /// deployment.
810    pub source_upload_url: std::string::String,
811
812    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
813}
814
815impl StorageSource {
816    /// Creates a new default instance.
817    pub fn new() -> Self {
818        std::default::Default::default()
819    }
820
821    /// Sets the value of [bucket][crate::model::StorageSource::bucket].
822    ///
823    /// # Example
824    /// ```ignore,no_run
825    /// # use google_cloud_functions_v2::model::StorageSource;
826    /// let x = StorageSource::new().set_bucket("example");
827    /// ```
828    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
829        self.bucket = v.into();
830        self
831    }
832
833    /// Sets the value of [object][crate::model::StorageSource::object].
834    ///
835    /// # Example
836    /// ```ignore,no_run
837    /// # use google_cloud_functions_v2::model::StorageSource;
838    /// let x = StorageSource::new().set_object("example");
839    /// ```
840    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
841        self.object = v.into();
842        self
843    }
844
845    /// Sets the value of [generation][crate::model::StorageSource::generation].
846    ///
847    /// # Example
848    /// ```ignore,no_run
849    /// # use google_cloud_functions_v2::model::StorageSource;
850    /// let x = StorageSource::new().set_generation(42);
851    /// ```
852    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
853        self.generation = v.into();
854        self
855    }
856
857    /// Sets the value of [source_upload_url][crate::model::StorageSource::source_upload_url].
858    ///
859    /// # Example
860    /// ```ignore,no_run
861    /// # use google_cloud_functions_v2::model::StorageSource;
862    /// let x = StorageSource::new().set_source_upload_url("example");
863    /// ```
864    pub fn set_source_upload_url<T: std::convert::Into<std::string::String>>(
865        mut self,
866        v: T,
867    ) -> Self {
868        self.source_upload_url = v.into();
869        self
870    }
871}
872
873impl wkt::message::Message for StorageSource {
874    fn typename() -> &'static str {
875        "type.googleapis.com/google.cloud.functions.v2.StorageSource"
876    }
877}
878
879/// Location of the source in a Google Cloud Source Repository.
880#[derive(Clone, Default, PartialEq)]
881#[non_exhaustive]
882pub struct RepoSource {
883    /// ID of the project that owns the Cloud Source Repository. If omitted, the
884    /// project ID requesting the build is assumed.
885    pub project_id: std::string::String,
886
887    /// Name of the Cloud Source Repository.
888    pub repo_name: std::string::String,
889
890    /// Directory, relative to the source root, in which to run the build.
891    ///
892    /// This must be a relative path. If a step's `dir` is specified and is an
893    /// absolute path, this value is ignored for that step's execution.
894    /// eg. helloworld (no leading slash allowed)
895    pub dir: std::string::String,
896
897    /// Only trigger a build if the revision regex does NOT match the revision
898    /// regex.
899    pub invert_regex: bool,
900
901    /// A revision within the Cloud Source Repository must be specified in
902    /// one of these ways.
903    pub revision: std::option::Option<crate::model::repo_source::Revision>,
904
905    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
906}
907
908impl RepoSource {
909    /// Creates a new default instance.
910    pub fn new() -> Self {
911        std::default::Default::default()
912    }
913
914    /// Sets the value of [project_id][crate::model::RepoSource::project_id].
915    ///
916    /// # Example
917    /// ```ignore,no_run
918    /// # use google_cloud_functions_v2::model::RepoSource;
919    /// let x = RepoSource::new().set_project_id("example");
920    /// ```
921    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
922        self.project_id = v.into();
923        self
924    }
925
926    /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
927    ///
928    /// # Example
929    /// ```ignore,no_run
930    /// # use google_cloud_functions_v2::model::RepoSource;
931    /// let x = RepoSource::new().set_repo_name("example");
932    /// ```
933    pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
934        self.repo_name = v.into();
935        self
936    }
937
938    /// Sets the value of [dir][crate::model::RepoSource::dir].
939    ///
940    /// # Example
941    /// ```ignore,no_run
942    /// # use google_cloud_functions_v2::model::RepoSource;
943    /// let x = RepoSource::new().set_dir("example");
944    /// ```
945    pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
946        self.dir = v.into();
947        self
948    }
949
950    /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
951    ///
952    /// # Example
953    /// ```ignore,no_run
954    /// # use google_cloud_functions_v2::model::RepoSource;
955    /// let x = RepoSource::new().set_invert_regex(true);
956    /// ```
957    pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
958        self.invert_regex = v.into();
959        self
960    }
961
962    /// Sets the value of [revision][crate::model::RepoSource::revision].
963    ///
964    /// Note that all the setters affecting `revision` are mutually
965    /// exclusive.
966    ///
967    /// # Example
968    /// ```ignore,no_run
969    /// # use google_cloud_functions_v2::model::RepoSource;
970    /// use google_cloud_functions_v2::model::repo_source::Revision;
971    /// let x = RepoSource::new().set_revision(Some(Revision::BranchName("example".to_string())));
972    /// ```
973    pub fn set_revision<
974        T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
975    >(
976        mut self,
977        v: T,
978    ) -> Self {
979        self.revision = v.into();
980        self
981    }
982
983    /// The value of [revision][crate::model::RepoSource::revision]
984    /// if it holds a `BranchName`, `None` if the field is not set or
985    /// holds a different branch.
986    pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
987        #[allow(unreachable_patterns)]
988        self.revision.as_ref().and_then(|v| match v {
989            crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
990            _ => std::option::Option::None,
991        })
992    }
993
994    /// Sets the value of [revision][crate::model::RepoSource::revision]
995    /// to hold a `BranchName`.
996    ///
997    /// Note that all the setters affecting `revision` are
998    /// mutually exclusive.
999    ///
1000    /// # Example
1001    /// ```ignore,no_run
1002    /// # use google_cloud_functions_v2::model::RepoSource;
1003    /// let x = RepoSource::new().set_branch_name("example");
1004    /// assert!(x.branch_name().is_some());
1005    /// assert!(x.tag_name().is_none());
1006    /// assert!(x.commit_sha().is_none());
1007    /// ```
1008    pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1009        self.revision =
1010            std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
1011        self
1012    }
1013
1014    /// The value of [revision][crate::model::RepoSource::revision]
1015    /// if it holds a `TagName`, `None` if the field is not set or
1016    /// holds a different branch.
1017    pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
1018        #[allow(unreachable_patterns)]
1019        self.revision.as_ref().and_then(|v| match v {
1020            crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
1021            _ => std::option::Option::None,
1022        })
1023    }
1024
1025    /// Sets the value of [revision][crate::model::RepoSource::revision]
1026    /// to hold a `TagName`.
1027    ///
1028    /// Note that all the setters affecting `revision` are
1029    /// mutually exclusive.
1030    ///
1031    /// # Example
1032    /// ```ignore,no_run
1033    /// # use google_cloud_functions_v2::model::RepoSource;
1034    /// let x = RepoSource::new().set_tag_name("example");
1035    /// assert!(x.tag_name().is_some());
1036    /// assert!(x.branch_name().is_none());
1037    /// assert!(x.commit_sha().is_none());
1038    /// ```
1039    pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1040        self.revision =
1041            std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
1042        self
1043    }
1044
1045    /// The value of [revision][crate::model::RepoSource::revision]
1046    /// if it holds a `CommitSha`, `None` if the field is not set or
1047    /// holds a different branch.
1048    pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
1049        #[allow(unreachable_patterns)]
1050        self.revision.as_ref().and_then(|v| match v {
1051            crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
1052            _ => std::option::Option::None,
1053        })
1054    }
1055
1056    /// Sets the value of [revision][crate::model::RepoSource::revision]
1057    /// to hold a `CommitSha`.
1058    ///
1059    /// Note that all the setters affecting `revision` are
1060    /// mutually exclusive.
1061    ///
1062    /// # Example
1063    /// ```ignore,no_run
1064    /// # use google_cloud_functions_v2::model::RepoSource;
1065    /// let x = RepoSource::new().set_commit_sha("example");
1066    /// assert!(x.commit_sha().is_some());
1067    /// assert!(x.branch_name().is_none());
1068    /// assert!(x.tag_name().is_none());
1069    /// ```
1070    pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1071        self.revision =
1072            std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
1073        self
1074    }
1075}
1076
1077impl wkt::message::Message for RepoSource {
1078    fn typename() -> &'static str {
1079        "type.googleapis.com/google.cloud.functions.v2.RepoSource"
1080    }
1081}
1082
1083/// Defines additional types related to [RepoSource].
1084pub mod repo_source {
1085    #[allow(unused_imports)]
1086    use super::*;
1087
1088    /// A revision within the Cloud Source Repository must be specified in
1089    /// one of these ways.
1090    #[derive(Clone, Debug, PartialEq)]
1091    #[non_exhaustive]
1092    pub enum Revision {
1093        /// Regex matching branches to build.
1094        ///
1095        /// The syntax of the regular expressions accepted is the syntax accepted by
1096        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1097        BranchName(std::string::String),
1098        /// Regex matching tags to build.
1099        ///
1100        /// The syntax of the regular expressions accepted is the syntax accepted by
1101        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
1102        TagName(std::string::String),
1103        /// Explicit commit SHA to build.
1104        CommitSha(std::string::String),
1105    }
1106}
1107
1108/// The location of the function source code.
1109#[derive(Clone, Default, PartialEq)]
1110#[non_exhaustive]
1111pub struct Source {
1112    /// Location of the source.
1113    /// At least one source needs to be provided for the deployment to succeed.
1114    pub source: std::option::Option<crate::model::source::Source>,
1115
1116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1117}
1118
1119impl Source {
1120    /// Creates a new default instance.
1121    pub fn new() -> Self {
1122        std::default::Default::default()
1123    }
1124
1125    /// Sets the value of [source][crate::model::Source::source].
1126    ///
1127    /// Note that all the setters affecting `source` are mutually
1128    /// exclusive.
1129    ///
1130    /// # Example
1131    /// ```ignore,no_run
1132    /// # use google_cloud_functions_v2::model::Source;
1133    /// use google_cloud_functions_v2::model::source::Source as SourceOneOf;
1134    /// let x = Source::new().set_source(Some(SourceOneOf::GitUri("example".to_string())));
1135    /// ```
1136    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
1137        mut self,
1138        v: T,
1139    ) -> Self {
1140        self.source = v.into();
1141        self
1142    }
1143
1144    /// The value of [source][crate::model::Source::source]
1145    /// if it holds a `StorageSource`, `None` if the field is not set or
1146    /// holds a different branch.
1147    pub fn storage_source(
1148        &self,
1149    ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
1150        #[allow(unreachable_patterns)]
1151        self.source.as_ref().and_then(|v| match v {
1152            crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
1153            _ => std::option::Option::None,
1154        })
1155    }
1156
1157    /// Sets the value of [source][crate::model::Source::source]
1158    /// to hold a `StorageSource`.
1159    ///
1160    /// Note that all the setters affecting `source` are
1161    /// mutually exclusive.
1162    ///
1163    /// # Example
1164    /// ```ignore,no_run
1165    /// # use google_cloud_functions_v2::model::Source;
1166    /// use google_cloud_functions_v2::model::StorageSource;
1167    /// let x = Source::new().set_storage_source(StorageSource::default()/* use setters */);
1168    /// assert!(x.storage_source().is_some());
1169    /// assert!(x.repo_source().is_none());
1170    /// assert!(x.git_uri().is_none());
1171    /// ```
1172    pub fn set_storage_source<
1173        T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
1174    >(
1175        mut self,
1176        v: T,
1177    ) -> Self {
1178        self.source =
1179            std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
1180        self
1181    }
1182
1183    /// The value of [source][crate::model::Source::source]
1184    /// if it holds a `RepoSource`, `None` if the field is not set or
1185    /// holds a different branch.
1186    pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
1187        #[allow(unreachable_patterns)]
1188        self.source.as_ref().and_then(|v| match v {
1189            crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
1190            _ => std::option::Option::None,
1191        })
1192    }
1193
1194    /// Sets the value of [source][crate::model::Source::source]
1195    /// to hold a `RepoSource`.
1196    ///
1197    /// Note that all the setters affecting `source` are
1198    /// mutually exclusive.
1199    ///
1200    /// # Example
1201    /// ```ignore,no_run
1202    /// # use google_cloud_functions_v2::model::Source;
1203    /// use google_cloud_functions_v2::model::RepoSource;
1204    /// let x = Source::new().set_repo_source(RepoSource::default()/* use setters */);
1205    /// assert!(x.repo_source().is_some());
1206    /// assert!(x.storage_source().is_none());
1207    /// assert!(x.git_uri().is_none());
1208    /// ```
1209    pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
1210        mut self,
1211        v: T,
1212    ) -> Self {
1213        self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
1214        self
1215    }
1216
1217    /// The value of [source][crate::model::Source::source]
1218    /// if it holds a `GitUri`, `None` if the field is not set or
1219    /// holds a different branch.
1220    pub fn git_uri(&self) -> std::option::Option<&std::string::String> {
1221        #[allow(unreachable_patterns)]
1222        self.source.as_ref().and_then(|v| match v {
1223            crate::model::source::Source::GitUri(v) => std::option::Option::Some(v),
1224            _ => std::option::Option::None,
1225        })
1226    }
1227
1228    /// Sets the value of [source][crate::model::Source::source]
1229    /// to hold a `GitUri`.
1230    ///
1231    /// Note that all the setters affecting `source` are
1232    /// mutually exclusive.
1233    ///
1234    /// # Example
1235    /// ```ignore,no_run
1236    /// # use google_cloud_functions_v2::model::Source;
1237    /// let x = Source::new().set_git_uri("example");
1238    /// assert!(x.git_uri().is_some());
1239    /// assert!(x.storage_source().is_none());
1240    /// assert!(x.repo_source().is_none());
1241    /// ```
1242    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1243        self.source = std::option::Option::Some(crate::model::source::Source::GitUri(v.into()));
1244        self
1245    }
1246}
1247
1248impl wkt::message::Message for Source {
1249    fn typename() -> &'static str {
1250        "type.googleapis.com/google.cloud.functions.v2.Source"
1251    }
1252}
1253
1254/// Defines additional types related to [Source].
1255pub mod source {
1256    #[allow(unused_imports)]
1257    use super::*;
1258
1259    /// Location of the source.
1260    /// At least one source needs to be provided for the deployment to succeed.
1261    #[derive(Clone, Debug, PartialEq)]
1262    #[non_exhaustive]
1263    pub enum Source {
1264        /// If provided, get the source from this location in Google Cloud Storage.
1265        StorageSource(std::boxed::Box<crate::model::StorageSource>),
1266        /// If provided, get the source from this location in a Cloud Source
1267        /// Repository.
1268        RepoSource(std::boxed::Box<crate::model::RepoSource>),
1269        /// If provided, get the source from GitHub repository. This option is valid
1270        /// only for GCF 1st Gen function.
1271        /// Example: <https://github.com/>\<user\>/\<repo\>/blob/\<commit\>/\<path-to-code\>
1272        GitUri(std::string::String),
1273    }
1274}
1275
1276/// Provenance of the source. Ways to find the original source, or verify that
1277/// some source was used for this build.
1278#[derive(Clone, Default, PartialEq)]
1279#[non_exhaustive]
1280pub struct SourceProvenance {
1281    /// A copy of the build's `source.storage_source`, if exists, with any
1282    /// generations resolved.
1283    pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
1284
1285    /// A copy of the build's `source.repo_source`, if exists, with any
1286    /// revisions resolved.
1287    pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
1288
1289    /// A copy of the build's `source.git_uri`, if exists, with any commits
1290    /// resolved.
1291    pub git_uri: std::string::String,
1292
1293    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1294}
1295
1296impl SourceProvenance {
1297    /// Creates a new default instance.
1298    pub fn new() -> Self {
1299        std::default::Default::default()
1300    }
1301
1302    /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
1303    ///
1304    /// # Example
1305    /// ```ignore,no_run
1306    /// # use google_cloud_functions_v2::model::SourceProvenance;
1307    /// use google_cloud_functions_v2::model::StorageSource;
1308    /// let x = SourceProvenance::new().set_resolved_storage_source(StorageSource::default()/* use setters */);
1309    /// ```
1310    pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
1311    where
1312        T: std::convert::Into<crate::model::StorageSource>,
1313    {
1314        self.resolved_storage_source = std::option::Option::Some(v.into());
1315        self
1316    }
1317
1318    /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
1319    ///
1320    /// # Example
1321    /// ```ignore,no_run
1322    /// # use google_cloud_functions_v2::model::SourceProvenance;
1323    /// use google_cloud_functions_v2::model::StorageSource;
1324    /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(Some(StorageSource::default()/* use setters */));
1325    /// let x = SourceProvenance::new().set_or_clear_resolved_storage_source(None::<StorageSource>);
1326    /// ```
1327    pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
1328    where
1329        T: std::convert::Into<crate::model::StorageSource>,
1330    {
1331        self.resolved_storage_source = v.map(|x| x.into());
1332        self
1333    }
1334
1335    /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
1336    ///
1337    /// # Example
1338    /// ```ignore,no_run
1339    /// # use google_cloud_functions_v2::model::SourceProvenance;
1340    /// use google_cloud_functions_v2::model::RepoSource;
1341    /// let x = SourceProvenance::new().set_resolved_repo_source(RepoSource::default()/* use setters */);
1342    /// ```
1343    pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
1344    where
1345        T: std::convert::Into<crate::model::RepoSource>,
1346    {
1347        self.resolved_repo_source = std::option::Option::Some(v.into());
1348        self
1349    }
1350
1351    /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
1352    ///
1353    /// # Example
1354    /// ```ignore,no_run
1355    /// # use google_cloud_functions_v2::model::SourceProvenance;
1356    /// use google_cloud_functions_v2::model::RepoSource;
1357    /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(Some(RepoSource::default()/* use setters */));
1358    /// let x = SourceProvenance::new().set_or_clear_resolved_repo_source(None::<RepoSource>);
1359    /// ```
1360    pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
1361    where
1362        T: std::convert::Into<crate::model::RepoSource>,
1363    {
1364        self.resolved_repo_source = v.map(|x| x.into());
1365        self
1366    }
1367
1368    /// Sets the value of [git_uri][crate::model::SourceProvenance::git_uri].
1369    ///
1370    /// # Example
1371    /// ```ignore,no_run
1372    /// # use google_cloud_functions_v2::model::SourceProvenance;
1373    /// let x = SourceProvenance::new().set_git_uri("example");
1374    /// ```
1375    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1376        self.git_uri = v.into();
1377        self
1378    }
1379}
1380
1381impl wkt::message::Message for SourceProvenance {
1382    fn typename() -> &'static str {
1383        "type.googleapis.com/google.cloud.functions.v2.SourceProvenance"
1384    }
1385}
1386
1387/// Describes the Build step of the function that builds a container from the
1388/// given source.
1389#[derive(Clone, Default, PartialEq)]
1390#[non_exhaustive]
1391pub struct BuildConfig {
1392    /// Output only. The Cloud Build name of the latest successful deployment of
1393    /// the function.
1394    pub build: std::string::String,
1395
1396    /// The runtime in which to run the function. Required when deploying a new
1397    /// function, optional when updating an existing function. For a complete
1398    /// list of possible choices, see the
1399    /// [`gcloud` command
1400    /// reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
1401    pub runtime: std::string::String,
1402
1403    /// The name of the function (as defined in source code) that will be
1404    /// executed. Defaults to the resource name suffix, if not specified. For
1405    /// backward compatibility, if function with given name is not found, then the
1406    /// system will try to use function named "function".
1407    /// For Node.js this is name of a function exported by the module specified
1408    /// in `source_location`.
1409    pub entry_point: std::string::String,
1410
1411    /// The location of the function source code.
1412    pub source: std::option::Option<crate::model::Source>,
1413
1414    /// Output only. A permanent fixed identifier for source.
1415    pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
1416
1417    /// Name of the Cloud Build Custom Worker Pool that should be used to build the
1418    /// function. The format of this field is
1419    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
1420    /// {project} and {region} are the project id and region respectively where the
1421    /// worker pool is defined and {workerPool} is the short name of the worker
1422    /// pool.
1423    ///
1424    /// If the project id is not the same as the function, then the Cloud
1425    /// Functions Service Agent
1426    /// (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
1427    /// granted the role Cloud Build Custom Workers Builder
1428    /// (roles/cloudbuild.customworkers.builder) in the project.
1429    pub worker_pool: std::string::String,
1430
1431    /// User-provided build-time environment variables for the function
1432    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
1433
1434    /// Docker Registry to use for this deployment. This configuration is only
1435    /// applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
1436    /// Registry.
1437    /// Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
1438    /// available in response to Container Registry's deprecation:
1439    /// <https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
1440    /// Please use Artifact Registry instead, which is the default choice.
1441    ///
1442    /// If unspecified, it defaults to `ARTIFACT_REGISTRY`.
1443    /// If `docker_repository` field is specified, this field should either be left
1444    /// unspecified or set to `ARTIFACT_REGISTRY`.
1445    #[deprecated]
1446    pub docker_registry: crate::model::build_config::DockerRegistry,
1447
1448    /// Repository in Artifact Registry to which the function docker image will be
1449    /// pushed after it is built by Cloud Build. If specified by user, it is
1450    /// created and managed by user with a customer managed encryption key.
1451    /// Otherwise, GCF will create and use a repository named 'gcf-artifacts'
1452    /// for every deployed region.
1453    ///
1454    /// It must match the pattern
1455    /// `projects/{project}/locations/{location}/repositories/{repository}`.
1456    /// Repository format must be 'DOCKER'.
1457    pub docker_repository: std::string::String,
1458
1459    /// Service account to be used for building the container. The format of this
1460    /// field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
1461    pub service_account: std::string::String,
1462
1463    /// This controls when security patches are applied to the runtime environment.
1464    pub runtime_update_policy: std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>,
1465
1466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1467}
1468
1469impl BuildConfig {
1470    /// Creates a new default instance.
1471    pub fn new() -> Self {
1472        std::default::Default::default()
1473    }
1474
1475    /// Sets the value of [build][crate::model::BuildConfig::build].
1476    ///
1477    /// # Example
1478    /// ```ignore,no_run
1479    /// # use google_cloud_functions_v2::model::BuildConfig;
1480    /// let x = BuildConfig::new().set_build("example");
1481    /// ```
1482    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1483        self.build = v.into();
1484        self
1485    }
1486
1487    /// Sets the value of [runtime][crate::model::BuildConfig::runtime].
1488    ///
1489    /// # Example
1490    /// ```ignore,no_run
1491    /// # use google_cloud_functions_v2::model::BuildConfig;
1492    /// let x = BuildConfig::new().set_runtime("example");
1493    /// ```
1494    pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1495        self.runtime = v.into();
1496        self
1497    }
1498
1499    /// Sets the value of [entry_point][crate::model::BuildConfig::entry_point].
1500    ///
1501    /// # Example
1502    /// ```ignore,no_run
1503    /// # use google_cloud_functions_v2::model::BuildConfig;
1504    /// let x = BuildConfig::new().set_entry_point("example");
1505    /// ```
1506    pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1507        self.entry_point = v.into();
1508        self
1509    }
1510
1511    /// Sets the value of [source][crate::model::BuildConfig::source].
1512    ///
1513    /// # Example
1514    /// ```ignore,no_run
1515    /// # use google_cloud_functions_v2::model::BuildConfig;
1516    /// use google_cloud_functions_v2::model::Source;
1517    /// let x = BuildConfig::new().set_source(Source::default()/* use setters */);
1518    /// ```
1519    pub fn set_source<T>(mut self, v: T) -> Self
1520    where
1521        T: std::convert::Into<crate::model::Source>,
1522    {
1523        self.source = std::option::Option::Some(v.into());
1524        self
1525    }
1526
1527    /// Sets or clears the value of [source][crate::model::BuildConfig::source].
1528    ///
1529    /// # Example
1530    /// ```ignore,no_run
1531    /// # use google_cloud_functions_v2::model::BuildConfig;
1532    /// use google_cloud_functions_v2::model::Source;
1533    /// let x = BuildConfig::new().set_or_clear_source(Some(Source::default()/* use setters */));
1534    /// let x = BuildConfig::new().set_or_clear_source(None::<Source>);
1535    /// ```
1536    pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
1537    where
1538        T: std::convert::Into<crate::model::Source>,
1539    {
1540        self.source = v.map(|x| x.into());
1541        self
1542    }
1543
1544    /// Sets the value of [source_provenance][crate::model::BuildConfig::source_provenance].
1545    ///
1546    /// # Example
1547    /// ```ignore,no_run
1548    /// # use google_cloud_functions_v2::model::BuildConfig;
1549    /// use google_cloud_functions_v2::model::SourceProvenance;
1550    /// let x = BuildConfig::new().set_source_provenance(SourceProvenance::default()/* use setters */);
1551    /// ```
1552    pub fn set_source_provenance<T>(mut self, v: T) -> Self
1553    where
1554        T: std::convert::Into<crate::model::SourceProvenance>,
1555    {
1556        self.source_provenance = std::option::Option::Some(v.into());
1557        self
1558    }
1559
1560    /// Sets or clears the value of [source_provenance][crate::model::BuildConfig::source_provenance].
1561    ///
1562    /// # Example
1563    /// ```ignore,no_run
1564    /// # use google_cloud_functions_v2::model::BuildConfig;
1565    /// use google_cloud_functions_v2::model::SourceProvenance;
1566    /// let x = BuildConfig::new().set_or_clear_source_provenance(Some(SourceProvenance::default()/* use setters */));
1567    /// let x = BuildConfig::new().set_or_clear_source_provenance(None::<SourceProvenance>);
1568    /// ```
1569    pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1570    where
1571        T: std::convert::Into<crate::model::SourceProvenance>,
1572    {
1573        self.source_provenance = v.map(|x| x.into());
1574        self
1575    }
1576
1577    /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
1578    ///
1579    /// # Example
1580    /// ```ignore,no_run
1581    /// # use google_cloud_functions_v2::model::BuildConfig;
1582    /// let x = BuildConfig::new().set_worker_pool("example");
1583    /// ```
1584    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1585        self.worker_pool = v.into();
1586        self
1587    }
1588
1589    /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
1590    ///
1591    /// # Example
1592    /// ```ignore,no_run
1593    /// # use google_cloud_functions_v2::model::BuildConfig;
1594    /// let x = BuildConfig::new().set_environment_variables([
1595    ///     ("key0", "abc"),
1596    ///     ("key1", "xyz"),
1597    /// ]);
1598    /// ```
1599    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
1600    where
1601        T: std::iter::IntoIterator<Item = (K, V)>,
1602        K: std::convert::Into<std::string::String>,
1603        V: std::convert::Into<std::string::String>,
1604    {
1605        use std::iter::Iterator;
1606        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1607        self
1608    }
1609
1610    /// Sets the value of [docker_registry][crate::model::BuildConfig::docker_registry].
1611    ///
1612    /// # Example
1613    /// ```ignore,no_run
1614    /// # use google_cloud_functions_v2::model::BuildConfig;
1615    /// use google_cloud_functions_v2::model::build_config::DockerRegistry;
1616    /// let x0 = BuildConfig::new().set_docker_registry(DockerRegistry::ContainerRegistry);
1617    /// let x1 = BuildConfig::new().set_docker_registry(DockerRegistry::ArtifactRegistry);
1618    /// ```
1619    #[deprecated]
1620    pub fn set_docker_registry<
1621        T: std::convert::Into<crate::model::build_config::DockerRegistry>,
1622    >(
1623        mut self,
1624        v: T,
1625    ) -> Self {
1626        self.docker_registry = v.into();
1627        self
1628    }
1629
1630    /// Sets the value of [docker_repository][crate::model::BuildConfig::docker_repository].
1631    ///
1632    /// # Example
1633    /// ```ignore,no_run
1634    /// # use google_cloud_functions_v2::model::BuildConfig;
1635    /// let x = BuildConfig::new().set_docker_repository("example");
1636    /// ```
1637    pub fn set_docker_repository<T: std::convert::Into<std::string::String>>(
1638        mut self,
1639        v: T,
1640    ) -> Self {
1641        self.docker_repository = v.into();
1642        self
1643    }
1644
1645    /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
1646    ///
1647    /// # Example
1648    /// ```ignore,no_run
1649    /// # use google_cloud_functions_v2::model::BuildConfig;
1650    /// let x = BuildConfig::new().set_service_account("example");
1651    /// ```
1652    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1653        self.service_account = v.into();
1654        self
1655    }
1656
1657    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy].
1658    ///
1659    /// Note that all the setters affecting `runtime_update_policy` are mutually
1660    /// exclusive.
1661    ///
1662    /// # Example
1663    /// ```ignore,no_run
1664    /// # use google_cloud_functions_v2::model::BuildConfig;
1665    /// use google_cloud_functions_v2::model::AutomaticUpdatePolicy;
1666    /// let x = BuildConfig::new().set_runtime_update_policy(Some(
1667    ///     google_cloud_functions_v2::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(AutomaticUpdatePolicy::default().into())));
1668    /// ```
1669    pub fn set_runtime_update_policy<
1670        T: std::convert::Into<std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>>,
1671    >(
1672        mut self,
1673        v: T,
1674    ) -> Self {
1675        self.runtime_update_policy = v.into();
1676        self
1677    }
1678
1679    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
1680    /// if it holds a `AutomaticUpdatePolicy`, `None` if the field is not set or
1681    /// holds a different branch.
1682    pub fn automatic_update_policy(
1683        &self,
1684    ) -> std::option::Option<&std::boxed::Box<crate::model::AutomaticUpdatePolicy>> {
1685        #[allow(unreachable_patterns)]
1686        self.runtime_update_policy.as_ref().and_then(|v| match v {
1687            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v) => {
1688                std::option::Option::Some(v)
1689            }
1690            _ => std::option::Option::None,
1691        })
1692    }
1693
1694    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
1695    /// to hold a `AutomaticUpdatePolicy`.
1696    ///
1697    /// Note that all the setters affecting `runtime_update_policy` are
1698    /// mutually exclusive.
1699    ///
1700    /// # Example
1701    /// ```ignore,no_run
1702    /// # use google_cloud_functions_v2::model::BuildConfig;
1703    /// use google_cloud_functions_v2::model::AutomaticUpdatePolicy;
1704    /// let x = BuildConfig::new().set_automatic_update_policy(AutomaticUpdatePolicy::default()/* use setters */);
1705    /// assert!(x.automatic_update_policy().is_some());
1706    /// assert!(x.on_deploy_update_policy().is_none());
1707    /// ```
1708    pub fn set_automatic_update_policy<
1709        T: std::convert::Into<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>,
1710    >(
1711        mut self,
1712        v: T,
1713    ) -> Self {
1714        self.runtime_update_policy = std::option::Option::Some(
1715            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v.into()),
1716        );
1717        self
1718    }
1719
1720    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
1721    /// if it holds a `OnDeployUpdatePolicy`, `None` if the field is not set or
1722    /// holds a different branch.
1723    pub fn on_deploy_update_policy(
1724        &self,
1725    ) -> std::option::Option<&std::boxed::Box<crate::model::OnDeployUpdatePolicy>> {
1726        #[allow(unreachable_patterns)]
1727        self.runtime_update_policy.as_ref().and_then(|v| match v {
1728            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v) => {
1729                std::option::Option::Some(v)
1730            }
1731            _ => std::option::Option::None,
1732        })
1733    }
1734
1735    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
1736    /// to hold a `OnDeployUpdatePolicy`.
1737    ///
1738    /// Note that all the setters affecting `runtime_update_policy` are
1739    /// mutually exclusive.
1740    ///
1741    /// # Example
1742    /// ```ignore,no_run
1743    /// # use google_cloud_functions_v2::model::BuildConfig;
1744    /// use google_cloud_functions_v2::model::OnDeployUpdatePolicy;
1745    /// let x = BuildConfig::new().set_on_deploy_update_policy(OnDeployUpdatePolicy::default()/* use setters */);
1746    /// assert!(x.on_deploy_update_policy().is_some());
1747    /// assert!(x.automatic_update_policy().is_none());
1748    /// ```
1749    pub fn set_on_deploy_update_policy<
1750        T: std::convert::Into<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>,
1751    >(
1752        mut self,
1753        v: T,
1754    ) -> Self {
1755        self.runtime_update_policy = std::option::Option::Some(
1756            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v.into()),
1757        );
1758        self
1759    }
1760}
1761
1762impl wkt::message::Message for BuildConfig {
1763    fn typename() -> &'static str {
1764        "type.googleapis.com/google.cloud.functions.v2.BuildConfig"
1765    }
1766}
1767
1768/// Defines additional types related to [BuildConfig].
1769pub mod build_config {
1770    #[allow(unused_imports)]
1771    use super::*;
1772
1773    /// Docker Registry to use for storing function Docker images.
1774    ///
1775    /// # Working with unknown values
1776    ///
1777    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1778    /// additional enum variants at any time. Adding new variants is not considered
1779    /// a breaking change. Applications should write their code in anticipation of:
1780    ///
1781    /// - New values appearing in future releases of the client library, **and**
1782    /// - New values received dynamically, without application changes.
1783    ///
1784    /// Please consult the [Working with enums] section in the user guide for some
1785    /// guidelines.
1786    ///
1787    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1788    #[derive(Clone, Debug, PartialEq)]
1789    #[non_exhaustive]
1790    pub enum DockerRegistry {
1791        /// Unspecified.
1792        Unspecified,
1793        /// Docker images will be stored in multi-regional Container Registry
1794        /// repositories named `gcf`.
1795        ContainerRegistry,
1796        /// Docker images will be stored in regional Artifact Registry repositories.
1797        /// By default, GCF will create and use repositories named `gcf-artifacts`
1798        /// in every region in which a function is deployed. But the repository to
1799        /// use can also be specified by the user using the `docker_repository`
1800        /// field.
1801        ArtifactRegistry,
1802        /// If set, the enum was initialized with an unknown value.
1803        ///
1804        /// Applications can examine the value using [DockerRegistry::value] or
1805        /// [DockerRegistry::name].
1806        UnknownValue(docker_registry::UnknownValue),
1807    }
1808
1809    #[doc(hidden)]
1810    pub mod docker_registry {
1811        #[allow(unused_imports)]
1812        use super::*;
1813        #[derive(Clone, Debug, PartialEq)]
1814        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1815    }
1816
1817    impl DockerRegistry {
1818        /// Gets the enum value.
1819        ///
1820        /// Returns `None` if the enum contains an unknown value deserialized from
1821        /// the string representation of enums.
1822        pub fn value(&self) -> std::option::Option<i32> {
1823            match self {
1824                Self::Unspecified => std::option::Option::Some(0),
1825                Self::ContainerRegistry => std::option::Option::Some(1),
1826                Self::ArtifactRegistry => std::option::Option::Some(2),
1827                Self::UnknownValue(u) => u.0.value(),
1828            }
1829        }
1830
1831        /// Gets the enum value as a string.
1832        ///
1833        /// Returns `None` if the enum contains an unknown value deserialized from
1834        /// the integer representation of enums.
1835        pub fn name(&self) -> std::option::Option<&str> {
1836            match self {
1837                Self::Unspecified => std::option::Option::Some("DOCKER_REGISTRY_UNSPECIFIED"),
1838                Self::ContainerRegistry => std::option::Option::Some("CONTAINER_REGISTRY"),
1839                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
1840                Self::UnknownValue(u) => u.0.name(),
1841            }
1842        }
1843    }
1844
1845    impl std::default::Default for DockerRegistry {
1846        fn default() -> Self {
1847            use std::convert::From;
1848            Self::from(0)
1849        }
1850    }
1851
1852    impl std::fmt::Display for DockerRegistry {
1853        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1854            wkt::internal::display_enum(f, self.name(), self.value())
1855        }
1856    }
1857
1858    impl std::convert::From<i32> for DockerRegistry {
1859        fn from(value: i32) -> Self {
1860            match value {
1861                0 => Self::Unspecified,
1862                1 => Self::ContainerRegistry,
1863                2 => Self::ArtifactRegistry,
1864                _ => Self::UnknownValue(docker_registry::UnknownValue(
1865                    wkt::internal::UnknownEnumValue::Integer(value),
1866                )),
1867            }
1868        }
1869    }
1870
1871    impl std::convert::From<&str> for DockerRegistry {
1872        fn from(value: &str) -> Self {
1873            use std::string::ToString;
1874            match value {
1875                "DOCKER_REGISTRY_UNSPECIFIED" => Self::Unspecified,
1876                "CONTAINER_REGISTRY" => Self::ContainerRegistry,
1877                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
1878                _ => Self::UnknownValue(docker_registry::UnknownValue(
1879                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1880                )),
1881            }
1882        }
1883    }
1884
1885    impl serde::ser::Serialize for DockerRegistry {
1886        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1887        where
1888            S: serde::Serializer,
1889        {
1890            match self {
1891                Self::Unspecified => serializer.serialize_i32(0),
1892                Self::ContainerRegistry => serializer.serialize_i32(1),
1893                Self::ArtifactRegistry => serializer.serialize_i32(2),
1894                Self::UnknownValue(u) => u.0.serialize(serializer),
1895            }
1896        }
1897    }
1898
1899    impl<'de> serde::de::Deserialize<'de> for DockerRegistry {
1900        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1901        where
1902            D: serde::Deserializer<'de>,
1903        {
1904            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DockerRegistry>::new(
1905                ".google.cloud.functions.v2.BuildConfig.DockerRegistry",
1906            ))
1907        }
1908    }
1909
1910    /// This controls when security patches are applied to the runtime environment.
1911    #[derive(Clone, Debug, PartialEq)]
1912    #[non_exhaustive]
1913    pub enum RuntimeUpdatePolicy {
1914        #[allow(missing_docs)]
1915        AutomaticUpdatePolicy(std::boxed::Box<crate::model::AutomaticUpdatePolicy>),
1916        #[allow(missing_docs)]
1917        OnDeployUpdatePolicy(std::boxed::Box<crate::model::OnDeployUpdatePolicy>),
1918    }
1919}
1920
1921/// Describes the Service being deployed.
1922/// Currently Supported : Cloud Run (fully managed).
1923#[derive(Clone, Default, PartialEq)]
1924#[non_exhaustive]
1925pub struct ServiceConfig {
1926    /// Output only. Name of the service associated with a Function.
1927    /// The format of this field is
1928    /// `projects/{project}/locations/{region}/services/{service}`
1929    pub service: std::string::String,
1930
1931    /// The function execution timeout. Execution is considered failed and
1932    /// can be terminated if the function is not completed at the end of the
1933    /// timeout period. Defaults to 60 seconds.
1934    pub timeout_seconds: i32,
1935
1936    /// The amount of memory available for a function.
1937    /// Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
1938    /// supplied the value is interpreted as bytes.
1939    /// See
1940    /// <https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
1941    /// a full description.
1942    pub available_memory: std::string::String,
1943
1944    /// The number of CPUs used in a single container instance.
1945    /// Default value is calculated from available memory.
1946    /// Supports the same values as Cloud Run, see
1947    /// <https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
1948    /// Example: "1" indicates 1 vCPU
1949    pub available_cpu: std::string::String,
1950
1951    /// Environment variables that shall be available during function execution.
1952    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
1953
1954    /// The limit on the maximum number of function instances that may coexist at a
1955    /// given time.
1956    ///
1957    /// In some cases, such as rapid traffic surges, Cloud Functions may, for a
1958    /// short period of time, create more instances than the specified max
1959    /// instances limit. If your function cannot tolerate this temporary behavior,
1960    /// you may want to factor in a safety margin and set a lower max instances
1961    /// value than your function can tolerate.
1962    ///
1963    /// See the [Max
1964    /// Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
1965    /// more details.
1966    pub max_instance_count: i32,
1967
1968    /// The limit on the minimum number of function instances that may coexist at a
1969    /// given time.
1970    ///
1971    /// Function instances are kept in idle state for a short period after they
1972    /// finished executing the request to reduce cold start time for subsequent
1973    /// requests. Setting a minimum instance count will ensure that the given
1974    /// number of instances are kept running in idle state always. This can help
1975    /// with cold start times when jump in incoming request count occurs after the
1976    /// idle instance would have been stopped in the default case.
1977    pub min_instance_count: i32,
1978
1979    /// The Serverless VPC Access connector that this cloud function can connect
1980    /// to. The format of this field is `projects/*/locations/*/connectors/*`.
1981    pub vpc_connector: std::string::String,
1982
1983    /// The egress settings for the connector, controlling what traffic is diverted
1984    /// through it.
1985    pub vpc_connector_egress_settings: crate::model::service_config::VpcConnectorEgressSettings,
1986
1987    /// The ingress settings for the function, controlling what traffic can reach
1988    /// it.
1989    pub ingress_settings: crate::model::service_config::IngressSettings,
1990
1991    /// Output only. URI of the Service deployed.
1992    pub uri: std::string::String,
1993
1994    /// The email of the service's service account. If empty, defaults to
1995    /// `{project_number}-compute@developer.gserviceaccount.com`.
1996    pub service_account_email: std::string::String,
1997
1998    /// Whether 100% of traffic is routed to the latest revision.
1999    /// On CreateFunction and UpdateFunction, when set to true, the revision being
2000    /// deployed will serve 100% of traffic, ignoring any traffic split settings,
2001    /// if any. On GetFunction, true will be returned if the latest revision is
2002    /// serving 100% of traffic.
2003    pub all_traffic_on_latest_revision: bool,
2004
2005    /// Secret environment variables configuration.
2006    pub secret_environment_variables: std::vec::Vec<crate::model::SecretEnvVar>,
2007
2008    /// Secret volumes configuration.
2009    pub secret_volumes: std::vec::Vec<crate::model::SecretVolume>,
2010
2011    /// Output only. The name of service revision.
2012    pub revision: std::string::String,
2013
2014    /// Sets the maximum number of concurrent requests that each instance
2015    /// can receive. Defaults to 1.
2016    pub max_instance_request_concurrency: i32,
2017
2018    /// Security level configure whether the function only accepts https.
2019    /// This configuration is only applicable to 1st Gen functions with Http
2020    /// trigger. By default https is optional for 1st Gen functions; 2nd Gen
2021    /// functions are https ONLY.
2022    pub security_level: crate::model::service_config::SecurityLevel,
2023
2024    /// Optional. The binary authorization policy to be checked when deploying the
2025    /// Cloud Run service.
2026    pub binary_authorization_policy: std::string::String,
2027
2028    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2029}
2030
2031impl ServiceConfig {
2032    /// Creates a new default instance.
2033    pub fn new() -> Self {
2034        std::default::Default::default()
2035    }
2036
2037    /// Sets the value of [service][crate::model::ServiceConfig::service].
2038    ///
2039    /// # Example
2040    /// ```ignore,no_run
2041    /// # use google_cloud_functions_v2::model::ServiceConfig;
2042    /// let x = ServiceConfig::new().set_service("example");
2043    /// ```
2044    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2045        self.service = v.into();
2046        self
2047    }
2048
2049    /// Sets the value of [timeout_seconds][crate::model::ServiceConfig::timeout_seconds].
2050    ///
2051    /// # Example
2052    /// ```ignore,no_run
2053    /// # use google_cloud_functions_v2::model::ServiceConfig;
2054    /// let x = ServiceConfig::new().set_timeout_seconds(42);
2055    /// ```
2056    pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2057        self.timeout_seconds = v.into();
2058        self
2059    }
2060
2061    /// Sets the value of [available_memory][crate::model::ServiceConfig::available_memory].
2062    ///
2063    /// # Example
2064    /// ```ignore,no_run
2065    /// # use google_cloud_functions_v2::model::ServiceConfig;
2066    /// let x = ServiceConfig::new().set_available_memory("example");
2067    /// ```
2068    pub fn set_available_memory<T: std::convert::Into<std::string::String>>(
2069        mut self,
2070        v: T,
2071    ) -> Self {
2072        self.available_memory = v.into();
2073        self
2074    }
2075
2076    /// Sets the value of [available_cpu][crate::model::ServiceConfig::available_cpu].
2077    ///
2078    /// # Example
2079    /// ```ignore,no_run
2080    /// # use google_cloud_functions_v2::model::ServiceConfig;
2081    /// let x = ServiceConfig::new().set_available_cpu("example");
2082    /// ```
2083    pub fn set_available_cpu<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2084        self.available_cpu = v.into();
2085        self
2086    }
2087
2088    /// Sets the value of [environment_variables][crate::model::ServiceConfig::environment_variables].
2089    ///
2090    /// # Example
2091    /// ```ignore,no_run
2092    /// # use google_cloud_functions_v2::model::ServiceConfig;
2093    /// let x = ServiceConfig::new().set_environment_variables([
2094    ///     ("key0", "abc"),
2095    ///     ("key1", "xyz"),
2096    /// ]);
2097    /// ```
2098    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
2099    where
2100        T: std::iter::IntoIterator<Item = (K, V)>,
2101        K: std::convert::Into<std::string::String>,
2102        V: std::convert::Into<std::string::String>,
2103    {
2104        use std::iter::Iterator;
2105        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2106        self
2107    }
2108
2109    /// Sets the value of [max_instance_count][crate::model::ServiceConfig::max_instance_count].
2110    ///
2111    /// # Example
2112    /// ```ignore,no_run
2113    /// # use google_cloud_functions_v2::model::ServiceConfig;
2114    /// let x = ServiceConfig::new().set_max_instance_count(42);
2115    /// ```
2116    pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2117        self.max_instance_count = v.into();
2118        self
2119    }
2120
2121    /// Sets the value of [min_instance_count][crate::model::ServiceConfig::min_instance_count].
2122    ///
2123    /// # Example
2124    /// ```ignore,no_run
2125    /// # use google_cloud_functions_v2::model::ServiceConfig;
2126    /// let x = ServiceConfig::new().set_min_instance_count(42);
2127    /// ```
2128    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2129        self.min_instance_count = v.into();
2130        self
2131    }
2132
2133    /// Sets the value of [vpc_connector][crate::model::ServiceConfig::vpc_connector].
2134    ///
2135    /// # Example
2136    /// ```ignore,no_run
2137    /// # use google_cloud_functions_v2::model::ServiceConfig;
2138    /// let x = ServiceConfig::new().set_vpc_connector("example");
2139    /// ```
2140    pub fn set_vpc_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2141        self.vpc_connector = v.into();
2142        self
2143    }
2144
2145    /// Sets the value of [vpc_connector_egress_settings][crate::model::ServiceConfig::vpc_connector_egress_settings].
2146    ///
2147    /// # Example
2148    /// ```ignore,no_run
2149    /// # use google_cloud_functions_v2::model::ServiceConfig;
2150    /// use google_cloud_functions_v2::model::service_config::VpcConnectorEgressSettings;
2151    /// let x0 = ServiceConfig::new().set_vpc_connector_egress_settings(VpcConnectorEgressSettings::PrivateRangesOnly);
2152    /// let x1 = ServiceConfig::new().set_vpc_connector_egress_settings(VpcConnectorEgressSettings::AllTraffic);
2153    /// ```
2154    pub fn set_vpc_connector_egress_settings<
2155        T: std::convert::Into<crate::model::service_config::VpcConnectorEgressSettings>,
2156    >(
2157        mut self,
2158        v: T,
2159    ) -> Self {
2160        self.vpc_connector_egress_settings = v.into();
2161        self
2162    }
2163
2164    /// Sets the value of [ingress_settings][crate::model::ServiceConfig::ingress_settings].
2165    ///
2166    /// # Example
2167    /// ```ignore,no_run
2168    /// # use google_cloud_functions_v2::model::ServiceConfig;
2169    /// use google_cloud_functions_v2::model::service_config::IngressSettings;
2170    /// let x0 = ServiceConfig::new().set_ingress_settings(IngressSettings::AllowAll);
2171    /// let x1 = ServiceConfig::new().set_ingress_settings(IngressSettings::AllowInternalOnly);
2172    /// let x2 = ServiceConfig::new().set_ingress_settings(IngressSettings::AllowInternalAndGclb);
2173    /// ```
2174    pub fn set_ingress_settings<
2175        T: std::convert::Into<crate::model::service_config::IngressSettings>,
2176    >(
2177        mut self,
2178        v: T,
2179    ) -> Self {
2180        self.ingress_settings = v.into();
2181        self
2182    }
2183
2184    /// Sets the value of [uri][crate::model::ServiceConfig::uri].
2185    ///
2186    /// # Example
2187    /// ```ignore,no_run
2188    /// # use google_cloud_functions_v2::model::ServiceConfig;
2189    /// let x = ServiceConfig::new().set_uri("example");
2190    /// ```
2191    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2192        self.uri = v.into();
2193        self
2194    }
2195
2196    /// Sets the value of [service_account_email][crate::model::ServiceConfig::service_account_email].
2197    ///
2198    /// # Example
2199    /// ```ignore,no_run
2200    /// # use google_cloud_functions_v2::model::ServiceConfig;
2201    /// let x = ServiceConfig::new().set_service_account_email("example");
2202    /// ```
2203    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
2204        mut self,
2205        v: T,
2206    ) -> Self {
2207        self.service_account_email = v.into();
2208        self
2209    }
2210
2211    /// Sets the value of [all_traffic_on_latest_revision][crate::model::ServiceConfig::all_traffic_on_latest_revision].
2212    ///
2213    /// # Example
2214    /// ```ignore,no_run
2215    /// # use google_cloud_functions_v2::model::ServiceConfig;
2216    /// let x = ServiceConfig::new().set_all_traffic_on_latest_revision(true);
2217    /// ```
2218    pub fn set_all_traffic_on_latest_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2219        self.all_traffic_on_latest_revision = v.into();
2220        self
2221    }
2222
2223    /// Sets the value of [secret_environment_variables][crate::model::ServiceConfig::secret_environment_variables].
2224    ///
2225    /// # Example
2226    /// ```ignore,no_run
2227    /// # use google_cloud_functions_v2::model::ServiceConfig;
2228    /// use google_cloud_functions_v2::model::SecretEnvVar;
2229    /// let x = ServiceConfig::new()
2230    ///     .set_secret_environment_variables([
2231    ///         SecretEnvVar::default()/* use setters */,
2232    ///         SecretEnvVar::default()/* use (different) setters */,
2233    ///     ]);
2234    /// ```
2235    pub fn set_secret_environment_variables<T, V>(mut self, v: T) -> Self
2236    where
2237        T: std::iter::IntoIterator<Item = V>,
2238        V: std::convert::Into<crate::model::SecretEnvVar>,
2239    {
2240        use std::iter::Iterator;
2241        self.secret_environment_variables = v.into_iter().map(|i| i.into()).collect();
2242        self
2243    }
2244
2245    /// Sets the value of [secret_volumes][crate::model::ServiceConfig::secret_volumes].
2246    ///
2247    /// # Example
2248    /// ```ignore,no_run
2249    /// # use google_cloud_functions_v2::model::ServiceConfig;
2250    /// use google_cloud_functions_v2::model::SecretVolume;
2251    /// let x = ServiceConfig::new()
2252    ///     .set_secret_volumes([
2253    ///         SecretVolume::default()/* use setters */,
2254    ///         SecretVolume::default()/* use (different) setters */,
2255    ///     ]);
2256    /// ```
2257    pub fn set_secret_volumes<T, V>(mut self, v: T) -> Self
2258    where
2259        T: std::iter::IntoIterator<Item = V>,
2260        V: std::convert::Into<crate::model::SecretVolume>,
2261    {
2262        use std::iter::Iterator;
2263        self.secret_volumes = v.into_iter().map(|i| i.into()).collect();
2264        self
2265    }
2266
2267    /// Sets the value of [revision][crate::model::ServiceConfig::revision].
2268    ///
2269    /// # Example
2270    /// ```ignore,no_run
2271    /// # use google_cloud_functions_v2::model::ServiceConfig;
2272    /// let x = ServiceConfig::new().set_revision("example");
2273    /// ```
2274    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2275        self.revision = v.into();
2276        self
2277    }
2278
2279    /// Sets the value of [max_instance_request_concurrency][crate::model::ServiceConfig::max_instance_request_concurrency].
2280    ///
2281    /// # Example
2282    /// ```ignore,no_run
2283    /// # use google_cloud_functions_v2::model::ServiceConfig;
2284    /// let x = ServiceConfig::new().set_max_instance_request_concurrency(42);
2285    /// ```
2286    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
2287        mut self,
2288        v: T,
2289    ) -> Self {
2290        self.max_instance_request_concurrency = v.into();
2291        self
2292    }
2293
2294    /// Sets the value of [security_level][crate::model::ServiceConfig::security_level].
2295    ///
2296    /// # Example
2297    /// ```ignore,no_run
2298    /// # use google_cloud_functions_v2::model::ServiceConfig;
2299    /// use google_cloud_functions_v2::model::service_config::SecurityLevel;
2300    /// let x0 = ServiceConfig::new().set_security_level(SecurityLevel::SecureAlways);
2301    /// let x1 = ServiceConfig::new().set_security_level(SecurityLevel::SecureOptional);
2302    /// ```
2303    pub fn set_security_level<
2304        T: std::convert::Into<crate::model::service_config::SecurityLevel>,
2305    >(
2306        mut self,
2307        v: T,
2308    ) -> Self {
2309        self.security_level = v.into();
2310        self
2311    }
2312
2313    /// Sets the value of [binary_authorization_policy][crate::model::ServiceConfig::binary_authorization_policy].
2314    ///
2315    /// # Example
2316    /// ```ignore,no_run
2317    /// # use google_cloud_functions_v2::model::ServiceConfig;
2318    /// let x = ServiceConfig::new().set_binary_authorization_policy("example");
2319    /// ```
2320    pub fn set_binary_authorization_policy<T: std::convert::Into<std::string::String>>(
2321        mut self,
2322        v: T,
2323    ) -> Self {
2324        self.binary_authorization_policy = v.into();
2325        self
2326    }
2327}
2328
2329impl wkt::message::Message for ServiceConfig {
2330    fn typename() -> &'static str {
2331        "type.googleapis.com/google.cloud.functions.v2.ServiceConfig"
2332    }
2333}
2334
2335/// Defines additional types related to [ServiceConfig].
2336pub mod service_config {
2337    #[allow(unused_imports)]
2338    use super::*;
2339
2340    /// Available egress settings.
2341    ///
2342    /// This controls what traffic is diverted through the VPC Access Connector
2343    /// resource. By default PRIVATE_RANGES_ONLY will be used.
2344    ///
2345    /// # Working with unknown values
2346    ///
2347    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2348    /// additional enum variants at any time. Adding new variants is not considered
2349    /// a breaking change. Applications should write their code in anticipation of:
2350    ///
2351    /// - New values appearing in future releases of the client library, **and**
2352    /// - New values received dynamically, without application changes.
2353    ///
2354    /// Please consult the [Working with enums] section in the user guide for some
2355    /// guidelines.
2356    ///
2357    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2358    #[derive(Clone, Debug, PartialEq)]
2359    #[non_exhaustive]
2360    pub enum VpcConnectorEgressSettings {
2361        /// Unspecified.
2362        Unspecified,
2363        /// Use the VPC Access Connector only for private IP space from RFC1918.
2364        PrivateRangesOnly,
2365        /// Force the use of VPC Access Connector for all egress traffic from the
2366        /// function.
2367        AllTraffic,
2368        /// If set, the enum was initialized with an unknown value.
2369        ///
2370        /// Applications can examine the value using [VpcConnectorEgressSettings::value] or
2371        /// [VpcConnectorEgressSettings::name].
2372        UnknownValue(vpc_connector_egress_settings::UnknownValue),
2373    }
2374
2375    #[doc(hidden)]
2376    pub mod vpc_connector_egress_settings {
2377        #[allow(unused_imports)]
2378        use super::*;
2379        #[derive(Clone, Debug, PartialEq)]
2380        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2381    }
2382
2383    impl VpcConnectorEgressSettings {
2384        /// Gets the enum value.
2385        ///
2386        /// Returns `None` if the enum contains an unknown value deserialized from
2387        /// the string representation of enums.
2388        pub fn value(&self) -> std::option::Option<i32> {
2389            match self {
2390                Self::Unspecified => std::option::Option::Some(0),
2391                Self::PrivateRangesOnly => std::option::Option::Some(1),
2392                Self::AllTraffic => std::option::Option::Some(2),
2393                Self::UnknownValue(u) => u.0.value(),
2394            }
2395        }
2396
2397        /// Gets the enum value as a string.
2398        ///
2399        /// Returns `None` if the enum contains an unknown value deserialized from
2400        /// the integer representation of enums.
2401        pub fn name(&self) -> std::option::Option<&str> {
2402            match self {
2403                Self::Unspecified => {
2404                    std::option::Option::Some("VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED")
2405                }
2406                Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
2407                Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
2408                Self::UnknownValue(u) => u.0.name(),
2409            }
2410        }
2411    }
2412
2413    impl std::default::Default for VpcConnectorEgressSettings {
2414        fn default() -> Self {
2415            use std::convert::From;
2416            Self::from(0)
2417        }
2418    }
2419
2420    impl std::fmt::Display for VpcConnectorEgressSettings {
2421        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2422            wkt::internal::display_enum(f, self.name(), self.value())
2423        }
2424    }
2425
2426    impl std::convert::From<i32> for VpcConnectorEgressSettings {
2427        fn from(value: i32) -> Self {
2428            match value {
2429                0 => Self::Unspecified,
2430                1 => Self::PrivateRangesOnly,
2431                2 => Self::AllTraffic,
2432                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
2433                    wkt::internal::UnknownEnumValue::Integer(value),
2434                )),
2435            }
2436        }
2437    }
2438
2439    impl std::convert::From<&str> for VpcConnectorEgressSettings {
2440        fn from(value: &str) -> Self {
2441            use std::string::ToString;
2442            match value {
2443                "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
2444                "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
2445                "ALL_TRAFFIC" => Self::AllTraffic,
2446                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
2447                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2448                )),
2449            }
2450        }
2451    }
2452
2453    impl serde::ser::Serialize for VpcConnectorEgressSettings {
2454        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2455        where
2456            S: serde::Serializer,
2457        {
2458            match self {
2459                Self::Unspecified => serializer.serialize_i32(0),
2460                Self::PrivateRangesOnly => serializer.serialize_i32(1),
2461                Self::AllTraffic => serializer.serialize_i32(2),
2462                Self::UnknownValue(u) => u.0.serialize(serializer),
2463            }
2464        }
2465    }
2466
2467    impl<'de> serde::de::Deserialize<'de> for VpcConnectorEgressSettings {
2468        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2469        where
2470            D: serde::Deserializer<'de>,
2471        {
2472            deserializer.deserialize_any(
2473                wkt::internal::EnumVisitor::<VpcConnectorEgressSettings>::new(
2474                    ".google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings",
2475                ),
2476            )
2477        }
2478    }
2479
2480    /// Available ingress settings.
2481    ///
2482    /// This controls what traffic can reach the function.
2483    ///
2484    /// If unspecified, ALLOW_ALL will be used.
2485    ///
2486    /// # Working with unknown values
2487    ///
2488    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2489    /// additional enum variants at any time. Adding new variants is not considered
2490    /// a breaking change. Applications should write their code in anticipation of:
2491    ///
2492    /// - New values appearing in future releases of the client library, **and**
2493    /// - New values received dynamically, without application changes.
2494    ///
2495    /// Please consult the [Working with enums] section in the user guide for some
2496    /// guidelines.
2497    ///
2498    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2499    #[derive(Clone, Debug, PartialEq)]
2500    #[non_exhaustive]
2501    pub enum IngressSettings {
2502        /// Unspecified.
2503        Unspecified,
2504        /// Allow HTTP traffic from public and private sources.
2505        AllowAll,
2506        /// Allow HTTP traffic from only private VPC sources.
2507        AllowInternalOnly,
2508        /// Allow HTTP traffic from private VPC sources and through GCLB.
2509        AllowInternalAndGclb,
2510        /// If set, the enum was initialized with an unknown value.
2511        ///
2512        /// Applications can examine the value using [IngressSettings::value] or
2513        /// [IngressSettings::name].
2514        UnknownValue(ingress_settings::UnknownValue),
2515    }
2516
2517    #[doc(hidden)]
2518    pub mod ingress_settings {
2519        #[allow(unused_imports)]
2520        use super::*;
2521        #[derive(Clone, Debug, PartialEq)]
2522        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2523    }
2524
2525    impl IngressSettings {
2526        /// Gets the enum value.
2527        ///
2528        /// Returns `None` if the enum contains an unknown value deserialized from
2529        /// the string representation of enums.
2530        pub fn value(&self) -> std::option::Option<i32> {
2531            match self {
2532                Self::Unspecified => std::option::Option::Some(0),
2533                Self::AllowAll => std::option::Option::Some(1),
2534                Self::AllowInternalOnly => std::option::Option::Some(2),
2535                Self::AllowInternalAndGclb => std::option::Option::Some(3),
2536                Self::UnknownValue(u) => u.0.value(),
2537            }
2538        }
2539
2540        /// Gets the enum value as a string.
2541        ///
2542        /// Returns `None` if the enum contains an unknown value deserialized from
2543        /// the integer representation of enums.
2544        pub fn name(&self) -> std::option::Option<&str> {
2545            match self {
2546                Self::Unspecified => std::option::Option::Some("INGRESS_SETTINGS_UNSPECIFIED"),
2547                Self::AllowAll => std::option::Option::Some("ALLOW_ALL"),
2548                Self::AllowInternalOnly => std::option::Option::Some("ALLOW_INTERNAL_ONLY"),
2549                Self::AllowInternalAndGclb => std::option::Option::Some("ALLOW_INTERNAL_AND_GCLB"),
2550                Self::UnknownValue(u) => u.0.name(),
2551            }
2552        }
2553    }
2554
2555    impl std::default::Default for IngressSettings {
2556        fn default() -> Self {
2557            use std::convert::From;
2558            Self::from(0)
2559        }
2560    }
2561
2562    impl std::fmt::Display for IngressSettings {
2563        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2564            wkt::internal::display_enum(f, self.name(), self.value())
2565        }
2566    }
2567
2568    impl std::convert::From<i32> for IngressSettings {
2569        fn from(value: i32) -> Self {
2570            match value {
2571                0 => Self::Unspecified,
2572                1 => Self::AllowAll,
2573                2 => Self::AllowInternalOnly,
2574                3 => Self::AllowInternalAndGclb,
2575                _ => Self::UnknownValue(ingress_settings::UnknownValue(
2576                    wkt::internal::UnknownEnumValue::Integer(value),
2577                )),
2578            }
2579        }
2580    }
2581
2582    impl std::convert::From<&str> for IngressSettings {
2583        fn from(value: &str) -> Self {
2584            use std::string::ToString;
2585            match value {
2586                "INGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
2587                "ALLOW_ALL" => Self::AllowAll,
2588                "ALLOW_INTERNAL_ONLY" => Self::AllowInternalOnly,
2589                "ALLOW_INTERNAL_AND_GCLB" => Self::AllowInternalAndGclb,
2590                _ => Self::UnknownValue(ingress_settings::UnknownValue(
2591                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2592                )),
2593            }
2594        }
2595    }
2596
2597    impl serde::ser::Serialize for IngressSettings {
2598        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2599        where
2600            S: serde::Serializer,
2601        {
2602            match self {
2603                Self::Unspecified => serializer.serialize_i32(0),
2604                Self::AllowAll => serializer.serialize_i32(1),
2605                Self::AllowInternalOnly => serializer.serialize_i32(2),
2606                Self::AllowInternalAndGclb => serializer.serialize_i32(3),
2607                Self::UnknownValue(u) => u.0.serialize(serializer),
2608            }
2609        }
2610    }
2611
2612    impl<'de> serde::de::Deserialize<'de> for IngressSettings {
2613        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2614        where
2615            D: serde::Deserializer<'de>,
2616        {
2617            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressSettings>::new(
2618                ".google.cloud.functions.v2.ServiceConfig.IngressSettings",
2619            ))
2620        }
2621    }
2622
2623    /// Available security level settings.
2624    ///
2625    /// This enforces security protocol on function URL.
2626    ///
2627    /// Security level is only configurable for 1st Gen functions, If unspecified,
2628    /// SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY.
2629    ///
2630    /// # Working with unknown values
2631    ///
2632    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2633    /// additional enum variants at any time. Adding new variants is not considered
2634    /// a breaking change. Applications should write their code in anticipation of:
2635    ///
2636    /// - New values appearing in future releases of the client library, **and**
2637    /// - New values received dynamically, without application changes.
2638    ///
2639    /// Please consult the [Working with enums] section in the user guide for some
2640    /// guidelines.
2641    ///
2642    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2643    #[derive(Clone, Debug, PartialEq)]
2644    #[non_exhaustive]
2645    pub enum SecurityLevel {
2646        /// Unspecified.
2647        Unspecified,
2648        /// Requests for a URL that match this handler that do not use HTTPS are
2649        /// automatically redirected to the HTTPS URL with the same path. Query
2650        /// parameters are reserved for the redirect.
2651        SecureAlways,
2652        /// Both HTTP and HTTPS requests with URLs that match the handler succeed
2653        /// without redirects. The application can examine the request to determine
2654        /// which protocol was used and respond accordingly.
2655        SecureOptional,
2656        /// If set, the enum was initialized with an unknown value.
2657        ///
2658        /// Applications can examine the value using [SecurityLevel::value] or
2659        /// [SecurityLevel::name].
2660        UnknownValue(security_level::UnknownValue),
2661    }
2662
2663    #[doc(hidden)]
2664    pub mod security_level {
2665        #[allow(unused_imports)]
2666        use super::*;
2667        #[derive(Clone, Debug, PartialEq)]
2668        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2669    }
2670
2671    impl SecurityLevel {
2672        /// Gets the enum value.
2673        ///
2674        /// Returns `None` if the enum contains an unknown value deserialized from
2675        /// the string representation of enums.
2676        pub fn value(&self) -> std::option::Option<i32> {
2677            match self {
2678                Self::Unspecified => std::option::Option::Some(0),
2679                Self::SecureAlways => std::option::Option::Some(1),
2680                Self::SecureOptional => std::option::Option::Some(2),
2681                Self::UnknownValue(u) => u.0.value(),
2682            }
2683        }
2684
2685        /// Gets the enum value as a string.
2686        ///
2687        /// Returns `None` if the enum contains an unknown value deserialized from
2688        /// the integer representation of enums.
2689        pub fn name(&self) -> std::option::Option<&str> {
2690            match self {
2691                Self::Unspecified => std::option::Option::Some("SECURITY_LEVEL_UNSPECIFIED"),
2692                Self::SecureAlways => std::option::Option::Some("SECURE_ALWAYS"),
2693                Self::SecureOptional => std::option::Option::Some("SECURE_OPTIONAL"),
2694                Self::UnknownValue(u) => u.0.name(),
2695            }
2696        }
2697    }
2698
2699    impl std::default::Default for SecurityLevel {
2700        fn default() -> Self {
2701            use std::convert::From;
2702            Self::from(0)
2703        }
2704    }
2705
2706    impl std::fmt::Display for SecurityLevel {
2707        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2708            wkt::internal::display_enum(f, self.name(), self.value())
2709        }
2710    }
2711
2712    impl std::convert::From<i32> for SecurityLevel {
2713        fn from(value: i32) -> Self {
2714            match value {
2715                0 => Self::Unspecified,
2716                1 => Self::SecureAlways,
2717                2 => Self::SecureOptional,
2718                _ => Self::UnknownValue(security_level::UnknownValue(
2719                    wkt::internal::UnknownEnumValue::Integer(value),
2720                )),
2721            }
2722        }
2723    }
2724
2725    impl std::convert::From<&str> for SecurityLevel {
2726        fn from(value: &str) -> Self {
2727            use std::string::ToString;
2728            match value {
2729                "SECURITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
2730                "SECURE_ALWAYS" => Self::SecureAlways,
2731                "SECURE_OPTIONAL" => Self::SecureOptional,
2732                _ => Self::UnknownValue(security_level::UnknownValue(
2733                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2734                )),
2735            }
2736        }
2737    }
2738
2739    impl serde::ser::Serialize for SecurityLevel {
2740        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2741        where
2742            S: serde::Serializer,
2743        {
2744            match self {
2745                Self::Unspecified => serializer.serialize_i32(0),
2746                Self::SecureAlways => serializer.serialize_i32(1),
2747                Self::SecureOptional => serializer.serialize_i32(2),
2748                Self::UnknownValue(u) => u.0.serialize(serializer),
2749            }
2750        }
2751    }
2752
2753    impl<'de> serde::de::Deserialize<'de> for SecurityLevel {
2754        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2755        where
2756            D: serde::Deserializer<'de>,
2757        {
2758            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityLevel>::new(
2759                ".google.cloud.functions.v2.ServiceConfig.SecurityLevel",
2760            ))
2761        }
2762    }
2763}
2764
2765/// Configuration for a secret environment variable. It has the information
2766/// necessary to fetch the secret value from secret manager and expose it as an
2767/// environment variable.
2768#[derive(Clone, Default, PartialEq)]
2769#[non_exhaustive]
2770pub struct SecretEnvVar {
2771    /// Name of the environment variable.
2772    pub key: std::string::String,
2773
2774    /// Project identifier (preferably project number but can also be the
2775    /// project ID) of the project that contains the secret. If not set, it is
2776    /// assumed that the secret is in the same project as the function.
2777    pub project_id: std::string::String,
2778
2779    /// Name of the secret in secret manager (not the full resource name).
2780    pub secret: std::string::String,
2781
2782    /// Version of the secret (version number or the string 'latest'). It is
2783    /// recommended to use a numeric version for secret environment variables as
2784    /// any updates to the secret value is not reflected until new instances
2785    /// start.
2786    pub version: std::string::String,
2787
2788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2789}
2790
2791impl SecretEnvVar {
2792    /// Creates a new default instance.
2793    pub fn new() -> Self {
2794        std::default::Default::default()
2795    }
2796
2797    /// Sets the value of [key][crate::model::SecretEnvVar::key].
2798    ///
2799    /// # Example
2800    /// ```ignore,no_run
2801    /// # use google_cloud_functions_v2::model::SecretEnvVar;
2802    /// let x = SecretEnvVar::new().set_key("example");
2803    /// ```
2804    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2805        self.key = v.into();
2806        self
2807    }
2808
2809    /// Sets the value of [project_id][crate::model::SecretEnvVar::project_id].
2810    ///
2811    /// # Example
2812    /// ```ignore,no_run
2813    /// # use google_cloud_functions_v2::model::SecretEnvVar;
2814    /// let x = SecretEnvVar::new().set_project_id("example");
2815    /// ```
2816    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2817        self.project_id = v.into();
2818        self
2819    }
2820
2821    /// Sets the value of [secret][crate::model::SecretEnvVar::secret].
2822    ///
2823    /// # Example
2824    /// ```ignore,no_run
2825    /// # use google_cloud_functions_v2::model::SecretEnvVar;
2826    /// let x = SecretEnvVar::new().set_secret("example");
2827    /// ```
2828    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2829        self.secret = v.into();
2830        self
2831    }
2832
2833    /// Sets the value of [version][crate::model::SecretEnvVar::version].
2834    ///
2835    /// # Example
2836    /// ```ignore,no_run
2837    /// # use google_cloud_functions_v2::model::SecretEnvVar;
2838    /// let x = SecretEnvVar::new().set_version("example");
2839    /// ```
2840    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2841        self.version = v.into();
2842        self
2843    }
2844}
2845
2846impl wkt::message::Message for SecretEnvVar {
2847    fn typename() -> &'static str {
2848        "type.googleapis.com/google.cloud.functions.v2.SecretEnvVar"
2849    }
2850}
2851
2852/// Configuration for a secret volume. It has the information necessary to fetch
2853/// the secret value from secret manager and make it available as files mounted
2854/// at the requested paths within the application container.
2855#[derive(Clone, Default, PartialEq)]
2856#[non_exhaustive]
2857pub struct SecretVolume {
2858    /// The path within the container to mount the secret volume. For example,
2859    /// setting the mount_path as `/etc/secrets` would mount the secret value files
2860    /// under the `/etc/secrets` directory. This directory will also be completely
2861    /// shadowed and unavailable to mount any other secrets.
2862    /// Recommended mount path: /etc/secrets
2863    pub mount_path: std::string::String,
2864
2865    /// Project identifier (preferably project number but can also be the project
2866    /// ID) of the project that contains the secret. If not set, it is
2867    /// assumed that the secret is in the same project as the function.
2868    pub project_id: std::string::String,
2869
2870    /// Name of the secret in secret manager (not the full resource name).
2871    pub secret: std::string::String,
2872
2873    /// List of secret versions to mount for this secret. If empty, the `latest`
2874    /// version of the secret will be made available in a file named after the
2875    /// secret under the mount point.
2876    pub versions: std::vec::Vec<crate::model::secret_volume::SecretVersion>,
2877
2878    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2879}
2880
2881impl SecretVolume {
2882    /// Creates a new default instance.
2883    pub fn new() -> Self {
2884        std::default::Default::default()
2885    }
2886
2887    /// Sets the value of [mount_path][crate::model::SecretVolume::mount_path].
2888    ///
2889    /// # Example
2890    /// ```ignore,no_run
2891    /// # use google_cloud_functions_v2::model::SecretVolume;
2892    /// let x = SecretVolume::new().set_mount_path("example");
2893    /// ```
2894    pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2895        self.mount_path = v.into();
2896        self
2897    }
2898
2899    /// Sets the value of [project_id][crate::model::SecretVolume::project_id].
2900    ///
2901    /// # Example
2902    /// ```ignore,no_run
2903    /// # use google_cloud_functions_v2::model::SecretVolume;
2904    /// let x = SecretVolume::new().set_project_id("example");
2905    /// ```
2906    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2907        self.project_id = v.into();
2908        self
2909    }
2910
2911    /// Sets the value of [secret][crate::model::SecretVolume::secret].
2912    ///
2913    /// # Example
2914    /// ```ignore,no_run
2915    /// # use google_cloud_functions_v2::model::SecretVolume;
2916    /// let x = SecretVolume::new().set_secret("example");
2917    /// ```
2918    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2919        self.secret = v.into();
2920        self
2921    }
2922
2923    /// Sets the value of [versions][crate::model::SecretVolume::versions].
2924    ///
2925    /// # Example
2926    /// ```ignore,no_run
2927    /// # use google_cloud_functions_v2::model::SecretVolume;
2928    /// use google_cloud_functions_v2::model::secret_volume::SecretVersion;
2929    /// let x = SecretVolume::new()
2930    ///     .set_versions([
2931    ///         SecretVersion::default()/* use setters */,
2932    ///         SecretVersion::default()/* use (different) setters */,
2933    ///     ]);
2934    /// ```
2935    pub fn set_versions<T, V>(mut self, v: T) -> Self
2936    where
2937        T: std::iter::IntoIterator<Item = V>,
2938        V: std::convert::Into<crate::model::secret_volume::SecretVersion>,
2939    {
2940        use std::iter::Iterator;
2941        self.versions = v.into_iter().map(|i| i.into()).collect();
2942        self
2943    }
2944}
2945
2946impl wkt::message::Message for SecretVolume {
2947    fn typename() -> &'static str {
2948        "type.googleapis.com/google.cloud.functions.v2.SecretVolume"
2949    }
2950}
2951
2952/// Defines additional types related to [SecretVolume].
2953pub mod secret_volume {
2954    #[allow(unused_imports)]
2955    use super::*;
2956
2957    /// Configuration for a single version.
2958    #[derive(Clone, Default, PartialEq)]
2959    #[non_exhaustive]
2960    pub struct SecretVersion {
2961        /// Version of the secret (version number or the string 'latest'). It is
2962        /// preferable to use `latest` version with secret volumes as secret value
2963        /// changes are reflected immediately.
2964        pub version: std::string::String,
2965
2966        /// Relative path of the file under the mount path where the secret value for
2967        /// this version will be fetched and made available. For example, setting the
2968        /// mount_path as '/etc/secrets' and path as `secret_foo` would mount the
2969        /// secret value file at `/etc/secrets/secret_foo`.
2970        pub path: std::string::String,
2971
2972        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2973    }
2974
2975    impl SecretVersion {
2976        /// Creates a new default instance.
2977        pub fn new() -> Self {
2978            std::default::Default::default()
2979        }
2980
2981        /// Sets the value of [version][crate::model::secret_volume::SecretVersion::version].
2982        ///
2983        /// # Example
2984        /// ```ignore,no_run
2985        /// # use google_cloud_functions_v2::model::secret_volume::SecretVersion;
2986        /// let x = SecretVersion::new().set_version("example");
2987        /// ```
2988        pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2989            self.version = v.into();
2990            self
2991        }
2992
2993        /// Sets the value of [path][crate::model::secret_volume::SecretVersion::path].
2994        ///
2995        /// # Example
2996        /// ```ignore,no_run
2997        /// # use google_cloud_functions_v2::model::secret_volume::SecretVersion;
2998        /// let x = SecretVersion::new().set_path("example");
2999        /// ```
3000        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3001            self.path = v.into();
3002            self
3003        }
3004    }
3005
3006    impl wkt::message::Message for SecretVersion {
3007        fn typename() -> &'static str {
3008            "type.googleapis.com/google.cloud.functions.v2.SecretVolume.SecretVersion"
3009        }
3010    }
3011}
3012
3013/// Describes EventTrigger, used to request events to be sent from another
3014/// service.
3015#[derive(Clone, Default, PartialEq)]
3016#[non_exhaustive]
3017pub struct EventTrigger {
3018    /// Output only. The resource name of the Eventarc trigger. The format of this
3019    /// field is `projects/{project}/locations/{region}/triggers/{trigger}`.
3020    pub trigger: std::string::String,
3021
3022    /// The region that the trigger will be in. The trigger will only receive
3023    /// events originating in this region. It can be the same
3024    /// region as the function, a different region or multi-region, or the global
3025    /// region. If not provided, defaults to the same region as the function.
3026    pub trigger_region: std::string::String,
3027
3028    /// Required. The type of event to observe. For example:
3029    /// `google.cloud.audit.log.v1.written` or
3030    /// `google.cloud.pubsub.topic.v1.messagePublished`.
3031    pub event_type: std::string::String,
3032
3033    /// Criteria used to filter events.
3034    pub event_filters: std::vec::Vec<crate::model::EventFilter>,
3035
3036    /// Optional. The name of a Pub/Sub topic in the same project that will be used
3037    /// as the transport topic for the event delivery. Format:
3038    /// `projects/{project}/topics/{topic}`.
3039    ///
3040    /// This is only valid for events of type
3041    /// `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
3042    /// will not be deleted at function deletion.
3043    pub pubsub_topic: std::string::String,
3044
3045    /// Optional. The email of the trigger's service account. The service account
3046    /// must have permission to invoke Cloud Run services, the permission is
3047    /// `run.routes.invoke`.
3048    /// If empty, defaults to the Compute Engine default service account:
3049    /// `{project_number}-compute@developer.gserviceaccount.com`.
3050    pub service_account_email: std::string::String,
3051
3052    /// Optional. If unset, then defaults to ignoring failures (i.e. not retrying
3053    /// them).
3054    pub retry_policy: crate::model::event_trigger::RetryPolicy,
3055
3056    /// Optional. The name of the channel associated with the trigger in
3057    /// `projects/{project}/locations/{location}/channels/{channel}` format.
3058    /// You must provide a channel to receive events from Eventarc SaaS partners.
3059    pub channel: std::string::String,
3060
3061    /// Optional. The hostname of the service that 1st Gen function should be
3062    /// observed.
3063    ///
3064    /// If no string is provided, the default service implementing the API will
3065    /// be used. For example, `storage.googleapis.com` is the default for all
3066    /// event types in the `google.storage` namespace.
3067    ///
3068    /// The field is only applicable to 1st Gen functions.
3069    pub service: std::string::String,
3070
3071    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3072}
3073
3074impl EventTrigger {
3075    /// Creates a new default instance.
3076    pub fn new() -> Self {
3077        std::default::Default::default()
3078    }
3079
3080    /// Sets the value of [trigger][crate::model::EventTrigger::trigger].
3081    ///
3082    /// # Example
3083    /// ```ignore,no_run
3084    /// # use google_cloud_functions_v2::model::EventTrigger;
3085    /// let x = EventTrigger::new().set_trigger("example");
3086    /// ```
3087    pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3088        self.trigger = v.into();
3089        self
3090    }
3091
3092    /// Sets the value of [trigger_region][crate::model::EventTrigger::trigger_region].
3093    ///
3094    /// # Example
3095    /// ```ignore,no_run
3096    /// # use google_cloud_functions_v2::model::EventTrigger;
3097    /// let x = EventTrigger::new().set_trigger_region("example");
3098    /// ```
3099    pub fn set_trigger_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3100        self.trigger_region = v.into();
3101        self
3102    }
3103
3104    /// Sets the value of [event_type][crate::model::EventTrigger::event_type].
3105    ///
3106    /// # Example
3107    /// ```ignore,no_run
3108    /// # use google_cloud_functions_v2::model::EventTrigger;
3109    /// let x = EventTrigger::new().set_event_type("example");
3110    /// ```
3111    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3112        self.event_type = v.into();
3113        self
3114    }
3115
3116    /// Sets the value of [event_filters][crate::model::EventTrigger::event_filters].
3117    ///
3118    /// # Example
3119    /// ```ignore,no_run
3120    /// # use google_cloud_functions_v2::model::EventTrigger;
3121    /// use google_cloud_functions_v2::model::EventFilter;
3122    /// let x = EventTrigger::new()
3123    ///     .set_event_filters([
3124    ///         EventFilter::default()/* use setters */,
3125    ///         EventFilter::default()/* use (different) setters */,
3126    ///     ]);
3127    /// ```
3128    pub fn set_event_filters<T, V>(mut self, v: T) -> Self
3129    where
3130        T: std::iter::IntoIterator<Item = V>,
3131        V: std::convert::Into<crate::model::EventFilter>,
3132    {
3133        use std::iter::Iterator;
3134        self.event_filters = v.into_iter().map(|i| i.into()).collect();
3135        self
3136    }
3137
3138    /// Sets the value of [pubsub_topic][crate::model::EventTrigger::pubsub_topic].
3139    ///
3140    /// # Example
3141    /// ```ignore,no_run
3142    /// # use google_cloud_functions_v2::model::EventTrigger;
3143    /// let x = EventTrigger::new().set_pubsub_topic("example");
3144    /// ```
3145    pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3146        self.pubsub_topic = v.into();
3147        self
3148    }
3149
3150    /// Sets the value of [service_account_email][crate::model::EventTrigger::service_account_email].
3151    ///
3152    /// # Example
3153    /// ```ignore,no_run
3154    /// # use google_cloud_functions_v2::model::EventTrigger;
3155    /// let x = EventTrigger::new().set_service_account_email("example");
3156    /// ```
3157    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
3158        mut self,
3159        v: T,
3160    ) -> Self {
3161        self.service_account_email = v.into();
3162        self
3163    }
3164
3165    /// Sets the value of [retry_policy][crate::model::EventTrigger::retry_policy].
3166    ///
3167    /// # Example
3168    /// ```ignore,no_run
3169    /// # use google_cloud_functions_v2::model::EventTrigger;
3170    /// use google_cloud_functions_v2::model::event_trigger::RetryPolicy;
3171    /// let x0 = EventTrigger::new().set_retry_policy(RetryPolicy::DoNotRetry);
3172    /// let x1 = EventTrigger::new().set_retry_policy(RetryPolicy::Retry);
3173    /// ```
3174    pub fn set_retry_policy<T: std::convert::Into<crate::model::event_trigger::RetryPolicy>>(
3175        mut self,
3176        v: T,
3177    ) -> Self {
3178        self.retry_policy = v.into();
3179        self
3180    }
3181
3182    /// Sets the value of [channel][crate::model::EventTrigger::channel].
3183    ///
3184    /// # Example
3185    /// ```ignore,no_run
3186    /// # use google_cloud_functions_v2::model::EventTrigger;
3187    /// let x = EventTrigger::new().set_channel("example");
3188    /// ```
3189    pub fn set_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3190        self.channel = v.into();
3191        self
3192    }
3193
3194    /// Sets the value of [service][crate::model::EventTrigger::service].
3195    ///
3196    /// # Example
3197    /// ```ignore,no_run
3198    /// # use google_cloud_functions_v2::model::EventTrigger;
3199    /// let x = EventTrigger::new().set_service("example");
3200    /// ```
3201    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3202        self.service = v.into();
3203        self
3204    }
3205}
3206
3207impl wkt::message::Message for EventTrigger {
3208    fn typename() -> &'static str {
3209        "type.googleapis.com/google.cloud.functions.v2.EventTrigger"
3210    }
3211}
3212
3213/// Defines additional types related to [EventTrigger].
3214pub mod event_trigger {
3215    #[allow(unused_imports)]
3216    use super::*;
3217
3218    /// Describes the retry policy in case of function's execution failure.
3219    /// Retried execution is charged as any other execution.
3220    ///
3221    /// # Working with unknown values
3222    ///
3223    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3224    /// additional enum variants at any time. Adding new variants is not considered
3225    /// a breaking change. Applications should write their code in anticipation of:
3226    ///
3227    /// - New values appearing in future releases of the client library, **and**
3228    /// - New values received dynamically, without application changes.
3229    ///
3230    /// Please consult the [Working with enums] section in the user guide for some
3231    /// guidelines.
3232    ///
3233    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3234    #[derive(Clone, Debug, PartialEq)]
3235    #[non_exhaustive]
3236    pub enum RetryPolicy {
3237        /// Not specified.
3238        Unspecified,
3239        /// Do not retry.
3240        DoNotRetry,
3241        /// Retry on any failure, retry up to 7 days with an exponential backoff
3242        /// (capped at 10 seconds).
3243        Retry,
3244        /// If set, the enum was initialized with an unknown value.
3245        ///
3246        /// Applications can examine the value using [RetryPolicy::value] or
3247        /// [RetryPolicy::name].
3248        UnknownValue(retry_policy::UnknownValue),
3249    }
3250
3251    #[doc(hidden)]
3252    pub mod retry_policy {
3253        #[allow(unused_imports)]
3254        use super::*;
3255        #[derive(Clone, Debug, PartialEq)]
3256        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3257    }
3258
3259    impl RetryPolicy {
3260        /// Gets the enum value.
3261        ///
3262        /// Returns `None` if the enum contains an unknown value deserialized from
3263        /// the string representation of enums.
3264        pub fn value(&self) -> std::option::Option<i32> {
3265            match self {
3266                Self::Unspecified => std::option::Option::Some(0),
3267                Self::DoNotRetry => std::option::Option::Some(1),
3268                Self::Retry => std::option::Option::Some(2),
3269                Self::UnknownValue(u) => u.0.value(),
3270            }
3271        }
3272
3273        /// Gets the enum value as a string.
3274        ///
3275        /// Returns `None` if the enum contains an unknown value deserialized from
3276        /// the integer representation of enums.
3277        pub fn name(&self) -> std::option::Option<&str> {
3278            match self {
3279                Self::Unspecified => std::option::Option::Some("RETRY_POLICY_UNSPECIFIED"),
3280                Self::DoNotRetry => std::option::Option::Some("RETRY_POLICY_DO_NOT_RETRY"),
3281                Self::Retry => std::option::Option::Some("RETRY_POLICY_RETRY"),
3282                Self::UnknownValue(u) => u.0.name(),
3283            }
3284        }
3285    }
3286
3287    impl std::default::Default for RetryPolicy {
3288        fn default() -> Self {
3289            use std::convert::From;
3290            Self::from(0)
3291        }
3292    }
3293
3294    impl std::fmt::Display for RetryPolicy {
3295        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3296            wkt::internal::display_enum(f, self.name(), self.value())
3297        }
3298    }
3299
3300    impl std::convert::From<i32> for RetryPolicy {
3301        fn from(value: i32) -> Self {
3302            match value {
3303                0 => Self::Unspecified,
3304                1 => Self::DoNotRetry,
3305                2 => Self::Retry,
3306                _ => Self::UnknownValue(retry_policy::UnknownValue(
3307                    wkt::internal::UnknownEnumValue::Integer(value),
3308                )),
3309            }
3310        }
3311    }
3312
3313    impl std::convert::From<&str> for RetryPolicy {
3314        fn from(value: &str) -> Self {
3315            use std::string::ToString;
3316            match value {
3317                "RETRY_POLICY_UNSPECIFIED" => Self::Unspecified,
3318                "RETRY_POLICY_DO_NOT_RETRY" => Self::DoNotRetry,
3319                "RETRY_POLICY_RETRY" => Self::Retry,
3320                _ => Self::UnknownValue(retry_policy::UnknownValue(
3321                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3322                )),
3323            }
3324        }
3325    }
3326
3327    impl serde::ser::Serialize for RetryPolicy {
3328        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3329        where
3330            S: serde::Serializer,
3331        {
3332            match self {
3333                Self::Unspecified => serializer.serialize_i32(0),
3334                Self::DoNotRetry => serializer.serialize_i32(1),
3335                Self::Retry => serializer.serialize_i32(2),
3336                Self::UnknownValue(u) => u.0.serialize(serializer),
3337            }
3338        }
3339    }
3340
3341    impl<'de> serde::de::Deserialize<'de> for RetryPolicy {
3342        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3343        where
3344            D: serde::Deserializer<'de>,
3345        {
3346            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetryPolicy>::new(
3347                ".google.cloud.functions.v2.EventTrigger.RetryPolicy",
3348            ))
3349        }
3350    }
3351}
3352
3353/// Filters events based on exact matches on the CloudEvents attributes.
3354#[derive(Clone, Default, PartialEq)]
3355#[non_exhaustive]
3356pub struct EventFilter {
3357    /// Required. The name of a CloudEvents attribute.
3358    pub attribute: std::string::String,
3359
3360    /// Required. The value for the attribute.
3361    pub value: std::string::String,
3362
3363    /// Optional. The operator used for matching the events with the value of the
3364    /// filter. If not specified, only events that have an exact key-value pair
3365    /// specified in the filter are matched. The only allowed value is
3366    /// `match-path-pattern`.
3367    pub operator: std::string::String,
3368
3369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3370}
3371
3372impl EventFilter {
3373    /// Creates a new default instance.
3374    pub fn new() -> Self {
3375        std::default::Default::default()
3376    }
3377
3378    /// Sets the value of [attribute][crate::model::EventFilter::attribute].
3379    ///
3380    /// # Example
3381    /// ```ignore,no_run
3382    /// # use google_cloud_functions_v2::model::EventFilter;
3383    /// let x = EventFilter::new().set_attribute("example");
3384    /// ```
3385    pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3386        self.attribute = v.into();
3387        self
3388    }
3389
3390    /// Sets the value of [value][crate::model::EventFilter::value].
3391    ///
3392    /// # Example
3393    /// ```ignore,no_run
3394    /// # use google_cloud_functions_v2::model::EventFilter;
3395    /// let x = EventFilter::new().set_value("example");
3396    /// ```
3397    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3398        self.value = v.into();
3399        self
3400    }
3401
3402    /// Sets the value of [operator][crate::model::EventFilter::operator].
3403    ///
3404    /// # Example
3405    /// ```ignore,no_run
3406    /// # use google_cloud_functions_v2::model::EventFilter;
3407    /// let x = EventFilter::new().set_operator("example");
3408    /// ```
3409    pub fn set_operator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3410        self.operator = v.into();
3411        self
3412    }
3413}
3414
3415impl wkt::message::Message for EventFilter {
3416    fn typename() -> &'static str {
3417        "type.googleapis.com/google.cloud.functions.v2.EventFilter"
3418    }
3419}
3420
3421/// Request for the `GetFunction` method.
3422#[derive(Clone, Default, PartialEq)]
3423#[non_exhaustive]
3424pub struct GetFunctionRequest {
3425    /// Required. The name of the function which details should be obtained.
3426    pub name: std::string::String,
3427
3428    /// Optional. The optional version of the 1st gen function whose details should
3429    /// be obtained. The version of a 1st gen function is an integer that starts
3430    /// from 1 and gets incremented on redeployments. GCF may keep historical
3431    /// configs for old versions of 1st gen function. This field can be specified
3432    /// to fetch the historical configs. This field is valid only for GCF 1st gen
3433    /// function.
3434    pub revision: std::string::String,
3435
3436    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3437}
3438
3439impl GetFunctionRequest {
3440    /// Creates a new default instance.
3441    pub fn new() -> Self {
3442        std::default::Default::default()
3443    }
3444
3445    /// Sets the value of [name][crate::model::GetFunctionRequest::name].
3446    ///
3447    /// # Example
3448    /// ```ignore,no_run
3449    /// # use google_cloud_functions_v2::model::GetFunctionRequest;
3450    /// let x = GetFunctionRequest::new().set_name("example");
3451    /// ```
3452    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3453        self.name = v.into();
3454        self
3455    }
3456
3457    /// Sets the value of [revision][crate::model::GetFunctionRequest::revision].
3458    ///
3459    /// # Example
3460    /// ```ignore,no_run
3461    /// # use google_cloud_functions_v2::model::GetFunctionRequest;
3462    /// let x = GetFunctionRequest::new().set_revision("example");
3463    /// ```
3464    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3465        self.revision = v.into();
3466        self
3467    }
3468}
3469
3470impl wkt::message::Message for GetFunctionRequest {
3471    fn typename() -> &'static str {
3472        "type.googleapis.com/google.cloud.functions.v2.GetFunctionRequest"
3473    }
3474}
3475
3476/// Request for the `ListFunctions` method.
3477#[derive(Clone, Default, PartialEq)]
3478#[non_exhaustive]
3479pub struct ListFunctionsRequest {
3480    /// Required. The project and location from which the function should be
3481    /// listed, specified in the format `projects/*/locations/*` If you want to
3482    /// list functions in all locations, use "-" in place of a location. When
3483    /// listing functions in all locations, if one or more location(s) are
3484    /// unreachable, the response will contain functions from all reachable
3485    /// locations along with the names of any unreachable locations.
3486    pub parent: std::string::String,
3487
3488    /// Maximum number of functions to return per call. The largest allowed
3489    /// page_size is 1,000, if the page_size is omitted or specified as greater
3490    /// than 1,000 then it will be replaced as 1,000. The size of the list
3491    /// response can be less than specified when used with filters.
3492    pub page_size: i32,
3493
3494    /// The value returned by the last
3495    /// `ListFunctionsResponse`; indicates that
3496    /// this is a continuation of a prior `ListFunctions` call, and that the
3497    /// system should return the next page of data.
3498    pub page_token: std::string::String,
3499
3500    /// The filter for Functions that match the filter expression,
3501    /// following the syntax outlined in <https://google.aip.dev/160>.
3502    pub filter: std::string::String,
3503
3504    /// The sorting order of the resources returned. Value should be a comma
3505    /// separated list of fields. The default sorting order is ascending.
3506    /// See <https://google.aip.dev/132#ordering>.
3507    pub order_by: std::string::String,
3508
3509    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3510}
3511
3512impl ListFunctionsRequest {
3513    /// Creates a new default instance.
3514    pub fn new() -> Self {
3515        std::default::Default::default()
3516    }
3517
3518    /// Sets the value of [parent][crate::model::ListFunctionsRequest::parent].
3519    ///
3520    /// # Example
3521    /// ```ignore,no_run
3522    /// # use google_cloud_functions_v2::model::ListFunctionsRequest;
3523    /// let x = ListFunctionsRequest::new().set_parent("example");
3524    /// ```
3525    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3526        self.parent = v.into();
3527        self
3528    }
3529
3530    /// Sets the value of [page_size][crate::model::ListFunctionsRequest::page_size].
3531    ///
3532    /// # Example
3533    /// ```ignore,no_run
3534    /// # use google_cloud_functions_v2::model::ListFunctionsRequest;
3535    /// let x = ListFunctionsRequest::new().set_page_size(42);
3536    /// ```
3537    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3538        self.page_size = v.into();
3539        self
3540    }
3541
3542    /// Sets the value of [page_token][crate::model::ListFunctionsRequest::page_token].
3543    ///
3544    /// # Example
3545    /// ```ignore,no_run
3546    /// # use google_cloud_functions_v2::model::ListFunctionsRequest;
3547    /// let x = ListFunctionsRequest::new().set_page_token("example");
3548    /// ```
3549    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3550        self.page_token = v.into();
3551        self
3552    }
3553
3554    /// Sets the value of [filter][crate::model::ListFunctionsRequest::filter].
3555    ///
3556    /// # Example
3557    /// ```ignore,no_run
3558    /// # use google_cloud_functions_v2::model::ListFunctionsRequest;
3559    /// let x = ListFunctionsRequest::new().set_filter("example");
3560    /// ```
3561    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3562        self.filter = v.into();
3563        self
3564    }
3565
3566    /// Sets the value of [order_by][crate::model::ListFunctionsRequest::order_by].
3567    ///
3568    /// # Example
3569    /// ```ignore,no_run
3570    /// # use google_cloud_functions_v2::model::ListFunctionsRequest;
3571    /// let x = ListFunctionsRequest::new().set_order_by("example");
3572    /// ```
3573    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3574        self.order_by = v.into();
3575        self
3576    }
3577}
3578
3579impl wkt::message::Message for ListFunctionsRequest {
3580    fn typename() -> &'static str {
3581        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsRequest"
3582    }
3583}
3584
3585/// Response for the `ListFunctions` method.
3586#[derive(Clone, Default, PartialEq)]
3587#[non_exhaustive]
3588pub struct ListFunctionsResponse {
3589    /// The functions that match the request.
3590    pub functions: std::vec::Vec<crate::model::Function>,
3591
3592    /// A token, which can be sent as `page_token` to retrieve the next page.
3593    /// If this field is omitted, there are no subsequent pages.
3594    pub next_page_token: std::string::String,
3595
3596    /// Locations that could not be reached. The response does not include any
3597    /// functions from these locations.
3598    pub unreachable: std::vec::Vec<std::string::String>,
3599
3600    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3601}
3602
3603impl ListFunctionsResponse {
3604    /// Creates a new default instance.
3605    pub fn new() -> Self {
3606        std::default::Default::default()
3607    }
3608
3609    /// Sets the value of [functions][crate::model::ListFunctionsResponse::functions].
3610    ///
3611    /// # Example
3612    /// ```ignore,no_run
3613    /// # use google_cloud_functions_v2::model::ListFunctionsResponse;
3614    /// use google_cloud_functions_v2::model::Function;
3615    /// let x = ListFunctionsResponse::new()
3616    ///     .set_functions([
3617    ///         Function::default()/* use setters */,
3618    ///         Function::default()/* use (different) setters */,
3619    ///     ]);
3620    /// ```
3621    pub fn set_functions<T, V>(mut self, v: T) -> Self
3622    where
3623        T: std::iter::IntoIterator<Item = V>,
3624        V: std::convert::Into<crate::model::Function>,
3625    {
3626        use std::iter::Iterator;
3627        self.functions = v.into_iter().map(|i| i.into()).collect();
3628        self
3629    }
3630
3631    /// Sets the value of [next_page_token][crate::model::ListFunctionsResponse::next_page_token].
3632    ///
3633    /// # Example
3634    /// ```ignore,no_run
3635    /// # use google_cloud_functions_v2::model::ListFunctionsResponse;
3636    /// let x = ListFunctionsResponse::new().set_next_page_token("example");
3637    /// ```
3638    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3639        self.next_page_token = v.into();
3640        self
3641    }
3642
3643    /// Sets the value of [unreachable][crate::model::ListFunctionsResponse::unreachable].
3644    ///
3645    /// # Example
3646    /// ```ignore,no_run
3647    /// # use google_cloud_functions_v2::model::ListFunctionsResponse;
3648    /// let x = ListFunctionsResponse::new().set_unreachable(["a", "b", "c"]);
3649    /// ```
3650    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3651    where
3652        T: std::iter::IntoIterator<Item = V>,
3653        V: std::convert::Into<std::string::String>,
3654    {
3655        use std::iter::Iterator;
3656        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3657        self
3658    }
3659}
3660
3661impl wkt::message::Message for ListFunctionsResponse {
3662    fn typename() -> &'static str {
3663        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsResponse"
3664    }
3665}
3666
3667#[doc(hidden)]
3668impl google_cloud_gax::paginator::internal::PageableResponse for ListFunctionsResponse {
3669    type PageItem = crate::model::Function;
3670
3671    fn items(self) -> std::vec::Vec<Self::PageItem> {
3672        self.functions
3673    }
3674
3675    fn next_page_token(&self) -> std::string::String {
3676        use std::clone::Clone;
3677        self.next_page_token.clone()
3678    }
3679}
3680
3681/// Request for the `CreateFunction` method.
3682#[derive(Clone, Default, PartialEq)]
3683#[non_exhaustive]
3684pub struct CreateFunctionRequest {
3685    /// Required. The project and location in which the function should be created,
3686    /// specified in the format `projects/*/locations/*`
3687    pub parent: std::string::String,
3688
3689    /// Required. Function to be created.
3690    pub function: std::option::Option<crate::model::Function>,
3691
3692    /// The ID to use for the function, which will become the final component of
3693    /// the function's resource name.
3694    ///
3695    /// This value should be 4-63 characters, and valid characters
3696    /// are /[a-z][0-9]-/.
3697    pub function_id: std::string::String,
3698
3699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3700}
3701
3702impl CreateFunctionRequest {
3703    /// Creates a new default instance.
3704    pub fn new() -> Self {
3705        std::default::Default::default()
3706    }
3707
3708    /// Sets the value of [parent][crate::model::CreateFunctionRequest::parent].
3709    ///
3710    /// # Example
3711    /// ```ignore,no_run
3712    /// # use google_cloud_functions_v2::model::CreateFunctionRequest;
3713    /// let x = CreateFunctionRequest::new().set_parent("example");
3714    /// ```
3715    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3716        self.parent = v.into();
3717        self
3718    }
3719
3720    /// Sets the value of [function][crate::model::CreateFunctionRequest::function].
3721    ///
3722    /// # Example
3723    /// ```ignore,no_run
3724    /// # use google_cloud_functions_v2::model::CreateFunctionRequest;
3725    /// use google_cloud_functions_v2::model::Function;
3726    /// let x = CreateFunctionRequest::new().set_function(Function::default()/* use setters */);
3727    /// ```
3728    pub fn set_function<T>(mut self, v: T) -> Self
3729    where
3730        T: std::convert::Into<crate::model::Function>,
3731    {
3732        self.function = std::option::Option::Some(v.into());
3733        self
3734    }
3735
3736    /// Sets or clears the value of [function][crate::model::CreateFunctionRequest::function].
3737    ///
3738    /// # Example
3739    /// ```ignore,no_run
3740    /// # use google_cloud_functions_v2::model::CreateFunctionRequest;
3741    /// use google_cloud_functions_v2::model::Function;
3742    /// let x = CreateFunctionRequest::new().set_or_clear_function(Some(Function::default()/* use setters */));
3743    /// let x = CreateFunctionRequest::new().set_or_clear_function(None::<Function>);
3744    /// ```
3745    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
3746    where
3747        T: std::convert::Into<crate::model::Function>,
3748    {
3749        self.function = v.map(|x| x.into());
3750        self
3751    }
3752
3753    /// Sets the value of [function_id][crate::model::CreateFunctionRequest::function_id].
3754    ///
3755    /// # Example
3756    /// ```ignore,no_run
3757    /// # use google_cloud_functions_v2::model::CreateFunctionRequest;
3758    /// let x = CreateFunctionRequest::new().set_function_id("example");
3759    /// ```
3760    pub fn set_function_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3761        self.function_id = v.into();
3762        self
3763    }
3764}
3765
3766impl wkt::message::Message for CreateFunctionRequest {
3767    fn typename() -> &'static str {
3768        "type.googleapis.com/google.cloud.functions.v2.CreateFunctionRequest"
3769    }
3770}
3771
3772/// Request for the `UpdateFunction` method.
3773#[derive(Clone, Default, PartialEq)]
3774#[non_exhaustive]
3775pub struct UpdateFunctionRequest {
3776    /// Required. New version of the function.
3777    pub function: std::option::Option<crate::model::Function>,
3778
3779    /// The list of fields to be updated.
3780    /// If no field mask is provided, all fields will be updated.
3781    pub update_mask: std::option::Option<wkt::FieldMask>,
3782
3783    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3784}
3785
3786impl UpdateFunctionRequest {
3787    /// Creates a new default instance.
3788    pub fn new() -> Self {
3789        std::default::Default::default()
3790    }
3791
3792    /// Sets the value of [function][crate::model::UpdateFunctionRequest::function].
3793    ///
3794    /// # Example
3795    /// ```ignore,no_run
3796    /// # use google_cloud_functions_v2::model::UpdateFunctionRequest;
3797    /// use google_cloud_functions_v2::model::Function;
3798    /// let x = UpdateFunctionRequest::new().set_function(Function::default()/* use setters */);
3799    /// ```
3800    pub fn set_function<T>(mut self, v: T) -> Self
3801    where
3802        T: std::convert::Into<crate::model::Function>,
3803    {
3804        self.function = std::option::Option::Some(v.into());
3805        self
3806    }
3807
3808    /// Sets or clears the value of [function][crate::model::UpdateFunctionRequest::function].
3809    ///
3810    /// # Example
3811    /// ```ignore,no_run
3812    /// # use google_cloud_functions_v2::model::UpdateFunctionRequest;
3813    /// use google_cloud_functions_v2::model::Function;
3814    /// let x = UpdateFunctionRequest::new().set_or_clear_function(Some(Function::default()/* use setters */));
3815    /// let x = UpdateFunctionRequest::new().set_or_clear_function(None::<Function>);
3816    /// ```
3817    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
3818    where
3819        T: std::convert::Into<crate::model::Function>,
3820    {
3821        self.function = v.map(|x| x.into());
3822        self
3823    }
3824
3825    /// Sets the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
3826    ///
3827    /// # Example
3828    /// ```ignore,no_run
3829    /// # use google_cloud_functions_v2::model::UpdateFunctionRequest;
3830    /// use wkt::FieldMask;
3831    /// let x = UpdateFunctionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3832    /// ```
3833    pub fn set_update_mask<T>(mut self, v: T) -> Self
3834    where
3835        T: std::convert::Into<wkt::FieldMask>,
3836    {
3837        self.update_mask = std::option::Option::Some(v.into());
3838        self
3839    }
3840
3841    /// Sets or clears the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
3842    ///
3843    /// # Example
3844    /// ```ignore,no_run
3845    /// # use google_cloud_functions_v2::model::UpdateFunctionRequest;
3846    /// use wkt::FieldMask;
3847    /// let x = UpdateFunctionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3848    /// let x = UpdateFunctionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3849    /// ```
3850    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3851    where
3852        T: std::convert::Into<wkt::FieldMask>,
3853    {
3854        self.update_mask = v.map(|x| x.into());
3855        self
3856    }
3857}
3858
3859impl wkt::message::Message for UpdateFunctionRequest {
3860    fn typename() -> &'static str {
3861        "type.googleapis.com/google.cloud.functions.v2.UpdateFunctionRequest"
3862    }
3863}
3864
3865/// Request for the `DeleteFunction` method.
3866#[derive(Clone, Default, PartialEq)]
3867#[non_exhaustive]
3868pub struct DeleteFunctionRequest {
3869    /// Required. The name of the function which should be deleted.
3870    pub name: std::string::String,
3871
3872    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3873}
3874
3875impl DeleteFunctionRequest {
3876    /// Creates a new default instance.
3877    pub fn new() -> Self {
3878        std::default::Default::default()
3879    }
3880
3881    /// Sets the value of [name][crate::model::DeleteFunctionRequest::name].
3882    ///
3883    /// # Example
3884    /// ```ignore,no_run
3885    /// # use google_cloud_functions_v2::model::DeleteFunctionRequest;
3886    /// let x = DeleteFunctionRequest::new().set_name("example");
3887    /// ```
3888    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3889        self.name = v.into();
3890        self
3891    }
3892}
3893
3894impl wkt::message::Message for DeleteFunctionRequest {
3895    fn typename() -> &'static str {
3896        "type.googleapis.com/google.cloud.functions.v2.DeleteFunctionRequest"
3897    }
3898}
3899
3900/// Request of `GenerateSourceUploadUrl` method.
3901#[derive(Clone, Default, PartialEq)]
3902#[non_exhaustive]
3903pub struct GenerateUploadUrlRequest {
3904    /// Required. The project and location in which the Google Cloud Storage signed
3905    /// URL should be generated, specified in the format `projects/*/locations/*`.
3906    pub parent: std::string::String,
3907
3908    /// Resource name of a KMS crypto key (managed by the user) used to
3909    /// encrypt/decrypt function source code objects in intermediate Cloud Storage
3910    /// buckets. When you generate an upload url and upload your source code, it
3911    /// gets copied to an intermediate Cloud Storage bucket. The source code is
3912    /// then copied to a versioned directory in the sources bucket in the consumer
3913    /// project during the function deployment.
3914    ///
3915    /// It must match the pattern
3916    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
3917    ///
3918    /// The Google Cloud Functions service account
3919    /// (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
3920    /// granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
3921    /// (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
3922    /// Key/KeyRing/Project/Organization (least access preferred).
3923    pub kms_key_name: std::string::String,
3924
3925    /// The function environment the generated upload url will be used for.
3926    /// The upload url for 2nd Gen functions can also be used for 1st gen
3927    /// functions, but not vice versa. If not specified, 2nd generation-style
3928    /// upload URLs are generated.
3929    pub environment: crate::model::Environment,
3930
3931    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3932}
3933
3934impl GenerateUploadUrlRequest {
3935    /// Creates a new default instance.
3936    pub fn new() -> Self {
3937        std::default::Default::default()
3938    }
3939
3940    /// Sets the value of [parent][crate::model::GenerateUploadUrlRequest::parent].
3941    ///
3942    /// # Example
3943    /// ```ignore,no_run
3944    /// # use google_cloud_functions_v2::model::GenerateUploadUrlRequest;
3945    /// let x = GenerateUploadUrlRequest::new().set_parent("example");
3946    /// ```
3947    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3948        self.parent = v.into();
3949        self
3950    }
3951
3952    /// Sets the value of [kms_key_name][crate::model::GenerateUploadUrlRequest::kms_key_name].
3953    ///
3954    /// # Example
3955    /// ```ignore,no_run
3956    /// # use google_cloud_functions_v2::model::GenerateUploadUrlRequest;
3957    /// let x = GenerateUploadUrlRequest::new().set_kms_key_name("example");
3958    /// ```
3959    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3960        self.kms_key_name = v.into();
3961        self
3962    }
3963
3964    /// Sets the value of [environment][crate::model::GenerateUploadUrlRequest::environment].
3965    ///
3966    /// # Example
3967    /// ```ignore,no_run
3968    /// # use google_cloud_functions_v2::model::GenerateUploadUrlRequest;
3969    /// use google_cloud_functions_v2::model::Environment;
3970    /// let x0 = GenerateUploadUrlRequest::new().set_environment(Environment::Gen1);
3971    /// let x1 = GenerateUploadUrlRequest::new().set_environment(Environment::Gen2);
3972    /// ```
3973    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
3974        mut self,
3975        v: T,
3976    ) -> Self {
3977        self.environment = v.into();
3978        self
3979    }
3980}
3981
3982impl wkt::message::Message for GenerateUploadUrlRequest {
3983    fn typename() -> &'static str {
3984        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlRequest"
3985    }
3986}
3987
3988/// Response of `GenerateSourceUploadUrl` method.
3989#[derive(Clone, Default, PartialEq)]
3990#[non_exhaustive]
3991pub struct GenerateUploadUrlResponse {
3992    /// The generated Google Cloud Storage signed URL that should be used for a
3993    /// function source code upload. The uploaded file should be a zip archive
3994    /// which contains a function.
3995    pub upload_url: std::string::String,
3996
3997    /// The location of the source code in the upload bucket.
3998    ///
3999    /// Once the archive is uploaded using the `upload_url` use this field to
4000    /// set the `function.build_config.source.storage_source`
4001    /// during CreateFunction and UpdateFunction.
4002    ///
4003    /// Generation defaults to 0, as Cloud Storage provides a new generation only
4004    /// upon uploading a new object or version of an object.
4005    pub storage_source: std::option::Option<crate::model::StorageSource>,
4006
4007    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4008}
4009
4010impl GenerateUploadUrlResponse {
4011    /// Creates a new default instance.
4012    pub fn new() -> Self {
4013        std::default::Default::default()
4014    }
4015
4016    /// Sets the value of [upload_url][crate::model::GenerateUploadUrlResponse::upload_url].
4017    ///
4018    /// # Example
4019    /// ```ignore,no_run
4020    /// # use google_cloud_functions_v2::model::GenerateUploadUrlResponse;
4021    /// let x = GenerateUploadUrlResponse::new().set_upload_url("example");
4022    /// ```
4023    pub fn set_upload_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4024        self.upload_url = v.into();
4025        self
4026    }
4027
4028    /// Sets the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
4029    ///
4030    /// # Example
4031    /// ```ignore,no_run
4032    /// # use google_cloud_functions_v2::model::GenerateUploadUrlResponse;
4033    /// use google_cloud_functions_v2::model::StorageSource;
4034    /// let x = GenerateUploadUrlResponse::new().set_storage_source(StorageSource::default()/* use setters */);
4035    /// ```
4036    pub fn set_storage_source<T>(mut self, v: T) -> Self
4037    where
4038        T: std::convert::Into<crate::model::StorageSource>,
4039    {
4040        self.storage_source = std::option::Option::Some(v.into());
4041        self
4042    }
4043
4044    /// Sets or clears the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
4045    ///
4046    /// # Example
4047    /// ```ignore,no_run
4048    /// # use google_cloud_functions_v2::model::GenerateUploadUrlResponse;
4049    /// use google_cloud_functions_v2::model::StorageSource;
4050    /// let x = GenerateUploadUrlResponse::new().set_or_clear_storage_source(Some(StorageSource::default()/* use setters */));
4051    /// let x = GenerateUploadUrlResponse::new().set_or_clear_storage_source(None::<StorageSource>);
4052    /// ```
4053    pub fn set_or_clear_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
4054    where
4055        T: std::convert::Into<crate::model::StorageSource>,
4056    {
4057        self.storage_source = v.map(|x| x.into());
4058        self
4059    }
4060}
4061
4062impl wkt::message::Message for GenerateUploadUrlResponse {
4063    fn typename() -> &'static str {
4064        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlResponse"
4065    }
4066}
4067
4068/// Request of `GenerateDownloadUrl` method.
4069#[derive(Clone, Default, PartialEq)]
4070#[non_exhaustive]
4071pub struct GenerateDownloadUrlRequest {
4072    /// Required. The name of function for which source code Google Cloud Storage
4073    /// signed URL should be generated.
4074    pub name: std::string::String,
4075
4076    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4077}
4078
4079impl GenerateDownloadUrlRequest {
4080    /// Creates a new default instance.
4081    pub fn new() -> Self {
4082        std::default::Default::default()
4083    }
4084
4085    /// Sets the value of [name][crate::model::GenerateDownloadUrlRequest::name].
4086    ///
4087    /// # Example
4088    /// ```ignore,no_run
4089    /// # use google_cloud_functions_v2::model::GenerateDownloadUrlRequest;
4090    /// let x = GenerateDownloadUrlRequest::new().set_name("example");
4091    /// ```
4092    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4093        self.name = v.into();
4094        self
4095    }
4096}
4097
4098impl wkt::message::Message for GenerateDownloadUrlRequest {
4099    fn typename() -> &'static str {
4100        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlRequest"
4101    }
4102}
4103
4104/// Response of `GenerateDownloadUrl` method.
4105#[derive(Clone, Default, PartialEq)]
4106#[non_exhaustive]
4107pub struct GenerateDownloadUrlResponse {
4108    /// The generated Google Cloud Storage signed URL that should be used for
4109    /// function source code download.
4110    pub download_url: std::string::String,
4111
4112    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4113}
4114
4115impl GenerateDownloadUrlResponse {
4116    /// Creates a new default instance.
4117    pub fn new() -> Self {
4118        std::default::Default::default()
4119    }
4120
4121    /// Sets the value of [download_url][crate::model::GenerateDownloadUrlResponse::download_url].
4122    ///
4123    /// # Example
4124    /// ```ignore,no_run
4125    /// # use google_cloud_functions_v2::model::GenerateDownloadUrlResponse;
4126    /// let x = GenerateDownloadUrlResponse::new().set_download_url("example");
4127    /// ```
4128    pub fn set_download_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4129        self.download_url = v.into();
4130        self
4131    }
4132}
4133
4134impl wkt::message::Message for GenerateDownloadUrlResponse {
4135    fn typename() -> &'static str {
4136        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlResponse"
4137    }
4138}
4139
4140/// Request for the `ListRuntimes` method.
4141#[derive(Clone, Default, PartialEq)]
4142#[non_exhaustive]
4143pub struct ListRuntimesRequest {
4144    /// Required. The project and location from which the runtimes should be
4145    /// listed, specified in the format `projects/*/locations/*`
4146    pub parent: std::string::String,
4147
4148    /// The filter for Runtimes that match the filter expression,
4149    /// following the syntax outlined in <https://google.aip.dev/160>.
4150    pub filter: std::string::String,
4151
4152    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4153}
4154
4155impl ListRuntimesRequest {
4156    /// Creates a new default instance.
4157    pub fn new() -> Self {
4158        std::default::Default::default()
4159    }
4160
4161    /// Sets the value of [parent][crate::model::ListRuntimesRequest::parent].
4162    ///
4163    /// # Example
4164    /// ```ignore,no_run
4165    /// # use google_cloud_functions_v2::model::ListRuntimesRequest;
4166    /// let x = ListRuntimesRequest::new().set_parent("example");
4167    /// ```
4168    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4169        self.parent = v.into();
4170        self
4171    }
4172
4173    /// Sets the value of [filter][crate::model::ListRuntimesRequest::filter].
4174    ///
4175    /// # Example
4176    /// ```ignore,no_run
4177    /// # use google_cloud_functions_v2::model::ListRuntimesRequest;
4178    /// let x = ListRuntimesRequest::new().set_filter("example");
4179    /// ```
4180    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4181        self.filter = v.into();
4182        self
4183    }
4184}
4185
4186impl wkt::message::Message for ListRuntimesRequest {
4187    fn typename() -> &'static str {
4188        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesRequest"
4189    }
4190}
4191
4192/// Response for the `ListRuntimes` method.
4193#[derive(Clone, Default, PartialEq)]
4194#[non_exhaustive]
4195pub struct ListRuntimesResponse {
4196    /// The runtimes that match the request.
4197    pub runtimes: std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
4198
4199    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4200}
4201
4202impl ListRuntimesResponse {
4203    /// Creates a new default instance.
4204    pub fn new() -> Self {
4205        std::default::Default::default()
4206    }
4207
4208    /// Sets the value of [runtimes][crate::model::ListRuntimesResponse::runtimes].
4209    ///
4210    /// # Example
4211    /// ```ignore,no_run
4212    /// # use google_cloud_functions_v2::model::ListRuntimesResponse;
4213    /// use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4214    /// let x = ListRuntimesResponse::new()
4215    ///     .set_runtimes([
4216    ///         Runtime::default()/* use setters */,
4217    ///         Runtime::default()/* use (different) setters */,
4218    ///     ]);
4219    /// ```
4220    pub fn set_runtimes<T, V>(mut self, v: T) -> Self
4221    where
4222        T: std::iter::IntoIterator<Item = V>,
4223        V: std::convert::Into<crate::model::list_runtimes_response::Runtime>,
4224    {
4225        use std::iter::Iterator;
4226        self.runtimes = v.into_iter().map(|i| i.into()).collect();
4227        self
4228    }
4229}
4230
4231impl wkt::message::Message for ListRuntimesResponse {
4232    fn typename() -> &'static str {
4233        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse"
4234    }
4235}
4236
4237/// Defines additional types related to [ListRuntimesResponse].
4238pub mod list_runtimes_response {
4239    #[allow(unused_imports)]
4240    use super::*;
4241
4242    /// Describes a runtime and any special information (e.g., deprecation status)
4243    /// related to it.
4244    #[derive(Clone, Default, PartialEq)]
4245    #[non_exhaustive]
4246    pub struct Runtime {
4247        /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
4248        pub name: std::string::String,
4249
4250        /// The user facing name, eg 'Go 1.13', 'Node.js 12', etc.
4251        pub display_name: std::string::String,
4252
4253        /// The stage of life this runtime is in, e.g., BETA, GA, etc.
4254        pub stage: crate::model::list_runtimes_response::RuntimeStage,
4255
4256        /// Warning messages, e.g., a deprecation warning.
4257        pub warnings: std::vec::Vec<std::string::String>,
4258
4259        /// The environment for the runtime.
4260        pub environment: crate::model::Environment,
4261
4262        /// Deprecation date for the runtime.
4263        pub deprecation_date: std::option::Option<google_cloud_type::model::Date>,
4264
4265        /// Decommission date for the runtime.
4266        pub decommission_date: std::option::Option<google_cloud_type::model::Date>,
4267
4268        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4269    }
4270
4271    impl Runtime {
4272        /// Creates a new default instance.
4273        pub fn new() -> Self {
4274            std::default::Default::default()
4275        }
4276
4277        /// Sets the value of [name][crate::model::list_runtimes_response::Runtime::name].
4278        ///
4279        /// # Example
4280        /// ```ignore,no_run
4281        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4282        /// let x = Runtime::new().set_name("example");
4283        /// ```
4284        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4285            self.name = v.into();
4286            self
4287        }
4288
4289        /// Sets the value of [display_name][crate::model::list_runtimes_response::Runtime::display_name].
4290        ///
4291        /// # Example
4292        /// ```ignore,no_run
4293        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4294        /// let x = Runtime::new().set_display_name("example");
4295        /// ```
4296        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
4297            mut self,
4298            v: T,
4299        ) -> Self {
4300            self.display_name = v.into();
4301            self
4302        }
4303
4304        /// Sets the value of [stage][crate::model::list_runtimes_response::Runtime::stage].
4305        ///
4306        /// # Example
4307        /// ```ignore,no_run
4308        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4309        /// use google_cloud_functions_v2::model::list_runtimes_response::RuntimeStage;
4310        /// let x0 = Runtime::new().set_stage(RuntimeStage::Development);
4311        /// let x1 = Runtime::new().set_stage(RuntimeStage::Alpha);
4312        /// let x2 = Runtime::new().set_stage(RuntimeStage::Beta);
4313        /// ```
4314        pub fn set_stage<
4315            T: std::convert::Into<crate::model::list_runtimes_response::RuntimeStage>,
4316        >(
4317            mut self,
4318            v: T,
4319        ) -> Self {
4320            self.stage = v.into();
4321            self
4322        }
4323
4324        /// Sets the value of [warnings][crate::model::list_runtimes_response::Runtime::warnings].
4325        ///
4326        /// # Example
4327        /// ```ignore,no_run
4328        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4329        /// let x = Runtime::new().set_warnings(["a", "b", "c"]);
4330        /// ```
4331        pub fn set_warnings<T, V>(mut self, v: T) -> Self
4332        where
4333            T: std::iter::IntoIterator<Item = V>,
4334            V: std::convert::Into<std::string::String>,
4335        {
4336            use std::iter::Iterator;
4337            self.warnings = v.into_iter().map(|i| i.into()).collect();
4338            self
4339        }
4340
4341        /// Sets the value of [environment][crate::model::list_runtimes_response::Runtime::environment].
4342        ///
4343        /// # Example
4344        /// ```ignore,no_run
4345        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4346        /// use google_cloud_functions_v2::model::Environment;
4347        /// let x0 = Runtime::new().set_environment(Environment::Gen1);
4348        /// let x1 = Runtime::new().set_environment(Environment::Gen2);
4349        /// ```
4350        pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
4351            mut self,
4352            v: T,
4353        ) -> Self {
4354            self.environment = v.into();
4355            self
4356        }
4357
4358        /// Sets the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
4359        ///
4360        /// # Example
4361        /// ```ignore,no_run
4362        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4363        /// use google_cloud_type::model::Date;
4364        /// let x = Runtime::new().set_deprecation_date(Date::default()/* use setters */);
4365        /// ```
4366        pub fn set_deprecation_date<T>(mut self, v: T) -> Self
4367        where
4368            T: std::convert::Into<google_cloud_type::model::Date>,
4369        {
4370            self.deprecation_date = std::option::Option::Some(v.into());
4371            self
4372        }
4373
4374        /// Sets or clears the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
4375        ///
4376        /// # Example
4377        /// ```ignore,no_run
4378        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4379        /// use google_cloud_type::model::Date;
4380        /// let x = Runtime::new().set_or_clear_deprecation_date(Some(Date::default()/* use setters */));
4381        /// let x = Runtime::new().set_or_clear_deprecation_date(None::<Date>);
4382        /// ```
4383        pub fn set_or_clear_deprecation_date<T>(mut self, v: std::option::Option<T>) -> Self
4384        where
4385            T: std::convert::Into<google_cloud_type::model::Date>,
4386        {
4387            self.deprecation_date = v.map(|x| x.into());
4388            self
4389        }
4390
4391        /// Sets the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
4392        ///
4393        /// # Example
4394        /// ```ignore,no_run
4395        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4396        /// use google_cloud_type::model::Date;
4397        /// let x = Runtime::new().set_decommission_date(Date::default()/* use setters */);
4398        /// ```
4399        pub fn set_decommission_date<T>(mut self, v: T) -> Self
4400        where
4401            T: std::convert::Into<google_cloud_type::model::Date>,
4402        {
4403            self.decommission_date = std::option::Option::Some(v.into());
4404            self
4405        }
4406
4407        /// Sets or clears the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
4408        ///
4409        /// # Example
4410        /// ```ignore,no_run
4411        /// # use google_cloud_functions_v2::model::list_runtimes_response::Runtime;
4412        /// use google_cloud_type::model::Date;
4413        /// let x = Runtime::new().set_or_clear_decommission_date(Some(Date::default()/* use setters */));
4414        /// let x = Runtime::new().set_or_clear_decommission_date(None::<Date>);
4415        /// ```
4416        pub fn set_or_clear_decommission_date<T>(mut self, v: std::option::Option<T>) -> Self
4417        where
4418            T: std::convert::Into<google_cloud_type::model::Date>,
4419        {
4420            self.decommission_date = v.map(|x| x.into());
4421            self
4422        }
4423    }
4424
4425    impl wkt::message::Message for Runtime {
4426        fn typename() -> &'static str {
4427            "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse.Runtime"
4428        }
4429    }
4430
4431    /// The various stages that a runtime can be in.
4432    ///
4433    /// # Working with unknown values
4434    ///
4435    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4436    /// additional enum variants at any time. Adding new variants is not considered
4437    /// a breaking change. Applications should write their code in anticipation of:
4438    ///
4439    /// - New values appearing in future releases of the client library, **and**
4440    /// - New values received dynamically, without application changes.
4441    ///
4442    /// Please consult the [Working with enums] section in the user guide for some
4443    /// guidelines.
4444    ///
4445    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4446    #[derive(Clone, Debug, PartialEq)]
4447    #[non_exhaustive]
4448    pub enum RuntimeStage {
4449        /// Not specified.
4450        Unspecified,
4451        /// The runtime is in development.
4452        Development,
4453        /// The runtime is in the Alpha stage.
4454        Alpha,
4455        /// The runtime is in the Beta stage.
4456        Beta,
4457        /// The runtime is generally available.
4458        Ga,
4459        /// The runtime is deprecated.
4460        Deprecated,
4461        /// The runtime is no longer supported.
4462        Decommissioned,
4463        /// If set, the enum was initialized with an unknown value.
4464        ///
4465        /// Applications can examine the value using [RuntimeStage::value] or
4466        /// [RuntimeStage::name].
4467        UnknownValue(runtime_stage::UnknownValue),
4468    }
4469
4470    #[doc(hidden)]
4471    pub mod runtime_stage {
4472        #[allow(unused_imports)]
4473        use super::*;
4474        #[derive(Clone, Debug, PartialEq)]
4475        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4476    }
4477
4478    impl RuntimeStage {
4479        /// Gets the enum value.
4480        ///
4481        /// Returns `None` if the enum contains an unknown value deserialized from
4482        /// the string representation of enums.
4483        pub fn value(&self) -> std::option::Option<i32> {
4484            match self {
4485                Self::Unspecified => std::option::Option::Some(0),
4486                Self::Development => std::option::Option::Some(1),
4487                Self::Alpha => std::option::Option::Some(2),
4488                Self::Beta => std::option::Option::Some(3),
4489                Self::Ga => std::option::Option::Some(4),
4490                Self::Deprecated => std::option::Option::Some(5),
4491                Self::Decommissioned => std::option::Option::Some(6),
4492                Self::UnknownValue(u) => u.0.value(),
4493            }
4494        }
4495
4496        /// Gets the enum value as a string.
4497        ///
4498        /// Returns `None` if the enum contains an unknown value deserialized from
4499        /// the integer representation of enums.
4500        pub fn name(&self) -> std::option::Option<&str> {
4501            match self {
4502                Self::Unspecified => std::option::Option::Some("RUNTIME_STAGE_UNSPECIFIED"),
4503                Self::Development => std::option::Option::Some("DEVELOPMENT"),
4504                Self::Alpha => std::option::Option::Some("ALPHA"),
4505                Self::Beta => std::option::Option::Some("BETA"),
4506                Self::Ga => std::option::Option::Some("GA"),
4507                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
4508                Self::Decommissioned => std::option::Option::Some("DECOMMISSIONED"),
4509                Self::UnknownValue(u) => u.0.name(),
4510            }
4511        }
4512    }
4513
4514    impl std::default::Default for RuntimeStage {
4515        fn default() -> Self {
4516            use std::convert::From;
4517            Self::from(0)
4518        }
4519    }
4520
4521    impl std::fmt::Display for RuntimeStage {
4522        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4523            wkt::internal::display_enum(f, self.name(), self.value())
4524        }
4525    }
4526
4527    impl std::convert::From<i32> for RuntimeStage {
4528        fn from(value: i32) -> Self {
4529            match value {
4530                0 => Self::Unspecified,
4531                1 => Self::Development,
4532                2 => Self::Alpha,
4533                3 => Self::Beta,
4534                4 => Self::Ga,
4535                5 => Self::Deprecated,
4536                6 => Self::Decommissioned,
4537                _ => Self::UnknownValue(runtime_stage::UnknownValue(
4538                    wkt::internal::UnknownEnumValue::Integer(value),
4539                )),
4540            }
4541        }
4542    }
4543
4544    impl std::convert::From<&str> for RuntimeStage {
4545        fn from(value: &str) -> Self {
4546            use std::string::ToString;
4547            match value {
4548                "RUNTIME_STAGE_UNSPECIFIED" => Self::Unspecified,
4549                "DEVELOPMENT" => Self::Development,
4550                "ALPHA" => Self::Alpha,
4551                "BETA" => Self::Beta,
4552                "GA" => Self::Ga,
4553                "DEPRECATED" => Self::Deprecated,
4554                "DECOMMISSIONED" => Self::Decommissioned,
4555                _ => Self::UnknownValue(runtime_stage::UnknownValue(
4556                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4557                )),
4558            }
4559        }
4560    }
4561
4562    impl serde::ser::Serialize for RuntimeStage {
4563        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4564        where
4565            S: serde::Serializer,
4566        {
4567            match self {
4568                Self::Unspecified => serializer.serialize_i32(0),
4569                Self::Development => serializer.serialize_i32(1),
4570                Self::Alpha => serializer.serialize_i32(2),
4571                Self::Beta => serializer.serialize_i32(3),
4572                Self::Ga => serializer.serialize_i32(4),
4573                Self::Deprecated => serializer.serialize_i32(5),
4574                Self::Decommissioned => serializer.serialize_i32(6),
4575                Self::UnknownValue(u) => u.0.serialize(serializer),
4576            }
4577        }
4578    }
4579
4580    impl<'de> serde::de::Deserialize<'de> for RuntimeStage {
4581        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4582        where
4583            D: serde::Deserializer<'de>,
4584        {
4585            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuntimeStage>::new(
4586                ".google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage",
4587            ))
4588        }
4589    }
4590}
4591
4592/// Security patches are applied automatically to the runtime without requiring
4593/// the function to be redeployed.
4594#[derive(Clone, Default, PartialEq)]
4595#[non_exhaustive]
4596pub struct AutomaticUpdatePolicy {
4597    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4598}
4599
4600impl AutomaticUpdatePolicy {
4601    /// Creates a new default instance.
4602    pub fn new() -> Self {
4603        std::default::Default::default()
4604    }
4605}
4606
4607impl wkt::message::Message for AutomaticUpdatePolicy {
4608    fn typename() -> &'static str {
4609        "type.googleapis.com/google.cloud.functions.v2.AutomaticUpdatePolicy"
4610    }
4611}
4612
4613/// Security patches are only applied when a function is redeployed.
4614#[derive(Clone, Default, PartialEq)]
4615#[non_exhaustive]
4616pub struct OnDeployUpdatePolicy {
4617    /// Output only. contains the runtime version which was used during latest
4618    /// function deployment.
4619    pub runtime_version: std::string::String,
4620
4621    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4622}
4623
4624impl OnDeployUpdatePolicy {
4625    /// Creates a new default instance.
4626    pub fn new() -> Self {
4627        std::default::Default::default()
4628    }
4629
4630    /// Sets the value of [runtime_version][crate::model::OnDeployUpdatePolicy::runtime_version].
4631    ///
4632    /// # Example
4633    /// ```ignore,no_run
4634    /// # use google_cloud_functions_v2::model::OnDeployUpdatePolicy;
4635    /// let x = OnDeployUpdatePolicy::new().set_runtime_version("example");
4636    /// ```
4637    pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4638        self.runtime_version = v.into();
4639        self
4640    }
4641}
4642
4643impl wkt::message::Message for OnDeployUpdatePolicy {
4644    fn typename() -> &'static str {
4645        "type.googleapis.com/google.cloud.functions.v2.OnDeployUpdatePolicy"
4646    }
4647}
4648
4649/// Represents the metadata of the long-running operation.
4650#[derive(Clone, Default, PartialEq)]
4651#[non_exhaustive]
4652pub struct OperationMetadata {
4653    /// The time the operation was created.
4654    pub create_time: std::option::Option<wkt::Timestamp>,
4655
4656    /// The time the operation finished running.
4657    pub end_time: std::option::Option<wkt::Timestamp>,
4658
4659    /// Server-defined resource path for the target of the operation.
4660    pub target: std::string::String,
4661
4662    /// Name of the verb executed by the operation.
4663    pub verb: std::string::String,
4664
4665    /// Human-readable status of the operation, if any.
4666    pub status_detail: std::string::String,
4667
4668    /// Identifies whether the user has requested cancellation
4669    /// of the operation. Operations that have successfully been cancelled
4670    /// have
4671    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
4672    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
4673    /// corresponding to `Code.CANCELLED`.
4674    ///
4675    /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
4676    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
4677    pub cancel_requested: bool,
4678
4679    /// API version used to start the operation.
4680    pub api_version: std::string::String,
4681
4682    /// The original request that started the operation.
4683    pub request_resource: std::option::Option<wkt::Any>,
4684
4685    /// Mechanism for reporting in-progress stages
4686    pub stages: std::vec::Vec<crate::model::Stage>,
4687
4688    /// An identifier for Firebase function sources. Disclaimer: This field is only
4689    /// supported for Firebase function deployments.
4690    pub source_token: std::string::String,
4691
4692    /// The build name of the function for create and update operations.
4693    pub build_name: std::string::String,
4694
4695    /// The operation type.
4696    pub operation_type: crate::model::OperationType,
4697
4698    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4699}
4700
4701impl OperationMetadata {
4702    /// Creates a new default instance.
4703    pub fn new() -> Self {
4704        std::default::Default::default()
4705    }
4706
4707    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
4708    ///
4709    /// # Example
4710    /// ```ignore,no_run
4711    /// # use google_cloud_functions_v2::model::OperationMetadata;
4712    /// use wkt::Timestamp;
4713    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
4714    /// ```
4715    pub fn set_create_time<T>(mut self, v: T) -> Self
4716    where
4717        T: std::convert::Into<wkt::Timestamp>,
4718    {
4719        self.create_time = std::option::Option::Some(v.into());
4720        self
4721    }
4722
4723    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
4724    ///
4725    /// # Example
4726    /// ```ignore,no_run
4727    /// # use google_cloud_functions_v2::model::OperationMetadata;
4728    /// use wkt::Timestamp;
4729    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4730    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
4731    /// ```
4732    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4733    where
4734        T: std::convert::Into<wkt::Timestamp>,
4735    {
4736        self.create_time = v.map(|x| x.into());
4737        self
4738    }
4739
4740    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
4741    ///
4742    /// # Example
4743    /// ```ignore,no_run
4744    /// # use google_cloud_functions_v2::model::OperationMetadata;
4745    /// use wkt::Timestamp;
4746    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4747    /// ```
4748    pub fn set_end_time<T>(mut self, v: T) -> Self
4749    where
4750        T: std::convert::Into<wkt::Timestamp>,
4751    {
4752        self.end_time = std::option::Option::Some(v.into());
4753        self
4754    }
4755
4756    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
4757    ///
4758    /// # Example
4759    /// ```ignore,no_run
4760    /// # use google_cloud_functions_v2::model::OperationMetadata;
4761    /// use wkt::Timestamp;
4762    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4763    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4764    /// ```
4765    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4766    where
4767        T: std::convert::Into<wkt::Timestamp>,
4768    {
4769        self.end_time = v.map(|x| x.into());
4770        self
4771    }
4772
4773    /// Sets the value of [target][crate::model::OperationMetadata::target].
4774    ///
4775    /// # Example
4776    /// ```ignore,no_run
4777    /// # use google_cloud_functions_v2::model::OperationMetadata;
4778    /// let x = OperationMetadata::new().set_target("example");
4779    /// ```
4780    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4781        self.target = v.into();
4782        self
4783    }
4784
4785    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
4786    ///
4787    /// # Example
4788    /// ```ignore,no_run
4789    /// # use google_cloud_functions_v2::model::OperationMetadata;
4790    /// let x = OperationMetadata::new().set_verb("example");
4791    /// ```
4792    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4793        self.verb = v.into();
4794        self
4795    }
4796
4797    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
4798    ///
4799    /// # Example
4800    /// ```ignore,no_run
4801    /// # use google_cloud_functions_v2::model::OperationMetadata;
4802    /// let x = OperationMetadata::new().set_status_detail("example");
4803    /// ```
4804    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4805        self.status_detail = v.into();
4806        self
4807    }
4808
4809    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
4810    ///
4811    /// # Example
4812    /// ```ignore,no_run
4813    /// # use google_cloud_functions_v2::model::OperationMetadata;
4814    /// let x = OperationMetadata::new().set_cancel_requested(true);
4815    /// ```
4816    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4817        self.cancel_requested = v.into();
4818        self
4819    }
4820
4821    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
4822    ///
4823    /// # Example
4824    /// ```ignore,no_run
4825    /// # use google_cloud_functions_v2::model::OperationMetadata;
4826    /// let x = OperationMetadata::new().set_api_version("example");
4827    /// ```
4828    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4829        self.api_version = v.into();
4830        self
4831    }
4832
4833    /// Sets the value of [request_resource][crate::model::OperationMetadata::request_resource].
4834    ///
4835    /// # Example
4836    /// ```ignore,no_run
4837    /// # use google_cloud_functions_v2::model::OperationMetadata;
4838    /// use wkt::Any;
4839    /// let x = OperationMetadata::new().set_request_resource(Any::default()/* use setters */);
4840    /// ```
4841    pub fn set_request_resource<T>(mut self, v: T) -> Self
4842    where
4843        T: std::convert::Into<wkt::Any>,
4844    {
4845        self.request_resource = std::option::Option::Some(v.into());
4846        self
4847    }
4848
4849    /// Sets or clears the value of [request_resource][crate::model::OperationMetadata::request_resource].
4850    ///
4851    /// # Example
4852    /// ```ignore,no_run
4853    /// # use google_cloud_functions_v2::model::OperationMetadata;
4854    /// use wkt::Any;
4855    /// let x = OperationMetadata::new().set_or_clear_request_resource(Some(Any::default()/* use setters */));
4856    /// let x = OperationMetadata::new().set_or_clear_request_resource(None::<Any>);
4857    /// ```
4858    pub fn set_or_clear_request_resource<T>(mut self, v: std::option::Option<T>) -> Self
4859    where
4860        T: std::convert::Into<wkt::Any>,
4861    {
4862        self.request_resource = v.map(|x| x.into());
4863        self
4864    }
4865
4866    /// Sets the value of [stages][crate::model::OperationMetadata::stages].
4867    ///
4868    /// # Example
4869    /// ```ignore,no_run
4870    /// # use google_cloud_functions_v2::model::OperationMetadata;
4871    /// use google_cloud_functions_v2::model::Stage;
4872    /// let x = OperationMetadata::new()
4873    ///     .set_stages([
4874    ///         Stage::default()/* use setters */,
4875    ///         Stage::default()/* use (different) setters */,
4876    ///     ]);
4877    /// ```
4878    pub fn set_stages<T, V>(mut self, v: T) -> Self
4879    where
4880        T: std::iter::IntoIterator<Item = V>,
4881        V: std::convert::Into<crate::model::Stage>,
4882    {
4883        use std::iter::Iterator;
4884        self.stages = v.into_iter().map(|i| i.into()).collect();
4885        self
4886    }
4887
4888    /// Sets the value of [source_token][crate::model::OperationMetadata::source_token].
4889    ///
4890    /// # Example
4891    /// ```ignore,no_run
4892    /// # use google_cloud_functions_v2::model::OperationMetadata;
4893    /// let x = OperationMetadata::new().set_source_token("example");
4894    /// ```
4895    pub fn set_source_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4896        self.source_token = v.into();
4897        self
4898    }
4899
4900    /// Sets the value of [build_name][crate::model::OperationMetadata::build_name].
4901    ///
4902    /// # Example
4903    /// ```ignore,no_run
4904    /// # use google_cloud_functions_v2::model::OperationMetadata;
4905    /// let x = OperationMetadata::new().set_build_name("example");
4906    /// ```
4907    pub fn set_build_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4908        self.build_name = v.into();
4909        self
4910    }
4911
4912    /// Sets the value of [operation_type][crate::model::OperationMetadata::operation_type].
4913    ///
4914    /// # Example
4915    /// ```ignore,no_run
4916    /// # use google_cloud_functions_v2::model::OperationMetadata;
4917    /// use google_cloud_functions_v2::model::OperationType;
4918    /// let x0 = OperationMetadata::new().set_operation_type(OperationType::CreateFunction);
4919    /// let x1 = OperationMetadata::new().set_operation_type(OperationType::UpdateFunction);
4920    /// let x2 = OperationMetadata::new().set_operation_type(OperationType::DeleteFunction);
4921    /// ```
4922    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
4923        mut self,
4924        v: T,
4925    ) -> Self {
4926        self.operation_type = v.into();
4927        self
4928    }
4929}
4930
4931impl wkt::message::Message for OperationMetadata {
4932    fn typename() -> &'static str {
4933        "type.googleapis.com/google.cloud.functions.v2.OperationMetadata"
4934    }
4935}
4936
4937/// Extra GCF specific location information.
4938#[derive(Clone, Default, PartialEq)]
4939#[non_exhaustive]
4940pub struct LocationMetadata {
4941    /// The Cloud Function environments this location supports.
4942    pub environments: std::vec::Vec<crate::model::Environment>,
4943
4944    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4945}
4946
4947impl LocationMetadata {
4948    /// Creates a new default instance.
4949    pub fn new() -> Self {
4950        std::default::Default::default()
4951    }
4952
4953    /// Sets the value of [environments][crate::model::LocationMetadata::environments].
4954    ///
4955    /// # Example
4956    /// ```ignore,no_run
4957    /// # use google_cloud_functions_v2::model::LocationMetadata;
4958    /// use google_cloud_functions_v2::model::Environment;
4959    /// let x = LocationMetadata::new().set_environments([
4960    ///     Environment::Gen1,
4961    ///     Environment::Gen2,
4962    /// ]);
4963    /// ```
4964    pub fn set_environments<T, V>(mut self, v: T) -> Self
4965    where
4966        T: std::iter::IntoIterator<Item = V>,
4967        V: std::convert::Into<crate::model::Environment>,
4968    {
4969        use std::iter::Iterator;
4970        self.environments = v.into_iter().map(|i| i.into()).collect();
4971        self
4972    }
4973}
4974
4975impl wkt::message::Message for LocationMetadata {
4976    fn typename() -> &'static str {
4977        "type.googleapis.com/google.cloud.functions.v2.LocationMetadata"
4978    }
4979}
4980
4981/// Each Stage of the deployment process
4982#[derive(Clone, Default, PartialEq)]
4983#[non_exhaustive]
4984pub struct Stage {
4985    /// Name of the Stage. This will be unique for each Stage.
4986    pub name: crate::model::stage::Name,
4987
4988    /// Message describing the Stage
4989    pub message: std::string::String,
4990
4991    /// Current state of the Stage
4992    pub state: crate::model::stage::State,
4993
4994    /// Resource of the Stage
4995    pub resource: std::string::String,
4996
4997    /// Link to the current Stage resource
4998    pub resource_uri: std::string::String,
4999
5000    /// State messages from the current Stage.
5001    pub state_messages: std::vec::Vec<crate::model::StateMessage>,
5002
5003    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5004}
5005
5006impl Stage {
5007    /// Creates a new default instance.
5008    pub fn new() -> Self {
5009        std::default::Default::default()
5010    }
5011
5012    /// Sets the value of [name][crate::model::Stage::name].
5013    ///
5014    /// # Example
5015    /// ```ignore,no_run
5016    /// # use google_cloud_functions_v2::model::Stage;
5017    /// use google_cloud_functions_v2::model::stage::Name;
5018    /// let x0 = Stage::new().set_name(Name::ArtifactRegistry);
5019    /// let x1 = Stage::new().set_name(Name::Build);
5020    /// let x2 = Stage::new().set_name(Name::Service);
5021    /// ```
5022    pub fn set_name<T: std::convert::Into<crate::model::stage::Name>>(mut self, v: T) -> Self {
5023        self.name = v.into();
5024        self
5025    }
5026
5027    /// Sets the value of [message][crate::model::Stage::message].
5028    ///
5029    /// # Example
5030    /// ```ignore,no_run
5031    /// # use google_cloud_functions_v2::model::Stage;
5032    /// let x = Stage::new().set_message("example");
5033    /// ```
5034    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5035        self.message = v.into();
5036        self
5037    }
5038
5039    /// Sets the value of [state][crate::model::Stage::state].
5040    ///
5041    /// # Example
5042    /// ```ignore,no_run
5043    /// # use google_cloud_functions_v2::model::Stage;
5044    /// use google_cloud_functions_v2::model::stage::State;
5045    /// let x0 = Stage::new().set_state(State::NotStarted);
5046    /// let x1 = Stage::new().set_state(State::InProgress);
5047    /// let x2 = Stage::new().set_state(State::Complete);
5048    /// ```
5049    pub fn set_state<T: std::convert::Into<crate::model::stage::State>>(mut self, v: T) -> Self {
5050        self.state = v.into();
5051        self
5052    }
5053
5054    /// Sets the value of [resource][crate::model::Stage::resource].
5055    ///
5056    /// # Example
5057    /// ```ignore,no_run
5058    /// # use google_cloud_functions_v2::model::Stage;
5059    /// let x = Stage::new().set_resource("example");
5060    /// ```
5061    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5062        self.resource = v.into();
5063        self
5064    }
5065
5066    /// Sets the value of [resource_uri][crate::model::Stage::resource_uri].
5067    ///
5068    /// # Example
5069    /// ```ignore,no_run
5070    /// # use google_cloud_functions_v2::model::Stage;
5071    /// let x = Stage::new().set_resource_uri("example");
5072    /// ```
5073    pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5074        self.resource_uri = v.into();
5075        self
5076    }
5077
5078    /// Sets the value of [state_messages][crate::model::Stage::state_messages].
5079    ///
5080    /// # Example
5081    /// ```ignore,no_run
5082    /// # use google_cloud_functions_v2::model::Stage;
5083    /// use google_cloud_functions_v2::model::StateMessage;
5084    /// let x = Stage::new()
5085    ///     .set_state_messages([
5086    ///         StateMessage::default()/* use setters */,
5087    ///         StateMessage::default()/* use (different) setters */,
5088    ///     ]);
5089    /// ```
5090    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
5091    where
5092        T: std::iter::IntoIterator<Item = V>,
5093        V: std::convert::Into<crate::model::StateMessage>,
5094    {
5095        use std::iter::Iterator;
5096        self.state_messages = v.into_iter().map(|i| i.into()).collect();
5097        self
5098    }
5099}
5100
5101impl wkt::message::Message for Stage {
5102    fn typename() -> &'static str {
5103        "type.googleapis.com/google.cloud.functions.v2.Stage"
5104    }
5105}
5106
5107/// Defines additional types related to [Stage].
5108pub mod stage {
5109    #[allow(unused_imports)]
5110    use super::*;
5111
5112    /// Possible names for a Stage
5113    ///
5114    /// # Working with unknown values
5115    ///
5116    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5117    /// additional enum variants at any time. Adding new variants is not considered
5118    /// a breaking change. Applications should write their code in anticipation of:
5119    ///
5120    /// - New values appearing in future releases of the client library, **and**
5121    /// - New values received dynamically, without application changes.
5122    ///
5123    /// Please consult the [Working with enums] section in the user guide for some
5124    /// guidelines.
5125    ///
5126    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5127    #[derive(Clone, Debug, PartialEq)]
5128    #[non_exhaustive]
5129    pub enum Name {
5130        /// Not specified. Invalid name.
5131        Unspecified,
5132        /// Artifact Registry Stage
5133        ArtifactRegistry,
5134        /// Build Stage
5135        Build,
5136        /// Service Stage
5137        Service,
5138        /// Trigger Stage
5139        Trigger,
5140        /// Service Rollback Stage
5141        ServiceRollback,
5142        /// Trigger Rollback Stage
5143        TriggerRollback,
5144        /// If set, the enum was initialized with an unknown value.
5145        ///
5146        /// Applications can examine the value using [Name::value] or
5147        /// [Name::name].
5148        UnknownValue(name::UnknownValue),
5149    }
5150
5151    #[doc(hidden)]
5152    pub mod name {
5153        #[allow(unused_imports)]
5154        use super::*;
5155        #[derive(Clone, Debug, PartialEq)]
5156        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5157    }
5158
5159    impl Name {
5160        /// Gets the enum value.
5161        ///
5162        /// Returns `None` if the enum contains an unknown value deserialized from
5163        /// the string representation of enums.
5164        pub fn value(&self) -> std::option::Option<i32> {
5165            match self {
5166                Self::Unspecified => std::option::Option::Some(0),
5167                Self::ArtifactRegistry => std::option::Option::Some(1),
5168                Self::Build => std::option::Option::Some(2),
5169                Self::Service => std::option::Option::Some(3),
5170                Self::Trigger => std::option::Option::Some(4),
5171                Self::ServiceRollback => std::option::Option::Some(5),
5172                Self::TriggerRollback => std::option::Option::Some(6),
5173                Self::UnknownValue(u) => u.0.value(),
5174            }
5175        }
5176
5177        /// Gets the enum value as a string.
5178        ///
5179        /// Returns `None` if the enum contains an unknown value deserialized from
5180        /// the integer representation of enums.
5181        pub fn name(&self) -> std::option::Option<&str> {
5182            match self {
5183                Self::Unspecified => std::option::Option::Some("NAME_UNSPECIFIED"),
5184                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
5185                Self::Build => std::option::Option::Some("BUILD"),
5186                Self::Service => std::option::Option::Some("SERVICE"),
5187                Self::Trigger => std::option::Option::Some("TRIGGER"),
5188                Self::ServiceRollback => std::option::Option::Some("SERVICE_ROLLBACK"),
5189                Self::TriggerRollback => std::option::Option::Some("TRIGGER_ROLLBACK"),
5190                Self::UnknownValue(u) => u.0.name(),
5191            }
5192        }
5193    }
5194
5195    impl std::default::Default for Name {
5196        fn default() -> Self {
5197            use std::convert::From;
5198            Self::from(0)
5199        }
5200    }
5201
5202    impl std::fmt::Display for Name {
5203        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5204            wkt::internal::display_enum(f, self.name(), self.value())
5205        }
5206    }
5207
5208    impl std::convert::From<i32> for Name {
5209        fn from(value: i32) -> Self {
5210            match value {
5211                0 => Self::Unspecified,
5212                1 => Self::ArtifactRegistry,
5213                2 => Self::Build,
5214                3 => Self::Service,
5215                4 => Self::Trigger,
5216                5 => Self::ServiceRollback,
5217                6 => Self::TriggerRollback,
5218                _ => Self::UnknownValue(name::UnknownValue(
5219                    wkt::internal::UnknownEnumValue::Integer(value),
5220                )),
5221            }
5222        }
5223    }
5224
5225    impl std::convert::From<&str> for Name {
5226        fn from(value: &str) -> Self {
5227            use std::string::ToString;
5228            match value {
5229                "NAME_UNSPECIFIED" => Self::Unspecified,
5230                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
5231                "BUILD" => Self::Build,
5232                "SERVICE" => Self::Service,
5233                "TRIGGER" => Self::Trigger,
5234                "SERVICE_ROLLBACK" => Self::ServiceRollback,
5235                "TRIGGER_ROLLBACK" => Self::TriggerRollback,
5236                _ => Self::UnknownValue(name::UnknownValue(
5237                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5238                )),
5239            }
5240        }
5241    }
5242
5243    impl serde::ser::Serialize for Name {
5244        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5245        where
5246            S: serde::Serializer,
5247        {
5248            match self {
5249                Self::Unspecified => serializer.serialize_i32(0),
5250                Self::ArtifactRegistry => serializer.serialize_i32(1),
5251                Self::Build => serializer.serialize_i32(2),
5252                Self::Service => serializer.serialize_i32(3),
5253                Self::Trigger => serializer.serialize_i32(4),
5254                Self::ServiceRollback => serializer.serialize_i32(5),
5255                Self::TriggerRollback => serializer.serialize_i32(6),
5256                Self::UnknownValue(u) => u.0.serialize(serializer),
5257            }
5258        }
5259    }
5260
5261    impl<'de> serde::de::Deserialize<'de> for Name {
5262        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5263        where
5264            D: serde::Deserializer<'de>,
5265        {
5266            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Name>::new(
5267                ".google.cloud.functions.v2.Stage.Name",
5268            ))
5269        }
5270    }
5271
5272    /// Possible states for a Stage
5273    ///
5274    /// # Working with unknown values
5275    ///
5276    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5277    /// additional enum variants at any time. Adding new variants is not considered
5278    /// a breaking change. Applications should write their code in anticipation of:
5279    ///
5280    /// - New values appearing in future releases of the client library, **and**
5281    /// - New values received dynamically, without application changes.
5282    ///
5283    /// Please consult the [Working with enums] section in the user guide for some
5284    /// guidelines.
5285    ///
5286    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5287    #[derive(Clone, Debug, PartialEq)]
5288    #[non_exhaustive]
5289    pub enum State {
5290        /// Not specified. Invalid state.
5291        Unspecified,
5292        /// Stage has not started.
5293        NotStarted,
5294        /// Stage is in progress.
5295        InProgress,
5296        /// Stage has completed.
5297        Complete,
5298        /// If set, the enum was initialized with an unknown value.
5299        ///
5300        /// Applications can examine the value using [State::value] or
5301        /// [State::name].
5302        UnknownValue(state::UnknownValue),
5303    }
5304
5305    #[doc(hidden)]
5306    pub mod state {
5307        #[allow(unused_imports)]
5308        use super::*;
5309        #[derive(Clone, Debug, PartialEq)]
5310        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5311    }
5312
5313    impl State {
5314        /// Gets the enum value.
5315        ///
5316        /// Returns `None` if the enum contains an unknown value deserialized from
5317        /// the string representation of enums.
5318        pub fn value(&self) -> std::option::Option<i32> {
5319            match self {
5320                Self::Unspecified => std::option::Option::Some(0),
5321                Self::NotStarted => std::option::Option::Some(1),
5322                Self::InProgress => std::option::Option::Some(2),
5323                Self::Complete => std::option::Option::Some(3),
5324                Self::UnknownValue(u) => u.0.value(),
5325            }
5326        }
5327
5328        /// Gets the enum value as a string.
5329        ///
5330        /// Returns `None` if the enum contains an unknown value deserialized from
5331        /// the integer representation of enums.
5332        pub fn name(&self) -> std::option::Option<&str> {
5333            match self {
5334                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5335                Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
5336                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
5337                Self::Complete => std::option::Option::Some("COMPLETE"),
5338                Self::UnknownValue(u) => u.0.name(),
5339            }
5340        }
5341    }
5342
5343    impl std::default::Default for State {
5344        fn default() -> Self {
5345            use std::convert::From;
5346            Self::from(0)
5347        }
5348    }
5349
5350    impl std::fmt::Display for State {
5351        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5352            wkt::internal::display_enum(f, self.name(), self.value())
5353        }
5354    }
5355
5356    impl std::convert::From<i32> for State {
5357        fn from(value: i32) -> Self {
5358            match value {
5359                0 => Self::Unspecified,
5360                1 => Self::NotStarted,
5361                2 => Self::InProgress,
5362                3 => Self::Complete,
5363                _ => Self::UnknownValue(state::UnknownValue(
5364                    wkt::internal::UnknownEnumValue::Integer(value),
5365                )),
5366            }
5367        }
5368    }
5369
5370    impl std::convert::From<&str> for State {
5371        fn from(value: &str) -> Self {
5372            use std::string::ToString;
5373            match value {
5374                "STATE_UNSPECIFIED" => Self::Unspecified,
5375                "NOT_STARTED" => Self::NotStarted,
5376                "IN_PROGRESS" => Self::InProgress,
5377                "COMPLETE" => Self::Complete,
5378                _ => Self::UnknownValue(state::UnknownValue(
5379                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5380                )),
5381            }
5382        }
5383    }
5384
5385    impl serde::ser::Serialize for State {
5386        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5387        where
5388            S: serde::Serializer,
5389        {
5390            match self {
5391                Self::Unspecified => serializer.serialize_i32(0),
5392                Self::NotStarted => serializer.serialize_i32(1),
5393                Self::InProgress => serializer.serialize_i32(2),
5394                Self::Complete => serializer.serialize_i32(3),
5395                Self::UnknownValue(u) => u.0.serialize(serializer),
5396            }
5397        }
5398    }
5399
5400    impl<'de> serde::de::Deserialize<'de> for State {
5401        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5402        where
5403            D: serde::Deserializer<'de>,
5404        {
5405            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5406                ".google.cloud.functions.v2.Stage.State",
5407            ))
5408        }
5409    }
5410}
5411
5412/// The type of the long running operation.
5413///
5414/// # Working with unknown values
5415///
5416/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5417/// additional enum variants at any time. Adding new variants is not considered
5418/// a breaking change. Applications should write their code in anticipation of:
5419///
5420/// - New values appearing in future releases of the client library, **and**
5421/// - New values received dynamically, without application changes.
5422///
5423/// Please consult the [Working with enums] section in the user guide for some
5424/// guidelines.
5425///
5426/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5427#[derive(Clone, Debug, PartialEq)]
5428#[non_exhaustive]
5429pub enum OperationType {
5430    /// Unspecified
5431    OperationtypeUnspecified,
5432    /// CreateFunction
5433    CreateFunction,
5434    /// UpdateFunction
5435    UpdateFunction,
5436    /// DeleteFunction
5437    DeleteFunction,
5438    /// If set, the enum was initialized with an unknown value.
5439    ///
5440    /// Applications can examine the value using [OperationType::value] or
5441    /// [OperationType::name].
5442    UnknownValue(operation_type::UnknownValue),
5443}
5444
5445#[doc(hidden)]
5446pub mod operation_type {
5447    #[allow(unused_imports)]
5448    use super::*;
5449    #[derive(Clone, Debug, PartialEq)]
5450    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5451}
5452
5453impl OperationType {
5454    /// Gets the enum value.
5455    ///
5456    /// Returns `None` if the enum contains an unknown value deserialized from
5457    /// the string representation of enums.
5458    pub fn value(&self) -> std::option::Option<i32> {
5459        match self {
5460            Self::OperationtypeUnspecified => std::option::Option::Some(0),
5461            Self::CreateFunction => std::option::Option::Some(1),
5462            Self::UpdateFunction => std::option::Option::Some(2),
5463            Self::DeleteFunction => std::option::Option::Some(3),
5464            Self::UnknownValue(u) => u.0.value(),
5465        }
5466    }
5467
5468    /// Gets the enum value as a string.
5469    ///
5470    /// Returns `None` if the enum contains an unknown value deserialized from
5471    /// the integer representation of enums.
5472    pub fn name(&self) -> std::option::Option<&str> {
5473        match self {
5474            Self::OperationtypeUnspecified => {
5475                std::option::Option::Some("OPERATIONTYPE_UNSPECIFIED")
5476            }
5477            Self::CreateFunction => std::option::Option::Some("CREATE_FUNCTION"),
5478            Self::UpdateFunction => std::option::Option::Some("UPDATE_FUNCTION"),
5479            Self::DeleteFunction => std::option::Option::Some("DELETE_FUNCTION"),
5480            Self::UnknownValue(u) => u.0.name(),
5481        }
5482    }
5483}
5484
5485impl std::default::Default for OperationType {
5486    fn default() -> Self {
5487        use std::convert::From;
5488        Self::from(0)
5489    }
5490}
5491
5492impl std::fmt::Display for OperationType {
5493    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5494        wkt::internal::display_enum(f, self.name(), self.value())
5495    }
5496}
5497
5498impl std::convert::From<i32> for OperationType {
5499    fn from(value: i32) -> Self {
5500        match value {
5501            0 => Self::OperationtypeUnspecified,
5502            1 => Self::CreateFunction,
5503            2 => Self::UpdateFunction,
5504            3 => Self::DeleteFunction,
5505            _ => Self::UnknownValue(operation_type::UnknownValue(
5506                wkt::internal::UnknownEnumValue::Integer(value),
5507            )),
5508        }
5509    }
5510}
5511
5512impl std::convert::From<&str> for OperationType {
5513    fn from(value: &str) -> Self {
5514        use std::string::ToString;
5515        match value {
5516            "OPERATIONTYPE_UNSPECIFIED" => Self::OperationtypeUnspecified,
5517            "CREATE_FUNCTION" => Self::CreateFunction,
5518            "UPDATE_FUNCTION" => Self::UpdateFunction,
5519            "DELETE_FUNCTION" => Self::DeleteFunction,
5520            _ => Self::UnknownValue(operation_type::UnknownValue(
5521                wkt::internal::UnknownEnumValue::String(value.to_string()),
5522            )),
5523        }
5524    }
5525}
5526
5527impl serde::ser::Serialize for OperationType {
5528    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5529    where
5530        S: serde::Serializer,
5531    {
5532        match self {
5533            Self::OperationtypeUnspecified => serializer.serialize_i32(0),
5534            Self::CreateFunction => serializer.serialize_i32(1),
5535            Self::UpdateFunction => serializer.serialize_i32(2),
5536            Self::DeleteFunction => serializer.serialize_i32(3),
5537            Self::UnknownValue(u) => u.0.serialize(serializer),
5538        }
5539    }
5540}
5541
5542impl<'de> serde::de::Deserialize<'de> for OperationType {
5543    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5544    where
5545        D: serde::Deserializer<'de>,
5546    {
5547        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
5548            ".google.cloud.functions.v2.OperationType",
5549        ))
5550    }
5551}
5552
5553/// The environment the function is hosted on.
5554///
5555/// # Working with unknown values
5556///
5557/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5558/// additional enum variants at any time. Adding new variants is not considered
5559/// a breaking change. Applications should write their code in anticipation of:
5560///
5561/// - New values appearing in future releases of the client library, **and**
5562/// - New values received dynamically, without application changes.
5563///
5564/// Please consult the [Working with enums] section in the user guide for some
5565/// guidelines.
5566///
5567/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5568#[derive(Clone, Debug, PartialEq)]
5569#[non_exhaustive]
5570pub enum Environment {
5571    /// Unspecified
5572    Unspecified,
5573    /// Gen 1
5574    Gen1,
5575    /// Gen 2
5576    Gen2,
5577    /// If set, the enum was initialized with an unknown value.
5578    ///
5579    /// Applications can examine the value using [Environment::value] or
5580    /// [Environment::name].
5581    UnknownValue(environment::UnknownValue),
5582}
5583
5584#[doc(hidden)]
5585pub mod environment {
5586    #[allow(unused_imports)]
5587    use super::*;
5588    #[derive(Clone, Debug, PartialEq)]
5589    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5590}
5591
5592impl Environment {
5593    /// Gets the enum value.
5594    ///
5595    /// Returns `None` if the enum contains an unknown value deserialized from
5596    /// the string representation of enums.
5597    pub fn value(&self) -> std::option::Option<i32> {
5598        match self {
5599            Self::Unspecified => std::option::Option::Some(0),
5600            Self::Gen1 => std::option::Option::Some(1),
5601            Self::Gen2 => std::option::Option::Some(2),
5602            Self::UnknownValue(u) => u.0.value(),
5603        }
5604    }
5605
5606    /// Gets the enum value as a string.
5607    ///
5608    /// Returns `None` if the enum contains an unknown value deserialized from
5609    /// the integer representation of enums.
5610    pub fn name(&self) -> std::option::Option<&str> {
5611        match self {
5612            Self::Unspecified => std::option::Option::Some("ENVIRONMENT_UNSPECIFIED"),
5613            Self::Gen1 => std::option::Option::Some("GEN_1"),
5614            Self::Gen2 => std::option::Option::Some("GEN_2"),
5615            Self::UnknownValue(u) => u.0.name(),
5616        }
5617    }
5618}
5619
5620impl std::default::Default for Environment {
5621    fn default() -> Self {
5622        use std::convert::From;
5623        Self::from(0)
5624    }
5625}
5626
5627impl std::fmt::Display for Environment {
5628    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5629        wkt::internal::display_enum(f, self.name(), self.value())
5630    }
5631}
5632
5633impl std::convert::From<i32> for Environment {
5634    fn from(value: i32) -> Self {
5635        match value {
5636            0 => Self::Unspecified,
5637            1 => Self::Gen1,
5638            2 => Self::Gen2,
5639            _ => Self::UnknownValue(environment::UnknownValue(
5640                wkt::internal::UnknownEnumValue::Integer(value),
5641            )),
5642        }
5643    }
5644}
5645
5646impl std::convert::From<&str> for Environment {
5647    fn from(value: &str) -> Self {
5648        use std::string::ToString;
5649        match value {
5650            "ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
5651            "GEN_1" => Self::Gen1,
5652            "GEN_2" => Self::Gen2,
5653            _ => Self::UnknownValue(environment::UnknownValue(
5654                wkt::internal::UnknownEnumValue::String(value.to_string()),
5655            )),
5656        }
5657    }
5658}
5659
5660impl serde::ser::Serialize for Environment {
5661    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5662    where
5663        S: serde::Serializer,
5664    {
5665        match self {
5666            Self::Unspecified => serializer.serialize_i32(0),
5667            Self::Gen1 => serializer.serialize_i32(1),
5668            Self::Gen2 => serializer.serialize_i32(2),
5669            Self::UnknownValue(u) => u.0.serialize(serializer),
5670        }
5671    }
5672}
5673
5674impl<'de> serde::de::Deserialize<'de> for Environment {
5675    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5676    where
5677        D: serde::Deserializer<'de>,
5678    {
5679        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Environment>::new(
5680            ".google.cloud.functions.v2.Environment",
5681        ))
5682    }
5683}