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