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