google_cloud_functions_v2/
model.rs

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