google_cloud_run_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 api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38/// Request message for submitting a Build.
39#[derive(Clone, Debug, Default, PartialEq)]
40#[non_exhaustive]
41pub struct SubmitBuildRequest {
42    /// Required. The project and location to build in. Location must be a region,
43    /// e.g., 'us-central1' or 'global' if the global builder is to be used.
44    /// Format:
45    /// `projects/{project}/locations/{location}`
46    pub parent: std::string::String,
47
48    /// Required. Artifact Registry URI to store the built image.
49    pub image_uri: std::string::String,
50
51    /// Optional. The service account to use for the build. If not set, the default
52    /// Cloud Build service account for the project will be used.
53    pub service_account: std::string::String,
54
55    /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
56    /// build the function. The format of this field is
57    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
58    /// `{project}` and `{region}` are the project id and region respectively where
59    /// the worker pool is defined and `{workerPool}` is the short name of the
60    /// worker pool.
61    pub worker_pool: std::string::String,
62
63    /// Optional. Additional tags to annotate the build.
64    pub tags: std::vec::Vec<std::string::String>,
65
66    /// Location of source.
67    pub source: std::option::Option<crate::model::submit_build_request::Source>,
68
69    /// Build type must be one of the following.
70    pub build_type: std::option::Option<crate::model::submit_build_request::BuildType>,
71
72    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
73}
74
75impl SubmitBuildRequest {
76    pub fn new() -> Self {
77        std::default::Default::default()
78    }
79
80    /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
81    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82        self.parent = v.into();
83        self
84    }
85
86    /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
87    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
88        self.image_uri = v.into();
89        self
90    }
91
92    /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
93    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94        self.service_account = v.into();
95        self
96    }
97
98    /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
99    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
100        self.worker_pool = v.into();
101        self
102    }
103
104    /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
105    pub fn set_tags<T, V>(mut self, v: T) -> Self
106    where
107        T: std::iter::IntoIterator<Item = V>,
108        V: std::convert::Into<std::string::String>,
109    {
110        use std::iter::Iterator;
111        self.tags = v.into_iter().map(|i| i.into()).collect();
112        self
113    }
114
115    /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
116    ///
117    /// Note that all the setters affecting `source` are mutually
118    /// exclusive.
119    pub fn set_source<
120        T: std::convert::Into<std::option::Option<crate::model::submit_build_request::Source>>,
121    >(
122        mut self,
123        v: T,
124    ) -> Self {
125        self.source = v.into();
126        self
127    }
128
129    /// The value of [source][crate::model::SubmitBuildRequest::source]
130    /// if it holds a `StorageSource`, `None` if the field is not set or
131    /// holds a different branch.
132    pub fn storage_source(
133        &self,
134    ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
135        #[allow(unreachable_patterns)]
136        self.source.as_ref().and_then(|v| match v {
137            crate::model::submit_build_request::Source::StorageSource(v) => {
138                std::option::Option::Some(v)
139            }
140            _ => std::option::Option::None,
141        })
142    }
143
144    /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
145    /// to hold a `StorageSource`.
146    ///
147    /// Note that all the setters affecting `source` are
148    /// mutually exclusive.
149    pub fn set_storage_source<
150        T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
151    >(
152        mut self,
153        v: T,
154    ) -> Self {
155        self.source = std::option::Option::Some(
156            crate::model::submit_build_request::Source::StorageSource(v.into()),
157        );
158        self
159    }
160
161    /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
162    ///
163    /// Note that all the setters affecting `build_type` are mutually
164    /// exclusive.
165    pub fn set_build_type<
166        T: std::convert::Into<std::option::Option<crate::model::submit_build_request::BuildType>>,
167    >(
168        mut self,
169        v: T,
170    ) -> Self {
171        self.build_type = v.into();
172        self
173    }
174
175    /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
176    /// if it holds a `BuildpackBuild`, `None` if the field is not set or
177    /// holds a different branch.
178    pub fn buildpack_build(
179        &self,
180    ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>
181    {
182        #[allow(unreachable_patterns)]
183        self.build_type.as_ref().and_then(|v| match v {
184            crate::model::submit_build_request::BuildType::BuildpackBuild(v) => {
185                std::option::Option::Some(v)
186            }
187            _ => std::option::Option::None,
188        })
189    }
190
191    /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
192    /// to hold a `BuildpackBuild`.
193    ///
194    /// Note that all the setters affecting `build_type` are
195    /// mutually exclusive.
196    pub fn set_buildpack_build<
197        T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>>,
198    >(
199        mut self,
200        v: T,
201    ) -> Self {
202        self.build_type = std::option::Option::Some(
203            crate::model::submit_build_request::BuildType::BuildpackBuild(v.into()),
204        );
205        self
206    }
207
208    /// The value of [build_type][crate::model::SubmitBuildRequest::build_type]
209    /// if it holds a `DockerBuild`, `None` if the field is not set or
210    /// holds a different branch.
211    pub fn docker_build(
212        &self,
213    ) -> std::option::Option<&std::boxed::Box<crate::model::submit_build_request::DockerBuild>>
214    {
215        #[allow(unreachable_patterns)]
216        self.build_type.as_ref().and_then(|v| match v {
217            crate::model::submit_build_request::BuildType::DockerBuild(v) => {
218                std::option::Option::Some(v)
219            }
220            _ => std::option::Option::None,
221        })
222    }
223
224    /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
225    /// to hold a `DockerBuild`.
226    ///
227    /// Note that all the setters affecting `build_type` are
228    /// mutually exclusive.
229    pub fn set_docker_build<
230        T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
231    >(
232        mut self,
233        v: T,
234    ) -> Self {
235        self.build_type = std::option::Option::Some(
236            crate::model::submit_build_request::BuildType::DockerBuild(v.into()),
237        );
238        self
239    }
240}
241
242impl wkt::message::Message for SubmitBuildRequest {
243    fn typename() -> &'static str {
244        "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest"
245    }
246}
247
248#[doc(hidden)]
249impl<'de> serde::de::Deserialize<'de> for SubmitBuildRequest {
250    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
251    where
252        D: serde::Deserializer<'de>,
253    {
254        #[allow(non_camel_case_types)]
255        #[doc(hidden)]
256        #[derive(PartialEq, Eq, Hash)]
257        enum __FieldTag {
258            __parent,
259            __storage_source,
260            __image_uri,
261            __buildpack_build,
262            __docker_build,
263            __service_account,
264            __worker_pool,
265            __tags,
266            Unknown(std::string::String),
267        }
268        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
269            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
270            where
271                D: serde::Deserializer<'de>,
272            {
273                struct Visitor;
274                impl<'de> serde::de::Visitor<'de> for Visitor {
275                    type Value = __FieldTag;
276                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
277                        formatter.write_str("a field name for SubmitBuildRequest")
278                    }
279                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
280                    where
281                        E: serde::de::Error,
282                    {
283                        use std::result::Result::Ok;
284                        use std::string::ToString;
285                        match value {
286                            "parent" => Ok(__FieldTag::__parent),
287                            "storageSource" => Ok(__FieldTag::__storage_source),
288                            "storage_source" => Ok(__FieldTag::__storage_source),
289                            "imageUri" => Ok(__FieldTag::__image_uri),
290                            "image_uri" => Ok(__FieldTag::__image_uri),
291                            "buildpackBuild" => Ok(__FieldTag::__buildpack_build),
292                            "buildpack_build" => Ok(__FieldTag::__buildpack_build),
293                            "dockerBuild" => Ok(__FieldTag::__docker_build),
294                            "docker_build" => Ok(__FieldTag::__docker_build),
295                            "serviceAccount" => Ok(__FieldTag::__service_account),
296                            "service_account" => Ok(__FieldTag::__service_account),
297                            "workerPool" => Ok(__FieldTag::__worker_pool),
298                            "worker_pool" => Ok(__FieldTag::__worker_pool),
299                            "tags" => Ok(__FieldTag::__tags),
300                            _ => Ok(__FieldTag::Unknown(value.to_string())),
301                        }
302                    }
303                }
304                deserializer.deserialize_identifier(Visitor)
305            }
306        }
307        struct Visitor;
308        impl<'de> serde::de::Visitor<'de> for Visitor {
309            type Value = SubmitBuildRequest;
310            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
311                formatter.write_str("struct SubmitBuildRequest")
312            }
313            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
314            where
315                A: serde::de::MapAccess<'de>,
316            {
317                #[allow(unused_imports)]
318                use serde::de::Error;
319                use std::option::Option::Some;
320                let mut fields = std::collections::HashSet::new();
321                let mut result = Self::Value::new();
322                while let Some(tag) = map.next_key::<__FieldTag>()? {
323                    #[allow(clippy::match_single_binding)]
324                    match tag {
325                        __FieldTag::__parent => {
326                            if !fields.insert(__FieldTag::__parent) {
327                                return std::result::Result::Err(A::Error::duplicate_field(
328                                    "multiple values for parent",
329                                ));
330                            }
331                            result.parent = map
332                                .next_value::<std::option::Option<std::string::String>>()?
333                                .unwrap_or_default();
334                        }
335                        __FieldTag::__storage_source => {
336                            if !fields.insert(__FieldTag::__storage_source) {
337                                return std::result::Result::Err(A::Error::duplicate_field(
338                                    "multiple values for storage_source",
339                                ));
340                            }
341                            if result.source.is_some() {
342                                return std::result::Result::Err(A::Error::duplicate_field(
343                                    "multiple values for `source`, a oneof with full ID .google.cloud.run.v2.SubmitBuildRequest.storage_source, latest field was storageSource",
344                                ));
345                            }
346                            result.source = std::option::Option::Some(
347                                crate::model::submit_build_request::Source::StorageSource(
348                                    map.next_value::<std::option::Option<
349                                        std::boxed::Box<crate::model::StorageSource>,
350                                    >>()?
351                                    .unwrap_or_default(),
352                                ),
353                            );
354                        }
355                        __FieldTag::__image_uri => {
356                            if !fields.insert(__FieldTag::__image_uri) {
357                                return std::result::Result::Err(A::Error::duplicate_field(
358                                    "multiple values for image_uri",
359                                ));
360                            }
361                            result.image_uri = map
362                                .next_value::<std::option::Option<std::string::String>>()?
363                                .unwrap_or_default();
364                        }
365                        __FieldTag::__buildpack_build => {
366                            if !fields.insert(__FieldTag::__buildpack_build) {
367                                return std::result::Result::Err(A::Error::duplicate_field(
368                                    "multiple values for buildpack_build",
369                                ));
370                            }
371                            if result.build_type.is_some() {
372                                return std::result::Result::Err(A::Error::duplicate_field(
373                                    "multiple values for `build_type`, a oneof with full ID .google.cloud.run.v2.SubmitBuildRequest.buildpack_build, latest field was buildpackBuild",
374                                ));
375                            }
376                            result.build_type = std::option::Option::Some(
377                                crate::model::submit_build_request::BuildType::BuildpackBuild(
378                                    map.next_value::<std::option::Option<
379                                        std::boxed::Box<
380                                            crate::model::submit_build_request::BuildpacksBuild,
381                                        >,
382                                    >>()?
383                                    .unwrap_or_default(),
384                                ),
385                            );
386                        }
387                        __FieldTag::__docker_build => {
388                            if !fields.insert(__FieldTag::__docker_build) {
389                                return std::result::Result::Err(A::Error::duplicate_field(
390                                    "multiple values for docker_build",
391                                ));
392                            }
393                            if result.build_type.is_some() {
394                                return std::result::Result::Err(A::Error::duplicate_field(
395                                    "multiple values for `build_type`, a oneof with full ID .google.cloud.run.v2.SubmitBuildRequest.docker_build, latest field was dockerBuild",
396                                ));
397                            }
398                            result.build_type = std::option::Option::Some(
399                                crate::model::submit_build_request::BuildType::DockerBuild(
400                                    map.next_value::<std::option::Option<
401                                        std::boxed::Box<
402                                            crate::model::submit_build_request::DockerBuild,
403                                        >,
404                                    >>()?
405                                    .unwrap_or_default(),
406                                ),
407                            );
408                        }
409                        __FieldTag::__service_account => {
410                            if !fields.insert(__FieldTag::__service_account) {
411                                return std::result::Result::Err(A::Error::duplicate_field(
412                                    "multiple values for service_account",
413                                ));
414                            }
415                            result.service_account = map
416                                .next_value::<std::option::Option<std::string::String>>()?
417                                .unwrap_or_default();
418                        }
419                        __FieldTag::__worker_pool => {
420                            if !fields.insert(__FieldTag::__worker_pool) {
421                                return std::result::Result::Err(A::Error::duplicate_field(
422                                    "multiple values for worker_pool",
423                                ));
424                            }
425                            result.worker_pool = map
426                                .next_value::<std::option::Option<std::string::String>>()?
427                                .unwrap_or_default();
428                        }
429                        __FieldTag::__tags => {
430                            if !fields.insert(__FieldTag::__tags) {
431                                return std::result::Result::Err(A::Error::duplicate_field(
432                                    "multiple values for tags",
433                                ));
434                            }
435                            result.tags = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
436                        }
437                        __FieldTag::Unknown(key) => {
438                            let value = map.next_value::<serde_json::Value>()?;
439                            result._unknown_fields.insert(key, value);
440                        }
441                    }
442                }
443                std::result::Result::Ok(result)
444            }
445        }
446        deserializer.deserialize_any(Visitor)
447    }
448}
449
450#[doc(hidden)]
451impl serde::ser::Serialize for SubmitBuildRequest {
452    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
453    where
454        S: serde::ser::Serializer,
455    {
456        use serde::ser::SerializeMap;
457        #[allow(unused_imports)]
458        use std::option::Option::Some;
459        let mut state = serializer.serialize_map(std::option::Option::None)?;
460        if !self.parent.is_empty() {
461            state.serialize_entry("parent", &self.parent)?;
462        }
463        if let Some(value) = self.storage_source() {
464            state.serialize_entry("storageSource", value)?;
465        }
466        if !self.image_uri.is_empty() {
467            state.serialize_entry("imageUri", &self.image_uri)?;
468        }
469        if let Some(value) = self.buildpack_build() {
470            state.serialize_entry("buildpackBuild", value)?;
471        }
472        if let Some(value) = self.docker_build() {
473            state.serialize_entry("dockerBuild", value)?;
474        }
475        if !self.service_account.is_empty() {
476            state.serialize_entry("serviceAccount", &self.service_account)?;
477        }
478        if !self.worker_pool.is_empty() {
479            state.serialize_entry("workerPool", &self.worker_pool)?;
480        }
481        if !self.tags.is_empty() {
482            state.serialize_entry("tags", &self.tags)?;
483        }
484        if !self._unknown_fields.is_empty() {
485            for (key, value) in self._unknown_fields.iter() {
486                state.serialize_entry(key, &value)?;
487            }
488        }
489        state.end()
490    }
491}
492
493/// Defines additional types related to [SubmitBuildRequest].
494pub mod submit_build_request {
495    #[allow(unused_imports)]
496    use super::*;
497
498    /// Build the source using Docker. This means the source has a Dockerfile.
499    #[derive(Clone, Debug, Default, PartialEq)]
500    #[non_exhaustive]
501    pub struct DockerBuild {
502        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
503    }
504
505    impl DockerBuild {
506        pub fn new() -> Self {
507            std::default::Default::default()
508        }
509    }
510
511    impl wkt::message::Message for DockerBuild {
512        fn typename() -> &'static str {
513            "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.DockerBuild"
514        }
515    }
516
517    #[doc(hidden)]
518    impl<'de> serde::de::Deserialize<'de> for DockerBuild {
519        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
520        where
521            D: serde::Deserializer<'de>,
522        {
523            #[allow(non_camel_case_types)]
524            #[doc(hidden)]
525            #[derive(PartialEq, Eq, Hash)]
526            enum __FieldTag {
527                Unknown(std::string::String),
528            }
529            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
530                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
531                where
532                    D: serde::Deserializer<'de>,
533                {
534                    struct Visitor;
535                    impl<'de> serde::de::Visitor<'de> for Visitor {
536                        type Value = __FieldTag;
537                        fn expecting(
538                            &self,
539                            formatter: &mut std::fmt::Formatter,
540                        ) -> std::fmt::Result {
541                            formatter.write_str("a field name for DockerBuild")
542                        }
543                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
544                        where
545                            E: serde::de::Error,
546                        {
547                            use std::result::Result::Ok;
548                            use std::string::ToString;
549                            Ok(__FieldTag::Unknown(value.to_string()))
550                        }
551                    }
552                    deserializer.deserialize_identifier(Visitor)
553                }
554            }
555            struct Visitor;
556            impl<'de> serde::de::Visitor<'de> for Visitor {
557                type Value = DockerBuild;
558                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
559                    formatter.write_str("struct DockerBuild")
560                }
561                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
562                where
563                    A: serde::de::MapAccess<'de>,
564                {
565                    #[allow(unused_imports)]
566                    use serde::de::Error;
567                    use std::option::Option::Some;
568                    let mut result = Self::Value::new();
569                    while let Some(tag) = map.next_key::<__FieldTag>()? {
570                        #[allow(clippy::match_single_binding)]
571                        match tag {
572                            __FieldTag::Unknown(key) => {
573                                let value = map.next_value::<serde_json::Value>()?;
574                                result._unknown_fields.insert(key, value);
575                            }
576                        }
577                    }
578                    std::result::Result::Ok(result)
579                }
580            }
581            deserializer.deserialize_any(Visitor)
582        }
583    }
584
585    #[doc(hidden)]
586    impl serde::ser::Serialize for DockerBuild {
587        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
588        where
589            S: serde::ser::Serializer,
590        {
591            use serde::ser::SerializeMap;
592            #[allow(unused_imports)]
593            use std::option::Option::Some;
594            let mut state = serializer.serialize_map(std::option::Option::None)?;
595            if !self._unknown_fields.is_empty() {
596                for (key, value) in self._unknown_fields.iter() {
597                    state.serialize_entry(key, &value)?;
598                }
599            }
600            state.end()
601        }
602    }
603
604    /// Build the source using Buildpacks.
605    #[derive(Clone, Debug, Default, PartialEq)]
606    #[non_exhaustive]
607    pub struct BuildpacksBuild {
608        /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
609        #[deprecated]
610        pub runtime: std::string::String,
611
612        /// Optional. Name of the function target if the source is a function source.
613        /// Required for function builds.
614        pub function_target: std::string::String,
615
616        /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be
617        /// stored. cache_image_uri is optional and omitting it will disable caching.
618        /// This URL must be stable across builds. It is used to derive a
619        /// build-specific temporary URL by substituting the tag with the build ID.
620        /// The build will clean up the temporary image on a best-effort basis.
621        pub cache_image_uri: std::string::String,
622
623        /// Optional. The base image to use for the build.
624        pub base_image: std::string::String,
625
626        /// Optional. User-provided build-time environment variables.
627        pub environment_variables:
628            std::collections::HashMap<std::string::String, std::string::String>,
629
630        /// Optional. Whether or not the application container will be enrolled in
631        /// automatic base image updates. When true, the application will be built on
632        /// a scratch base image, so the base layers can be appended at run time.
633        pub enable_automatic_updates: bool,
634
635        /// Optional. project_descriptor stores the path to the project descriptor
636        /// file. When empty, it means that there is no project descriptor file in
637        /// the source.
638        pub project_descriptor: std::string::String,
639
640        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
641    }
642
643    impl BuildpacksBuild {
644        pub fn new() -> Self {
645            std::default::Default::default()
646        }
647
648        /// Sets the value of [runtime][crate::model::submit_build_request::BuildpacksBuild::runtime].
649        #[deprecated]
650        pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
651            self.runtime = v.into();
652            self
653        }
654
655        /// Sets the value of [function_target][crate::model::submit_build_request::BuildpacksBuild::function_target].
656        pub fn set_function_target<T: std::convert::Into<std::string::String>>(
657            mut self,
658            v: T,
659        ) -> Self {
660            self.function_target = v.into();
661            self
662        }
663
664        /// Sets the value of [cache_image_uri][crate::model::submit_build_request::BuildpacksBuild::cache_image_uri].
665        pub fn set_cache_image_uri<T: std::convert::Into<std::string::String>>(
666            mut self,
667            v: T,
668        ) -> Self {
669            self.cache_image_uri = v.into();
670            self
671        }
672
673        /// Sets the value of [base_image][crate::model::submit_build_request::BuildpacksBuild::base_image].
674        pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
675            self.base_image = v.into();
676            self
677        }
678
679        /// Sets the value of [environment_variables][crate::model::submit_build_request::BuildpacksBuild::environment_variables].
680        pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
681        where
682            T: std::iter::IntoIterator<Item = (K, V)>,
683            K: std::convert::Into<std::string::String>,
684            V: std::convert::Into<std::string::String>,
685        {
686            use std::iter::Iterator;
687            self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
688            self
689        }
690
691        /// Sets the value of [enable_automatic_updates][crate::model::submit_build_request::BuildpacksBuild::enable_automatic_updates].
692        pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
693            self.enable_automatic_updates = v.into();
694            self
695        }
696
697        /// Sets the value of [project_descriptor][crate::model::submit_build_request::BuildpacksBuild::project_descriptor].
698        pub fn set_project_descriptor<T: std::convert::Into<std::string::String>>(
699            mut self,
700            v: T,
701        ) -> Self {
702            self.project_descriptor = v.into();
703            self
704        }
705    }
706
707    impl wkt::message::Message for BuildpacksBuild {
708        fn typename() -> &'static str {
709            "type.googleapis.com/google.cloud.run.v2.SubmitBuildRequest.BuildpacksBuild"
710        }
711    }
712
713    #[doc(hidden)]
714    impl<'de> serde::de::Deserialize<'de> for BuildpacksBuild {
715        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
716        where
717            D: serde::Deserializer<'de>,
718        {
719            #[allow(non_camel_case_types)]
720            #[doc(hidden)]
721            #[derive(PartialEq, Eq, Hash)]
722            enum __FieldTag {
723                __runtime,
724                __function_target,
725                __cache_image_uri,
726                __base_image,
727                __environment_variables,
728                __enable_automatic_updates,
729                __project_descriptor,
730                Unknown(std::string::String),
731            }
732            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
733                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
734                where
735                    D: serde::Deserializer<'de>,
736                {
737                    struct Visitor;
738                    impl<'de> serde::de::Visitor<'de> for Visitor {
739                        type Value = __FieldTag;
740                        fn expecting(
741                            &self,
742                            formatter: &mut std::fmt::Formatter,
743                        ) -> std::fmt::Result {
744                            formatter.write_str("a field name for BuildpacksBuild")
745                        }
746                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
747                        where
748                            E: serde::de::Error,
749                        {
750                            use std::result::Result::Ok;
751                            use std::string::ToString;
752                            match value {
753                                "runtime" => Ok(__FieldTag::__runtime),
754                                "functionTarget" => Ok(__FieldTag::__function_target),
755                                "function_target" => Ok(__FieldTag::__function_target),
756                                "cacheImageUri" => Ok(__FieldTag::__cache_image_uri),
757                                "cache_image_uri" => Ok(__FieldTag::__cache_image_uri),
758                                "baseImage" => Ok(__FieldTag::__base_image),
759                                "base_image" => Ok(__FieldTag::__base_image),
760                                "environmentVariables" => Ok(__FieldTag::__environment_variables),
761                                "environment_variables" => Ok(__FieldTag::__environment_variables),
762                                "enableAutomaticUpdates" => {
763                                    Ok(__FieldTag::__enable_automatic_updates)
764                                }
765                                "enable_automatic_updates" => {
766                                    Ok(__FieldTag::__enable_automatic_updates)
767                                }
768                                "projectDescriptor" => Ok(__FieldTag::__project_descriptor),
769                                "project_descriptor" => Ok(__FieldTag::__project_descriptor),
770                                _ => Ok(__FieldTag::Unknown(value.to_string())),
771                            }
772                        }
773                    }
774                    deserializer.deserialize_identifier(Visitor)
775                }
776            }
777            struct Visitor;
778            impl<'de> serde::de::Visitor<'de> for Visitor {
779                type Value = BuildpacksBuild;
780                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
781                    formatter.write_str("struct BuildpacksBuild")
782                }
783                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
784                where
785                    A: serde::de::MapAccess<'de>,
786                {
787                    #[allow(unused_imports)]
788                    use serde::de::Error;
789                    use std::option::Option::Some;
790                    let mut fields = std::collections::HashSet::new();
791                    let mut result = Self::Value::new();
792                    while let Some(tag) = map.next_key::<__FieldTag>()? {
793                        #[allow(clippy::match_single_binding)]
794                        match tag {
795                            __FieldTag::__runtime => {
796                                if !fields.insert(__FieldTag::__runtime) {
797                                    return std::result::Result::Err(A::Error::duplicate_field(
798                                        "multiple values for runtime",
799                                    ));
800                                }
801                                result.runtime = map
802                                    .next_value::<std::option::Option<std::string::String>>()?
803                                    .unwrap_or_default();
804                            }
805                            __FieldTag::__function_target => {
806                                if !fields.insert(__FieldTag::__function_target) {
807                                    return std::result::Result::Err(A::Error::duplicate_field(
808                                        "multiple values for function_target",
809                                    ));
810                                }
811                                result.function_target = map
812                                    .next_value::<std::option::Option<std::string::String>>()?
813                                    .unwrap_or_default();
814                            }
815                            __FieldTag::__cache_image_uri => {
816                                if !fields.insert(__FieldTag::__cache_image_uri) {
817                                    return std::result::Result::Err(A::Error::duplicate_field(
818                                        "multiple values for cache_image_uri",
819                                    ));
820                                }
821                                result.cache_image_uri = map
822                                    .next_value::<std::option::Option<std::string::String>>()?
823                                    .unwrap_or_default();
824                            }
825                            __FieldTag::__base_image => {
826                                if !fields.insert(__FieldTag::__base_image) {
827                                    return std::result::Result::Err(A::Error::duplicate_field(
828                                        "multiple values for base_image",
829                                    ));
830                                }
831                                result.base_image = map
832                                    .next_value::<std::option::Option<std::string::String>>()?
833                                    .unwrap_or_default();
834                            }
835                            __FieldTag::__environment_variables => {
836                                if !fields.insert(__FieldTag::__environment_variables) {
837                                    return std::result::Result::Err(A::Error::duplicate_field(
838                                        "multiple values for environment_variables",
839                                    ));
840                                }
841                                result.environment_variables = map
842                                    .next_value::<std::option::Option<
843                                        std::collections::HashMap<
844                                            std::string::String,
845                                            std::string::String,
846                                        >,
847                                    >>()?
848                                    .unwrap_or_default();
849                            }
850                            __FieldTag::__enable_automatic_updates => {
851                                if !fields.insert(__FieldTag::__enable_automatic_updates) {
852                                    return std::result::Result::Err(A::Error::duplicate_field(
853                                        "multiple values for enable_automatic_updates",
854                                    ));
855                                }
856                                result.enable_automatic_updates = map
857                                    .next_value::<std::option::Option<bool>>()?
858                                    .unwrap_or_default();
859                            }
860                            __FieldTag::__project_descriptor => {
861                                if !fields.insert(__FieldTag::__project_descriptor) {
862                                    return std::result::Result::Err(A::Error::duplicate_field(
863                                        "multiple values for project_descriptor",
864                                    ));
865                                }
866                                result.project_descriptor = map
867                                    .next_value::<std::option::Option<std::string::String>>()?
868                                    .unwrap_or_default();
869                            }
870                            __FieldTag::Unknown(key) => {
871                                let value = map.next_value::<serde_json::Value>()?;
872                                result._unknown_fields.insert(key, value);
873                            }
874                        }
875                    }
876                    std::result::Result::Ok(result)
877                }
878            }
879            deserializer.deserialize_any(Visitor)
880        }
881    }
882
883    #[doc(hidden)]
884    impl serde::ser::Serialize for BuildpacksBuild {
885        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
886        where
887            S: serde::ser::Serializer,
888        {
889            use serde::ser::SerializeMap;
890            #[allow(unused_imports)]
891            use std::option::Option::Some;
892            let mut state = serializer.serialize_map(std::option::Option::None)?;
893            if !self.runtime.is_empty() {
894                state.serialize_entry("runtime", &self.runtime)?;
895            }
896            if !self.function_target.is_empty() {
897                state.serialize_entry("functionTarget", &self.function_target)?;
898            }
899            if !self.cache_image_uri.is_empty() {
900                state.serialize_entry("cacheImageUri", &self.cache_image_uri)?;
901            }
902            if !self.base_image.is_empty() {
903                state.serialize_entry("baseImage", &self.base_image)?;
904            }
905            if !self.environment_variables.is_empty() {
906                state.serialize_entry("environmentVariables", &self.environment_variables)?;
907            }
908            if !wkt::internal::is_default(&self.enable_automatic_updates) {
909                state.serialize_entry("enableAutomaticUpdates", &self.enable_automatic_updates)?;
910            }
911            if !self.project_descriptor.is_empty() {
912                state.serialize_entry("projectDescriptor", &self.project_descriptor)?;
913            }
914            if !self._unknown_fields.is_empty() {
915                for (key, value) in self._unknown_fields.iter() {
916                    state.serialize_entry(key, &value)?;
917                }
918            }
919            state.end()
920        }
921    }
922
923    /// Location of source.
924    #[derive(Clone, Debug, PartialEq)]
925    #[non_exhaustive]
926    pub enum Source {
927        /// Required. Source for the build.
928        StorageSource(std::boxed::Box<crate::model::StorageSource>),
929    }
930
931    /// Build type must be one of the following.
932    #[derive(Clone, Debug, PartialEq)]
933    #[non_exhaustive]
934    pub enum BuildType {
935        /// Build the source using Buildpacks.
936        BuildpackBuild(std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>),
937        /// Build the source using Docker. This means the source has a Dockerfile.
938        DockerBuild(std::boxed::Box<crate::model::submit_build_request::DockerBuild>),
939    }
940}
941
942/// Response message for submitting a Build.
943#[derive(Clone, Debug, Default, PartialEq)]
944#[non_exhaustive]
945pub struct SubmitBuildResponse {
946    /// Cloud Build operation to be polled via CloudBuild API.
947    pub build_operation: std::option::Option<longrunning::model::Operation>,
948
949    /// URI of the base builder image in Artifact Registry being used in the build.
950    /// Used to opt into automatic base image updates.
951    pub base_image_uri: std::string::String,
952
953    /// Warning message for the base image.
954    pub base_image_warning: std::string::String,
955
956    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
957}
958
959impl SubmitBuildResponse {
960    pub fn new() -> Self {
961        std::default::Default::default()
962    }
963
964    /// Sets the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
965    pub fn set_build_operation<T>(mut self, v: T) -> Self
966    where
967        T: std::convert::Into<longrunning::model::Operation>,
968    {
969        self.build_operation = std::option::Option::Some(v.into());
970        self
971    }
972
973    /// Sets or clears the value of [build_operation][crate::model::SubmitBuildResponse::build_operation].
974    pub fn set_or_clear_build_operation<T>(mut self, v: std::option::Option<T>) -> Self
975    where
976        T: std::convert::Into<longrunning::model::Operation>,
977    {
978        self.build_operation = v.map(|x| x.into());
979        self
980    }
981
982    /// Sets the value of [base_image_uri][crate::model::SubmitBuildResponse::base_image_uri].
983    pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
984        self.base_image_uri = v.into();
985        self
986    }
987
988    /// Sets the value of [base_image_warning][crate::model::SubmitBuildResponse::base_image_warning].
989    pub fn set_base_image_warning<T: std::convert::Into<std::string::String>>(
990        mut self,
991        v: T,
992    ) -> Self {
993        self.base_image_warning = v.into();
994        self
995    }
996}
997
998impl wkt::message::Message for SubmitBuildResponse {
999    fn typename() -> &'static str {
1000        "type.googleapis.com/google.cloud.run.v2.SubmitBuildResponse"
1001    }
1002}
1003
1004#[doc(hidden)]
1005impl<'de> serde::de::Deserialize<'de> for SubmitBuildResponse {
1006    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1007    where
1008        D: serde::Deserializer<'de>,
1009    {
1010        #[allow(non_camel_case_types)]
1011        #[doc(hidden)]
1012        #[derive(PartialEq, Eq, Hash)]
1013        enum __FieldTag {
1014            __build_operation,
1015            __base_image_uri,
1016            __base_image_warning,
1017            Unknown(std::string::String),
1018        }
1019        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1020            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1021            where
1022                D: serde::Deserializer<'de>,
1023            {
1024                struct Visitor;
1025                impl<'de> serde::de::Visitor<'de> for Visitor {
1026                    type Value = __FieldTag;
1027                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1028                        formatter.write_str("a field name for SubmitBuildResponse")
1029                    }
1030                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1031                    where
1032                        E: serde::de::Error,
1033                    {
1034                        use std::result::Result::Ok;
1035                        use std::string::ToString;
1036                        match value {
1037                            "buildOperation" => Ok(__FieldTag::__build_operation),
1038                            "build_operation" => Ok(__FieldTag::__build_operation),
1039                            "baseImageUri" => Ok(__FieldTag::__base_image_uri),
1040                            "base_image_uri" => Ok(__FieldTag::__base_image_uri),
1041                            "baseImageWarning" => Ok(__FieldTag::__base_image_warning),
1042                            "base_image_warning" => Ok(__FieldTag::__base_image_warning),
1043                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1044                        }
1045                    }
1046                }
1047                deserializer.deserialize_identifier(Visitor)
1048            }
1049        }
1050        struct Visitor;
1051        impl<'de> serde::de::Visitor<'de> for Visitor {
1052            type Value = SubmitBuildResponse;
1053            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1054                formatter.write_str("struct SubmitBuildResponse")
1055            }
1056            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1057            where
1058                A: serde::de::MapAccess<'de>,
1059            {
1060                #[allow(unused_imports)]
1061                use serde::de::Error;
1062                use std::option::Option::Some;
1063                let mut fields = std::collections::HashSet::new();
1064                let mut result = Self::Value::new();
1065                while let Some(tag) = map.next_key::<__FieldTag>()? {
1066                    #[allow(clippy::match_single_binding)]
1067                    match tag {
1068                        __FieldTag::__build_operation => {
1069                            if !fields.insert(__FieldTag::__build_operation) {
1070                                return std::result::Result::Err(A::Error::duplicate_field(
1071                                    "multiple values for build_operation",
1072                                ));
1073                            }
1074                            result.build_operation = map
1075                                .next_value::<std::option::Option<longrunning::model::Operation>>(
1076                                )?;
1077                        }
1078                        __FieldTag::__base_image_uri => {
1079                            if !fields.insert(__FieldTag::__base_image_uri) {
1080                                return std::result::Result::Err(A::Error::duplicate_field(
1081                                    "multiple values for base_image_uri",
1082                                ));
1083                            }
1084                            result.base_image_uri = map
1085                                .next_value::<std::option::Option<std::string::String>>()?
1086                                .unwrap_or_default();
1087                        }
1088                        __FieldTag::__base_image_warning => {
1089                            if !fields.insert(__FieldTag::__base_image_warning) {
1090                                return std::result::Result::Err(A::Error::duplicate_field(
1091                                    "multiple values for base_image_warning",
1092                                ));
1093                            }
1094                            result.base_image_warning = map
1095                                .next_value::<std::option::Option<std::string::String>>()?
1096                                .unwrap_or_default();
1097                        }
1098                        __FieldTag::Unknown(key) => {
1099                            let value = map.next_value::<serde_json::Value>()?;
1100                            result._unknown_fields.insert(key, value);
1101                        }
1102                    }
1103                }
1104                std::result::Result::Ok(result)
1105            }
1106        }
1107        deserializer.deserialize_any(Visitor)
1108    }
1109}
1110
1111#[doc(hidden)]
1112impl serde::ser::Serialize for SubmitBuildResponse {
1113    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1114    where
1115        S: serde::ser::Serializer,
1116    {
1117        use serde::ser::SerializeMap;
1118        #[allow(unused_imports)]
1119        use std::option::Option::Some;
1120        let mut state = serializer.serialize_map(std::option::Option::None)?;
1121        if self.build_operation.is_some() {
1122            state.serialize_entry("buildOperation", &self.build_operation)?;
1123        }
1124        if !self.base_image_uri.is_empty() {
1125            state.serialize_entry("baseImageUri", &self.base_image_uri)?;
1126        }
1127        if !self.base_image_warning.is_empty() {
1128            state.serialize_entry("baseImageWarning", &self.base_image_warning)?;
1129        }
1130        if !self._unknown_fields.is_empty() {
1131            for (key, value) in self._unknown_fields.iter() {
1132                state.serialize_entry(key, &value)?;
1133            }
1134        }
1135        state.end()
1136    }
1137}
1138
1139/// Location of the source in an archive file in Google Cloud Storage.
1140#[derive(Clone, Debug, Default, PartialEq)]
1141#[non_exhaustive]
1142pub struct StorageSource {
1143    /// Required. Google Cloud Storage bucket containing the source (see
1144    /// [Bucket Name
1145    /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
1146    pub bucket: std::string::String,
1147
1148    /// Required. Google Cloud Storage object containing the source.
1149    ///
1150    /// This object must be a gzipped archive file (`.tar.gz`) containing source to
1151    /// build.
1152    pub object: std::string::String,
1153
1154    /// Optional. Google Cloud Storage generation for the object. If the generation
1155    /// is omitted, the latest generation will be used.
1156    pub generation: i64,
1157
1158    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1159}
1160
1161impl StorageSource {
1162    pub fn new() -> Self {
1163        std::default::Default::default()
1164    }
1165
1166    /// Sets the value of [bucket][crate::model::StorageSource::bucket].
1167    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1168        self.bucket = v.into();
1169        self
1170    }
1171
1172    /// Sets the value of [object][crate::model::StorageSource::object].
1173    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1174        self.object = v.into();
1175        self
1176    }
1177
1178    /// Sets the value of [generation][crate::model::StorageSource::generation].
1179    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1180        self.generation = v.into();
1181        self
1182    }
1183}
1184
1185impl wkt::message::Message for StorageSource {
1186    fn typename() -> &'static str {
1187        "type.googleapis.com/google.cloud.run.v2.StorageSource"
1188    }
1189}
1190
1191#[doc(hidden)]
1192impl<'de> serde::de::Deserialize<'de> for StorageSource {
1193    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1194    where
1195        D: serde::Deserializer<'de>,
1196    {
1197        #[allow(non_camel_case_types)]
1198        #[doc(hidden)]
1199        #[derive(PartialEq, Eq, Hash)]
1200        enum __FieldTag {
1201            __bucket,
1202            __object,
1203            __generation,
1204            Unknown(std::string::String),
1205        }
1206        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1207            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1208            where
1209                D: serde::Deserializer<'de>,
1210            {
1211                struct Visitor;
1212                impl<'de> serde::de::Visitor<'de> for Visitor {
1213                    type Value = __FieldTag;
1214                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1215                        formatter.write_str("a field name for StorageSource")
1216                    }
1217                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1218                    where
1219                        E: serde::de::Error,
1220                    {
1221                        use std::result::Result::Ok;
1222                        use std::string::ToString;
1223                        match value {
1224                            "bucket" => Ok(__FieldTag::__bucket),
1225                            "object" => Ok(__FieldTag::__object),
1226                            "generation" => Ok(__FieldTag::__generation),
1227                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1228                        }
1229                    }
1230                }
1231                deserializer.deserialize_identifier(Visitor)
1232            }
1233        }
1234        struct Visitor;
1235        impl<'de> serde::de::Visitor<'de> for Visitor {
1236            type Value = StorageSource;
1237            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1238                formatter.write_str("struct StorageSource")
1239            }
1240            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1241            where
1242                A: serde::de::MapAccess<'de>,
1243            {
1244                #[allow(unused_imports)]
1245                use serde::de::Error;
1246                use std::option::Option::Some;
1247                let mut fields = std::collections::HashSet::new();
1248                let mut result = Self::Value::new();
1249                while let Some(tag) = map.next_key::<__FieldTag>()? {
1250                    #[allow(clippy::match_single_binding)]
1251                    match tag {
1252                        __FieldTag::__bucket => {
1253                            if !fields.insert(__FieldTag::__bucket) {
1254                                return std::result::Result::Err(A::Error::duplicate_field(
1255                                    "multiple values for bucket",
1256                                ));
1257                            }
1258                            result.bucket = map
1259                                .next_value::<std::option::Option<std::string::String>>()?
1260                                .unwrap_or_default();
1261                        }
1262                        __FieldTag::__object => {
1263                            if !fields.insert(__FieldTag::__object) {
1264                                return std::result::Result::Err(A::Error::duplicate_field(
1265                                    "multiple values for object",
1266                                ));
1267                            }
1268                            result.object = map
1269                                .next_value::<std::option::Option<std::string::String>>()?
1270                                .unwrap_or_default();
1271                        }
1272                        __FieldTag::__generation => {
1273                            if !fields.insert(__FieldTag::__generation) {
1274                                return std::result::Result::Err(A::Error::duplicate_field(
1275                                    "multiple values for generation",
1276                                ));
1277                            }
1278                            struct __With(std::option::Option<i64>);
1279                            impl<'de> serde::de::Deserialize<'de> for __With {
1280                                fn deserialize<D>(
1281                                    deserializer: D,
1282                                ) -> std::result::Result<Self, D::Error>
1283                                where
1284                                    D: serde::de::Deserializer<'de>,
1285                                {
1286                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1287                                }
1288                            }
1289                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
1290                        }
1291                        __FieldTag::Unknown(key) => {
1292                            let value = map.next_value::<serde_json::Value>()?;
1293                            result._unknown_fields.insert(key, value);
1294                        }
1295                    }
1296                }
1297                std::result::Result::Ok(result)
1298            }
1299        }
1300        deserializer.deserialize_any(Visitor)
1301    }
1302}
1303
1304#[doc(hidden)]
1305impl serde::ser::Serialize for StorageSource {
1306    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1307    where
1308        S: serde::ser::Serializer,
1309    {
1310        use serde::ser::SerializeMap;
1311        #[allow(unused_imports)]
1312        use std::option::Option::Some;
1313        let mut state = serializer.serialize_map(std::option::Option::None)?;
1314        if !self.bucket.is_empty() {
1315            state.serialize_entry("bucket", &self.bucket)?;
1316        }
1317        if !self.object.is_empty() {
1318            state.serialize_entry("object", &self.object)?;
1319        }
1320        if !wkt::internal::is_default(&self.generation) {
1321            struct __With<'a>(&'a i64);
1322            impl<'a> serde::ser::Serialize for __With<'a> {
1323                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1324                where
1325                    S: serde::ser::Serializer,
1326                {
1327                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1328                }
1329            }
1330            state.serialize_entry("generation", &__With(&self.generation))?;
1331        }
1332        if !self._unknown_fields.is_empty() {
1333            for (key, value) in self._unknown_fields.iter() {
1334                state.serialize_entry(key, &value)?;
1335            }
1336        }
1337        state.end()
1338    }
1339}
1340
1341/// Defines a status condition for a resource.
1342#[derive(Clone, Debug, Default, PartialEq)]
1343#[non_exhaustive]
1344pub struct Condition {
1345    /// type is used to communicate the status of the reconciliation process.
1346    /// See also:
1347    /// <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting>
1348    /// Types common to all resources include:
1349    ///
1350    /// * "Ready": True when the Resource is ready.
1351    pub r#type: std::string::String,
1352
1353    /// State of the condition.
1354    pub state: crate::model::condition::State,
1355
1356    /// Human readable message indicating details about the current status.
1357    pub message: std::string::String,
1358
1359    /// Last time the condition transitioned from one status to another.
1360    pub last_transition_time: std::option::Option<wkt::Timestamp>,
1361
1362    /// How to interpret failures of this condition, one of Error, Warning, Info
1363    pub severity: crate::model::condition::Severity,
1364
1365    /// The reason for this condition. Depending on the condition type,
1366    /// it will populate one of these fields.
1367    /// Successful conditions cannot have a reason.
1368    pub reasons: std::option::Option<crate::model::condition::Reasons>,
1369
1370    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1371}
1372
1373impl Condition {
1374    pub fn new() -> Self {
1375        std::default::Default::default()
1376    }
1377
1378    /// Sets the value of [r#type][crate::model::Condition::type].
1379    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1380        self.r#type = v.into();
1381        self
1382    }
1383
1384    /// Sets the value of [state][crate::model::Condition::state].
1385    pub fn set_state<T: std::convert::Into<crate::model::condition::State>>(
1386        mut self,
1387        v: T,
1388    ) -> Self {
1389        self.state = v.into();
1390        self
1391    }
1392
1393    /// Sets the value of [message][crate::model::Condition::message].
1394    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1395        self.message = v.into();
1396        self
1397    }
1398
1399    /// Sets the value of [last_transition_time][crate::model::Condition::last_transition_time].
1400    pub fn set_last_transition_time<T>(mut self, v: T) -> Self
1401    where
1402        T: std::convert::Into<wkt::Timestamp>,
1403    {
1404        self.last_transition_time = std::option::Option::Some(v.into());
1405        self
1406    }
1407
1408    /// Sets or clears the value of [last_transition_time][crate::model::Condition::last_transition_time].
1409    pub fn set_or_clear_last_transition_time<T>(mut self, v: std::option::Option<T>) -> Self
1410    where
1411        T: std::convert::Into<wkt::Timestamp>,
1412    {
1413        self.last_transition_time = v.map(|x| x.into());
1414        self
1415    }
1416
1417    /// Sets the value of [severity][crate::model::Condition::severity].
1418    pub fn set_severity<T: std::convert::Into<crate::model::condition::Severity>>(
1419        mut self,
1420        v: T,
1421    ) -> Self {
1422        self.severity = v.into();
1423        self
1424    }
1425
1426    /// Sets the value of [reasons][crate::model::Condition::reasons].
1427    ///
1428    /// Note that all the setters affecting `reasons` are mutually
1429    /// exclusive.
1430    pub fn set_reasons<
1431        T: std::convert::Into<std::option::Option<crate::model::condition::Reasons>>,
1432    >(
1433        mut self,
1434        v: T,
1435    ) -> Self {
1436        self.reasons = v.into();
1437        self
1438    }
1439
1440    /// The value of [reasons][crate::model::Condition::reasons]
1441    /// if it holds a `Reason`, `None` if the field is not set or
1442    /// holds a different branch.
1443    pub fn reason(&self) -> std::option::Option<&crate::model::condition::CommonReason> {
1444        #[allow(unreachable_patterns)]
1445        self.reasons.as_ref().and_then(|v| match v {
1446            crate::model::condition::Reasons::Reason(v) => std::option::Option::Some(v),
1447            _ => std::option::Option::None,
1448        })
1449    }
1450
1451    /// Sets the value of [reasons][crate::model::Condition::reasons]
1452    /// to hold a `Reason`.
1453    ///
1454    /// Note that all the setters affecting `reasons` are
1455    /// mutually exclusive.
1456    pub fn set_reason<T: std::convert::Into<crate::model::condition::CommonReason>>(
1457        mut self,
1458        v: T,
1459    ) -> Self {
1460        self.reasons =
1461            std::option::Option::Some(crate::model::condition::Reasons::Reason(v.into()));
1462        self
1463    }
1464
1465    /// The value of [reasons][crate::model::Condition::reasons]
1466    /// if it holds a `RevisionReason`, `None` if the field is not set or
1467    /// holds a different branch.
1468    pub fn revision_reason(&self) -> std::option::Option<&crate::model::condition::RevisionReason> {
1469        #[allow(unreachable_patterns)]
1470        self.reasons.as_ref().and_then(|v| match v {
1471            crate::model::condition::Reasons::RevisionReason(v) => std::option::Option::Some(v),
1472            _ => std::option::Option::None,
1473        })
1474    }
1475
1476    /// Sets the value of [reasons][crate::model::Condition::reasons]
1477    /// to hold a `RevisionReason`.
1478    ///
1479    /// Note that all the setters affecting `reasons` are
1480    /// mutually exclusive.
1481    pub fn set_revision_reason<T: std::convert::Into<crate::model::condition::RevisionReason>>(
1482        mut self,
1483        v: T,
1484    ) -> Self {
1485        self.reasons =
1486            std::option::Option::Some(crate::model::condition::Reasons::RevisionReason(v.into()));
1487        self
1488    }
1489
1490    /// The value of [reasons][crate::model::Condition::reasons]
1491    /// if it holds a `ExecutionReason`, `None` if the field is not set or
1492    /// holds a different branch.
1493    pub fn execution_reason(
1494        &self,
1495    ) -> std::option::Option<&crate::model::condition::ExecutionReason> {
1496        #[allow(unreachable_patterns)]
1497        self.reasons.as_ref().and_then(|v| match v {
1498            crate::model::condition::Reasons::ExecutionReason(v) => std::option::Option::Some(v),
1499            _ => std::option::Option::None,
1500        })
1501    }
1502
1503    /// Sets the value of [reasons][crate::model::Condition::reasons]
1504    /// to hold a `ExecutionReason`.
1505    ///
1506    /// Note that all the setters affecting `reasons` are
1507    /// mutually exclusive.
1508    pub fn set_execution_reason<T: std::convert::Into<crate::model::condition::ExecutionReason>>(
1509        mut self,
1510        v: T,
1511    ) -> Self {
1512        self.reasons =
1513            std::option::Option::Some(crate::model::condition::Reasons::ExecutionReason(v.into()));
1514        self
1515    }
1516}
1517
1518impl wkt::message::Message for Condition {
1519    fn typename() -> &'static str {
1520        "type.googleapis.com/google.cloud.run.v2.Condition"
1521    }
1522}
1523
1524#[doc(hidden)]
1525impl<'de> serde::de::Deserialize<'de> for Condition {
1526    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1527    where
1528        D: serde::Deserializer<'de>,
1529    {
1530        #[allow(non_camel_case_types)]
1531        #[doc(hidden)]
1532        #[derive(PartialEq, Eq, Hash)]
1533        enum __FieldTag {
1534            __type,
1535            __state,
1536            __message,
1537            __last_transition_time,
1538            __severity,
1539            __reason,
1540            __revision_reason,
1541            __execution_reason,
1542            Unknown(std::string::String),
1543        }
1544        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1545            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1546            where
1547                D: serde::Deserializer<'de>,
1548            {
1549                struct Visitor;
1550                impl<'de> serde::de::Visitor<'de> for Visitor {
1551                    type Value = __FieldTag;
1552                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1553                        formatter.write_str("a field name for Condition")
1554                    }
1555                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1556                    where
1557                        E: serde::de::Error,
1558                    {
1559                        use std::result::Result::Ok;
1560                        use std::string::ToString;
1561                        match value {
1562                            "type" => Ok(__FieldTag::__type),
1563                            "state" => Ok(__FieldTag::__state),
1564                            "message" => Ok(__FieldTag::__message),
1565                            "lastTransitionTime" => Ok(__FieldTag::__last_transition_time),
1566                            "last_transition_time" => Ok(__FieldTag::__last_transition_time),
1567                            "severity" => Ok(__FieldTag::__severity),
1568                            "reason" => Ok(__FieldTag::__reason),
1569                            "revisionReason" => Ok(__FieldTag::__revision_reason),
1570                            "revision_reason" => Ok(__FieldTag::__revision_reason),
1571                            "executionReason" => Ok(__FieldTag::__execution_reason),
1572                            "execution_reason" => Ok(__FieldTag::__execution_reason),
1573                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1574                        }
1575                    }
1576                }
1577                deserializer.deserialize_identifier(Visitor)
1578            }
1579        }
1580        struct Visitor;
1581        impl<'de> serde::de::Visitor<'de> for Visitor {
1582            type Value = Condition;
1583            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1584                formatter.write_str("struct Condition")
1585            }
1586            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1587            where
1588                A: serde::de::MapAccess<'de>,
1589            {
1590                #[allow(unused_imports)]
1591                use serde::de::Error;
1592                use std::option::Option::Some;
1593                let mut fields = std::collections::HashSet::new();
1594                let mut result = Self::Value::new();
1595                while let Some(tag) = map.next_key::<__FieldTag>()? {
1596                    #[allow(clippy::match_single_binding)]
1597                    match tag {
1598                        __FieldTag::__type => {
1599                            if !fields.insert(__FieldTag::__type) {
1600                                return std::result::Result::Err(A::Error::duplicate_field(
1601                                    "multiple values for type",
1602                                ));
1603                            }
1604                            result.r#type = map
1605                                .next_value::<std::option::Option<std::string::String>>()?
1606                                .unwrap_or_default();
1607                        }
1608                        __FieldTag::__state => {
1609                            if !fields.insert(__FieldTag::__state) {
1610                                return std::result::Result::Err(A::Error::duplicate_field(
1611                                    "multiple values for state",
1612                                ));
1613                            }
1614                            result.state = map
1615                                .next_value::<std::option::Option<crate::model::condition::State>>(
1616                                )?
1617                                .unwrap_or_default();
1618                        }
1619                        __FieldTag::__message => {
1620                            if !fields.insert(__FieldTag::__message) {
1621                                return std::result::Result::Err(A::Error::duplicate_field(
1622                                    "multiple values for message",
1623                                ));
1624                            }
1625                            result.message = map
1626                                .next_value::<std::option::Option<std::string::String>>()?
1627                                .unwrap_or_default();
1628                        }
1629                        __FieldTag::__last_transition_time => {
1630                            if !fields.insert(__FieldTag::__last_transition_time) {
1631                                return std::result::Result::Err(A::Error::duplicate_field(
1632                                    "multiple values for last_transition_time",
1633                                ));
1634                            }
1635                            result.last_transition_time =
1636                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1637                        }
1638                        __FieldTag::__severity => {
1639                            if !fields.insert(__FieldTag::__severity) {
1640                                return std::result::Result::Err(A::Error::duplicate_field(
1641                                    "multiple values for severity",
1642                                ));
1643                            }
1644                            result.severity = map.next_value::<std::option::Option<crate::model::condition::Severity>>()?.unwrap_or_default();
1645                        }
1646                        __FieldTag::__reason => {
1647                            if !fields.insert(__FieldTag::__reason) {
1648                                return std::result::Result::Err(A::Error::duplicate_field(
1649                                    "multiple values for reason",
1650                                ));
1651                            }
1652                            if result.reasons.is_some() {
1653                                return std::result::Result::Err(A::Error::duplicate_field(
1654                                    "multiple values for `reasons`, a oneof with full ID .google.cloud.run.v2.Condition.reason, latest field was reason",
1655                                ));
1656                            }
1657                            result.reasons =
1658                                std::option::Option::Some(
1659                                    crate::model::condition::Reasons::Reason(
1660                                        map.next_value::<std::option::Option<
1661                                            crate::model::condition::CommonReason,
1662                                        >>()?
1663                                        .unwrap_or_default(),
1664                                    ),
1665                                );
1666                        }
1667                        __FieldTag::__revision_reason => {
1668                            if !fields.insert(__FieldTag::__revision_reason) {
1669                                return std::result::Result::Err(A::Error::duplicate_field(
1670                                    "multiple values for revision_reason",
1671                                ));
1672                            }
1673                            if result.reasons.is_some() {
1674                                return std::result::Result::Err(A::Error::duplicate_field(
1675                                    "multiple values for `reasons`, a oneof with full ID .google.cloud.run.v2.Condition.revision_reason, latest field was revisionReason",
1676                                ));
1677                            }
1678                            result.reasons = std::option::Option::Some(
1679                                crate::model::condition::Reasons::RevisionReason(
1680                                    map.next_value::<std::option::Option<
1681                                        crate::model::condition::RevisionReason,
1682                                    >>()?
1683                                    .unwrap_or_default(),
1684                                ),
1685                            );
1686                        }
1687                        __FieldTag::__execution_reason => {
1688                            if !fields.insert(__FieldTag::__execution_reason) {
1689                                return std::result::Result::Err(A::Error::duplicate_field(
1690                                    "multiple values for execution_reason",
1691                                ));
1692                            }
1693                            if result.reasons.is_some() {
1694                                return std::result::Result::Err(A::Error::duplicate_field(
1695                                    "multiple values for `reasons`, a oneof with full ID .google.cloud.run.v2.Condition.execution_reason, latest field was executionReason",
1696                                ));
1697                            }
1698                            result.reasons = std::option::Option::Some(
1699                                crate::model::condition::Reasons::ExecutionReason(
1700                                    map.next_value::<std::option::Option<
1701                                        crate::model::condition::ExecutionReason,
1702                                    >>()?
1703                                    .unwrap_or_default(),
1704                                ),
1705                            );
1706                        }
1707                        __FieldTag::Unknown(key) => {
1708                            let value = map.next_value::<serde_json::Value>()?;
1709                            result._unknown_fields.insert(key, value);
1710                        }
1711                    }
1712                }
1713                std::result::Result::Ok(result)
1714            }
1715        }
1716        deserializer.deserialize_any(Visitor)
1717    }
1718}
1719
1720#[doc(hidden)]
1721impl serde::ser::Serialize for Condition {
1722    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1723    where
1724        S: serde::ser::Serializer,
1725    {
1726        use serde::ser::SerializeMap;
1727        #[allow(unused_imports)]
1728        use std::option::Option::Some;
1729        let mut state = serializer.serialize_map(std::option::Option::None)?;
1730        if !self.r#type.is_empty() {
1731            state.serialize_entry("type", &self.r#type)?;
1732        }
1733        if !wkt::internal::is_default(&self.state) {
1734            state.serialize_entry("state", &self.state)?;
1735        }
1736        if !self.message.is_empty() {
1737            state.serialize_entry("message", &self.message)?;
1738        }
1739        if self.last_transition_time.is_some() {
1740            state.serialize_entry("lastTransitionTime", &self.last_transition_time)?;
1741        }
1742        if !wkt::internal::is_default(&self.severity) {
1743            state.serialize_entry("severity", &self.severity)?;
1744        }
1745        if let Some(value) = self.reason() {
1746            state.serialize_entry("reason", value)?;
1747        }
1748        if let Some(value) = self.revision_reason() {
1749            state.serialize_entry("revisionReason", value)?;
1750        }
1751        if let Some(value) = self.execution_reason() {
1752            state.serialize_entry("executionReason", value)?;
1753        }
1754        if !self._unknown_fields.is_empty() {
1755            for (key, value) in self._unknown_fields.iter() {
1756                state.serialize_entry(key, &value)?;
1757            }
1758        }
1759        state.end()
1760    }
1761}
1762
1763/// Defines additional types related to [Condition].
1764pub mod condition {
1765    #[allow(unused_imports)]
1766    use super::*;
1767
1768    /// Represents the possible Condition states.
1769    ///
1770    /// # Working with unknown values
1771    ///
1772    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1773    /// additional enum variants at any time. Adding new variants is not considered
1774    /// a breaking change. Applications should write their code in anticipation of:
1775    ///
1776    /// - New values appearing in future releases of the client library, **and**
1777    /// - New values received dynamically, without application changes.
1778    ///
1779    /// Please consult the [Working with enums] section in the user guide for some
1780    /// guidelines.
1781    ///
1782    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1783    #[derive(Clone, Debug, PartialEq)]
1784    #[non_exhaustive]
1785    pub enum State {
1786        /// The default value. This value is used if the state is omitted.
1787        Unspecified,
1788        /// Transient state: Reconciliation has not started yet.
1789        ConditionPending,
1790        /// Transient state: reconciliation is still in progress.
1791        ConditionReconciling,
1792        /// Terminal state: Reconciliation did not succeed.
1793        ConditionFailed,
1794        /// Terminal state: Reconciliation completed successfully.
1795        ConditionSucceeded,
1796        /// If set, the enum was initialized with an unknown value.
1797        ///
1798        /// Applications can examine the value using [State::value] or
1799        /// [State::name].
1800        UnknownValue(state::UnknownValue),
1801    }
1802
1803    #[doc(hidden)]
1804    pub mod state {
1805        #[allow(unused_imports)]
1806        use super::*;
1807        #[derive(Clone, Debug, PartialEq)]
1808        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1809    }
1810
1811    impl State {
1812        /// Gets the enum value.
1813        ///
1814        /// Returns `None` if the enum contains an unknown value deserialized from
1815        /// the string representation of enums.
1816        pub fn value(&self) -> std::option::Option<i32> {
1817            match self {
1818                Self::Unspecified => std::option::Option::Some(0),
1819                Self::ConditionPending => std::option::Option::Some(1),
1820                Self::ConditionReconciling => std::option::Option::Some(2),
1821                Self::ConditionFailed => std::option::Option::Some(3),
1822                Self::ConditionSucceeded => std::option::Option::Some(4),
1823                Self::UnknownValue(u) => u.0.value(),
1824            }
1825        }
1826
1827        /// Gets the enum value as a string.
1828        ///
1829        /// Returns `None` if the enum contains an unknown value deserialized from
1830        /// the integer representation of enums.
1831        pub fn name(&self) -> std::option::Option<&str> {
1832            match self {
1833                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1834                Self::ConditionPending => std::option::Option::Some("CONDITION_PENDING"),
1835                Self::ConditionReconciling => std::option::Option::Some("CONDITION_RECONCILING"),
1836                Self::ConditionFailed => std::option::Option::Some("CONDITION_FAILED"),
1837                Self::ConditionSucceeded => std::option::Option::Some("CONDITION_SUCCEEDED"),
1838                Self::UnknownValue(u) => u.0.name(),
1839            }
1840        }
1841    }
1842
1843    impl std::default::Default for State {
1844        fn default() -> Self {
1845            use std::convert::From;
1846            Self::from(0)
1847        }
1848    }
1849
1850    impl std::fmt::Display for State {
1851        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1852            wkt::internal::display_enum(f, self.name(), self.value())
1853        }
1854    }
1855
1856    impl std::convert::From<i32> for State {
1857        fn from(value: i32) -> Self {
1858            match value {
1859                0 => Self::Unspecified,
1860                1 => Self::ConditionPending,
1861                2 => Self::ConditionReconciling,
1862                3 => Self::ConditionFailed,
1863                4 => Self::ConditionSucceeded,
1864                _ => Self::UnknownValue(state::UnknownValue(
1865                    wkt::internal::UnknownEnumValue::Integer(value),
1866                )),
1867            }
1868        }
1869    }
1870
1871    impl std::convert::From<&str> for State {
1872        fn from(value: &str) -> Self {
1873            use std::string::ToString;
1874            match value {
1875                "STATE_UNSPECIFIED" => Self::Unspecified,
1876                "CONDITION_PENDING" => Self::ConditionPending,
1877                "CONDITION_RECONCILING" => Self::ConditionReconciling,
1878                "CONDITION_FAILED" => Self::ConditionFailed,
1879                "CONDITION_SUCCEEDED" => Self::ConditionSucceeded,
1880                _ => Self::UnknownValue(state::UnknownValue(
1881                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1882                )),
1883            }
1884        }
1885    }
1886
1887    impl serde::ser::Serialize for State {
1888        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1889        where
1890            S: serde::Serializer,
1891        {
1892            match self {
1893                Self::Unspecified => serializer.serialize_i32(0),
1894                Self::ConditionPending => serializer.serialize_i32(1),
1895                Self::ConditionReconciling => serializer.serialize_i32(2),
1896                Self::ConditionFailed => serializer.serialize_i32(3),
1897                Self::ConditionSucceeded => serializer.serialize_i32(4),
1898                Self::UnknownValue(u) => u.0.serialize(serializer),
1899            }
1900        }
1901    }
1902
1903    impl<'de> serde::de::Deserialize<'de> for State {
1904        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1905        where
1906            D: serde::Deserializer<'de>,
1907        {
1908            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1909                ".google.cloud.run.v2.Condition.State",
1910            ))
1911        }
1912    }
1913
1914    /// Represents the severity of the condition failures.
1915    ///
1916    /// # Working with unknown values
1917    ///
1918    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1919    /// additional enum variants at any time. Adding new variants is not considered
1920    /// a breaking change. Applications should write their code in anticipation of:
1921    ///
1922    /// - New values appearing in future releases of the client library, **and**
1923    /// - New values received dynamically, without application changes.
1924    ///
1925    /// Please consult the [Working with enums] section in the user guide for some
1926    /// guidelines.
1927    ///
1928    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1929    #[derive(Clone, Debug, PartialEq)]
1930    #[non_exhaustive]
1931    pub enum Severity {
1932        /// Unspecified severity
1933        Unspecified,
1934        /// Error severity.
1935        Error,
1936        /// Warning severity.
1937        Warning,
1938        /// Info severity.
1939        Info,
1940        /// If set, the enum was initialized with an unknown value.
1941        ///
1942        /// Applications can examine the value using [Severity::value] or
1943        /// [Severity::name].
1944        UnknownValue(severity::UnknownValue),
1945    }
1946
1947    #[doc(hidden)]
1948    pub mod severity {
1949        #[allow(unused_imports)]
1950        use super::*;
1951        #[derive(Clone, Debug, PartialEq)]
1952        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1953    }
1954
1955    impl Severity {
1956        /// Gets the enum value.
1957        ///
1958        /// Returns `None` if the enum contains an unknown value deserialized from
1959        /// the string representation of enums.
1960        pub fn value(&self) -> std::option::Option<i32> {
1961            match self {
1962                Self::Unspecified => std::option::Option::Some(0),
1963                Self::Error => std::option::Option::Some(1),
1964                Self::Warning => std::option::Option::Some(2),
1965                Self::Info => std::option::Option::Some(3),
1966                Self::UnknownValue(u) => u.0.value(),
1967            }
1968        }
1969
1970        /// Gets the enum value as a string.
1971        ///
1972        /// Returns `None` if the enum contains an unknown value deserialized from
1973        /// the integer representation of enums.
1974        pub fn name(&self) -> std::option::Option<&str> {
1975            match self {
1976                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
1977                Self::Error => std::option::Option::Some("ERROR"),
1978                Self::Warning => std::option::Option::Some("WARNING"),
1979                Self::Info => std::option::Option::Some("INFO"),
1980                Self::UnknownValue(u) => u.0.name(),
1981            }
1982        }
1983    }
1984
1985    impl std::default::Default for Severity {
1986        fn default() -> Self {
1987            use std::convert::From;
1988            Self::from(0)
1989        }
1990    }
1991
1992    impl std::fmt::Display for Severity {
1993        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1994            wkt::internal::display_enum(f, self.name(), self.value())
1995        }
1996    }
1997
1998    impl std::convert::From<i32> for Severity {
1999        fn from(value: i32) -> Self {
2000            match value {
2001                0 => Self::Unspecified,
2002                1 => Self::Error,
2003                2 => Self::Warning,
2004                3 => Self::Info,
2005                _ => Self::UnknownValue(severity::UnknownValue(
2006                    wkt::internal::UnknownEnumValue::Integer(value),
2007                )),
2008            }
2009        }
2010    }
2011
2012    impl std::convert::From<&str> for Severity {
2013        fn from(value: &str) -> Self {
2014            use std::string::ToString;
2015            match value {
2016                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
2017                "ERROR" => Self::Error,
2018                "WARNING" => Self::Warning,
2019                "INFO" => Self::Info,
2020                _ => Self::UnknownValue(severity::UnknownValue(
2021                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2022                )),
2023            }
2024        }
2025    }
2026
2027    impl serde::ser::Serialize for Severity {
2028        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2029        where
2030            S: serde::Serializer,
2031        {
2032            match self {
2033                Self::Unspecified => serializer.serialize_i32(0),
2034                Self::Error => serializer.serialize_i32(1),
2035                Self::Warning => serializer.serialize_i32(2),
2036                Self::Info => serializer.serialize_i32(3),
2037                Self::UnknownValue(u) => u.0.serialize(serializer),
2038            }
2039        }
2040    }
2041
2042    impl<'de> serde::de::Deserialize<'de> for Severity {
2043        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2044        where
2045            D: serde::Deserializer<'de>,
2046        {
2047            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
2048                ".google.cloud.run.v2.Condition.Severity",
2049            ))
2050        }
2051    }
2052
2053    /// Reasons common to all types of conditions.
2054    ///
2055    /// # Working with unknown values
2056    ///
2057    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2058    /// additional enum variants at any time. Adding new variants is not considered
2059    /// a breaking change. Applications should write their code in anticipation of:
2060    ///
2061    /// - New values appearing in future releases of the client library, **and**
2062    /// - New values received dynamically, without application changes.
2063    ///
2064    /// Please consult the [Working with enums] section in the user guide for some
2065    /// guidelines.
2066    ///
2067    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2068    #[derive(Clone, Debug, PartialEq)]
2069    #[non_exhaustive]
2070    pub enum CommonReason {
2071        /// Default value.
2072        Undefined,
2073        /// Reason unknown. Further details will be in message.
2074        Unknown,
2075        /// Revision creation process failed.
2076        RevisionFailed,
2077        /// Timed out waiting for completion.
2078        ProgressDeadlineExceeded,
2079        /// The container image path is incorrect.
2080        ContainerMissing,
2081        /// Insufficient permissions on the container image.
2082        ContainerPermissionDenied,
2083        /// Container image is not authorized by policy.
2084        ContainerImageUnauthorized,
2085        /// Container image policy authorization check failed.
2086        ContainerImageAuthorizationCheckFailed,
2087        /// Insufficient permissions on encryption key.
2088        EncryptionKeyPermissionDenied,
2089        /// Permission check on encryption key failed.
2090        EncryptionKeyCheckFailed,
2091        /// At least one Access check on secrets failed.
2092        SecretsAccessCheckFailed,
2093        /// Waiting for operation to complete.
2094        WaitingForOperation,
2095        /// System will retry immediately.
2096        ImmediateRetry,
2097        /// System will retry later; current attempt failed.
2098        PostponedRetry,
2099        /// An internal error occurred. Further information may be in the message.
2100        Internal,
2101        /// User-provided VPC network was not found.
2102        VpcNetworkNotFound,
2103        /// If set, the enum was initialized with an unknown value.
2104        ///
2105        /// Applications can examine the value using [CommonReason::value] or
2106        /// [CommonReason::name].
2107        UnknownValue(common_reason::UnknownValue),
2108    }
2109
2110    #[doc(hidden)]
2111    pub mod common_reason {
2112        #[allow(unused_imports)]
2113        use super::*;
2114        #[derive(Clone, Debug, PartialEq)]
2115        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2116    }
2117
2118    impl CommonReason {
2119        /// Gets the enum value.
2120        ///
2121        /// Returns `None` if the enum contains an unknown value deserialized from
2122        /// the string representation of enums.
2123        pub fn value(&self) -> std::option::Option<i32> {
2124            match self {
2125                Self::Undefined => std::option::Option::Some(0),
2126                Self::Unknown => std::option::Option::Some(1),
2127                Self::RevisionFailed => std::option::Option::Some(3),
2128                Self::ProgressDeadlineExceeded => std::option::Option::Some(4),
2129                Self::ContainerMissing => std::option::Option::Some(6),
2130                Self::ContainerPermissionDenied => std::option::Option::Some(7),
2131                Self::ContainerImageUnauthorized => std::option::Option::Some(8),
2132                Self::ContainerImageAuthorizationCheckFailed => std::option::Option::Some(9),
2133                Self::EncryptionKeyPermissionDenied => std::option::Option::Some(10),
2134                Self::EncryptionKeyCheckFailed => std::option::Option::Some(11),
2135                Self::SecretsAccessCheckFailed => std::option::Option::Some(12),
2136                Self::WaitingForOperation => std::option::Option::Some(13),
2137                Self::ImmediateRetry => std::option::Option::Some(14),
2138                Self::PostponedRetry => std::option::Option::Some(15),
2139                Self::Internal => std::option::Option::Some(16),
2140                Self::VpcNetworkNotFound => std::option::Option::Some(17),
2141                Self::UnknownValue(u) => u.0.value(),
2142            }
2143        }
2144
2145        /// Gets the enum value as a string.
2146        ///
2147        /// Returns `None` if the enum contains an unknown value deserialized from
2148        /// the integer representation of enums.
2149        pub fn name(&self) -> std::option::Option<&str> {
2150            match self {
2151                Self::Undefined => std::option::Option::Some("COMMON_REASON_UNDEFINED"),
2152                Self::Unknown => std::option::Option::Some("UNKNOWN"),
2153                Self::RevisionFailed => std::option::Option::Some("REVISION_FAILED"),
2154                Self::ProgressDeadlineExceeded => {
2155                    std::option::Option::Some("PROGRESS_DEADLINE_EXCEEDED")
2156                }
2157                Self::ContainerMissing => std::option::Option::Some("CONTAINER_MISSING"),
2158                Self::ContainerPermissionDenied => {
2159                    std::option::Option::Some("CONTAINER_PERMISSION_DENIED")
2160                }
2161                Self::ContainerImageUnauthorized => {
2162                    std::option::Option::Some("CONTAINER_IMAGE_UNAUTHORIZED")
2163                }
2164                Self::ContainerImageAuthorizationCheckFailed => {
2165                    std::option::Option::Some("CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED")
2166                }
2167                Self::EncryptionKeyPermissionDenied => {
2168                    std::option::Option::Some("ENCRYPTION_KEY_PERMISSION_DENIED")
2169                }
2170                Self::EncryptionKeyCheckFailed => {
2171                    std::option::Option::Some("ENCRYPTION_KEY_CHECK_FAILED")
2172                }
2173                Self::SecretsAccessCheckFailed => {
2174                    std::option::Option::Some("SECRETS_ACCESS_CHECK_FAILED")
2175                }
2176                Self::WaitingForOperation => std::option::Option::Some("WAITING_FOR_OPERATION"),
2177                Self::ImmediateRetry => std::option::Option::Some("IMMEDIATE_RETRY"),
2178                Self::PostponedRetry => std::option::Option::Some("POSTPONED_RETRY"),
2179                Self::Internal => std::option::Option::Some("INTERNAL"),
2180                Self::VpcNetworkNotFound => std::option::Option::Some("VPC_NETWORK_NOT_FOUND"),
2181                Self::UnknownValue(u) => u.0.name(),
2182            }
2183        }
2184    }
2185
2186    impl std::default::Default for CommonReason {
2187        fn default() -> Self {
2188            use std::convert::From;
2189            Self::from(0)
2190        }
2191    }
2192
2193    impl std::fmt::Display for CommonReason {
2194        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2195            wkt::internal::display_enum(f, self.name(), self.value())
2196        }
2197    }
2198
2199    impl std::convert::From<i32> for CommonReason {
2200        fn from(value: i32) -> Self {
2201            match value {
2202                0 => Self::Undefined,
2203                1 => Self::Unknown,
2204                3 => Self::RevisionFailed,
2205                4 => Self::ProgressDeadlineExceeded,
2206                6 => Self::ContainerMissing,
2207                7 => Self::ContainerPermissionDenied,
2208                8 => Self::ContainerImageUnauthorized,
2209                9 => Self::ContainerImageAuthorizationCheckFailed,
2210                10 => Self::EncryptionKeyPermissionDenied,
2211                11 => Self::EncryptionKeyCheckFailed,
2212                12 => Self::SecretsAccessCheckFailed,
2213                13 => Self::WaitingForOperation,
2214                14 => Self::ImmediateRetry,
2215                15 => Self::PostponedRetry,
2216                16 => Self::Internal,
2217                17 => Self::VpcNetworkNotFound,
2218                _ => Self::UnknownValue(common_reason::UnknownValue(
2219                    wkt::internal::UnknownEnumValue::Integer(value),
2220                )),
2221            }
2222        }
2223    }
2224
2225    impl std::convert::From<&str> for CommonReason {
2226        fn from(value: &str) -> Self {
2227            use std::string::ToString;
2228            match value {
2229                "COMMON_REASON_UNDEFINED" => Self::Undefined,
2230                "UNKNOWN" => Self::Unknown,
2231                "REVISION_FAILED" => Self::RevisionFailed,
2232                "PROGRESS_DEADLINE_EXCEEDED" => Self::ProgressDeadlineExceeded,
2233                "CONTAINER_MISSING" => Self::ContainerMissing,
2234                "CONTAINER_PERMISSION_DENIED" => Self::ContainerPermissionDenied,
2235                "CONTAINER_IMAGE_UNAUTHORIZED" => Self::ContainerImageUnauthorized,
2236                "CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED" => {
2237                    Self::ContainerImageAuthorizationCheckFailed
2238                }
2239                "ENCRYPTION_KEY_PERMISSION_DENIED" => Self::EncryptionKeyPermissionDenied,
2240                "ENCRYPTION_KEY_CHECK_FAILED" => Self::EncryptionKeyCheckFailed,
2241                "SECRETS_ACCESS_CHECK_FAILED" => Self::SecretsAccessCheckFailed,
2242                "WAITING_FOR_OPERATION" => Self::WaitingForOperation,
2243                "IMMEDIATE_RETRY" => Self::ImmediateRetry,
2244                "POSTPONED_RETRY" => Self::PostponedRetry,
2245                "INTERNAL" => Self::Internal,
2246                "VPC_NETWORK_NOT_FOUND" => Self::VpcNetworkNotFound,
2247                _ => Self::UnknownValue(common_reason::UnknownValue(
2248                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2249                )),
2250            }
2251        }
2252    }
2253
2254    impl serde::ser::Serialize for CommonReason {
2255        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2256        where
2257            S: serde::Serializer,
2258        {
2259            match self {
2260                Self::Undefined => serializer.serialize_i32(0),
2261                Self::Unknown => serializer.serialize_i32(1),
2262                Self::RevisionFailed => serializer.serialize_i32(3),
2263                Self::ProgressDeadlineExceeded => serializer.serialize_i32(4),
2264                Self::ContainerMissing => serializer.serialize_i32(6),
2265                Self::ContainerPermissionDenied => serializer.serialize_i32(7),
2266                Self::ContainerImageUnauthorized => serializer.serialize_i32(8),
2267                Self::ContainerImageAuthorizationCheckFailed => serializer.serialize_i32(9),
2268                Self::EncryptionKeyPermissionDenied => serializer.serialize_i32(10),
2269                Self::EncryptionKeyCheckFailed => serializer.serialize_i32(11),
2270                Self::SecretsAccessCheckFailed => serializer.serialize_i32(12),
2271                Self::WaitingForOperation => serializer.serialize_i32(13),
2272                Self::ImmediateRetry => serializer.serialize_i32(14),
2273                Self::PostponedRetry => serializer.serialize_i32(15),
2274                Self::Internal => serializer.serialize_i32(16),
2275                Self::VpcNetworkNotFound => serializer.serialize_i32(17),
2276                Self::UnknownValue(u) => u.0.serialize(serializer),
2277            }
2278        }
2279    }
2280
2281    impl<'de> serde::de::Deserialize<'de> for CommonReason {
2282        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2283        where
2284            D: serde::Deserializer<'de>,
2285        {
2286            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CommonReason>::new(
2287                ".google.cloud.run.v2.Condition.CommonReason",
2288            ))
2289        }
2290    }
2291
2292    /// Reasons specific to Revision resource.
2293    ///
2294    /// # Working with unknown values
2295    ///
2296    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2297    /// additional enum variants at any time. Adding new variants is not considered
2298    /// a breaking change. Applications should write their code in anticipation of:
2299    ///
2300    /// - New values appearing in future releases of the client library, **and**
2301    /// - New values received dynamically, without application changes.
2302    ///
2303    /// Please consult the [Working with enums] section in the user guide for some
2304    /// guidelines.
2305    ///
2306    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2307    #[derive(Clone, Debug, PartialEq)]
2308    #[non_exhaustive]
2309    pub enum RevisionReason {
2310        /// Default value.
2311        Undefined,
2312        /// Revision in Pending state.
2313        Pending,
2314        /// Revision is in Reserve state.
2315        Reserve,
2316        /// Revision is Retired.
2317        Retired,
2318        /// Revision is being retired.
2319        Retiring,
2320        /// Revision is being recreated.
2321        Recreating,
2322        /// There was a health check error.
2323        HealthCheckContainerError,
2324        /// Health check failed due to user error from customized path of the
2325        /// container. System will retry.
2326        CustomizedPathResponsePending,
2327        /// A revision with min_instance_count > 0 was created and is reserved, but
2328        /// it was not configured to serve traffic, so it's not live. This can also
2329        /// happen momentarily during traffic migration.
2330        MinInstancesNotProvisioned,
2331        /// The maximum allowed number of active revisions has been reached.
2332        ActiveRevisionLimitReached,
2333        /// There was no deployment defined.
2334        /// This value is no longer used, but Services created in older versions of
2335        /// the API might contain this value.
2336        NoDeployment,
2337        /// A revision's container has no port specified since the revision is of a
2338        /// manually scaled service with 0 instance count
2339        HealthCheckSkipped,
2340        /// A revision with min_instance_count > 0 was created and is waiting for
2341        /// enough instances to begin a traffic migration.
2342        MinInstancesWarming,
2343        /// If set, the enum was initialized with an unknown value.
2344        ///
2345        /// Applications can examine the value using [RevisionReason::value] or
2346        /// [RevisionReason::name].
2347        UnknownValue(revision_reason::UnknownValue),
2348    }
2349
2350    #[doc(hidden)]
2351    pub mod revision_reason {
2352        #[allow(unused_imports)]
2353        use super::*;
2354        #[derive(Clone, Debug, PartialEq)]
2355        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2356    }
2357
2358    impl RevisionReason {
2359        /// Gets the enum value.
2360        ///
2361        /// Returns `None` if the enum contains an unknown value deserialized from
2362        /// the string representation of enums.
2363        pub fn value(&self) -> std::option::Option<i32> {
2364            match self {
2365                Self::Undefined => std::option::Option::Some(0),
2366                Self::Pending => std::option::Option::Some(1),
2367                Self::Reserve => std::option::Option::Some(2),
2368                Self::Retired => std::option::Option::Some(3),
2369                Self::Retiring => std::option::Option::Some(4),
2370                Self::Recreating => std::option::Option::Some(5),
2371                Self::HealthCheckContainerError => std::option::Option::Some(6),
2372                Self::CustomizedPathResponsePending => std::option::Option::Some(7),
2373                Self::MinInstancesNotProvisioned => std::option::Option::Some(8),
2374                Self::ActiveRevisionLimitReached => std::option::Option::Some(9),
2375                Self::NoDeployment => std::option::Option::Some(10),
2376                Self::HealthCheckSkipped => std::option::Option::Some(11),
2377                Self::MinInstancesWarming => std::option::Option::Some(12),
2378                Self::UnknownValue(u) => u.0.value(),
2379            }
2380        }
2381
2382        /// Gets the enum value as a string.
2383        ///
2384        /// Returns `None` if the enum contains an unknown value deserialized from
2385        /// the integer representation of enums.
2386        pub fn name(&self) -> std::option::Option<&str> {
2387            match self {
2388                Self::Undefined => std::option::Option::Some("REVISION_REASON_UNDEFINED"),
2389                Self::Pending => std::option::Option::Some("PENDING"),
2390                Self::Reserve => std::option::Option::Some("RESERVE"),
2391                Self::Retired => std::option::Option::Some("RETIRED"),
2392                Self::Retiring => std::option::Option::Some("RETIRING"),
2393                Self::Recreating => std::option::Option::Some("RECREATING"),
2394                Self::HealthCheckContainerError => {
2395                    std::option::Option::Some("HEALTH_CHECK_CONTAINER_ERROR")
2396                }
2397                Self::CustomizedPathResponsePending => {
2398                    std::option::Option::Some("CUSTOMIZED_PATH_RESPONSE_PENDING")
2399                }
2400                Self::MinInstancesNotProvisioned => {
2401                    std::option::Option::Some("MIN_INSTANCES_NOT_PROVISIONED")
2402                }
2403                Self::ActiveRevisionLimitReached => {
2404                    std::option::Option::Some("ACTIVE_REVISION_LIMIT_REACHED")
2405                }
2406                Self::NoDeployment => std::option::Option::Some("NO_DEPLOYMENT"),
2407                Self::HealthCheckSkipped => std::option::Option::Some("HEALTH_CHECK_SKIPPED"),
2408                Self::MinInstancesWarming => std::option::Option::Some("MIN_INSTANCES_WARMING"),
2409                Self::UnknownValue(u) => u.0.name(),
2410            }
2411        }
2412    }
2413
2414    impl std::default::Default for RevisionReason {
2415        fn default() -> Self {
2416            use std::convert::From;
2417            Self::from(0)
2418        }
2419    }
2420
2421    impl std::fmt::Display for RevisionReason {
2422        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2423            wkt::internal::display_enum(f, self.name(), self.value())
2424        }
2425    }
2426
2427    impl std::convert::From<i32> for RevisionReason {
2428        fn from(value: i32) -> Self {
2429            match value {
2430                0 => Self::Undefined,
2431                1 => Self::Pending,
2432                2 => Self::Reserve,
2433                3 => Self::Retired,
2434                4 => Self::Retiring,
2435                5 => Self::Recreating,
2436                6 => Self::HealthCheckContainerError,
2437                7 => Self::CustomizedPathResponsePending,
2438                8 => Self::MinInstancesNotProvisioned,
2439                9 => Self::ActiveRevisionLimitReached,
2440                10 => Self::NoDeployment,
2441                11 => Self::HealthCheckSkipped,
2442                12 => Self::MinInstancesWarming,
2443                _ => Self::UnknownValue(revision_reason::UnknownValue(
2444                    wkt::internal::UnknownEnumValue::Integer(value),
2445                )),
2446            }
2447        }
2448    }
2449
2450    impl std::convert::From<&str> for RevisionReason {
2451        fn from(value: &str) -> Self {
2452            use std::string::ToString;
2453            match value {
2454                "REVISION_REASON_UNDEFINED" => Self::Undefined,
2455                "PENDING" => Self::Pending,
2456                "RESERVE" => Self::Reserve,
2457                "RETIRED" => Self::Retired,
2458                "RETIRING" => Self::Retiring,
2459                "RECREATING" => Self::Recreating,
2460                "HEALTH_CHECK_CONTAINER_ERROR" => Self::HealthCheckContainerError,
2461                "CUSTOMIZED_PATH_RESPONSE_PENDING" => Self::CustomizedPathResponsePending,
2462                "MIN_INSTANCES_NOT_PROVISIONED" => Self::MinInstancesNotProvisioned,
2463                "ACTIVE_REVISION_LIMIT_REACHED" => Self::ActiveRevisionLimitReached,
2464                "NO_DEPLOYMENT" => Self::NoDeployment,
2465                "HEALTH_CHECK_SKIPPED" => Self::HealthCheckSkipped,
2466                "MIN_INSTANCES_WARMING" => Self::MinInstancesWarming,
2467                _ => Self::UnknownValue(revision_reason::UnknownValue(
2468                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2469                )),
2470            }
2471        }
2472    }
2473
2474    impl serde::ser::Serialize for RevisionReason {
2475        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2476        where
2477            S: serde::Serializer,
2478        {
2479            match self {
2480                Self::Undefined => serializer.serialize_i32(0),
2481                Self::Pending => serializer.serialize_i32(1),
2482                Self::Reserve => serializer.serialize_i32(2),
2483                Self::Retired => serializer.serialize_i32(3),
2484                Self::Retiring => serializer.serialize_i32(4),
2485                Self::Recreating => serializer.serialize_i32(5),
2486                Self::HealthCheckContainerError => serializer.serialize_i32(6),
2487                Self::CustomizedPathResponsePending => serializer.serialize_i32(7),
2488                Self::MinInstancesNotProvisioned => serializer.serialize_i32(8),
2489                Self::ActiveRevisionLimitReached => serializer.serialize_i32(9),
2490                Self::NoDeployment => serializer.serialize_i32(10),
2491                Self::HealthCheckSkipped => serializer.serialize_i32(11),
2492                Self::MinInstancesWarming => serializer.serialize_i32(12),
2493                Self::UnknownValue(u) => u.0.serialize(serializer),
2494            }
2495        }
2496    }
2497
2498    impl<'de> serde::de::Deserialize<'de> for RevisionReason {
2499        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2500        where
2501            D: serde::Deserializer<'de>,
2502        {
2503            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RevisionReason>::new(
2504                ".google.cloud.run.v2.Condition.RevisionReason",
2505            ))
2506        }
2507    }
2508
2509    /// Reasons specific to Execution resource.
2510    ///
2511    /// # Working with unknown values
2512    ///
2513    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2514    /// additional enum variants at any time. Adding new variants is not considered
2515    /// a breaking change. Applications should write their code in anticipation of:
2516    ///
2517    /// - New values appearing in future releases of the client library, **and**
2518    /// - New values received dynamically, without application changes.
2519    ///
2520    /// Please consult the [Working with enums] section in the user guide for some
2521    /// guidelines.
2522    ///
2523    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2524    #[derive(Clone, Debug, PartialEq)]
2525    #[non_exhaustive]
2526    pub enum ExecutionReason {
2527        /// Default value.
2528        Undefined,
2529        /// Internal system error getting execution status. System will retry.
2530        JobStatusServicePollingError,
2531        /// A task reached its retry limit and the last attempt failed due to the
2532        /// user container exiting with a non-zero exit code.
2533        NonZeroExitCode,
2534        /// The execution was cancelled by users.
2535        Cancelled,
2536        /// The execution is in the process of being cancelled.
2537        Cancelling,
2538        /// The execution was deleted.
2539        Deleted,
2540        /// If set, the enum was initialized with an unknown value.
2541        ///
2542        /// Applications can examine the value using [ExecutionReason::value] or
2543        /// [ExecutionReason::name].
2544        UnknownValue(execution_reason::UnknownValue),
2545    }
2546
2547    #[doc(hidden)]
2548    pub mod execution_reason {
2549        #[allow(unused_imports)]
2550        use super::*;
2551        #[derive(Clone, Debug, PartialEq)]
2552        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2553    }
2554
2555    impl ExecutionReason {
2556        /// Gets the enum value.
2557        ///
2558        /// Returns `None` if the enum contains an unknown value deserialized from
2559        /// the string representation of enums.
2560        pub fn value(&self) -> std::option::Option<i32> {
2561            match self {
2562                Self::Undefined => std::option::Option::Some(0),
2563                Self::JobStatusServicePollingError => std::option::Option::Some(1),
2564                Self::NonZeroExitCode => std::option::Option::Some(2),
2565                Self::Cancelled => std::option::Option::Some(3),
2566                Self::Cancelling => std::option::Option::Some(4),
2567                Self::Deleted => std::option::Option::Some(5),
2568                Self::UnknownValue(u) => u.0.value(),
2569            }
2570        }
2571
2572        /// Gets the enum value as a string.
2573        ///
2574        /// Returns `None` if the enum contains an unknown value deserialized from
2575        /// the integer representation of enums.
2576        pub fn name(&self) -> std::option::Option<&str> {
2577            match self {
2578                Self::Undefined => std::option::Option::Some("EXECUTION_REASON_UNDEFINED"),
2579                Self::JobStatusServicePollingError => {
2580                    std::option::Option::Some("JOB_STATUS_SERVICE_POLLING_ERROR")
2581                }
2582                Self::NonZeroExitCode => std::option::Option::Some("NON_ZERO_EXIT_CODE"),
2583                Self::Cancelled => std::option::Option::Some("CANCELLED"),
2584                Self::Cancelling => std::option::Option::Some("CANCELLING"),
2585                Self::Deleted => std::option::Option::Some("DELETED"),
2586                Self::UnknownValue(u) => u.0.name(),
2587            }
2588        }
2589    }
2590
2591    impl std::default::Default for ExecutionReason {
2592        fn default() -> Self {
2593            use std::convert::From;
2594            Self::from(0)
2595        }
2596    }
2597
2598    impl std::fmt::Display for ExecutionReason {
2599        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2600            wkt::internal::display_enum(f, self.name(), self.value())
2601        }
2602    }
2603
2604    impl std::convert::From<i32> for ExecutionReason {
2605        fn from(value: i32) -> Self {
2606            match value {
2607                0 => Self::Undefined,
2608                1 => Self::JobStatusServicePollingError,
2609                2 => Self::NonZeroExitCode,
2610                3 => Self::Cancelled,
2611                4 => Self::Cancelling,
2612                5 => Self::Deleted,
2613                _ => Self::UnknownValue(execution_reason::UnknownValue(
2614                    wkt::internal::UnknownEnumValue::Integer(value),
2615                )),
2616            }
2617        }
2618    }
2619
2620    impl std::convert::From<&str> for ExecutionReason {
2621        fn from(value: &str) -> Self {
2622            use std::string::ToString;
2623            match value {
2624                "EXECUTION_REASON_UNDEFINED" => Self::Undefined,
2625                "JOB_STATUS_SERVICE_POLLING_ERROR" => Self::JobStatusServicePollingError,
2626                "NON_ZERO_EXIT_CODE" => Self::NonZeroExitCode,
2627                "CANCELLED" => Self::Cancelled,
2628                "CANCELLING" => Self::Cancelling,
2629                "DELETED" => Self::Deleted,
2630                _ => Self::UnknownValue(execution_reason::UnknownValue(
2631                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2632                )),
2633            }
2634        }
2635    }
2636
2637    impl serde::ser::Serialize for ExecutionReason {
2638        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2639        where
2640            S: serde::Serializer,
2641        {
2642            match self {
2643                Self::Undefined => serializer.serialize_i32(0),
2644                Self::JobStatusServicePollingError => serializer.serialize_i32(1),
2645                Self::NonZeroExitCode => serializer.serialize_i32(2),
2646                Self::Cancelled => serializer.serialize_i32(3),
2647                Self::Cancelling => serializer.serialize_i32(4),
2648                Self::Deleted => serializer.serialize_i32(5),
2649                Self::UnknownValue(u) => u.0.serialize(serializer),
2650            }
2651        }
2652    }
2653
2654    impl<'de> serde::de::Deserialize<'de> for ExecutionReason {
2655        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2656        where
2657            D: serde::Deserializer<'de>,
2658        {
2659            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionReason>::new(
2660                ".google.cloud.run.v2.Condition.ExecutionReason",
2661            ))
2662        }
2663    }
2664
2665    /// The reason for this condition. Depending on the condition type,
2666    /// it will populate one of these fields.
2667    /// Successful conditions cannot have a reason.
2668    #[derive(Clone, Debug, PartialEq)]
2669    #[non_exhaustive]
2670    pub enum Reasons {
2671        /// Output only. A common (service-level) reason for this condition.
2672        Reason(crate::model::condition::CommonReason),
2673        /// Output only. A reason for the revision condition.
2674        RevisionReason(crate::model::condition::RevisionReason),
2675        /// Output only. A reason for the execution condition.
2676        ExecutionReason(crate::model::condition::ExecutionReason),
2677    }
2678}
2679
2680/// Request message for obtaining a Execution by its full name.
2681#[derive(Clone, Debug, Default, PartialEq)]
2682#[non_exhaustive]
2683pub struct GetExecutionRequest {
2684    /// Required. The full name of the Execution.
2685    /// Format:
2686    /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
2687    /// where `{project}` can be project id or number.
2688    pub name: std::string::String,
2689
2690    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2691}
2692
2693impl GetExecutionRequest {
2694    pub fn new() -> Self {
2695        std::default::Default::default()
2696    }
2697
2698    /// Sets the value of [name][crate::model::GetExecutionRequest::name].
2699    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2700        self.name = v.into();
2701        self
2702    }
2703}
2704
2705impl wkt::message::Message for GetExecutionRequest {
2706    fn typename() -> &'static str {
2707        "type.googleapis.com/google.cloud.run.v2.GetExecutionRequest"
2708    }
2709}
2710
2711#[doc(hidden)]
2712impl<'de> serde::de::Deserialize<'de> for GetExecutionRequest {
2713    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2714    where
2715        D: serde::Deserializer<'de>,
2716    {
2717        #[allow(non_camel_case_types)]
2718        #[doc(hidden)]
2719        #[derive(PartialEq, Eq, Hash)]
2720        enum __FieldTag {
2721            __name,
2722            Unknown(std::string::String),
2723        }
2724        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2725            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2726            where
2727                D: serde::Deserializer<'de>,
2728            {
2729                struct Visitor;
2730                impl<'de> serde::de::Visitor<'de> for Visitor {
2731                    type Value = __FieldTag;
2732                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2733                        formatter.write_str("a field name for GetExecutionRequest")
2734                    }
2735                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2736                    where
2737                        E: serde::de::Error,
2738                    {
2739                        use std::result::Result::Ok;
2740                        use std::string::ToString;
2741                        match value {
2742                            "name" => Ok(__FieldTag::__name),
2743                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2744                        }
2745                    }
2746                }
2747                deserializer.deserialize_identifier(Visitor)
2748            }
2749        }
2750        struct Visitor;
2751        impl<'de> serde::de::Visitor<'de> for Visitor {
2752            type Value = GetExecutionRequest;
2753            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2754                formatter.write_str("struct GetExecutionRequest")
2755            }
2756            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2757            where
2758                A: serde::de::MapAccess<'de>,
2759            {
2760                #[allow(unused_imports)]
2761                use serde::de::Error;
2762                use std::option::Option::Some;
2763                let mut fields = std::collections::HashSet::new();
2764                let mut result = Self::Value::new();
2765                while let Some(tag) = map.next_key::<__FieldTag>()? {
2766                    #[allow(clippy::match_single_binding)]
2767                    match tag {
2768                        __FieldTag::__name => {
2769                            if !fields.insert(__FieldTag::__name) {
2770                                return std::result::Result::Err(A::Error::duplicate_field(
2771                                    "multiple values for name",
2772                                ));
2773                            }
2774                            result.name = map
2775                                .next_value::<std::option::Option<std::string::String>>()?
2776                                .unwrap_or_default();
2777                        }
2778                        __FieldTag::Unknown(key) => {
2779                            let value = map.next_value::<serde_json::Value>()?;
2780                            result._unknown_fields.insert(key, value);
2781                        }
2782                    }
2783                }
2784                std::result::Result::Ok(result)
2785            }
2786        }
2787        deserializer.deserialize_any(Visitor)
2788    }
2789}
2790
2791#[doc(hidden)]
2792impl serde::ser::Serialize for GetExecutionRequest {
2793    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2794    where
2795        S: serde::ser::Serializer,
2796    {
2797        use serde::ser::SerializeMap;
2798        #[allow(unused_imports)]
2799        use std::option::Option::Some;
2800        let mut state = serializer.serialize_map(std::option::Option::None)?;
2801        if !self.name.is_empty() {
2802            state.serialize_entry("name", &self.name)?;
2803        }
2804        if !self._unknown_fields.is_empty() {
2805            for (key, value) in self._unknown_fields.iter() {
2806                state.serialize_entry(key, &value)?;
2807            }
2808        }
2809        state.end()
2810    }
2811}
2812
2813/// Request message for retrieving a list of Executions.
2814#[derive(Clone, Debug, Default, PartialEq)]
2815#[non_exhaustive]
2816pub struct ListExecutionsRequest {
2817    /// Required. The Execution from which the Executions should be listed.
2818    /// To list all Executions across Jobs, use "-" instead of Job name.
2819    /// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
2820    /// `{project}` can be project id or number.
2821    pub parent: std::string::String,
2822
2823    /// Maximum number of Executions to return in this call.
2824    pub page_size: i32,
2825
2826    /// A page token received from a previous call to ListExecutions.
2827    /// All other parameters must match.
2828    pub page_token: std::string::String,
2829
2830    /// If true, returns deleted (but unexpired) resources along with active ones.
2831    pub show_deleted: bool,
2832
2833    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2834}
2835
2836impl ListExecutionsRequest {
2837    pub fn new() -> Self {
2838        std::default::Default::default()
2839    }
2840
2841    /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
2842    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2843        self.parent = v.into();
2844        self
2845    }
2846
2847    /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
2848    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2849        self.page_size = v.into();
2850        self
2851    }
2852
2853    /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
2854    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2855        self.page_token = v.into();
2856        self
2857    }
2858
2859    /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
2860    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2861        self.show_deleted = v.into();
2862        self
2863    }
2864}
2865
2866impl wkt::message::Message for ListExecutionsRequest {
2867    fn typename() -> &'static str {
2868        "type.googleapis.com/google.cloud.run.v2.ListExecutionsRequest"
2869    }
2870}
2871
2872#[doc(hidden)]
2873impl<'de> serde::de::Deserialize<'de> for ListExecutionsRequest {
2874    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2875    where
2876        D: serde::Deserializer<'de>,
2877    {
2878        #[allow(non_camel_case_types)]
2879        #[doc(hidden)]
2880        #[derive(PartialEq, Eq, Hash)]
2881        enum __FieldTag {
2882            __parent,
2883            __page_size,
2884            __page_token,
2885            __show_deleted,
2886            Unknown(std::string::String),
2887        }
2888        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2889            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2890            where
2891                D: serde::Deserializer<'de>,
2892            {
2893                struct Visitor;
2894                impl<'de> serde::de::Visitor<'de> for Visitor {
2895                    type Value = __FieldTag;
2896                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2897                        formatter.write_str("a field name for ListExecutionsRequest")
2898                    }
2899                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2900                    where
2901                        E: serde::de::Error,
2902                    {
2903                        use std::result::Result::Ok;
2904                        use std::string::ToString;
2905                        match value {
2906                            "parent" => Ok(__FieldTag::__parent),
2907                            "pageSize" => Ok(__FieldTag::__page_size),
2908                            "page_size" => Ok(__FieldTag::__page_size),
2909                            "pageToken" => Ok(__FieldTag::__page_token),
2910                            "page_token" => Ok(__FieldTag::__page_token),
2911                            "showDeleted" => Ok(__FieldTag::__show_deleted),
2912                            "show_deleted" => Ok(__FieldTag::__show_deleted),
2913                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2914                        }
2915                    }
2916                }
2917                deserializer.deserialize_identifier(Visitor)
2918            }
2919        }
2920        struct Visitor;
2921        impl<'de> serde::de::Visitor<'de> for Visitor {
2922            type Value = ListExecutionsRequest;
2923            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2924                formatter.write_str("struct ListExecutionsRequest")
2925            }
2926            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2927            where
2928                A: serde::de::MapAccess<'de>,
2929            {
2930                #[allow(unused_imports)]
2931                use serde::de::Error;
2932                use std::option::Option::Some;
2933                let mut fields = std::collections::HashSet::new();
2934                let mut result = Self::Value::new();
2935                while let Some(tag) = map.next_key::<__FieldTag>()? {
2936                    #[allow(clippy::match_single_binding)]
2937                    match tag {
2938                        __FieldTag::__parent => {
2939                            if !fields.insert(__FieldTag::__parent) {
2940                                return std::result::Result::Err(A::Error::duplicate_field(
2941                                    "multiple values for parent",
2942                                ));
2943                            }
2944                            result.parent = map
2945                                .next_value::<std::option::Option<std::string::String>>()?
2946                                .unwrap_or_default();
2947                        }
2948                        __FieldTag::__page_size => {
2949                            if !fields.insert(__FieldTag::__page_size) {
2950                                return std::result::Result::Err(A::Error::duplicate_field(
2951                                    "multiple values for page_size",
2952                                ));
2953                            }
2954                            struct __With(std::option::Option<i32>);
2955                            impl<'de> serde::de::Deserialize<'de> for __With {
2956                                fn deserialize<D>(
2957                                    deserializer: D,
2958                                ) -> std::result::Result<Self, D::Error>
2959                                where
2960                                    D: serde::de::Deserializer<'de>,
2961                                {
2962                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2963                                }
2964                            }
2965                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2966                        }
2967                        __FieldTag::__page_token => {
2968                            if !fields.insert(__FieldTag::__page_token) {
2969                                return std::result::Result::Err(A::Error::duplicate_field(
2970                                    "multiple values for page_token",
2971                                ));
2972                            }
2973                            result.page_token = map
2974                                .next_value::<std::option::Option<std::string::String>>()?
2975                                .unwrap_or_default();
2976                        }
2977                        __FieldTag::__show_deleted => {
2978                            if !fields.insert(__FieldTag::__show_deleted) {
2979                                return std::result::Result::Err(A::Error::duplicate_field(
2980                                    "multiple values for show_deleted",
2981                                ));
2982                            }
2983                            result.show_deleted = map
2984                                .next_value::<std::option::Option<bool>>()?
2985                                .unwrap_or_default();
2986                        }
2987                        __FieldTag::Unknown(key) => {
2988                            let value = map.next_value::<serde_json::Value>()?;
2989                            result._unknown_fields.insert(key, value);
2990                        }
2991                    }
2992                }
2993                std::result::Result::Ok(result)
2994            }
2995        }
2996        deserializer.deserialize_any(Visitor)
2997    }
2998}
2999
3000#[doc(hidden)]
3001impl serde::ser::Serialize for ListExecutionsRequest {
3002    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3003    where
3004        S: serde::ser::Serializer,
3005    {
3006        use serde::ser::SerializeMap;
3007        #[allow(unused_imports)]
3008        use std::option::Option::Some;
3009        let mut state = serializer.serialize_map(std::option::Option::None)?;
3010        if !self.parent.is_empty() {
3011            state.serialize_entry("parent", &self.parent)?;
3012        }
3013        if !wkt::internal::is_default(&self.page_size) {
3014            struct __With<'a>(&'a i32);
3015            impl<'a> serde::ser::Serialize for __With<'a> {
3016                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3017                where
3018                    S: serde::ser::Serializer,
3019                {
3020                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3021                }
3022            }
3023            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3024        }
3025        if !self.page_token.is_empty() {
3026            state.serialize_entry("pageToken", &self.page_token)?;
3027        }
3028        if !wkt::internal::is_default(&self.show_deleted) {
3029            state.serialize_entry("showDeleted", &self.show_deleted)?;
3030        }
3031        if !self._unknown_fields.is_empty() {
3032            for (key, value) in self._unknown_fields.iter() {
3033                state.serialize_entry(key, &value)?;
3034            }
3035        }
3036        state.end()
3037    }
3038}
3039
3040/// Response message containing a list of Executions.
3041#[derive(Clone, Debug, Default, PartialEq)]
3042#[non_exhaustive]
3043pub struct ListExecutionsResponse {
3044    /// The resulting list of Executions.
3045    pub executions: std::vec::Vec<crate::model::Execution>,
3046
3047    /// A token indicating there are more items than page_size. Use it in the next
3048    /// ListExecutions request to continue.
3049    pub next_page_token: std::string::String,
3050
3051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3052}
3053
3054impl ListExecutionsResponse {
3055    pub fn new() -> Self {
3056        std::default::Default::default()
3057    }
3058
3059    /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
3060    pub fn set_executions<T, V>(mut self, v: T) -> Self
3061    where
3062        T: std::iter::IntoIterator<Item = V>,
3063        V: std::convert::Into<crate::model::Execution>,
3064    {
3065        use std::iter::Iterator;
3066        self.executions = v.into_iter().map(|i| i.into()).collect();
3067        self
3068    }
3069
3070    /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
3071    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3072        self.next_page_token = v.into();
3073        self
3074    }
3075}
3076
3077impl wkt::message::Message for ListExecutionsResponse {
3078    fn typename() -> &'static str {
3079        "type.googleapis.com/google.cloud.run.v2.ListExecutionsResponse"
3080    }
3081}
3082
3083#[doc(hidden)]
3084impl gax::paginator::internal::PageableResponse for ListExecutionsResponse {
3085    type PageItem = crate::model::Execution;
3086
3087    fn items(self) -> std::vec::Vec<Self::PageItem> {
3088        self.executions
3089    }
3090
3091    fn next_page_token(&self) -> std::string::String {
3092        use std::clone::Clone;
3093        self.next_page_token.clone()
3094    }
3095}
3096
3097#[doc(hidden)]
3098impl<'de> serde::de::Deserialize<'de> for ListExecutionsResponse {
3099    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3100    where
3101        D: serde::Deserializer<'de>,
3102    {
3103        #[allow(non_camel_case_types)]
3104        #[doc(hidden)]
3105        #[derive(PartialEq, Eq, Hash)]
3106        enum __FieldTag {
3107            __executions,
3108            __next_page_token,
3109            Unknown(std::string::String),
3110        }
3111        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3112            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3113            where
3114                D: serde::Deserializer<'de>,
3115            {
3116                struct Visitor;
3117                impl<'de> serde::de::Visitor<'de> for Visitor {
3118                    type Value = __FieldTag;
3119                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3120                        formatter.write_str("a field name for ListExecutionsResponse")
3121                    }
3122                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3123                    where
3124                        E: serde::de::Error,
3125                    {
3126                        use std::result::Result::Ok;
3127                        use std::string::ToString;
3128                        match value {
3129                            "executions" => Ok(__FieldTag::__executions),
3130                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3131                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3132                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3133                        }
3134                    }
3135                }
3136                deserializer.deserialize_identifier(Visitor)
3137            }
3138        }
3139        struct Visitor;
3140        impl<'de> serde::de::Visitor<'de> for Visitor {
3141            type Value = ListExecutionsResponse;
3142            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3143                formatter.write_str("struct ListExecutionsResponse")
3144            }
3145            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3146            where
3147                A: serde::de::MapAccess<'de>,
3148            {
3149                #[allow(unused_imports)]
3150                use serde::de::Error;
3151                use std::option::Option::Some;
3152                let mut fields = std::collections::HashSet::new();
3153                let mut result = Self::Value::new();
3154                while let Some(tag) = map.next_key::<__FieldTag>()? {
3155                    #[allow(clippy::match_single_binding)]
3156                    match tag {
3157                        __FieldTag::__executions => {
3158                            if !fields.insert(__FieldTag::__executions) {
3159                                return std::result::Result::Err(A::Error::duplicate_field(
3160                                    "multiple values for executions",
3161                                ));
3162                            }
3163                            result.executions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Execution>>>()?.unwrap_or_default();
3164                        }
3165                        __FieldTag::__next_page_token => {
3166                            if !fields.insert(__FieldTag::__next_page_token) {
3167                                return std::result::Result::Err(A::Error::duplicate_field(
3168                                    "multiple values for next_page_token",
3169                                ));
3170                            }
3171                            result.next_page_token = map
3172                                .next_value::<std::option::Option<std::string::String>>()?
3173                                .unwrap_or_default();
3174                        }
3175                        __FieldTag::Unknown(key) => {
3176                            let value = map.next_value::<serde_json::Value>()?;
3177                            result._unknown_fields.insert(key, value);
3178                        }
3179                    }
3180                }
3181                std::result::Result::Ok(result)
3182            }
3183        }
3184        deserializer.deserialize_any(Visitor)
3185    }
3186}
3187
3188#[doc(hidden)]
3189impl serde::ser::Serialize for ListExecutionsResponse {
3190    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3191    where
3192        S: serde::ser::Serializer,
3193    {
3194        use serde::ser::SerializeMap;
3195        #[allow(unused_imports)]
3196        use std::option::Option::Some;
3197        let mut state = serializer.serialize_map(std::option::Option::None)?;
3198        if !self.executions.is_empty() {
3199            state.serialize_entry("executions", &self.executions)?;
3200        }
3201        if !self.next_page_token.is_empty() {
3202            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3203        }
3204        if !self._unknown_fields.is_empty() {
3205            for (key, value) in self._unknown_fields.iter() {
3206                state.serialize_entry(key, &value)?;
3207            }
3208        }
3209        state.end()
3210    }
3211}
3212
3213/// Request message for deleting an Execution.
3214#[derive(Clone, Debug, Default, PartialEq)]
3215#[non_exhaustive]
3216pub struct DeleteExecutionRequest {
3217    /// Required. The name of the Execution to delete.
3218    /// Format:
3219    /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
3220    /// where `{project}` can be project id or number.
3221    pub name: std::string::String,
3222
3223    /// Indicates that the request should be validated without actually
3224    /// deleting any resources.
3225    pub validate_only: bool,
3226
3227    /// A system-generated fingerprint for this version of the resource.
3228    /// This may be used to detect modification conflict during updates.
3229    pub etag: std::string::String,
3230
3231    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3232}
3233
3234impl DeleteExecutionRequest {
3235    pub fn new() -> Self {
3236        std::default::Default::default()
3237    }
3238
3239    /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
3240    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3241        self.name = v.into();
3242        self
3243    }
3244
3245    /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
3246    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3247        self.validate_only = v.into();
3248        self
3249    }
3250
3251    /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
3252    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3253        self.etag = v.into();
3254        self
3255    }
3256}
3257
3258impl wkt::message::Message for DeleteExecutionRequest {
3259    fn typename() -> &'static str {
3260        "type.googleapis.com/google.cloud.run.v2.DeleteExecutionRequest"
3261    }
3262}
3263
3264#[doc(hidden)]
3265impl<'de> serde::de::Deserialize<'de> for DeleteExecutionRequest {
3266    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3267    where
3268        D: serde::Deserializer<'de>,
3269    {
3270        #[allow(non_camel_case_types)]
3271        #[doc(hidden)]
3272        #[derive(PartialEq, Eq, Hash)]
3273        enum __FieldTag {
3274            __name,
3275            __validate_only,
3276            __etag,
3277            Unknown(std::string::String),
3278        }
3279        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3280            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3281            where
3282                D: serde::Deserializer<'de>,
3283            {
3284                struct Visitor;
3285                impl<'de> serde::de::Visitor<'de> for Visitor {
3286                    type Value = __FieldTag;
3287                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3288                        formatter.write_str("a field name for DeleteExecutionRequest")
3289                    }
3290                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3291                    where
3292                        E: serde::de::Error,
3293                    {
3294                        use std::result::Result::Ok;
3295                        use std::string::ToString;
3296                        match value {
3297                            "name" => Ok(__FieldTag::__name),
3298                            "validateOnly" => Ok(__FieldTag::__validate_only),
3299                            "validate_only" => Ok(__FieldTag::__validate_only),
3300                            "etag" => Ok(__FieldTag::__etag),
3301                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3302                        }
3303                    }
3304                }
3305                deserializer.deserialize_identifier(Visitor)
3306            }
3307        }
3308        struct Visitor;
3309        impl<'de> serde::de::Visitor<'de> for Visitor {
3310            type Value = DeleteExecutionRequest;
3311            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3312                formatter.write_str("struct DeleteExecutionRequest")
3313            }
3314            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3315            where
3316                A: serde::de::MapAccess<'de>,
3317            {
3318                #[allow(unused_imports)]
3319                use serde::de::Error;
3320                use std::option::Option::Some;
3321                let mut fields = std::collections::HashSet::new();
3322                let mut result = Self::Value::new();
3323                while let Some(tag) = map.next_key::<__FieldTag>()? {
3324                    #[allow(clippy::match_single_binding)]
3325                    match tag {
3326                        __FieldTag::__name => {
3327                            if !fields.insert(__FieldTag::__name) {
3328                                return std::result::Result::Err(A::Error::duplicate_field(
3329                                    "multiple values for name",
3330                                ));
3331                            }
3332                            result.name = map
3333                                .next_value::<std::option::Option<std::string::String>>()?
3334                                .unwrap_or_default();
3335                        }
3336                        __FieldTag::__validate_only => {
3337                            if !fields.insert(__FieldTag::__validate_only) {
3338                                return std::result::Result::Err(A::Error::duplicate_field(
3339                                    "multiple values for validate_only",
3340                                ));
3341                            }
3342                            result.validate_only = map
3343                                .next_value::<std::option::Option<bool>>()?
3344                                .unwrap_or_default();
3345                        }
3346                        __FieldTag::__etag => {
3347                            if !fields.insert(__FieldTag::__etag) {
3348                                return std::result::Result::Err(A::Error::duplicate_field(
3349                                    "multiple values for etag",
3350                                ));
3351                            }
3352                            result.etag = map
3353                                .next_value::<std::option::Option<std::string::String>>()?
3354                                .unwrap_or_default();
3355                        }
3356                        __FieldTag::Unknown(key) => {
3357                            let value = map.next_value::<serde_json::Value>()?;
3358                            result._unknown_fields.insert(key, value);
3359                        }
3360                    }
3361                }
3362                std::result::Result::Ok(result)
3363            }
3364        }
3365        deserializer.deserialize_any(Visitor)
3366    }
3367}
3368
3369#[doc(hidden)]
3370impl serde::ser::Serialize for DeleteExecutionRequest {
3371    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3372    where
3373        S: serde::ser::Serializer,
3374    {
3375        use serde::ser::SerializeMap;
3376        #[allow(unused_imports)]
3377        use std::option::Option::Some;
3378        let mut state = serializer.serialize_map(std::option::Option::None)?;
3379        if !self.name.is_empty() {
3380            state.serialize_entry("name", &self.name)?;
3381        }
3382        if !wkt::internal::is_default(&self.validate_only) {
3383            state.serialize_entry("validateOnly", &self.validate_only)?;
3384        }
3385        if !self.etag.is_empty() {
3386            state.serialize_entry("etag", &self.etag)?;
3387        }
3388        if !self._unknown_fields.is_empty() {
3389            for (key, value) in self._unknown_fields.iter() {
3390                state.serialize_entry(key, &value)?;
3391            }
3392        }
3393        state.end()
3394    }
3395}
3396
3397/// Request message for deleting an Execution.
3398#[derive(Clone, Debug, Default, PartialEq)]
3399#[non_exhaustive]
3400pub struct CancelExecutionRequest {
3401    /// Required. The name of the Execution to cancel.
3402    /// Format:
3403    /// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
3404    /// where `{project}` can be project id or number.
3405    pub name: std::string::String,
3406
3407    /// Indicates that the request should be validated without actually
3408    /// cancelling any resources.
3409    pub validate_only: bool,
3410
3411    /// A system-generated fingerprint for this version of the resource.
3412    /// This may be used to detect modification conflict during updates.
3413    pub etag: std::string::String,
3414
3415    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3416}
3417
3418impl CancelExecutionRequest {
3419    pub fn new() -> Self {
3420        std::default::Default::default()
3421    }
3422
3423    /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
3424    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3425        self.name = v.into();
3426        self
3427    }
3428
3429    /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
3430    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3431        self.validate_only = v.into();
3432        self
3433    }
3434
3435    /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
3436    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3437        self.etag = v.into();
3438        self
3439    }
3440}
3441
3442impl wkt::message::Message for CancelExecutionRequest {
3443    fn typename() -> &'static str {
3444        "type.googleapis.com/google.cloud.run.v2.CancelExecutionRequest"
3445    }
3446}
3447
3448#[doc(hidden)]
3449impl<'de> serde::de::Deserialize<'de> for CancelExecutionRequest {
3450    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3451    where
3452        D: serde::Deserializer<'de>,
3453    {
3454        #[allow(non_camel_case_types)]
3455        #[doc(hidden)]
3456        #[derive(PartialEq, Eq, Hash)]
3457        enum __FieldTag {
3458            __name,
3459            __validate_only,
3460            __etag,
3461            Unknown(std::string::String),
3462        }
3463        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3464            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3465            where
3466                D: serde::Deserializer<'de>,
3467            {
3468                struct Visitor;
3469                impl<'de> serde::de::Visitor<'de> for Visitor {
3470                    type Value = __FieldTag;
3471                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3472                        formatter.write_str("a field name for CancelExecutionRequest")
3473                    }
3474                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3475                    where
3476                        E: serde::de::Error,
3477                    {
3478                        use std::result::Result::Ok;
3479                        use std::string::ToString;
3480                        match value {
3481                            "name" => Ok(__FieldTag::__name),
3482                            "validateOnly" => Ok(__FieldTag::__validate_only),
3483                            "validate_only" => Ok(__FieldTag::__validate_only),
3484                            "etag" => Ok(__FieldTag::__etag),
3485                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3486                        }
3487                    }
3488                }
3489                deserializer.deserialize_identifier(Visitor)
3490            }
3491        }
3492        struct Visitor;
3493        impl<'de> serde::de::Visitor<'de> for Visitor {
3494            type Value = CancelExecutionRequest;
3495            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3496                formatter.write_str("struct CancelExecutionRequest")
3497            }
3498            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3499            where
3500                A: serde::de::MapAccess<'de>,
3501            {
3502                #[allow(unused_imports)]
3503                use serde::de::Error;
3504                use std::option::Option::Some;
3505                let mut fields = std::collections::HashSet::new();
3506                let mut result = Self::Value::new();
3507                while let Some(tag) = map.next_key::<__FieldTag>()? {
3508                    #[allow(clippy::match_single_binding)]
3509                    match tag {
3510                        __FieldTag::__name => {
3511                            if !fields.insert(__FieldTag::__name) {
3512                                return std::result::Result::Err(A::Error::duplicate_field(
3513                                    "multiple values for name",
3514                                ));
3515                            }
3516                            result.name = map
3517                                .next_value::<std::option::Option<std::string::String>>()?
3518                                .unwrap_or_default();
3519                        }
3520                        __FieldTag::__validate_only => {
3521                            if !fields.insert(__FieldTag::__validate_only) {
3522                                return std::result::Result::Err(A::Error::duplicate_field(
3523                                    "multiple values for validate_only",
3524                                ));
3525                            }
3526                            result.validate_only = map
3527                                .next_value::<std::option::Option<bool>>()?
3528                                .unwrap_or_default();
3529                        }
3530                        __FieldTag::__etag => {
3531                            if !fields.insert(__FieldTag::__etag) {
3532                                return std::result::Result::Err(A::Error::duplicate_field(
3533                                    "multiple values for etag",
3534                                ));
3535                            }
3536                            result.etag = map
3537                                .next_value::<std::option::Option<std::string::String>>()?
3538                                .unwrap_or_default();
3539                        }
3540                        __FieldTag::Unknown(key) => {
3541                            let value = map.next_value::<serde_json::Value>()?;
3542                            result._unknown_fields.insert(key, value);
3543                        }
3544                    }
3545                }
3546                std::result::Result::Ok(result)
3547            }
3548        }
3549        deserializer.deserialize_any(Visitor)
3550    }
3551}
3552
3553#[doc(hidden)]
3554impl serde::ser::Serialize for CancelExecutionRequest {
3555    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3556    where
3557        S: serde::ser::Serializer,
3558    {
3559        use serde::ser::SerializeMap;
3560        #[allow(unused_imports)]
3561        use std::option::Option::Some;
3562        let mut state = serializer.serialize_map(std::option::Option::None)?;
3563        if !self.name.is_empty() {
3564            state.serialize_entry("name", &self.name)?;
3565        }
3566        if !wkt::internal::is_default(&self.validate_only) {
3567            state.serialize_entry("validateOnly", &self.validate_only)?;
3568        }
3569        if !self.etag.is_empty() {
3570            state.serialize_entry("etag", &self.etag)?;
3571        }
3572        if !self._unknown_fields.is_empty() {
3573            for (key, value) in self._unknown_fields.iter() {
3574                state.serialize_entry(key, &value)?;
3575            }
3576        }
3577        state.end()
3578    }
3579}
3580
3581/// Execution represents the configuration of a single execution. A execution an
3582/// immutable resource that references a container image which is run to
3583/// completion.
3584#[derive(Clone, Debug, Default, PartialEq)]
3585#[non_exhaustive]
3586pub struct Execution {
3587    /// Output only. The unique name of this Execution.
3588    pub name: std::string::String,
3589
3590    /// Output only. Server assigned unique identifier for the Execution. The value
3591    /// is a UUID4 string and guaranteed to remain unchanged until the resource is
3592    /// deleted.
3593    pub uid: std::string::String,
3594
3595    /// Output only. Email address of the authenticated creator.
3596    pub creator: std::string::String,
3597
3598    /// Output only. A number that monotonically increases every time the user
3599    /// modifies the desired state.
3600    pub generation: i64,
3601
3602    /// Output only. Unstructured key value map that can be used to organize and
3603    /// categorize objects. User-provided labels are shared with Google's billing
3604    /// system, so they can be used to filter, or break down billing charges by
3605    /// team, component, environment, state, etc. For more information, visit
3606    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
3607    /// <https://cloud.google.com/run/docs/configuring/labels>
3608    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3609
3610    /// Output only. Unstructured key value map that may
3611    /// be set by external tools to store and arbitrary metadata.
3612    /// They are not queryable and should be preserved
3613    /// when modifying objects.
3614    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3615
3616    /// Output only. Represents time when the execution was acknowledged by the
3617    /// execution controller. It is not guaranteed to be set in happens-before
3618    /// order across separate operations.
3619    pub create_time: std::option::Option<wkt::Timestamp>,
3620
3621    /// Output only. Represents time when the execution started to run.
3622    /// It is not guaranteed to be set in happens-before order across separate
3623    /// operations.
3624    pub start_time: std::option::Option<wkt::Timestamp>,
3625
3626    /// Output only. Represents time when the execution was completed. It is not
3627    /// guaranteed to be set in happens-before order across separate operations.
3628    pub completion_time: std::option::Option<wkt::Timestamp>,
3629
3630    /// Output only. The last-modified time.
3631    pub update_time: std::option::Option<wkt::Timestamp>,
3632
3633    /// Output only. For a deleted resource, the deletion time. It is only
3634    /// populated as a response to a Delete request.
3635    pub delete_time: std::option::Option<wkt::Timestamp>,
3636
3637    /// Output only. For a deleted resource, the time after which it will be
3638    /// permamently deleted. It is only populated as a response to a Delete
3639    /// request.
3640    pub expire_time: std::option::Option<wkt::Timestamp>,
3641
3642    /// The least stable launch stage needed to create this resource, as defined by
3643    /// [Google Cloud Platform Launch
3644    /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
3645    /// `ALPHA`, `BETA`, and `GA`.
3646    ///
3647    /// Note that this value might not be what was used
3648    /// as input. For example, if ALPHA was provided as input in the parent
3649    /// resource, but only BETA and GA-level features are were, this field will be
3650    /// BETA.
3651    pub launch_stage: api::model::LaunchStage,
3652
3653    /// Output only. The name of the parent Job.
3654    pub job: std::string::String,
3655
3656    /// Output only. Specifies the maximum desired number of tasks the execution
3657    /// should run at any given time. Must be <= task_count. The actual number of
3658    /// tasks running in steady state will be less than this number when
3659    /// ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
3660    /// the work left to do is less than max parallelism.
3661    pub parallelism: i32,
3662
3663    /// Output only. Specifies the desired number of tasks the execution should
3664    /// run. Setting to 1 means that parallelism is limited to 1 and the success of
3665    /// that task signals the success of the execution.
3666    pub task_count: i32,
3667
3668    /// Output only. The template used to create tasks for this execution.
3669    pub template: std::option::Option<crate::model::TaskTemplate>,
3670
3671    /// Output only. Indicates whether the resource's reconciliation is still in
3672    /// progress. See comments in `Job.reconciling` for additional information on
3673    /// reconciliation process in Cloud Run.
3674    pub reconciling: bool,
3675
3676    /// Output only. The Condition of this Execution, containing its readiness
3677    /// status, and detailed error information in case it did not reach the desired
3678    /// state.
3679    pub conditions: std::vec::Vec<crate::model::Condition>,
3680
3681    /// Output only. The generation of this Execution. See comments in
3682    /// `reconciling` for additional information on reconciliation process in Cloud
3683    /// Run.
3684    pub observed_generation: i64,
3685
3686    /// Output only. The number of actively running tasks.
3687    pub running_count: i32,
3688
3689    /// Output only. The number of tasks which reached phase Succeeded.
3690    pub succeeded_count: i32,
3691
3692    /// Output only. The number of tasks which reached phase Failed.
3693    pub failed_count: i32,
3694
3695    /// Output only. The number of tasks which reached phase Cancelled.
3696    pub cancelled_count: i32,
3697
3698    /// Output only. The number of tasks which have retried at least once.
3699    pub retried_count: i32,
3700
3701    /// Output only. URI where logs for this execution can be found in Cloud
3702    /// Console.
3703    pub log_uri: std::string::String,
3704
3705    /// Output only. Reserved for future use.
3706    pub satisfies_pzs: bool,
3707
3708    /// Output only. A system-generated fingerprint for this version of the
3709    /// resource. May be used to detect modification conflict during updates.
3710    pub etag: std::string::String,
3711
3712    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3713}
3714
3715impl Execution {
3716    pub fn new() -> Self {
3717        std::default::Default::default()
3718    }
3719
3720    /// Sets the value of [name][crate::model::Execution::name].
3721    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3722        self.name = v.into();
3723        self
3724    }
3725
3726    /// Sets the value of [uid][crate::model::Execution::uid].
3727    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3728        self.uid = v.into();
3729        self
3730    }
3731
3732    /// Sets the value of [creator][crate::model::Execution::creator].
3733    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3734        self.creator = v.into();
3735        self
3736    }
3737
3738    /// Sets the value of [generation][crate::model::Execution::generation].
3739    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3740        self.generation = v.into();
3741        self
3742    }
3743
3744    /// Sets the value of [labels][crate::model::Execution::labels].
3745    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3746    where
3747        T: std::iter::IntoIterator<Item = (K, V)>,
3748        K: std::convert::Into<std::string::String>,
3749        V: std::convert::Into<std::string::String>,
3750    {
3751        use std::iter::Iterator;
3752        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3753        self
3754    }
3755
3756    /// Sets the value of [annotations][crate::model::Execution::annotations].
3757    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3758    where
3759        T: std::iter::IntoIterator<Item = (K, V)>,
3760        K: std::convert::Into<std::string::String>,
3761        V: std::convert::Into<std::string::String>,
3762    {
3763        use std::iter::Iterator;
3764        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3765        self
3766    }
3767
3768    /// Sets the value of [create_time][crate::model::Execution::create_time].
3769    pub fn set_create_time<T>(mut self, v: T) -> Self
3770    where
3771        T: std::convert::Into<wkt::Timestamp>,
3772    {
3773        self.create_time = std::option::Option::Some(v.into());
3774        self
3775    }
3776
3777    /// Sets or clears the value of [create_time][crate::model::Execution::create_time].
3778    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3779    where
3780        T: std::convert::Into<wkt::Timestamp>,
3781    {
3782        self.create_time = v.map(|x| x.into());
3783        self
3784    }
3785
3786    /// Sets the value of [start_time][crate::model::Execution::start_time].
3787    pub fn set_start_time<T>(mut self, v: T) -> Self
3788    where
3789        T: std::convert::Into<wkt::Timestamp>,
3790    {
3791        self.start_time = std::option::Option::Some(v.into());
3792        self
3793    }
3794
3795    /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
3796    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3797    where
3798        T: std::convert::Into<wkt::Timestamp>,
3799    {
3800        self.start_time = v.map(|x| x.into());
3801        self
3802    }
3803
3804    /// Sets the value of [completion_time][crate::model::Execution::completion_time].
3805    pub fn set_completion_time<T>(mut self, v: T) -> Self
3806    where
3807        T: std::convert::Into<wkt::Timestamp>,
3808    {
3809        self.completion_time = std::option::Option::Some(v.into());
3810        self
3811    }
3812
3813    /// Sets or clears the value of [completion_time][crate::model::Execution::completion_time].
3814    pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
3815    where
3816        T: std::convert::Into<wkt::Timestamp>,
3817    {
3818        self.completion_time = v.map(|x| x.into());
3819        self
3820    }
3821
3822    /// Sets the value of [update_time][crate::model::Execution::update_time].
3823    pub fn set_update_time<T>(mut self, v: T) -> Self
3824    where
3825        T: std::convert::Into<wkt::Timestamp>,
3826    {
3827        self.update_time = std::option::Option::Some(v.into());
3828        self
3829    }
3830
3831    /// Sets or clears the value of [update_time][crate::model::Execution::update_time].
3832    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3833    where
3834        T: std::convert::Into<wkt::Timestamp>,
3835    {
3836        self.update_time = v.map(|x| x.into());
3837        self
3838    }
3839
3840    /// Sets the value of [delete_time][crate::model::Execution::delete_time].
3841    pub fn set_delete_time<T>(mut self, v: T) -> Self
3842    where
3843        T: std::convert::Into<wkt::Timestamp>,
3844    {
3845        self.delete_time = std::option::Option::Some(v.into());
3846        self
3847    }
3848
3849    /// Sets or clears the value of [delete_time][crate::model::Execution::delete_time].
3850    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3851    where
3852        T: std::convert::Into<wkt::Timestamp>,
3853    {
3854        self.delete_time = v.map(|x| x.into());
3855        self
3856    }
3857
3858    /// Sets the value of [expire_time][crate::model::Execution::expire_time].
3859    pub fn set_expire_time<T>(mut self, v: T) -> Self
3860    where
3861        T: std::convert::Into<wkt::Timestamp>,
3862    {
3863        self.expire_time = std::option::Option::Some(v.into());
3864        self
3865    }
3866
3867    /// Sets or clears the value of [expire_time][crate::model::Execution::expire_time].
3868    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
3869    where
3870        T: std::convert::Into<wkt::Timestamp>,
3871    {
3872        self.expire_time = v.map(|x| x.into());
3873        self
3874    }
3875
3876    /// Sets the value of [launch_stage][crate::model::Execution::launch_stage].
3877    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
3878        mut self,
3879        v: T,
3880    ) -> Self {
3881        self.launch_stage = v.into();
3882        self
3883    }
3884
3885    /// Sets the value of [job][crate::model::Execution::job].
3886    pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3887        self.job = v.into();
3888        self
3889    }
3890
3891    /// Sets the value of [parallelism][crate::model::Execution::parallelism].
3892    pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3893        self.parallelism = v.into();
3894        self
3895    }
3896
3897    /// Sets the value of [task_count][crate::model::Execution::task_count].
3898    pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3899        self.task_count = v.into();
3900        self
3901    }
3902
3903    /// Sets the value of [template][crate::model::Execution::template].
3904    pub fn set_template<T>(mut self, v: T) -> Self
3905    where
3906        T: std::convert::Into<crate::model::TaskTemplate>,
3907    {
3908        self.template = std::option::Option::Some(v.into());
3909        self
3910    }
3911
3912    /// Sets or clears the value of [template][crate::model::Execution::template].
3913    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
3914    where
3915        T: std::convert::Into<crate::model::TaskTemplate>,
3916    {
3917        self.template = v.map(|x| x.into());
3918        self
3919    }
3920
3921    /// Sets the value of [reconciling][crate::model::Execution::reconciling].
3922    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3923        self.reconciling = v.into();
3924        self
3925    }
3926
3927    /// Sets the value of [conditions][crate::model::Execution::conditions].
3928    pub fn set_conditions<T, V>(mut self, v: T) -> Self
3929    where
3930        T: std::iter::IntoIterator<Item = V>,
3931        V: std::convert::Into<crate::model::Condition>,
3932    {
3933        use std::iter::Iterator;
3934        self.conditions = v.into_iter().map(|i| i.into()).collect();
3935        self
3936    }
3937
3938    /// Sets the value of [observed_generation][crate::model::Execution::observed_generation].
3939    pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3940        self.observed_generation = v.into();
3941        self
3942    }
3943
3944    /// Sets the value of [running_count][crate::model::Execution::running_count].
3945    pub fn set_running_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3946        self.running_count = v.into();
3947        self
3948    }
3949
3950    /// Sets the value of [succeeded_count][crate::model::Execution::succeeded_count].
3951    pub fn set_succeeded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3952        self.succeeded_count = v.into();
3953        self
3954    }
3955
3956    /// Sets the value of [failed_count][crate::model::Execution::failed_count].
3957    pub fn set_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3958        self.failed_count = v.into();
3959        self
3960    }
3961
3962    /// Sets the value of [cancelled_count][crate::model::Execution::cancelled_count].
3963    pub fn set_cancelled_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3964        self.cancelled_count = v.into();
3965        self
3966    }
3967
3968    /// Sets the value of [retried_count][crate::model::Execution::retried_count].
3969    pub fn set_retried_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3970        self.retried_count = v.into();
3971        self
3972    }
3973
3974    /// Sets the value of [log_uri][crate::model::Execution::log_uri].
3975    pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3976        self.log_uri = v.into();
3977        self
3978    }
3979
3980    /// Sets the value of [satisfies_pzs][crate::model::Execution::satisfies_pzs].
3981    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3982        self.satisfies_pzs = v.into();
3983        self
3984    }
3985
3986    /// Sets the value of [etag][crate::model::Execution::etag].
3987    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3988        self.etag = v.into();
3989        self
3990    }
3991}
3992
3993impl wkt::message::Message for Execution {
3994    fn typename() -> &'static str {
3995        "type.googleapis.com/google.cloud.run.v2.Execution"
3996    }
3997}
3998
3999#[doc(hidden)]
4000impl<'de> serde::de::Deserialize<'de> for Execution {
4001    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4002    where
4003        D: serde::Deserializer<'de>,
4004    {
4005        #[allow(non_camel_case_types)]
4006        #[doc(hidden)]
4007        #[derive(PartialEq, Eq, Hash)]
4008        enum __FieldTag {
4009            __name,
4010            __uid,
4011            __creator,
4012            __generation,
4013            __labels,
4014            __annotations,
4015            __create_time,
4016            __start_time,
4017            __completion_time,
4018            __update_time,
4019            __delete_time,
4020            __expire_time,
4021            __launch_stage,
4022            __job,
4023            __parallelism,
4024            __task_count,
4025            __template,
4026            __reconciling,
4027            __conditions,
4028            __observed_generation,
4029            __running_count,
4030            __succeeded_count,
4031            __failed_count,
4032            __cancelled_count,
4033            __retried_count,
4034            __log_uri,
4035            __satisfies_pzs,
4036            __etag,
4037            Unknown(std::string::String),
4038        }
4039        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4040            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4041            where
4042                D: serde::Deserializer<'de>,
4043            {
4044                struct Visitor;
4045                impl<'de> serde::de::Visitor<'de> for Visitor {
4046                    type Value = __FieldTag;
4047                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4048                        formatter.write_str("a field name for Execution")
4049                    }
4050                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4051                    where
4052                        E: serde::de::Error,
4053                    {
4054                        use std::result::Result::Ok;
4055                        use std::string::ToString;
4056                        match value {
4057                            "name" => Ok(__FieldTag::__name),
4058                            "uid" => Ok(__FieldTag::__uid),
4059                            "creator" => Ok(__FieldTag::__creator),
4060                            "generation" => Ok(__FieldTag::__generation),
4061                            "labels" => Ok(__FieldTag::__labels),
4062                            "annotations" => Ok(__FieldTag::__annotations),
4063                            "createTime" => Ok(__FieldTag::__create_time),
4064                            "create_time" => Ok(__FieldTag::__create_time),
4065                            "startTime" => Ok(__FieldTag::__start_time),
4066                            "start_time" => Ok(__FieldTag::__start_time),
4067                            "completionTime" => Ok(__FieldTag::__completion_time),
4068                            "completion_time" => Ok(__FieldTag::__completion_time),
4069                            "updateTime" => Ok(__FieldTag::__update_time),
4070                            "update_time" => Ok(__FieldTag::__update_time),
4071                            "deleteTime" => Ok(__FieldTag::__delete_time),
4072                            "delete_time" => Ok(__FieldTag::__delete_time),
4073                            "expireTime" => Ok(__FieldTag::__expire_time),
4074                            "expire_time" => Ok(__FieldTag::__expire_time),
4075                            "launchStage" => Ok(__FieldTag::__launch_stage),
4076                            "launch_stage" => Ok(__FieldTag::__launch_stage),
4077                            "job" => Ok(__FieldTag::__job),
4078                            "parallelism" => Ok(__FieldTag::__parallelism),
4079                            "taskCount" => Ok(__FieldTag::__task_count),
4080                            "task_count" => Ok(__FieldTag::__task_count),
4081                            "template" => Ok(__FieldTag::__template),
4082                            "reconciling" => Ok(__FieldTag::__reconciling),
4083                            "conditions" => Ok(__FieldTag::__conditions),
4084                            "observedGeneration" => Ok(__FieldTag::__observed_generation),
4085                            "observed_generation" => Ok(__FieldTag::__observed_generation),
4086                            "runningCount" => Ok(__FieldTag::__running_count),
4087                            "running_count" => Ok(__FieldTag::__running_count),
4088                            "succeededCount" => Ok(__FieldTag::__succeeded_count),
4089                            "succeeded_count" => Ok(__FieldTag::__succeeded_count),
4090                            "failedCount" => Ok(__FieldTag::__failed_count),
4091                            "failed_count" => Ok(__FieldTag::__failed_count),
4092                            "cancelledCount" => Ok(__FieldTag::__cancelled_count),
4093                            "cancelled_count" => Ok(__FieldTag::__cancelled_count),
4094                            "retriedCount" => Ok(__FieldTag::__retried_count),
4095                            "retried_count" => Ok(__FieldTag::__retried_count),
4096                            "logUri" => Ok(__FieldTag::__log_uri),
4097                            "log_uri" => Ok(__FieldTag::__log_uri),
4098                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
4099                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
4100                            "etag" => Ok(__FieldTag::__etag),
4101                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4102                        }
4103                    }
4104                }
4105                deserializer.deserialize_identifier(Visitor)
4106            }
4107        }
4108        struct Visitor;
4109        impl<'de> serde::de::Visitor<'de> for Visitor {
4110            type Value = Execution;
4111            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4112                formatter.write_str("struct Execution")
4113            }
4114            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4115            where
4116                A: serde::de::MapAccess<'de>,
4117            {
4118                #[allow(unused_imports)]
4119                use serde::de::Error;
4120                use std::option::Option::Some;
4121                let mut fields = std::collections::HashSet::new();
4122                let mut result = Self::Value::new();
4123                while let Some(tag) = map.next_key::<__FieldTag>()? {
4124                    #[allow(clippy::match_single_binding)]
4125                    match tag {
4126                        __FieldTag::__name => {
4127                            if !fields.insert(__FieldTag::__name) {
4128                                return std::result::Result::Err(A::Error::duplicate_field(
4129                                    "multiple values for name",
4130                                ));
4131                            }
4132                            result.name = map
4133                                .next_value::<std::option::Option<std::string::String>>()?
4134                                .unwrap_or_default();
4135                        }
4136                        __FieldTag::__uid => {
4137                            if !fields.insert(__FieldTag::__uid) {
4138                                return std::result::Result::Err(A::Error::duplicate_field(
4139                                    "multiple values for uid",
4140                                ));
4141                            }
4142                            result.uid = map
4143                                .next_value::<std::option::Option<std::string::String>>()?
4144                                .unwrap_or_default();
4145                        }
4146                        __FieldTag::__creator => {
4147                            if !fields.insert(__FieldTag::__creator) {
4148                                return std::result::Result::Err(A::Error::duplicate_field(
4149                                    "multiple values for creator",
4150                                ));
4151                            }
4152                            result.creator = map
4153                                .next_value::<std::option::Option<std::string::String>>()?
4154                                .unwrap_or_default();
4155                        }
4156                        __FieldTag::__generation => {
4157                            if !fields.insert(__FieldTag::__generation) {
4158                                return std::result::Result::Err(A::Error::duplicate_field(
4159                                    "multiple values for generation",
4160                                ));
4161                            }
4162                            struct __With(std::option::Option<i64>);
4163                            impl<'de> serde::de::Deserialize<'de> for __With {
4164                                fn deserialize<D>(
4165                                    deserializer: D,
4166                                ) -> std::result::Result<Self, D::Error>
4167                                where
4168                                    D: serde::de::Deserializer<'de>,
4169                                {
4170                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4171                                }
4172                            }
4173                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
4174                        }
4175                        __FieldTag::__labels => {
4176                            if !fields.insert(__FieldTag::__labels) {
4177                                return std::result::Result::Err(A::Error::duplicate_field(
4178                                    "multiple values for labels",
4179                                ));
4180                            }
4181                            result.labels = map
4182                                .next_value::<std::option::Option<
4183                                    std::collections::HashMap<
4184                                        std::string::String,
4185                                        std::string::String,
4186                                    >,
4187                                >>()?
4188                                .unwrap_or_default();
4189                        }
4190                        __FieldTag::__annotations => {
4191                            if !fields.insert(__FieldTag::__annotations) {
4192                                return std::result::Result::Err(A::Error::duplicate_field(
4193                                    "multiple values for annotations",
4194                                ));
4195                            }
4196                            result.annotations = map
4197                                .next_value::<std::option::Option<
4198                                    std::collections::HashMap<
4199                                        std::string::String,
4200                                        std::string::String,
4201                                    >,
4202                                >>()?
4203                                .unwrap_or_default();
4204                        }
4205                        __FieldTag::__create_time => {
4206                            if !fields.insert(__FieldTag::__create_time) {
4207                                return std::result::Result::Err(A::Error::duplicate_field(
4208                                    "multiple values for create_time",
4209                                ));
4210                            }
4211                            result.create_time =
4212                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4213                        }
4214                        __FieldTag::__start_time => {
4215                            if !fields.insert(__FieldTag::__start_time) {
4216                                return std::result::Result::Err(A::Error::duplicate_field(
4217                                    "multiple values for start_time",
4218                                ));
4219                            }
4220                            result.start_time =
4221                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4222                        }
4223                        __FieldTag::__completion_time => {
4224                            if !fields.insert(__FieldTag::__completion_time) {
4225                                return std::result::Result::Err(A::Error::duplicate_field(
4226                                    "multiple values for completion_time",
4227                                ));
4228                            }
4229                            result.completion_time =
4230                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4231                        }
4232                        __FieldTag::__update_time => {
4233                            if !fields.insert(__FieldTag::__update_time) {
4234                                return std::result::Result::Err(A::Error::duplicate_field(
4235                                    "multiple values for update_time",
4236                                ));
4237                            }
4238                            result.update_time =
4239                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4240                        }
4241                        __FieldTag::__delete_time => {
4242                            if !fields.insert(__FieldTag::__delete_time) {
4243                                return std::result::Result::Err(A::Error::duplicate_field(
4244                                    "multiple values for delete_time",
4245                                ));
4246                            }
4247                            result.delete_time =
4248                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4249                        }
4250                        __FieldTag::__expire_time => {
4251                            if !fields.insert(__FieldTag::__expire_time) {
4252                                return std::result::Result::Err(A::Error::duplicate_field(
4253                                    "multiple values for expire_time",
4254                                ));
4255                            }
4256                            result.expire_time =
4257                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4258                        }
4259                        __FieldTag::__launch_stage => {
4260                            if !fields.insert(__FieldTag::__launch_stage) {
4261                                return std::result::Result::Err(A::Error::duplicate_field(
4262                                    "multiple values for launch_stage",
4263                                ));
4264                            }
4265                            result.launch_stage = map
4266                                .next_value::<std::option::Option<api::model::LaunchStage>>()?
4267                                .unwrap_or_default();
4268                        }
4269                        __FieldTag::__job => {
4270                            if !fields.insert(__FieldTag::__job) {
4271                                return std::result::Result::Err(A::Error::duplicate_field(
4272                                    "multiple values for job",
4273                                ));
4274                            }
4275                            result.job = map
4276                                .next_value::<std::option::Option<std::string::String>>()?
4277                                .unwrap_or_default();
4278                        }
4279                        __FieldTag::__parallelism => {
4280                            if !fields.insert(__FieldTag::__parallelism) {
4281                                return std::result::Result::Err(A::Error::duplicate_field(
4282                                    "multiple values for parallelism",
4283                                ));
4284                            }
4285                            struct __With(std::option::Option<i32>);
4286                            impl<'de> serde::de::Deserialize<'de> for __With {
4287                                fn deserialize<D>(
4288                                    deserializer: D,
4289                                ) -> std::result::Result<Self, D::Error>
4290                                where
4291                                    D: serde::de::Deserializer<'de>,
4292                                {
4293                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4294                                }
4295                            }
4296                            result.parallelism = map.next_value::<__With>()?.0.unwrap_or_default();
4297                        }
4298                        __FieldTag::__task_count => {
4299                            if !fields.insert(__FieldTag::__task_count) {
4300                                return std::result::Result::Err(A::Error::duplicate_field(
4301                                    "multiple values for task_count",
4302                                ));
4303                            }
4304                            struct __With(std::option::Option<i32>);
4305                            impl<'de> serde::de::Deserialize<'de> for __With {
4306                                fn deserialize<D>(
4307                                    deserializer: D,
4308                                ) -> std::result::Result<Self, D::Error>
4309                                where
4310                                    D: serde::de::Deserializer<'de>,
4311                                {
4312                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4313                                }
4314                            }
4315                            result.task_count = map.next_value::<__With>()?.0.unwrap_or_default();
4316                        }
4317                        __FieldTag::__template => {
4318                            if !fields.insert(__FieldTag::__template) {
4319                                return std::result::Result::Err(A::Error::duplicate_field(
4320                                    "multiple values for template",
4321                                ));
4322                            }
4323                            result.template = map
4324                                .next_value::<std::option::Option<crate::model::TaskTemplate>>()?;
4325                        }
4326                        __FieldTag::__reconciling => {
4327                            if !fields.insert(__FieldTag::__reconciling) {
4328                                return std::result::Result::Err(A::Error::duplicate_field(
4329                                    "multiple values for reconciling",
4330                                ));
4331                            }
4332                            result.reconciling = map
4333                                .next_value::<std::option::Option<bool>>()?
4334                                .unwrap_or_default();
4335                        }
4336                        __FieldTag::__conditions => {
4337                            if !fields.insert(__FieldTag::__conditions) {
4338                                return std::result::Result::Err(A::Error::duplicate_field(
4339                                    "multiple values for conditions",
4340                                ));
4341                            }
4342                            result.conditions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Condition>>>()?.unwrap_or_default();
4343                        }
4344                        __FieldTag::__observed_generation => {
4345                            if !fields.insert(__FieldTag::__observed_generation) {
4346                                return std::result::Result::Err(A::Error::duplicate_field(
4347                                    "multiple values for observed_generation",
4348                                ));
4349                            }
4350                            struct __With(std::option::Option<i64>);
4351                            impl<'de> serde::de::Deserialize<'de> for __With {
4352                                fn deserialize<D>(
4353                                    deserializer: D,
4354                                ) -> std::result::Result<Self, D::Error>
4355                                where
4356                                    D: serde::de::Deserializer<'de>,
4357                                {
4358                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4359                                }
4360                            }
4361                            result.observed_generation =
4362                                map.next_value::<__With>()?.0.unwrap_or_default();
4363                        }
4364                        __FieldTag::__running_count => {
4365                            if !fields.insert(__FieldTag::__running_count) {
4366                                return std::result::Result::Err(A::Error::duplicate_field(
4367                                    "multiple values for running_count",
4368                                ));
4369                            }
4370                            struct __With(std::option::Option<i32>);
4371                            impl<'de> serde::de::Deserialize<'de> for __With {
4372                                fn deserialize<D>(
4373                                    deserializer: D,
4374                                ) -> std::result::Result<Self, D::Error>
4375                                where
4376                                    D: serde::de::Deserializer<'de>,
4377                                {
4378                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4379                                }
4380                            }
4381                            result.running_count =
4382                                map.next_value::<__With>()?.0.unwrap_or_default();
4383                        }
4384                        __FieldTag::__succeeded_count => {
4385                            if !fields.insert(__FieldTag::__succeeded_count) {
4386                                return std::result::Result::Err(A::Error::duplicate_field(
4387                                    "multiple values for succeeded_count",
4388                                ));
4389                            }
4390                            struct __With(std::option::Option<i32>);
4391                            impl<'de> serde::de::Deserialize<'de> for __With {
4392                                fn deserialize<D>(
4393                                    deserializer: D,
4394                                ) -> std::result::Result<Self, D::Error>
4395                                where
4396                                    D: serde::de::Deserializer<'de>,
4397                                {
4398                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4399                                }
4400                            }
4401                            result.succeeded_count =
4402                                map.next_value::<__With>()?.0.unwrap_or_default();
4403                        }
4404                        __FieldTag::__failed_count => {
4405                            if !fields.insert(__FieldTag::__failed_count) {
4406                                return std::result::Result::Err(A::Error::duplicate_field(
4407                                    "multiple values for failed_count",
4408                                ));
4409                            }
4410                            struct __With(std::option::Option<i32>);
4411                            impl<'de> serde::de::Deserialize<'de> for __With {
4412                                fn deserialize<D>(
4413                                    deserializer: D,
4414                                ) -> std::result::Result<Self, D::Error>
4415                                where
4416                                    D: serde::de::Deserializer<'de>,
4417                                {
4418                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4419                                }
4420                            }
4421                            result.failed_count = map.next_value::<__With>()?.0.unwrap_or_default();
4422                        }
4423                        __FieldTag::__cancelled_count => {
4424                            if !fields.insert(__FieldTag::__cancelled_count) {
4425                                return std::result::Result::Err(A::Error::duplicate_field(
4426                                    "multiple values for cancelled_count",
4427                                ));
4428                            }
4429                            struct __With(std::option::Option<i32>);
4430                            impl<'de> serde::de::Deserialize<'de> for __With {
4431                                fn deserialize<D>(
4432                                    deserializer: D,
4433                                ) -> std::result::Result<Self, D::Error>
4434                                where
4435                                    D: serde::de::Deserializer<'de>,
4436                                {
4437                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4438                                }
4439                            }
4440                            result.cancelled_count =
4441                                map.next_value::<__With>()?.0.unwrap_or_default();
4442                        }
4443                        __FieldTag::__retried_count => {
4444                            if !fields.insert(__FieldTag::__retried_count) {
4445                                return std::result::Result::Err(A::Error::duplicate_field(
4446                                    "multiple values for retried_count",
4447                                ));
4448                            }
4449                            struct __With(std::option::Option<i32>);
4450                            impl<'de> serde::de::Deserialize<'de> for __With {
4451                                fn deserialize<D>(
4452                                    deserializer: D,
4453                                ) -> std::result::Result<Self, D::Error>
4454                                where
4455                                    D: serde::de::Deserializer<'de>,
4456                                {
4457                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4458                                }
4459                            }
4460                            result.retried_count =
4461                                map.next_value::<__With>()?.0.unwrap_or_default();
4462                        }
4463                        __FieldTag::__log_uri => {
4464                            if !fields.insert(__FieldTag::__log_uri) {
4465                                return std::result::Result::Err(A::Error::duplicate_field(
4466                                    "multiple values for log_uri",
4467                                ));
4468                            }
4469                            result.log_uri = map
4470                                .next_value::<std::option::Option<std::string::String>>()?
4471                                .unwrap_or_default();
4472                        }
4473                        __FieldTag::__satisfies_pzs => {
4474                            if !fields.insert(__FieldTag::__satisfies_pzs) {
4475                                return std::result::Result::Err(A::Error::duplicate_field(
4476                                    "multiple values for satisfies_pzs",
4477                                ));
4478                            }
4479                            result.satisfies_pzs = map
4480                                .next_value::<std::option::Option<bool>>()?
4481                                .unwrap_or_default();
4482                        }
4483                        __FieldTag::__etag => {
4484                            if !fields.insert(__FieldTag::__etag) {
4485                                return std::result::Result::Err(A::Error::duplicate_field(
4486                                    "multiple values for etag",
4487                                ));
4488                            }
4489                            result.etag = map
4490                                .next_value::<std::option::Option<std::string::String>>()?
4491                                .unwrap_or_default();
4492                        }
4493                        __FieldTag::Unknown(key) => {
4494                            let value = map.next_value::<serde_json::Value>()?;
4495                            result._unknown_fields.insert(key, value);
4496                        }
4497                    }
4498                }
4499                std::result::Result::Ok(result)
4500            }
4501        }
4502        deserializer.deserialize_any(Visitor)
4503    }
4504}
4505
4506#[doc(hidden)]
4507impl serde::ser::Serialize for Execution {
4508    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4509    where
4510        S: serde::ser::Serializer,
4511    {
4512        use serde::ser::SerializeMap;
4513        #[allow(unused_imports)]
4514        use std::option::Option::Some;
4515        let mut state = serializer.serialize_map(std::option::Option::None)?;
4516        if !self.name.is_empty() {
4517            state.serialize_entry("name", &self.name)?;
4518        }
4519        if !self.uid.is_empty() {
4520            state.serialize_entry("uid", &self.uid)?;
4521        }
4522        if !self.creator.is_empty() {
4523            state.serialize_entry("creator", &self.creator)?;
4524        }
4525        if !wkt::internal::is_default(&self.generation) {
4526            struct __With<'a>(&'a i64);
4527            impl<'a> serde::ser::Serialize for __With<'a> {
4528                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4529                where
4530                    S: serde::ser::Serializer,
4531                {
4532                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4533                }
4534            }
4535            state.serialize_entry("generation", &__With(&self.generation))?;
4536        }
4537        if !self.labels.is_empty() {
4538            state.serialize_entry("labels", &self.labels)?;
4539        }
4540        if !self.annotations.is_empty() {
4541            state.serialize_entry("annotations", &self.annotations)?;
4542        }
4543        if self.create_time.is_some() {
4544            state.serialize_entry("createTime", &self.create_time)?;
4545        }
4546        if self.start_time.is_some() {
4547            state.serialize_entry("startTime", &self.start_time)?;
4548        }
4549        if self.completion_time.is_some() {
4550            state.serialize_entry("completionTime", &self.completion_time)?;
4551        }
4552        if self.update_time.is_some() {
4553            state.serialize_entry("updateTime", &self.update_time)?;
4554        }
4555        if self.delete_time.is_some() {
4556            state.serialize_entry("deleteTime", &self.delete_time)?;
4557        }
4558        if self.expire_time.is_some() {
4559            state.serialize_entry("expireTime", &self.expire_time)?;
4560        }
4561        if !wkt::internal::is_default(&self.launch_stage) {
4562            state.serialize_entry("launchStage", &self.launch_stage)?;
4563        }
4564        if !self.job.is_empty() {
4565            state.serialize_entry("job", &self.job)?;
4566        }
4567        if !wkt::internal::is_default(&self.parallelism) {
4568            struct __With<'a>(&'a i32);
4569            impl<'a> serde::ser::Serialize for __With<'a> {
4570                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4571                where
4572                    S: serde::ser::Serializer,
4573                {
4574                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4575                }
4576            }
4577            state.serialize_entry("parallelism", &__With(&self.parallelism))?;
4578        }
4579        if !wkt::internal::is_default(&self.task_count) {
4580            struct __With<'a>(&'a i32);
4581            impl<'a> serde::ser::Serialize for __With<'a> {
4582                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4583                where
4584                    S: serde::ser::Serializer,
4585                {
4586                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4587                }
4588            }
4589            state.serialize_entry("taskCount", &__With(&self.task_count))?;
4590        }
4591        if self.template.is_some() {
4592            state.serialize_entry("template", &self.template)?;
4593        }
4594        if !wkt::internal::is_default(&self.reconciling) {
4595            state.serialize_entry("reconciling", &self.reconciling)?;
4596        }
4597        if !self.conditions.is_empty() {
4598            state.serialize_entry("conditions", &self.conditions)?;
4599        }
4600        if !wkt::internal::is_default(&self.observed_generation) {
4601            struct __With<'a>(&'a i64);
4602            impl<'a> serde::ser::Serialize for __With<'a> {
4603                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4604                where
4605                    S: serde::ser::Serializer,
4606                {
4607                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
4608                }
4609            }
4610            state.serialize_entry("observedGeneration", &__With(&self.observed_generation))?;
4611        }
4612        if !wkt::internal::is_default(&self.running_count) {
4613            struct __With<'a>(&'a i32);
4614            impl<'a> serde::ser::Serialize for __With<'a> {
4615                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4616                where
4617                    S: serde::ser::Serializer,
4618                {
4619                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4620                }
4621            }
4622            state.serialize_entry("runningCount", &__With(&self.running_count))?;
4623        }
4624        if !wkt::internal::is_default(&self.succeeded_count) {
4625            struct __With<'a>(&'a i32);
4626            impl<'a> serde::ser::Serialize for __With<'a> {
4627                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4628                where
4629                    S: serde::ser::Serializer,
4630                {
4631                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4632                }
4633            }
4634            state.serialize_entry("succeededCount", &__With(&self.succeeded_count))?;
4635        }
4636        if !wkt::internal::is_default(&self.failed_count) {
4637            struct __With<'a>(&'a i32);
4638            impl<'a> serde::ser::Serialize for __With<'a> {
4639                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4640                where
4641                    S: serde::ser::Serializer,
4642                {
4643                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4644                }
4645            }
4646            state.serialize_entry("failedCount", &__With(&self.failed_count))?;
4647        }
4648        if !wkt::internal::is_default(&self.cancelled_count) {
4649            struct __With<'a>(&'a i32);
4650            impl<'a> serde::ser::Serialize for __With<'a> {
4651                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4652                where
4653                    S: serde::ser::Serializer,
4654                {
4655                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4656                }
4657            }
4658            state.serialize_entry("cancelledCount", &__With(&self.cancelled_count))?;
4659        }
4660        if !wkt::internal::is_default(&self.retried_count) {
4661            struct __With<'a>(&'a i32);
4662            impl<'a> serde::ser::Serialize for __With<'a> {
4663                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4664                where
4665                    S: serde::ser::Serializer,
4666                {
4667                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4668                }
4669            }
4670            state.serialize_entry("retriedCount", &__With(&self.retried_count))?;
4671        }
4672        if !self.log_uri.is_empty() {
4673            state.serialize_entry("logUri", &self.log_uri)?;
4674        }
4675        if !wkt::internal::is_default(&self.satisfies_pzs) {
4676            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
4677        }
4678        if !self.etag.is_empty() {
4679            state.serialize_entry("etag", &self.etag)?;
4680        }
4681        if !self._unknown_fields.is_empty() {
4682            for (key, value) in self._unknown_fields.iter() {
4683                state.serialize_entry(key, &value)?;
4684            }
4685        }
4686        state.end()
4687    }
4688}
4689
4690/// ExecutionTemplate describes the data an execution should have when created
4691/// from a template.
4692#[derive(Clone, Debug, Default, PartialEq)]
4693#[non_exhaustive]
4694pub struct ExecutionTemplate {
4695    /// Unstructured key value map that can be used to organize and categorize
4696    /// objects.
4697    /// User-provided labels are shared with Google's billing system, so they can
4698    /// be used to filter, or break down billing charges by team, component,
4699    /// environment, state, etc. For more information, visit
4700    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
4701    /// <https://cloud.google.com/run/docs/configuring/labels>.
4702    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4703
4704    /// Unstructured key value map that may be set by external tools to store and
4705    /// arbitrary metadata. They are not queryable and should be preserved
4706    /// when modifying objects.
4707    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
4708
4709    /// Optional. Specifies the maximum desired number of tasks the execution
4710    /// should run at given time. When the job is run, if this field is 0 or unset,
4711    /// the maximum possible value will be used for that execution. The actual
4712    /// number of tasks running in steady state will be less than this number when
4713    /// there are fewer tasks waiting to be completed remaining, i.e. when the work
4714    /// left to do is less than max parallelism.
4715    pub parallelism: i32,
4716
4717    /// Specifies the desired number of tasks the execution should run.
4718    /// Setting to 1 means that parallelism is limited to 1 and the success of
4719    /// that task signals the success of the execution. Defaults to 1.
4720    pub task_count: i32,
4721
4722    /// Required. Describes the task(s) that will be created when executing an
4723    /// execution.
4724    pub template: std::option::Option<crate::model::TaskTemplate>,
4725
4726    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4727}
4728
4729impl ExecutionTemplate {
4730    pub fn new() -> Self {
4731        std::default::Default::default()
4732    }
4733
4734    /// Sets the value of [labels][crate::model::ExecutionTemplate::labels].
4735    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4736    where
4737        T: std::iter::IntoIterator<Item = (K, V)>,
4738        K: std::convert::Into<std::string::String>,
4739        V: std::convert::Into<std::string::String>,
4740    {
4741        use std::iter::Iterator;
4742        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4743        self
4744    }
4745
4746    /// Sets the value of [annotations][crate::model::ExecutionTemplate::annotations].
4747    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
4748    where
4749        T: std::iter::IntoIterator<Item = (K, V)>,
4750        K: std::convert::Into<std::string::String>,
4751        V: std::convert::Into<std::string::String>,
4752    {
4753        use std::iter::Iterator;
4754        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4755        self
4756    }
4757
4758    /// Sets the value of [parallelism][crate::model::ExecutionTemplate::parallelism].
4759    pub fn set_parallelism<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4760        self.parallelism = v.into();
4761        self
4762    }
4763
4764    /// Sets the value of [task_count][crate::model::ExecutionTemplate::task_count].
4765    pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4766        self.task_count = v.into();
4767        self
4768    }
4769
4770    /// Sets the value of [template][crate::model::ExecutionTemplate::template].
4771    pub fn set_template<T>(mut self, v: T) -> Self
4772    where
4773        T: std::convert::Into<crate::model::TaskTemplate>,
4774    {
4775        self.template = std::option::Option::Some(v.into());
4776        self
4777    }
4778
4779    /// Sets or clears the value of [template][crate::model::ExecutionTemplate::template].
4780    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
4781    where
4782        T: std::convert::Into<crate::model::TaskTemplate>,
4783    {
4784        self.template = v.map(|x| x.into());
4785        self
4786    }
4787}
4788
4789impl wkt::message::Message for ExecutionTemplate {
4790    fn typename() -> &'static str {
4791        "type.googleapis.com/google.cloud.run.v2.ExecutionTemplate"
4792    }
4793}
4794
4795#[doc(hidden)]
4796impl<'de> serde::de::Deserialize<'de> for ExecutionTemplate {
4797    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4798    where
4799        D: serde::Deserializer<'de>,
4800    {
4801        #[allow(non_camel_case_types)]
4802        #[doc(hidden)]
4803        #[derive(PartialEq, Eq, Hash)]
4804        enum __FieldTag {
4805            __labels,
4806            __annotations,
4807            __parallelism,
4808            __task_count,
4809            __template,
4810            Unknown(std::string::String),
4811        }
4812        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4813            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4814            where
4815                D: serde::Deserializer<'de>,
4816            {
4817                struct Visitor;
4818                impl<'de> serde::de::Visitor<'de> for Visitor {
4819                    type Value = __FieldTag;
4820                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4821                        formatter.write_str("a field name for ExecutionTemplate")
4822                    }
4823                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4824                    where
4825                        E: serde::de::Error,
4826                    {
4827                        use std::result::Result::Ok;
4828                        use std::string::ToString;
4829                        match value {
4830                            "labels" => Ok(__FieldTag::__labels),
4831                            "annotations" => Ok(__FieldTag::__annotations),
4832                            "parallelism" => Ok(__FieldTag::__parallelism),
4833                            "taskCount" => Ok(__FieldTag::__task_count),
4834                            "task_count" => Ok(__FieldTag::__task_count),
4835                            "template" => Ok(__FieldTag::__template),
4836                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4837                        }
4838                    }
4839                }
4840                deserializer.deserialize_identifier(Visitor)
4841            }
4842        }
4843        struct Visitor;
4844        impl<'de> serde::de::Visitor<'de> for Visitor {
4845            type Value = ExecutionTemplate;
4846            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4847                formatter.write_str("struct ExecutionTemplate")
4848            }
4849            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4850            where
4851                A: serde::de::MapAccess<'de>,
4852            {
4853                #[allow(unused_imports)]
4854                use serde::de::Error;
4855                use std::option::Option::Some;
4856                let mut fields = std::collections::HashSet::new();
4857                let mut result = Self::Value::new();
4858                while let Some(tag) = map.next_key::<__FieldTag>()? {
4859                    #[allow(clippy::match_single_binding)]
4860                    match tag {
4861                        __FieldTag::__labels => {
4862                            if !fields.insert(__FieldTag::__labels) {
4863                                return std::result::Result::Err(A::Error::duplicate_field(
4864                                    "multiple values for labels",
4865                                ));
4866                            }
4867                            result.labels = map
4868                                .next_value::<std::option::Option<
4869                                    std::collections::HashMap<
4870                                        std::string::String,
4871                                        std::string::String,
4872                                    >,
4873                                >>()?
4874                                .unwrap_or_default();
4875                        }
4876                        __FieldTag::__annotations => {
4877                            if !fields.insert(__FieldTag::__annotations) {
4878                                return std::result::Result::Err(A::Error::duplicate_field(
4879                                    "multiple values for annotations",
4880                                ));
4881                            }
4882                            result.annotations = map
4883                                .next_value::<std::option::Option<
4884                                    std::collections::HashMap<
4885                                        std::string::String,
4886                                        std::string::String,
4887                                    >,
4888                                >>()?
4889                                .unwrap_or_default();
4890                        }
4891                        __FieldTag::__parallelism => {
4892                            if !fields.insert(__FieldTag::__parallelism) {
4893                                return std::result::Result::Err(A::Error::duplicate_field(
4894                                    "multiple values for parallelism",
4895                                ));
4896                            }
4897                            struct __With(std::option::Option<i32>);
4898                            impl<'de> serde::de::Deserialize<'de> for __With {
4899                                fn deserialize<D>(
4900                                    deserializer: D,
4901                                ) -> std::result::Result<Self, D::Error>
4902                                where
4903                                    D: serde::de::Deserializer<'de>,
4904                                {
4905                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4906                                }
4907                            }
4908                            result.parallelism = map.next_value::<__With>()?.0.unwrap_or_default();
4909                        }
4910                        __FieldTag::__task_count => {
4911                            if !fields.insert(__FieldTag::__task_count) {
4912                                return std::result::Result::Err(A::Error::duplicate_field(
4913                                    "multiple values for task_count",
4914                                ));
4915                            }
4916                            struct __With(std::option::Option<i32>);
4917                            impl<'de> serde::de::Deserialize<'de> for __With {
4918                                fn deserialize<D>(
4919                                    deserializer: D,
4920                                ) -> std::result::Result<Self, D::Error>
4921                                where
4922                                    D: serde::de::Deserializer<'de>,
4923                                {
4924                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4925                                }
4926                            }
4927                            result.task_count = map.next_value::<__With>()?.0.unwrap_or_default();
4928                        }
4929                        __FieldTag::__template => {
4930                            if !fields.insert(__FieldTag::__template) {
4931                                return std::result::Result::Err(A::Error::duplicate_field(
4932                                    "multiple values for template",
4933                                ));
4934                            }
4935                            result.template = map
4936                                .next_value::<std::option::Option<crate::model::TaskTemplate>>()?;
4937                        }
4938                        __FieldTag::Unknown(key) => {
4939                            let value = map.next_value::<serde_json::Value>()?;
4940                            result._unknown_fields.insert(key, value);
4941                        }
4942                    }
4943                }
4944                std::result::Result::Ok(result)
4945            }
4946        }
4947        deserializer.deserialize_any(Visitor)
4948    }
4949}
4950
4951#[doc(hidden)]
4952impl serde::ser::Serialize for ExecutionTemplate {
4953    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4954    where
4955        S: serde::ser::Serializer,
4956    {
4957        use serde::ser::SerializeMap;
4958        #[allow(unused_imports)]
4959        use std::option::Option::Some;
4960        let mut state = serializer.serialize_map(std::option::Option::None)?;
4961        if !self.labels.is_empty() {
4962            state.serialize_entry("labels", &self.labels)?;
4963        }
4964        if !self.annotations.is_empty() {
4965            state.serialize_entry("annotations", &self.annotations)?;
4966        }
4967        if !wkt::internal::is_default(&self.parallelism) {
4968            struct __With<'a>(&'a i32);
4969            impl<'a> serde::ser::Serialize for __With<'a> {
4970                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4971                where
4972                    S: serde::ser::Serializer,
4973                {
4974                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4975                }
4976            }
4977            state.serialize_entry("parallelism", &__With(&self.parallelism))?;
4978        }
4979        if !wkt::internal::is_default(&self.task_count) {
4980            struct __With<'a>(&'a i32);
4981            impl<'a> serde::ser::Serialize for __With<'a> {
4982                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4983                where
4984                    S: serde::ser::Serializer,
4985                {
4986                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4987                }
4988            }
4989            state.serialize_entry("taskCount", &__With(&self.task_count))?;
4990        }
4991        if self.template.is_some() {
4992            state.serialize_entry("template", &self.template)?;
4993        }
4994        if !self._unknown_fields.is_empty() {
4995            for (key, value) in self._unknown_fields.iter() {
4996                state.serialize_entry(key, &value)?;
4997            }
4998        }
4999        state.end()
5000    }
5001}
5002
5003/// Request message for creating a Job.
5004#[derive(Clone, Debug, Default, PartialEq)]
5005#[non_exhaustive]
5006pub struct CreateJobRequest {
5007    /// Required. The location and project in which this Job should be created.
5008    /// Format: projects/{project}/locations/{location}, where {project} can be
5009    /// project id or number.
5010    pub parent: std::string::String,
5011
5012    /// Required. The Job instance to create.
5013    pub job: std::option::Option<crate::model::Job>,
5014
5015    /// Required. The unique identifier for the Job. The name of the job becomes
5016    /// {parent}/jobs/{job_id}.
5017    pub job_id: std::string::String,
5018
5019    /// Indicates that the request should be validated and default values
5020    /// populated, without persisting the request or creating any resources.
5021    pub validate_only: bool,
5022
5023    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5024}
5025
5026impl CreateJobRequest {
5027    pub fn new() -> Self {
5028        std::default::Default::default()
5029    }
5030
5031    /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
5032    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5033        self.parent = v.into();
5034        self
5035    }
5036
5037    /// Sets the value of [job][crate::model::CreateJobRequest::job].
5038    pub fn set_job<T>(mut self, v: T) -> Self
5039    where
5040        T: std::convert::Into<crate::model::Job>,
5041    {
5042        self.job = std::option::Option::Some(v.into());
5043        self
5044    }
5045
5046    /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
5047    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
5048    where
5049        T: std::convert::Into<crate::model::Job>,
5050    {
5051        self.job = v.map(|x| x.into());
5052        self
5053    }
5054
5055    /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
5056    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5057        self.job_id = v.into();
5058        self
5059    }
5060
5061    /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
5062    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5063        self.validate_only = v.into();
5064        self
5065    }
5066}
5067
5068impl wkt::message::Message for CreateJobRequest {
5069    fn typename() -> &'static str {
5070        "type.googleapis.com/google.cloud.run.v2.CreateJobRequest"
5071    }
5072}
5073
5074#[doc(hidden)]
5075impl<'de> serde::de::Deserialize<'de> for CreateJobRequest {
5076    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5077    where
5078        D: serde::Deserializer<'de>,
5079    {
5080        #[allow(non_camel_case_types)]
5081        #[doc(hidden)]
5082        #[derive(PartialEq, Eq, Hash)]
5083        enum __FieldTag {
5084            __parent,
5085            __job,
5086            __job_id,
5087            __validate_only,
5088            Unknown(std::string::String),
5089        }
5090        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5091            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5092            where
5093                D: serde::Deserializer<'de>,
5094            {
5095                struct Visitor;
5096                impl<'de> serde::de::Visitor<'de> for Visitor {
5097                    type Value = __FieldTag;
5098                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5099                        formatter.write_str("a field name for CreateJobRequest")
5100                    }
5101                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5102                    where
5103                        E: serde::de::Error,
5104                    {
5105                        use std::result::Result::Ok;
5106                        use std::string::ToString;
5107                        match value {
5108                            "parent" => Ok(__FieldTag::__parent),
5109                            "job" => Ok(__FieldTag::__job),
5110                            "jobId" => Ok(__FieldTag::__job_id),
5111                            "job_id" => Ok(__FieldTag::__job_id),
5112                            "validateOnly" => Ok(__FieldTag::__validate_only),
5113                            "validate_only" => Ok(__FieldTag::__validate_only),
5114                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5115                        }
5116                    }
5117                }
5118                deserializer.deserialize_identifier(Visitor)
5119            }
5120        }
5121        struct Visitor;
5122        impl<'de> serde::de::Visitor<'de> for Visitor {
5123            type Value = CreateJobRequest;
5124            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5125                formatter.write_str("struct CreateJobRequest")
5126            }
5127            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5128            where
5129                A: serde::de::MapAccess<'de>,
5130            {
5131                #[allow(unused_imports)]
5132                use serde::de::Error;
5133                use std::option::Option::Some;
5134                let mut fields = std::collections::HashSet::new();
5135                let mut result = Self::Value::new();
5136                while let Some(tag) = map.next_key::<__FieldTag>()? {
5137                    #[allow(clippy::match_single_binding)]
5138                    match tag {
5139                        __FieldTag::__parent => {
5140                            if !fields.insert(__FieldTag::__parent) {
5141                                return std::result::Result::Err(A::Error::duplicate_field(
5142                                    "multiple values for parent",
5143                                ));
5144                            }
5145                            result.parent = map
5146                                .next_value::<std::option::Option<std::string::String>>()?
5147                                .unwrap_or_default();
5148                        }
5149                        __FieldTag::__job => {
5150                            if !fields.insert(__FieldTag::__job) {
5151                                return std::result::Result::Err(A::Error::duplicate_field(
5152                                    "multiple values for job",
5153                                ));
5154                            }
5155                            result.job =
5156                                map.next_value::<std::option::Option<crate::model::Job>>()?;
5157                        }
5158                        __FieldTag::__job_id => {
5159                            if !fields.insert(__FieldTag::__job_id) {
5160                                return std::result::Result::Err(A::Error::duplicate_field(
5161                                    "multiple values for job_id",
5162                                ));
5163                            }
5164                            result.job_id = map
5165                                .next_value::<std::option::Option<std::string::String>>()?
5166                                .unwrap_or_default();
5167                        }
5168                        __FieldTag::__validate_only => {
5169                            if !fields.insert(__FieldTag::__validate_only) {
5170                                return std::result::Result::Err(A::Error::duplicate_field(
5171                                    "multiple values for validate_only",
5172                                ));
5173                            }
5174                            result.validate_only = map
5175                                .next_value::<std::option::Option<bool>>()?
5176                                .unwrap_or_default();
5177                        }
5178                        __FieldTag::Unknown(key) => {
5179                            let value = map.next_value::<serde_json::Value>()?;
5180                            result._unknown_fields.insert(key, value);
5181                        }
5182                    }
5183                }
5184                std::result::Result::Ok(result)
5185            }
5186        }
5187        deserializer.deserialize_any(Visitor)
5188    }
5189}
5190
5191#[doc(hidden)]
5192impl serde::ser::Serialize for CreateJobRequest {
5193    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5194    where
5195        S: serde::ser::Serializer,
5196    {
5197        use serde::ser::SerializeMap;
5198        #[allow(unused_imports)]
5199        use std::option::Option::Some;
5200        let mut state = serializer.serialize_map(std::option::Option::None)?;
5201        if !self.parent.is_empty() {
5202            state.serialize_entry("parent", &self.parent)?;
5203        }
5204        if self.job.is_some() {
5205            state.serialize_entry("job", &self.job)?;
5206        }
5207        if !self.job_id.is_empty() {
5208            state.serialize_entry("jobId", &self.job_id)?;
5209        }
5210        if !wkt::internal::is_default(&self.validate_only) {
5211            state.serialize_entry("validateOnly", &self.validate_only)?;
5212        }
5213        if !self._unknown_fields.is_empty() {
5214            for (key, value) in self._unknown_fields.iter() {
5215                state.serialize_entry(key, &value)?;
5216            }
5217        }
5218        state.end()
5219    }
5220}
5221
5222/// Request message for obtaining a Job by its full name.
5223#[derive(Clone, Debug, Default, PartialEq)]
5224#[non_exhaustive]
5225pub struct GetJobRequest {
5226    /// Required. The full name of the Job.
5227    /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5228    /// can be project id or number.
5229    pub name: std::string::String,
5230
5231    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5232}
5233
5234impl GetJobRequest {
5235    pub fn new() -> Self {
5236        std::default::Default::default()
5237    }
5238
5239    /// Sets the value of [name][crate::model::GetJobRequest::name].
5240    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5241        self.name = v.into();
5242        self
5243    }
5244}
5245
5246impl wkt::message::Message for GetJobRequest {
5247    fn typename() -> &'static str {
5248        "type.googleapis.com/google.cloud.run.v2.GetJobRequest"
5249    }
5250}
5251
5252#[doc(hidden)]
5253impl<'de> serde::de::Deserialize<'de> for GetJobRequest {
5254    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5255    where
5256        D: serde::Deserializer<'de>,
5257    {
5258        #[allow(non_camel_case_types)]
5259        #[doc(hidden)]
5260        #[derive(PartialEq, Eq, Hash)]
5261        enum __FieldTag {
5262            __name,
5263            Unknown(std::string::String),
5264        }
5265        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5266            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5267            where
5268                D: serde::Deserializer<'de>,
5269            {
5270                struct Visitor;
5271                impl<'de> serde::de::Visitor<'de> for Visitor {
5272                    type Value = __FieldTag;
5273                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5274                        formatter.write_str("a field name for GetJobRequest")
5275                    }
5276                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5277                    where
5278                        E: serde::de::Error,
5279                    {
5280                        use std::result::Result::Ok;
5281                        use std::string::ToString;
5282                        match value {
5283                            "name" => Ok(__FieldTag::__name),
5284                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5285                        }
5286                    }
5287                }
5288                deserializer.deserialize_identifier(Visitor)
5289            }
5290        }
5291        struct Visitor;
5292        impl<'de> serde::de::Visitor<'de> for Visitor {
5293            type Value = GetJobRequest;
5294            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5295                formatter.write_str("struct GetJobRequest")
5296            }
5297            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5298            where
5299                A: serde::de::MapAccess<'de>,
5300            {
5301                #[allow(unused_imports)]
5302                use serde::de::Error;
5303                use std::option::Option::Some;
5304                let mut fields = std::collections::HashSet::new();
5305                let mut result = Self::Value::new();
5306                while let Some(tag) = map.next_key::<__FieldTag>()? {
5307                    #[allow(clippy::match_single_binding)]
5308                    match tag {
5309                        __FieldTag::__name => {
5310                            if !fields.insert(__FieldTag::__name) {
5311                                return std::result::Result::Err(A::Error::duplicate_field(
5312                                    "multiple values for name",
5313                                ));
5314                            }
5315                            result.name = map
5316                                .next_value::<std::option::Option<std::string::String>>()?
5317                                .unwrap_or_default();
5318                        }
5319                        __FieldTag::Unknown(key) => {
5320                            let value = map.next_value::<serde_json::Value>()?;
5321                            result._unknown_fields.insert(key, value);
5322                        }
5323                    }
5324                }
5325                std::result::Result::Ok(result)
5326            }
5327        }
5328        deserializer.deserialize_any(Visitor)
5329    }
5330}
5331
5332#[doc(hidden)]
5333impl serde::ser::Serialize for GetJobRequest {
5334    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5335    where
5336        S: serde::ser::Serializer,
5337    {
5338        use serde::ser::SerializeMap;
5339        #[allow(unused_imports)]
5340        use std::option::Option::Some;
5341        let mut state = serializer.serialize_map(std::option::Option::None)?;
5342        if !self.name.is_empty() {
5343            state.serialize_entry("name", &self.name)?;
5344        }
5345        if !self._unknown_fields.is_empty() {
5346            for (key, value) in self._unknown_fields.iter() {
5347                state.serialize_entry(key, &value)?;
5348            }
5349        }
5350        state.end()
5351    }
5352}
5353
5354/// Request message for updating a Job.
5355#[derive(Clone, Debug, Default, PartialEq)]
5356#[non_exhaustive]
5357pub struct UpdateJobRequest {
5358    /// Required. The Job to be updated.
5359    pub job: std::option::Option<crate::model::Job>,
5360
5361    /// Indicates that the request should be validated and default values
5362    /// populated, without persisting the request or updating any resources.
5363    pub validate_only: bool,
5364
5365    /// Optional. If set to true, and if the Job does not exist, it will create a
5366    /// new one. Caller must have both create and update permissions for this call
5367    /// if this is set to true.
5368    pub allow_missing: bool,
5369
5370    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5371}
5372
5373impl UpdateJobRequest {
5374    pub fn new() -> Self {
5375        std::default::Default::default()
5376    }
5377
5378    /// Sets the value of [job][crate::model::UpdateJobRequest::job].
5379    pub fn set_job<T>(mut self, v: T) -> Self
5380    where
5381        T: std::convert::Into<crate::model::Job>,
5382    {
5383        self.job = std::option::Option::Some(v.into());
5384        self
5385    }
5386
5387    /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
5388    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
5389    where
5390        T: std::convert::Into<crate::model::Job>,
5391    {
5392        self.job = v.map(|x| x.into());
5393        self
5394    }
5395
5396    /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
5397    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5398        self.validate_only = v.into();
5399        self
5400    }
5401
5402    /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
5403    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5404        self.allow_missing = v.into();
5405        self
5406    }
5407}
5408
5409impl wkt::message::Message for UpdateJobRequest {
5410    fn typename() -> &'static str {
5411        "type.googleapis.com/google.cloud.run.v2.UpdateJobRequest"
5412    }
5413}
5414
5415#[doc(hidden)]
5416impl<'de> serde::de::Deserialize<'de> for UpdateJobRequest {
5417    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5418    where
5419        D: serde::Deserializer<'de>,
5420    {
5421        #[allow(non_camel_case_types)]
5422        #[doc(hidden)]
5423        #[derive(PartialEq, Eq, Hash)]
5424        enum __FieldTag {
5425            __job,
5426            __validate_only,
5427            __allow_missing,
5428            Unknown(std::string::String),
5429        }
5430        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5431            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5432            where
5433                D: serde::Deserializer<'de>,
5434            {
5435                struct Visitor;
5436                impl<'de> serde::de::Visitor<'de> for Visitor {
5437                    type Value = __FieldTag;
5438                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5439                        formatter.write_str("a field name for UpdateJobRequest")
5440                    }
5441                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5442                    where
5443                        E: serde::de::Error,
5444                    {
5445                        use std::result::Result::Ok;
5446                        use std::string::ToString;
5447                        match value {
5448                            "job" => Ok(__FieldTag::__job),
5449                            "validateOnly" => Ok(__FieldTag::__validate_only),
5450                            "validate_only" => Ok(__FieldTag::__validate_only),
5451                            "allowMissing" => Ok(__FieldTag::__allow_missing),
5452                            "allow_missing" => Ok(__FieldTag::__allow_missing),
5453                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5454                        }
5455                    }
5456                }
5457                deserializer.deserialize_identifier(Visitor)
5458            }
5459        }
5460        struct Visitor;
5461        impl<'de> serde::de::Visitor<'de> for Visitor {
5462            type Value = UpdateJobRequest;
5463            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5464                formatter.write_str("struct UpdateJobRequest")
5465            }
5466            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5467            where
5468                A: serde::de::MapAccess<'de>,
5469            {
5470                #[allow(unused_imports)]
5471                use serde::de::Error;
5472                use std::option::Option::Some;
5473                let mut fields = std::collections::HashSet::new();
5474                let mut result = Self::Value::new();
5475                while let Some(tag) = map.next_key::<__FieldTag>()? {
5476                    #[allow(clippy::match_single_binding)]
5477                    match tag {
5478                        __FieldTag::__job => {
5479                            if !fields.insert(__FieldTag::__job) {
5480                                return std::result::Result::Err(A::Error::duplicate_field(
5481                                    "multiple values for job",
5482                                ));
5483                            }
5484                            result.job =
5485                                map.next_value::<std::option::Option<crate::model::Job>>()?;
5486                        }
5487                        __FieldTag::__validate_only => {
5488                            if !fields.insert(__FieldTag::__validate_only) {
5489                                return std::result::Result::Err(A::Error::duplicate_field(
5490                                    "multiple values for validate_only",
5491                                ));
5492                            }
5493                            result.validate_only = map
5494                                .next_value::<std::option::Option<bool>>()?
5495                                .unwrap_or_default();
5496                        }
5497                        __FieldTag::__allow_missing => {
5498                            if !fields.insert(__FieldTag::__allow_missing) {
5499                                return std::result::Result::Err(A::Error::duplicate_field(
5500                                    "multiple values for allow_missing",
5501                                ));
5502                            }
5503                            result.allow_missing = map
5504                                .next_value::<std::option::Option<bool>>()?
5505                                .unwrap_or_default();
5506                        }
5507                        __FieldTag::Unknown(key) => {
5508                            let value = map.next_value::<serde_json::Value>()?;
5509                            result._unknown_fields.insert(key, value);
5510                        }
5511                    }
5512                }
5513                std::result::Result::Ok(result)
5514            }
5515        }
5516        deserializer.deserialize_any(Visitor)
5517    }
5518}
5519
5520#[doc(hidden)]
5521impl serde::ser::Serialize for UpdateJobRequest {
5522    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5523    where
5524        S: serde::ser::Serializer,
5525    {
5526        use serde::ser::SerializeMap;
5527        #[allow(unused_imports)]
5528        use std::option::Option::Some;
5529        let mut state = serializer.serialize_map(std::option::Option::None)?;
5530        if self.job.is_some() {
5531            state.serialize_entry("job", &self.job)?;
5532        }
5533        if !wkt::internal::is_default(&self.validate_only) {
5534            state.serialize_entry("validateOnly", &self.validate_only)?;
5535        }
5536        if !wkt::internal::is_default(&self.allow_missing) {
5537            state.serialize_entry("allowMissing", &self.allow_missing)?;
5538        }
5539        if !self._unknown_fields.is_empty() {
5540            for (key, value) in self._unknown_fields.iter() {
5541                state.serialize_entry(key, &value)?;
5542            }
5543        }
5544        state.end()
5545    }
5546}
5547
5548/// Request message for retrieving a list of Jobs.
5549#[derive(Clone, Debug, Default, PartialEq)]
5550#[non_exhaustive]
5551pub struct ListJobsRequest {
5552    /// Required. The location and project to list resources on.
5553    /// Format: projects/{project}/locations/{location}, where {project} can be
5554    /// project id or number.
5555    pub parent: std::string::String,
5556
5557    /// Maximum number of Jobs to return in this call.
5558    pub page_size: i32,
5559
5560    /// A page token received from a previous call to ListJobs.
5561    /// All other parameters must match.
5562    pub page_token: std::string::String,
5563
5564    /// If true, returns deleted (but unexpired) resources along with active ones.
5565    pub show_deleted: bool,
5566
5567    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5568}
5569
5570impl ListJobsRequest {
5571    pub fn new() -> Self {
5572        std::default::Default::default()
5573    }
5574
5575    /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
5576    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5577        self.parent = v.into();
5578        self
5579    }
5580
5581    /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
5582    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5583        self.page_size = v.into();
5584        self
5585    }
5586
5587    /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
5588    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5589        self.page_token = v.into();
5590        self
5591    }
5592
5593    /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
5594    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5595        self.show_deleted = v.into();
5596        self
5597    }
5598}
5599
5600impl wkt::message::Message for ListJobsRequest {
5601    fn typename() -> &'static str {
5602        "type.googleapis.com/google.cloud.run.v2.ListJobsRequest"
5603    }
5604}
5605
5606#[doc(hidden)]
5607impl<'de> serde::de::Deserialize<'de> for ListJobsRequest {
5608    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5609    where
5610        D: serde::Deserializer<'de>,
5611    {
5612        #[allow(non_camel_case_types)]
5613        #[doc(hidden)]
5614        #[derive(PartialEq, Eq, Hash)]
5615        enum __FieldTag {
5616            __parent,
5617            __page_size,
5618            __page_token,
5619            __show_deleted,
5620            Unknown(std::string::String),
5621        }
5622        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5623            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5624            where
5625                D: serde::Deserializer<'de>,
5626            {
5627                struct Visitor;
5628                impl<'de> serde::de::Visitor<'de> for Visitor {
5629                    type Value = __FieldTag;
5630                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5631                        formatter.write_str("a field name for ListJobsRequest")
5632                    }
5633                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5634                    where
5635                        E: serde::de::Error,
5636                    {
5637                        use std::result::Result::Ok;
5638                        use std::string::ToString;
5639                        match value {
5640                            "parent" => Ok(__FieldTag::__parent),
5641                            "pageSize" => Ok(__FieldTag::__page_size),
5642                            "page_size" => Ok(__FieldTag::__page_size),
5643                            "pageToken" => Ok(__FieldTag::__page_token),
5644                            "page_token" => Ok(__FieldTag::__page_token),
5645                            "showDeleted" => Ok(__FieldTag::__show_deleted),
5646                            "show_deleted" => Ok(__FieldTag::__show_deleted),
5647                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5648                        }
5649                    }
5650                }
5651                deserializer.deserialize_identifier(Visitor)
5652            }
5653        }
5654        struct Visitor;
5655        impl<'de> serde::de::Visitor<'de> for Visitor {
5656            type Value = ListJobsRequest;
5657            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5658                formatter.write_str("struct ListJobsRequest")
5659            }
5660            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5661            where
5662                A: serde::de::MapAccess<'de>,
5663            {
5664                #[allow(unused_imports)]
5665                use serde::de::Error;
5666                use std::option::Option::Some;
5667                let mut fields = std::collections::HashSet::new();
5668                let mut result = Self::Value::new();
5669                while let Some(tag) = map.next_key::<__FieldTag>()? {
5670                    #[allow(clippy::match_single_binding)]
5671                    match tag {
5672                        __FieldTag::__parent => {
5673                            if !fields.insert(__FieldTag::__parent) {
5674                                return std::result::Result::Err(A::Error::duplicate_field(
5675                                    "multiple values for parent",
5676                                ));
5677                            }
5678                            result.parent = map
5679                                .next_value::<std::option::Option<std::string::String>>()?
5680                                .unwrap_or_default();
5681                        }
5682                        __FieldTag::__page_size => {
5683                            if !fields.insert(__FieldTag::__page_size) {
5684                                return std::result::Result::Err(A::Error::duplicate_field(
5685                                    "multiple values for page_size",
5686                                ));
5687                            }
5688                            struct __With(std::option::Option<i32>);
5689                            impl<'de> serde::de::Deserialize<'de> for __With {
5690                                fn deserialize<D>(
5691                                    deserializer: D,
5692                                ) -> std::result::Result<Self, D::Error>
5693                                where
5694                                    D: serde::de::Deserializer<'de>,
5695                                {
5696                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5697                                }
5698                            }
5699                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5700                        }
5701                        __FieldTag::__page_token => {
5702                            if !fields.insert(__FieldTag::__page_token) {
5703                                return std::result::Result::Err(A::Error::duplicate_field(
5704                                    "multiple values for page_token",
5705                                ));
5706                            }
5707                            result.page_token = map
5708                                .next_value::<std::option::Option<std::string::String>>()?
5709                                .unwrap_or_default();
5710                        }
5711                        __FieldTag::__show_deleted => {
5712                            if !fields.insert(__FieldTag::__show_deleted) {
5713                                return std::result::Result::Err(A::Error::duplicate_field(
5714                                    "multiple values for show_deleted",
5715                                ));
5716                            }
5717                            result.show_deleted = map
5718                                .next_value::<std::option::Option<bool>>()?
5719                                .unwrap_or_default();
5720                        }
5721                        __FieldTag::Unknown(key) => {
5722                            let value = map.next_value::<serde_json::Value>()?;
5723                            result._unknown_fields.insert(key, value);
5724                        }
5725                    }
5726                }
5727                std::result::Result::Ok(result)
5728            }
5729        }
5730        deserializer.deserialize_any(Visitor)
5731    }
5732}
5733
5734#[doc(hidden)]
5735impl serde::ser::Serialize for ListJobsRequest {
5736    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5737    where
5738        S: serde::ser::Serializer,
5739    {
5740        use serde::ser::SerializeMap;
5741        #[allow(unused_imports)]
5742        use std::option::Option::Some;
5743        let mut state = serializer.serialize_map(std::option::Option::None)?;
5744        if !self.parent.is_empty() {
5745            state.serialize_entry("parent", &self.parent)?;
5746        }
5747        if !wkt::internal::is_default(&self.page_size) {
5748            struct __With<'a>(&'a i32);
5749            impl<'a> serde::ser::Serialize for __With<'a> {
5750                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5751                where
5752                    S: serde::ser::Serializer,
5753                {
5754                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5755                }
5756            }
5757            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5758        }
5759        if !self.page_token.is_empty() {
5760            state.serialize_entry("pageToken", &self.page_token)?;
5761        }
5762        if !wkt::internal::is_default(&self.show_deleted) {
5763            state.serialize_entry("showDeleted", &self.show_deleted)?;
5764        }
5765        if !self._unknown_fields.is_empty() {
5766            for (key, value) in self._unknown_fields.iter() {
5767                state.serialize_entry(key, &value)?;
5768            }
5769        }
5770        state.end()
5771    }
5772}
5773
5774/// Response message containing a list of Jobs.
5775#[derive(Clone, Debug, Default, PartialEq)]
5776#[non_exhaustive]
5777pub struct ListJobsResponse {
5778    /// The resulting list of Jobs.
5779    pub jobs: std::vec::Vec<crate::model::Job>,
5780
5781    /// A token indicating there are more items than page_size. Use it in the next
5782    /// ListJobs request to continue.
5783    pub next_page_token: std::string::String,
5784
5785    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5786}
5787
5788impl ListJobsResponse {
5789    pub fn new() -> Self {
5790        std::default::Default::default()
5791    }
5792
5793    /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
5794    pub fn set_jobs<T, V>(mut self, v: T) -> Self
5795    where
5796        T: std::iter::IntoIterator<Item = V>,
5797        V: std::convert::Into<crate::model::Job>,
5798    {
5799        use std::iter::Iterator;
5800        self.jobs = v.into_iter().map(|i| i.into()).collect();
5801        self
5802    }
5803
5804    /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
5805    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5806        self.next_page_token = v.into();
5807        self
5808    }
5809}
5810
5811impl wkt::message::Message for ListJobsResponse {
5812    fn typename() -> &'static str {
5813        "type.googleapis.com/google.cloud.run.v2.ListJobsResponse"
5814    }
5815}
5816
5817#[doc(hidden)]
5818impl gax::paginator::internal::PageableResponse for ListJobsResponse {
5819    type PageItem = crate::model::Job;
5820
5821    fn items(self) -> std::vec::Vec<Self::PageItem> {
5822        self.jobs
5823    }
5824
5825    fn next_page_token(&self) -> std::string::String {
5826        use std::clone::Clone;
5827        self.next_page_token.clone()
5828    }
5829}
5830
5831#[doc(hidden)]
5832impl<'de> serde::de::Deserialize<'de> for ListJobsResponse {
5833    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5834    where
5835        D: serde::Deserializer<'de>,
5836    {
5837        #[allow(non_camel_case_types)]
5838        #[doc(hidden)]
5839        #[derive(PartialEq, Eq, Hash)]
5840        enum __FieldTag {
5841            __jobs,
5842            __next_page_token,
5843            Unknown(std::string::String),
5844        }
5845        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5846            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5847            where
5848                D: serde::Deserializer<'de>,
5849            {
5850                struct Visitor;
5851                impl<'de> serde::de::Visitor<'de> for Visitor {
5852                    type Value = __FieldTag;
5853                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5854                        formatter.write_str("a field name for ListJobsResponse")
5855                    }
5856                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5857                    where
5858                        E: serde::de::Error,
5859                    {
5860                        use std::result::Result::Ok;
5861                        use std::string::ToString;
5862                        match value {
5863                            "jobs" => Ok(__FieldTag::__jobs),
5864                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
5865                            "next_page_token" => Ok(__FieldTag::__next_page_token),
5866                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5867                        }
5868                    }
5869                }
5870                deserializer.deserialize_identifier(Visitor)
5871            }
5872        }
5873        struct Visitor;
5874        impl<'de> serde::de::Visitor<'de> for Visitor {
5875            type Value = ListJobsResponse;
5876            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5877                formatter.write_str("struct ListJobsResponse")
5878            }
5879            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5880            where
5881                A: serde::de::MapAccess<'de>,
5882            {
5883                #[allow(unused_imports)]
5884                use serde::de::Error;
5885                use std::option::Option::Some;
5886                let mut fields = std::collections::HashSet::new();
5887                let mut result = Self::Value::new();
5888                while let Some(tag) = map.next_key::<__FieldTag>()? {
5889                    #[allow(clippy::match_single_binding)]
5890                    match tag {
5891                        __FieldTag::__jobs => {
5892                            if !fields.insert(__FieldTag::__jobs) {
5893                                return std::result::Result::Err(A::Error::duplicate_field(
5894                                    "multiple values for jobs",
5895                                ));
5896                            }
5897                            result.jobs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Job>>>()?.unwrap_or_default();
5898                        }
5899                        __FieldTag::__next_page_token => {
5900                            if !fields.insert(__FieldTag::__next_page_token) {
5901                                return std::result::Result::Err(A::Error::duplicate_field(
5902                                    "multiple values for next_page_token",
5903                                ));
5904                            }
5905                            result.next_page_token = map
5906                                .next_value::<std::option::Option<std::string::String>>()?
5907                                .unwrap_or_default();
5908                        }
5909                        __FieldTag::Unknown(key) => {
5910                            let value = map.next_value::<serde_json::Value>()?;
5911                            result._unknown_fields.insert(key, value);
5912                        }
5913                    }
5914                }
5915                std::result::Result::Ok(result)
5916            }
5917        }
5918        deserializer.deserialize_any(Visitor)
5919    }
5920}
5921
5922#[doc(hidden)]
5923impl serde::ser::Serialize for ListJobsResponse {
5924    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5925    where
5926        S: serde::ser::Serializer,
5927    {
5928        use serde::ser::SerializeMap;
5929        #[allow(unused_imports)]
5930        use std::option::Option::Some;
5931        let mut state = serializer.serialize_map(std::option::Option::None)?;
5932        if !self.jobs.is_empty() {
5933            state.serialize_entry("jobs", &self.jobs)?;
5934        }
5935        if !self.next_page_token.is_empty() {
5936            state.serialize_entry("nextPageToken", &self.next_page_token)?;
5937        }
5938        if !self._unknown_fields.is_empty() {
5939            for (key, value) in self._unknown_fields.iter() {
5940                state.serialize_entry(key, &value)?;
5941            }
5942        }
5943        state.end()
5944    }
5945}
5946
5947/// Request message to delete a Job by its full name.
5948#[derive(Clone, Debug, Default, PartialEq)]
5949#[non_exhaustive]
5950pub struct DeleteJobRequest {
5951    /// Required. The full name of the Job.
5952    /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
5953    /// can be project id or number.
5954    pub name: std::string::String,
5955
5956    /// Indicates that the request should be validated without actually
5957    /// deleting any resources.
5958    pub validate_only: bool,
5959
5960    /// A system-generated fingerprint for this version of the
5961    /// resource. May be used to detect modification conflict during updates.
5962    pub etag: std::string::String,
5963
5964    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5965}
5966
5967impl DeleteJobRequest {
5968    pub fn new() -> Self {
5969        std::default::Default::default()
5970    }
5971
5972    /// Sets the value of [name][crate::model::DeleteJobRequest::name].
5973    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5974        self.name = v.into();
5975        self
5976    }
5977
5978    /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
5979    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5980        self.validate_only = v.into();
5981        self
5982    }
5983
5984    /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
5985    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5986        self.etag = v.into();
5987        self
5988    }
5989}
5990
5991impl wkt::message::Message for DeleteJobRequest {
5992    fn typename() -> &'static str {
5993        "type.googleapis.com/google.cloud.run.v2.DeleteJobRequest"
5994    }
5995}
5996
5997#[doc(hidden)]
5998impl<'de> serde::de::Deserialize<'de> for DeleteJobRequest {
5999    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6000    where
6001        D: serde::Deserializer<'de>,
6002    {
6003        #[allow(non_camel_case_types)]
6004        #[doc(hidden)]
6005        #[derive(PartialEq, Eq, Hash)]
6006        enum __FieldTag {
6007            __name,
6008            __validate_only,
6009            __etag,
6010            Unknown(std::string::String),
6011        }
6012        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6013            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6014            where
6015                D: serde::Deserializer<'de>,
6016            {
6017                struct Visitor;
6018                impl<'de> serde::de::Visitor<'de> for Visitor {
6019                    type Value = __FieldTag;
6020                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6021                        formatter.write_str("a field name for DeleteJobRequest")
6022                    }
6023                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6024                    where
6025                        E: serde::de::Error,
6026                    {
6027                        use std::result::Result::Ok;
6028                        use std::string::ToString;
6029                        match value {
6030                            "name" => Ok(__FieldTag::__name),
6031                            "validateOnly" => Ok(__FieldTag::__validate_only),
6032                            "validate_only" => Ok(__FieldTag::__validate_only),
6033                            "etag" => Ok(__FieldTag::__etag),
6034                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6035                        }
6036                    }
6037                }
6038                deserializer.deserialize_identifier(Visitor)
6039            }
6040        }
6041        struct Visitor;
6042        impl<'de> serde::de::Visitor<'de> for Visitor {
6043            type Value = DeleteJobRequest;
6044            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6045                formatter.write_str("struct DeleteJobRequest")
6046            }
6047            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6048            where
6049                A: serde::de::MapAccess<'de>,
6050            {
6051                #[allow(unused_imports)]
6052                use serde::de::Error;
6053                use std::option::Option::Some;
6054                let mut fields = std::collections::HashSet::new();
6055                let mut result = Self::Value::new();
6056                while let Some(tag) = map.next_key::<__FieldTag>()? {
6057                    #[allow(clippy::match_single_binding)]
6058                    match tag {
6059                        __FieldTag::__name => {
6060                            if !fields.insert(__FieldTag::__name) {
6061                                return std::result::Result::Err(A::Error::duplicate_field(
6062                                    "multiple values for name",
6063                                ));
6064                            }
6065                            result.name = map
6066                                .next_value::<std::option::Option<std::string::String>>()?
6067                                .unwrap_or_default();
6068                        }
6069                        __FieldTag::__validate_only => {
6070                            if !fields.insert(__FieldTag::__validate_only) {
6071                                return std::result::Result::Err(A::Error::duplicate_field(
6072                                    "multiple values for validate_only",
6073                                ));
6074                            }
6075                            result.validate_only = map
6076                                .next_value::<std::option::Option<bool>>()?
6077                                .unwrap_or_default();
6078                        }
6079                        __FieldTag::__etag => {
6080                            if !fields.insert(__FieldTag::__etag) {
6081                                return std::result::Result::Err(A::Error::duplicate_field(
6082                                    "multiple values for etag",
6083                                ));
6084                            }
6085                            result.etag = map
6086                                .next_value::<std::option::Option<std::string::String>>()?
6087                                .unwrap_or_default();
6088                        }
6089                        __FieldTag::Unknown(key) => {
6090                            let value = map.next_value::<serde_json::Value>()?;
6091                            result._unknown_fields.insert(key, value);
6092                        }
6093                    }
6094                }
6095                std::result::Result::Ok(result)
6096            }
6097        }
6098        deserializer.deserialize_any(Visitor)
6099    }
6100}
6101
6102#[doc(hidden)]
6103impl serde::ser::Serialize for DeleteJobRequest {
6104    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6105    where
6106        S: serde::ser::Serializer,
6107    {
6108        use serde::ser::SerializeMap;
6109        #[allow(unused_imports)]
6110        use std::option::Option::Some;
6111        let mut state = serializer.serialize_map(std::option::Option::None)?;
6112        if !self.name.is_empty() {
6113            state.serialize_entry("name", &self.name)?;
6114        }
6115        if !wkt::internal::is_default(&self.validate_only) {
6116            state.serialize_entry("validateOnly", &self.validate_only)?;
6117        }
6118        if !self.etag.is_empty() {
6119            state.serialize_entry("etag", &self.etag)?;
6120        }
6121        if !self._unknown_fields.is_empty() {
6122            for (key, value) in self._unknown_fields.iter() {
6123                state.serialize_entry(key, &value)?;
6124            }
6125        }
6126        state.end()
6127    }
6128}
6129
6130/// Request message to create a new Execution of a Job.
6131#[derive(Clone, Debug, Default, PartialEq)]
6132#[non_exhaustive]
6133pub struct RunJobRequest {
6134    /// Required. The full name of the Job.
6135    /// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
6136    /// can be project id or number.
6137    pub name: std::string::String,
6138
6139    /// Indicates that the request should be validated without actually
6140    /// deleting any resources.
6141    pub validate_only: bool,
6142
6143    /// A system-generated fingerprint for this version of the
6144    /// resource. May be used to detect modification conflict during updates.
6145    pub etag: std::string::String,
6146
6147    /// Overrides specification for a given execution of a job. If provided,
6148    /// overrides will be applied to update the execution or task spec.
6149    pub overrides: std::option::Option<crate::model::run_job_request::Overrides>,
6150
6151    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6152}
6153
6154impl RunJobRequest {
6155    pub fn new() -> Self {
6156        std::default::Default::default()
6157    }
6158
6159    /// Sets the value of [name][crate::model::RunJobRequest::name].
6160    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6161        self.name = v.into();
6162        self
6163    }
6164
6165    /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
6166    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6167        self.validate_only = v.into();
6168        self
6169    }
6170
6171    /// Sets the value of [etag][crate::model::RunJobRequest::etag].
6172    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6173        self.etag = v.into();
6174        self
6175    }
6176
6177    /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
6178    pub fn set_overrides<T>(mut self, v: T) -> Self
6179    where
6180        T: std::convert::Into<crate::model::run_job_request::Overrides>,
6181    {
6182        self.overrides = std::option::Option::Some(v.into());
6183        self
6184    }
6185
6186    /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
6187    pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
6188    where
6189        T: std::convert::Into<crate::model::run_job_request::Overrides>,
6190    {
6191        self.overrides = v.map(|x| x.into());
6192        self
6193    }
6194}
6195
6196impl wkt::message::Message for RunJobRequest {
6197    fn typename() -> &'static str {
6198        "type.googleapis.com/google.cloud.run.v2.RunJobRequest"
6199    }
6200}
6201
6202#[doc(hidden)]
6203impl<'de> serde::de::Deserialize<'de> for RunJobRequest {
6204    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6205    where
6206        D: serde::Deserializer<'de>,
6207    {
6208        #[allow(non_camel_case_types)]
6209        #[doc(hidden)]
6210        #[derive(PartialEq, Eq, Hash)]
6211        enum __FieldTag {
6212            __name,
6213            __validate_only,
6214            __etag,
6215            __overrides,
6216            Unknown(std::string::String),
6217        }
6218        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6219            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6220            where
6221                D: serde::Deserializer<'de>,
6222            {
6223                struct Visitor;
6224                impl<'de> serde::de::Visitor<'de> for Visitor {
6225                    type Value = __FieldTag;
6226                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6227                        formatter.write_str("a field name for RunJobRequest")
6228                    }
6229                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6230                    where
6231                        E: serde::de::Error,
6232                    {
6233                        use std::result::Result::Ok;
6234                        use std::string::ToString;
6235                        match value {
6236                            "name" => Ok(__FieldTag::__name),
6237                            "validateOnly" => Ok(__FieldTag::__validate_only),
6238                            "validate_only" => Ok(__FieldTag::__validate_only),
6239                            "etag" => Ok(__FieldTag::__etag),
6240                            "overrides" => Ok(__FieldTag::__overrides),
6241                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6242                        }
6243                    }
6244                }
6245                deserializer.deserialize_identifier(Visitor)
6246            }
6247        }
6248        struct Visitor;
6249        impl<'de> serde::de::Visitor<'de> for Visitor {
6250            type Value = RunJobRequest;
6251            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6252                formatter.write_str("struct RunJobRequest")
6253            }
6254            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6255            where
6256                A: serde::de::MapAccess<'de>,
6257            {
6258                #[allow(unused_imports)]
6259                use serde::de::Error;
6260                use std::option::Option::Some;
6261                let mut fields = std::collections::HashSet::new();
6262                let mut result = Self::Value::new();
6263                while let Some(tag) = map.next_key::<__FieldTag>()? {
6264                    #[allow(clippy::match_single_binding)]
6265                    match tag {
6266                        __FieldTag::__name => {
6267                            if !fields.insert(__FieldTag::__name) {
6268                                return std::result::Result::Err(A::Error::duplicate_field(
6269                                    "multiple values for name",
6270                                ));
6271                            }
6272                            result.name = map
6273                                .next_value::<std::option::Option<std::string::String>>()?
6274                                .unwrap_or_default();
6275                        }
6276                        __FieldTag::__validate_only => {
6277                            if !fields.insert(__FieldTag::__validate_only) {
6278                                return std::result::Result::Err(A::Error::duplicate_field(
6279                                    "multiple values for validate_only",
6280                                ));
6281                            }
6282                            result.validate_only = map
6283                                .next_value::<std::option::Option<bool>>()?
6284                                .unwrap_or_default();
6285                        }
6286                        __FieldTag::__etag => {
6287                            if !fields.insert(__FieldTag::__etag) {
6288                                return std::result::Result::Err(A::Error::duplicate_field(
6289                                    "multiple values for etag",
6290                                ));
6291                            }
6292                            result.etag = map
6293                                .next_value::<std::option::Option<std::string::String>>()?
6294                                .unwrap_or_default();
6295                        }
6296                        __FieldTag::__overrides => {
6297                            if !fields.insert(__FieldTag::__overrides) {
6298                                return std::result::Result::Err(A::Error::duplicate_field(
6299                                    "multiple values for overrides",
6300                                ));
6301                            }
6302                            result.overrides = map.next_value::<std::option::Option<crate::model::run_job_request::Overrides>>()?
6303                                ;
6304                        }
6305                        __FieldTag::Unknown(key) => {
6306                            let value = map.next_value::<serde_json::Value>()?;
6307                            result._unknown_fields.insert(key, value);
6308                        }
6309                    }
6310                }
6311                std::result::Result::Ok(result)
6312            }
6313        }
6314        deserializer.deserialize_any(Visitor)
6315    }
6316}
6317
6318#[doc(hidden)]
6319impl serde::ser::Serialize for RunJobRequest {
6320    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6321    where
6322        S: serde::ser::Serializer,
6323    {
6324        use serde::ser::SerializeMap;
6325        #[allow(unused_imports)]
6326        use std::option::Option::Some;
6327        let mut state = serializer.serialize_map(std::option::Option::None)?;
6328        if !self.name.is_empty() {
6329            state.serialize_entry("name", &self.name)?;
6330        }
6331        if !wkt::internal::is_default(&self.validate_only) {
6332            state.serialize_entry("validateOnly", &self.validate_only)?;
6333        }
6334        if !self.etag.is_empty() {
6335            state.serialize_entry("etag", &self.etag)?;
6336        }
6337        if self.overrides.is_some() {
6338            state.serialize_entry("overrides", &self.overrides)?;
6339        }
6340        if !self._unknown_fields.is_empty() {
6341            for (key, value) in self._unknown_fields.iter() {
6342                state.serialize_entry(key, &value)?;
6343            }
6344        }
6345        state.end()
6346    }
6347}
6348
6349/// Defines additional types related to [RunJobRequest].
6350pub mod run_job_request {
6351    #[allow(unused_imports)]
6352    use super::*;
6353
6354    /// RunJob Overrides that contains Execution fields to be overridden.
6355    #[derive(Clone, Debug, Default, PartialEq)]
6356    #[non_exhaustive]
6357    pub struct Overrides {
6358        /// Per container override specification.
6359        pub container_overrides:
6360            std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>,
6361
6362        /// Optional. The desired number of tasks the execution should run. Will
6363        /// replace existing task_count value.
6364        pub task_count: i32,
6365
6366        /// Duration in seconds the task may be active before the system will
6367        /// actively try to mark it failed and kill associated containers. Will
6368        /// replace existing timeout_seconds value.
6369        pub timeout: std::option::Option<wkt::Duration>,
6370
6371        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6372    }
6373
6374    impl Overrides {
6375        pub fn new() -> Self {
6376            std::default::Default::default()
6377        }
6378
6379        /// Sets the value of [container_overrides][crate::model::run_job_request::Overrides::container_overrides].
6380        pub fn set_container_overrides<T, V>(mut self, v: T) -> Self
6381        where
6382            T: std::iter::IntoIterator<Item = V>,
6383            V: std::convert::Into<crate::model::run_job_request::overrides::ContainerOverride>,
6384        {
6385            use std::iter::Iterator;
6386            self.container_overrides = v.into_iter().map(|i| i.into()).collect();
6387            self
6388        }
6389
6390        /// Sets the value of [task_count][crate::model::run_job_request::Overrides::task_count].
6391        pub fn set_task_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6392            self.task_count = v.into();
6393            self
6394        }
6395
6396        /// Sets the value of [timeout][crate::model::run_job_request::Overrides::timeout].
6397        pub fn set_timeout<T>(mut self, v: T) -> Self
6398        where
6399            T: std::convert::Into<wkt::Duration>,
6400        {
6401            self.timeout = std::option::Option::Some(v.into());
6402            self
6403        }
6404
6405        /// Sets or clears the value of [timeout][crate::model::run_job_request::Overrides::timeout].
6406        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6407        where
6408            T: std::convert::Into<wkt::Duration>,
6409        {
6410            self.timeout = v.map(|x| x.into());
6411            self
6412        }
6413    }
6414
6415    impl wkt::message::Message for Overrides {
6416        fn typename() -> &'static str {
6417            "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides"
6418        }
6419    }
6420
6421    #[doc(hidden)]
6422    impl<'de> serde::de::Deserialize<'de> for Overrides {
6423        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6424        where
6425            D: serde::Deserializer<'de>,
6426        {
6427            #[allow(non_camel_case_types)]
6428            #[doc(hidden)]
6429            #[derive(PartialEq, Eq, Hash)]
6430            enum __FieldTag {
6431                __container_overrides,
6432                __task_count,
6433                __timeout,
6434                Unknown(std::string::String),
6435            }
6436            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6437                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6438                where
6439                    D: serde::Deserializer<'de>,
6440                {
6441                    struct Visitor;
6442                    impl<'de> serde::de::Visitor<'de> for Visitor {
6443                        type Value = __FieldTag;
6444                        fn expecting(
6445                            &self,
6446                            formatter: &mut std::fmt::Formatter,
6447                        ) -> std::fmt::Result {
6448                            formatter.write_str("a field name for Overrides")
6449                        }
6450                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6451                        where
6452                            E: serde::de::Error,
6453                        {
6454                            use std::result::Result::Ok;
6455                            use std::string::ToString;
6456                            match value {
6457                                "containerOverrides" => Ok(__FieldTag::__container_overrides),
6458                                "container_overrides" => Ok(__FieldTag::__container_overrides),
6459                                "taskCount" => Ok(__FieldTag::__task_count),
6460                                "task_count" => Ok(__FieldTag::__task_count),
6461                                "timeout" => Ok(__FieldTag::__timeout),
6462                                _ => Ok(__FieldTag::Unknown(value.to_string())),
6463                            }
6464                        }
6465                    }
6466                    deserializer.deserialize_identifier(Visitor)
6467                }
6468            }
6469            struct Visitor;
6470            impl<'de> serde::de::Visitor<'de> for Visitor {
6471                type Value = Overrides;
6472                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6473                    formatter.write_str("struct Overrides")
6474                }
6475                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6476                where
6477                    A: serde::de::MapAccess<'de>,
6478                {
6479                    #[allow(unused_imports)]
6480                    use serde::de::Error;
6481                    use std::option::Option::Some;
6482                    let mut fields = std::collections::HashSet::new();
6483                    let mut result = Self::Value::new();
6484                    while let Some(tag) = map.next_key::<__FieldTag>()? {
6485                        #[allow(clippy::match_single_binding)]
6486                        match tag {
6487                            __FieldTag::__container_overrides => {
6488                                if !fields.insert(__FieldTag::__container_overrides) {
6489                                    return std::result::Result::Err(A::Error::duplicate_field(
6490                                        "multiple values for container_overrides",
6491                                    ));
6492                                }
6493                                result.container_overrides = map.next_value::<std::option::Option<std::vec::Vec<crate::model::run_job_request::overrides::ContainerOverride>>>()?.unwrap_or_default();
6494                            }
6495                            __FieldTag::__task_count => {
6496                                if !fields.insert(__FieldTag::__task_count) {
6497                                    return std::result::Result::Err(A::Error::duplicate_field(
6498                                        "multiple values for task_count",
6499                                    ));
6500                                }
6501                                struct __With(std::option::Option<i32>);
6502                                impl<'de> serde::de::Deserialize<'de> for __With {
6503                                    fn deserialize<D>(
6504                                        deserializer: D,
6505                                    ) -> std::result::Result<Self, D::Error>
6506                                    where
6507                                        D: serde::de::Deserializer<'de>,
6508                                    {
6509                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6510                                    }
6511                                }
6512                                result.task_count =
6513                                    map.next_value::<__With>()?.0.unwrap_or_default();
6514                            }
6515                            __FieldTag::__timeout => {
6516                                if !fields.insert(__FieldTag::__timeout) {
6517                                    return std::result::Result::Err(A::Error::duplicate_field(
6518                                        "multiple values for timeout",
6519                                    ));
6520                                }
6521                                result.timeout =
6522                                    map.next_value::<std::option::Option<wkt::Duration>>()?;
6523                            }
6524                            __FieldTag::Unknown(key) => {
6525                                let value = map.next_value::<serde_json::Value>()?;
6526                                result._unknown_fields.insert(key, value);
6527                            }
6528                        }
6529                    }
6530                    std::result::Result::Ok(result)
6531                }
6532            }
6533            deserializer.deserialize_any(Visitor)
6534        }
6535    }
6536
6537    #[doc(hidden)]
6538    impl serde::ser::Serialize for Overrides {
6539        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6540        where
6541            S: serde::ser::Serializer,
6542        {
6543            use serde::ser::SerializeMap;
6544            #[allow(unused_imports)]
6545            use std::option::Option::Some;
6546            let mut state = serializer.serialize_map(std::option::Option::None)?;
6547            if !self.container_overrides.is_empty() {
6548                state.serialize_entry("containerOverrides", &self.container_overrides)?;
6549            }
6550            if !wkt::internal::is_default(&self.task_count) {
6551                struct __With<'a>(&'a i32);
6552                impl<'a> serde::ser::Serialize for __With<'a> {
6553                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6554                    where
6555                        S: serde::ser::Serializer,
6556                    {
6557                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6558                    }
6559                }
6560                state.serialize_entry("taskCount", &__With(&self.task_count))?;
6561            }
6562            if self.timeout.is_some() {
6563                state.serialize_entry("timeout", &self.timeout)?;
6564            }
6565            if !self._unknown_fields.is_empty() {
6566                for (key, value) in self._unknown_fields.iter() {
6567                    state.serialize_entry(key, &value)?;
6568                }
6569            }
6570            state.end()
6571        }
6572    }
6573
6574    /// Defines additional types related to [Overrides].
6575    pub mod overrides {
6576        #[allow(unused_imports)]
6577        use super::*;
6578
6579        /// Per-container override specification.
6580        #[derive(Clone, Debug, Default, PartialEq)]
6581        #[non_exhaustive]
6582        pub struct ContainerOverride {
6583            /// The name of the container specified as a DNS_LABEL.
6584            pub name: std::string::String,
6585
6586            /// Optional. Arguments to the entrypoint. Will replace existing args for
6587            /// override.
6588            pub args: std::vec::Vec<std::string::String>,
6589
6590            /// List of environment variables to set in the container. Will be merged
6591            /// with existing env for override.
6592            pub env: std::vec::Vec<crate::model::EnvVar>,
6593
6594            /// Optional. True if the intention is to clear out existing args list.
6595            pub clear_args: bool,
6596
6597            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6598        }
6599
6600        impl ContainerOverride {
6601            pub fn new() -> Self {
6602                std::default::Default::default()
6603            }
6604
6605            /// Sets the value of [name][crate::model::run_job_request::overrides::ContainerOverride::name].
6606            pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6607                self.name = v.into();
6608                self
6609            }
6610
6611            /// Sets the value of [args][crate::model::run_job_request::overrides::ContainerOverride::args].
6612            pub fn set_args<T, V>(mut self, v: T) -> Self
6613            where
6614                T: std::iter::IntoIterator<Item = V>,
6615                V: std::convert::Into<std::string::String>,
6616            {
6617                use std::iter::Iterator;
6618                self.args = v.into_iter().map(|i| i.into()).collect();
6619                self
6620            }
6621
6622            /// Sets the value of [env][crate::model::run_job_request::overrides::ContainerOverride::env].
6623            pub fn set_env<T, V>(mut self, v: T) -> Self
6624            where
6625                T: std::iter::IntoIterator<Item = V>,
6626                V: std::convert::Into<crate::model::EnvVar>,
6627            {
6628                use std::iter::Iterator;
6629                self.env = v.into_iter().map(|i| i.into()).collect();
6630                self
6631            }
6632
6633            /// Sets the value of [clear_args][crate::model::run_job_request::overrides::ContainerOverride::clear_args].
6634            pub fn set_clear_args<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6635                self.clear_args = v.into();
6636                self
6637            }
6638        }
6639
6640        impl wkt::message::Message for ContainerOverride {
6641            fn typename() -> &'static str {
6642                "type.googleapis.com/google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride"
6643            }
6644        }
6645
6646        #[doc(hidden)]
6647        impl<'de> serde::de::Deserialize<'de> for ContainerOverride {
6648            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6649            where
6650                D: serde::Deserializer<'de>,
6651            {
6652                #[allow(non_camel_case_types)]
6653                #[doc(hidden)]
6654                #[derive(PartialEq, Eq, Hash)]
6655                enum __FieldTag {
6656                    __name,
6657                    __args,
6658                    __env,
6659                    __clear_args,
6660                    Unknown(std::string::String),
6661                }
6662                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6663                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6664                    where
6665                        D: serde::Deserializer<'de>,
6666                    {
6667                        struct Visitor;
6668                        impl<'de> serde::de::Visitor<'de> for Visitor {
6669                            type Value = __FieldTag;
6670                            fn expecting(
6671                                &self,
6672                                formatter: &mut std::fmt::Formatter,
6673                            ) -> std::fmt::Result {
6674                                formatter.write_str("a field name for ContainerOverride")
6675                            }
6676                            fn visit_str<E>(
6677                                self,
6678                                value: &str,
6679                            ) -> std::result::Result<Self::Value, E>
6680                            where
6681                                E: serde::de::Error,
6682                            {
6683                                use std::result::Result::Ok;
6684                                use std::string::ToString;
6685                                match value {
6686                                    "name" => Ok(__FieldTag::__name),
6687                                    "args" => Ok(__FieldTag::__args),
6688                                    "env" => Ok(__FieldTag::__env),
6689                                    "clearArgs" => Ok(__FieldTag::__clear_args),
6690                                    "clear_args" => Ok(__FieldTag::__clear_args),
6691                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
6692                                }
6693                            }
6694                        }
6695                        deserializer.deserialize_identifier(Visitor)
6696                    }
6697                }
6698                struct Visitor;
6699                impl<'de> serde::de::Visitor<'de> for Visitor {
6700                    type Value = ContainerOverride;
6701                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6702                        formatter.write_str("struct ContainerOverride")
6703                    }
6704                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6705                    where
6706                        A: serde::de::MapAccess<'de>,
6707                    {
6708                        #[allow(unused_imports)]
6709                        use serde::de::Error;
6710                        use std::option::Option::Some;
6711                        let mut fields = std::collections::HashSet::new();
6712                        let mut result = Self::Value::new();
6713                        while let Some(tag) = map.next_key::<__FieldTag>()? {
6714                            #[allow(clippy::match_single_binding)]
6715                            match tag {
6716                                __FieldTag::__name => {
6717                                    if !fields.insert(__FieldTag::__name) {
6718                                        return std::result::Result::Err(
6719                                            A::Error::duplicate_field("multiple values for name"),
6720                                        );
6721                                    }
6722                                    result.name = map
6723                                        .next_value::<std::option::Option<std::string::String>>()?
6724                                        .unwrap_or_default();
6725                                }
6726                                __FieldTag::__args => {
6727                                    if !fields.insert(__FieldTag::__args) {
6728                                        return std::result::Result::Err(
6729                                            A::Error::duplicate_field("multiple values for args"),
6730                                        );
6731                                    }
6732                                    result.args = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6733                                }
6734                                __FieldTag::__env => {
6735                                    if !fields.insert(__FieldTag::__env) {
6736                                        return std::result::Result::Err(
6737                                            A::Error::duplicate_field("multiple values for env"),
6738                                        );
6739                                    }
6740                                    result.env =
6741                                        map.next_value::<std::option::Option<
6742                                            std::vec::Vec<crate::model::EnvVar>,
6743                                        >>()?
6744                                        .unwrap_or_default();
6745                                }
6746                                __FieldTag::__clear_args => {
6747                                    if !fields.insert(__FieldTag::__clear_args) {
6748                                        return std::result::Result::Err(
6749                                            A::Error::duplicate_field(
6750                                                "multiple values for clear_args",
6751                                            ),
6752                                        );
6753                                    }
6754                                    result.clear_args = map
6755                                        .next_value::<std::option::Option<bool>>()?
6756                                        .unwrap_or_default();
6757                                }
6758                                __FieldTag::Unknown(key) => {
6759                                    let value = map.next_value::<serde_json::Value>()?;
6760                                    result._unknown_fields.insert(key, value);
6761                                }
6762                            }
6763                        }
6764                        std::result::Result::Ok(result)
6765                    }
6766                }
6767                deserializer.deserialize_any(Visitor)
6768            }
6769        }
6770
6771        #[doc(hidden)]
6772        impl serde::ser::Serialize for ContainerOverride {
6773            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6774            where
6775                S: serde::ser::Serializer,
6776            {
6777                use serde::ser::SerializeMap;
6778                #[allow(unused_imports)]
6779                use std::option::Option::Some;
6780                let mut state = serializer.serialize_map(std::option::Option::None)?;
6781                if !self.name.is_empty() {
6782                    state.serialize_entry("name", &self.name)?;
6783                }
6784                if !self.args.is_empty() {
6785                    state.serialize_entry("args", &self.args)?;
6786                }
6787                if !self.env.is_empty() {
6788                    state.serialize_entry("env", &self.env)?;
6789                }
6790                if !wkt::internal::is_default(&self.clear_args) {
6791                    state.serialize_entry("clearArgs", &self.clear_args)?;
6792                }
6793                if !self._unknown_fields.is_empty() {
6794                    for (key, value) in self._unknown_fields.iter() {
6795                        state.serialize_entry(key, &value)?;
6796                    }
6797                }
6798                state.end()
6799            }
6800        }
6801    }
6802}
6803
6804/// Job represents the configuration of a single job, which references a
6805/// container image that is run to completion.
6806#[derive(Clone, Debug, Default, PartialEq)]
6807#[non_exhaustive]
6808pub struct Job {
6809    /// The fully qualified name of this Job.
6810    ///
6811    /// Format:
6812    /// projects/{project}/locations/{location}/jobs/{job}
6813    pub name: std::string::String,
6814
6815    /// Output only. Server assigned unique identifier for the Execution. The value
6816    /// is a UUID4 string and guaranteed to remain unchanged until the resource is
6817    /// deleted.
6818    pub uid: std::string::String,
6819
6820    /// Output only. A number that monotonically increases every time the user
6821    /// modifies the desired state.
6822    pub generation: i64,
6823
6824    /// Unstructured key value map that can be used to organize and categorize
6825    /// objects.
6826    /// User-provided labels are shared with Google's billing system, so they can
6827    /// be used to filter, or break down billing charges by team, component,
6828    /// environment, state, etc. For more information, visit
6829    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
6830    /// <https://cloud.google.com/run/docs/configuring/labels>.
6831    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6832
6833    /// Unstructured key value map that may
6834    /// be set by external tools to store and arbitrary metadata.
6835    /// They are not queryable and should be preserved
6836    /// when modifying objects.
6837    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
6838
6839    /// Output only. The creation time.
6840    pub create_time: std::option::Option<wkt::Timestamp>,
6841
6842    /// Output only. The last-modified time.
6843    pub update_time: std::option::Option<wkt::Timestamp>,
6844
6845    /// Output only. The deletion time. It is only populated as a response to a
6846    /// Delete request.
6847    pub delete_time: std::option::Option<wkt::Timestamp>,
6848
6849    /// Output only. For a deleted resource, the time after which it will be
6850    /// permamently deleted.
6851    pub expire_time: std::option::Option<wkt::Timestamp>,
6852
6853    /// Output only. Email address of the authenticated creator.
6854    pub creator: std::string::String,
6855
6856    /// Output only. Email address of the last authenticated modifier.
6857    pub last_modifier: std::string::String,
6858
6859    /// Arbitrary identifier for the API client.
6860    pub client: std::string::String,
6861
6862    /// Arbitrary version identifier for the API client.
6863    pub client_version: std::string::String,
6864
6865    /// The launch stage as defined by [Google Cloud Platform
6866    /// Launch Stages](https://cloud.google.com/terms/launch-stages).
6867    /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
6868    /// is assumed.
6869    /// Set the launch stage to a preview stage on input to allow use of preview
6870    /// features in that stage. On read (or output), describes whether the resource
6871    /// uses preview features.
6872    ///
6873    /// For example, if ALPHA is provided as input, but only BETA and GA-level
6874    /// features are used, this field will be BETA on output.
6875    pub launch_stage: api::model::LaunchStage,
6876
6877    /// Settings for the Binary Authorization feature.
6878    pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
6879
6880    /// Required. The template used to create executions for this Job.
6881    pub template: std::option::Option<crate::model::ExecutionTemplate>,
6882
6883    /// Output only. The generation of this Job. See comments in `reconciling` for
6884    /// additional information on reconciliation process in Cloud Run.
6885    pub observed_generation: i64,
6886
6887    /// Output only. The Condition of this Job, containing its readiness status,
6888    /// and detailed error information in case it did not reach the desired state.
6889    pub terminal_condition: std::option::Option<crate::model::Condition>,
6890
6891    /// Output only. The Conditions of all other associated sub-resources. They
6892    /// contain additional diagnostics information in case the Job does not reach
6893    /// its desired state. See comments in `reconciling` for additional information
6894    /// on reconciliation process in Cloud Run.
6895    pub conditions: std::vec::Vec<crate::model::Condition>,
6896
6897    /// Output only. Number of executions created for this job.
6898    pub execution_count: i32,
6899
6900    /// Output only. Name of the last created execution.
6901    pub latest_created_execution: std::option::Option<crate::model::ExecutionReference>,
6902
6903    /// Output only. Returns true if the Job is currently being acted upon by the
6904    /// system to bring it into the desired state.
6905    ///
6906    /// When a new Job is created, or an existing one is updated, Cloud Run
6907    /// will asynchronously perform all necessary steps to bring the Job to the
6908    /// desired state. This process is called reconciliation.
6909    /// While reconciliation is in process, `observed_generation` and
6910    /// `latest_succeeded_execution`, will have transient values that might
6911    /// mismatch the intended state: Once reconciliation is over (and this field is
6912    /// false), there are two possible outcomes: reconciliation succeeded and the
6913    /// state matches the Job, or there was an error,  and reconciliation failed.
6914    /// This state can be found in `terminal_condition.state`.
6915    ///
6916    /// If reconciliation succeeded, the following fields will match:
6917    /// `observed_generation` and `generation`, `latest_succeeded_execution` and
6918    /// `latest_created_execution`.
6919    ///
6920    /// If reconciliation failed, `observed_generation` and
6921    /// `latest_succeeded_execution` will have the state of the last succeeded
6922    /// execution or empty for newly created Job. Additional information on the
6923    /// failure can be found in `terminal_condition` and `conditions`.
6924    pub reconciling: bool,
6925
6926    /// Output only. Reserved for future use.
6927    pub satisfies_pzs: bool,
6928
6929    /// Output only. A system-generated fingerprint for this version of the
6930    /// resource. May be used to detect modification conflict during updates.
6931    pub etag: std::string::String,
6932
6933    pub create_execution: std::option::Option<crate::model::job::CreateExecution>,
6934
6935    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6936}
6937
6938impl Job {
6939    pub fn new() -> Self {
6940        std::default::Default::default()
6941    }
6942
6943    /// Sets the value of [name][crate::model::Job::name].
6944    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6945        self.name = v.into();
6946        self
6947    }
6948
6949    /// Sets the value of [uid][crate::model::Job::uid].
6950    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6951        self.uid = v.into();
6952        self
6953    }
6954
6955    /// Sets the value of [generation][crate::model::Job::generation].
6956    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6957        self.generation = v.into();
6958        self
6959    }
6960
6961    /// Sets the value of [labels][crate::model::Job::labels].
6962    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6963    where
6964        T: std::iter::IntoIterator<Item = (K, V)>,
6965        K: std::convert::Into<std::string::String>,
6966        V: std::convert::Into<std::string::String>,
6967    {
6968        use std::iter::Iterator;
6969        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6970        self
6971    }
6972
6973    /// Sets the value of [annotations][crate::model::Job::annotations].
6974    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
6975    where
6976        T: std::iter::IntoIterator<Item = (K, V)>,
6977        K: std::convert::Into<std::string::String>,
6978        V: std::convert::Into<std::string::String>,
6979    {
6980        use std::iter::Iterator;
6981        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6982        self
6983    }
6984
6985    /// Sets the value of [create_time][crate::model::Job::create_time].
6986    pub fn set_create_time<T>(mut self, v: T) -> Self
6987    where
6988        T: std::convert::Into<wkt::Timestamp>,
6989    {
6990        self.create_time = std::option::Option::Some(v.into());
6991        self
6992    }
6993
6994    /// Sets or clears the value of [create_time][crate::model::Job::create_time].
6995    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6996    where
6997        T: std::convert::Into<wkt::Timestamp>,
6998    {
6999        self.create_time = v.map(|x| x.into());
7000        self
7001    }
7002
7003    /// Sets the value of [update_time][crate::model::Job::update_time].
7004    pub fn set_update_time<T>(mut self, v: T) -> Self
7005    where
7006        T: std::convert::Into<wkt::Timestamp>,
7007    {
7008        self.update_time = std::option::Option::Some(v.into());
7009        self
7010    }
7011
7012    /// Sets or clears the value of [update_time][crate::model::Job::update_time].
7013    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7014    where
7015        T: std::convert::Into<wkt::Timestamp>,
7016    {
7017        self.update_time = v.map(|x| x.into());
7018        self
7019    }
7020
7021    /// Sets the value of [delete_time][crate::model::Job::delete_time].
7022    pub fn set_delete_time<T>(mut self, v: T) -> Self
7023    where
7024        T: std::convert::Into<wkt::Timestamp>,
7025    {
7026        self.delete_time = std::option::Option::Some(v.into());
7027        self
7028    }
7029
7030    /// Sets or clears the value of [delete_time][crate::model::Job::delete_time].
7031    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
7032    where
7033        T: std::convert::Into<wkt::Timestamp>,
7034    {
7035        self.delete_time = v.map(|x| x.into());
7036        self
7037    }
7038
7039    /// Sets the value of [expire_time][crate::model::Job::expire_time].
7040    pub fn set_expire_time<T>(mut self, v: T) -> Self
7041    where
7042        T: std::convert::Into<wkt::Timestamp>,
7043    {
7044        self.expire_time = std::option::Option::Some(v.into());
7045        self
7046    }
7047
7048    /// Sets or clears the value of [expire_time][crate::model::Job::expire_time].
7049    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7050    where
7051        T: std::convert::Into<wkt::Timestamp>,
7052    {
7053        self.expire_time = v.map(|x| x.into());
7054        self
7055    }
7056
7057    /// Sets the value of [creator][crate::model::Job::creator].
7058    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7059        self.creator = v.into();
7060        self
7061    }
7062
7063    /// Sets the value of [last_modifier][crate::model::Job::last_modifier].
7064    pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7065        self.last_modifier = v.into();
7066        self
7067    }
7068
7069    /// Sets the value of [client][crate::model::Job::client].
7070    pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7071        self.client = v.into();
7072        self
7073    }
7074
7075    /// Sets the value of [client_version][crate::model::Job::client_version].
7076    pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7077        self.client_version = v.into();
7078        self
7079    }
7080
7081    /// Sets the value of [launch_stage][crate::model::Job::launch_stage].
7082    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
7083        mut self,
7084        v: T,
7085    ) -> Self {
7086        self.launch_stage = v.into();
7087        self
7088    }
7089
7090    /// Sets the value of [binary_authorization][crate::model::Job::binary_authorization].
7091    pub fn set_binary_authorization<T>(mut self, v: T) -> Self
7092    where
7093        T: std::convert::Into<crate::model::BinaryAuthorization>,
7094    {
7095        self.binary_authorization = std::option::Option::Some(v.into());
7096        self
7097    }
7098
7099    /// Sets or clears the value of [binary_authorization][crate::model::Job::binary_authorization].
7100    pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
7101    where
7102        T: std::convert::Into<crate::model::BinaryAuthorization>,
7103    {
7104        self.binary_authorization = v.map(|x| x.into());
7105        self
7106    }
7107
7108    /// Sets the value of [template][crate::model::Job::template].
7109    pub fn set_template<T>(mut self, v: T) -> Self
7110    where
7111        T: std::convert::Into<crate::model::ExecutionTemplate>,
7112    {
7113        self.template = std::option::Option::Some(v.into());
7114        self
7115    }
7116
7117    /// Sets or clears the value of [template][crate::model::Job::template].
7118    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
7119    where
7120        T: std::convert::Into<crate::model::ExecutionTemplate>,
7121    {
7122        self.template = v.map(|x| x.into());
7123        self
7124    }
7125
7126    /// Sets the value of [observed_generation][crate::model::Job::observed_generation].
7127    pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7128        self.observed_generation = v.into();
7129        self
7130    }
7131
7132    /// Sets the value of [terminal_condition][crate::model::Job::terminal_condition].
7133    pub fn set_terminal_condition<T>(mut self, v: T) -> Self
7134    where
7135        T: std::convert::Into<crate::model::Condition>,
7136    {
7137        self.terminal_condition = std::option::Option::Some(v.into());
7138        self
7139    }
7140
7141    /// Sets or clears the value of [terminal_condition][crate::model::Job::terminal_condition].
7142    pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
7143    where
7144        T: std::convert::Into<crate::model::Condition>,
7145    {
7146        self.terminal_condition = v.map(|x| x.into());
7147        self
7148    }
7149
7150    /// Sets the value of [conditions][crate::model::Job::conditions].
7151    pub fn set_conditions<T, V>(mut self, v: T) -> Self
7152    where
7153        T: std::iter::IntoIterator<Item = V>,
7154        V: std::convert::Into<crate::model::Condition>,
7155    {
7156        use std::iter::Iterator;
7157        self.conditions = v.into_iter().map(|i| i.into()).collect();
7158        self
7159    }
7160
7161    /// Sets the value of [execution_count][crate::model::Job::execution_count].
7162    pub fn set_execution_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7163        self.execution_count = v.into();
7164        self
7165    }
7166
7167    /// Sets the value of [latest_created_execution][crate::model::Job::latest_created_execution].
7168    pub fn set_latest_created_execution<T>(mut self, v: T) -> Self
7169    where
7170        T: std::convert::Into<crate::model::ExecutionReference>,
7171    {
7172        self.latest_created_execution = std::option::Option::Some(v.into());
7173        self
7174    }
7175
7176    /// Sets or clears the value of [latest_created_execution][crate::model::Job::latest_created_execution].
7177    pub fn set_or_clear_latest_created_execution<T>(mut self, v: std::option::Option<T>) -> Self
7178    where
7179        T: std::convert::Into<crate::model::ExecutionReference>,
7180    {
7181        self.latest_created_execution = v.map(|x| x.into());
7182        self
7183    }
7184
7185    /// Sets the value of [reconciling][crate::model::Job::reconciling].
7186    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7187        self.reconciling = v.into();
7188        self
7189    }
7190
7191    /// Sets the value of [satisfies_pzs][crate::model::Job::satisfies_pzs].
7192    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7193        self.satisfies_pzs = v.into();
7194        self
7195    }
7196
7197    /// Sets the value of [etag][crate::model::Job::etag].
7198    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7199        self.etag = v.into();
7200        self
7201    }
7202
7203    /// Sets the value of [create_execution][crate::model::Job::create_execution].
7204    ///
7205    /// Note that all the setters affecting `create_execution` are mutually
7206    /// exclusive.
7207    pub fn set_create_execution<
7208        T: std::convert::Into<std::option::Option<crate::model::job::CreateExecution>>,
7209    >(
7210        mut self,
7211        v: T,
7212    ) -> Self {
7213        self.create_execution = v.into();
7214        self
7215    }
7216
7217    /// The value of [create_execution][crate::model::Job::create_execution]
7218    /// if it holds a `StartExecutionToken`, `None` if the field is not set or
7219    /// holds a different branch.
7220    pub fn start_execution_token(&self) -> std::option::Option<&std::string::String> {
7221        #[allow(unreachable_patterns)]
7222        self.create_execution.as_ref().and_then(|v| match v {
7223            crate::model::job::CreateExecution::StartExecutionToken(v) => {
7224                std::option::Option::Some(v)
7225            }
7226            _ => std::option::Option::None,
7227        })
7228    }
7229
7230    /// Sets the value of [create_execution][crate::model::Job::create_execution]
7231    /// to hold a `StartExecutionToken`.
7232    ///
7233    /// Note that all the setters affecting `create_execution` are
7234    /// mutually exclusive.
7235    pub fn set_start_execution_token<T: std::convert::Into<std::string::String>>(
7236        mut self,
7237        v: T,
7238    ) -> Self {
7239        self.create_execution = std::option::Option::Some(
7240            crate::model::job::CreateExecution::StartExecutionToken(v.into()),
7241        );
7242        self
7243    }
7244
7245    /// The value of [create_execution][crate::model::Job::create_execution]
7246    /// if it holds a `RunExecutionToken`, `None` if the field is not set or
7247    /// holds a different branch.
7248    pub fn run_execution_token(&self) -> std::option::Option<&std::string::String> {
7249        #[allow(unreachable_patterns)]
7250        self.create_execution.as_ref().and_then(|v| match v {
7251            crate::model::job::CreateExecution::RunExecutionToken(v) => {
7252                std::option::Option::Some(v)
7253            }
7254            _ => std::option::Option::None,
7255        })
7256    }
7257
7258    /// Sets the value of [create_execution][crate::model::Job::create_execution]
7259    /// to hold a `RunExecutionToken`.
7260    ///
7261    /// Note that all the setters affecting `create_execution` are
7262    /// mutually exclusive.
7263    pub fn set_run_execution_token<T: std::convert::Into<std::string::String>>(
7264        mut self,
7265        v: T,
7266    ) -> Self {
7267        self.create_execution = std::option::Option::Some(
7268            crate::model::job::CreateExecution::RunExecutionToken(v.into()),
7269        );
7270        self
7271    }
7272}
7273
7274impl wkt::message::Message for Job {
7275    fn typename() -> &'static str {
7276        "type.googleapis.com/google.cloud.run.v2.Job"
7277    }
7278}
7279
7280#[doc(hidden)]
7281impl<'de> serde::de::Deserialize<'de> for Job {
7282    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7283    where
7284        D: serde::Deserializer<'de>,
7285    {
7286        #[allow(non_camel_case_types)]
7287        #[doc(hidden)]
7288        #[derive(PartialEq, Eq, Hash)]
7289        enum __FieldTag {
7290            __name,
7291            __uid,
7292            __generation,
7293            __labels,
7294            __annotations,
7295            __create_time,
7296            __update_time,
7297            __delete_time,
7298            __expire_time,
7299            __creator,
7300            __last_modifier,
7301            __client,
7302            __client_version,
7303            __launch_stage,
7304            __binary_authorization,
7305            __template,
7306            __observed_generation,
7307            __terminal_condition,
7308            __conditions,
7309            __execution_count,
7310            __latest_created_execution,
7311            __reconciling,
7312            __satisfies_pzs,
7313            __start_execution_token,
7314            __run_execution_token,
7315            __etag,
7316            Unknown(std::string::String),
7317        }
7318        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7319            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7320            where
7321                D: serde::Deserializer<'de>,
7322            {
7323                struct Visitor;
7324                impl<'de> serde::de::Visitor<'de> for Visitor {
7325                    type Value = __FieldTag;
7326                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7327                        formatter.write_str("a field name for Job")
7328                    }
7329                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7330                    where
7331                        E: serde::de::Error,
7332                    {
7333                        use std::result::Result::Ok;
7334                        use std::string::ToString;
7335                        match value {
7336                            "name" => Ok(__FieldTag::__name),
7337                            "uid" => Ok(__FieldTag::__uid),
7338                            "generation" => Ok(__FieldTag::__generation),
7339                            "labels" => Ok(__FieldTag::__labels),
7340                            "annotations" => Ok(__FieldTag::__annotations),
7341                            "createTime" => Ok(__FieldTag::__create_time),
7342                            "create_time" => Ok(__FieldTag::__create_time),
7343                            "updateTime" => Ok(__FieldTag::__update_time),
7344                            "update_time" => Ok(__FieldTag::__update_time),
7345                            "deleteTime" => Ok(__FieldTag::__delete_time),
7346                            "delete_time" => Ok(__FieldTag::__delete_time),
7347                            "expireTime" => Ok(__FieldTag::__expire_time),
7348                            "expire_time" => Ok(__FieldTag::__expire_time),
7349                            "creator" => Ok(__FieldTag::__creator),
7350                            "lastModifier" => Ok(__FieldTag::__last_modifier),
7351                            "last_modifier" => Ok(__FieldTag::__last_modifier),
7352                            "client" => Ok(__FieldTag::__client),
7353                            "clientVersion" => Ok(__FieldTag::__client_version),
7354                            "client_version" => Ok(__FieldTag::__client_version),
7355                            "launchStage" => Ok(__FieldTag::__launch_stage),
7356                            "launch_stage" => Ok(__FieldTag::__launch_stage),
7357                            "binaryAuthorization" => Ok(__FieldTag::__binary_authorization),
7358                            "binary_authorization" => Ok(__FieldTag::__binary_authorization),
7359                            "template" => Ok(__FieldTag::__template),
7360                            "observedGeneration" => Ok(__FieldTag::__observed_generation),
7361                            "observed_generation" => Ok(__FieldTag::__observed_generation),
7362                            "terminalCondition" => Ok(__FieldTag::__terminal_condition),
7363                            "terminal_condition" => Ok(__FieldTag::__terminal_condition),
7364                            "conditions" => Ok(__FieldTag::__conditions),
7365                            "executionCount" => Ok(__FieldTag::__execution_count),
7366                            "execution_count" => Ok(__FieldTag::__execution_count),
7367                            "latestCreatedExecution" => Ok(__FieldTag::__latest_created_execution),
7368                            "latest_created_execution" => {
7369                                Ok(__FieldTag::__latest_created_execution)
7370                            }
7371                            "reconciling" => Ok(__FieldTag::__reconciling),
7372                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
7373                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
7374                            "startExecutionToken" => Ok(__FieldTag::__start_execution_token),
7375                            "start_execution_token" => Ok(__FieldTag::__start_execution_token),
7376                            "runExecutionToken" => Ok(__FieldTag::__run_execution_token),
7377                            "run_execution_token" => Ok(__FieldTag::__run_execution_token),
7378                            "etag" => Ok(__FieldTag::__etag),
7379                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7380                        }
7381                    }
7382                }
7383                deserializer.deserialize_identifier(Visitor)
7384            }
7385        }
7386        struct Visitor;
7387        impl<'de> serde::de::Visitor<'de> for Visitor {
7388            type Value = Job;
7389            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7390                formatter.write_str("struct Job")
7391            }
7392            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7393            where
7394                A: serde::de::MapAccess<'de>,
7395            {
7396                #[allow(unused_imports)]
7397                use serde::de::Error;
7398                use std::option::Option::Some;
7399                let mut fields = std::collections::HashSet::new();
7400                let mut result = Self::Value::new();
7401                while let Some(tag) = map.next_key::<__FieldTag>()? {
7402                    #[allow(clippy::match_single_binding)]
7403                    match tag {
7404                        __FieldTag::__name => {
7405                            if !fields.insert(__FieldTag::__name) {
7406                                return std::result::Result::Err(A::Error::duplicate_field(
7407                                    "multiple values for name",
7408                                ));
7409                            }
7410                            result.name = map
7411                                .next_value::<std::option::Option<std::string::String>>()?
7412                                .unwrap_or_default();
7413                        }
7414                        __FieldTag::__uid => {
7415                            if !fields.insert(__FieldTag::__uid) {
7416                                return std::result::Result::Err(A::Error::duplicate_field(
7417                                    "multiple values for uid",
7418                                ));
7419                            }
7420                            result.uid = map
7421                                .next_value::<std::option::Option<std::string::String>>()?
7422                                .unwrap_or_default();
7423                        }
7424                        __FieldTag::__generation => {
7425                            if !fields.insert(__FieldTag::__generation) {
7426                                return std::result::Result::Err(A::Error::duplicate_field(
7427                                    "multiple values for generation",
7428                                ));
7429                            }
7430                            struct __With(std::option::Option<i64>);
7431                            impl<'de> serde::de::Deserialize<'de> for __With {
7432                                fn deserialize<D>(
7433                                    deserializer: D,
7434                                ) -> std::result::Result<Self, D::Error>
7435                                where
7436                                    D: serde::de::Deserializer<'de>,
7437                                {
7438                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7439                                }
7440                            }
7441                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
7442                        }
7443                        __FieldTag::__labels => {
7444                            if !fields.insert(__FieldTag::__labels) {
7445                                return std::result::Result::Err(A::Error::duplicate_field(
7446                                    "multiple values for labels",
7447                                ));
7448                            }
7449                            result.labels = map
7450                                .next_value::<std::option::Option<
7451                                    std::collections::HashMap<
7452                                        std::string::String,
7453                                        std::string::String,
7454                                    >,
7455                                >>()?
7456                                .unwrap_or_default();
7457                        }
7458                        __FieldTag::__annotations => {
7459                            if !fields.insert(__FieldTag::__annotations) {
7460                                return std::result::Result::Err(A::Error::duplicate_field(
7461                                    "multiple values for annotations",
7462                                ));
7463                            }
7464                            result.annotations = map
7465                                .next_value::<std::option::Option<
7466                                    std::collections::HashMap<
7467                                        std::string::String,
7468                                        std::string::String,
7469                                    >,
7470                                >>()?
7471                                .unwrap_or_default();
7472                        }
7473                        __FieldTag::__create_time => {
7474                            if !fields.insert(__FieldTag::__create_time) {
7475                                return std::result::Result::Err(A::Error::duplicate_field(
7476                                    "multiple values for create_time",
7477                                ));
7478                            }
7479                            result.create_time =
7480                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7481                        }
7482                        __FieldTag::__update_time => {
7483                            if !fields.insert(__FieldTag::__update_time) {
7484                                return std::result::Result::Err(A::Error::duplicate_field(
7485                                    "multiple values for update_time",
7486                                ));
7487                            }
7488                            result.update_time =
7489                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7490                        }
7491                        __FieldTag::__delete_time => {
7492                            if !fields.insert(__FieldTag::__delete_time) {
7493                                return std::result::Result::Err(A::Error::duplicate_field(
7494                                    "multiple values for delete_time",
7495                                ));
7496                            }
7497                            result.delete_time =
7498                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7499                        }
7500                        __FieldTag::__expire_time => {
7501                            if !fields.insert(__FieldTag::__expire_time) {
7502                                return std::result::Result::Err(A::Error::duplicate_field(
7503                                    "multiple values for expire_time",
7504                                ));
7505                            }
7506                            result.expire_time =
7507                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7508                        }
7509                        __FieldTag::__creator => {
7510                            if !fields.insert(__FieldTag::__creator) {
7511                                return std::result::Result::Err(A::Error::duplicate_field(
7512                                    "multiple values for creator",
7513                                ));
7514                            }
7515                            result.creator = map
7516                                .next_value::<std::option::Option<std::string::String>>()?
7517                                .unwrap_or_default();
7518                        }
7519                        __FieldTag::__last_modifier => {
7520                            if !fields.insert(__FieldTag::__last_modifier) {
7521                                return std::result::Result::Err(A::Error::duplicate_field(
7522                                    "multiple values for last_modifier",
7523                                ));
7524                            }
7525                            result.last_modifier = map
7526                                .next_value::<std::option::Option<std::string::String>>()?
7527                                .unwrap_or_default();
7528                        }
7529                        __FieldTag::__client => {
7530                            if !fields.insert(__FieldTag::__client) {
7531                                return std::result::Result::Err(A::Error::duplicate_field(
7532                                    "multiple values for client",
7533                                ));
7534                            }
7535                            result.client = map
7536                                .next_value::<std::option::Option<std::string::String>>()?
7537                                .unwrap_or_default();
7538                        }
7539                        __FieldTag::__client_version => {
7540                            if !fields.insert(__FieldTag::__client_version) {
7541                                return std::result::Result::Err(A::Error::duplicate_field(
7542                                    "multiple values for client_version",
7543                                ));
7544                            }
7545                            result.client_version = map
7546                                .next_value::<std::option::Option<std::string::String>>()?
7547                                .unwrap_or_default();
7548                        }
7549                        __FieldTag::__launch_stage => {
7550                            if !fields.insert(__FieldTag::__launch_stage) {
7551                                return std::result::Result::Err(A::Error::duplicate_field(
7552                                    "multiple values for launch_stage",
7553                                ));
7554                            }
7555                            result.launch_stage = map
7556                                .next_value::<std::option::Option<api::model::LaunchStage>>()?
7557                                .unwrap_or_default();
7558                        }
7559                        __FieldTag::__binary_authorization => {
7560                            if !fields.insert(__FieldTag::__binary_authorization) {
7561                                return std::result::Result::Err(A::Error::duplicate_field(
7562                                    "multiple values for binary_authorization",
7563                                ));
7564                            }
7565                            result.binary_authorization = map.next_value::<std::option::Option<crate::model::BinaryAuthorization>>()?
7566                                ;
7567                        }
7568                        __FieldTag::__template => {
7569                            if !fields.insert(__FieldTag::__template) {
7570                                return std::result::Result::Err(A::Error::duplicate_field(
7571                                    "multiple values for template",
7572                                ));
7573                            }
7574                            result.template = map
7575                                .next_value::<std::option::Option<crate::model::ExecutionTemplate>>(
7576                                )?;
7577                        }
7578                        __FieldTag::__observed_generation => {
7579                            if !fields.insert(__FieldTag::__observed_generation) {
7580                                return std::result::Result::Err(A::Error::duplicate_field(
7581                                    "multiple values for observed_generation",
7582                                ));
7583                            }
7584                            struct __With(std::option::Option<i64>);
7585                            impl<'de> serde::de::Deserialize<'de> for __With {
7586                                fn deserialize<D>(
7587                                    deserializer: D,
7588                                ) -> std::result::Result<Self, D::Error>
7589                                where
7590                                    D: serde::de::Deserializer<'de>,
7591                                {
7592                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
7593                                }
7594                            }
7595                            result.observed_generation =
7596                                map.next_value::<__With>()?.0.unwrap_or_default();
7597                        }
7598                        __FieldTag::__terminal_condition => {
7599                            if !fields.insert(__FieldTag::__terminal_condition) {
7600                                return std::result::Result::Err(A::Error::duplicate_field(
7601                                    "multiple values for terminal_condition",
7602                                ));
7603                            }
7604                            result.terminal_condition =
7605                                map.next_value::<std::option::Option<crate::model::Condition>>()?;
7606                        }
7607                        __FieldTag::__conditions => {
7608                            if !fields.insert(__FieldTag::__conditions) {
7609                                return std::result::Result::Err(A::Error::duplicate_field(
7610                                    "multiple values for conditions",
7611                                ));
7612                            }
7613                            result.conditions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Condition>>>()?.unwrap_or_default();
7614                        }
7615                        __FieldTag::__execution_count => {
7616                            if !fields.insert(__FieldTag::__execution_count) {
7617                                return std::result::Result::Err(A::Error::duplicate_field(
7618                                    "multiple values for execution_count",
7619                                ));
7620                            }
7621                            struct __With(std::option::Option<i32>);
7622                            impl<'de> serde::de::Deserialize<'de> for __With {
7623                                fn deserialize<D>(
7624                                    deserializer: D,
7625                                ) -> std::result::Result<Self, D::Error>
7626                                where
7627                                    D: serde::de::Deserializer<'de>,
7628                                {
7629                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
7630                                }
7631                            }
7632                            result.execution_count =
7633                                map.next_value::<__With>()?.0.unwrap_or_default();
7634                        }
7635                        __FieldTag::__latest_created_execution => {
7636                            if !fields.insert(__FieldTag::__latest_created_execution) {
7637                                return std::result::Result::Err(A::Error::duplicate_field(
7638                                    "multiple values for latest_created_execution",
7639                                ));
7640                            }
7641                            result.latest_created_execution = map.next_value::<std::option::Option<crate::model::ExecutionReference>>()?
7642                                ;
7643                        }
7644                        __FieldTag::__reconciling => {
7645                            if !fields.insert(__FieldTag::__reconciling) {
7646                                return std::result::Result::Err(A::Error::duplicate_field(
7647                                    "multiple values for reconciling",
7648                                ));
7649                            }
7650                            result.reconciling = map
7651                                .next_value::<std::option::Option<bool>>()?
7652                                .unwrap_or_default();
7653                        }
7654                        __FieldTag::__satisfies_pzs => {
7655                            if !fields.insert(__FieldTag::__satisfies_pzs) {
7656                                return std::result::Result::Err(A::Error::duplicate_field(
7657                                    "multiple values for satisfies_pzs",
7658                                ));
7659                            }
7660                            result.satisfies_pzs = map
7661                                .next_value::<std::option::Option<bool>>()?
7662                                .unwrap_or_default();
7663                        }
7664                        __FieldTag::__start_execution_token => {
7665                            if !fields.insert(__FieldTag::__start_execution_token) {
7666                                return std::result::Result::Err(A::Error::duplicate_field(
7667                                    "multiple values for start_execution_token",
7668                                ));
7669                            }
7670                            if result.create_execution.is_some() {
7671                                return std::result::Result::Err(A::Error::duplicate_field(
7672                                    "multiple values for `create_execution`, a oneof with full ID .google.cloud.run.v2.Job.start_execution_token, latest field was startExecutionToken",
7673                                ));
7674                            }
7675                            result.create_execution = std::option::Option::Some(
7676                                crate::model::job::CreateExecution::StartExecutionToken(
7677                                    map.next_value::<std::option::Option<std::string::String>>()?
7678                                        .unwrap_or_default(),
7679                                ),
7680                            );
7681                        }
7682                        __FieldTag::__run_execution_token => {
7683                            if !fields.insert(__FieldTag::__run_execution_token) {
7684                                return std::result::Result::Err(A::Error::duplicate_field(
7685                                    "multiple values for run_execution_token",
7686                                ));
7687                            }
7688                            if result.create_execution.is_some() {
7689                                return std::result::Result::Err(A::Error::duplicate_field(
7690                                    "multiple values for `create_execution`, a oneof with full ID .google.cloud.run.v2.Job.run_execution_token, latest field was runExecutionToken",
7691                                ));
7692                            }
7693                            result.create_execution = std::option::Option::Some(
7694                                crate::model::job::CreateExecution::RunExecutionToken(
7695                                    map.next_value::<std::option::Option<std::string::String>>()?
7696                                        .unwrap_or_default(),
7697                                ),
7698                            );
7699                        }
7700                        __FieldTag::__etag => {
7701                            if !fields.insert(__FieldTag::__etag) {
7702                                return std::result::Result::Err(A::Error::duplicate_field(
7703                                    "multiple values for etag",
7704                                ));
7705                            }
7706                            result.etag = map
7707                                .next_value::<std::option::Option<std::string::String>>()?
7708                                .unwrap_or_default();
7709                        }
7710                        __FieldTag::Unknown(key) => {
7711                            let value = map.next_value::<serde_json::Value>()?;
7712                            result._unknown_fields.insert(key, value);
7713                        }
7714                    }
7715                }
7716                std::result::Result::Ok(result)
7717            }
7718        }
7719        deserializer.deserialize_any(Visitor)
7720    }
7721}
7722
7723#[doc(hidden)]
7724impl serde::ser::Serialize for Job {
7725    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7726    where
7727        S: serde::ser::Serializer,
7728    {
7729        use serde::ser::SerializeMap;
7730        #[allow(unused_imports)]
7731        use std::option::Option::Some;
7732        let mut state = serializer.serialize_map(std::option::Option::None)?;
7733        if !self.name.is_empty() {
7734            state.serialize_entry("name", &self.name)?;
7735        }
7736        if !self.uid.is_empty() {
7737            state.serialize_entry("uid", &self.uid)?;
7738        }
7739        if !wkt::internal::is_default(&self.generation) {
7740            struct __With<'a>(&'a i64);
7741            impl<'a> serde::ser::Serialize for __With<'a> {
7742                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7743                where
7744                    S: serde::ser::Serializer,
7745                {
7746                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7747                }
7748            }
7749            state.serialize_entry("generation", &__With(&self.generation))?;
7750        }
7751        if !self.labels.is_empty() {
7752            state.serialize_entry("labels", &self.labels)?;
7753        }
7754        if !self.annotations.is_empty() {
7755            state.serialize_entry("annotations", &self.annotations)?;
7756        }
7757        if self.create_time.is_some() {
7758            state.serialize_entry("createTime", &self.create_time)?;
7759        }
7760        if self.update_time.is_some() {
7761            state.serialize_entry("updateTime", &self.update_time)?;
7762        }
7763        if self.delete_time.is_some() {
7764            state.serialize_entry("deleteTime", &self.delete_time)?;
7765        }
7766        if self.expire_time.is_some() {
7767            state.serialize_entry("expireTime", &self.expire_time)?;
7768        }
7769        if !self.creator.is_empty() {
7770            state.serialize_entry("creator", &self.creator)?;
7771        }
7772        if !self.last_modifier.is_empty() {
7773            state.serialize_entry("lastModifier", &self.last_modifier)?;
7774        }
7775        if !self.client.is_empty() {
7776            state.serialize_entry("client", &self.client)?;
7777        }
7778        if !self.client_version.is_empty() {
7779            state.serialize_entry("clientVersion", &self.client_version)?;
7780        }
7781        if !wkt::internal::is_default(&self.launch_stage) {
7782            state.serialize_entry("launchStage", &self.launch_stage)?;
7783        }
7784        if self.binary_authorization.is_some() {
7785            state.serialize_entry("binaryAuthorization", &self.binary_authorization)?;
7786        }
7787        if self.template.is_some() {
7788            state.serialize_entry("template", &self.template)?;
7789        }
7790        if !wkt::internal::is_default(&self.observed_generation) {
7791            struct __With<'a>(&'a i64);
7792            impl<'a> serde::ser::Serialize for __With<'a> {
7793                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7794                where
7795                    S: serde::ser::Serializer,
7796                {
7797                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
7798                }
7799            }
7800            state.serialize_entry("observedGeneration", &__With(&self.observed_generation))?;
7801        }
7802        if self.terminal_condition.is_some() {
7803            state.serialize_entry("terminalCondition", &self.terminal_condition)?;
7804        }
7805        if !self.conditions.is_empty() {
7806            state.serialize_entry("conditions", &self.conditions)?;
7807        }
7808        if !wkt::internal::is_default(&self.execution_count) {
7809            struct __With<'a>(&'a i32);
7810            impl<'a> serde::ser::Serialize for __With<'a> {
7811                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7812                where
7813                    S: serde::ser::Serializer,
7814                {
7815                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7816                }
7817            }
7818            state.serialize_entry("executionCount", &__With(&self.execution_count))?;
7819        }
7820        if self.latest_created_execution.is_some() {
7821            state.serialize_entry("latestCreatedExecution", &self.latest_created_execution)?;
7822        }
7823        if !wkt::internal::is_default(&self.reconciling) {
7824            state.serialize_entry("reconciling", &self.reconciling)?;
7825        }
7826        if !wkt::internal::is_default(&self.satisfies_pzs) {
7827            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
7828        }
7829        if let Some(value) = self.start_execution_token() {
7830            state.serialize_entry("startExecutionToken", value)?;
7831        }
7832        if let Some(value) = self.run_execution_token() {
7833            state.serialize_entry("runExecutionToken", value)?;
7834        }
7835        if !self.etag.is_empty() {
7836            state.serialize_entry("etag", &self.etag)?;
7837        }
7838        if !self._unknown_fields.is_empty() {
7839            for (key, value) in self._unknown_fields.iter() {
7840                state.serialize_entry(key, &value)?;
7841            }
7842        }
7843        state.end()
7844    }
7845}
7846
7847/// Defines additional types related to [Job].
7848pub mod job {
7849    #[allow(unused_imports)]
7850    use super::*;
7851
7852    #[derive(Clone, Debug, PartialEq)]
7853    #[non_exhaustive]
7854    pub enum CreateExecution {
7855        /// A unique string used as a suffix creating a new execution. The Job will
7856        /// become ready when the execution is successfully started.
7857        /// The sum of job name and token length must be fewer than 63 characters.
7858        StartExecutionToken(std::string::String),
7859        /// A unique string used as a suffix for creating a new execution. The Job
7860        /// will become ready when the execution is successfully completed.
7861        /// The sum of job name and token length must be fewer than 63 characters.
7862        RunExecutionToken(std::string::String),
7863    }
7864}
7865
7866/// Reference to an Execution. Use /Executions.GetExecution with the given name
7867/// to get full execution including the latest status.
7868#[derive(Clone, Debug, Default, PartialEq)]
7869#[non_exhaustive]
7870pub struct ExecutionReference {
7871    /// Name of the execution.
7872    pub name: std::string::String,
7873
7874    /// Creation timestamp of the execution.
7875    pub create_time: std::option::Option<wkt::Timestamp>,
7876
7877    /// Creation timestamp of the execution.
7878    pub completion_time: std::option::Option<wkt::Timestamp>,
7879
7880    /// The deletion time of the execution. It is only
7881    /// populated as a response to a Delete request.
7882    pub delete_time: std::option::Option<wkt::Timestamp>,
7883
7884    /// Status for the execution completion.
7885    pub completion_status: crate::model::execution_reference::CompletionStatus,
7886
7887    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7888}
7889
7890impl ExecutionReference {
7891    pub fn new() -> Self {
7892        std::default::Default::default()
7893    }
7894
7895    /// Sets the value of [name][crate::model::ExecutionReference::name].
7896    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7897        self.name = v.into();
7898        self
7899    }
7900
7901    /// Sets the value of [create_time][crate::model::ExecutionReference::create_time].
7902    pub fn set_create_time<T>(mut self, v: T) -> Self
7903    where
7904        T: std::convert::Into<wkt::Timestamp>,
7905    {
7906        self.create_time = std::option::Option::Some(v.into());
7907        self
7908    }
7909
7910    /// Sets or clears the value of [create_time][crate::model::ExecutionReference::create_time].
7911    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7912    where
7913        T: std::convert::Into<wkt::Timestamp>,
7914    {
7915        self.create_time = v.map(|x| x.into());
7916        self
7917    }
7918
7919    /// Sets the value of [completion_time][crate::model::ExecutionReference::completion_time].
7920    pub fn set_completion_time<T>(mut self, v: T) -> Self
7921    where
7922        T: std::convert::Into<wkt::Timestamp>,
7923    {
7924        self.completion_time = std::option::Option::Some(v.into());
7925        self
7926    }
7927
7928    /// Sets or clears the value of [completion_time][crate::model::ExecutionReference::completion_time].
7929    pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
7930    where
7931        T: std::convert::Into<wkt::Timestamp>,
7932    {
7933        self.completion_time = v.map(|x| x.into());
7934        self
7935    }
7936
7937    /// Sets the value of [delete_time][crate::model::ExecutionReference::delete_time].
7938    pub fn set_delete_time<T>(mut self, v: T) -> Self
7939    where
7940        T: std::convert::Into<wkt::Timestamp>,
7941    {
7942        self.delete_time = std::option::Option::Some(v.into());
7943        self
7944    }
7945
7946    /// Sets or clears the value of [delete_time][crate::model::ExecutionReference::delete_time].
7947    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
7948    where
7949        T: std::convert::Into<wkt::Timestamp>,
7950    {
7951        self.delete_time = v.map(|x| x.into());
7952        self
7953    }
7954
7955    /// Sets the value of [completion_status][crate::model::ExecutionReference::completion_status].
7956    pub fn set_completion_status<
7957        T: std::convert::Into<crate::model::execution_reference::CompletionStatus>,
7958    >(
7959        mut self,
7960        v: T,
7961    ) -> Self {
7962        self.completion_status = v.into();
7963        self
7964    }
7965}
7966
7967impl wkt::message::Message for ExecutionReference {
7968    fn typename() -> &'static str {
7969        "type.googleapis.com/google.cloud.run.v2.ExecutionReference"
7970    }
7971}
7972
7973#[doc(hidden)]
7974impl<'de> serde::de::Deserialize<'de> for ExecutionReference {
7975    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7976    where
7977        D: serde::Deserializer<'de>,
7978    {
7979        #[allow(non_camel_case_types)]
7980        #[doc(hidden)]
7981        #[derive(PartialEq, Eq, Hash)]
7982        enum __FieldTag {
7983            __name,
7984            __create_time,
7985            __completion_time,
7986            __delete_time,
7987            __completion_status,
7988            Unknown(std::string::String),
7989        }
7990        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7991            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7992            where
7993                D: serde::Deserializer<'de>,
7994            {
7995                struct Visitor;
7996                impl<'de> serde::de::Visitor<'de> for Visitor {
7997                    type Value = __FieldTag;
7998                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7999                        formatter.write_str("a field name for ExecutionReference")
8000                    }
8001                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8002                    where
8003                        E: serde::de::Error,
8004                    {
8005                        use std::result::Result::Ok;
8006                        use std::string::ToString;
8007                        match value {
8008                            "name" => Ok(__FieldTag::__name),
8009                            "createTime" => Ok(__FieldTag::__create_time),
8010                            "create_time" => Ok(__FieldTag::__create_time),
8011                            "completionTime" => Ok(__FieldTag::__completion_time),
8012                            "completion_time" => Ok(__FieldTag::__completion_time),
8013                            "deleteTime" => Ok(__FieldTag::__delete_time),
8014                            "delete_time" => Ok(__FieldTag::__delete_time),
8015                            "completionStatus" => Ok(__FieldTag::__completion_status),
8016                            "completion_status" => Ok(__FieldTag::__completion_status),
8017                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8018                        }
8019                    }
8020                }
8021                deserializer.deserialize_identifier(Visitor)
8022            }
8023        }
8024        struct Visitor;
8025        impl<'de> serde::de::Visitor<'de> for Visitor {
8026            type Value = ExecutionReference;
8027            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8028                formatter.write_str("struct ExecutionReference")
8029            }
8030            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8031            where
8032                A: serde::de::MapAccess<'de>,
8033            {
8034                #[allow(unused_imports)]
8035                use serde::de::Error;
8036                use std::option::Option::Some;
8037                let mut fields = std::collections::HashSet::new();
8038                let mut result = Self::Value::new();
8039                while let Some(tag) = map.next_key::<__FieldTag>()? {
8040                    #[allow(clippy::match_single_binding)]
8041                    match tag {
8042                        __FieldTag::__name => {
8043                            if !fields.insert(__FieldTag::__name) {
8044                                return std::result::Result::Err(A::Error::duplicate_field(
8045                                    "multiple values for name",
8046                                ));
8047                            }
8048                            result.name = map
8049                                .next_value::<std::option::Option<std::string::String>>()?
8050                                .unwrap_or_default();
8051                        }
8052                        __FieldTag::__create_time => {
8053                            if !fields.insert(__FieldTag::__create_time) {
8054                                return std::result::Result::Err(A::Error::duplicate_field(
8055                                    "multiple values for create_time",
8056                                ));
8057                            }
8058                            result.create_time =
8059                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8060                        }
8061                        __FieldTag::__completion_time => {
8062                            if !fields.insert(__FieldTag::__completion_time) {
8063                                return std::result::Result::Err(A::Error::duplicate_field(
8064                                    "multiple values for completion_time",
8065                                ));
8066                            }
8067                            result.completion_time =
8068                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8069                        }
8070                        __FieldTag::__delete_time => {
8071                            if !fields.insert(__FieldTag::__delete_time) {
8072                                return std::result::Result::Err(A::Error::duplicate_field(
8073                                    "multiple values for delete_time",
8074                                ));
8075                            }
8076                            result.delete_time =
8077                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8078                        }
8079                        __FieldTag::__completion_status => {
8080                            if !fields.insert(__FieldTag::__completion_status) {
8081                                return std::result::Result::Err(A::Error::duplicate_field(
8082                                    "multiple values for completion_status",
8083                                ));
8084                            }
8085                            result.completion_status = map
8086                                .next_value::<std::option::Option<
8087                                    crate::model::execution_reference::CompletionStatus,
8088                                >>()?
8089                                .unwrap_or_default();
8090                        }
8091                        __FieldTag::Unknown(key) => {
8092                            let value = map.next_value::<serde_json::Value>()?;
8093                            result._unknown_fields.insert(key, value);
8094                        }
8095                    }
8096                }
8097                std::result::Result::Ok(result)
8098            }
8099        }
8100        deserializer.deserialize_any(Visitor)
8101    }
8102}
8103
8104#[doc(hidden)]
8105impl serde::ser::Serialize for ExecutionReference {
8106    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8107    where
8108        S: serde::ser::Serializer,
8109    {
8110        use serde::ser::SerializeMap;
8111        #[allow(unused_imports)]
8112        use std::option::Option::Some;
8113        let mut state = serializer.serialize_map(std::option::Option::None)?;
8114        if !self.name.is_empty() {
8115            state.serialize_entry("name", &self.name)?;
8116        }
8117        if self.create_time.is_some() {
8118            state.serialize_entry("createTime", &self.create_time)?;
8119        }
8120        if self.completion_time.is_some() {
8121            state.serialize_entry("completionTime", &self.completion_time)?;
8122        }
8123        if self.delete_time.is_some() {
8124            state.serialize_entry("deleteTime", &self.delete_time)?;
8125        }
8126        if !wkt::internal::is_default(&self.completion_status) {
8127            state.serialize_entry("completionStatus", &self.completion_status)?;
8128        }
8129        if !self._unknown_fields.is_empty() {
8130            for (key, value) in self._unknown_fields.iter() {
8131                state.serialize_entry(key, &value)?;
8132            }
8133        }
8134        state.end()
8135    }
8136}
8137
8138/// Defines additional types related to [ExecutionReference].
8139pub mod execution_reference {
8140    #[allow(unused_imports)]
8141    use super::*;
8142
8143    /// Possible execution completion status.
8144    ///
8145    /// # Working with unknown values
8146    ///
8147    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8148    /// additional enum variants at any time. Adding new variants is not considered
8149    /// a breaking change. Applications should write their code in anticipation of:
8150    ///
8151    /// - New values appearing in future releases of the client library, **and**
8152    /// - New values received dynamically, without application changes.
8153    ///
8154    /// Please consult the [Working with enums] section in the user guide for some
8155    /// guidelines.
8156    ///
8157    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8158    #[derive(Clone, Debug, PartialEq)]
8159    #[non_exhaustive]
8160    pub enum CompletionStatus {
8161        /// The default value. This value is used if the state is omitted.
8162        Unspecified,
8163        /// Job execution has succeeded.
8164        ExecutionSucceeded,
8165        /// Job execution has failed.
8166        ExecutionFailed,
8167        /// Job execution is running normally.
8168        ExecutionRunning,
8169        /// Waiting for backing resources to be provisioned.
8170        ExecutionPending,
8171        /// Job execution has been cancelled by the user.
8172        ExecutionCancelled,
8173        /// If set, the enum was initialized with an unknown value.
8174        ///
8175        /// Applications can examine the value using [CompletionStatus::value] or
8176        /// [CompletionStatus::name].
8177        UnknownValue(completion_status::UnknownValue),
8178    }
8179
8180    #[doc(hidden)]
8181    pub mod completion_status {
8182        #[allow(unused_imports)]
8183        use super::*;
8184        #[derive(Clone, Debug, PartialEq)]
8185        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8186    }
8187
8188    impl CompletionStatus {
8189        /// Gets the enum value.
8190        ///
8191        /// Returns `None` if the enum contains an unknown value deserialized from
8192        /// the string representation of enums.
8193        pub fn value(&self) -> std::option::Option<i32> {
8194            match self {
8195                Self::Unspecified => std::option::Option::Some(0),
8196                Self::ExecutionSucceeded => std::option::Option::Some(1),
8197                Self::ExecutionFailed => std::option::Option::Some(2),
8198                Self::ExecutionRunning => std::option::Option::Some(3),
8199                Self::ExecutionPending => std::option::Option::Some(4),
8200                Self::ExecutionCancelled => std::option::Option::Some(5),
8201                Self::UnknownValue(u) => u.0.value(),
8202            }
8203        }
8204
8205        /// Gets the enum value as a string.
8206        ///
8207        /// Returns `None` if the enum contains an unknown value deserialized from
8208        /// the integer representation of enums.
8209        pub fn name(&self) -> std::option::Option<&str> {
8210            match self {
8211                Self::Unspecified => std::option::Option::Some("COMPLETION_STATUS_UNSPECIFIED"),
8212                Self::ExecutionSucceeded => std::option::Option::Some("EXECUTION_SUCCEEDED"),
8213                Self::ExecutionFailed => std::option::Option::Some("EXECUTION_FAILED"),
8214                Self::ExecutionRunning => std::option::Option::Some("EXECUTION_RUNNING"),
8215                Self::ExecutionPending => std::option::Option::Some("EXECUTION_PENDING"),
8216                Self::ExecutionCancelled => std::option::Option::Some("EXECUTION_CANCELLED"),
8217                Self::UnknownValue(u) => u.0.name(),
8218            }
8219        }
8220    }
8221
8222    impl std::default::Default for CompletionStatus {
8223        fn default() -> Self {
8224            use std::convert::From;
8225            Self::from(0)
8226        }
8227    }
8228
8229    impl std::fmt::Display for CompletionStatus {
8230        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8231            wkt::internal::display_enum(f, self.name(), self.value())
8232        }
8233    }
8234
8235    impl std::convert::From<i32> for CompletionStatus {
8236        fn from(value: i32) -> Self {
8237            match value {
8238                0 => Self::Unspecified,
8239                1 => Self::ExecutionSucceeded,
8240                2 => Self::ExecutionFailed,
8241                3 => Self::ExecutionRunning,
8242                4 => Self::ExecutionPending,
8243                5 => Self::ExecutionCancelled,
8244                _ => Self::UnknownValue(completion_status::UnknownValue(
8245                    wkt::internal::UnknownEnumValue::Integer(value),
8246                )),
8247            }
8248        }
8249    }
8250
8251    impl std::convert::From<&str> for CompletionStatus {
8252        fn from(value: &str) -> Self {
8253            use std::string::ToString;
8254            match value {
8255                "COMPLETION_STATUS_UNSPECIFIED" => Self::Unspecified,
8256                "EXECUTION_SUCCEEDED" => Self::ExecutionSucceeded,
8257                "EXECUTION_FAILED" => Self::ExecutionFailed,
8258                "EXECUTION_RUNNING" => Self::ExecutionRunning,
8259                "EXECUTION_PENDING" => Self::ExecutionPending,
8260                "EXECUTION_CANCELLED" => Self::ExecutionCancelled,
8261                _ => Self::UnknownValue(completion_status::UnknownValue(
8262                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8263                )),
8264            }
8265        }
8266    }
8267
8268    impl serde::ser::Serialize for CompletionStatus {
8269        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8270        where
8271            S: serde::Serializer,
8272        {
8273            match self {
8274                Self::Unspecified => serializer.serialize_i32(0),
8275                Self::ExecutionSucceeded => serializer.serialize_i32(1),
8276                Self::ExecutionFailed => serializer.serialize_i32(2),
8277                Self::ExecutionRunning => serializer.serialize_i32(3),
8278                Self::ExecutionPending => serializer.serialize_i32(4),
8279                Self::ExecutionCancelled => serializer.serialize_i32(5),
8280                Self::UnknownValue(u) => u.0.serialize(serializer),
8281            }
8282        }
8283    }
8284
8285    impl<'de> serde::de::Deserialize<'de> for CompletionStatus {
8286        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8287        where
8288            D: serde::Deserializer<'de>,
8289        {
8290            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompletionStatus>::new(
8291                ".google.cloud.run.v2.ExecutionReference.CompletionStatus",
8292            ))
8293        }
8294    }
8295}
8296
8297/// A single application container.
8298/// This specifies both the container to run, the command to run in the container
8299/// and the arguments to supply to it.
8300/// Note that additional arguments can be supplied by the system to the container
8301/// at runtime.
8302#[derive(Clone, Debug, Default, PartialEq)]
8303#[non_exhaustive]
8304pub struct Container {
8305    /// Name of the container specified as a DNS_LABEL (RFC 1123).
8306    pub name: std::string::String,
8307
8308    /// Required. Name of the container image in Dockerhub, Google Artifact
8309    /// Registry, or Google Container Registry. If the host is not provided,
8310    /// Dockerhub is assumed.
8311    pub image: std::string::String,
8312
8313    /// Entrypoint array. Not executed within a shell.
8314    /// The docker image's ENTRYPOINT is used if this is not provided.
8315    pub command: std::vec::Vec<std::string::String>,
8316
8317    /// Arguments to the entrypoint.
8318    /// The docker image's CMD is used if this is not provided.
8319    pub args: std::vec::Vec<std::string::String>,
8320
8321    /// List of environment variables to set in the container.
8322    pub env: std::vec::Vec<crate::model::EnvVar>,
8323
8324    /// Compute Resource requirements by this container.
8325    pub resources: std::option::Option<crate::model::ResourceRequirements>,
8326
8327    /// List of ports to expose from the container. Only a single port can be
8328    /// specified. The specified ports must be listening on all interfaces
8329    /// (0.0.0.0) within the container to be accessible.
8330    ///
8331    /// If omitted, a port number will be chosen and passed to the container
8332    /// through the PORT environment variable for the container to listen on.
8333    pub ports: std::vec::Vec<crate::model::ContainerPort>,
8334
8335    /// Volume to mount into the container's filesystem.
8336    pub volume_mounts: std::vec::Vec<crate::model::VolumeMount>,
8337
8338    /// Container's working directory.
8339    /// If not specified, the container runtime's default will be used, which
8340    /// might be configured in the container image.
8341    pub working_dir: std::string::String,
8342
8343    /// Periodic probe of container liveness.
8344    /// Container will be restarted if the probe fails.
8345    pub liveness_probe: std::option::Option<crate::model::Probe>,
8346
8347    /// Startup probe of application within the container.
8348    /// All other probes are disabled if a startup probe is provided, until it
8349    /// succeeds. Container will not be added to service endpoints if the probe
8350    /// fails.
8351    pub startup_probe: std::option::Option<crate::model::Probe>,
8352
8353    /// Names of the containers that must start before this container.
8354    pub depends_on: std::vec::Vec<std::string::String>,
8355
8356    /// Base image for this container. Only supported for services. If set, it
8357    /// indicates that the service is enrolled into automatic base image update.
8358    pub base_image_uri: std::string::String,
8359
8360    /// Output only. The build info of the container image.
8361    pub build_info: std::option::Option<crate::model::BuildInfo>,
8362
8363    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8364}
8365
8366impl Container {
8367    pub fn new() -> Self {
8368        std::default::Default::default()
8369    }
8370
8371    /// Sets the value of [name][crate::model::Container::name].
8372    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8373        self.name = v.into();
8374        self
8375    }
8376
8377    /// Sets the value of [image][crate::model::Container::image].
8378    pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8379        self.image = v.into();
8380        self
8381    }
8382
8383    /// Sets the value of [command][crate::model::Container::command].
8384    pub fn set_command<T, V>(mut self, v: T) -> Self
8385    where
8386        T: std::iter::IntoIterator<Item = V>,
8387        V: std::convert::Into<std::string::String>,
8388    {
8389        use std::iter::Iterator;
8390        self.command = v.into_iter().map(|i| i.into()).collect();
8391        self
8392    }
8393
8394    /// Sets the value of [args][crate::model::Container::args].
8395    pub fn set_args<T, V>(mut self, v: T) -> Self
8396    where
8397        T: std::iter::IntoIterator<Item = V>,
8398        V: std::convert::Into<std::string::String>,
8399    {
8400        use std::iter::Iterator;
8401        self.args = v.into_iter().map(|i| i.into()).collect();
8402        self
8403    }
8404
8405    /// Sets the value of [env][crate::model::Container::env].
8406    pub fn set_env<T, V>(mut self, v: T) -> Self
8407    where
8408        T: std::iter::IntoIterator<Item = V>,
8409        V: std::convert::Into<crate::model::EnvVar>,
8410    {
8411        use std::iter::Iterator;
8412        self.env = v.into_iter().map(|i| i.into()).collect();
8413        self
8414    }
8415
8416    /// Sets the value of [resources][crate::model::Container::resources].
8417    pub fn set_resources<T>(mut self, v: T) -> Self
8418    where
8419        T: std::convert::Into<crate::model::ResourceRequirements>,
8420    {
8421        self.resources = std::option::Option::Some(v.into());
8422        self
8423    }
8424
8425    /// Sets or clears the value of [resources][crate::model::Container::resources].
8426    pub fn set_or_clear_resources<T>(mut self, v: std::option::Option<T>) -> Self
8427    where
8428        T: std::convert::Into<crate::model::ResourceRequirements>,
8429    {
8430        self.resources = v.map(|x| x.into());
8431        self
8432    }
8433
8434    /// Sets the value of [ports][crate::model::Container::ports].
8435    pub fn set_ports<T, V>(mut self, v: T) -> Self
8436    where
8437        T: std::iter::IntoIterator<Item = V>,
8438        V: std::convert::Into<crate::model::ContainerPort>,
8439    {
8440        use std::iter::Iterator;
8441        self.ports = v.into_iter().map(|i| i.into()).collect();
8442        self
8443    }
8444
8445    /// Sets the value of [volume_mounts][crate::model::Container::volume_mounts].
8446    pub fn set_volume_mounts<T, V>(mut self, v: T) -> Self
8447    where
8448        T: std::iter::IntoIterator<Item = V>,
8449        V: std::convert::Into<crate::model::VolumeMount>,
8450    {
8451        use std::iter::Iterator;
8452        self.volume_mounts = v.into_iter().map(|i| i.into()).collect();
8453        self
8454    }
8455
8456    /// Sets the value of [working_dir][crate::model::Container::working_dir].
8457    pub fn set_working_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8458        self.working_dir = v.into();
8459        self
8460    }
8461
8462    /// Sets the value of [liveness_probe][crate::model::Container::liveness_probe].
8463    pub fn set_liveness_probe<T>(mut self, v: T) -> Self
8464    where
8465        T: std::convert::Into<crate::model::Probe>,
8466    {
8467        self.liveness_probe = std::option::Option::Some(v.into());
8468        self
8469    }
8470
8471    /// Sets or clears the value of [liveness_probe][crate::model::Container::liveness_probe].
8472    pub fn set_or_clear_liveness_probe<T>(mut self, v: std::option::Option<T>) -> Self
8473    where
8474        T: std::convert::Into<crate::model::Probe>,
8475    {
8476        self.liveness_probe = v.map(|x| x.into());
8477        self
8478    }
8479
8480    /// Sets the value of [startup_probe][crate::model::Container::startup_probe].
8481    pub fn set_startup_probe<T>(mut self, v: T) -> Self
8482    where
8483        T: std::convert::Into<crate::model::Probe>,
8484    {
8485        self.startup_probe = std::option::Option::Some(v.into());
8486        self
8487    }
8488
8489    /// Sets or clears the value of [startup_probe][crate::model::Container::startup_probe].
8490    pub fn set_or_clear_startup_probe<T>(mut self, v: std::option::Option<T>) -> Self
8491    where
8492        T: std::convert::Into<crate::model::Probe>,
8493    {
8494        self.startup_probe = v.map(|x| x.into());
8495        self
8496    }
8497
8498    /// Sets the value of [depends_on][crate::model::Container::depends_on].
8499    pub fn set_depends_on<T, V>(mut self, v: T) -> Self
8500    where
8501        T: std::iter::IntoIterator<Item = V>,
8502        V: std::convert::Into<std::string::String>,
8503    {
8504        use std::iter::Iterator;
8505        self.depends_on = v.into_iter().map(|i| i.into()).collect();
8506        self
8507    }
8508
8509    /// Sets the value of [base_image_uri][crate::model::Container::base_image_uri].
8510    pub fn set_base_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8511        self.base_image_uri = v.into();
8512        self
8513    }
8514
8515    /// Sets the value of [build_info][crate::model::Container::build_info].
8516    pub fn set_build_info<T>(mut self, v: T) -> Self
8517    where
8518        T: std::convert::Into<crate::model::BuildInfo>,
8519    {
8520        self.build_info = std::option::Option::Some(v.into());
8521        self
8522    }
8523
8524    /// Sets or clears the value of [build_info][crate::model::Container::build_info].
8525    pub fn set_or_clear_build_info<T>(mut self, v: std::option::Option<T>) -> Self
8526    where
8527        T: std::convert::Into<crate::model::BuildInfo>,
8528    {
8529        self.build_info = v.map(|x| x.into());
8530        self
8531    }
8532}
8533
8534impl wkt::message::Message for Container {
8535    fn typename() -> &'static str {
8536        "type.googleapis.com/google.cloud.run.v2.Container"
8537    }
8538}
8539
8540#[doc(hidden)]
8541impl<'de> serde::de::Deserialize<'de> for Container {
8542    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8543    where
8544        D: serde::Deserializer<'de>,
8545    {
8546        #[allow(non_camel_case_types)]
8547        #[doc(hidden)]
8548        #[derive(PartialEq, Eq, Hash)]
8549        enum __FieldTag {
8550            __name,
8551            __image,
8552            __command,
8553            __args,
8554            __env,
8555            __resources,
8556            __ports,
8557            __volume_mounts,
8558            __working_dir,
8559            __liveness_probe,
8560            __startup_probe,
8561            __depends_on,
8562            __base_image_uri,
8563            __build_info,
8564            Unknown(std::string::String),
8565        }
8566        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8567            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8568            where
8569                D: serde::Deserializer<'de>,
8570            {
8571                struct Visitor;
8572                impl<'de> serde::de::Visitor<'de> for Visitor {
8573                    type Value = __FieldTag;
8574                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8575                        formatter.write_str("a field name for Container")
8576                    }
8577                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8578                    where
8579                        E: serde::de::Error,
8580                    {
8581                        use std::result::Result::Ok;
8582                        use std::string::ToString;
8583                        match value {
8584                            "name" => Ok(__FieldTag::__name),
8585                            "image" => Ok(__FieldTag::__image),
8586                            "command" => Ok(__FieldTag::__command),
8587                            "args" => Ok(__FieldTag::__args),
8588                            "env" => Ok(__FieldTag::__env),
8589                            "resources" => Ok(__FieldTag::__resources),
8590                            "ports" => Ok(__FieldTag::__ports),
8591                            "volumeMounts" => Ok(__FieldTag::__volume_mounts),
8592                            "volume_mounts" => Ok(__FieldTag::__volume_mounts),
8593                            "workingDir" => Ok(__FieldTag::__working_dir),
8594                            "working_dir" => Ok(__FieldTag::__working_dir),
8595                            "livenessProbe" => Ok(__FieldTag::__liveness_probe),
8596                            "liveness_probe" => Ok(__FieldTag::__liveness_probe),
8597                            "startupProbe" => Ok(__FieldTag::__startup_probe),
8598                            "startup_probe" => Ok(__FieldTag::__startup_probe),
8599                            "dependsOn" => Ok(__FieldTag::__depends_on),
8600                            "depends_on" => Ok(__FieldTag::__depends_on),
8601                            "baseImageUri" => Ok(__FieldTag::__base_image_uri),
8602                            "base_image_uri" => Ok(__FieldTag::__base_image_uri),
8603                            "buildInfo" => Ok(__FieldTag::__build_info),
8604                            "build_info" => Ok(__FieldTag::__build_info),
8605                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8606                        }
8607                    }
8608                }
8609                deserializer.deserialize_identifier(Visitor)
8610            }
8611        }
8612        struct Visitor;
8613        impl<'de> serde::de::Visitor<'de> for Visitor {
8614            type Value = Container;
8615            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8616                formatter.write_str("struct Container")
8617            }
8618            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8619            where
8620                A: serde::de::MapAccess<'de>,
8621            {
8622                #[allow(unused_imports)]
8623                use serde::de::Error;
8624                use std::option::Option::Some;
8625                let mut fields = std::collections::HashSet::new();
8626                let mut result = Self::Value::new();
8627                while let Some(tag) = map.next_key::<__FieldTag>()? {
8628                    #[allow(clippy::match_single_binding)]
8629                    match tag {
8630                        __FieldTag::__name => {
8631                            if !fields.insert(__FieldTag::__name) {
8632                                return std::result::Result::Err(A::Error::duplicate_field(
8633                                    "multiple values for name",
8634                                ));
8635                            }
8636                            result.name = map
8637                                .next_value::<std::option::Option<std::string::String>>()?
8638                                .unwrap_or_default();
8639                        }
8640                        __FieldTag::__image => {
8641                            if !fields.insert(__FieldTag::__image) {
8642                                return std::result::Result::Err(A::Error::duplicate_field(
8643                                    "multiple values for image",
8644                                ));
8645                            }
8646                            result.image = map
8647                                .next_value::<std::option::Option<std::string::String>>()?
8648                                .unwrap_or_default();
8649                        }
8650                        __FieldTag::__command => {
8651                            if !fields.insert(__FieldTag::__command) {
8652                                return std::result::Result::Err(A::Error::duplicate_field(
8653                                    "multiple values for command",
8654                                ));
8655                            }
8656                            result.command = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8657                        }
8658                        __FieldTag::__args => {
8659                            if !fields.insert(__FieldTag::__args) {
8660                                return std::result::Result::Err(A::Error::duplicate_field(
8661                                    "multiple values for args",
8662                                ));
8663                            }
8664                            result.args = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8665                        }
8666                        __FieldTag::__env => {
8667                            if !fields.insert(__FieldTag::__env) {
8668                                return std::result::Result::Err(A::Error::duplicate_field(
8669                                    "multiple values for env",
8670                                ));
8671                            }
8672                            result.env = map.next_value::<std::option::Option<std::vec::Vec<crate::model::EnvVar>>>()?.unwrap_or_default();
8673                        }
8674                        __FieldTag::__resources => {
8675                            if !fields.insert(__FieldTag::__resources) {
8676                                return std::result::Result::Err(A::Error::duplicate_field(
8677                                    "multiple values for resources",
8678                                ));
8679                            }
8680                            result.resources = map.next_value::<std::option::Option<crate::model::ResourceRequirements>>()?
8681                                ;
8682                        }
8683                        __FieldTag::__ports => {
8684                            if !fields.insert(__FieldTag::__ports) {
8685                                return std::result::Result::Err(A::Error::duplicate_field(
8686                                    "multiple values for ports",
8687                                ));
8688                            }
8689                            result.ports = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ContainerPort>>>()?.unwrap_or_default();
8690                        }
8691                        __FieldTag::__volume_mounts => {
8692                            if !fields.insert(__FieldTag::__volume_mounts) {
8693                                return std::result::Result::Err(A::Error::duplicate_field(
8694                                    "multiple values for volume_mounts",
8695                                ));
8696                            }
8697                            result.volume_mounts = map.next_value::<std::option::Option<std::vec::Vec<crate::model::VolumeMount>>>()?.unwrap_or_default();
8698                        }
8699                        __FieldTag::__working_dir => {
8700                            if !fields.insert(__FieldTag::__working_dir) {
8701                                return std::result::Result::Err(A::Error::duplicate_field(
8702                                    "multiple values for working_dir",
8703                                ));
8704                            }
8705                            result.working_dir = map
8706                                .next_value::<std::option::Option<std::string::String>>()?
8707                                .unwrap_or_default();
8708                        }
8709                        __FieldTag::__liveness_probe => {
8710                            if !fields.insert(__FieldTag::__liveness_probe) {
8711                                return std::result::Result::Err(A::Error::duplicate_field(
8712                                    "multiple values for liveness_probe",
8713                                ));
8714                            }
8715                            result.liveness_probe =
8716                                map.next_value::<std::option::Option<crate::model::Probe>>()?;
8717                        }
8718                        __FieldTag::__startup_probe => {
8719                            if !fields.insert(__FieldTag::__startup_probe) {
8720                                return std::result::Result::Err(A::Error::duplicate_field(
8721                                    "multiple values for startup_probe",
8722                                ));
8723                            }
8724                            result.startup_probe =
8725                                map.next_value::<std::option::Option<crate::model::Probe>>()?;
8726                        }
8727                        __FieldTag::__depends_on => {
8728                            if !fields.insert(__FieldTag::__depends_on) {
8729                                return std::result::Result::Err(A::Error::duplicate_field(
8730                                    "multiple values for depends_on",
8731                                ));
8732                            }
8733                            result.depends_on = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8734                        }
8735                        __FieldTag::__base_image_uri => {
8736                            if !fields.insert(__FieldTag::__base_image_uri) {
8737                                return std::result::Result::Err(A::Error::duplicate_field(
8738                                    "multiple values for base_image_uri",
8739                                ));
8740                            }
8741                            result.base_image_uri = map
8742                                .next_value::<std::option::Option<std::string::String>>()?
8743                                .unwrap_or_default();
8744                        }
8745                        __FieldTag::__build_info => {
8746                            if !fields.insert(__FieldTag::__build_info) {
8747                                return std::result::Result::Err(A::Error::duplicate_field(
8748                                    "multiple values for build_info",
8749                                ));
8750                            }
8751                            result.build_info =
8752                                map.next_value::<std::option::Option<crate::model::BuildInfo>>()?;
8753                        }
8754                        __FieldTag::Unknown(key) => {
8755                            let value = map.next_value::<serde_json::Value>()?;
8756                            result._unknown_fields.insert(key, value);
8757                        }
8758                    }
8759                }
8760                std::result::Result::Ok(result)
8761            }
8762        }
8763        deserializer.deserialize_any(Visitor)
8764    }
8765}
8766
8767#[doc(hidden)]
8768impl serde::ser::Serialize for Container {
8769    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8770    where
8771        S: serde::ser::Serializer,
8772    {
8773        use serde::ser::SerializeMap;
8774        #[allow(unused_imports)]
8775        use std::option::Option::Some;
8776        let mut state = serializer.serialize_map(std::option::Option::None)?;
8777        if !self.name.is_empty() {
8778            state.serialize_entry("name", &self.name)?;
8779        }
8780        if !self.image.is_empty() {
8781            state.serialize_entry("image", &self.image)?;
8782        }
8783        if !self.command.is_empty() {
8784            state.serialize_entry("command", &self.command)?;
8785        }
8786        if !self.args.is_empty() {
8787            state.serialize_entry("args", &self.args)?;
8788        }
8789        if !self.env.is_empty() {
8790            state.serialize_entry("env", &self.env)?;
8791        }
8792        if self.resources.is_some() {
8793            state.serialize_entry("resources", &self.resources)?;
8794        }
8795        if !self.ports.is_empty() {
8796            state.serialize_entry("ports", &self.ports)?;
8797        }
8798        if !self.volume_mounts.is_empty() {
8799            state.serialize_entry("volumeMounts", &self.volume_mounts)?;
8800        }
8801        if !self.working_dir.is_empty() {
8802            state.serialize_entry("workingDir", &self.working_dir)?;
8803        }
8804        if self.liveness_probe.is_some() {
8805            state.serialize_entry("livenessProbe", &self.liveness_probe)?;
8806        }
8807        if self.startup_probe.is_some() {
8808            state.serialize_entry("startupProbe", &self.startup_probe)?;
8809        }
8810        if !self.depends_on.is_empty() {
8811            state.serialize_entry("dependsOn", &self.depends_on)?;
8812        }
8813        if !self.base_image_uri.is_empty() {
8814            state.serialize_entry("baseImageUri", &self.base_image_uri)?;
8815        }
8816        if self.build_info.is_some() {
8817            state.serialize_entry("buildInfo", &self.build_info)?;
8818        }
8819        if !self._unknown_fields.is_empty() {
8820            for (key, value) in self._unknown_fields.iter() {
8821                state.serialize_entry(key, &value)?;
8822            }
8823        }
8824        state.end()
8825    }
8826}
8827
8828/// ResourceRequirements describes the compute resource requirements.
8829#[derive(Clone, Debug, Default, PartialEq)]
8830#[non_exhaustive]
8831pub struct ResourceRequirements {
8832    /// Only `memory` and `cpu` keys in the map are supported.
8833    pub limits: std::collections::HashMap<std::string::String, std::string::String>,
8834
8835    /// Determines whether CPU is only allocated during requests (true by default).
8836    /// However, if ResourceRequirements is set, the caller must explicitly
8837    /// set this field to true to preserve the default behavior.
8838    pub cpu_idle: bool,
8839
8840    /// Determines whether CPU should be boosted on startup of a new container
8841    /// instance above the requested CPU threshold, this can help reduce cold-start
8842    /// latency.
8843    pub startup_cpu_boost: bool,
8844
8845    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8846}
8847
8848impl ResourceRequirements {
8849    pub fn new() -> Self {
8850        std::default::Default::default()
8851    }
8852
8853    /// Sets the value of [limits][crate::model::ResourceRequirements::limits].
8854    pub fn set_limits<T, K, V>(mut self, v: T) -> Self
8855    where
8856        T: std::iter::IntoIterator<Item = (K, V)>,
8857        K: std::convert::Into<std::string::String>,
8858        V: std::convert::Into<std::string::String>,
8859    {
8860        use std::iter::Iterator;
8861        self.limits = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8862        self
8863    }
8864
8865    /// Sets the value of [cpu_idle][crate::model::ResourceRequirements::cpu_idle].
8866    pub fn set_cpu_idle<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8867        self.cpu_idle = v.into();
8868        self
8869    }
8870
8871    /// Sets the value of [startup_cpu_boost][crate::model::ResourceRequirements::startup_cpu_boost].
8872    pub fn set_startup_cpu_boost<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8873        self.startup_cpu_boost = v.into();
8874        self
8875    }
8876}
8877
8878impl wkt::message::Message for ResourceRequirements {
8879    fn typename() -> &'static str {
8880        "type.googleapis.com/google.cloud.run.v2.ResourceRequirements"
8881    }
8882}
8883
8884#[doc(hidden)]
8885impl<'de> serde::de::Deserialize<'de> for ResourceRequirements {
8886    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8887    where
8888        D: serde::Deserializer<'de>,
8889    {
8890        #[allow(non_camel_case_types)]
8891        #[doc(hidden)]
8892        #[derive(PartialEq, Eq, Hash)]
8893        enum __FieldTag {
8894            __limits,
8895            __cpu_idle,
8896            __startup_cpu_boost,
8897            Unknown(std::string::String),
8898        }
8899        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8900            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8901            where
8902                D: serde::Deserializer<'de>,
8903            {
8904                struct Visitor;
8905                impl<'de> serde::de::Visitor<'de> for Visitor {
8906                    type Value = __FieldTag;
8907                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8908                        formatter.write_str("a field name for ResourceRequirements")
8909                    }
8910                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8911                    where
8912                        E: serde::de::Error,
8913                    {
8914                        use std::result::Result::Ok;
8915                        use std::string::ToString;
8916                        match value {
8917                            "limits" => Ok(__FieldTag::__limits),
8918                            "cpuIdle" => Ok(__FieldTag::__cpu_idle),
8919                            "cpu_idle" => Ok(__FieldTag::__cpu_idle),
8920                            "startupCpuBoost" => Ok(__FieldTag::__startup_cpu_boost),
8921                            "startup_cpu_boost" => Ok(__FieldTag::__startup_cpu_boost),
8922                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8923                        }
8924                    }
8925                }
8926                deserializer.deserialize_identifier(Visitor)
8927            }
8928        }
8929        struct Visitor;
8930        impl<'de> serde::de::Visitor<'de> for Visitor {
8931            type Value = ResourceRequirements;
8932            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8933                formatter.write_str("struct ResourceRequirements")
8934            }
8935            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8936            where
8937                A: serde::de::MapAccess<'de>,
8938            {
8939                #[allow(unused_imports)]
8940                use serde::de::Error;
8941                use std::option::Option::Some;
8942                let mut fields = std::collections::HashSet::new();
8943                let mut result = Self::Value::new();
8944                while let Some(tag) = map.next_key::<__FieldTag>()? {
8945                    #[allow(clippy::match_single_binding)]
8946                    match tag {
8947                        __FieldTag::__limits => {
8948                            if !fields.insert(__FieldTag::__limits) {
8949                                return std::result::Result::Err(A::Error::duplicate_field(
8950                                    "multiple values for limits",
8951                                ));
8952                            }
8953                            result.limits = map
8954                                .next_value::<std::option::Option<
8955                                    std::collections::HashMap<
8956                                        std::string::String,
8957                                        std::string::String,
8958                                    >,
8959                                >>()?
8960                                .unwrap_or_default();
8961                        }
8962                        __FieldTag::__cpu_idle => {
8963                            if !fields.insert(__FieldTag::__cpu_idle) {
8964                                return std::result::Result::Err(A::Error::duplicate_field(
8965                                    "multiple values for cpu_idle",
8966                                ));
8967                            }
8968                            result.cpu_idle = map
8969                                .next_value::<std::option::Option<bool>>()?
8970                                .unwrap_or_default();
8971                        }
8972                        __FieldTag::__startup_cpu_boost => {
8973                            if !fields.insert(__FieldTag::__startup_cpu_boost) {
8974                                return std::result::Result::Err(A::Error::duplicate_field(
8975                                    "multiple values for startup_cpu_boost",
8976                                ));
8977                            }
8978                            result.startup_cpu_boost = map
8979                                .next_value::<std::option::Option<bool>>()?
8980                                .unwrap_or_default();
8981                        }
8982                        __FieldTag::Unknown(key) => {
8983                            let value = map.next_value::<serde_json::Value>()?;
8984                            result._unknown_fields.insert(key, value);
8985                        }
8986                    }
8987                }
8988                std::result::Result::Ok(result)
8989            }
8990        }
8991        deserializer.deserialize_any(Visitor)
8992    }
8993}
8994
8995#[doc(hidden)]
8996impl serde::ser::Serialize for ResourceRequirements {
8997    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8998    where
8999        S: serde::ser::Serializer,
9000    {
9001        use serde::ser::SerializeMap;
9002        #[allow(unused_imports)]
9003        use std::option::Option::Some;
9004        let mut state = serializer.serialize_map(std::option::Option::None)?;
9005        if !self.limits.is_empty() {
9006            state.serialize_entry("limits", &self.limits)?;
9007        }
9008        if !wkt::internal::is_default(&self.cpu_idle) {
9009            state.serialize_entry("cpuIdle", &self.cpu_idle)?;
9010        }
9011        if !wkt::internal::is_default(&self.startup_cpu_boost) {
9012            state.serialize_entry("startupCpuBoost", &self.startup_cpu_boost)?;
9013        }
9014        if !self._unknown_fields.is_empty() {
9015            for (key, value) in self._unknown_fields.iter() {
9016                state.serialize_entry(key, &value)?;
9017            }
9018        }
9019        state.end()
9020    }
9021}
9022
9023/// EnvVar represents an environment variable present in a Container.
9024#[derive(Clone, Debug, Default, PartialEq)]
9025#[non_exhaustive]
9026pub struct EnvVar {
9027    /// Required. Name of the environment variable. Must not exceed 32768
9028    /// characters.
9029    pub name: std::string::String,
9030
9031    pub values: std::option::Option<crate::model::env_var::Values>,
9032
9033    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9034}
9035
9036impl EnvVar {
9037    pub fn new() -> Self {
9038        std::default::Default::default()
9039    }
9040
9041    /// Sets the value of [name][crate::model::EnvVar::name].
9042    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9043        self.name = v.into();
9044        self
9045    }
9046
9047    /// Sets the value of [values][crate::model::EnvVar::values].
9048    ///
9049    /// Note that all the setters affecting `values` are mutually
9050    /// exclusive.
9051    pub fn set_values<T: std::convert::Into<std::option::Option<crate::model::env_var::Values>>>(
9052        mut self,
9053        v: T,
9054    ) -> Self {
9055        self.values = v.into();
9056        self
9057    }
9058
9059    /// The value of [values][crate::model::EnvVar::values]
9060    /// if it holds a `Value`, `None` if the field is not set or
9061    /// holds a different branch.
9062    pub fn value(&self) -> std::option::Option<&std::string::String> {
9063        #[allow(unreachable_patterns)]
9064        self.values.as_ref().and_then(|v| match v {
9065            crate::model::env_var::Values::Value(v) => std::option::Option::Some(v),
9066            _ => std::option::Option::None,
9067        })
9068    }
9069
9070    /// Sets the value of [values][crate::model::EnvVar::values]
9071    /// to hold a `Value`.
9072    ///
9073    /// Note that all the setters affecting `values` are
9074    /// mutually exclusive.
9075    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9076        self.values = std::option::Option::Some(crate::model::env_var::Values::Value(v.into()));
9077        self
9078    }
9079
9080    /// The value of [values][crate::model::EnvVar::values]
9081    /// if it holds a `ValueSource`, `None` if the field is not set or
9082    /// holds a different branch.
9083    pub fn value_source(
9084        &self,
9085    ) -> std::option::Option<&std::boxed::Box<crate::model::EnvVarSource>> {
9086        #[allow(unreachable_patterns)]
9087        self.values.as_ref().and_then(|v| match v {
9088            crate::model::env_var::Values::ValueSource(v) => std::option::Option::Some(v),
9089            _ => std::option::Option::None,
9090        })
9091    }
9092
9093    /// Sets the value of [values][crate::model::EnvVar::values]
9094    /// to hold a `ValueSource`.
9095    ///
9096    /// Note that all the setters affecting `values` are
9097    /// mutually exclusive.
9098    pub fn set_value_source<T: std::convert::Into<std::boxed::Box<crate::model::EnvVarSource>>>(
9099        mut self,
9100        v: T,
9101    ) -> Self {
9102        self.values =
9103            std::option::Option::Some(crate::model::env_var::Values::ValueSource(v.into()));
9104        self
9105    }
9106}
9107
9108impl wkt::message::Message for EnvVar {
9109    fn typename() -> &'static str {
9110        "type.googleapis.com/google.cloud.run.v2.EnvVar"
9111    }
9112}
9113
9114#[doc(hidden)]
9115impl<'de> serde::de::Deserialize<'de> for EnvVar {
9116    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9117    where
9118        D: serde::Deserializer<'de>,
9119    {
9120        #[allow(non_camel_case_types)]
9121        #[doc(hidden)]
9122        #[derive(PartialEq, Eq, Hash)]
9123        enum __FieldTag {
9124            __name,
9125            __value,
9126            __value_source,
9127            Unknown(std::string::String),
9128        }
9129        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9130            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9131            where
9132                D: serde::Deserializer<'de>,
9133            {
9134                struct Visitor;
9135                impl<'de> serde::de::Visitor<'de> for Visitor {
9136                    type Value = __FieldTag;
9137                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9138                        formatter.write_str("a field name for EnvVar")
9139                    }
9140                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9141                    where
9142                        E: serde::de::Error,
9143                    {
9144                        use std::result::Result::Ok;
9145                        use std::string::ToString;
9146                        match value {
9147                            "name" => Ok(__FieldTag::__name),
9148                            "value" => Ok(__FieldTag::__value),
9149                            "valueSource" => Ok(__FieldTag::__value_source),
9150                            "value_source" => Ok(__FieldTag::__value_source),
9151                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9152                        }
9153                    }
9154                }
9155                deserializer.deserialize_identifier(Visitor)
9156            }
9157        }
9158        struct Visitor;
9159        impl<'de> serde::de::Visitor<'de> for Visitor {
9160            type Value = EnvVar;
9161            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9162                formatter.write_str("struct EnvVar")
9163            }
9164            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9165            where
9166                A: serde::de::MapAccess<'de>,
9167            {
9168                #[allow(unused_imports)]
9169                use serde::de::Error;
9170                use std::option::Option::Some;
9171                let mut fields = std::collections::HashSet::new();
9172                let mut result = Self::Value::new();
9173                while let Some(tag) = map.next_key::<__FieldTag>()? {
9174                    #[allow(clippy::match_single_binding)]
9175                    match tag {
9176                        __FieldTag::__name => {
9177                            if !fields.insert(__FieldTag::__name) {
9178                                return std::result::Result::Err(A::Error::duplicate_field(
9179                                    "multiple values for name",
9180                                ));
9181                            }
9182                            result.name = map
9183                                .next_value::<std::option::Option<std::string::String>>()?
9184                                .unwrap_or_default();
9185                        }
9186                        __FieldTag::__value => {
9187                            if !fields.insert(__FieldTag::__value) {
9188                                return std::result::Result::Err(A::Error::duplicate_field(
9189                                    "multiple values for value",
9190                                ));
9191                            }
9192                            if result.values.is_some() {
9193                                return std::result::Result::Err(A::Error::duplicate_field(
9194                                    "multiple values for `values`, a oneof with full ID .google.cloud.run.v2.EnvVar.value, latest field was value",
9195                                ));
9196                            }
9197                            result.values =
9198                                std::option::Option::Some(crate::model::env_var::Values::Value(
9199                                    map.next_value::<std::option::Option<std::string::String>>()?
9200                                        .unwrap_or_default(),
9201                                ));
9202                        }
9203                        __FieldTag::__value_source => {
9204                            if !fields.insert(__FieldTag::__value_source) {
9205                                return std::result::Result::Err(A::Error::duplicate_field(
9206                                    "multiple values for value_source",
9207                                ));
9208                            }
9209                            if result.values.is_some() {
9210                                return std::result::Result::Err(A::Error::duplicate_field(
9211                                    "multiple values for `values`, a oneof with full ID .google.cloud.run.v2.EnvVar.value_source, latest field was valueSource",
9212                                ));
9213                            }
9214                            result.values = std::option::Option::Some(
9215                                crate::model::env_var::Values::ValueSource(
9216                                    map.next_value::<std::option::Option<
9217                                        std::boxed::Box<crate::model::EnvVarSource>,
9218                                    >>()?
9219                                    .unwrap_or_default(),
9220                                ),
9221                            );
9222                        }
9223                        __FieldTag::Unknown(key) => {
9224                            let value = map.next_value::<serde_json::Value>()?;
9225                            result._unknown_fields.insert(key, value);
9226                        }
9227                    }
9228                }
9229                std::result::Result::Ok(result)
9230            }
9231        }
9232        deserializer.deserialize_any(Visitor)
9233    }
9234}
9235
9236#[doc(hidden)]
9237impl serde::ser::Serialize for EnvVar {
9238    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9239    where
9240        S: serde::ser::Serializer,
9241    {
9242        use serde::ser::SerializeMap;
9243        #[allow(unused_imports)]
9244        use std::option::Option::Some;
9245        let mut state = serializer.serialize_map(std::option::Option::None)?;
9246        if !self.name.is_empty() {
9247            state.serialize_entry("name", &self.name)?;
9248        }
9249        if let Some(value) = self.value() {
9250            state.serialize_entry("value", value)?;
9251        }
9252        if let Some(value) = self.value_source() {
9253            state.serialize_entry("valueSource", value)?;
9254        }
9255        if !self._unknown_fields.is_empty() {
9256            for (key, value) in self._unknown_fields.iter() {
9257                state.serialize_entry(key, &value)?;
9258            }
9259        }
9260        state.end()
9261    }
9262}
9263
9264/// Defines additional types related to [EnvVar].
9265pub mod env_var {
9266    #[allow(unused_imports)]
9267    use super::*;
9268
9269    #[derive(Clone, Debug, PartialEq)]
9270    #[non_exhaustive]
9271    pub enum Values {
9272        /// Literal value of the environment variable.
9273        /// Defaults to "", and the maximum length is 32768 bytes.
9274        /// Variable references are not supported in Cloud Run.
9275        Value(std::string::String),
9276        /// Source for the environment variable's value.
9277        ValueSource(std::boxed::Box<crate::model::EnvVarSource>),
9278    }
9279}
9280
9281/// EnvVarSource represents a source for the value of an EnvVar.
9282#[derive(Clone, Debug, Default, PartialEq)]
9283#[non_exhaustive]
9284pub struct EnvVarSource {
9285    /// Selects a secret and a specific version from Cloud Secret Manager.
9286    pub secret_key_ref: std::option::Option<crate::model::SecretKeySelector>,
9287
9288    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9289}
9290
9291impl EnvVarSource {
9292    pub fn new() -> Self {
9293        std::default::Default::default()
9294    }
9295
9296    /// Sets the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
9297    pub fn set_secret_key_ref<T>(mut self, v: T) -> Self
9298    where
9299        T: std::convert::Into<crate::model::SecretKeySelector>,
9300    {
9301        self.secret_key_ref = std::option::Option::Some(v.into());
9302        self
9303    }
9304
9305    /// Sets or clears the value of [secret_key_ref][crate::model::EnvVarSource::secret_key_ref].
9306    pub fn set_or_clear_secret_key_ref<T>(mut self, v: std::option::Option<T>) -> Self
9307    where
9308        T: std::convert::Into<crate::model::SecretKeySelector>,
9309    {
9310        self.secret_key_ref = v.map(|x| x.into());
9311        self
9312    }
9313}
9314
9315impl wkt::message::Message for EnvVarSource {
9316    fn typename() -> &'static str {
9317        "type.googleapis.com/google.cloud.run.v2.EnvVarSource"
9318    }
9319}
9320
9321#[doc(hidden)]
9322impl<'de> serde::de::Deserialize<'de> for EnvVarSource {
9323    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9324    where
9325        D: serde::Deserializer<'de>,
9326    {
9327        #[allow(non_camel_case_types)]
9328        #[doc(hidden)]
9329        #[derive(PartialEq, Eq, Hash)]
9330        enum __FieldTag {
9331            __secret_key_ref,
9332            Unknown(std::string::String),
9333        }
9334        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9335            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9336            where
9337                D: serde::Deserializer<'de>,
9338            {
9339                struct Visitor;
9340                impl<'de> serde::de::Visitor<'de> for Visitor {
9341                    type Value = __FieldTag;
9342                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9343                        formatter.write_str("a field name for EnvVarSource")
9344                    }
9345                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9346                    where
9347                        E: serde::de::Error,
9348                    {
9349                        use std::result::Result::Ok;
9350                        use std::string::ToString;
9351                        match value {
9352                            "secretKeyRef" => Ok(__FieldTag::__secret_key_ref),
9353                            "secret_key_ref" => Ok(__FieldTag::__secret_key_ref),
9354                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9355                        }
9356                    }
9357                }
9358                deserializer.deserialize_identifier(Visitor)
9359            }
9360        }
9361        struct Visitor;
9362        impl<'de> serde::de::Visitor<'de> for Visitor {
9363            type Value = EnvVarSource;
9364            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9365                formatter.write_str("struct EnvVarSource")
9366            }
9367            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9368            where
9369                A: serde::de::MapAccess<'de>,
9370            {
9371                #[allow(unused_imports)]
9372                use serde::de::Error;
9373                use std::option::Option::Some;
9374                let mut fields = std::collections::HashSet::new();
9375                let mut result = Self::Value::new();
9376                while let Some(tag) = map.next_key::<__FieldTag>()? {
9377                    #[allow(clippy::match_single_binding)]
9378                    match tag {
9379                        __FieldTag::__secret_key_ref => {
9380                            if !fields.insert(__FieldTag::__secret_key_ref) {
9381                                return std::result::Result::Err(A::Error::duplicate_field(
9382                                    "multiple values for secret_key_ref",
9383                                ));
9384                            }
9385                            result.secret_key_ref = map
9386                                .next_value::<std::option::Option<crate::model::SecretKeySelector>>(
9387                                )?;
9388                        }
9389                        __FieldTag::Unknown(key) => {
9390                            let value = map.next_value::<serde_json::Value>()?;
9391                            result._unknown_fields.insert(key, value);
9392                        }
9393                    }
9394                }
9395                std::result::Result::Ok(result)
9396            }
9397        }
9398        deserializer.deserialize_any(Visitor)
9399    }
9400}
9401
9402#[doc(hidden)]
9403impl serde::ser::Serialize for EnvVarSource {
9404    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9405    where
9406        S: serde::ser::Serializer,
9407    {
9408        use serde::ser::SerializeMap;
9409        #[allow(unused_imports)]
9410        use std::option::Option::Some;
9411        let mut state = serializer.serialize_map(std::option::Option::None)?;
9412        if self.secret_key_ref.is_some() {
9413            state.serialize_entry("secretKeyRef", &self.secret_key_ref)?;
9414        }
9415        if !self._unknown_fields.is_empty() {
9416            for (key, value) in self._unknown_fields.iter() {
9417                state.serialize_entry(key, &value)?;
9418            }
9419        }
9420        state.end()
9421    }
9422}
9423
9424/// SecretEnvVarSource represents a source for the value of an EnvVar.
9425#[derive(Clone, Debug, Default, PartialEq)]
9426#[non_exhaustive]
9427pub struct SecretKeySelector {
9428    /// Required. The name of the secret in Cloud Secret Manager.
9429    /// Format: {secret_name} if the secret is in the same project.
9430    /// projects/{project}/secrets/{secret_name} if the secret is
9431    /// in a different project.
9432    pub secret: std::string::String,
9433
9434    /// The Cloud Secret Manager secret version.
9435    /// Can be 'latest' for the latest version, an integer for a specific version,
9436    /// or a version alias.
9437    pub version: std::string::String,
9438
9439    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9440}
9441
9442impl SecretKeySelector {
9443    pub fn new() -> Self {
9444        std::default::Default::default()
9445    }
9446
9447    /// Sets the value of [secret][crate::model::SecretKeySelector::secret].
9448    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9449        self.secret = v.into();
9450        self
9451    }
9452
9453    /// Sets the value of [version][crate::model::SecretKeySelector::version].
9454    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9455        self.version = v.into();
9456        self
9457    }
9458}
9459
9460impl wkt::message::Message for SecretKeySelector {
9461    fn typename() -> &'static str {
9462        "type.googleapis.com/google.cloud.run.v2.SecretKeySelector"
9463    }
9464}
9465
9466#[doc(hidden)]
9467impl<'de> serde::de::Deserialize<'de> for SecretKeySelector {
9468    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9469    where
9470        D: serde::Deserializer<'de>,
9471    {
9472        #[allow(non_camel_case_types)]
9473        #[doc(hidden)]
9474        #[derive(PartialEq, Eq, Hash)]
9475        enum __FieldTag {
9476            __secret,
9477            __version,
9478            Unknown(std::string::String),
9479        }
9480        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9481            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9482            where
9483                D: serde::Deserializer<'de>,
9484            {
9485                struct Visitor;
9486                impl<'de> serde::de::Visitor<'de> for Visitor {
9487                    type Value = __FieldTag;
9488                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9489                        formatter.write_str("a field name for SecretKeySelector")
9490                    }
9491                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9492                    where
9493                        E: serde::de::Error,
9494                    {
9495                        use std::result::Result::Ok;
9496                        use std::string::ToString;
9497                        match value {
9498                            "secret" => Ok(__FieldTag::__secret),
9499                            "version" => Ok(__FieldTag::__version),
9500                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9501                        }
9502                    }
9503                }
9504                deserializer.deserialize_identifier(Visitor)
9505            }
9506        }
9507        struct Visitor;
9508        impl<'de> serde::de::Visitor<'de> for Visitor {
9509            type Value = SecretKeySelector;
9510            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9511                formatter.write_str("struct SecretKeySelector")
9512            }
9513            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9514            where
9515                A: serde::de::MapAccess<'de>,
9516            {
9517                #[allow(unused_imports)]
9518                use serde::de::Error;
9519                use std::option::Option::Some;
9520                let mut fields = std::collections::HashSet::new();
9521                let mut result = Self::Value::new();
9522                while let Some(tag) = map.next_key::<__FieldTag>()? {
9523                    #[allow(clippy::match_single_binding)]
9524                    match tag {
9525                        __FieldTag::__secret => {
9526                            if !fields.insert(__FieldTag::__secret) {
9527                                return std::result::Result::Err(A::Error::duplicate_field(
9528                                    "multiple values for secret",
9529                                ));
9530                            }
9531                            result.secret = map
9532                                .next_value::<std::option::Option<std::string::String>>()?
9533                                .unwrap_or_default();
9534                        }
9535                        __FieldTag::__version => {
9536                            if !fields.insert(__FieldTag::__version) {
9537                                return std::result::Result::Err(A::Error::duplicate_field(
9538                                    "multiple values for version",
9539                                ));
9540                            }
9541                            result.version = map
9542                                .next_value::<std::option::Option<std::string::String>>()?
9543                                .unwrap_or_default();
9544                        }
9545                        __FieldTag::Unknown(key) => {
9546                            let value = map.next_value::<serde_json::Value>()?;
9547                            result._unknown_fields.insert(key, value);
9548                        }
9549                    }
9550                }
9551                std::result::Result::Ok(result)
9552            }
9553        }
9554        deserializer.deserialize_any(Visitor)
9555    }
9556}
9557
9558#[doc(hidden)]
9559impl serde::ser::Serialize for SecretKeySelector {
9560    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9561    where
9562        S: serde::ser::Serializer,
9563    {
9564        use serde::ser::SerializeMap;
9565        #[allow(unused_imports)]
9566        use std::option::Option::Some;
9567        let mut state = serializer.serialize_map(std::option::Option::None)?;
9568        if !self.secret.is_empty() {
9569            state.serialize_entry("secret", &self.secret)?;
9570        }
9571        if !self.version.is_empty() {
9572            state.serialize_entry("version", &self.version)?;
9573        }
9574        if !self._unknown_fields.is_empty() {
9575            for (key, value) in self._unknown_fields.iter() {
9576                state.serialize_entry(key, &value)?;
9577            }
9578        }
9579        state.end()
9580    }
9581}
9582
9583/// ContainerPort represents a network port in a single container.
9584#[derive(Clone, Debug, Default, PartialEq)]
9585#[non_exhaustive]
9586pub struct ContainerPort {
9587    /// If specified, used to specify which protocol to use.
9588    /// Allowed values are "http1" and "h2c".
9589    pub name: std::string::String,
9590
9591    /// Port number the container listens on.
9592    /// This must be a valid TCP port number, 0 < container_port < 65536.
9593    pub container_port: i32,
9594
9595    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9596}
9597
9598impl ContainerPort {
9599    pub fn new() -> Self {
9600        std::default::Default::default()
9601    }
9602
9603    /// Sets the value of [name][crate::model::ContainerPort::name].
9604    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9605        self.name = v.into();
9606        self
9607    }
9608
9609    /// Sets the value of [container_port][crate::model::ContainerPort::container_port].
9610    pub fn set_container_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9611        self.container_port = v.into();
9612        self
9613    }
9614}
9615
9616impl wkt::message::Message for ContainerPort {
9617    fn typename() -> &'static str {
9618        "type.googleapis.com/google.cloud.run.v2.ContainerPort"
9619    }
9620}
9621
9622#[doc(hidden)]
9623impl<'de> serde::de::Deserialize<'de> for ContainerPort {
9624    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9625    where
9626        D: serde::Deserializer<'de>,
9627    {
9628        #[allow(non_camel_case_types)]
9629        #[doc(hidden)]
9630        #[derive(PartialEq, Eq, Hash)]
9631        enum __FieldTag {
9632            __name,
9633            __container_port,
9634            Unknown(std::string::String),
9635        }
9636        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9637            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9638            where
9639                D: serde::Deserializer<'de>,
9640            {
9641                struct Visitor;
9642                impl<'de> serde::de::Visitor<'de> for Visitor {
9643                    type Value = __FieldTag;
9644                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9645                        formatter.write_str("a field name for ContainerPort")
9646                    }
9647                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9648                    where
9649                        E: serde::de::Error,
9650                    {
9651                        use std::result::Result::Ok;
9652                        use std::string::ToString;
9653                        match value {
9654                            "name" => Ok(__FieldTag::__name),
9655                            "containerPort" => Ok(__FieldTag::__container_port),
9656                            "container_port" => Ok(__FieldTag::__container_port),
9657                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9658                        }
9659                    }
9660                }
9661                deserializer.deserialize_identifier(Visitor)
9662            }
9663        }
9664        struct Visitor;
9665        impl<'de> serde::de::Visitor<'de> for Visitor {
9666            type Value = ContainerPort;
9667            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9668                formatter.write_str("struct ContainerPort")
9669            }
9670            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9671            where
9672                A: serde::de::MapAccess<'de>,
9673            {
9674                #[allow(unused_imports)]
9675                use serde::de::Error;
9676                use std::option::Option::Some;
9677                let mut fields = std::collections::HashSet::new();
9678                let mut result = Self::Value::new();
9679                while let Some(tag) = map.next_key::<__FieldTag>()? {
9680                    #[allow(clippy::match_single_binding)]
9681                    match tag {
9682                        __FieldTag::__name => {
9683                            if !fields.insert(__FieldTag::__name) {
9684                                return std::result::Result::Err(A::Error::duplicate_field(
9685                                    "multiple values for name",
9686                                ));
9687                            }
9688                            result.name = map
9689                                .next_value::<std::option::Option<std::string::String>>()?
9690                                .unwrap_or_default();
9691                        }
9692                        __FieldTag::__container_port => {
9693                            if !fields.insert(__FieldTag::__container_port) {
9694                                return std::result::Result::Err(A::Error::duplicate_field(
9695                                    "multiple values for container_port",
9696                                ));
9697                            }
9698                            struct __With(std::option::Option<i32>);
9699                            impl<'de> serde::de::Deserialize<'de> for __With {
9700                                fn deserialize<D>(
9701                                    deserializer: D,
9702                                ) -> std::result::Result<Self, D::Error>
9703                                where
9704                                    D: serde::de::Deserializer<'de>,
9705                                {
9706                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
9707                                }
9708                            }
9709                            result.container_port =
9710                                map.next_value::<__With>()?.0.unwrap_or_default();
9711                        }
9712                        __FieldTag::Unknown(key) => {
9713                            let value = map.next_value::<serde_json::Value>()?;
9714                            result._unknown_fields.insert(key, value);
9715                        }
9716                    }
9717                }
9718                std::result::Result::Ok(result)
9719            }
9720        }
9721        deserializer.deserialize_any(Visitor)
9722    }
9723}
9724
9725#[doc(hidden)]
9726impl serde::ser::Serialize for ContainerPort {
9727    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9728    where
9729        S: serde::ser::Serializer,
9730    {
9731        use serde::ser::SerializeMap;
9732        #[allow(unused_imports)]
9733        use std::option::Option::Some;
9734        let mut state = serializer.serialize_map(std::option::Option::None)?;
9735        if !self.name.is_empty() {
9736            state.serialize_entry("name", &self.name)?;
9737        }
9738        if !wkt::internal::is_default(&self.container_port) {
9739            struct __With<'a>(&'a i32);
9740            impl<'a> serde::ser::Serialize for __With<'a> {
9741                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9742                where
9743                    S: serde::ser::Serializer,
9744                {
9745                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
9746                }
9747            }
9748            state.serialize_entry("containerPort", &__With(&self.container_port))?;
9749        }
9750        if !self._unknown_fields.is_empty() {
9751            for (key, value) in self._unknown_fields.iter() {
9752                state.serialize_entry(key, &value)?;
9753            }
9754        }
9755        state.end()
9756    }
9757}
9758
9759/// VolumeMount describes a mounting of a Volume within a container.
9760#[derive(Clone, Debug, Default, PartialEq)]
9761#[non_exhaustive]
9762pub struct VolumeMount {
9763    /// Required. This must match the Name of a Volume.
9764    pub name: std::string::String,
9765
9766    /// Required. Path within the container at which the volume should be mounted.
9767    /// Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must
9768    /// otherwise be `/cloudsql`. All instances defined in the Volume will be
9769    /// available as `/cloudsql/[instance]`. For more information on Cloud SQL
9770    /// volumes, visit <https://cloud.google.com/sql/docs/mysql/connect-run>
9771    pub mount_path: std::string::String,
9772
9773    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9774}
9775
9776impl VolumeMount {
9777    pub fn new() -> Self {
9778        std::default::Default::default()
9779    }
9780
9781    /// Sets the value of [name][crate::model::VolumeMount::name].
9782    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9783        self.name = v.into();
9784        self
9785    }
9786
9787    /// Sets the value of [mount_path][crate::model::VolumeMount::mount_path].
9788    pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9789        self.mount_path = v.into();
9790        self
9791    }
9792}
9793
9794impl wkt::message::Message for VolumeMount {
9795    fn typename() -> &'static str {
9796        "type.googleapis.com/google.cloud.run.v2.VolumeMount"
9797    }
9798}
9799
9800#[doc(hidden)]
9801impl<'de> serde::de::Deserialize<'de> for VolumeMount {
9802    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9803    where
9804        D: serde::Deserializer<'de>,
9805    {
9806        #[allow(non_camel_case_types)]
9807        #[doc(hidden)]
9808        #[derive(PartialEq, Eq, Hash)]
9809        enum __FieldTag {
9810            __name,
9811            __mount_path,
9812            Unknown(std::string::String),
9813        }
9814        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9815            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9816            where
9817                D: serde::Deserializer<'de>,
9818            {
9819                struct Visitor;
9820                impl<'de> serde::de::Visitor<'de> for Visitor {
9821                    type Value = __FieldTag;
9822                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9823                        formatter.write_str("a field name for VolumeMount")
9824                    }
9825                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9826                    where
9827                        E: serde::de::Error,
9828                    {
9829                        use std::result::Result::Ok;
9830                        use std::string::ToString;
9831                        match value {
9832                            "name" => Ok(__FieldTag::__name),
9833                            "mountPath" => Ok(__FieldTag::__mount_path),
9834                            "mount_path" => Ok(__FieldTag::__mount_path),
9835                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9836                        }
9837                    }
9838                }
9839                deserializer.deserialize_identifier(Visitor)
9840            }
9841        }
9842        struct Visitor;
9843        impl<'de> serde::de::Visitor<'de> for Visitor {
9844            type Value = VolumeMount;
9845            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9846                formatter.write_str("struct VolumeMount")
9847            }
9848            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9849            where
9850                A: serde::de::MapAccess<'de>,
9851            {
9852                #[allow(unused_imports)]
9853                use serde::de::Error;
9854                use std::option::Option::Some;
9855                let mut fields = std::collections::HashSet::new();
9856                let mut result = Self::Value::new();
9857                while let Some(tag) = map.next_key::<__FieldTag>()? {
9858                    #[allow(clippy::match_single_binding)]
9859                    match tag {
9860                        __FieldTag::__name => {
9861                            if !fields.insert(__FieldTag::__name) {
9862                                return std::result::Result::Err(A::Error::duplicate_field(
9863                                    "multiple values for name",
9864                                ));
9865                            }
9866                            result.name = map
9867                                .next_value::<std::option::Option<std::string::String>>()?
9868                                .unwrap_or_default();
9869                        }
9870                        __FieldTag::__mount_path => {
9871                            if !fields.insert(__FieldTag::__mount_path) {
9872                                return std::result::Result::Err(A::Error::duplicate_field(
9873                                    "multiple values for mount_path",
9874                                ));
9875                            }
9876                            result.mount_path = map
9877                                .next_value::<std::option::Option<std::string::String>>()?
9878                                .unwrap_or_default();
9879                        }
9880                        __FieldTag::Unknown(key) => {
9881                            let value = map.next_value::<serde_json::Value>()?;
9882                            result._unknown_fields.insert(key, value);
9883                        }
9884                    }
9885                }
9886                std::result::Result::Ok(result)
9887            }
9888        }
9889        deserializer.deserialize_any(Visitor)
9890    }
9891}
9892
9893#[doc(hidden)]
9894impl serde::ser::Serialize for VolumeMount {
9895    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9896    where
9897        S: serde::ser::Serializer,
9898    {
9899        use serde::ser::SerializeMap;
9900        #[allow(unused_imports)]
9901        use std::option::Option::Some;
9902        let mut state = serializer.serialize_map(std::option::Option::None)?;
9903        if !self.name.is_empty() {
9904            state.serialize_entry("name", &self.name)?;
9905        }
9906        if !self.mount_path.is_empty() {
9907            state.serialize_entry("mountPath", &self.mount_path)?;
9908        }
9909        if !self._unknown_fields.is_empty() {
9910            for (key, value) in self._unknown_fields.iter() {
9911                state.serialize_entry(key, &value)?;
9912            }
9913        }
9914        state.end()
9915    }
9916}
9917
9918/// Volume represents a named volume in a container.
9919#[derive(Clone, Debug, Default, PartialEq)]
9920#[non_exhaustive]
9921pub struct Volume {
9922    /// Required. Volume's name.
9923    pub name: std::string::String,
9924
9925    pub volume_type: std::option::Option<crate::model::volume::VolumeType>,
9926
9927    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9928}
9929
9930impl Volume {
9931    pub fn new() -> Self {
9932        std::default::Default::default()
9933    }
9934
9935    /// Sets the value of [name][crate::model::Volume::name].
9936    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9937        self.name = v.into();
9938        self
9939    }
9940
9941    /// Sets the value of [volume_type][crate::model::Volume::volume_type].
9942    ///
9943    /// Note that all the setters affecting `volume_type` are mutually
9944    /// exclusive.
9945    pub fn set_volume_type<
9946        T: std::convert::Into<std::option::Option<crate::model::volume::VolumeType>>,
9947    >(
9948        mut self,
9949        v: T,
9950    ) -> Self {
9951        self.volume_type = v.into();
9952        self
9953    }
9954
9955    /// The value of [volume_type][crate::model::Volume::volume_type]
9956    /// if it holds a `Secret`, `None` if the field is not set or
9957    /// holds a different branch.
9958    pub fn secret(
9959        &self,
9960    ) -> std::option::Option<&std::boxed::Box<crate::model::SecretVolumeSource>> {
9961        #[allow(unreachable_patterns)]
9962        self.volume_type.as_ref().and_then(|v| match v {
9963            crate::model::volume::VolumeType::Secret(v) => std::option::Option::Some(v),
9964            _ => std::option::Option::None,
9965        })
9966    }
9967
9968    /// Sets the value of [volume_type][crate::model::Volume::volume_type]
9969    /// to hold a `Secret`.
9970    ///
9971    /// Note that all the setters affecting `volume_type` are
9972    /// mutually exclusive.
9973    pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretVolumeSource>>>(
9974        mut self,
9975        v: T,
9976    ) -> Self {
9977        self.volume_type =
9978            std::option::Option::Some(crate::model::volume::VolumeType::Secret(v.into()));
9979        self
9980    }
9981
9982    /// The value of [volume_type][crate::model::Volume::volume_type]
9983    /// if it holds a `CloudSqlInstance`, `None` if the field is not set or
9984    /// holds a different branch.
9985    pub fn cloud_sql_instance(
9986        &self,
9987    ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSqlInstance>> {
9988        #[allow(unreachable_patterns)]
9989        self.volume_type.as_ref().and_then(|v| match v {
9990            crate::model::volume::VolumeType::CloudSqlInstance(v) => std::option::Option::Some(v),
9991            _ => std::option::Option::None,
9992        })
9993    }
9994
9995    /// Sets the value of [volume_type][crate::model::Volume::volume_type]
9996    /// to hold a `CloudSqlInstance`.
9997    ///
9998    /// Note that all the setters affecting `volume_type` are
9999    /// mutually exclusive.
10000    pub fn set_cloud_sql_instance<
10001        T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlInstance>>,
10002    >(
10003        mut self,
10004        v: T,
10005    ) -> Self {
10006        self.volume_type =
10007            std::option::Option::Some(crate::model::volume::VolumeType::CloudSqlInstance(v.into()));
10008        self
10009    }
10010
10011    /// The value of [volume_type][crate::model::Volume::volume_type]
10012    /// if it holds a `EmptyDir`, `None` if the field is not set or
10013    /// holds a different branch.
10014    pub fn empty_dir(
10015        &self,
10016    ) -> std::option::Option<&std::boxed::Box<crate::model::EmptyDirVolumeSource>> {
10017        #[allow(unreachable_patterns)]
10018        self.volume_type.as_ref().and_then(|v| match v {
10019            crate::model::volume::VolumeType::EmptyDir(v) => std::option::Option::Some(v),
10020            _ => std::option::Option::None,
10021        })
10022    }
10023
10024    /// Sets the value of [volume_type][crate::model::Volume::volume_type]
10025    /// to hold a `EmptyDir`.
10026    ///
10027    /// Note that all the setters affecting `volume_type` are
10028    /// mutually exclusive.
10029    pub fn set_empty_dir<
10030        T: std::convert::Into<std::boxed::Box<crate::model::EmptyDirVolumeSource>>,
10031    >(
10032        mut self,
10033        v: T,
10034    ) -> Self {
10035        self.volume_type =
10036            std::option::Option::Some(crate::model::volume::VolumeType::EmptyDir(v.into()));
10037        self
10038    }
10039
10040    /// The value of [volume_type][crate::model::Volume::volume_type]
10041    /// if it holds a `Nfs`, `None` if the field is not set or
10042    /// holds a different branch.
10043    pub fn nfs(&self) -> std::option::Option<&std::boxed::Box<crate::model::NFSVolumeSource>> {
10044        #[allow(unreachable_patterns)]
10045        self.volume_type.as_ref().and_then(|v| match v {
10046            crate::model::volume::VolumeType::Nfs(v) => std::option::Option::Some(v),
10047            _ => std::option::Option::None,
10048        })
10049    }
10050
10051    /// Sets the value of [volume_type][crate::model::Volume::volume_type]
10052    /// to hold a `Nfs`.
10053    ///
10054    /// Note that all the setters affecting `volume_type` are
10055    /// mutually exclusive.
10056    pub fn set_nfs<T: std::convert::Into<std::boxed::Box<crate::model::NFSVolumeSource>>>(
10057        mut self,
10058        v: T,
10059    ) -> Self {
10060        self.volume_type =
10061            std::option::Option::Some(crate::model::volume::VolumeType::Nfs(v.into()));
10062        self
10063    }
10064
10065    /// The value of [volume_type][crate::model::Volume::volume_type]
10066    /// if it holds a `Gcs`, `None` if the field is not set or
10067    /// holds a different branch.
10068    pub fn gcs(&self) -> std::option::Option<&std::boxed::Box<crate::model::GCSVolumeSource>> {
10069        #[allow(unreachable_patterns)]
10070        self.volume_type.as_ref().and_then(|v| match v {
10071            crate::model::volume::VolumeType::Gcs(v) => std::option::Option::Some(v),
10072            _ => std::option::Option::None,
10073        })
10074    }
10075
10076    /// Sets the value of [volume_type][crate::model::Volume::volume_type]
10077    /// to hold a `Gcs`.
10078    ///
10079    /// Note that all the setters affecting `volume_type` are
10080    /// mutually exclusive.
10081    pub fn set_gcs<T: std::convert::Into<std::boxed::Box<crate::model::GCSVolumeSource>>>(
10082        mut self,
10083        v: T,
10084    ) -> Self {
10085        self.volume_type =
10086            std::option::Option::Some(crate::model::volume::VolumeType::Gcs(v.into()));
10087        self
10088    }
10089}
10090
10091impl wkt::message::Message for Volume {
10092    fn typename() -> &'static str {
10093        "type.googleapis.com/google.cloud.run.v2.Volume"
10094    }
10095}
10096
10097#[doc(hidden)]
10098impl<'de> serde::de::Deserialize<'de> for Volume {
10099    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10100    where
10101        D: serde::Deserializer<'de>,
10102    {
10103        #[allow(non_camel_case_types)]
10104        #[doc(hidden)]
10105        #[derive(PartialEq, Eq, Hash)]
10106        enum __FieldTag {
10107            __name,
10108            __secret,
10109            __cloud_sql_instance,
10110            __empty_dir,
10111            __nfs,
10112            __gcs,
10113            Unknown(std::string::String),
10114        }
10115        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10116            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10117            where
10118                D: serde::Deserializer<'de>,
10119            {
10120                struct Visitor;
10121                impl<'de> serde::de::Visitor<'de> for Visitor {
10122                    type Value = __FieldTag;
10123                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10124                        formatter.write_str("a field name for Volume")
10125                    }
10126                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10127                    where
10128                        E: serde::de::Error,
10129                    {
10130                        use std::result::Result::Ok;
10131                        use std::string::ToString;
10132                        match value {
10133                            "name" => Ok(__FieldTag::__name),
10134                            "secret" => Ok(__FieldTag::__secret),
10135                            "cloudSqlInstance" => Ok(__FieldTag::__cloud_sql_instance),
10136                            "cloud_sql_instance" => Ok(__FieldTag::__cloud_sql_instance),
10137                            "emptyDir" => Ok(__FieldTag::__empty_dir),
10138                            "empty_dir" => Ok(__FieldTag::__empty_dir),
10139                            "nfs" => Ok(__FieldTag::__nfs),
10140                            "gcs" => Ok(__FieldTag::__gcs),
10141                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10142                        }
10143                    }
10144                }
10145                deserializer.deserialize_identifier(Visitor)
10146            }
10147        }
10148        struct Visitor;
10149        impl<'de> serde::de::Visitor<'de> for Visitor {
10150            type Value = Volume;
10151            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10152                formatter.write_str("struct Volume")
10153            }
10154            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10155            where
10156                A: serde::de::MapAccess<'de>,
10157            {
10158                #[allow(unused_imports)]
10159                use serde::de::Error;
10160                use std::option::Option::Some;
10161                let mut fields = std::collections::HashSet::new();
10162                let mut result = Self::Value::new();
10163                while let Some(tag) = map.next_key::<__FieldTag>()? {
10164                    #[allow(clippy::match_single_binding)]
10165                    match tag {
10166                        __FieldTag::__name => {
10167                            if !fields.insert(__FieldTag::__name) {
10168                                return std::result::Result::Err(A::Error::duplicate_field(
10169                                    "multiple values for name",
10170                                ));
10171                            }
10172                            result.name = map
10173                                .next_value::<std::option::Option<std::string::String>>()?
10174                                .unwrap_or_default();
10175                        }
10176                        __FieldTag::__secret => {
10177                            if !fields.insert(__FieldTag::__secret) {
10178                                return std::result::Result::Err(A::Error::duplicate_field(
10179                                    "multiple values for secret",
10180                                ));
10181                            }
10182                            if result.volume_type.is_some() {
10183                                return std::result::Result::Err(A::Error::duplicate_field(
10184                                    "multiple values for `volume_type`, a oneof with full ID .google.cloud.run.v2.Volume.secret, latest field was secret",
10185                                ));
10186                            }
10187                            result.volume_type = std::option::Option::Some(
10188                                crate::model::volume::VolumeType::Secret(
10189                                    map.next_value::<std::option::Option<
10190                                        std::boxed::Box<crate::model::SecretVolumeSource>,
10191                                    >>()?
10192                                    .unwrap_or_default(),
10193                                ),
10194                            );
10195                        }
10196                        __FieldTag::__cloud_sql_instance => {
10197                            if !fields.insert(__FieldTag::__cloud_sql_instance) {
10198                                return std::result::Result::Err(A::Error::duplicate_field(
10199                                    "multiple values for cloud_sql_instance",
10200                                ));
10201                            }
10202                            if result.volume_type.is_some() {
10203                                return std::result::Result::Err(A::Error::duplicate_field(
10204                                    "multiple values for `volume_type`, a oneof with full ID .google.cloud.run.v2.Volume.cloud_sql_instance, latest field was cloudSqlInstance",
10205                                ));
10206                            }
10207                            result.volume_type = std::option::Option::Some(
10208                                crate::model::volume::VolumeType::CloudSqlInstance(
10209                                    map.next_value::<std::option::Option<
10210                                        std::boxed::Box<crate::model::CloudSqlInstance>,
10211                                    >>()?
10212                                    .unwrap_or_default(),
10213                                ),
10214                            );
10215                        }
10216                        __FieldTag::__empty_dir => {
10217                            if !fields.insert(__FieldTag::__empty_dir) {
10218                                return std::result::Result::Err(A::Error::duplicate_field(
10219                                    "multiple values for empty_dir",
10220                                ));
10221                            }
10222                            if result.volume_type.is_some() {
10223                                return std::result::Result::Err(A::Error::duplicate_field(
10224                                    "multiple values for `volume_type`, a oneof with full ID .google.cloud.run.v2.Volume.empty_dir, latest field was emptyDir",
10225                                ));
10226                            }
10227                            result.volume_type = std::option::Option::Some(
10228                                crate::model::volume::VolumeType::EmptyDir(
10229                                    map.next_value::<std::option::Option<
10230                                        std::boxed::Box<crate::model::EmptyDirVolumeSource>,
10231                                    >>()?
10232                                    .unwrap_or_default(),
10233                                ),
10234                            );
10235                        }
10236                        __FieldTag::__nfs => {
10237                            if !fields.insert(__FieldTag::__nfs) {
10238                                return std::result::Result::Err(A::Error::duplicate_field(
10239                                    "multiple values for nfs",
10240                                ));
10241                            }
10242                            if result.volume_type.is_some() {
10243                                return std::result::Result::Err(A::Error::duplicate_field(
10244                                    "multiple values for `volume_type`, a oneof with full ID .google.cloud.run.v2.Volume.nfs, latest field was nfs",
10245                                ));
10246                            }
10247                            result.volume_type =
10248                                std::option::Option::Some(crate::model::volume::VolumeType::Nfs(
10249                                    map.next_value::<std::option::Option<
10250                                        std::boxed::Box<crate::model::NFSVolumeSource>,
10251                                    >>()?
10252                                    .unwrap_or_default(),
10253                                ));
10254                        }
10255                        __FieldTag::__gcs => {
10256                            if !fields.insert(__FieldTag::__gcs) {
10257                                return std::result::Result::Err(A::Error::duplicate_field(
10258                                    "multiple values for gcs",
10259                                ));
10260                            }
10261                            if result.volume_type.is_some() {
10262                                return std::result::Result::Err(A::Error::duplicate_field(
10263                                    "multiple values for `volume_type`, a oneof with full ID .google.cloud.run.v2.Volume.gcs, latest field was gcs",
10264                                ));
10265                            }
10266                            result.volume_type =
10267                                std::option::Option::Some(crate::model::volume::VolumeType::Gcs(
10268                                    map.next_value::<std::option::Option<
10269                                        std::boxed::Box<crate::model::GCSVolumeSource>,
10270                                    >>()?
10271                                    .unwrap_or_default(),
10272                                ));
10273                        }
10274                        __FieldTag::Unknown(key) => {
10275                            let value = map.next_value::<serde_json::Value>()?;
10276                            result._unknown_fields.insert(key, value);
10277                        }
10278                    }
10279                }
10280                std::result::Result::Ok(result)
10281            }
10282        }
10283        deserializer.deserialize_any(Visitor)
10284    }
10285}
10286
10287#[doc(hidden)]
10288impl serde::ser::Serialize for Volume {
10289    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10290    where
10291        S: serde::ser::Serializer,
10292    {
10293        use serde::ser::SerializeMap;
10294        #[allow(unused_imports)]
10295        use std::option::Option::Some;
10296        let mut state = serializer.serialize_map(std::option::Option::None)?;
10297        if !self.name.is_empty() {
10298            state.serialize_entry("name", &self.name)?;
10299        }
10300        if let Some(value) = self.secret() {
10301            state.serialize_entry("secret", value)?;
10302        }
10303        if let Some(value) = self.cloud_sql_instance() {
10304            state.serialize_entry("cloudSqlInstance", value)?;
10305        }
10306        if let Some(value) = self.empty_dir() {
10307            state.serialize_entry("emptyDir", value)?;
10308        }
10309        if let Some(value) = self.nfs() {
10310            state.serialize_entry("nfs", value)?;
10311        }
10312        if let Some(value) = self.gcs() {
10313            state.serialize_entry("gcs", value)?;
10314        }
10315        if !self._unknown_fields.is_empty() {
10316            for (key, value) in self._unknown_fields.iter() {
10317                state.serialize_entry(key, &value)?;
10318            }
10319        }
10320        state.end()
10321    }
10322}
10323
10324/// Defines additional types related to [Volume].
10325pub mod volume {
10326    #[allow(unused_imports)]
10327    use super::*;
10328
10329    #[derive(Clone, Debug, PartialEq)]
10330    #[non_exhaustive]
10331    pub enum VolumeType {
10332        /// Secret represents a secret that should populate this volume.
10333        Secret(std::boxed::Box<crate::model::SecretVolumeSource>),
10334        /// For Cloud SQL volumes, contains the specific instances that should be
10335        /// mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
10336        /// more information on how to connect Cloud SQL and Cloud Run.
10337        CloudSqlInstance(std::boxed::Box<crate::model::CloudSqlInstance>),
10338        /// Ephemeral storage used as a shared volume.
10339        EmptyDir(std::boxed::Box<crate::model::EmptyDirVolumeSource>),
10340        /// For NFS Voumes, contains the path to the nfs Volume
10341        Nfs(std::boxed::Box<crate::model::NFSVolumeSource>),
10342        /// Persistent storage backed by a Google Cloud Storage bucket.
10343        Gcs(std::boxed::Box<crate::model::GCSVolumeSource>),
10344    }
10345}
10346
10347/// The secret's value will be presented as the content of a file whose
10348/// name is defined in the item path. If no items are defined, the name of
10349/// the file is the secret.
10350#[derive(Clone, Debug, Default, PartialEq)]
10351#[non_exhaustive]
10352pub struct SecretVolumeSource {
10353    /// Required. The name of the secret in Cloud Secret Manager.
10354    /// Format: {secret} if the secret is in the same project.
10355    /// projects/{project}/secrets/{secret} if the secret is
10356    /// in a different project.
10357    pub secret: std::string::String,
10358
10359    /// If unspecified, the volume will expose a file whose name is the
10360    /// secret, relative to VolumeMount.mount_path.
10361    /// If specified, the key will be used as the version to fetch from Cloud
10362    /// Secret Manager and the path will be the name of the file exposed in the
10363    /// volume. When items are defined, they must specify a path and a version.
10364    pub items: std::vec::Vec<crate::model::VersionToPath>,
10365
10366    /// Integer representation of mode bits to use on created files by default.
10367    /// Must be a value between 0000 and 0777 (octal), defaulting to 0444.
10368    /// Directories within the path are not affected by  this setting.
10369    ///
10370    /// Notes
10371    ///
10372    /// * Internally, a umask of 0222 will be applied to any non-zero value.
10373    /// * This is an integer representation of the mode bits. So, the octal
10374    ///   integer value should look exactly as the chmod numeric notation with a
10375    ///   leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
10376    ///   or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
10377    ///   493 (base-10).
10378    /// * This might be in conflict with other options that affect the
10379    ///   file mode, like fsGroup, and the result can be other mode bits set.
10380    ///
10381    /// This might be in conflict with other options that affect the
10382    /// file mode, like fsGroup, and as a result, other mode bits could be set.
10383    pub default_mode: i32,
10384
10385    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10386}
10387
10388impl SecretVolumeSource {
10389    pub fn new() -> Self {
10390        std::default::Default::default()
10391    }
10392
10393    /// Sets the value of [secret][crate::model::SecretVolumeSource::secret].
10394    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10395        self.secret = v.into();
10396        self
10397    }
10398
10399    /// Sets the value of [items][crate::model::SecretVolumeSource::items].
10400    pub fn set_items<T, V>(mut self, v: T) -> Self
10401    where
10402        T: std::iter::IntoIterator<Item = V>,
10403        V: std::convert::Into<crate::model::VersionToPath>,
10404    {
10405        use std::iter::Iterator;
10406        self.items = v.into_iter().map(|i| i.into()).collect();
10407        self
10408    }
10409
10410    /// Sets the value of [default_mode][crate::model::SecretVolumeSource::default_mode].
10411    pub fn set_default_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10412        self.default_mode = v.into();
10413        self
10414    }
10415}
10416
10417impl wkt::message::Message for SecretVolumeSource {
10418    fn typename() -> &'static str {
10419        "type.googleapis.com/google.cloud.run.v2.SecretVolumeSource"
10420    }
10421}
10422
10423#[doc(hidden)]
10424impl<'de> serde::de::Deserialize<'de> for SecretVolumeSource {
10425    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10426    where
10427        D: serde::Deserializer<'de>,
10428    {
10429        #[allow(non_camel_case_types)]
10430        #[doc(hidden)]
10431        #[derive(PartialEq, Eq, Hash)]
10432        enum __FieldTag {
10433            __secret,
10434            __items,
10435            __default_mode,
10436            Unknown(std::string::String),
10437        }
10438        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10439            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10440            where
10441                D: serde::Deserializer<'de>,
10442            {
10443                struct Visitor;
10444                impl<'de> serde::de::Visitor<'de> for Visitor {
10445                    type Value = __FieldTag;
10446                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10447                        formatter.write_str("a field name for SecretVolumeSource")
10448                    }
10449                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10450                    where
10451                        E: serde::de::Error,
10452                    {
10453                        use std::result::Result::Ok;
10454                        use std::string::ToString;
10455                        match value {
10456                            "secret" => Ok(__FieldTag::__secret),
10457                            "items" => Ok(__FieldTag::__items),
10458                            "defaultMode" => Ok(__FieldTag::__default_mode),
10459                            "default_mode" => Ok(__FieldTag::__default_mode),
10460                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10461                        }
10462                    }
10463                }
10464                deserializer.deserialize_identifier(Visitor)
10465            }
10466        }
10467        struct Visitor;
10468        impl<'de> serde::de::Visitor<'de> for Visitor {
10469            type Value = SecretVolumeSource;
10470            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10471                formatter.write_str("struct SecretVolumeSource")
10472            }
10473            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10474            where
10475                A: serde::de::MapAccess<'de>,
10476            {
10477                #[allow(unused_imports)]
10478                use serde::de::Error;
10479                use std::option::Option::Some;
10480                let mut fields = std::collections::HashSet::new();
10481                let mut result = Self::Value::new();
10482                while let Some(tag) = map.next_key::<__FieldTag>()? {
10483                    #[allow(clippy::match_single_binding)]
10484                    match tag {
10485                        __FieldTag::__secret => {
10486                            if !fields.insert(__FieldTag::__secret) {
10487                                return std::result::Result::Err(A::Error::duplicate_field(
10488                                    "multiple values for secret",
10489                                ));
10490                            }
10491                            result.secret = map
10492                                .next_value::<std::option::Option<std::string::String>>()?
10493                                .unwrap_or_default();
10494                        }
10495                        __FieldTag::__items => {
10496                            if !fields.insert(__FieldTag::__items) {
10497                                return std::result::Result::Err(A::Error::duplicate_field(
10498                                    "multiple values for items",
10499                                ));
10500                            }
10501                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::VersionToPath>>>()?.unwrap_or_default();
10502                        }
10503                        __FieldTag::__default_mode => {
10504                            if !fields.insert(__FieldTag::__default_mode) {
10505                                return std::result::Result::Err(A::Error::duplicate_field(
10506                                    "multiple values for default_mode",
10507                                ));
10508                            }
10509                            struct __With(std::option::Option<i32>);
10510                            impl<'de> serde::de::Deserialize<'de> for __With {
10511                                fn deserialize<D>(
10512                                    deserializer: D,
10513                                ) -> std::result::Result<Self, D::Error>
10514                                where
10515                                    D: serde::de::Deserializer<'de>,
10516                                {
10517                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
10518                                }
10519                            }
10520                            result.default_mode = map.next_value::<__With>()?.0.unwrap_or_default();
10521                        }
10522                        __FieldTag::Unknown(key) => {
10523                            let value = map.next_value::<serde_json::Value>()?;
10524                            result._unknown_fields.insert(key, value);
10525                        }
10526                    }
10527                }
10528                std::result::Result::Ok(result)
10529            }
10530        }
10531        deserializer.deserialize_any(Visitor)
10532    }
10533}
10534
10535#[doc(hidden)]
10536impl serde::ser::Serialize for SecretVolumeSource {
10537    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10538    where
10539        S: serde::ser::Serializer,
10540    {
10541        use serde::ser::SerializeMap;
10542        #[allow(unused_imports)]
10543        use std::option::Option::Some;
10544        let mut state = serializer.serialize_map(std::option::Option::None)?;
10545        if !self.secret.is_empty() {
10546            state.serialize_entry("secret", &self.secret)?;
10547        }
10548        if !self.items.is_empty() {
10549            state.serialize_entry("items", &self.items)?;
10550        }
10551        if !wkt::internal::is_default(&self.default_mode) {
10552            struct __With<'a>(&'a i32);
10553            impl<'a> serde::ser::Serialize for __With<'a> {
10554                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10555                where
10556                    S: serde::ser::Serializer,
10557                {
10558                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
10559                }
10560            }
10561            state.serialize_entry("defaultMode", &__With(&self.default_mode))?;
10562        }
10563        if !self._unknown_fields.is_empty() {
10564            for (key, value) in self._unknown_fields.iter() {
10565                state.serialize_entry(key, &value)?;
10566            }
10567        }
10568        state.end()
10569    }
10570}
10571
10572/// VersionToPath maps a specific version of a secret to a relative file to mount
10573/// to, relative to VolumeMount's mount_path.
10574#[derive(Clone, Debug, Default, PartialEq)]
10575#[non_exhaustive]
10576pub struct VersionToPath {
10577    /// Required. The relative path of the secret in the container.
10578    pub path: std::string::String,
10579
10580    /// The Cloud Secret Manager secret version.
10581    /// Can be 'latest' for the latest value, or an integer or a secret alias for a
10582    /// specific version.
10583    pub version: std::string::String,
10584
10585    /// Integer octal mode bits to use on this file, must be a value between
10586    /// 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
10587    /// used.
10588    ///
10589    /// Notes
10590    ///
10591    /// * Internally, a umask of 0222 will be applied to any non-zero value.
10592    /// * This is an integer representation of the mode bits. So, the octal
10593    ///   integer value should look exactly as the chmod numeric notation with a
10594    ///   leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal)
10595    ///   or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or
10596    ///   493 (base-10).
10597    /// * This might be in conflict with other options that affect the
10598    ///   file mode, like fsGroup, and the result can be other mode bits set.
10599    pub mode: i32,
10600
10601    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10602}
10603
10604impl VersionToPath {
10605    pub fn new() -> Self {
10606        std::default::Default::default()
10607    }
10608
10609    /// Sets the value of [path][crate::model::VersionToPath::path].
10610    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10611        self.path = v.into();
10612        self
10613    }
10614
10615    /// Sets the value of [version][crate::model::VersionToPath::version].
10616    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10617        self.version = v.into();
10618        self
10619    }
10620
10621    /// Sets the value of [mode][crate::model::VersionToPath::mode].
10622    pub fn set_mode<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10623        self.mode = v.into();
10624        self
10625    }
10626}
10627
10628impl wkt::message::Message for VersionToPath {
10629    fn typename() -> &'static str {
10630        "type.googleapis.com/google.cloud.run.v2.VersionToPath"
10631    }
10632}
10633
10634#[doc(hidden)]
10635impl<'de> serde::de::Deserialize<'de> for VersionToPath {
10636    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10637    where
10638        D: serde::Deserializer<'de>,
10639    {
10640        #[allow(non_camel_case_types)]
10641        #[doc(hidden)]
10642        #[derive(PartialEq, Eq, Hash)]
10643        enum __FieldTag {
10644            __path,
10645            __version,
10646            __mode,
10647            Unknown(std::string::String),
10648        }
10649        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10650            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10651            where
10652                D: serde::Deserializer<'de>,
10653            {
10654                struct Visitor;
10655                impl<'de> serde::de::Visitor<'de> for Visitor {
10656                    type Value = __FieldTag;
10657                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10658                        formatter.write_str("a field name for VersionToPath")
10659                    }
10660                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10661                    where
10662                        E: serde::de::Error,
10663                    {
10664                        use std::result::Result::Ok;
10665                        use std::string::ToString;
10666                        match value {
10667                            "path" => Ok(__FieldTag::__path),
10668                            "version" => Ok(__FieldTag::__version),
10669                            "mode" => Ok(__FieldTag::__mode),
10670                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10671                        }
10672                    }
10673                }
10674                deserializer.deserialize_identifier(Visitor)
10675            }
10676        }
10677        struct Visitor;
10678        impl<'de> serde::de::Visitor<'de> for Visitor {
10679            type Value = VersionToPath;
10680            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10681                formatter.write_str("struct VersionToPath")
10682            }
10683            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10684            where
10685                A: serde::de::MapAccess<'de>,
10686            {
10687                #[allow(unused_imports)]
10688                use serde::de::Error;
10689                use std::option::Option::Some;
10690                let mut fields = std::collections::HashSet::new();
10691                let mut result = Self::Value::new();
10692                while let Some(tag) = map.next_key::<__FieldTag>()? {
10693                    #[allow(clippy::match_single_binding)]
10694                    match tag {
10695                        __FieldTag::__path => {
10696                            if !fields.insert(__FieldTag::__path) {
10697                                return std::result::Result::Err(A::Error::duplicate_field(
10698                                    "multiple values for path",
10699                                ));
10700                            }
10701                            result.path = map
10702                                .next_value::<std::option::Option<std::string::String>>()?
10703                                .unwrap_or_default();
10704                        }
10705                        __FieldTag::__version => {
10706                            if !fields.insert(__FieldTag::__version) {
10707                                return std::result::Result::Err(A::Error::duplicate_field(
10708                                    "multiple values for version",
10709                                ));
10710                            }
10711                            result.version = map
10712                                .next_value::<std::option::Option<std::string::String>>()?
10713                                .unwrap_or_default();
10714                        }
10715                        __FieldTag::__mode => {
10716                            if !fields.insert(__FieldTag::__mode) {
10717                                return std::result::Result::Err(A::Error::duplicate_field(
10718                                    "multiple values for mode",
10719                                ));
10720                            }
10721                            struct __With(std::option::Option<i32>);
10722                            impl<'de> serde::de::Deserialize<'de> for __With {
10723                                fn deserialize<D>(
10724                                    deserializer: D,
10725                                ) -> std::result::Result<Self, D::Error>
10726                                where
10727                                    D: serde::de::Deserializer<'de>,
10728                                {
10729                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
10730                                }
10731                            }
10732                            result.mode = map.next_value::<__With>()?.0.unwrap_or_default();
10733                        }
10734                        __FieldTag::Unknown(key) => {
10735                            let value = map.next_value::<serde_json::Value>()?;
10736                            result._unknown_fields.insert(key, value);
10737                        }
10738                    }
10739                }
10740                std::result::Result::Ok(result)
10741            }
10742        }
10743        deserializer.deserialize_any(Visitor)
10744    }
10745}
10746
10747#[doc(hidden)]
10748impl serde::ser::Serialize for VersionToPath {
10749    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10750    where
10751        S: serde::ser::Serializer,
10752    {
10753        use serde::ser::SerializeMap;
10754        #[allow(unused_imports)]
10755        use std::option::Option::Some;
10756        let mut state = serializer.serialize_map(std::option::Option::None)?;
10757        if !self.path.is_empty() {
10758            state.serialize_entry("path", &self.path)?;
10759        }
10760        if !self.version.is_empty() {
10761            state.serialize_entry("version", &self.version)?;
10762        }
10763        if !wkt::internal::is_default(&self.mode) {
10764            struct __With<'a>(&'a i32);
10765            impl<'a> serde::ser::Serialize for __With<'a> {
10766                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10767                where
10768                    S: serde::ser::Serializer,
10769                {
10770                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
10771                }
10772            }
10773            state.serialize_entry("mode", &__With(&self.mode))?;
10774        }
10775        if !self._unknown_fields.is_empty() {
10776            for (key, value) in self._unknown_fields.iter() {
10777                state.serialize_entry(key, &value)?;
10778            }
10779        }
10780        state.end()
10781    }
10782}
10783
10784/// Represents a set of Cloud SQL instances. Each one will be available under
10785/// /cloudsql/[instance]. Visit
10786/// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
10787/// how to connect Cloud SQL and Cloud Run.
10788#[derive(Clone, Debug, Default, PartialEq)]
10789#[non_exhaustive]
10790pub struct CloudSqlInstance {
10791    /// The Cloud SQL instance connection names, as can be found in
10792    /// <https://console.cloud.google.com/sql/instances>. Visit
10793    /// <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on
10794    /// how to connect Cloud SQL and Cloud Run. Format:
10795    /// {project}:{location}:{instance}
10796    pub instances: std::vec::Vec<std::string::String>,
10797
10798    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10799}
10800
10801impl CloudSqlInstance {
10802    pub fn new() -> Self {
10803        std::default::Default::default()
10804    }
10805
10806    /// Sets the value of [instances][crate::model::CloudSqlInstance::instances].
10807    pub fn set_instances<T, V>(mut self, v: T) -> Self
10808    where
10809        T: std::iter::IntoIterator<Item = V>,
10810        V: std::convert::Into<std::string::String>,
10811    {
10812        use std::iter::Iterator;
10813        self.instances = v.into_iter().map(|i| i.into()).collect();
10814        self
10815    }
10816}
10817
10818impl wkt::message::Message for CloudSqlInstance {
10819    fn typename() -> &'static str {
10820        "type.googleapis.com/google.cloud.run.v2.CloudSqlInstance"
10821    }
10822}
10823
10824#[doc(hidden)]
10825impl<'de> serde::de::Deserialize<'de> for CloudSqlInstance {
10826    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10827    where
10828        D: serde::Deserializer<'de>,
10829    {
10830        #[allow(non_camel_case_types)]
10831        #[doc(hidden)]
10832        #[derive(PartialEq, Eq, Hash)]
10833        enum __FieldTag {
10834            __instances,
10835            Unknown(std::string::String),
10836        }
10837        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10838            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10839            where
10840                D: serde::Deserializer<'de>,
10841            {
10842                struct Visitor;
10843                impl<'de> serde::de::Visitor<'de> for Visitor {
10844                    type Value = __FieldTag;
10845                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10846                        formatter.write_str("a field name for CloudSqlInstance")
10847                    }
10848                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10849                    where
10850                        E: serde::de::Error,
10851                    {
10852                        use std::result::Result::Ok;
10853                        use std::string::ToString;
10854                        match value {
10855                            "instances" => Ok(__FieldTag::__instances),
10856                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10857                        }
10858                    }
10859                }
10860                deserializer.deserialize_identifier(Visitor)
10861            }
10862        }
10863        struct Visitor;
10864        impl<'de> serde::de::Visitor<'de> for Visitor {
10865            type Value = CloudSqlInstance;
10866            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10867                formatter.write_str("struct CloudSqlInstance")
10868            }
10869            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10870            where
10871                A: serde::de::MapAccess<'de>,
10872            {
10873                #[allow(unused_imports)]
10874                use serde::de::Error;
10875                use std::option::Option::Some;
10876                let mut fields = std::collections::HashSet::new();
10877                let mut result = Self::Value::new();
10878                while let Some(tag) = map.next_key::<__FieldTag>()? {
10879                    #[allow(clippy::match_single_binding)]
10880                    match tag {
10881                        __FieldTag::__instances => {
10882                            if !fields.insert(__FieldTag::__instances) {
10883                                return std::result::Result::Err(A::Error::duplicate_field(
10884                                    "multiple values for instances",
10885                                ));
10886                            }
10887                            result.instances = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10888                        }
10889                        __FieldTag::Unknown(key) => {
10890                            let value = map.next_value::<serde_json::Value>()?;
10891                            result._unknown_fields.insert(key, value);
10892                        }
10893                    }
10894                }
10895                std::result::Result::Ok(result)
10896            }
10897        }
10898        deserializer.deserialize_any(Visitor)
10899    }
10900}
10901
10902#[doc(hidden)]
10903impl serde::ser::Serialize for CloudSqlInstance {
10904    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10905    where
10906        S: serde::ser::Serializer,
10907    {
10908        use serde::ser::SerializeMap;
10909        #[allow(unused_imports)]
10910        use std::option::Option::Some;
10911        let mut state = serializer.serialize_map(std::option::Option::None)?;
10912        if !self.instances.is_empty() {
10913            state.serialize_entry("instances", &self.instances)?;
10914        }
10915        if !self._unknown_fields.is_empty() {
10916            for (key, value) in self._unknown_fields.iter() {
10917                state.serialize_entry(key, &value)?;
10918            }
10919        }
10920        state.end()
10921    }
10922}
10923
10924/// In memory (tmpfs) ephemeral storage.
10925/// It is ephemeral in the sense that when the sandbox is taken down, the data is
10926/// destroyed with it (it does not persist across sandbox runs).
10927#[derive(Clone, Debug, Default, PartialEq)]
10928#[non_exhaustive]
10929pub struct EmptyDirVolumeSource {
10930    /// The medium on which the data is stored. Acceptable values today is only
10931    /// MEMORY or none. When none, the default will currently be backed by memory
10932    /// but could change over time. +optional
10933    pub medium: crate::model::empty_dir_volume_source::Medium,
10934
10935    /// Limit on the storage usable by this EmptyDir volume.
10936    /// The size limit is also applicable for memory medium.
10937    /// The maximum usage on memory medium EmptyDir would be the minimum value
10938    /// between the SizeLimit specified here and the sum of memory limits of all
10939    /// containers. The default is nil which means that the limit is undefined.
10940    /// More info:
10941    /// <https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume>.
10942    /// Info in Kubernetes:
10943    /// <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir>
10944    pub size_limit: std::string::String,
10945
10946    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10947}
10948
10949impl EmptyDirVolumeSource {
10950    pub fn new() -> Self {
10951        std::default::Default::default()
10952    }
10953
10954    /// Sets the value of [medium][crate::model::EmptyDirVolumeSource::medium].
10955    pub fn set_medium<T: std::convert::Into<crate::model::empty_dir_volume_source::Medium>>(
10956        mut self,
10957        v: T,
10958    ) -> Self {
10959        self.medium = v.into();
10960        self
10961    }
10962
10963    /// Sets the value of [size_limit][crate::model::EmptyDirVolumeSource::size_limit].
10964    pub fn set_size_limit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10965        self.size_limit = v.into();
10966        self
10967    }
10968}
10969
10970impl wkt::message::Message for EmptyDirVolumeSource {
10971    fn typename() -> &'static str {
10972        "type.googleapis.com/google.cloud.run.v2.EmptyDirVolumeSource"
10973    }
10974}
10975
10976#[doc(hidden)]
10977impl<'de> serde::de::Deserialize<'de> for EmptyDirVolumeSource {
10978    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10979    where
10980        D: serde::Deserializer<'de>,
10981    {
10982        #[allow(non_camel_case_types)]
10983        #[doc(hidden)]
10984        #[derive(PartialEq, Eq, Hash)]
10985        enum __FieldTag {
10986            __medium,
10987            __size_limit,
10988            Unknown(std::string::String),
10989        }
10990        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10991            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10992            where
10993                D: serde::Deserializer<'de>,
10994            {
10995                struct Visitor;
10996                impl<'de> serde::de::Visitor<'de> for Visitor {
10997                    type Value = __FieldTag;
10998                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10999                        formatter.write_str("a field name for EmptyDirVolumeSource")
11000                    }
11001                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11002                    where
11003                        E: serde::de::Error,
11004                    {
11005                        use std::result::Result::Ok;
11006                        use std::string::ToString;
11007                        match value {
11008                            "medium" => Ok(__FieldTag::__medium),
11009                            "sizeLimit" => Ok(__FieldTag::__size_limit),
11010                            "size_limit" => Ok(__FieldTag::__size_limit),
11011                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11012                        }
11013                    }
11014                }
11015                deserializer.deserialize_identifier(Visitor)
11016            }
11017        }
11018        struct Visitor;
11019        impl<'de> serde::de::Visitor<'de> for Visitor {
11020            type Value = EmptyDirVolumeSource;
11021            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11022                formatter.write_str("struct EmptyDirVolumeSource")
11023            }
11024            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11025            where
11026                A: serde::de::MapAccess<'de>,
11027            {
11028                #[allow(unused_imports)]
11029                use serde::de::Error;
11030                use std::option::Option::Some;
11031                let mut fields = std::collections::HashSet::new();
11032                let mut result = Self::Value::new();
11033                while let Some(tag) = map.next_key::<__FieldTag>()? {
11034                    #[allow(clippy::match_single_binding)]
11035                    match tag {
11036                        __FieldTag::__medium => {
11037                            if !fields.insert(__FieldTag::__medium) {
11038                                return std::result::Result::Err(A::Error::duplicate_field(
11039                                    "multiple values for medium",
11040                                ));
11041                            }
11042                            result.medium =
11043                                map.next_value::<std::option::Option<
11044                                    crate::model::empty_dir_volume_source::Medium,
11045                                >>()?
11046                                .unwrap_or_default();
11047                        }
11048                        __FieldTag::__size_limit => {
11049                            if !fields.insert(__FieldTag::__size_limit) {
11050                                return std::result::Result::Err(A::Error::duplicate_field(
11051                                    "multiple values for size_limit",
11052                                ));
11053                            }
11054                            result.size_limit = map
11055                                .next_value::<std::option::Option<std::string::String>>()?
11056                                .unwrap_or_default();
11057                        }
11058                        __FieldTag::Unknown(key) => {
11059                            let value = map.next_value::<serde_json::Value>()?;
11060                            result._unknown_fields.insert(key, value);
11061                        }
11062                    }
11063                }
11064                std::result::Result::Ok(result)
11065            }
11066        }
11067        deserializer.deserialize_any(Visitor)
11068    }
11069}
11070
11071#[doc(hidden)]
11072impl serde::ser::Serialize for EmptyDirVolumeSource {
11073    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11074    where
11075        S: serde::ser::Serializer,
11076    {
11077        use serde::ser::SerializeMap;
11078        #[allow(unused_imports)]
11079        use std::option::Option::Some;
11080        let mut state = serializer.serialize_map(std::option::Option::None)?;
11081        if !wkt::internal::is_default(&self.medium) {
11082            state.serialize_entry("medium", &self.medium)?;
11083        }
11084        if !self.size_limit.is_empty() {
11085            state.serialize_entry("sizeLimit", &self.size_limit)?;
11086        }
11087        if !self._unknown_fields.is_empty() {
11088            for (key, value) in self._unknown_fields.iter() {
11089                state.serialize_entry(key, &value)?;
11090            }
11091        }
11092        state.end()
11093    }
11094}
11095
11096/// Defines additional types related to [EmptyDirVolumeSource].
11097pub mod empty_dir_volume_source {
11098    #[allow(unused_imports)]
11099    use super::*;
11100
11101    /// The different types of medium supported for EmptyDir.
11102    ///
11103    /// # Working with unknown values
11104    ///
11105    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11106    /// additional enum variants at any time. Adding new variants is not considered
11107    /// a breaking change. Applications should write their code in anticipation of:
11108    ///
11109    /// - New values appearing in future releases of the client library, **and**
11110    /// - New values received dynamically, without application changes.
11111    ///
11112    /// Please consult the [Working with enums] section in the user guide for some
11113    /// guidelines.
11114    ///
11115    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11116    #[derive(Clone, Debug, PartialEq)]
11117    #[non_exhaustive]
11118    pub enum Medium {
11119        /// When not specified, falls back to the default implementation which
11120        /// is currently in memory (this may change over time).
11121        Unspecified,
11122        /// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
11123        Memory,
11124        /// If set, the enum was initialized with an unknown value.
11125        ///
11126        /// Applications can examine the value using [Medium::value] or
11127        /// [Medium::name].
11128        UnknownValue(medium::UnknownValue),
11129    }
11130
11131    #[doc(hidden)]
11132    pub mod medium {
11133        #[allow(unused_imports)]
11134        use super::*;
11135        #[derive(Clone, Debug, PartialEq)]
11136        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11137    }
11138
11139    impl Medium {
11140        /// Gets the enum value.
11141        ///
11142        /// Returns `None` if the enum contains an unknown value deserialized from
11143        /// the string representation of enums.
11144        pub fn value(&self) -> std::option::Option<i32> {
11145            match self {
11146                Self::Unspecified => std::option::Option::Some(0),
11147                Self::Memory => std::option::Option::Some(1),
11148                Self::UnknownValue(u) => u.0.value(),
11149            }
11150        }
11151
11152        /// Gets the enum value as a string.
11153        ///
11154        /// Returns `None` if the enum contains an unknown value deserialized from
11155        /// the integer representation of enums.
11156        pub fn name(&self) -> std::option::Option<&str> {
11157            match self {
11158                Self::Unspecified => std::option::Option::Some("MEDIUM_UNSPECIFIED"),
11159                Self::Memory => std::option::Option::Some("MEMORY"),
11160                Self::UnknownValue(u) => u.0.name(),
11161            }
11162        }
11163    }
11164
11165    impl std::default::Default for Medium {
11166        fn default() -> Self {
11167            use std::convert::From;
11168            Self::from(0)
11169        }
11170    }
11171
11172    impl std::fmt::Display for Medium {
11173        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11174            wkt::internal::display_enum(f, self.name(), self.value())
11175        }
11176    }
11177
11178    impl std::convert::From<i32> for Medium {
11179        fn from(value: i32) -> Self {
11180            match value {
11181                0 => Self::Unspecified,
11182                1 => Self::Memory,
11183                _ => Self::UnknownValue(medium::UnknownValue(
11184                    wkt::internal::UnknownEnumValue::Integer(value),
11185                )),
11186            }
11187        }
11188    }
11189
11190    impl std::convert::From<&str> for Medium {
11191        fn from(value: &str) -> Self {
11192            use std::string::ToString;
11193            match value {
11194                "MEDIUM_UNSPECIFIED" => Self::Unspecified,
11195                "MEMORY" => Self::Memory,
11196                _ => Self::UnknownValue(medium::UnknownValue(
11197                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11198                )),
11199            }
11200        }
11201    }
11202
11203    impl serde::ser::Serialize for Medium {
11204        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11205        where
11206            S: serde::Serializer,
11207        {
11208            match self {
11209                Self::Unspecified => serializer.serialize_i32(0),
11210                Self::Memory => serializer.serialize_i32(1),
11211                Self::UnknownValue(u) => u.0.serialize(serializer),
11212            }
11213        }
11214    }
11215
11216    impl<'de> serde::de::Deserialize<'de> for Medium {
11217        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11218        where
11219            D: serde::Deserializer<'de>,
11220        {
11221            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Medium>::new(
11222                ".google.cloud.run.v2.EmptyDirVolumeSource.Medium",
11223            ))
11224        }
11225    }
11226}
11227
11228/// Represents an NFS mount.
11229#[derive(Clone, Debug, Default, PartialEq)]
11230#[non_exhaustive]
11231pub struct NFSVolumeSource {
11232    /// Hostname or IP address of the NFS server
11233    pub server: std::string::String,
11234
11235    /// Path that is exported by the NFS server.
11236    pub path: std::string::String,
11237
11238    /// If true, the volume will be mounted as read only for all mounts.
11239    pub read_only: bool,
11240
11241    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11242}
11243
11244impl NFSVolumeSource {
11245    pub fn new() -> Self {
11246        std::default::Default::default()
11247    }
11248
11249    /// Sets the value of [server][crate::model::NFSVolumeSource::server].
11250    pub fn set_server<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11251        self.server = v.into();
11252        self
11253    }
11254
11255    /// Sets the value of [path][crate::model::NFSVolumeSource::path].
11256    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11257        self.path = v.into();
11258        self
11259    }
11260
11261    /// Sets the value of [read_only][crate::model::NFSVolumeSource::read_only].
11262    pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11263        self.read_only = v.into();
11264        self
11265    }
11266}
11267
11268impl wkt::message::Message for NFSVolumeSource {
11269    fn typename() -> &'static str {
11270        "type.googleapis.com/google.cloud.run.v2.NFSVolumeSource"
11271    }
11272}
11273
11274#[doc(hidden)]
11275impl<'de> serde::de::Deserialize<'de> for NFSVolumeSource {
11276    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11277    where
11278        D: serde::Deserializer<'de>,
11279    {
11280        #[allow(non_camel_case_types)]
11281        #[doc(hidden)]
11282        #[derive(PartialEq, Eq, Hash)]
11283        enum __FieldTag {
11284            __server,
11285            __path,
11286            __read_only,
11287            Unknown(std::string::String),
11288        }
11289        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11290            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11291            where
11292                D: serde::Deserializer<'de>,
11293            {
11294                struct Visitor;
11295                impl<'de> serde::de::Visitor<'de> for Visitor {
11296                    type Value = __FieldTag;
11297                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11298                        formatter.write_str("a field name for NFSVolumeSource")
11299                    }
11300                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11301                    where
11302                        E: serde::de::Error,
11303                    {
11304                        use std::result::Result::Ok;
11305                        use std::string::ToString;
11306                        match value {
11307                            "server" => Ok(__FieldTag::__server),
11308                            "path" => Ok(__FieldTag::__path),
11309                            "readOnly" => Ok(__FieldTag::__read_only),
11310                            "read_only" => Ok(__FieldTag::__read_only),
11311                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11312                        }
11313                    }
11314                }
11315                deserializer.deserialize_identifier(Visitor)
11316            }
11317        }
11318        struct Visitor;
11319        impl<'de> serde::de::Visitor<'de> for Visitor {
11320            type Value = NFSVolumeSource;
11321            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11322                formatter.write_str("struct NFSVolumeSource")
11323            }
11324            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11325            where
11326                A: serde::de::MapAccess<'de>,
11327            {
11328                #[allow(unused_imports)]
11329                use serde::de::Error;
11330                use std::option::Option::Some;
11331                let mut fields = std::collections::HashSet::new();
11332                let mut result = Self::Value::new();
11333                while let Some(tag) = map.next_key::<__FieldTag>()? {
11334                    #[allow(clippy::match_single_binding)]
11335                    match tag {
11336                        __FieldTag::__server => {
11337                            if !fields.insert(__FieldTag::__server) {
11338                                return std::result::Result::Err(A::Error::duplicate_field(
11339                                    "multiple values for server",
11340                                ));
11341                            }
11342                            result.server = map
11343                                .next_value::<std::option::Option<std::string::String>>()?
11344                                .unwrap_or_default();
11345                        }
11346                        __FieldTag::__path => {
11347                            if !fields.insert(__FieldTag::__path) {
11348                                return std::result::Result::Err(A::Error::duplicate_field(
11349                                    "multiple values for path",
11350                                ));
11351                            }
11352                            result.path = map
11353                                .next_value::<std::option::Option<std::string::String>>()?
11354                                .unwrap_or_default();
11355                        }
11356                        __FieldTag::__read_only => {
11357                            if !fields.insert(__FieldTag::__read_only) {
11358                                return std::result::Result::Err(A::Error::duplicate_field(
11359                                    "multiple values for read_only",
11360                                ));
11361                            }
11362                            result.read_only = map
11363                                .next_value::<std::option::Option<bool>>()?
11364                                .unwrap_or_default();
11365                        }
11366                        __FieldTag::Unknown(key) => {
11367                            let value = map.next_value::<serde_json::Value>()?;
11368                            result._unknown_fields.insert(key, value);
11369                        }
11370                    }
11371                }
11372                std::result::Result::Ok(result)
11373            }
11374        }
11375        deserializer.deserialize_any(Visitor)
11376    }
11377}
11378
11379#[doc(hidden)]
11380impl serde::ser::Serialize for NFSVolumeSource {
11381    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11382    where
11383        S: serde::ser::Serializer,
11384    {
11385        use serde::ser::SerializeMap;
11386        #[allow(unused_imports)]
11387        use std::option::Option::Some;
11388        let mut state = serializer.serialize_map(std::option::Option::None)?;
11389        if !self.server.is_empty() {
11390            state.serialize_entry("server", &self.server)?;
11391        }
11392        if !self.path.is_empty() {
11393            state.serialize_entry("path", &self.path)?;
11394        }
11395        if !wkt::internal::is_default(&self.read_only) {
11396            state.serialize_entry("readOnly", &self.read_only)?;
11397        }
11398        if !self._unknown_fields.is_empty() {
11399            for (key, value) in self._unknown_fields.iter() {
11400                state.serialize_entry(key, &value)?;
11401            }
11402        }
11403        state.end()
11404    }
11405}
11406
11407/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage
11408/// FUSE.
11409#[derive(Clone, Debug, Default, PartialEq)]
11410#[non_exhaustive]
11411pub struct GCSVolumeSource {
11412    /// Cloud Storage Bucket name.
11413    pub bucket: std::string::String,
11414
11415    /// If true, the volume will be mounted as read only for all mounts.
11416    pub read_only: bool,
11417
11418    /// A list of additional flags to pass to the gcsfuse CLI.
11419    /// Options should be specified without the leading "--".
11420    pub mount_options: std::vec::Vec<std::string::String>,
11421
11422    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11423}
11424
11425impl GCSVolumeSource {
11426    pub fn new() -> Self {
11427        std::default::Default::default()
11428    }
11429
11430    /// Sets the value of [bucket][crate::model::GCSVolumeSource::bucket].
11431    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11432        self.bucket = v.into();
11433        self
11434    }
11435
11436    /// Sets the value of [read_only][crate::model::GCSVolumeSource::read_only].
11437    pub fn set_read_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11438        self.read_only = v.into();
11439        self
11440    }
11441
11442    /// Sets the value of [mount_options][crate::model::GCSVolumeSource::mount_options].
11443    pub fn set_mount_options<T, V>(mut self, v: T) -> Self
11444    where
11445        T: std::iter::IntoIterator<Item = V>,
11446        V: std::convert::Into<std::string::String>,
11447    {
11448        use std::iter::Iterator;
11449        self.mount_options = v.into_iter().map(|i| i.into()).collect();
11450        self
11451    }
11452}
11453
11454impl wkt::message::Message for GCSVolumeSource {
11455    fn typename() -> &'static str {
11456        "type.googleapis.com/google.cloud.run.v2.GCSVolumeSource"
11457    }
11458}
11459
11460#[doc(hidden)]
11461impl<'de> serde::de::Deserialize<'de> for GCSVolumeSource {
11462    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11463    where
11464        D: serde::Deserializer<'de>,
11465    {
11466        #[allow(non_camel_case_types)]
11467        #[doc(hidden)]
11468        #[derive(PartialEq, Eq, Hash)]
11469        enum __FieldTag {
11470            __bucket,
11471            __read_only,
11472            __mount_options,
11473            Unknown(std::string::String),
11474        }
11475        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11476            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11477            where
11478                D: serde::Deserializer<'de>,
11479            {
11480                struct Visitor;
11481                impl<'de> serde::de::Visitor<'de> for Visitor {
11482                    type Value = __FieldTag;
11483                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11484                        formatter.write_str("a field name for GCSVolumeSource")
11485                    }
11486                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11487                    where
11488                        E: serde::de::Error,
11489                    {
11490                        use std::result::Result::Ok;
11491                        use std::string::ToString;
11492                        match value {
11493                            "bucket" => Ok(__FieldTag::__bucket),
11494                            "readOnly" => Ok(__FieldTag::__read_only),
11495                            "read_only" => Ok(__FieldTag::__read_only),
11496                            "mountOptions" => Ok(__FieldTag::__mount_options),
11497                            "mount_options" => Ok(__FieldTag::__mount_options),
11498                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11499                        }
11500                    }
11501                }
11502                deserializer.deserialize_identifier(Visitor)
11503            }
11504        }
11505        struct Visitor;
11506        impl<'de> serde::de::Visitor<'de> for Visitor {
11507            type Value = GCSVolumeSource;
11508            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11509                formatter.write_str("struct GCSVolumeSource")
11510            }
11511            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11512            where
11513                A: serde::de::MapAccess<'de>,
11514            {
11515                #[allow(unused_imports)]
11516                use serde::de::Error;
11517                use std::option::Option::Some;
11518                let mut fields = std::collections::HashSet::new();
11519                let mut result = Self::Value::new();
11520                while let Some(tag) = map.next_key::<__FieldTag>()? {
11521                    #[allow(clippy::match_single_binding)]
11522                    match tag {
11523                        __FieldTag::__bucket => {
11524                            if !fields.insert(__FieldTag::__bucket) {
11525                                return std::result::Result::Err(A::Error::duplicate_field(
11526                                    "multiple values for bucket",
11527                                ));
11528                            }
11529                            result.bucket = map
11530                                .next_value::<std::option::Option<std::string::String>>()?
11531                                .unwrap_or_default();
11532                        }
11533                        __FieldTag::__read_only => {
11534                            if !fields.insert(__FieldTag::__read_only) {
11535                                return std::result::Result::Err(A::Error::duplicate_field(
11536                                    "multiple values for read_only",
11537                                ));
11538                            }
11539                            result.read_only = map
11540                                .next_value::<std::option::Option<bool>>()?
11541                                .unwrap_or_default();
11542                        }
11543                        __FieldTag::__mount_options => {
11544                            if !fields.insert(__FieldTag::__mount_options) {
11545                                return std::result::Result::Err(A::Error::duplicate_field(
11546                                    "multiple values for mount_options",
11547                                ));
11548                            }
11549                            result.mount_options = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11550                        }
11551                        __FieldTag::Unknown(key) => {
11552                            let value = map.next_value::<serde_json::Value>()?;
11553                            result._unknown_fields.insert(key, value);
11554                        }
11555                    }
11556                }
11557                std::result::Result::Ok(result)
11558            }
11559        }
11560        deserializer.deserialize_any(Visitor)
11561    }
11562}
11563
11564#[doc(hidden)]
11565impl serde::ser::Serialize for GCSVolumeSource {
11566    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11567    where
11568        S: serde::ser::Serializer,
11569    {
11570        use serde::ser::SerializeMap;
11571        #[allow(unused_imports)]
11572        use std::option::Option::Some;
11573        let mut state = serializer.serialize_map(std::option::Option::None)?;
11574        if !self.bucket.is_empty() {
11575            state.serialize_entry("bucket", &self.bucket)?;
11576        }
11577        if !wkt::internal::is_default(&self.read_only) {
11578            state.serialize_entry("readOnly", &self.read_only)?;
11579        }
11580        if !self.mount_options.is_empty() {
11581            state.serialize_entry("mountOptions", &self.mount_options)?;
11582        }
11583        if !self._unknown_fields.is_empty() {
11584            for (key, value) in self._unknown_fields.iter() {
11585                state.serialize_entry(key, &value)?;
11586            }
11587        }
11588        state.end()
11589    }
11590}
11591
11592/// Probe describes a health check to be performed against a container to
11593/// determine whether it is alive or ready to receive traffic.
11594#[derive(Clone, Debug, Default, PartialEq)]
11595#[non_exhaustive]
11596pub struct Probe {
11597    /// Optional. Number of seconds after the container has started before the
11598    /// probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum
11599    /// value for liveness probe is 3600. Maximum value for startup probe is 240.
11600    pub initial_delay_seconds: i32,
11601
11602    /// Optional. Number of seconds after which the probe times out.
11603    /// Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
11604    /// Must be smaller than period_seconds.
11605    pub timeout_seconds: i32,
11606
11607    /// Optional. How often (in seconds) to perform the probe.
11608    /// Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
11609    /// is 3600. Maximum value for startup probe is 240.
11610    /// Must be greater or equal than timeout_seconds.
11611    pub period_seconds: i32,
11612
11613    /// Optional. Minimum consecutive failures for the probe to be considered
11614    /// failed after having succeeded. Defaults to 3. Minimum value is 1.
11615    pub failure_threshold: i32,
11616
11617    pub probe_type: std::option::Option<crate::model::probe::ProbeType>,
11618
11619    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11620}
11621
11622impl Probe {
11623    pub fn new() -> Self {
11624        std::default::Default::default()
11625    }
11626
11627    /// Sets the value of [initial_delay_seconds][crate::model::Probe::initial_delay_seconds].
11628    pub fn set_initial_delay_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11629        self.initial_delay_seconds = v.into();
11630        self
11631    }
11632
11633    /// Sets the value of [timeout_seconds][crate::model::Probe::timeout_seconds].
11634    pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11635        self.timeout_seconds = v.into();
11636        self
11637    }
11638
11639    /// Sets the value of [period_seconds][crate::model::Probe::period_seconds].
11640    pub fn set_period_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11641        self.period_seconds = v.into();
11642        self
11643    }
11644
11645    /// Sets the value of [failure_threshold][crate::model::Probe::failure_threshold].
11646    pub fn set_failure_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11647        self.failure_threshold = v.into();
11648        self
11649    }
11650
11651    /// Sets the value of [probe_type][crate::model::Probe::probe_type].
11652    ///
11653    /// Note that all the setters affecting `probe_type` are mutually
11654    /// exclusive.
11655    pub fn set_probe_type<
11656        T: std::convert::Into<std::option::Option<crate::model::probe::ProbeType>>,
11657    >(
11658        mut self,
11659        v: T,
11660    ) -> Self {
11661        self.probe_type = v.into();
11662        self
11663    }
11664
11665    /// The value of [probe_type][crate::model::Probe::probe_type]
11666    /// if it holds a `HttpGet`, `None` if the field is not set or
11667    /// holds a different branch.
11668    pub fn http_get(&self) -> std::option::Option<&std::boxed::Box<crate::model::HTTPGetAction>> {
11669        #[allow(unreachable_patterns)]
11670        self.probe_type.as_ref().and_then(|v| match v {
11671            crate::model::probe::ProbeType::HttpGet(v) => std::option::Option::Some(v),
11672            _ => std::option::Option::None,
11673        })
11674    }
11675
11676    /// Sets the value of [probe_type][crate::model::Probe::probe_type]
11677    /// to hold a `HttpGet`.
11678    ///
11679    /// Note that all the setters affecting `probe_type` are
11680    /// mutually exclusive.
11681    pub fn set_http_get<T: std::convert::Into<std::boxed::Box<crate::model::HTTPGetAction>>>(
11682        mut self,
11683        v: T,
11684    ) -> Self {
11685        self.probe_type =
11686            std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(v.into()));
11687        self
11688    }
11689
11690    /// The value of [probe_type][crate::model::Probe::probe_type]
11691    /// if it holds a `TcpSocket`, `None` if the field is not set or
11692    /// holds a different branch.
11693    pub fn tcp_socket(
11694        &self,
11695    ) -> std::option::Option<&std::boxed::Box<crate::model::TCPSocketAction>> {
11696        #[allow(unreachable_patterns)]
11697        self.probe_type.as_ref().and_then(|v| match v {
11698            crate::model::probe::ProbeType::TcpSocket(v) => std::option::Option::Some(v),
11699            _ => std::option::Option::None,
11700        })
11701    }
11702
11703    /// Sets the value of [probe_type][crate::model::Probe::probe_type]
11704    /// to hold a `TcpSocket`.
11705    ///
11706    /// Note that all the setters affecting `probe_type` are
11707    /// mutually exclusive.
11708    pub fn set_tcp_socket<T: std::convert::Into<std::boxed::Box<crate::model::TCPSocketAction>>>(
11709        mut self,
11710        v: T,
11711    ) -> Self {
11712        self.probe_type =
11713            std::option::Option::Some(crate::model::probe::ProbeType::TcpSocket(v.into()));
11714        self
11715    }
11716
11717    /// The value of [probe_type][crate::model::Probe::probe_type]
11718    /// if it holds a `Grpc`, `None` if the field is not set or
11719    /// holds a different branch.
11720    pub fn grpc(&self) -> std::option::Option<&std::boxed::Box<crate::model::GRPCAction>> {
11721        #[allow(unreachable_patterns)]
11722        self.probe_type.as_ref().and_then(|v| match v {
11723            crate::model::probe::ProbeType::Grpc(v) => std::option::Option::Some(v),
11724            _ => std::option::Option::None,
11725        })
11726    }
11727
11728    /// Sets the value of [probe_type][crate::model::Probe::probe_type]
11729    /// to hold a `Grpc`.
11730    ///
11731    /// Note that all the setters affecting `probe_type` are
11732    /// mutually exclusive.
11733    pub fn set_grpc<T: std::convert::Into<std::boxed::Box<crate::model::GRPCAction>>>(
11734        mut self,
11735        v: T,
11736    ) -> Self {
11737        self.probe_type = std::option::Option::Some(crate::model::probe::ProbeType::Grpc(v.into()));
11738        self
11739    }
11740}
11741
11742impl wkt::message::Message for Probe {
11743    fn typename() -> &'static str {
11744        "type.googleapis.com/google.cloud.run.v2.Probe"
11745    }
11746}
11747
11748#[doc(hidden)]
11749impl<'de> serde::de::Deserialize<'de> for Probe {
11750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11751    where
11752        D: serde::Deserializer<'de>,
11753    {
11754        #[allow(non_camel_case_types)]
11755        #[doc(hidden)]
11756        #[derive(PartialEq, Eq, Hash)]
11757        enum __FieldTag {
11758            __initial_delay_seconds,
11759            __timeout_seconds,
11760            __period_seconds,
11761            __failure_threshold,
11762            __http_get,
11763            __tcp_socket,
11764            __grpc,
11765            Unknown(std::string::String),
11766        }
11767        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11768            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11769            where
11770                D: serde::Deserializer<'de>,
11771            {
11772                struct Visitor;
11773                impl<'de> serde::de::Visitor<'de> for Visitor {
11774                    type Value = __FieldTag;
11775                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11776                        formatter.write_str("a field name for Probe")
11777                    }
11778                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11779                    where
11780                        E: serde::de::Error,
11781                    {
11782                        use std::result::Result::Ok;
11783                        use std::string::ToString;
11784                        match value {
11785                            "initialDelaySeconds" => Ok(__FieldTag::__initial_delay_seconds),
11786                            "initial_delay_seconds" => Ok(__FieldTag::__initial_delay_seconds),
11787                            "timeoutSeconds" => Ok(__FieldTag::__timeout_seconds),
11788                            "timeout_seconds" => Ok(__FieldTag::__timeout_seconds),
11789                            "periodSeconds" => Ok(__FieldTag::__period_seconds),
11790                            "period_seconds" => Ok(__FieldTag::__period_seconds),
11791                            "failureThreshold" => Ok(__FieldTag::__failure_threshold),
11792                            "failure_threshold" => Ok(__FieldTag::__failure_threshold),
11793                            "httpGet" => Ok(__FieldTag::__http_get),
11794                            "http_get" => Ok(__FieldTag::__http_get),
11795                            "tcpSocket" => Ok(__FieldTag::__tcp_socket),
11796                            "tcp_socket" => Ok(__FieldTag::__tcp_socket),
11797                            "grpc" => Ok(__FieldTag::__grpc),
11798                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11799                        }
11800                    }
11801                }
11802                deserializer.deserialize_identifier(Visitor)
11803            }
11804        }
11805        struct Visitor;
11806        impl<'de> serde::de::Visitor<'de> for Visitor {
11807            type Value = Probe;
11808            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11809                formatter.write_str("struct Probe")
11810            }
11811            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11812            where
11813                A: serde::de::MapAccess<'de>,
11814            {
11815                #[allow(unused_imports)]
11816                use serde::de::Error;
11817                use std::option::Option::Some;
11818                let mut fields = std::collections::HashSet::new();
11819                let mut result = Self::Value::new();
11820                while let Some(tag) = map.next_key::<__FieldTag>()? {
11821                    #[allow(clippy::match_single_binding)]
11822                    match tag {
11823                        __FieldTag::__initial_delay_seconds => {
11824                            if !fields.insert(__FieldTag::__initial_delay_seconds) {
11825                                return std::result::Result::Err(A::Error::duplicate_field(
11826                                    "multiple values for initial_delay_seconds",
11827                                ));
11828                            }
11829                            struct __With(std::option::Option<i32>);
11830                            impl<'de> serde::de::Deserialize<'de> for __With {
11831                                fn deserialize<D>(
11832                                    deserializer: D,
11833                                ) -> std::result::Result<Self, D::Error>
11834                                where
11835                                    D: serde::de::Deserializer<'de>,
11836                                {
11837                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11838                                }
11839                            }
11840                            result.initial_delay_seconds =
11841                                map.next_value::<__With>()?.0.unwrap_or_default();
11842                        }
11843                        __FieldTag::__timeout_seconds => {
11844                            if !fields.insert(__FieldTag::__timeout_seconds) {
11845                                return std::result::Result::Err(A::Error::duplicate_field(
11846                                    "multiple values for timeout_seconds",
11847                                ));
11848                            }
11849                            struct __With(std::option::Option<i32>);
11850                            impl<'de> serde::de::Deserialize<'de> for __With {
11851                                fn deserialize<D>(
11852                                    deserializer: D,
11853                                ) -> std::result::Result<Self, D::Error>
11854                                where
11855                                    D: serde::de::Deserializer<'de>,
11856                                {
11857                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11858                                }
11859                            }
11860                            result.timeout_seconds =
11861                                map.next_value::<__With>()?.0.unwrap_or_default();
11862                        }
11863                        __FieldTag::__period_seconds => {
11864                            if !fields.insert(__FieldTag::__period_seconds) {
11865                                return std::result::Result::Err(A::Error::duplicate_field(
11866                                    "multiple values for period_seconds",
11867                                ));
11868                            }
11869                            struct __With(std::option::Option<i32>);
11870                            impl<'de> serde::de::Deserialize<'de> for __With {
11871                                fn deserialize<D>(
11872                                    deserializer: D,
11873                                ) -> std::result::Result<Self, D::Error>
11874                                where
11875                                    D: serde::de::Deserializer<'de>,
11876                                {
11877                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11878                                }
11879                            }
11880                            result.period_seconds =
11881                                map.next_value::<__With>()?.0.unwrap_or_default();
11882                        }
11883                        __FieldTag::__failure_threshold => {
11884                            if !fields.insert(__FieldTag::__failure_threshold) {
11885                                return std::result::Result::Err(A::Error::duplicate_field(
11886                                    "multiple values for failure_threshold",
11887                                ));
11888                            }
11889                            struct __With(std::option::Option<i32>);
11890                            impl<'de> serde::de::Deserialize<'de> for __With {
11891                                fn deserialize<D>(
11892                                    deserializer: D,
11893                                ) -> std::result::Result<Self, D::Error>
11894                                where
11895                                    D: serde::de::Deserializer<'de>,
11896                                {
11897                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11898                                }
11899                            }
11900                            result.failure_threshold =
11901                                map.next_value::<__With>()?.0.unwrap_or_default();
11902                        }
11903                        __FieldTag::__http_get => {
11904                            if !fields.insert(__FieldTag::__http_get) {
11905                                return std::result::Result::Err(A::Error::duplicate_field(
11906                                    "multiple values for http_get",
11907                                ));
11908                            }
11909                            if result.probe_type.is_some() {
11910                                return std::result::Result::Err(A::Error::duplicate_field(
11911                                    "multiple values for `probe_type`, a oneof with full ID .google.cloud.run.v2.Probe.http_get, latest field was httpGet",
11912                                ));
11913                            }
11914                            result.probe_type =
11915                                std::option::Option::Some(crate::model::probe::ProbeType::HttpGet(
11916                                    map.next_value::<std::option::Option<
11917                                        std::boxed::Box<crate::model::HTTPGetAction>,
11918                                    >>()?
11919                                    .unwrap_or_default(),
11920                                ));
11921                        }
11922                        __FieldTag::__tcp_socket => {
11923                            if !fields.insert(__FieldTag::__tcp_socket) {
11924                                return std::result::Result::Err(A::Error::duplicate_field(
11925                                    "multiple values for tcp_socket",
11926                                ));
11927                            }
11928                            if result.probe_type.is_some() {
11929                                return std::result::Result::Err(A::Error::duplicate_field(
11930                                    "multiple values for `probe_type`, a oneof with full ID .google.cloud.run.v2.Probe.tcp_socket, latest field was tcpSocket",
11931                                ));
11932                            }
11933                            result.probe_type = std::option::Option::Some(
11934                                crate::model::probe::ProbeType::TcpSocket(
11935                                    map.next_value::<std::option::Option<
11936                                        std::boxed::Box<crate::model::TCPSocketAction>,
11937                                    >>()?
11938                                    .unwrap_or_default(),
11939                                ),
11940                            );
11941                        }
11942                        __FieldTag::__grpc => {
11943                            if !fields.insert(__FieldTag::__grpc) {
11944                                return std::result::Result::Err(A::Error::duplicate_field(
11945                                    "multiple values for grpc",
11946                                ));
11947                            }
11948                            if result.probe_type.is_some() {
11949                                return std::result::Result::Err(A::Error::duplicate_field(
11950                                    "multiple values for `probe_type`, a oneof with full ID .google.cloud.run.v2.Probe.grpc, latest field was grpc",
11951                                ));
11952                            }
11953                            result.probe_type =
11954                                std::option::Option::Some(crate::model::probe::ProbeType::Grpc(
11955                                    map.next_value::<std::option::Option<
11956                                        std::boxed::Box<crate::model::GRPCAction>,
11957                                    >>()?
11958                                    .unwrap_or_default(),
11959                                ));
11960                        }
11961                        __FieldTag::Unknown(key) => {
11962                            let value = map.next_value::<serde_json::Value>()?;
11963                            result._unknown_fields.insert(key, value);
11964                        }
11965                    }
11966                }
11967                std::result::Result::Ok(result)
11968            }
11969        }
11970        deserializer.deserialize_any(Visitor)
11971    }
11972}
11973
11974#[doc(hidden)]
11975impl serde::ser::Serialize for Probe {
11976    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11977    where
11978        S: serde::ser::Serializer,
11979    {
11980        use serde::ser::SerializeMap;
11981        #[allow(unused_imports)]
11982        use std::option::Option::Some;
11983        let mut state = serializer.serialize_map(std::option::Option::None)?;
11984        if !wkt::internal::is_default(&self.initial_delay_seconds) {
11985            struct __With<'a>(&'a i32);
11986            impl<'a> serde::ser::Serialize for __With<'a> {
11987                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11988                where
11989                    S: serde::ser::Serializer,
11990                {
11991                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11992                }
11993            }
11994            state.serialize_entry("initialDelaySeconds", &__With(&self.initial_delay_seconds))?;
11995        }
11996        if !wkt::internal::is_default(&self.timeout_seconds) {
11997            struct __With<'a>(&'a i32);
11998            impl<'a> serde::ser::Serialize for __With<'a> {
11999                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12000                where
12001                    S: serde::ser::Serializer,
12002                {
12003                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12004                }
12005            }
12006            state.serialize_entry("timeoutSeconds", &__With(&self.timeout_seconds))?;
12007        }
12008        if !wkt::internal::is_default(&self.period_seconds) {
12009            struct __With<'a>(&'a i32);
12010            impl<'a> serde::ser::Serialize for __With<'a> {
12011                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12012                where
12013                    S: serde::ser::Serializer,
12014                {
12015                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12016                }
12017            }
12018            state.serialize_entry("periodSeconds", &__With(&self.period_seconds))?;
12019        }
12020        if !wkt::internal::is_default(&self.failure_threshold) {
12021            struct __With<'a>(&'a i32);
12022            impl<'a> serde::ser::Serialize for __With<'a> {
12023                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12024                where
12025                    S: serde::ser::Serializer,
12026                {
12027                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12028                }
12029            }
12030            state.serialize_entry("failureThreshold", &__With(&self.failure_threshold))?;
12031        }
12032        if let Some(value) = self.http_get() {
12033            state.serialize_entry("httpGet", value)?;
12034        }
12035        if let Some(value) = self.tcp_socket() {
12036            state.serialize_entry("tcpSocket", value)?;
12037        }
12038        if let Some(value) = self.grpc() {
12039            state.serialize_entry("grpc", value)?;
12040        }
12041        if !self._unknown_fields.is_empty() {
12042            for (key, value) in self._unknown_fields.iter() {
12043                state.serialize_entry(key, &value)?;
12044            }
12045        }
12046        state.end()
12047    }
12048}
12049
12050/// Defines additional types related to [Probe].
12051pub mod probe {
12052    #[allow(unused_imports)]
12053    use super::*;
12054
12055    #[derive(Clone, Debug, PartialEq)]
12056    #[non_exhaustive]
12057    pub enum ProbeType {
12058        /// Optional. HTTPGet specifies the http request to perform.
12059        /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
12060        HttpGet(std::boxed::Box<crate::model::HTTPGetAction>),
12061        /// Optional. TCPSocket specifies an action involving a TCP port.
12062        /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
12063        TcpSocket(std::boxed::Box<crate::model::TCPSocketAction>),
12064        /// Optional. GRPC specifies an action involving a gRPC port.
12065        /// Exactly one of httpGet, tcpSocket, or grpc must be specified.
12066        Grpc(std::boxed::Box<crate::model::GRPCAction>),
12067    }
12068}
12069
12070/// HTTPGetAction describes an action based on HTTP Get requests.
12071#[derive(Clone, Debug, Default, PartialEq)]
12072#[non_exhaustive]
12073pub struct HTTPGetAction {
12074    /// Optional. Path to access on the HTTP server. Defaults to '/'.
12075    pub path: std::string::String,
12076
12077    /// Optional. Custom headers to set in the request. HTTP allows repeated
12078    /// headers.
12079    pub http_headers: std::vec::Vec<crate::model::HTTPHeader>,
12080
12081    /// Optional. Port number to access on the container. Must be in the range 1 to
12082    /// 65535. If not specified, defaults to the exposed port of the container,
12083    /// which is the value of container.ports[0].containerPort.
12084    pub port: i32,
12085
12086    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12087}
12088
12089impl HTTPGetAction {
12090    pub fn new() -> Self {
12091        std::default::Default::default()
12092    }
12093
12094    /// Sets the value of [path][crate::model::HTTPGetAction::path].
12095    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12096        self.path = v.into();
12097        self
12098    }
12099
12100    /// Sets the value of [http_headers][crate::model::HTTPGetAction::http_headers].
12101    pub fn set_http_headers<T, V>(mut self, v: T) -> Self
12102    where
12103        T: std::iter::IntoIterator<Item = V>,
12104        V: std::convert::Into<crate::model::HTTPHeader>,
12105    {
12106        use std::iter::Iterator;
12107        self.http_headers = v.into_iter().map(|i| i.into()).collect();
12108        self
12109    }
12110
12111    /// Sets the value of [port][crate::model::HTTPGetAction::port].
12112    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12113        self.port = v.into();
12114        self
12115    }
12116}
12117
12118impl wkt::message::Message for HTTPGetAction {
12119    fn typename() -> &'static str {
12120        "type.googleapis.com/google.cloud.run.v2.HTTPGetAction"
12121    }
12122}
12123
12124#[doc(hidden)]
12125impl<'de> serde::de::Deserialize<'de> for HTTPGetAction {
12126    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12127    where
12128        D: serde::Deserializer<'de>,
12129    {
12130        #[allow(non_camel_case_types)]
12131        #[doc(hidden)]
12132        #[derive(PartialEq, Eq, Hash)]
12133        enum __FieldTag {
12134            __path,
12135            __http_headers,
12136            __port,
12137            Unknown(std::string::String),
12138        }
12139        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12140            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12141            where
12142                D: serde::Deserializer<'de>,
12143            {
12144                struct Visitor;
12145                impl<'de> serde::de::Visitor<'de> for Visitor {
12146                    type Value = __FieldTag;
12147                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12148                        formatter.write_str("a field name for HTTPGetAction")
12149                    }
12150                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12151                    where
12152                        E: serde::de::Error,
12153                    {
12154                        use std::result::Result::Ok;
12155                        use std::string::ToString;
12156                        match value {
12157                            "path" => Ok(__FieldTag::__path),
12158                            "httpHeaders" => Ok(__FieldTag::__http_headers),
12159                            "http_headers" => Ok(__FieldTag::__http_headers),
12160                            "port" => Ok(__FieldTag::__port),
12161                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12162                        }
12163                    }
12164                }
12165                deserializer.deserialize_identifier(Visitor)
12166            }
12167        }
12168        struct Visitor;
12169        impl<'de> serde::de::Visitor<'de> for Visitor {
12170            type Value = HTTPGetAction;
12171            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12172                formatter.write_str("struct HTTPGetAction")
12173            }
12174            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12175            where
12176                A: serde::de::MapAccess<'de>,
12177            {
12178                #[allow(unused_imports)]
12179                use serde::de::Error;
12180                use std::option::Option::Some;
12181                let mut fields = std::collections::HashSet::new();
12182                let mut result = Self::Value::new();
12183                while let Some(tag) = map.next_key::<__FieldTag>()? {
12184                    #[allow(clippy::match_single_binding)]
12185                    match tag {
12186                        __FieldTag::__path => {
12187                            if !fields.insert(__FieldTag::__path) {
12188                                return std::result::Result::Err(A::Error::duplicate_field(
12189                                    "multiple values for path",
12190                                ));
12191                            }
12192                            result.path = map
12193                                .next_value::<std::option::Option<std::string::String>>()?
12194                                .unwrap_or_default();
12195                        }
12196                        __FieldTag::__http_headers => {
12197                            if !fields.insert(__FieldTag::__http_headers) {
12198                                return std::result::Result::Err(A::Error::duplicate_field(
12199                                    "multiple values for http_headers",
12200                                ));
12201                            }
12202                            result.http_headers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::HTTPHeader>>>()?.unwrap_or_default();
12203                        }
12204                        __FieldTag::__port => {
12205                            if !fields.insert(__FieldTag::__port) {
12206                                return std::result::Result::Err(A::Error::duplicate_field(
12207                                    "multiple values for port",
12208                                ));
12209                            }
12210                            struct __With(std::option::Option<i32>);
12211                            impl<'de> serde::de::Deserialize<'de> for __With {
12212                                fn deserialize<D>(
12213                                    deserializer: D,
12214                                ) -> std::result::Result<Self, D::Error>
12215                                where
12216                                    D: serde::de::Deserializer<'de>,
12217                                {
12218                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12219                                }
12220                            }
12221                            result.port = map.next_value::<__With>()?.0.unwrap_or_default();
12222                        }
12223                        __FieldTag::Unknown(key) => {
12224                            let value = map.next_value::<serde_json::Value>()?;
12225                            result._unknown_fields.insert(key, value);
12226                        }
12227                    }
12228                }
12229                std::result::Result::Ok(result)
12230            }
12231        }
12232        deserializer.deserialize_any(Visitor)
12233    }
12234}
12235
12236#[doc(hidden)]
12237impl serde::ser::Serialize for HTTPGetAction {
12238    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12239    where
12240        S: serde::ser::Serializer,
12241    {
12242        use serde::ser::SerializeMap;
12243        #[allow(unused_imports)]
12244        use std::option::Option::Some;
12245        let mut state = serializer.serialize_map(std::option::Option::None)?;
12246        if !self.path.is_empty() {
12247            state.serialize_entry("path", &self.path)?;
12248        }
12249        if !self.http_headers.is_empty() {
12250            state.serialize_entry("httpHeaders", &self.http_headers)?;
12251        }
12252        if !wkt::internal::is_default(&self.port) {
12253            struct __With<'a>(&'a i32);
12254            impl<'a> serde::ser::Serialize for __With<'a> {
12255                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12256                where
12257                    S: serde::ser::Serializer,
12258                {
12259                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12260                }
12261            }
12262            state.serialize_entry("port", &__With(&self.port))?;
12263        }
12264        if !self._unknown_fields.is_empty() {
12265            for (key, value) in self._unknown_fields.iter() {
12266                state.serialize_entry(key, &value)?;
12267            }
12268        }
12269        state.end()
12270    }
12271}
12272
12273/// HTTPHeader describes a custom header to be used in HTTP probes
12274#[derive(Clone, Debug, Default, PartialEq)]
12275#[non_exhaustive]
12276pub struct HTTPHeader {
12277    /// Required. The header field name
12278    pub name: std::string::String,
12279
12280    /// Optional. The header field value
12281    pub value: std::string::String,
12282
12283    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12284}
12285
12286impl HTTPHeader {
12287    pub fn new() -> Self {
12288        std::default::Default::default()
12289    }
12290
12291    /// Sets the value of [name][crate::model::HTTPHeader::name].
12292    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12293        self.name = v.into();
12294        self
12295    }
12296
12297    /// Sets the value of [value][crate::model::HTTPHeader::value].
12298    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12299        self.value = v.into();
12300        self
12301    }
12302}
12303
12304impl wkt::message::Message for HTTPHeader {
12305    fn typename() -> &'static str {
12306        "type.googleapis.com/google.cloud.run.v2.HTTPHeader"
12307    }
12308}
12309
12310#[doc(hidden)]
12311impl<'de> serde::de::Deserialize<'de> for HTTPHeader {
12312    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12313    where
12314        D: serde::Deserializer<'de>,
12315    {
12316        #[allow(non_camel_case_types)]
12317        #[doc(hidden)]
12318        #[derive(PartialEq, Eq, Hash)]
12319        enum __FieldTag {
12320            __name,
12321            __value,
12322            Unknown(std::string::String),
12323        }
12324        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12325            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12326            where
12327                D: serde::Deserializer<'de>,
12328            {
12329                struct Visitor;
12330                impl<'de> serde::de::Visitor<'de> for Visitor {
12331                    type Value = __FieldTag;
12332                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12333                        formatter.write_str("a field name for HTTPHeader")
12334                    }
12335                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12336                    where
12337                        E: serde::de::Error,
12338                    {
12339                        use std::result::Result::Ok;
12340                        use std::string::ToString;
12341                        match value {
12342                            "name" => Ok(__FieldTag::__name),
12343                            "value" => Ok(__FieldTag::__value),
12344                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12345                        }
12346                    }
12347                }
12348                deserializer.deserialize_identifier(Visitor)
12349            }
12350        }
12351        struct Visitor;
12352        impl<'de> serde::de::Visitor<'de> for Visitor {
12353            type Value = HTTPHeader;
12354            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12355                formatter.write_str("struct HTTPHeader")
12356            }
12357            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12358            where
12359                A: serde::de::MapAccess<'de>,
12360            {
12361                #[allow(unused_imports)]
12362                use serde::de::Error;
12363                use std::option::Option::Some;
12364                let mut fields = std::collections::HashSet::new();
12365                let mut result = Self::Value::new();
12366                while let Some(tag) = map.next_key::<__FieldTag>()? {
12367                    #[allow(clippy::match_single_binding)]
12368                    match tag {
12369                        __FieldTag::__name => {
12370                            if !fields.insert(__FieldTag::__name) {
12371                                return std::result::Result::Err(A::Error::duplicate_field(
12372                                    "multiple values for name",
12373                                ));
12374                            }
12375                            result.name = map
12376                                .next_value::<std::option::Option<std::string::String>>()?
12377                                .unwrap_or_default();
12378                        }
12379                        __FieldTag::__value => {
12380                            if !fields.insert(__FieldTag::__value) {
12381                                return std::result::Result::Err(A::Error::duplicate_field(
12382                                    "multiple values for value",
12383                                ));
12384                            }
12385                            result.value = map
12386                                .next_value::<std::option::Option<std::string::String>>()?
12387                                .unwrap_or_default();
12388                        }
12389                        __FieldTag::Unknown(key) => {
12390                            let value = map.next_value::<serde_json::Value>()?;
12391                            result._unknown_fields.insert(key, value);
12392                        }
12393                    }
12394                }
12395                std::result::Result::Ok(result)
12396            }
12397        }
12398        deserializer.deserialize_any(Visitor)
12399    }
12400}
12401
12402#[doc(hidden)]
12403impl serde::ser::Serialize for HTTPHeader {
12404    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12405    where
12406        S: serde::ser::Serializer,
12407    {
12408        use serde::ser::SerializeMap;
12409        #[allow(unused_imports)]
12410        use std::option::Option::Some;
12411        let mut state = serializer.serialize_map(std::option::Option::None)?;
12412        if !self.name.is_empty() {
12413            state.serialize_entry("name", &self.name)?;
12414        }
12415        if !self.value.is_empty() {
12416            state.serialize_entry("value", &self.value)?;
12417        }
12418        if !self._unknown_fields.is_empty() {
12419            for (key, value) in self._unknown_fields.iter() {
12420                state.serialize_entry(key, &value)?;
12421            }
12422        }
12423        state.end()
12424    }
12425}
12426
12427/// TCPSocketAction describes an action based on opening a socket
12428#[derive(Clone, Debug, Default, PartialEq)]
12429#[non_exhaustive]
12430pub struct TCPSocketAction {
12431    /// Optional. Port number to access on the container. Must be in the range 1 to
12432    /// 65535. If not specified, defaults to the exposed port of the container,
12433    /// which is the value of container.ports[0].containerPort.
12434    pub port: i32,
12435
12436    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12437}
12438
12439impl TCPSocketAction {
12440    pub fn new() -> Self {
12441        std::default::Default::default()
12442    }
12443
12444    /// Sets the value of [port][crate::model::TCPSocketAction::port].
12445    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12446        self.port = v.into();
12447        self
12448    }
12449}
12450
12451impl wkt::message::Message for TCPSocketAction {
12452    fn typename() -> &'static str {
12453        "type.googleapis.com/google.cloud.run.v2.TCPSocketAction"
12454    }
12455}
12456
12457#[doc(hidden)]
12458impl<'de> serde::de::Deserialize<'de> for TCPSocketAction {
12459    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12460    where
12461        D: serde::Deserializer<'de>,
12462    {
12463        #[allow(non_camel_case_types)]
12464        #[doc(hidden)]
12465        #[derive(PartialEq, Eq, Hash)]
12466        enum __FieldTag {
12467            __port,
12468            Unknown(std::string::String),
12469        }
12470        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12471            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12472            where
12473                D: serde::Deserializer<'de>,
12474            {
12475                struct Visitor;
12476                impl<'de> serde::de::Visitor<'de> for Visitor {
12477                    type Value = __FieldTag;
12478                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12479                        formatter.write_str("a field name for TCPSocketAction")
12480                    }
12481                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12482                    where
12483                        E: serde::de::Error,
12484                    {
12485                        use std::result::Result::Ok;
12486                        use std::string::ToString;
12487                        match value {
12488                            "port" => Ok(__FieldTag::__port),
12489                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12490                        }
12491                    }
12492                }
12493                deserializer.deserialize_identifier(Visitor)
12494            }
12495        }
12496        struct Visitor;
12497        impl<'de> serde::de::Visitor<'de> for Visitor {
12498            type Value = TCPSocketAction;
12499            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12500                formatter.write_str("struct TCPSocketAction")
12501            }
12502            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12503            where
12504                A: serde::de::MapAccess<'de>,
12505            {
12506                #[allow(unused_imports)]
12507                use serde::de::Error;
12508                use std::option::Option::Some;
12509                let mut fields = std::collections::HashSet::new();
12510                let mut result = Self::Value::new();
12511                while let Some(tag) = map.next_key::<__FieldTag>()? {
12512                    #[allow(clippy::match_single_binding)]
12513                    match tag {
12514                        __FieldTag::__port => {
12515                            if !fields.insert(__FieldTag::__port) {
12516                                return std::result::Result::Err(A::Error::duplicate_field(
12517                                    "multiple values for port",
12518                                ));
12519                            }
12520                            struct __With(std::option::Option<i32>);
12521                            impl<'de> serde::de::Deserialize<'de> for __With {
12522                                fn deserialize<D>(
12523                                    deserializer: D,
12524                                ) -> std::result::Result<Self, D::Error>
12525                                where
12526                                    D: serde::de::Deserializer<'de>,
12527                                {
12528                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12529                                }
12530                            }
12531                            result.port = map.next_value::<__With>()?.0.unwrap_or_default();
12532                        }
12533                        __FieldTag::Unknown(key) => {
12534                            let value = map.next_value::<serde_json::Value>()?;
12535                            result._unknown_fields.insert(key, value);
12536                        }
12537                    }
12538                }
12539                std::result::Result::Ok(result)
12540            }
12541        }
12542        deserializer.deserialize_any(Visitor)
12543    }
12544}
12545
12546#[doc(hidden)]
12547impl serde::ser::Serialize for TCPSocketAction {
12548    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12549    where
12550        S: serde::ser::Serializer,
12551    {
12552        use serde::ser::SerializeMap;
12553        #[allow(unused_imports)]
12554        use std::option::Option::Some;
12555        let mut state = serializer.serialize_map(std::option::Option::None)?;
12556        if !wkt::internal::is_default(&self.port) {
12557            struct __With<'a>(&'a i32);
12558            impl<'a> serde::ser::Serialize for __With<'a> {
12559                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12560                where
12561                    S: serde::ser::Serializer,
12562                {
12563                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12564                }
12565            }
12566            state.serialize_entry("port", &__With(&self.port))?;
12567        }
12568        if !self._unknown_fields.is_empty() {
12569            for (key, value) in self._unknown_fields.iter() {
12570                state.serialize_entry(key, &value)?;
12571            }
12572        }
12573        state.end()
12574    }
12575}
12576
12577/// GRPCAction describes an action involving a GRPC port.
12578#[derive(Clone, Debug, Default, PartialEq)]
12579#[non_exhaustive]
12580pub struct GRPCAction {
12581    /// Optional. Port number of the gRPC service. Number must be in the range 1 to
12582    /// 65535. If not specified, defaults to the exposed port of the container,
12583    /// which is the value of container.ports[0].containerPort.
12584    pub port: i32,
12585
12586    /// Optional. Service is the name of the service to place in the gRPC
12587    /// HealthCheckRequest (see
12588    /// <https://github.com/grpc/grpc/blob/master/doc/health-checking.md> ). If this
12589    /// is not specified, the default behavior is defined by gRPC.
12590    pub service: std::string::String,
12591
12592    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12593}
12594
12595impl GRPCAction {
12596    pub fn new() -> Self {
12597        std::default::Default::default()
12598    }
12599
12600    /// Sets the value of [port][crate::model::GRPCAction::port].
12601    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12602        self.port = v.into();
12603        self
12604    }
12605
12606    /// Sets the value of [service][crate::model::GRPCAction::service].
12607    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12608        self.service = v.into();
12609        self
12610    }
12611}
12612
12613impl wkt::message::Message for GRPCAction {
12614    fn typename() -> &'static str {
12615        "type.googleapis.com/google.cloud.run.v2.GRPCAction"
12616    }
12617}
12618
12619#[doc(hidden)]
12620impl<'de> serde::de::Deserialize<'de> for GRPCAction {
12621    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12622    where
12623        D: serde::Deserializer<'de>,
12624    {
12625        #[allow(non_camel_case_types)]
12626        #[doc(hidden)]
12627        #[derive(PartialEq, Eq, Hash)]
12628        enum __FieldTag {
12629            __port,
12630            __service,
12631            Unknown(std::string::String),
12632        }
12633        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12634            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12635            where
12636                D: serde::Deserializer<'de>,
12637            {
12638                struct Visitor;
12639                impl<'de> serde::de::Visitor<'de> for Visitor {
12640                    type Value = __FieldTag;
12641                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12642                        formatter.write_str("a field name for GRPCAction")
12643                    }
12644                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12645                    where
12646                        E: serde::de::Error,
12647                    {
12648                        use std::result::Result::Ok;
12649                        use std::string::ToString;
12650                        match value {
12651                            "port" => Ok(__FieldTag::__port),
12652                            "service" => Ok(__FieldTag::__service),
12653                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12654                        }
12655                    }
12656                }
12657                deserializer.deserialize_identifier(Visitor)
12658            }
12659        }
12660        struct Visitor;
12661        impl<'de> serde::de::Visitor<'de> for Visitor {
12662            type Value = GRPCAction;
12663            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12664                formatter.write_str("struct GRPCAction")
12665            }
12666            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12667            where
12668                A: serde::de::MapAccess<'de>,
12669            {
12670                #[allow(unused_imports)]
12671                use serde::de::Error;
12672                use std::option::Option::Some;
12673                let mut fields = std::collections::HashSet::new();
12674                let mut result = Self::Value::new();
12675                while let Some(tag) = map.next_key::<__FieldTag>()? {
12676                    #[allow(clippy::match_single_binding)]
12677                    match tag {
12678                        __FieldTag::__port => {
12679                            if !fields.insert(__FieldTag::__port) {
12680                                return std::result::Result::Err(A::Error::duplicate_field(
12681                                    "multiple values for port",
12682                                ));
12683                            }
12684                            struct __With(std::option::Option<i32>);
12685                            impl<'de> serde::de::Deserialize<'de> for __With {
12686                                fn deserialize<D>(
12687                                    deserializer: D,
12688                                ) -> std::result::Result<Self, D::Error>
12689                                where
12690                                    D: serde::de::Deserializer<'de>,
12691                                {
12692                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12693                                }
12694                            }
12695                            result.port = map.next_value::<__With>()?.0.unwrap_or_default();
12696                        }
12697                        __FieldTag::__service => {
12698                            if !fields.insert(__FieldTag::__service) {
12699                                return std::result::Result::Err(A::Error::duplicate_field(
12700                                    "multiple values for service",
12701                                ));
12702                            }
12703                            result.service = map
12704                                .next_value::<std::option::Option<std::string::String>>()?
12705                                .unwrap_or_default();
12706                        }
12707                        __FieldTag::Unknown(key) => {
12708                            let value = map.next_value::<serde_json::Value>()?;
12709                            result._unknown_fields.insert(key, value);
12710                        }
12711                    }
12712                }
12713                std::result::Result::Ok(result)
12714            }
12715        }
12716        deserializer.deserialize_any(Visitor)
12717    }
12718}
12719
12720#[doc(hidden)]
12721impl serde::ser::Serialize for GRPCAction {
12722    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12723    where
12724        S: serde::ser::Serializer,
12725    {
12726        use serde::ser::SerializeMap;
12727        #[allow(unused_imports)]
12728        use std::option::Option::Some;
12729        let mut state = serializer.serialize_map(std::option::Option::None)?;
12730        if !wkt::internal::is_default(&self.port) {
12731            struct __With<'a>(&'a i32);
12732            impl<'a> serde::ser::Serialize for __With<'a> {
12733                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12734                where
12735                    S: serde::ser::Serializer,
12736                {
12737                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12738                }
12739            }
12740            state.serialize_entry("port", &__With(&self.port))?;
12741        }
12742        if !self.service.is_empty() {
12743            state.serialize_entry("service", &self.service)?;
12744        }
12745        if !self._unknown_fields.is_empty() {
12746            for (key, value) in self._unknown_fields.iter() {
12747                state.serialize_entry(key, &value)?;
12748            }
12749        }
12750        state.end()
12751    }
12752}
12753
12754/// Build information of the image.
12755#[derive(Clone, Debug, Default, PartialEq)]
12756#[non_exhaustive]
12757pub struct BuildInfo {
12758    /// Output only. Entry point of the function when the image is a Cloud Run
12759    /// function.
12760    pub function_target: std::string::String,
12761
12762    /// Output only. Source code location of the image.
12763    pub source_location: std::string::String,
12764
12765    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12766}
12767
12768impl BuildInfo {
12769    pub fn new() -> Self {
12770        std::default::Default::default()
12771    }
12772
12773    /// Sets the value of [function_target][crate::model::BuildInfo::function_target].
12774    pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12775        self.function_target = v.into();
12776        self
12777    }
12778
12779    /// Sets the value of [source_location][crate::model::BuildInfo::source_location].
12780    pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12781        self.source_location = v.into();
12782        self
12783    }
12784}
12785
12786impl wkt::message::Message for BuildInfo {
12787    fn typename() -> &'static str {
12788        "type.googleapis.com/google.cloud.run.v2.BuildInfo"
12789    }
12790}
12791
12792#[doc(hidden)]
12793impl<'de> serde::de::Deserialize<'de> for BuildInfo {
12794    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12795    where
12796        D: serde::Deserializer<'de>,
12797    {
12798        #[allow(non_camel_case_types)]
12799        #[doc(hidden)]
12800        #[derive(PartialEq, Eq, Hash)]
12801        enum __FieldTag {
12802            __function_target,
12803            __source_location,
12804            Unknown(std::string::String),
12805        }
12806        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12807            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12808            where
12809                D: serde::Deserializer<'de>,
12810            {
12811                struct Visitor;
12812                impl<'de> serde::de::Visitor<'de> for Visitor {
12813                    type Value = __FieldTag;
12814                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12815                        formatter.write_str("a field name for BuildInfo")
12816                    }
12817                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12818                    where
12819                        E: serde::de::Error,
12820                    {
12821                        use std::result::Result::Ok;
12822                        use std::string::ToString;
12823                        match value {
12824                            "functionTarget" => Ok(__FieldTag::__function_target),
12825                            "function_target" => Ok(__FieldTag::__function_target),
12826                            "sourceLocation" => Ok(__FieldTag::__source_location),
12827                            "source_location" => Ok(__FieldTag::__source_location),
12828                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12829                        }
12830                    }
12831                }
12832                deserializer.deserialize_identifier(Visitor)
12833            }
12834        }
12835        struct Visitor;
12836        impl<'de> serde::de::Visitor<'de> for Visitor {
12837            type Value = BuildInfo;
12838            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12839                formatter.write_str("struct BuildInfo")
12840            }
12841            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12842            where
12843                A: serde::de::MapAccess<'de>,
12844            {
12845                #[allow(unused_imports)]
12846                use serde::de::Error;
12847                use std::option::Option::Some;
12848                let mut fields = std::collections::HashSet::new();
12849                let mut result = Self::Value::new();
12850                while let Some(tag) = map.next_key::<__FieldTag>()? {
12851                    #[allow(clippy::match_single_binding)]
12852                    match tag {
12853                        __FieldTag::__function_target => {
12854                            if !fields.insert(__FieldTag::__function_target) {
12855                                return std::result::Result::Err(A::Error::duplicate_field(
12856                                    "multiple values for function_target",
12857                                ));
12858                            }
12859                            result.function_target = map
12860                                .next_value::<std::option::Option<std::string::String>>()?
12861                                .unwrap_or_default();
12862                        }
12863                        __FieldTag::__source_location => {
12864                            if !fields.insert(__FieldTag::__source_location) {
12865                                return std::result::Result::Err(A::Error::duplicate_field(
12866                                    "multiple values for source_location",
12867                                ));
12868                            }
12869                            result.source_location = map
12870                                .next_value::<std::option::Option<std::string::String>>()?
12871                                .unwrap_or_default();
12872                        }
12873                        __FieldTag::Unknown(key) => {
12874                            let value = map.next_value::<serde_json::Value>()?;
12875                            result._unknown_fields.insert(key, value);
12876                        }
12877                    }
12878                }
12879                std::result::Result::Ok(result)
12880            }
12881        }
12882        deserializer.deserialize_any(Visitor)
12883    }
12884}
12885
12886#[doc(hidden)]
12887impl serde::ser::Serialize for BuildInfo {
12888    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12889    where
12890        S: serde::ser::Serializer,
12891    {
12892        use serde::ser::SerializeMap;
12893        #[allow(unused_imports)]
12894        use std::option::Option::Some;
12895        let mut state = serializer.serialize_map(std::option::Option::None)?;
12896        if !self.function_target.is_empty() {
12897            state.serialize_entry("functionTarget", &self.function_target)?;
12898        }
12899        if !self.source_location.is_empty() {
12900            state.serialize_entry("sourceLocation", &self.source_location)?;
12901        }
12902        if !self._unknown_fields.is_empty() {
12903            for (key, value) in self._unknown_fields.iter() {
12904                state.serialize_entry(key, &value)?;
12905            }
12906        }
12907        state.end()
12908    }
12909}
12910
12911/// Request message for obtaining a Revision by its full name.
12912#[derive(Clone, Debug, Default, PartialEq)]
12913#[non_exhaustive]
12914pub struct GetRevisionRequest {
12915    /// Required. The full name of the Revision.
12916    /// Format:
12917    /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
12918    pub name: std::string::String,
12919
12920    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12921}
12922
12923impl GetRevisionRequest {
12924    pub fn new() -> Self {
12925        std::default::Default::default()
12926    }
12927
12928    /// Sets the value of [name][crate::model::GetRevisionRequest::name].
12929    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12930        self.name = v.into();
12931        self
12932    }
12933}
12934
12935impl wkt::message::Message for GetRevisionRequest {
12936    fn typename() -> &'static str {
12937        "type.googleapis.com/google.cloud.run.v2.GetRevisionRequest"
12938    }
12939}
12940
12941#[doc(hidden)]
12942impl<'de> serde::de::Deserialize<'de> for GetRevisionRequest {
12943    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12944    where
12945        D: serde::Deserializer<'de>,
12946    {
12947        #[allow(non_camel_case_types)]
12948        #[doc(hidden)]
12949        #[derive(PartialEq, Eq, Hash)]
12950        enum __FieldTag {
12951            __name,
12952            Unknown(std::string::String),
12953        }
12954        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12955            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12956            where
12957                D: serde::Deserializer<'de>,
12958            {
12959                struct Visitor;
12960                impl<'de> serde::de::Visitor<'de> for Visitor {
12961                    type Value = __FieldTag;
12962                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12963                        formatter.write_str("a field name for GetRevisionRequest")
12964                    }
12965                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12966                    where
12967                        E: serde::de::Error,
12968                    {
12969                        use std::result::Result::Ok;
12970                        use std::string::ToString;
12971                        match value {
12972                            "name" => Ok(__FieldTag::__name),
12973                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12974                        }
12975                    }
12976                }
12977                deserializer.deserialize_identifier(Visitor)
12978            }
12979        }
12980        struct Visitor;
12981        impl<'de> serde::de::Visitor<'de> for Visitor {
12982            type Value = GetRevisionRequest;
12983            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12984                formatter.write_str("struct GetRevisionRequest")
12985            }
12986            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12987            where
12988                A: serde::de::MapAccess<'de>,
12989            {
12990                #[allow(unused_imports)]
12991                use serde::de::Error;
12992                use std::option::Option::Some;
12993                let mut fields = std::collections::HashSet::new();
12994                let mut result = Self::Value::new();
12995                while let Some(tag) = map.next_key::<__FieldTag>()? {
12996                    #[allow(clippy::match_single_binding)]
12997                    match tag {
12998                        __FieldTag::__name => {
12999                            if !fields.insert(__FieldTag::__name) {
13000                                return std::result::Result::Err(A::Error::duplicate_field(
13001                                    "multiple values for name",
13002                                ));
13003                            }
13004                            result.name = map
13005                                .next_value::<std::option::Option<std::string::String>>()?
13006                                .unwrap_or_default();
13007                        }
13008                        __FieldTag::Unknown(key) => {
13009                            let value = map.next_value::<serde_json::Value>()?;
13010                            result._unknown_fields.insert(key, value);
13011                        }
13012                    }
13013                }
13014                std::result::Result::Ok(result)
13015            }
13016        }
13017        deserializer.deserialize_any(Visitor)
13018    }
13019}
13020
13021#[doc(hidden)]
13022impl serde::ser::Serialize for GetRevisionRequest {
13023    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13024    where
13025        S: serde::ser::Serializer,
13026    {
13027        use serde::ser::SerializeMap;
13028        #[allow(unused_imports)]
13029        use std::option::Option::Some;
13030        let mut state = serializer.serialize_map(std::option::Option::None)?;
13031        if !self.name.is_empty() {
13032            state.serialize_entry("name", &self.name)?;
13033        }
13034        if !self._unknown_fields.is_empty() {
13035            for (key, value) in self._unknown_fields.iter() {
13036                state.serialize_entry(key, &value)?;
13037            }
13038        }
13039        state.end()
13040    }
13041}
13042
13043/// Request message for retrieving a list of Revisions.
13044#[derive(Clone, Debug, Default, PartialEq)]
13045#[non_exhaustive]
13046pub struct ListRevisionsRequest {
13047    /// Required. The Service from which the Revisions should be listed.
13048    /// To list all Revisions across Services, use "-" instead of Service name.
13049    /// Format:
13050    /// projects/{project}/locations/{location}/services/{service}
13051    pub parent: std::string::String,
13052
13053    /// Maximum number of revisions to return in this call.
13054    pub page_size: i32,
13055
13056    /// A page token received from a previous call to ListRevisions.
13057    /// All other parameters must match.
13058    pub page_token: std::string::String,
13059
13060    /// If true, returns deleted (but unexpired) resources along with active ones.
13061    pub show_deleted: bool,
13062
13063    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13064}
13065
13066impl ListRevisionsRequest {
13067    pub fn new() -> Self {
13068        std::default::Default::default()
13069    }
13070
13071    /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
13072    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13073        self.parent = v.into();
13074        self
13075    }
13076
13077    /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
13078    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13079        self.page_size = v.into();
13080        self
13081    }
13082
13083    /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
13084    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13085        self.page_token = v.into();
13086        self
13087    }
13088
13089    /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
13090    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13091        self.show_deleted = v.into();
13092        self
13093    }
13094}
13095
13096impl wkt::message::Message for ListRevisionsRequest {
13097    fn typename() -> &'static str {
13098        "type.googleapis.com/google.cloud.run.v2.ListRevisionsRequest"
13099    }
13100}
13101
13102#[doc(hidden)]
13103impl<'de> serde::de::Deserialize<'de> for ListRevisionsRequest {
13104    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13105    where
13106        D: serde::Deserializer<'de>,
13107    {
13108        #[allow(non_camel_case_types)]
13109        #[doc(hidden)]
13110        #[derive(PartialEq, Eq, Hash)]
13111        enum __FieldTag {
13112            __parent,
13113            __page_size,
13114            __page_token,
13115            __show_deleted,
13116            Unknown(std::string::String),
13117        }
13118        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13119            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13120            where
13121                D: serde::Deserializer<'de>,
13122            {
13123                struct Visitor;
13124                impl<'de> serde::de::Visitor<'de> for Visitor {
13125                    type Value = __FieldTag;
13126                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13127                        formatter.write_str("a field name for ListRevisionsRequest")
13128                    }
13129                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13130                    where
13131                        E: serde::de::Error,
13132                    {
13133                        use std::result::Result::Ok;
13134                        use std::string::ToString;
13135                        match value {
13136                            "parent" => Ok(__FieldTag::__parent),
13137                            "pageSize" => Ok(__FieldTag::__page_size),
13138                            "page_size" => Ok(__FieldTag::__page_size),
13139                            "pageToken" => Ok(__FieldTag::__page_token),
13140                            "page_token" => Ok(__FieldTag::__page_token),
13141                            "showDeleted" => Ok(__FieldTag::__show_deleted),
13142                            "show_deleted" => Ok(__FieldTag::__show_deleted),
13143                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13144                        }
13145                    }
13146                }
13147                deserializer.deserialize_identifier(Visitor)
13148            }
13149        }
13150        struct Visitor;
13151        impl<'de> serde::de::Visitor<'de> for Visitor {
13152            type Value = ListRevisionsRequest;
13153            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13154                formatter.write_str("struct ListRevisionsRequest")
13155            }
13156            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13157            where
13158                A: serde::de::MapAccess<'de>,
13159            {
13160                #[allow(unused_imports)]
13161                use serde::de::Error;
13162                use std::option::Option::Some;
13163                let mut fields = std::collections::HashSet::new();
13164                let mut result = Self::Value::new();
13165                while let Some(tag) = map.next_key::<__FieldTag>()? {
13166                    #[allow(clippy::match_single_binding)]
13167                    match tag {
13168                        __FieldTag::__parent => {
13169                            if !fields.insert(__FieldTag::__parent) {
13170                                return std::result::Result::Err(A::Error::duplicate_field(
13171                                    "multiple values for parent",
13172                                ));
13173                            }
13174                            result.parent = map
13175                                .next_value::<std::option::Option<std::string::String>>()?
13176                                .unwrap_or_default();
13177                        }
13178                        __FieldTag::__page_size => {
13179                            if !fields.insert(__FieldTag::__page_size) {
13180                                return std::result::Result::Err(A::Error::duplicate_field(
13181                                    "multiple values for page_size",
13182                                ));
13183                            }
13184                            struct __With(std::option::Option<i32>);
13185                            impl<'de> serde::de::Deserialize<'de> for __With {
13186                                fn deserialize<D>(
13187                                    deserializer: D,
13188                                ) -> std::result::Result<Self, D::Error>
13189                                where
13190                                    D: serde::de::Deserializer<'de>,
13191                                {
13192                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13193                                }
13194                            }
13195                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
13196                        }
13197                        __FieldTag::__page_token => {
13198                            if !fields.insert(__FieldTag::__page_token) {
13199                                return std::result::Result::Err(A::Error::duplicate_field(
13200                                    "multiple values for page_token",
13201                                ));
13202                            }
13203                            result.page_token = map
13204                                .next_value::<std::option::Option<std::string::String>>()?
13205                                .unwrap_or_default();
13206                        }
13207                        __FieldTag::__show_deleted => {
13208                            if !fields.insert(__FieldTag::__show_deleted) {
13209                                return std::result::Result::Err(A::Error::duplicate_field(
13210                                    "multiple values for show_deleted",
13211                                ));
13212                            }
13213                            result.show_deleted = map
13214                                .next_value::<std::option::Option<bool>>()?
13215                                .unwrap_or_default();
13216                        }
13217                        __FieldTag::Unknown(key) => {
13218                            let value = map.next_value::<serde_json::Value>()?;
13219                            result._unknown_fields.insert(key, value);
13220                        }
13221                    }
13222                }
13223                std::result::Result::Ok(result)
13224            }
13225        }
13226        deserializer.deserialize_any(Visitor)
13227    }
13228}
13229
13230#[doc(hidden)]
13231impl serde::ser::Serialize for ListRevisionsRequest {
13232    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13233    where
13234        S: serde::ser::Serializer,
13235    {
13236        use serde::ser::SerializeMap;
13237        #[allow(unused_imports)]
13238        use std::option::Option::Some;
13239        let mut state = serializer.serialize_map(std::option::Option::None)?;
13240        if !self.parent.is_empty() {
13241            state.serialize_entry("parent", &self.parent)?;
13242        }
13243        if !wkt::internal::is_default(&self.page_size) {
13244            struct __With<'a>(&'a i32);
13245            impl<'a> serde::ser::Serialize for __With<'a> {
13246                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13247                where
13248                    S: serde::ser::Serializer,
13249                {
13250                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13251                }
13252            }
13253            state.serialize_entry("pageSize", &__With(&self.page_size))?;
13254        }
13255        if !self.page_token.is_empty() {
13256            state.serialize_entry("pageToken", &self.page_token)?;
13257        }
13258        if !wkt::internal::is_default(&self.show_deleted) {
13259            state.serialize_entry("showDeleted", &self.show_deleted)?;
13260        }
13261        if !self._unknown_fields.is_empty() {
13262            for (key, value) in self._unknown_fields.iter() {
13263                state.serialize_entry(key, &value)?;
13264            }
13265        }
13266        state.end()
13267    }
13268}
13269
13270/// Response message containing a list of Revisions.
13271#[derive(Clone, Debug, Default, PartialEq)]
13272#[non_exhaustive]
13273pub struct ListRevisionsResponse {
13274    /// The resulting list of Revisions.
13275    pub revisions: std::vec::Vec<crate::model::Revision>,
13276
13277    /// A token indicating there are more items than page_size. Use it in the next
13278    /// ListRevisions request to continue.
13279    pub next_page_token: std::string::String,
13280
13281    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13282}
13283
13284impl ListRevisionsResponse {
13285    pub fn new() -> Self {
13286        std::default::Default::default()
13287    }
13288
13289    /// Sets the value of [revisions][crate::model::ListRevisionsResponse::revisions].
13290    pub fn set_revisions<T, V>(mut self, v: T) -> Self
13291    where
13292        T: std::iter::IntoIterator<Item = V>,
13293        V: std::convert::Into<crate::model::Revision>,
13294    {
13295        use std::iter::Iterator;
13296        self.revisions = v.into_iter().map(|i| i.into()).collect();
13297        self
13298    }
13299
13300    /// Sets the value of [next_page_token][crate::model::ListRevisionsResponse::next_page_token].
13301    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13302        self.next_page_token = v.into();
13303        self
13304    }
13305}
13306
13307impl wkt::message::Message for ListRevisionsResponse {
13308    fn typename() -> &'static str {
13309        "type.googleapis.com/google.cloud.run.v2.ListRevisionsResponse"
13310    }
13311}
13312
13313#[doc(hidden)]
13314impl gax::paginator::internal::PageableResponse for ListRevisionsResponse {
13315    type PageItem = crate::model::Revision;
13316
13317    fn items(self) -> std::vec::Vec<Self::PageItem> {
13318        self.revisions
13319    }
13320
13321    fn next_page_token(&self) -> std::string::String {
13322        use std::clone::Clone;
13323        self.next_page_token.clone()
13324    }
13325}
13326
13327#[doc(hidden)]
13328impl<'de> serde::de::Deserialize<'de> for ListRevisionsResponse {
13329    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13330    where
13331        D: serde::Deserializer<'de>,
13332    {
13333        #[allow(non_camel_case_types)]
13334        #[doc(hidden)]
13335        #[derive(PartialEq, Eq, Hash)]
13336        enum __FieldTag {
13337            __revisions,
13338            __next_page_token,
13339            Unknown(std::string::String),
13340        }
13341        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13342            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13343            where
13344                D: serde::Deserializer<'de>,
13345            {
13346                struct Visitor;
13347                impl<'de> serde::de::Visitor<'de> for Visitor {
13348                    type Value = __FieldTag;
13349                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13350                        formatter.write_str("a field name for ListRevisionsResponse")
13351                    }
13352                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13353                    where
13354                        E: serde::de::Error,
13355                    {
13356                        use std::result::Result::Ok;
13357                        use std::string::ToString;
13358                        match value {
13359                            "revisions" => Ok(__FieldTag::__revisions),
13360                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
13361                            "next_page_token" => Ok(__FieldTag::__next_page_token),
13362                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13363                        }
13364                    }
13365                }
13366                deserializer.deserialize_identifier(Visitor)
13367            }
13368        }
13369        struct Visitor;
13370        impl<'de> serde::de::Visitor<'de> for Visitor {
13371            type Value = ListRevisionsResponse;
13372            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13373                formatter.write_str("struct ListRevisionsResponse")
13374            }
13375            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13376            where
13377                A: serde::de::MapAccess<'de>,
13378            {
13379                #[allow(unused_imports)]
13380                use serde::de::Error;
13381                use std::option::Option::Some;
13382                let mut fields = std::collections::HashSet::new();
13383                let mut result = Self::Value::new();
13384                while let Some(tag) = map.next_key::<__FieldTag>()? {
13385                    #[allow(clippy::match_single_binding)]
13386                    match tag {
13387                        __FieldTag::__revisions => {
13388                            if !fields.insert(__FieldTag::__revisions) {
13389                                return std::result::Result::Err(A::Error::duplicate_field(
13390                                    "multiple values for revisions",
13391                                ));
13392                            }
13393                            result.revisions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Revision>>>()?.unwrap_or_default();
13394                        }
13395                        __FieldTag::__next_page_token => {
13396                            if !fields.insert(__FieldTag::__next_page_token) {
13397                                return std::result::Result::Err(A::Error::duplicate_field(
13398                                    "multiple values for next_page_token",
13399                                ));
13400                            }
13401                            result.next_page_token = map
13402                                .next_value::<std::option::Option<std::string::String>>()?
13403                                .unwrap_or_default();
13404                        }
13405                        __FieldTag::Unknown(key) => {
13406                            let value = map.next_value::<serde_json::Value>()?;
13407                            result._unknown_fields.insert(key, value);
13408                        }
13409                    }
13410                }
13411                std::result::Result::Ok(result)
13412            }
13413        }
13414        deserializer.deserialize_any(Visitor)
13415    }
13416}
13417
13418#[doc(hidden)]
13419impl serde::ser::Serialize for ListRevisionsResponse {
13420    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13421    where
13422        S: serde::ser::Serializer,
13423    {
13424        use serde::ser::SerializeMap;
13425        #[allow(unused_imports)]
13426        use std::option::Option::Some;
13427        let mut state = serializer.serialize_map(std::option::Option::None)?;
13428        if !self.revisions.is_empty() {
13429            state.serialize_entry("revisions", &self.revisions)?;
13430        }
13431        if !self.next_page_token.is_empty() {
13432            state.serialize_entry("nextPageToken", &self.next_page_token)?;
13433        }
13434        if !self._unknown_fields.is_empty() {
13435            for (key, value) in self._unknown_fields.iter() {
13436                state.serialize_entry(key, &value)?;
13437            }
13438        }
13439        state.end()
13440    }
13441}
13442
13443/// Request message for deleting a retired Revision.
13444/// Revision lifecycle is usually managed by making changes to the parent
13445/// Service. Only retired revisions can be deleted with this API.
13446#[derive(Clone, Debug, Default, PartialEq)]
13447#[non_exhaustive]
13448pub struct DeleteRevisionRequest {
13449    /// Required. The name of the Revision to delete.
13450    /// Format:
13451    /// projects/{project}/locations/{location}/services/{service}/revisions/{revision}
13452    pub name: std::string::String,
13453
13454    /// Indicates that the request should be validated without actually
13455    /// deleting any resources.
13456    pub validate_only: bool,
13457
13458    /// A system-generated fingerprint for this version of the
13459    /// resource. This may be used to detect modification conflict during updates.
13460    pub etag: std::string::String,
13461
13462    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13463}
13464
13465impl DeleteRevisionRequest {
13466    pub fn new() -> Self {
13467        std::default::Default::default()
13468    }
13469
13470    /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
13471    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13472        self.name = v.into();
13473        self
13474    }
13475
13476    /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
13477    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13478        self.validate_only = v.into();
13479        self
13480    }
13481
13482    /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
13483    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13484        self.etag = v.into();
13485        self
13486    }
13487}
13488
13489impl wkt::message::Message for DeleteRevisionRequest {
13490    fn typename() -> &'static str {
13491        "type.googleapis.com/google.cloud.run.v2.DeleteRevisionRequest"
13492    }
13493}
13494
13495#[doc(hidden)]
13496impl<'de> serde::de::Deserialize<'de> for DeleteRevisionRequest {
13497    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13498    where
13499        D: serde::Deserializer<'de>,
13500    {
13501        #[allow(non_camel_case_types)]
13502        #[doc(hidden)]
13503        #[derive(PartialEq, Eq, Hash)]
13504        enum __FieldTag {
13505            __name,
13506            __validate_only,
13507            __etag,
13508            Unknown(std::string::String),
13509        }
13510        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13511            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13512            where
13513                D: serde::Deserializer<'de>,
13514            {
13515                struct Visitor;
13516                impl<'de> serde::de::Visitor<'de> for Visitor {
13517                    type Value = __FieldTag;
13518                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13519                        formatter.write_str("a field name for DeleteRevisionRequest")
13520                    }
13521                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13522                    where
13523                        E: serde::de::Error,
13524                    {
13525                        use std::result::Result::Ok;
13526                        use std::string::ToString;
13527                        match value {
13528                            "name" => Ok(__FieldTag::__name),
13529                            "validateOnly" => Ok(__FieldTag::__validate_only),
13530                            "validate_only" => Ok(__FieldTag::__validate_only),
13531                            "etag" => Ok(__FieldTag::__etag),
13532                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13533                        }
13534                    }
13535                }
13536                deserializer.deserialize_identifier(Visitor)
13537            }
13538        }
13539        struct Visitor;
13540        impl<'de> serde::de::Visitor<'de> for Visitor {
13541            type Value = DeleteRevisionRequest;
13542            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13543                formatter.write_str("struct DeleteRevisionRequest")
13544            }
13545            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13546            where
13547                A: serde::de::MapAccess<'de>,
13548            {
13549                #[allow(unused_imports)]
13550                use serde::de::Error;
13551                use std::option::Option::Some;
13552                let mut fields = std::collections::HashSet::new();
13553                let mut result = Self::Value::new();
13554                while let Some(tag) = map.next_key::<__FieldTag>()? {
13555                    #[allow(clippy::match_single_binding)]
13556                    match tag {
13557                        __FieldTag::__name => {
13558                            if !fields.insert(__FieldTag::__name) {
13559                                return std::result::Result::Err(A::Error::duplicate_field(
13560                                    "multiple values for name",
13561                                ));
13562                            }
13563                            result.name = map
13564                                .next_value::<std::option::Option<std::string::String>>()?
13565                                .unwrap_or_default();
13566                        }
13567                        __FieldTag::__validate_only => {
13568                            if !fields.insert(__FieldTag::__validate_only) {
13569                                return std::result::Result::Err(A::Error::duplicate_field(
13570                                    "multiple values for validate_only",
13571                                ));
13572                            }
13573                            result.validate_only = map
13574                                .next_value::<std::option::Option<bool>>()?
13575                                .unwrap_or_default();
13576                        }
13577                        __FieldTag::__etag => {
13578                            if !fields.insert(__FieldTag::__etag) {
13579                                return std::result::Result::Err(A::Error::duplicate_field(
13580                                    "multiple values for etag",
13581                                ));
13582                            }
13583                            result.etag = map
13584                                .next_value::<std::option::Option<std::string::String>>()?
13585                                .unwrap_or_default();
13586                        }
13587                        __FieldTag::Unknown(key) => {
13588                            let value = map.next_value::<serde_json::Value>()?;
13589                            result._unknown_fields.insert(key, value);
13590                        }
13591                    }
13592                }
13593                std::result::Result::Ok(result)
13594            }
13595        }
13596        deserializer.deserialize_any(Visitor)
13597    }
13598}
13599
13600#[doc(hidden)]
13601impl serde::ser::Serialize for DeleteRevisionRequest {
13602    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13603    where
13604        S: serde::ser::Serializer,
13605    {
13606        use serde::ser::SerializeMap;
13607        #[allow(unused_imports)]
13608        use std::option::Option::Some;
13609        let mut state = serializer.serialize_map(std::option::Option::None)?;
13610        if !self.name.is_empty() {
13611            state.serialize_entry("name", &self.name)?;
13612        }
13613        if !wkt::internal::is_default(&self.validate_only) {
13614            state.serialize_entry("validateOnly", &self.validate_only)?;
13615        }
13616        if !self.etag.is_empty() {
13617            state.serialize_entry("etag", &self.etag)?;
13618        }
13619        if !self._unknown_fields.is_empty() {
13620            for (key, value) in self._unknown_fields.iter() {
13621                state.serialize_entry(key, &value)?;
13622            }
13623        }
13624        state.end()
13625    }
13626}
13627
13628/// A Revision is an immutable snapshot of code and configuration.  A Revision
13629/// references a container image. Revisions are only created by updates to its
13630/// parent Service.
13631#[derive(Clone, Debug, Default, PartialEq)]
13632#[non_exhaustive]
13633pub struct Revision {
13634    /// Output only. The unique name of this Revision.
13635    pub name: std::string::String,
13636
13637    /// Output only. Server assigned unique identifier for the Revision. The value
13638    /// is a UUID4 string and guaranteed to remain unchanged until the resource is
13639    /// deleted.
13640    pub uid: std::string::String,
13641
13642    /// Output only. A number that monotonically increases every time the user
13643    /// modifies the desired state.
13644    pub generation: i64,
13645
13646    /// Output only. Unstructured key value map that can be used to organize and
13647    /// categorize objects. User-provided labels are shared with Google's billing
13648    /// system, so they can be used to filter, or break down billing charges by
13649    /// team, component, environment, state, etc. For more information, visit
13650    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
13651    /// <https://cloud.google.com/run/docs/configuring/labels>.
13652    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13653
13654    /// Output only. Unstructured key value map that may
13655    /// be set by external tools to store and arbitrary metadata.
13656    /// They are not queryable and should be preserved
13657    /// when modifying objects.
13658    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
13659
13660    /// Output only. The creation time.
13661    pub create_time: std::option::Option<wkt::Timestamp>,
13662
13663    /// Output only. The last-modified time.
13664    pub update_time: std::option::Option<wkt::Timestamp>,
13665
13666    /// Output only. For a deleted resource, the deletion time. It is only
13667    /// populated as a response to a Delete request.
13668    pub delete_time: std::option::Option<wkt::Timestamp>,
13669
13670    /// Output only. For a deleted resource, the time after which it will be
13671    /// permamently deleted. It is only populated as a response to a Delete
13672    /// request.
13673    pub expire_time: std::option::Option<wkt::Timestamp>,
13674
13675    /// The least stable launch stage needed to create this resource, as defined by
13676    /// [Google Cloud Platform Launch
13677    /// Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports
13678    /// `ALPHA`, `BETA`, and `GA`.
13679    ///
13680    /// Note that this value might not be what was used
13681    /// as input. For example, if ALPHA was provided as input in the parent
13682    /// resource, but only BETA and GA-level features are were, this field will be
13683    /// BETA.
13684    pub launch_stage: api::model::LaunchStage,
13685
13686    /// Output only. The name of the parent service.
13687    pub service: std::string::String,
13688
13689    /// Scaling settings for this revision.
13690    pub scaling: std::option::Option<crate::model::RevisionScaling>,
13691
13692    /// VPC Access configuration for this Revision. For more information, visit
13693    /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
13694    pub vpc_access: std::option::Option<crate::model::VpcAccess>,
13695
13696    /// Sets the maximum number of requests that each serving instance can receive.
13697    pub max_instance_request_concurrency: i32,
13698
13699    /// Max allowed time for an instance to respond to a request.
13700    pub timeout: std::option::Option<wkt::Duration>,
13701
13702    /// Email address of the IAM service account associated with the revision of
13703    /// the service. The service account represents the identity of the running
13704    /// revision, and determines what permissions the revision has.
13705    pub service_account: std::string::String,
13706
13707    /// Holds the single container that defines the unit of execution for this
13708    /// Revision.
13709    pub containers: std::vec::Vec<crate::model::Container>,
13710
13711    /// A list of Volumes to make available to containers.
13712    pub volumes: std::vec::Vec<crate::model::Volume>,
13713
13714    /// The execution environment being used to host this Revision.
13715    pub execution_environment: crate::model::ExecutionEnvironment,
13716
13717    /// A reference to a customer managed encryption key (CMEK) to use to encrypt
13718    /// this container image. For more information, go to
13719    /// <https://cloud.google.com/run/docs/securing/using-cmek>
13720    pub encryption_key: std::string::String,
13721
13722    /// Enables service mesh connectivity.
13723    pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
13724
13725    /// The action to take if the encryption key is revoked.
13726    pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
13727
13728    /// If encryption_key_revocation_action is SHUTDOWN, the duration before
13729    /// shutting down all instances. The minimum increment is 1 hour.
13730    pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
13731
13732    /// Output only. Indicates whether the resource's reconciliation is still in
13733    /// progress. See comments in `Service.reconciling` for additional information
13734    /// on reconciliation process in Cloud Run.
13735    pub reconciling: bool,
13736
13737    /// Output only. The Condition of this Revision, containing its readiness
13738    /// status, and detailed error information in case it did not reach a serving
13739    /// state.
13740    pub conditions: std::vec::Vec<crate::model::Condition>,
13741
13742    /// Output only. The generation of this Revision currently serving traffic. See
13743    /// comments in `reconciling` for additional information on reconciliation
13744    /// process in Cloud Run.
13745    pub observed_generation: i64,
13746
13747    /// Output only. The Google Console URI to obtain logs for the Revision.
13748    pub log_uri: std::string::String,
13749
13750    /// Output only. Reserved for future use.
13751    pub satisfies_pzs: bool,
13752
13753    /// Enable session affinity.
13754    pub session_affinity: bool,
13755
13756    /// Output only. The current effective scaling settings for the revision.
13757    pub scaling_status: std::option::Option<crate::model::RevisionScalingStatus>,
13758
13759    /// The node selector for the revision.
13760    pub node_selector: std::option::Option<crate::model::NodeSelector>,
13761
13762    /// Optional. Output only. True if GPU zonal redundancy is disabled on this
13763    /// revision.
13764    pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
13765
13766    /// Output only. Email address of the authenticated creator.
13767    pub creator: std::string::String,
13768
13769    /// Output only. A system-generated fingerprint for this version of the
13770    /// resource. May be used to detect modification conflict during updates.
13771    pub etag: std::string::String,
13772
13773    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13774}
13775
13776impl Revision {
13777    pub fn new() -> Self {
13778        std::default::Default::default()
13779    }
13780
13781    /// Sets the value of [name][crate::model::Revision::name].
13782    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13783        self.name = v.into();
13784        self
13785    }
13786
13787    /// Sets the value of [uid][crate::model::Revision::uid].
13788    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13789        self.uid = v.into();
13790        self
13791    }
13792
13793    /// Sets the value of [generation][crate::model::Revision::generation].
13794    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13795        self.generation = v.into();
13796        self
13797    }
13798
13799    /// Sets the value of [labels][crate::model::Revision::labels].
13800    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
13801    where
13802        T: std::iter::IntoIterator<Item = (K, V)>,
13803        K: std::convert::Into<std::string::String>,
13804        V: std::convert::Into<std::string::String>,
13805    {
13806        use std::iter::Iterator;
13807        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13808        self
13809    }
13810
13811    /// Sets the value of [annotations][crate::model::Revision::annotations].
13812    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
13813    where
13814        T: std::iter::IntoIterator<Item = (K, V)>,
13815        K: std::convert::Into<std::string::String>,
13816        V: std::convert::Into<std::string::String>,
13817    {
13818        use std::iter::Iterator;
13819        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13820        self
13821    }
13822
13823    /// Sets the value of [create_time][crate::model::Revision::create_time].
13824    pub fn set_create_time<T>(mut self, v: T) -> Self
13825    where
13826        T: std::convert::Into<wkt::Timestamp>,
13827    {
13828        self.create_time = std::option::Option::Some(v.into());
13829        self
13830    }
13831
13832    /// Sets or clears the value of [create_time][crate::model::Revision::create_time].
13833    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13834    where
13835        T: std::convert::Into<wkt::Timestamp>,
13836    {
13837        self.create_time = v.map(|x| x.into());
13838        self
13839    }
13840
13841    /// Sets the value of [update_time][crate::model::Revision::update_time].
13842    pub fn set_update_time<T>(mut self, v: T) -> Self
13843    where
13844        T: std::convert::Into<wkt::Timestamp>,
13845    {
13846        self.update_time = std::option::Option::Some(v.into());
13847        self
13848    }
13849
13850    /// Sets or clears the value of [update_time][crate::model::Revision::update_time].
13851    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13852    where
13853        T: std::convert::Into<wkt::Timestamp>,
13854    {
13855        self.update_time = v.map(|x| x.into());
13856        self
13857    }
13858
13859    /// Sets the value of [delete_time][crate::model::Revision::delete_time].
13860    pub fn set_delete_time<T>(mut self, v: T) -> Self
13861    where
13862        T: std::convert::Into<wkt::Timestamp>,
13863    {
13864        self.delete_time = std::option::Option::Some(v.into());
13865        self
13866    }
13867
13868    /// Sets or clears the value of [delete_time][crate::model::Revision::delete_time].
13869    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
13870    where
13871        T: std::convert::Into<wkt::Timestamp>,
13872    {
13873        self.delete_time = v.map(|x| x.into());
13874        self
13875    }
13876
13877    /// Sets the value of [expire_time][crate::model::Revision::expire_time].
13878    pub fn set_expire_time<T>(mut self, v: T) -> Self
13879    where
13880        T: std::convert::Into<wkt::Timestamp>,
13881    {
13882        self.expire_time = std::option::Option::Some(v.into());
13883        self
13884    }
13885
13886    /// Sets or clears the value of [expire_time][crate::model::Revision::expire_time].
13887    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
13888    where
13889        T: std::convert::Into<wkt::Timestamp>,
13890    {
13891        self.expire_time = v.map(|x| x.into());
13892        self
13893    }
13894
13895    /// Sets the value of [launch_stage][crate::model::Revision::launch_stage].
13896    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
13897        mut self,
13898        v: T,
13899    ) -> Self {
13900        self.launch_stage = v.into();
13901        self
13902    }
13903
13904    /// Sets the value of [service][crate::model::Revision::service].
13905    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13906        self.service = v.into();
13907        self
13908    }
13909
13910    /// Sets the value of [scaling][crate::model::Revision::scaling].
13911    pub fn set_scaling<T>(mut self, v: T) -> Self
13912    where
13913        T: std::convert::Into<crate::model::RevisionScaling>,
13914    {
13915        self.scaling = std::option::Option::Some(v.into());
13916        self
13917    }
13918
13919    /// Sets or clears the value of [scaling][crate::model::Revision::scaling].
13920    pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
13921    where
13922        T: std::convert::Into<crate::model::RevisionScaling>,
13923    {
13924        self.scaling = v.map(|x| x.into());
13925        self
13926    }
13927
13928    /// Sets the value of [vpc_access][crate::model::Revision::vpc_access].
13929    pub fn set_vpc_access<T>(mut self, v: T) -> Self
13930    where
13931        T: std::convert::Into<crate::model::VpcAccess>,
13932    {
13933        self.vpc_access = std::option::Option::Some(v.into());
13934        self
13935    }
13936
13937    /// Sets or clears the value of [vpc_access][crate::model::Revision::vpc_access].
13938    pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
13939    where
13940        T: std::convert::Into<crate::model::VpcAccess>,
13941    {
13942        self.vpc_access = v.map(|x| x.into());
13943        self
13944    }
13945
13946    /// Sets the value of [max_instance_request_concurrency][crate::model::Revision::max_instance_request_concurrency].
13947    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
13948        mut self,
13949        v: T,
13950    ) -> Self {
13951        self.max_instance_request_concurrency = v.into();
13952        self
13953    }
13954
13955    /// Sets the value of [timeout][crate::model::Revision::timeout].
13956    pub fn set_timeout<T>(mut self, v: T) -> Self
13957    where
13958        T: std::convert::Into<wkt::Duration>,
13959    {
13960        self.timeout = std::option::Option::Some(v.into());
13961        self
13962    }
13963
13964    /// Sets or clears the value of [timeout][crate::model::Revision::timeout].
13965    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13966    where
13967        T: std::convert::Into<wkt::Duration>,
13968    {
13969        self.timeout = v.map(|x| x.into());
13970        self
13971    }
13972
13973    /// Sets the value of [service_account][crate::model::Revision::service_account].
13974    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13975        self.service_account = v.into();
13976        self
13977    }
13978
13979    /// Sets the value of [containers][crate::model::Revision::containers].
13980    pub fn set_containers<T, V>(mut self, v: T) -> Self
13981    where
13982        T: std::iter::IntoIterator<Item = V>,
13983        V: std::convert::Into<crate::model::Container>,
13984    {
13985        use std::iter::Iterator;
13986        self.containers = v.into_iter().map(|i| i.into()).collect();
13987        self
13988    }
13989
13990    /// Sets the value of [volumes][crate::model::Revision::volumes].
13991    pub fn set_volumes<T, V>(mut self, v: T) -> Self
13992    where
13993        T: std::iter::IntoIterator<Item = V>,
13994        V: std::convert::Into<crate::model::Volume>,
13995    {
13996        use std::iter::Iterator;
13997        self.volumes = v.into_iter().map(|i| i.into()).collect();
13998        self
13999    }
14000
14001    /// Sets the value of [execution_environment][crate::model::Revision::execution_environment].
14002    pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
14003        mut self,
14004        v: T,
14005    ) -> Self {
14006        self.execution_environment = v.into();
14007        self
14008    }
14009
14010    /// Sets the value of [encryption_key][crate::model::Revision::encryption_key].
14011    pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14012        self.encryption_key = v.into();
14013        self
14014    }
14015
14016    /// Sets the value of [service_mesh][crate::model::Revision::service_mesh].
14017    pub fn set_service_mesh<T>(mut self, v: T) -> Self
14018    where
14019        T: std::convert::Into<crate::model::ServiceMesh>,
14020    {
14021        self.service_mesh = std::option::Option::Some(v.into());
14022        self
14023    }
14024
14025    /// Sets or clears the value of [service_mesh][crate::model::Revision::service_mesh].
14026    pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
14027    where
14028        T: std::convert::Into<crate::model::ServiceMesh>,
14029    {
14030        self.service_mesh = v.map(|x| x.into());
14031        self
14032    }
14033
14034    /// Sets the value of [encryption_key_revocation_action][crate::model::Revision::encryption_key_revocation_action].
14035    pub fn set_encryption_key_revocation_action<
14036        T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
14037    >(
14038        mut self,
14039        v: T,
14040    ) -> Self {
14041        self.encryption_key_revocation_action = v.into();
14042        self
14043    }
14044
14045    /// Sets the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
14046    pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
14047    where
14048        T: std::convert::Into<wkt::Duration>,
14049    {
14050        self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
14051        self
14052    }
14053
14054    /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::Revision::encryption_key_shutdown_duration].
14055    pub fn set_or_clear_encryption_key_shutdown_duration<T>(
14056        mut self,
14057        v: std::option::Option<T>,
14058    ) -> Self
14059    where
14060        T: std::convert::Into<wkt::Duration>,
14061    {
14062        self.encryption_key_shutdown_duration = v.map(|x| x.into());
14063        self
14064    }
14065
14066    /// Sets the value of [reconciling][crate::model::Revision::reconciling].
14067    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14068        self.reconciling = v.into();
14069        self
14070    }
14071
14072    /// Sets the value of [conditions][crate::model::Revision::conditions].
14073    pub fn set_conditions<T, V>(mut self, v: T) -> Self
14074    where
14075        T: std::iter::IntoIterator<Item = V>,
14076        V: std::convert::Into<crate::model::Condition>,
14077    {
14078        use std::iter::Iterator;
14079        self.conditions = v.into_iter().map(|i| i.into()).collect();
14080        self
14081    }
14082
14083    /// Sets the value of [observed_generation][crate::model::Revision::observed_generation].
14084    pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14085        self.observed_generation = v.into();
14086        self
14087    }
14088
14089    /// Sets the value of [log_uri][crate::model::Revision::log_uri].
14090    pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14091        self.log_uri = v.into();
14092        self
14093    }
14094
14095    /// Sets the value of [satisfies_pzs][crate::model::Revision::satisfies_pzs].
14096    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14097        self.satisfies_pzs = v.into();
14098        self
14099    }
14100
14101    /// Sets the value of [session_affinity][crate::model::Revision::session_affinity].
14102    pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14103        self.session_affinity = v.into();
14104        self
14105    }
14106
14107    /// Sets the value of [scaling_status][crate::model::Revision::scaling_status].
14108    pub fn set_scaling_status<T>(mut self, v: T) -> Self
14109    where
14110        T: std::convert::Into<crate::model::RevisionScalingStatus>,
14111    {
14112        self.scaling_status = std::option::Option::Some(v.into());
14113        self
14114    }
14115
14116    /// Sets or clears the value of [scaling_status][crate::model::Revision::scaling_status].
14117    pub fn set_or_clear_scaling_status<T>(mut self, v: std::option::Option<T>) -> Self
14118    where
14119        T: std::convert::Into<crate::model::RevisionScalingStatus>,
14120    {
14121        self.scaling_status = v.map(|x| x.into());
14122        self
14123    }
14124
14125    /// Sets the value of [node_selector][crate::model::Revision::node_selector].
14126    pub fn set_node_selector<T>(mut self, v: T) -> Self
14127    where
14128        T: std::convert::Into<crate::model::NodeSelector>,
14129    {
14130        self.node_selector = std::option::Option::Some(v.into());
14131        self
14132    }
14133
14134    /// Sets or clears the value of [node_selector][crate::model::Revision::node_selector].
14135    pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
14136    where
14137        T: std::convert::Into<crate::model::NodeSelector>,
14138    {
14139        self.node_selector = v.map(|x| x.into());
14140        self
14141    }
14142
14143    /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
14144    pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
14145    where
14146        T: std::convert::Into<bool>,
14147    {
14148        self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
14149        self
14150    }
14151
14152    /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::Revision::gpu_zonal_redundancy_disabled].
14153    pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
14154        mut self,
14155        v: std::option::Option<T>,
14156    ) -> Self
14157    where
14158        T: std::convert::Into<bool>,
14159    {
14160        self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
14161        self
14162    }
14163
14164    /// Sets the value of [creator][crate::model::Revision::creator].
14165    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14166        self.creator = v.into();
14167        self
14168    }
14169
14170    /// Sets the value of [etag][crate::model::Revision::etag].
14171    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14172        self.etag = v.into();
14173        self
14174    }
14175}
14176
14177impl wkt::message::Message for Revision {
14178    fn typename() -> &'static str {
14179        "type.googleapis.com/google.cloud.run.v2.Revision"
14180    }
14181}
14182
14183#[doc(hidden)]
14184impl<'de> serde::de::Deserialize<'de> for Revision {
14185    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14186    where
14187        D: serde::Deserializer<'de>,
14188    {
14189        #[allow(non_camel_case_types)]
14190        #[doc(hidden)]
14191        #[derive(PartialEq, Eq, Hash)]
14192        enum __FieldTag {
14193            __name,
14194            __uid,
14195            __generation,
14196            __labels,
14197            __annotations,
14198            __create_time,
14199            __update_time,
14200            __delete_time,
14201            __expire_time,
14202            __launch_stage,
14203            __service,
14204            __scaling,
14205            __vpc_access,
14206            __max_instance_request_concurrency,
14207            __timeout,
14208            __service_account,
14209            __containers,
14210            __volumes,
14211            __execution_environment,
14212            __encryption_key,
14213            __service_mesh,
14214            __encryption_key_revocation_action,
14215            __encryption_key_shutdown_duration,
14216            __reconciling,
14217            __conditions,
14218            __observed_generation,
14219            __log_uri,
14220            __satisfies_pzs,
14221            __session_affinity,
14222            __scaling_status,
14223            __node_selector,
14224            __gpu_zonal_redundancy_disabled,
14225            __creator,
14226            __etag,
14227            Unknown(std::string::String),
14228        }
14229        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14230            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14231            where
14232                D: serde::Deserializer<'de>,
14233            {
14234                struct Visitor;
14235                impl<'de> serde::de::Visitor<'de> for Visitor {
14236                    type Value = __FieldTag;
14237                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14238                        formatter.write_str("a field name for Revision")
14239                    }
14240                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14241                    where
14242                        E: serde::de::Error,
14243                    {
14244                        use std::result::Result::Ok;
14245                        use std::string::ToString;
14246                        match value {
14247                            "name" => Ok(__FieldTag::__name),
14248                            "uid" => Ok(__FieldTag::__uid),
14249                            "generation" => Ok(__FieldTag::__generation),
14250                            "labels" => Ok(__FieldTag::__labels),
14251                            "annotations" => Ok(__FieldTag::__annotations),
14252                            "createTime" => Ok(__FieldTag::__create_time),
14253                            "create_time" => Ok(__FieldTag::__create_time),
14254                            "updateTime" => Ok(__FieldTag::__update_time),
14255                            "update_time" => Ok(__FieldTag::__update_time),
14256                            "deleteTime" => Ok(__FieldTag::__delete_time),
14257                            "delete_time" => Ok(__FieldTag::__delete_time),
14258                            "expireTime" => Ok(__FieldTag::__expire_time),
14259                            "expire_time" => Ok(__FieldTag::__expire_time),
14260                            "launchStage" => Ok(__FieldTag::__launch_stage),
14261                            "launch_stage" => Ok(__FieldTag::__launch_stage),
14262                            "service" => Ok(__FieldTag::__service),
14263                            "scaling" => Ok(__FieldTag::__scaling),
14264                            "vpcAccess" => Ok(__FieldTag::__vpc_access),
14265                            "vpc_access" => Ok(__FieldTag::__vpc_access),
14266                            "maxInstanceRequestConcurrency" => {
14267                                Ok(__FieldTag::__max_instance_request_concurrency)
14268                            }
14269                            "max_instance_request_concurrency" => {
14270                                Ok(__FieldTag::__max_instance_request_concurrency)
14271                            }
14272                            "timeout" => Ok(__FieldTag::__timeout),
14273                            "serviceAccount" => Ok(__FieldTag::__service_account),
14274                            "service_account" => Ok(__FieldTag::__service_account),
14275                            "containers" => Ok(__FieldTag::__containers),
14276                            "volumes" => Ok(__FieldTag::__volumes),
14277                            "executionEnvironment" => Ok(__FieldTag::__execution_environment),
14278                            "execution_environment" => Ok(__FieldTag::__execution_environment),
14279                            "encryptionKey" => Ok(__FieldTag::__encryption_key),
14280                            "encryption_key" => Ok(__FieldTag::__encryption_key),
14281                            "serviceMesh" => Ok(__FieldTag::__service_mesh),
14282                            "service_mesh" => Ok(__FieldTag::__service_mesh),
14283                            "encryptionKeyRevocationAction" => {
14284                                Ok(__FieldTag::__encryption_key_revocation_action)
14285                            }
14286                            "encryption_key_revocation_action" => {
14287                                Ok(__FieldTag::__encryption_key_revocation_action)
14288                            }
14289                            "encryptionKeyShutdownDuration" => {
14290                                Ok(__FieldTag::__encryption_key_shutdown_duration)
14291                            }
14292                            "encryption_key_shutdown_duration" => {
14293                                Ok(__FieldTag::__encryption_key_shutdown_duration)
14294                            }
14295                            "reconciling" => Ok(__FieldTag::__reconciling),
14296                            "conditions" => Ok(__FieldTag::__conditions),
14297                            "observedGeneration" => Ok(__FieldTag::__observed_generation),
14298                            "observed_generation" => Ok(__FieldTag::__observed_generation),
14299                            "logUri" => Ok(__FieldTag::__log_uri),
14300                            "log_uri" => Ok(__FieldTag::__log_uri),
14301                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
14302                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
14303                            "sessionAffinity" => Ok(__FieldTag::__session_affinity),
14304                            "session_affinity" => Ok(__FieldTag::__session_affinity),
14305                            "scalingStatus" => Ok(__FieldTag::__scaling_status),
14306                            "scaling_status" => Ok(__FieldTag::__scaling_status),
14307                            "nodeSelector" => Ok(__FieldTag::__node_selector),
14308                            "node_selector" => Ok(__FieldTag::__node_selector),
14309                            "gpuZonalRedundancyDisabled" => {
14310                                Ok(__FieldTag::__gpu_zonal_redundancy_disabled)
14311                            }
14312                            "gpu_zonal_redundancy_disabled" => {
14313                                Ok(__FieldTag::__gpu_zonal_redundancy_disabled)
14314                            }
14315                            "creator" => Ok(__FieldTag::__creator),
14316                            "etag" => Ok(__FieldTag::__etag),
14317                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14318                        }
14319                    }
14320                }
14321                deserializer.deserialize_identifier(Visitor)
14322            }
14323        }
14324        struct Visitor;
14325        impl<'de> serde::de::Visitor<'de> for Visitor {
14326            type Value = Revision;
14327            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14328                formatter.write_str("struct Revision")
14329            }
14330            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14331            where
14332                A: serde::de::MapAccess<'de>,
14333            {
14334                #[allow(unused_imports)]
14335                use serde::de::Error;
14336                use std::option::Option::Some;
14337                let mut fields = std::collections::HashSet::new();
14338                let mut result = Self::Value::new();
14339                while let Some(tag) = map.next_key::<__FieldTag>()? {
14340                    #[allow(clippy::match_single_binding)]
14341                    match tag {
14342                        __FieldTag::__name => {
14343                            if !fields.insert(__FieldTag::__name) {
14344                                return std::result::Result::Err(A::Error::duplicate_field(
14345                                    "multiple values for name",
14346                                ));
14347                            }
14348                            result.name = map
14349                                .next_value::<std::option::Option<std::string::String>>()?
14350                                .unwrap_or_default();
14351                        }
14352                        __FieldTag::__uid => {
14353                            if !fields.insert(__FieldTag::__uid) {
14354                                return std::result::Result::Err(A::Error::duplicate_field(
14355                                    "multiple values for uid",
14356                                ));
14357                            }
14358                            result.uid = map
14359                                .next_value::<std::option::Option<std::string::String>>()?
14360                                .unwrap_or_default();
14361                        }
14362                        __FieldTag::__generation => {
14363                            if !fields.insert(__FieldTag::__generation) {
14364                                return std::result::Result::Err(A::Error::duplicate_field(
14365                                    "multiple values for generation",
14366                                ));
14367                            }
14368                            struct __With(std::option::Option<i64>);
14369                            impl<'de> serde::de::Deserialize<'de> for __With {
14370                                fn deserialize<D>(
14371                                    deserializer: D,
14372                                ) -> std::result::Result<Self, D::Error>
14373                                where
14374                                    D: serde::de::Deserializer<'de>,
14375                                {
14376                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14377                                }
14378                            }
14379                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
14380                        }
14381                        __FieldTag::__labels => {
14382                            if !fields.insert(__FieldTag::__labels) {
14383                                return std::result::Result::Err(A::Error::duplicate_field(
14384                                    "multiple values for labels",
14385                                ));
14386                            }
14387                            result.labels = map
14388                                .next_value::<std::option::Option<
14389                                    std::collections::HashMap<
14390                                        std::string::String,
14391                                        std::string::String,
14392                                    >,
14393                                >>()?
14394                                .unwrap_or_default();
14395                        }
14396                        __FieldTag::__annotations => {
14397                            if !fields.insert(__FieldTag::__annotations) {
14398                                return std::result::Result::Err(A::Error::duplicate_field(
14399                                    "multiple values for annotations",
14400                                ));
14401                            }
14402                            result.annotations = map
14403                                .next_value::<std::option::Option<
14404                                    std::collections::HashMap<
14405                                        std::string::String,
14406                                        std::string::String,
14407                                    >,
14408                                >>()?
14409                                .unwrap_or_default();
14410                        }
14411                        __FieldTag::__create_time => {
14412                            if !fields.insert(__FieldTag::__create_time) {
14413                                return std::result::Result::Err(A::Error::duplicate_field(
14414                                    "multiple values for create_time",
14415                                ));
14416                            }
14417                            result.create_time =
14418                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14419                        }
14420                        __FieldTag::__update_time => {
14421                            if !fields.insert(__FieldTag::__update_time) {
14422                                return std::result::Result::Err(A::Error::duplicate_field(
14423                                    "multiple values for update_time",
14424                                ));
14425                            }
14426                            result.update_time =
14427                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14428                        }
14429                        __FieldTag::__delete_time => {
14430                            if !fields.insert(__FieldTag::__delete_time) {
14431                                return std::result::Result::Err(A::Error::duplicate_field(
14432                                    "multiple values for delete_time",
14433                                ));
14434                            }
14435                            result.delete_time =
14436                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14437                        }
14438                        __FieldTag::__expire_time => {
14439                            if !fields.insert(__FieldTag::__expire_time) {
14440                                return std::result::Result::Err(A::Error::duplicate_field(
14441                                    "multiple values for expire_time",
14442                                ));
14443                            }
14444                            result.expire_time =
14445                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14446                        }
14447                        __FieldTag::__launch_stage => {
14448                            if !fields.insert(__FieldTag::__launch_stage) {
14449                                return std::result::Result::Err(A::Error::duplicate_field(
14450                                    "multiple values for launch_stage",
14451                                ));
14452                            }
14453                            result.launch_stage = map
14454                                .next_value::<std::option::Option<api::model::LaunchStage>>()?
14455                                .unwrap_or_default();
14456                        }
14457                        __FieldTag::__service => {
14458                            if !fields.insert(__FieldTag::__service) {
14459                                return std::result::Result::Err(A::Error::duplicate_field(
14460                                    "multiple values for service",
14461                                ));
14462                            }
14463                            result.service = map
14464                                .next_value::<std::option::Option<std::string::String>>()?
14465                                .unwrap_or_default();
14466                        }
14467                        __FieldTag::__scaling => {
14468                            if !fields.insert(__FieldTag::__scaling) {
14469                                return std::result::Result::Err(A::Error::duplicate_field(
14470                                    "multiple values for scaling",
14471                                ));
14472                            }
14473                            result.scaling = map
14474                                .next_value::<std::option::Option<crate::model::RevisionScaling>>(
14475                                )?;
14476                        }
14477                        __FieldTag::__vpc_access => {
14478                            if !fields.insert(__FieldTag::__vpc_access) {
14479                                return std::result::Result::Err(A::Error::duplicate_field(
14480                                    "multiple values for vpc_access",
14481                                ));
14482                            }
14483                            result.vpc_access =
14484                                map.next_value::<std::option::Option<crate::model::VpcAccess>>()?;
14485                        }
14486                        __FieldTag::__max_instance_request_concurrency => {
14487                            if !fields.insert(__FieldTag::__max_instance_request_concurrency) {
14488                                return std::result::Result::Err(A::Error::duplicate_field(
14489                                    "multiple values for max_instance_request_concurrency",
14490                                ));
14491                            }
14492                            struct __With(std::option::Option<i32>);
14493                            impl<'de> serde::de::Deserialize<'de> for __With {
14494                                fn deserialize<D>(
14495                                    deserializer: D,
14496                                ) -> std::result::Result<Self, D::Error>
14497                                where
14498                                    D: serde::de::Deserializer<'de>,
14499                                {
14500                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14501                                }
14502                            }
14503                            result.max_instance_request_concurrency =
14504                                map.next_value::<__With>()?.0.unwrap_or_default();
14505                        }
14506                        __FieldTag::__timeout => {
14507                            if !fields.insert(__FieldTag::__timeout) {
14508                                return std::result::Result::Err(A::Error::duplicate_field(
14509                                    "multiple values for timeout",
14510                                ));
14511                            }
14512                            result.timeout =
14513                                map.next_value::<std::option::Option<wkt::Duration>>()?;
14514                        }
14515                        __FieldTag::__service_account => {
14516                            if !fields.insert(__FieldTag::__service_account) {
14517                                return std::result::Result::Err(A::Error::duplicate_field(
14518                                    "multiple values for service_account",
14519                                ));
14520                            }
14521                            result.service_account = map
14522                                .next_value::<std::option::Option<std::string::String>>()?
14523                                .unwrap_or_default();
14524                        }
14525                        __FieldTag::__containers => {
14526                            if !fields.insert(__FieldTag::__containers) {
14527                                return std::result::Result::Err(A::Error::duplicate_field(
14528                                    "multiple values for containers",
14529                                ));
14530                            }
14531                            result.containers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Container>>>()?.unwrap_or_default();
14532                        }
14533                        __FieldTag::__volumes => {
14534                            if !fields.insert(__FieldTag::__volumes) {
14535                                return std::result::Result::Err(A::Error::duplicate_field(
14536                                    "multiple values for volumes",
14537                                ));
14538                            }
14539                            result.volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Volume>>>()?.unwrap_or_default();
14540                        }
14541                        __FieldTag::__execution_environment => {
14542                            if !fields.insert(__FieldTag::__execution_environment) {
14543                                return std::result::Result::Err(A::Error::duplicate_field(
14544                                    "multiple values for execution_environment",
14545                                ));
14546                            }
14547                            result.execution_environment = map.next_value::<std::option::Option<crate::model::ExecutionEnvironment>>()?.unwrap_or_default();
14548                        }
14549                        __FieldTag::__encryption_key => {
14550                            if !fields.insert(__FieldTag::__encryption_key) {
14551                                return std::result::Result::Err(A::Error::duplicate_field(
14552                                    "multiple values for encryption_key",
14553                                ));
14554                            }
14555                            result.encryption_key = map
14556                                .next_value::<std::option::Option<std::string::String>>()?
14557                                .unwrap_or_default();
14558                        }
14559                        __FieldTag::__service_mesh => {
14560                            if !fields.insert(__FieldTag::__service_mesh) {
14561                                return std::result::Result::Err(A::Error::duplicate_field(
14562                                    "multiple values for service_mesh",
14563                                ));
14564                            }
14565                            result.service_mesh =
14566                                map.next_value::<std::option::Option<crate::model::ServiceMesh>>()?;
14567                        }
14568                        __FieldTag::__encryption_key_revocation_action => {
14569                            if !fields.insert(__FieldTag::__encryption_key_revocation_action) {
14570                                return std::result::Result::Err(A::Error::duplicate_field(
14571                                    "multiple values for encryption_key_revocation_action",
14572                                ));
14573                            }
14574                            result.encryption_key_revocation_action =
14575                                map.next_value::<std::option::Option<
14576                                    crate::model::EncryptionKeyRevocationAction,
14577                                >>()?
14578                                .unwrap_or_default();
14579                        }
14580                        __FieldTag::__encryption_key_shutdown_duration => {
14581                            if !fields.insert(__FieldTag::__encryption_key_shutdown_duration) {
14582                                return std::result::Result::Err(A::Error::duplicate_field(
14583                                    "multiple values for encryption_key_shutdown_duration",
14584                                ));
14585                            }
14586                            result.encryption_key_shutdown_duration =
14587                                map.next_value::<std::option::Option<wkt::Duration>>()?;
14588                        }
14589                        __FieldTag::__reconciling => {
14590                            if !fields.insert(__FieldTag::__reconciling) {
14591                                return std::result::Result::Err(A::Error::duplicate_field(
14592                                    "multiple values for reconciling",
14593                                ));
14594                            }
14595                            result.reconciling = map
14596                                .next_value::<std::option::Option<bool>>()?
14597                                .unwrap_or_default();
14598                        }
14599                        __FieldTag::__conditions => {
14600                            if !fields.insert(__FieldTag::__conditions) {
14601                                return std::result::Result::Err(A::Error::duplicate_field(
14602                                    "multiple values for conditions",
14603                                ));
14604                            }
14605                            result.conditions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Condition>>>()?.unwrap_or_default();
14606                        }
14607                        __FieldTag::__observed_generation => {
14608                            if !fields.insert(__FieldTag::__observed_generation) {
14609                                return std::result::Result::Err(A::Error::duplicate_field(
14610                                    "multiple values for observed_generation",
14611                                ));
14612                            }
14613                            struct __With(std::option::Option<i64>);
14614                            impl<'de> serde::de::Deserialize<'de> for __With {
14615                                fn deserialize<D>(
14616                                    deserializer: D,
14617                                ) -> std::result::Result<Self, D::Error>
14618                                where
14619                                    D: serde::de::Deserializer<'de>,
14620                                {
14621                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14622                                }
14623                            }
14624                            result.observed_generation =
14625                                map.next_value::<__With>()?.0.unwrap_or_default();
14626                        }
14627                        __FieldTag::__log_uri => {
14628                            if !fields.insert(__FieldTag::__log_uri) {
14629                                return std::result::Result::Err(A::Error::duplicate_field(
14630                                    "multiple values for log_uri",
14631                                ));
14632                            }
14633                            result.log_uri = map
14634                                .next_value::<std::option::Option<std::string::String>>()?
14635                                .unwrap_or_default();
14636                        }
14637                        __FieldTag::__satisfies_pzs => {
14638                            if !fields.insert(__FieldTag::__satisfies_pzs) {
14639                                return std::result::Result::Err(A::Error::duplicate_field(
14640                                    "multiple values for satisfies_pzs",
14641                                ));
14642                            }
14643                            result.satisfies_pzs = map
14644                                .next_value::<std::option::Option<bool>>()?
14645                                .unwrap_or_default();
14646                        }
14647                        __FieldTag::__session_affinity => {
14648                            if !fields.insert(__FieldTag::__session_affinity) {
14649                                return std::result::Result::Err(A::Error::duplicate_field(
14650                                    "multiple values for session_affinity",
14651                                ));
14652                            }
14653                            result.session_affinity = map
14654                                .next_value::<std::option::Option<bool>>()?
14655                                .unwrap_or_default();
14656                        }
14657                        __FieldTag::__scaling_status => {
14658                            if !fields.insert(__FieldTag::__scaling_status) {
14659                                return std::result::Result::Err(A::Error::duplicate_field(
14660                                    "multiple values for scaling_status",
14661                                ));
14662                            }
14663                            result.scaling_status = map.next_value::<std::option::Option<crate::model::RevisionScalingStatus>>()?
14664                                ;
14665                        }
14666                        __FieldTag::__node_selector => {
14667                            if !fields.insert(__FieldTag::__node_selector) {
14668                                return std::result::Result::Err(A::Error::duplicate_field(
14669                                    "multiple values for node_selector",
14670                                ));
14671                            }
14672                            result.node_selector = map
14673                                .next_value::<std::option::Option<crate::model::NodeSelector>>()?;
14674                        }
14675                        __FieldTag::__gpu_zonal_redundancy_disabled => {
14676                            if !fields.insert(__FieldTag::__gpu_zonal_redundancy_disabled) {
14677                                return std::result::Result::Err(A::Error::duplicate_field(
14678                                    "multiple values for gpu_zonal_redundancy_disabled",
14679                                ));
14680                            }
14681                            result.gpu_zonal_redundancy_disabled =
14682                                map.next_value::<std::option::Option<bool>>()?;
14683                        }
14684                        __FieldTag::__creator => {
14685                            if !fields.insert(__FieldTag::__creator) {
14686                                return std::result::Result::Err(A::Error::duplicate_field(
14687                                    "multiple values for creator",
14688                                ));
14689                            }
14690                            result.creator = map
14691                                .next_value::<std::option::Option<std::string::String>>()?
14692                                .unwrap_or_default();
14693                        }
14694                        __FieldTag::__etag => {
14695                            if !fields.insert(__FieldTag::__etag) {
14696                                return std::result::Result::Err(A::Error::duplicate_field(
14697                                    "multiple values for etag",
14698                                ));
14699                            }
14700                            result.etag = map
14701                                .next_value::<std::option::Option<std::string::String>>()?
14702                                .unwrap_or_default();
14703                        }
14704                        __FieldTag::Unknown(key) => {
14705                            let value = map.next_value::<serde_json::Value>()?;
14706                            result._unknown_fields.insert(key, value);
14707                        }
14708                    }
14709                }
14710                std::result::Result::Ok(result)
14711            }
14712        }
14713        deserializer.deserialize_any(Visitor)
14714    }
14715}
14716
14717#[doc(hidden)]
14718impl serde::ser::Serialize for Revision {
14719    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14720    where
14721        S: serde::ser::Serializer,
14722    {
14723        use serde::ser::SerializeMap;
14724        #[allow(unused_imports)]
14725        use std::option::Option::Some;
14726        let mut state = serializer.serialize_map(std::option::Option::None)?;
14727        if !self.name.is_empty() {
14728            state.serialize_entry("name", &self.name)?;
14729        }
14730        if !self.uid.is_empty() {
14731            state.serialize_entry("uid", &self.uid)?;
14732        }
14733        if !wkt::internal::is_default(&self.generation) {
14734            struct __With<'a>(&'a i64);
14735            impl<'a> serde::ser::Serialize for __With<'a> {
14736                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14737                where
14738                    S: serde::ser::Serializer,
14739                {
14740                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14741                }
14742            }
14743            state.serialize_entry("generation", &__With(&self.generation))?;
14744        }
14745        if !self.labels.is_empty() {
14746            state.serialize_entry("labels", &self.labels)?;
14747        }
14748        if !self.annotations.is_empty() {
14749            state.serialize_entry("annotations", &self.annotations)?;
14750        }
14751        if self.create_time.is_some() {
14752            state.serialize_entry("createTime", &self.create_time)?;
14753        }
14754        if self.update_time.is_some() {
14755            state.serialize_entry("updateTime", &self.update_time)?;
14756        }
14757        if self.delete_time.is_some() {
14758            state.serialize_entry("deleteTime", &self.delete_time)?;
14759        }
14760        if self.expire_time.is_some() {
14761            state.serialize_entry("expireTime", &self.expire_time)?;
14762        }
14763        if !wkt::internal::is_default(&self.launch_stage) {
14764            state.serialize_entry("launchStage", &self.launch_stage)?;
14765        }
14766        if !self.service.is_empty() {
14767            state.serialize_entry("service", &self.service)?;
14768        }
14769        if self.scaling.is_some() {
14770            state.serialize_entry("scaling", &self.scaling)?;
14771        }
14772        if self.vpc_access.is_some() {
14773            state.serialize_entry("vpcAccess", &self.vpc_access)?;
14774        }
14775        if !wkt::internal::is_default(&self.max_instance_request_concurrency) {
14776            struct __With<'a>(&'a i32);
14777            impl<'a> serde::ser::Serialize for __With<'a> {
14778                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14779                where
14780                    S: serde::ser::Serializer,
14781                {
14782                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
14783                }
14784            }
14785            state.serialize_entry(
14786                "maxInstanceRequestConcurrency",
14787                &__With(&self.max_instance_request_concurrency),
14788            )?;
14789        }
14790        if self.timeout.is_some() {
14791            state.serialize_entry("timeout", &self.timeout)?;
14792        }
14793        if !self.service_account.is_empty() {
14794            state.serialize_entry("serviceAccount", &self.service_account)?;
14795        }
14796        if !self.containers.is_empty() {
14797            state.serialize_entry("containers", &self.containers)?;
14798        }
14799        if !self.volumes.is_empty() {
14800            state.serialize_entry("volumes", &self.volumes)?;
14801        }
14802        if !wkt::internal::is_default(&self.execution_environment) {
14803            state.serialize_entry("executionEnvironment", &self.execution_environment)?;
14804        }
14805        if !self.encryption_key.is_empty() {
14806            state.serialize_entry("encryptionKey", &self.encryption_key)?;
14807        }
14808        if self.service_mesh.is_some() {
14809            state.serialize_entry("serviceMesh", &self.service_mesh)?;
14810        }
14811        if !wkt::internal::is_default(&self.encryption_key_revocation_action) {
14812            state.serialize_entry(
14813                "encryptionKeyRevocationAction",
14814                &self.encryption_key_revocation_action,
14815            )?;
14816        }
14817        if self.encryption_key_shutdown_duration.is_some() {
14818            state.serialize_entry(
14819                "encryptionKeyShutdownDuration",
14820                &self.encryption_key_shutdown_duration,
14821            )?;
14822        }
14823        if !wkt::internal::is_default(&self.reconciling) {
14824            state.serialize_entry("reconciling", &self.reconciling)?;
14825        }
14826        if !self.conditions.is_empty() {
14827            state.serialize_entry("conditions", &self.conditions)?;
14828        }
14829        if !wkt::internal::is_default(&self.observed_generation) {
14830            struct __With<'a>(&'a i64);
14831            impl<'a> serde::ser::Serialize for __With<'a> {
14832                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14833                where
14834                    S: serde::ser::Serializer,
14835                {
14836                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14837                }
14838            }
14839            state.serialize_entry("observedGeneration", &__With(&self.observed_generation))?;
14840        }
14841        if !self.log_uri.is_empty() {
14842            state.serialize_entry("logUri", &self.log_uri)?;
14843        }
14844        if !wkt::internal::is_default(&self.satisfies_pzs) {
14845            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
14846        }
14847        if !wkt::internal::is_default(&self.session_affinity) {
14848            state.serialize_entry("sessionAffinity", &self.session_affinity)?;
14849        }
14850        if self.scaling_status.is_some() {
14851            state.serialize_entry("scalingStatus", &self.scaling_status)?;
14852        }
14853        if self.node_selector.is_some() {
14854            state.serialize_entry("nodeSelector", &self.node_selector)?;
14855        }
14856        if self.gpu_zonal_redundancy_disabled.is_some() {
14857            state.serialize_entry(
14858                "gpuZonalRedundancyDisabled",
14859                &self.gpu_zonal_redundancy_disabled,
14860            )?;
14861        }
14862        if !self.creator.is_empty() {
14863            state.serialize_entry("creator", &self.creator)?;
14864        }
14865        if !self.etag.is_empty() {
14866            state.serialize_entry("etag", &self.etag)?;
14867        }
14868        if !self._unknown_fields.is_empty() {
14869            for (key, value) in self._unknown_fields.iter() {
14870                state.serialize_entry(key, &value)?;
14871            }
14872        }
14873        state.end()
14874    }
14875}
14876
14877/// RevisionTemplate describes the data a revision should have when created from
14878/// a template.
14879#[derive(Clone, Debug, Default, PartialEq)]
14880#[non_exhaustive]
14881pub struct RevisionTemplate {
14882    /// Optional. The unique name for the revision. If this field is omitted, it
14883    /// will be automatically generated based on the Service name.
14884    pub revision: std::string::String,
14885
14886    /// Optional. Unstructured key value map that can be used to organize and
14887    /// categorize objects. User-provided labels are shared with Google's billing
14888    /// system, so they can be used to filter, or break down billing charges by
14889    /// team, component, environment, state, etc. For more information, visit
14890    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
14891    /// <https://cloud.google.com/run/docs/configuring/labels>.
14892    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14893
14894    /// Optional. Unstructured key value map that may be set by external tools to
14895    /// store and arbitrary metadata. They are not queryable and should be
14896    /// preserved when modifying objects.
14897    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
14898
14899    /// Optional. Scaling settings for this Revision.
14900    pub scaling: std::option::Option<crate::model::RevisionScaling>,
14901
14902    /// Optional. VPC Access configuration to use for this Revision. For more
14903    /// information, visit
14904    /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
14905    pub vpc_access: std::option::Option<crate::model::VpcAccess>,
14906
14907    /// Optional. Max allowed time for an instance to respond to a request.
14908    pub timeout: std::option::Option<wkt::Duration>,
14909
14910    /// Optional. Email address of the IAM service account associated with the
14911    /// revision of the service. The service account represents the identity of the
14912    /// running revision, and determines what permissions the revision has. If not
14913    /// provided, the revision will use the project's default service account.
14914    pub service_account: std::string::String,
14915
14916    /// Holds the single container that defines the unit of execution for this
14917    /// Revision.
14918    pub containers: std::vec::Vec<crate::model::Container>,
14919
14920    /// Optional. A list of Volumes to make available to containers.
14921    pub volumes: std::vec::Vec<crate::model::Volume>,
14922
14923    /// Optional. The sandbox environment to host this Revision.
14924    pub execution_environment: crate::model::ExecutionEnvironment,
14925
14926    /// A reference to a customer managed encryption key (CMEK) to use to encrypt
14927    /// this container image. For more information, go to
14928    /// <https://cloud.google.com/run/docs/securing/using-cmek>
14929    pub encryption_key: std::string::String,
14930
14931    /// Optional. Sets the maximum number of requests that each serving instance
14932    /// can receive. If not specified or 0, concurrency defaults to 80 when
14933    /// requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
14934    pub max_instance_request_concurrency: i32,
14935
14936    /// Optional. Enables service mesh connectivity.
14937    pub service_mesh: std::option::Option<crate::model::ServiceMesh>,
14938
14939    /// Optional. The action to take if the encryption key is revoked.
14940    pub encryption_key_revocation_action: crate::model::EncryptionKeyRevocationAction,
14941
14942    /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration
14943    /// before shutting down all instances. The minimum increment is 1 hour.
14944    pub encryption_key_shutdown_duration: std::option::Option<wkt::Duration>,
14945
14946    /// Optional. Enable session affinity.
14947    pub session_affinity: bool,
14948
14949    /// Optional. Disables health checking containers during deployment.
14950    pub health_check_disabled: bool,
14951
14952    /// Optional. The node selector for the revision template.
14953    pub node_selector: std::option::Option<crate::model::NodeSelector>,
14954
14955    /// Optional. True if GPU zonal redundancy is disabled on this revision.
14956    pub gpu_zonal_redundancy_disabled: std::option::Option<bool>,
14957
14958    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14959}
14960
14961impl RevisionTemplate {
14962    pub fn new() -> Self {
14963        std::default::Default::default()
14964    }
14965
14966    /// Sets the value of [revision][crate::model::RevisionTemplate::revision].
14967    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14968        self.revision = v.into();
14969        self
14970    }
14971
14972    /// Sets the value of [labels][crate::model::RevisionTemplate::labels].
14973    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14974    where
14975        T: std::iter::IntoIterator<Item = (K, V)>,
14976        K: std::convert::Into<std::string::String>,
14977        V: std::convert::Into<std::string::String>,
14978    {
14979        use std::iter::Iterator;
14980        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14981        self
14982    }
14983
14984    /// Sets the value of [annotations][crate::model::RevisionTemplate::annotations].
14985    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
14986    where
14987        T: std::iter::IntoIterator<Item = (K, V)>,
14988        K: std::convert::Into<std::string::String>,
14989        V: std::convert::Into<std::string::String>,
14990    {
14991        use std::iter::Iterator;
14992        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14993        self
14994    }
14995
14996    /// Sets the value of [scaling][crate::model::RevisionTemplate::scaling].
14997    pub fn set_scaling<T>(mut self, v: T) -> Self
14998    where
14999        T: std::convert::Into<crate::model::RevisionScaling>,
15000    {
15001        self.scaling = std::option::Option::Some(v.into());
15002        self
15003    }
15004
15005    /// Sets or clears the value of [scaling][crate::model::RevisionTemplate::scaling].
15006    pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
15007    where
15008        T: std::convert::Into<crate::model::RevisionScaling>,
15009    {
15010        self.scaling = v.map(|x| x.into());
15011        self
15012    }
15013
15014    /// Sets the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
15015    pub fn set_vpc_access<T>(mut self, v: T) -> Self
15016    where
15017        T: std::convert::Into<crate::model::VpcAccess>,
15018    {
15019        self.vpc_access = std::option::Option::Some(v.into());
15020        self
15021    }
15022
15023    /// Sets or clears the value of [vpc_access][crate::model::RevisionTemplate::vpc_access].
15024    pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
15025    where
15026        T: std::convert::Into<crate::model::VpcAccess>,
15027    {
15028        self.vpc_access = v.map(|x| x.into());
15029        self
15030    }
15031
15032    /// Sets the value of [timeout][crate::model::RevisionTemplate::timeout].
15033    pub fn set_timeout<T>(mut self, v: T) -> Self
15034    where
15035        T: std::convert::Into<wkt::Duration>,
15036    {
15037        self.timeout = std::option::Option::Some(v.into());
15038        self
15039    }
15040
15041    /// Sets or clears the value of [timeout][crate::model::RevisionTemplate::timeout].
15042    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
15043    where
15044        T: std::convert::Into<wkt::Duration>,
15045    {
15046        self.timeout = v.map(|x| x.into());
15047        self
15048    }
15049
15050    /// Sets the value of [service_account][crate::model::RevisionTemplate::service_account].
15051    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15052        self.service_account = v.into();
15053        self
15054    }
15055
15056    /// Sets the value of [containers][crate::model::RevisionTemplate::containers].
15057    pub fn set_containers<T, V>(mut self, v: T) -> Self
15058    where
15059        T: std::iter::IntoIterator<Item = V>,
15060        V: std::convert::Into<crate::model::Container>,
15061    {
15062        use std::iter::Iterator;
15063        self.containers = v.into_iter().map(|i| i.into()).collect();
15064        self
15065    }
15066
15067    /// Sets the value of [volumes][crate::model::RevisionTemplate::volumes].
15068    pub fn set_volumes<T, V>(mut self, v: T) -> Self
15069    where
15070        T: std::iter::IntoIterator<Item = V>,
15071        V: std::convert::Into<crate::model::Volume>,
15072    {
15073        use std::iter::Iterator;
15074        self.volumes = v.into_iter().map(|i| i.into()).collect();
15075        self
15076    }
15077
15078    /// Sets the value of [execution_environment][crate::model::RevisionTemplate::execution_environment].
15079    pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
15080        mut self,
15081        v: T,
15082    ) -> Self {
15083        self.execution_environment = v.into();
15084        self
15085    }
15086
15087    /// Sets the value of [encryption_key][crate::model::RevisionTemplate::encryption_key].
15088    pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15089        self.encryption_key = v.into();
15090        self
15091    }
15092
15093    /// Sets the value of [max_instance_request_concurrency][crate::model::RevisionTemplate::max_instance_request_concurrency].
15094    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
15095        mut self,
15096        v: T,
15097    ) -> Self {
15098        self.max_instance_request_concurrency = v.into();
15099        self
15100    }
15101
15102    /// Sets the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
15103    pub fn set_service_mesh<T>(mut self, v: T) -> Self
15104    where
15105        T: std::convert::Into<crate::model::ServiceMesh>,
15106    {
15107        self.service_mesh = std::option::Option::Some(v.into());
15108        self
15109    }
15110
15111    /// Sets or clears the value of [service_mesh][crate::model::RevisionTemplate::service_mesh].
15112    pub fn set_or_clear_service_mesh<T>(mut self, v: std::option::Option<T>) -> Self
15113    where
15114        T: std::convert::Into<crate::model::ServiceMesh>,
15115    {
15116        self.service_mesh = v.map(|x| x.into());
15117        self
15118    }
15119
15120    /// Sets the value of [encryption_key_revocation_action][crate::model::RevisionTemplate::encryption_key_revocation_action].
15121    pub fn set_encryption_key_revocation_action<
15122        T: std::convert::Into<crate::model::EncryptionKeyRevocationAction>,
15123    >(
15124        mut self,
15125        v: T,
15126    ) -> Self {
15127        self.encryption_key_revocation_action = v.into();
15128        self
15129    }
15130
15131    /// Sets the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
15132    pub fn set_encryption_key_shutdown_duration<T>(mut self, v: T) -> Self
15133    where
15134        T: std::convert::Into<wkt::Duration>,
15135    {
15136        self.encryption_key_shutdown_duration = std::option::Option::Some(v.into());
15137        self
15138    }
15139
15140    /// Sets or clears the value of [encryption_key_shutdown_duration][crate::model::RevisionTemplate::encryption_key_shutdown_duration].
15141    pub fn set_or_clear_encryption_key_shutdown_duration<T>(
15142        mut self,
15143        v: std::option::Option<T>,
15144    ) -> Self
15145    where
15146        T: std::convert::Into<wkt::Duration>,
15147    {
15148        self.encryption_key_shutdown_duration = v.map(|x| x.into());
15149        self
15150    }
15151
15152    /// Sets the value of [session_affinity][crate::model::RevisionTemplate::session_affinity].
15153    pub fn set_session_affinity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15154        self.session_affinity = v.into();
15155        self
15156    }
15157
15158    /// Sets the value of [health_check_disabled][crate::model::RevisionTemplate::health_check_disabled].
15159    pub fn set_health_check_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15160        self.health_check_disabled = v.into();
15161        self
15162    }
15163
15164    /// Sets the value of [node_selector][crate::model::RevisionTemplate::node_selector].
15165    pub fn set_node_selector<T>(mut self, v: T) -> Self
15166    where
15167        T: std::convert::Into<crate::model::NodeSelector>,
15168    {
15169        self.node_selector = std::option::Option::Some(v.into());
15170        self
15171    }
15172
15173    /// Sets or clears the value of [node_selector][crate::model::RevisionTemplate::node_selector].
15174    pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
15175    where
15176        T: std::convert::Into<crate::model::NodeSelector>,
15177    {
15178        self.node_selector = v.map(|x| x.into());
15179        self
15180    }
15181
15182    /// Sets the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
15183    pub fn set_gpu_zonal_redundancy_disabled<T>(mut self, v: T) -> Self
15184    where
15185        T: std::convert::Into<bool>,
15186    {
15187        self.gpu_zonal_redundancy_disabled = std::option::Option::Some(v.into());
15188        self
15189    }
15190
15191    /// Sets or clears the value of [gpu_zonal_redundancy_disabled][crate::model::RevisionTemplate::gpu_zonal_redundancy_disabled].
15192    pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(
15193        mut self,
15194        v: std::option::Option<T>,
15195    ) -> Self
15196    where
15197        T: std::convert::Into<bool>,
15198    {
15199        self.gpu_zonal_redundancy_disabled = v.map(|x| x.into());
15200        self
15201    }
15202}
15203
15204impl wkt::message::Message for RevisionTemplate {
15205    fn typename() -> &'static str {
15206        "type.googleapis.com/google.cloud.run.v2.RevisionTemplate"
15207    }
15208}
15209
15210#[doc(hidden)]
15211impl<'de> serde::de::Deserialize<'de> for RevisionTemplate {
15212    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15213    where
15214        D: serde::Deserializer<'de>,
15215    {
15216        #[allow(non_camel_case_types)]
15217        #[doc(hidden)]
15218        #[derive(PartialEq, Eq, Hash)]
15219        enum __FieldTag {
15220            __revision,
15221            __labels,
15222            __annotations,
15223            __scaling,
15224            __vpc_access,
15225            __timeout,
15226            __service_account,
15227            __containers,
15228            __volumes,
15229            __execution_environment,
15230            __encryption_key,
15231            __max_instance_request_concurrency,
15232            __service_mesh,
15233            __encryption_key_revocation_action,
15234            __encryption_key_shutdown_duration,
15235            __session_affinity,
15236            __health_check_disabled,
15237            __node_selector,
15238            __gpu_zonal_redundancy_disabled,
15239            Unknown(std::string::String),
15240        }
15241        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15242            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15243            where
15244                D: serde::Deserializer<'de>,
15245            {
15246                struct Visitor;
15247                impl<'de> serde::de::Visitor<'de> for Visitor {
15248                    type Value = __FieldTag;
15249                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15250                        formatter.write_str("a field name for RevisionTemplate")
15251                    }
15252                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15253                    where
15254                        E: serde::de::Error,
15255                    {
15256                        use std::result::Result::Ok;
15257                        use std::string::ToString;
15258                        match value {
15259                            "revision" => Ok(__FieldTag::__revision),
15260                            "labels" => Ok(__FieldTag::__labels),
15261                            "annotations" => Ok(__FieldTag::__annotations),
15262                            "scaling" => Ok(__FieldTag::__scaling),
15263                            "vpcAccess" => Ok(__FieldTag::__vpc_access),
15264                            "vpc_access" => Ok(__FieldTag::__vpc_access),
15265                            "timeout" => Ok(__FieldTag::__timeout),
15266                            "serviceAccount" => Ok(__FieldTag::__service_account),
15267                            "service_account" => Ok(__FieldTag::__service_account),
15268                            "containers" => Ok(__FieldTag::__containers),
15269                            "volumes" => Ok(__FieldTag::__volumes),
15270                            "executionEnvironment" => Ok(__FieldTag::__execution_environment),
15271                            "execution_environment" => Ok(__FieldTag::__execution_environment),
15272                            "encryptionKey" => Ok(__FieldTag::__encryption_key),
15273                            "encryption_key" => Ok(__FieldTag::__encryption_key),
15274                            "maxInstanceRequestConcurrency" => {
15275                                Ok(__FieldTag::__max_instance_request_concurrency)
15276                            }
15277                            "max_instance_request_concurrency" => {
15278                                Ok(__FieldTag::__max_instance_request_concurrency)
15279                            }
15280                            "serviceMesh" => Ok(__FieldTag::__service_mesh),
15281                            "service_mesh" => Ok(__FieldTag::__service_mesh),
15282                            "encryptionKeyRevocationAction" => {
15283                                Ok(__FieldTag::__encryption_key_revocation_action)
15284                            }
15285                            "encryption_key_revocation_action" => {
15286                                Ok(__FieldTag::__encryption_key_revocation_action)
15287                            }
15288                            "encryptionKeyShutdownDuration" => {
15289                                Ok(__FieldTag::__encryption_key_shutdown_duration)
15290                            }
15291                            "encryption_key_shutdown_duration" => {
15292                                Ok(__FieldTag::__encryption_key_shutdown_duration)
15293                            }
15294                            "sessionAffinity" => Ok(__FieldTag::__session_affinity),
15295                            "session_affinity" => Ok(__FieldTag::__session_affinity),
15296                            "healthCheckDisabled" => Ok(__FieldTag::__health_check_disabled),
15297                            "health_check_disabled" => Ok(__FieldTag::__health_check_disabled),
15298                            "nodeSelector" => Ok(__FieldTag::__node_selector),
15299                            "node_selector" => Ok(__FieldTag::__node_selector),
15300                            "gpuZonalRedundancyDisabled" => {
15301                                Ok(__FieldTag::__gpu_zonal_redundancy_disabled)
15302                            }
15303                            "gpu_zonal_redundancy_disabled" => {
15304                                Ok(__FieldTag::__gpu_zonal_redundancy_disabled)
15305                            }
15306                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15307                        }
15308                    }
15309                }
15310                deserializer.deserialize_identifier(Visitor)
15311            }
15312        }
15313        struct Visitor;
15314        impl<'de> serde::de::Visitor<'de> for Visitor {
15315            type Value = RevisionTemplate;
15316            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15317                formatter.write_str("struct RevisionTemplate")
15318            }
15319            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15320            where
15321                A: serde::de::MapAccess<'de>,
15322            {
15323                #[allow(unused_imports)]
15324                use serde::de::Error;
15325                use std::option::Option::Some;
15326                let mut fields = std::collections::HashSet::new();
15327                let mut result = Self::Value::new();
15328                while let Some(tag) = map.next_key::<__FieldTag>()? {
15329                    #[allow(clippy::match_single_binding)]
15330                    match tag {
15331                        __FieldTag::__revision => {
15332                            if !fields.insert(__FieldTag::__revision) {
15333                                return std::result::Result::Err(A::Error::duplicate_field(
15334                                    "multiple values for revision",
15335                                ));
15336                            }
15337                            result.revision = map
15338                                .next_value::<std::option::Option<std::string::String>>()?
15339                                .unwrap_or_default();
15340                        }
15341                        __FieldTag::__labels => {
15342                            if !fields.insert(__FieldTag::__labels) {
15343                                return std::result::Result::Err(A::Error::duplicate_field(
15344                                    "multiple values for labels",
15345                                ));
15346                            }
15347                            result.labels = map
15348                                .next_value::<std::option::Option<
15349                                    std::collections::HashMap<
15350                                        std::string::String,
15351                                        std::string::String,
15352                                    >,
15353                                >>()?
15354                                .unwrap_or_default();
15355                        }
15356                        __FieldTag::__annotations => {
15357                            if !fields.insert(__FieldTag::__annotations) {
15358                                return std::result::Result::Err(A::Error::duplicate_field(
15359                                    "multiple values for annotations",
15360                                ));
15361                            }
15362                            result.annotations = map
15363                                .next_value::<std::option::Option<
15364                                    std::collections::HashMap<
15365                                        std::string::String,
15366                                        std::string::String,
15367                                    >,
15368                                >>()?
15369                                .unwrap_or_default();
15370                        }
15371                        __FieldTag::__scaling => {
15372                            if !fields.insert(__FieldTag::__scaling) {
15373                                return std::result::Result::Err(A::Error::duplicate_field(
15374                                    "multiple values for scaling",
15375                                ));
15376                            }
15377                            result.scaling = map
15378                                .next_value::<std::option::Option<crate::model::RevisionScaling>>(
15379                                )?;
15380                        }
15381                        __FieldTag::__vpc_access => {
15382                            if !fields.insert(__FieldTag::__vpc_access) {
15383                                return std::result::Result::Err(A::Error::duplicate_field(
15384                                    "multiple values for vpc_access",
15385                                ));
15386                            }
15387                            result.vpc_access =
15388                                map.next_value::<std::option::Option<crate::model::VpcAccess>>()?;
15389                        }
15390                        __FieldTag::__timeout => {
15391                            if !fields.insert(__FieldTag::__timeout) {
15392                                return std::result::Result::Err(A::Error::duplicate_field(
15393                                    "multiple values for timeout",
15394                                ));
15395                            }
15396                            result.timeout =
15397                                map.next_value::<std::option::Option<wkt::Duration>>()?;
15398                        }
15399                        __FieldTag::__service_account => {
15400                            if !fields.insert(__FieldTag::__service_account) {
15401                                return std::result::Result::Err(A::Error::duplicate_field(
15402                                    "multiple values for service_account",
15403                                ));
15404                            }
15405                            result.service_account = map
15406                                .next_value::<std::option::Option<std::string::String>>()?
15407                                .unwrap_or_default();
15408                        }
15409                        __FieldTag::__containers => {
15410                            if !fields.insert(__FieldTag::__containers) {
15411                                return std::result::Result::Err(A::Error::duplicate_field(
15412                                    "multiple values for containers",
15413                                ));
15414                            }
15415                            result.containers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Container>>>()?.unwrap_or_default();
15416                        }
15417                        __FieldTag::__volumes => {
15418                            if !fields.insert(__FieldTag::__volumes) {
15419                                return std::result::Result::Err(A::Error::duplicate_field(
15420                                    "multiple values for volumes",
15421                                ));
15422                            }
15423                            result.volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Volume>>>()?.unwrap_or_default();
15424                        }
15425                        __FieldTag::__execution_environment => {
15426                            if !fields.insert(__FieldTag::__execution_environment) {
15427                                return std::result::Result::Err(A::Error::duplicate_field(
15428                                    "multiple values for execution_environment",
15429                                ));
15430                            }
15431                            result.execution_environment = map.next_value::<std::option::Option<crate::model::ExecutionEnvironment>>()?.unwrap_or_default();
15432                        }
15433                        __FieldTag::__encryption_key => {
15434                            if !fields.insert(__FieldTag::__encryption_key) {
15435                                return std::result::Result::Err(A::Error::duplicate_field(
15436                                    "multiple values for encryption_key",
15437                                ));
15438                            }
15439                            result.encryption_key = map
15440                                .next_value::<std::option::Option<std::string::String>>()?
15441                                .unwrap_or_default();
15442                        }
15443                        __FieldTag::__max_instance_request_concurrency => {
15444                            if !fields.insert(__FieldTag::__max_instance_request_concurrency) {
15445                                return std::result::Result::Err(A::Error::duplicate_field(
15446                                    "multiple values for max_instance_request_concurrency",
15447                                ));
15448                            }
15449                            struct __With(std::option::Option<i32>);
15450                            impl<'de> serde::de::Deserialize<'de> for __With {
15451                                fn deserialize<D>(
15452                                    deserializer: D,
15453                                ) -> std::result::Result<Self, D::Error>
15454                                where
15455                                    D: serde::de::Deserializer<'de>,
15456                                {
15457                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
15458                                }
15459                            }
15460                            result.max_instance_request_concurrency =
15461                                map.next_value::<__With>()?.0.unwrap_or_default();
15462                        }
15463                        __FieldTag::__service_mesh => {
15464                            if !fields.insert(__FieldTag::__service_mesh) {
15465                                return std::result::Result::Err(A::Error::duplicate_field(
15466                                    "multiple values for service_mesh",
15467                                ));
15468                            }
15469                            result.service_mesh =
15470                                map.next_value::<std::option::Option<crate::model::ServiceMesh>>()?;
15471                        }
15472                        __FieldTag::__encryption_key_revocation_action => {
15473                            if !fields.insert(__FieldTag::__encryption_key_revocation_action) {
15474                                return std::result::Result::Err(A::Error::duplicate_field(
15475                                    "multiple values for encryption_key_revocation_action",
15476                                ));
15477                            }
15478                            result.encryption_key_revocation_action =
15479                                map.next_value::<std::option::Option<
15480                                    crate::model::EncryptionKeyRevocationAction,
15481                                >>()?
15482                                .unwrap_or_default();
15483                        }
15484                        __FieldTag::__encryption_key_shutdown_duration => {
15485                            if !fields.insert(__FieldTag::__encryption_key_shutdown_duration) {
15486                                return std::result::Result::Err(A::Error::duplicate_field(
15487                                    "multiple values for encryption_key_shutdown_duration",
15488                                ));
15489                            }
15490                            result.encryption_key_shutdown_duration =
15491                                map.next_value::<std::option::Option<wkt::Duration>>()?;
15492                        }
15493                        __FieldTag::__session_affinity => {
15494                            if !fields.insert(__FieldTag::__session_affinity) {
15495                                return std::result::Result::Err(A::Error::duplicate_field(
15496                                    "multiple values for session_affinity",
15497                                ));
15498                            }
15499                            result.session_affinity = map
15500                                .next_value::<std::option::Option<bool>>()?
15501                                .unwrap_or_default();
15502                        }
15503                        __FieldTag::__health_check_disabled => {
15504                            if !fields.insert(__FieldTag::__health_check_disabled) {
15505                                return std::result::Result::Err(A::Error::duplicate_field(
15506                                    "multiple values for health_check_disabled",
15507                                ));
15508                            }
15509                            result.health_check_disabled = map
15510                                .next_value::<std::option::Option<bool>>()?
15511                                .unwrap_or_default();
15512                        }
15513                        __FieldTag::__node_selector => {
15514                            if !fields.insert(__FieldTag::__node_selector) {
15515                                return std::result::Result::Err(A::Error::duplicate_field(
15516                                    "multiple values for node_selector",
15517                                ));
15518                            }
15519                            result.node_selector = map
15520                                .next_value::<std::option::Option<crate::model::NodeSelector>>()?;
15521                        }
15522                        __FieldTag::__gpu_zonal_redundancy_disabled => {
15523                            if !fields.insert(__FieldTag::__gpu_zonal_redundancy_disabled) {
15524                                return std::result::Result::Err(A::Error::duplicate_field(
15525                                    "multiple values for gpu_zonal_redundancy_disabled",
15526                                ));
15527                            }
15528                            result.gpu_zonal_redundancy_disabled =
15529                                map.next_value::<std::option::Option<bool>>()?;
15530                        }
15531                        __FieldTag::Unknown(key) => {
15532                            let value = map.next_value::<serde_json::Value>()?;
15533                            result._unknown_fields.insert(key, value);
15534                        }
15535                    }
15536                }
15537                std::result::Result::Ok(result)
15538            }
15539        }
15540        deserializer.deserialize_any(Visitor)
15541    }
15542}
15543
15544#[doc(hidden)]
15545impl serde::ser::Serialize for RevisionTemplate {
15546    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15547    where
15548        S: serde::ser::Serializer,
15549    {
15550        use serde::ser::SerializeMap;
15551        #[allow(unused_imports)]
15552        use std::option::Option::Some;
15553        let mut state = serializer.serialize_map(std::option::Option::None)?;
15554        if !self.revision.is_empty() {
15555            state.serialize_entry("revision", &self.revision)?;
15556        }
15557        if !self.labels.is_empty() {
15558            state.serialize_entry("labels", &self.labels)?;
15559        }
15560        if !self.annotations.is_empty() {
15561            state.serialize_entry("annotations", &self.annotations)?;
15562        }
15563        if self.scaling.is_some() {
15564            state.serialize_entry("scaling", &self.scaling)?;
15565        }
15566        if self.vpc_access.is_some() {
15567            state.serialize_entry("vpcAccess", &self.vpc_access)?;
15568        }
15569        if self.timeout.is_some() {
15570            state.serialize_entry("timeout", &self.timeout)?;
15571        }
15572        if !self.service_account.is_empty() {
15573            state.serialize_entry("serviceAccount", &self.service_account)?;
15574        }
15575        if !self.containers.is_empty() {
15576            state.serialize_entry("containers", &self.containers)?;
15577        }
15578        if !self.volumes.is_empty() {
15579            state.serialize_entry("volumes", &self.volumes)?;
15580        }
15581        if !wkt::internal::is_default(&self.execution_environment) {
15582            state.serialize_entry("executionEnvironment", &self.execution_environment)?;
15583        }
15584        if !self.encryption_key.is_empty() {
15585            state.serialize_entry("encryptionKey", &self.encryption_key)?;
15586        }
15587        if !wkt::internal::is_default(&self.max_instance_request_concurrency) {
15588            struct __With<'a>(&'a i32);
15589            impl<'a> serde::ser::Serialize for __With<'a> {
15590                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15591                where
15592                    S: serde::ser::Serializer,
15593                {
15594                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
15595                }
15596            }
15597            state.serialize_entry(
15598                "maxInstanceRequestConcurrency",
15599                &__With(&self.max_instance_request_concurrency),
15600            )?;
15601        }
15602        if self.service_mesh.is_some() {
15603            state.serialize_entry("serviceMesh", &self.service_mesh)?;
15604        }
15605        if !wkt::internal::is_default(&self.encryption_key_revocation_action) {
15606            state.serialize_entry(
15607                "encryptionKeyRevocationAction",
15608                &self.encryption_key_revocation_action,
15609            )?;
15610        }
15611        if self.encryption_key_shutdown_duration.is_some() {
15612            state.serialize_entry(
15613                "encryptionKeyShutdownDuration",
15614                &self.encryption_key_shutdown_duration,
15615            )?;
15616        }
15617        if !wkt::internal::is_default(&self.session_affinity) {
15618            state.serialize_entry("sessionAffinity", &self.session_affinity)?;
15619        }
15620        if !wkt::internal::is_default(&self.health_check_disabled) {
15621            state.serialize_entry("healthCheckDisabled", &self.health_check_disabled)?;
15622        }
15623        if self.node_selector.is_some() {
15624            state.serialize_entry("nodeSelector", &self.node_selector)?;
15625        }
15626        if self.gpu_zonal_redundancy_disabled.is_some() {
15627            state.serialize_entry(
15628                "gpuZonalRedundancyDisabled",
15629                &self.gpu_zonal_redundancy_disabled,
15630            )?;
15631        }
15632        if !self._unknown_fields.is_empty() {
15633            for (key, value) in self._unknown_fields.iter() {
15634                state.serialize_entry(key, &value)?;
15635            }
15636        }
15637        state.end()
15638    }
15639}
15640
15641/// Request message for creating a Service.
15642#[derive(Clone, Debug, Default, PartialEq)]
15643#[non_exhaustive]
15644pub struct CreateServiceRequest {
15645    /// Required. The location and project in which this service should be created.
15646    /// Format: projects/{project}/locations/{location}, where {project} can be
15647    /// project id or number. Only lowercase characters, digits, and hyphens.
15648    pub parent: std::string::String,
15649
15650    /// Required. The Service instance to create.
15651    pub service: std::option::Option<crate::model::Service>,
15652
15653    /// Required. The unique identifier for the Service. It must begin with letter,
15654    /// and cannot end with hyphen; must contain fewer than 50 characters.
15655    /// The name of the service becomes {parent}/services/{service_id}.
15656    pub service_id: std::string::String,
15657
15658    /// Indicates that the request should be validated and default values
15659    /// populated, without persisting the request or creating any resources.
15660    pub validate_only: bool,
15661
15662    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15663}
15664
15665impl CreateServiceRequest {
15666    pub fn new() -> Self {
15667        std::default::Default::default()
15668    }
15669
15670    /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
15671    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15672        self.parent = v.into();
15673        self
15674    }
15675
15676    /// Sets the value of [service][crate::model::CreateServiceRequest::service].
15677    pub fn set_service<T>(mut self, v: T) -> Self
15678    where
15679        T: std::convert::Into<crate::model::Service>,
15680    {
15681        self.service = std::option::Option::Some(v.into());
15682        self
15683    }
15684
15685    /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
15686    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
15687    where
15688        T: std::convert::Into<crate::model::Service>,
15689    {
15690        self.service = v.map(|x| x.into());
15691        self
15692    }
15693
15694    /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
15695    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15696        self.service_id = v.into();
15697        self
15698    }
15699
15700    /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
15701    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15702        self.validate_only = v.into();
15703        self
15704    }
15705}
15706
15707impl wkt::message::Message for CreateServiceRequest {
15708    fn typename() -> &'static str {
15709        "type.googleapis.com/google.cloud.run.v2.CreateServiceRequest"
15710    }
15711}
15712
15713#[doc(hidden)]
15714impl<'de> serde::de::Deserialize<'de> for CreateServiceRequest {
15715    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15716    where
15717        D: serde::Deserializer<'de>,
15718    {
15719        #[allow(non_camel_case_types)]
15720        #[doc(hidden)]
15721        #[derive(PartialEq, Eq, Hash)]
15722        enum __FieldTag {
15723            __parent,
15724            __service,
15725            __service_id,
15726            __validate_only,
15727            Unknown(std::string::String),
15728        }
15729        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15730            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15731            where
15732                D: serde::Deserializer<'de>,
15733            {
15734                struct Visitor;
15735                impl<'de> serde::de::Visitor<'de> for Visitor {
15736                    type Value = __FieldTag;
15737                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15738                        formatter.write_str("a field name for CreateServiceRequest")
15739                    }
15740                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15741                    where
15742                        E: serde::de::Error,
15743                    {
15744                        use std::result::Result::Ok;
15745                        use std::string::ToString;
15746                        match value {
15747                            "parent" => Ok(__FieldTag::__parent),
15748                            "service" => Ok(__FieldTag::__service),
15749                            "serviceId" => Ok(__FieldTag::__service_id),
15750                            "service_id" => Ok(__FieldTag::__service_id),
15751                            "validateOnly" => Ok(__FieldTag::__validate_only),
15752                            "validate_only" => Ok(__FieldTag::__validate_only),
15753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15754                        }
15755                    }
15756                }
15757                deserializer.deserialize_identifier(Visitor)
15758            }
15759        }
15760        struct Visitor;
15761        impl<'de> serde::de::Visitor<'de> for Visitor {
15762            type Value = CreateServiceRequest;
15763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15764                formatter.write_str("struct CreateServiceRequest")
15765            }
15766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15767            where
15768                A: serde::de::MapAccess<'de>,
15769            {
15770                #[allow(unused_imports)]
15771                use serde::de::Error;
15772                use std::option::Option::Some;
15773                let mut fields = std::collections::HashSet::new();
15774                let mut result = Self::Value::new();
15775                while let Some(tag) = map.next_key::<__FieldTag>()? {
15776                    #[allow(clippy::match_single_binding)]
15777                    match tag {
15778                        __FieldTag::__parent => {
15779                            if !fields.insert(__FieldTag::__parent) {
15780                                return std::result::Result::Err(A::Error::duplicate_field(
15781                                    "multiple values for parent",
15782                                ));
15783                            }
15784                            result.parent = map
15785                                .next_value::<std::option::Option<std::string::String>>()?
15786                                .unwrap_or_default();
15787                        }
15788                        __FieldTag::__service => {
15789                            if !fields.insert(__FieldTag::__service) {
15790                                return std::result::Result::Err(A::Error::duplicate_field(
15791                                    "multiple values for service",
15792                                ));
15793                            }
15794                            result.service =
15795                                map.next_value::<std::option::Option<crate::model::Service>>()?;
15796                        }
15797                        __FieldTag::__service_id => {
15798                            if !fields.insert(__FieldTag::__service_id) {
15799                                return std::result::Result::Err(A::Error::duplicate_field(
15800                                    "multiple values for service_id",
15801                                ));
15802                            }
15803                            result.service_id = map
15804                                .next_value::<std::option::Option<std::string::String>>()?
15805                                .unwrap_or_default();
15806                        }
15807                        __FieldTag::__validate_only => {
15808                            if !fields.insert(__FieldTag::__validate_only) {
15809                                return std::result::Result::Err(A::Error::duplicate_field(
15810                                    "multiple values for validate_only",
15811                                ));
15812                            }
15813                            result.validate_only = map
15814                                .next_value::<std::option::Option<bool>>()?
15815                                .unwrap_or_default();
15816                        }
15817                        __FieldTag::Unknown(key) => {
15818                            let value = map.next_value::<serde_json::Value>()?;
15819                            result._unknown_fields.insert(key, value);
15820                        }
15821                    }
15822                }
15823                std::result::Result::Ok(result)
15824            }
15825        }
15826        deserializer.deserialize_any(Visitor)
15827    }
15828}
15829
15830#[doc(hidden)]
15831impl serde::ser::Serialize for CreateServiceRequest {
15832    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15833    where
15834        S: serde::ser::Serializer,
15835    {
15836        use serde::ser::SerializeMap;
15837        #[allow(unused_imports)]
15838        use std::option::Option::Some;
15839        let mut state = serializer.serialize_map(std::option::Option::None)?;
15840        if !self.parent.is_empty() {
15841            state.serialize_entry("parent", &self.parent)?;
15842        }
15843        if self.service.is_some() {
15844            state.serialize_entry("service", &self.service)?;
15845        }
15846        if !self.service_id.is_empty() {
15847            state.serialize_entry("serviceId", &self.service_id)?;
15848        }
15849        if !wkt::internal::is_default(&self.validate_only) {
15850            state.serialize_entry("validateOnly", &self.validate_only)?;
15851        }
15852        if !self._unknown_fields.is_empty() {
15853            for (key, value) in self._unknown_fields.iter() {
15854                state.serialize_entry(key, &value)?;
15855            }
15856        }
15857        state.end()
15858    }
15859}
15860
15861/// Request message for updating a service.
15862#[derive(Clone, Debug, Default, PartialEq)]
15863#[non_exhaustive]
15864pub struct UpdateServiceRequest {
15865    /// Optional. The list of fields to be updated.
15866    pub update_mask: std::option::Option<wkt::FieldMask>,
15867
15868    /// Required. The Service to be updated.
15869    pub service: std::option::Option<crate::model::Service>,
15870
15871    /// Indicates that the request should be validated and default values
15872    /// populated, without persisting the request or updating any resources.
15873    pub validate_only: bool,
15874
15875    /// Optional. If set to true, and if the Service does not exist, it will create
15876    /// a new one. The caller must have 'run.services.create' permissions if this
15877    /// is set to true and the Service does not exist.
15878    pub allow_missing: bool,
15879
15880    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15881}
15882
15883impl UpdateServiceRequest {
15884    pub fn new() -> Self {
15885        std::default::Default::default()
15886    }
15887
15888    /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
15889    pub fn set_update_mask<T>(mut self, v: T) -> Self
15890    where
15891        T: std::convert::Into<wkt::FieldMask>,
15892    {
15893        self.update_mask = std::option::Option::Some(v.into());
15894        self
15895    }
15896
15897    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
15898    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15899    where
15900        T: std::convert::Into<wkt::FieldMask>,
15901    {
15902        self.update_mask = v.map(|x| x.into());
15903        self
15904    }
15905
15906    /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
15907    pub fn set_service<T>(mut self, v: T) -> Self
15908    where
15909        T: std::convert::Into<crate::model::Service>,
15910    {
15911        self.service = std::option::Option::Some(v.into());
15912        self
15913    }
15914
15915    /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
15916    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
15917    where
15918        T: std::convert::Into<crate::model::Service>,
15919    {
15920        self.service = v.map(|x| x.into());
15921        self
15922    }
15923
15924    /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
15925    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15926        self.validate_only = v.into();
15927        self
15928    }
15929
15930    /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
15931    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15932        self.allow_missing = v.into();
15933        self
15934    }
15935}
15936
15937impl wkt::message::Message for UpdateServiceRequest {
15938    fn typename() -> &'static str {
15939        "type.googleapis.com/google.cloud.run.v2.UpdateServiceRequest"
15940    }
15941}
15942
15943#[doc(hidden)]
15944impl<'de> serde::de::Deserialize<'de> for UpdateServiceRequest {
15945    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15946    where
15947        D: serde::Deserializer<'de>,
15948    {
15949        #[allow(non_camel_case_types)]
15950        #[doc(hidden)]
15951        #[derive(PartialEq, Eq, Hash)]
15952        enum __FieldTag {
15953            __update_mask,
15954            __service,
15955            __validate_only,
15956            __allow_missing,
15957            Unknown(std::string::String),
15958        }
15959        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15960            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15961            where
15962                D: serde::Deserializer<'de>,
15963            {
15964                struct Visitor;
15965                impl<'de> serde::de::Visitor<'de> for Visitor {
15966                    type Value = __FieldTag;
15967                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15968                        formatter.write_str("a field name for UpdateServiceRequest")
15969                    }
15970                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15971                    where
15972                        E: serde::de::Error,
15973                    {
15974                        use std::result::Result::Ok;
15975                        use std::string::ToString;
15976                        match value {
15977                            "updateMask" => Ok(__FieldTag::__update_mask),
15978                            "update_mask" => Ok(__FieldTag::__update_mask),
15979                            "service" => Ok(__FieldTag::__service),
15980                            "validateOnly" => Ok(__FieldTag::__validate_only),
15981                            "validate_only" => Ok(__FieldTag::__validate_only),
15982                            "allowMissing" => Ok(__FieldTag::__allow_missing),
15983                            "allow_missing" => Ok(__FieldTag::__allow_missing),
15984                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15985                        }
15986                    }
15987                }
15988                deserializer.deserialize_identifier(Visitor)
15989            }
15990        }
15991        struct Visitor;
15992        impl<'de> serde::de::Visitor<'de> for Visitor {
15993            type Value = UpdateServiceRequest;
15994            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15995                formatter.write_str("struct UpdateServiceRequest")
15996            }
15997            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15998            where
15999                A: serde::de::MapAccess<'de>,
16000            {
16001                #[allow(unused_imports)]
16002                use serde::de::Error;
16003                use std::option::Option::Some;
16004                let mut fields = std::collections::HashSet::new();
16005                let mut result = Self::Value::new();
16006                while let Some(tag) = map.next_key::<__FieldTag>()? {
16007                    #[allow(clippy::match_single_binding)]
16008                    match tag {
16009                        __FieldTag::__update_mask => {
16010                            if !fields.insert(__FieldTag::__update_mask) {
16011                                return std::result::Result::Err(A::Error::duplicate_field(
16012                                    "multiple values for update_mask",
16013                                ));
16014                            }
16015                            result.update_mask =
16016                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
16017                        }
16018                        __FieldTag::__service => {
16019                            if !fields.insert(__FieldTag::__service) {
16020                                return std::result::Result::Err(A::Error::duplicate_field(
16021                                    "multiple values for service",
16022                                ));
16023                            }
16024                            result.service =
16025                                map.next_value::<std::option::Option<crate::model::Service>>()?;
16026                        }
16027                        __FieldTag::__validate_only => {
16028                            if !fields.insert(__FieldTag::__validate_only) {
16029                                return std::result::Result::Err(A::Error::duplicate_field(
16030                                    "multiple values for validate_only",
16031                                ));
16032                            }
16033                            result.validate_only = map
16034                                .next_value::<std::option::Option<bool>>()?
16035                                .unwrap_or_default();
16036                        }
16037                        __FieldTag::__allow_missing => {
16038                            if !fields.insert(__FieldTag::__allow_missing) {
16039                                return std::result::Result::Err(A::Error::duplicate_field(
16040                                    "multiple values for allow_missing",
16041                                ));
16042                            }
16043                            result.allow_missing = map
16044                                .next_value::<std::option::Option<bool>>()?
16045                                .unwrap_or_default();
16046                        }
16047                        __FieldTag::Unknown(key) => {
16048                            let value = map.next_value::<serde_json::Value>()?;
16049                            result._unknown_fields.insert(key, value);
16050                        }
16051                    }
16052                }
16053                std::result::Result::Ok(result)
16054            }
16055        }
16056        deserializer.deserialize_any(Visitor)
16057    }
16058}
16059
16060#[doc(hidden)]
16061impl serde::ser::Serialize for UpdateServiceRequest {
16062    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16063    where
16064        S: serde::ser::Serializer,
16065    {
16066        use serde::ser::SerializeMap;
16067        #[allow(unused_imports)]
16068        use std::option::Option::Some;
16069        let mut state = serializer.serialize_map(std::option::Option::None)?;
16070        if self.update_mask.is_some() {
16071            state.serialize_entry("updateMask", &self.update_mask)?;
16072        }
16073        if self.service.is_some() {
16074            state.serialize_entry("service", &self.service)?;
16075        }
16076        if !wkt::internal::is_default(&self.validate_only) {
16077            state.serialize_entry("validateOnly", &self.validate_only)?;
16078        }
16079        if !wkt::internal::is_default(&self.allow_missing) {
16080            state.serialize_entry("allowMissing", &self.allow_missing)?;
16081        }
16082        if !self._unknown_fields.is_empty() {
16083            for (key, value) in self._unknown_fields.iter() {
16084                state.serialize_entry(key, &value)?;
16085            }
16086        }
16087        state.end()
16088    }
16089}
16090
16091/// Request message for retrieving a list of Services.
16092#[derive(Clone, Debug, Default, PartialEq)]
16093#[non_exhaustive]
16094pub struct ListServicesRequest {
16095    /// Required. The location and project to list resources on.
16096    /// Location must be a valid Google Cloud region, and cannot be the "-"
16097    /// wildcard. Format: projects/{project}/locations/{location}, where {project}
16098    /// can be project id or number.
16099    pub parent: std::string::String,
16100
16101    /// Maximum number of Services to return in this call.
16102    pub page_size: i32,
16103
16104    /// A page token received from a previous call to ListServices.
16105    /// All other parameters must match.
16106    pub page_token: std::string::String,
16107
16108    /// If true, returns deleted (but unexpired) resources along with active ones.
16109    pub show_deleted: bool,
16110
16111    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16112}
16113
16114impl ListServicesRequest {
16115    pub fn new() -> Self {
16116        std::default::Default::default()
16117    }
16118
16119    /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
16120    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16121        self.parent = v.into();
16122        self
16123    }
16124
16125    /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
16126    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16127        self.page_size = v.into();
16128        self
16129    }
16130
16131    /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
16132    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16133        self.page_token = v.into();
16134        self
16135    }
16136
16137    /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
16138    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16139        self.show_deleted = v.into();
16140        self
16141    }
16142}
16143
16144impl wkt::message::Message for ListServicesRequest {
16145    fn typename() -> &'static str {
16146        "type.googleapis.com/google.cloud.run.v2.ListServicesRequest"
16147    }
16148}
16149
16150#[doc(hidden)]
16151impl<'de> serde::de::Deserialize<'de> for ListServicesRequest {
16152    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16153    where
16154        D: serde::Deserializer<'de>,
16155    {
16156        #[allow(non_camel_case_types)]
16157        #[doc(hidden)]
16158        #[derive(PartialEq, Eq, Hash)]
16159        enum __FieldTag {
16160            __parent,
16161            __page_size,
16162            __page_token,
16163            __show_deleted,
16164            Unknown(std::string::String),
16165        }
16166        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16167            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16168            where
16169                D: serde::Deserializer<'de>,
16170            {
16171                struct Visitor;
16172                impl<'de> serde::de::Visitor<'de> for Visitor {
16173                    type Value = __FieldTag;
16174                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16175                        formatter.write_str("a field name for ListServicesRequest")
16176                    }
16177                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16178                    where
16179                        E: serde::de::Error,
16180                    {
16181                        use std::result::Result::Ok;
16182                        use std::string::ToString;
16183                        match value {
16184                            "parent" => Ok(__FieldTag::__parent),
16185                            "pageSize" => Ok(__FieldTag::__page_size),
16186                            "page_size" => Ok(__FieldTag::__page_size),
16187                            "pageToken" => Ok(__FieldTag::__page_token),
16188                            "page_token" => Ok(__FieldTag::__page_token),
16189                            "showDeleted" => Ok(__FieldTag::__show_deleted),
16190                            "show_deleted" => Ok(__FieldTag::__show_deleted),
16191                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16192                        }
16193                    }
16194                }
16195                deserializer.deserialize_identifier(Visitor)
16196            }
16197        }
16198        struct Visitor;
16199        impl<'de> serde::de::Visitor<'de> for Visitor {
16200            type Value = ListServicesRequest;
16201            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16202                formatter.write_str("struct ListServicesRequest")
16203            }
16204            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16205            where
16206                A: serde::de::MapAccess<'de>,
16207            {
16208                #[allow(unused_imports)]
16209                use serde::de::Error;
16210                use std::option::Option::Some;
16211                let mut fields = std::collections::HashSet::new();
16212                let mut result = Self::Value::new();
16213                while let Some(tag) = map.next_key::<__FieldTag>()? {
16214                    #[allow(clippy::match_single_binding)]
16215                    match tag {
16216                        __FieldTag::__parent => {
16217                            if !fields.insert(__FieldTag::__parent) {
16218                                return std::result::Result::Err(A::Error::duplicate_field(
16219                                    "multiple values for parent",
16220                                ));
16221                            }
16222                            result.parent = map
16223                                .next_value::<std::option::Option<std::string::String>>()?
16224                                .unwrap_or_default();
16225                        }
16226                        __FieldTag::__page_size => {
16227                            if !fields.insert(__FieldTag::__page_size) {
16228                                return std::result::Result::Err(A::Error::duplicate_field(
16229                                    "multiple values for page_size",
16230                                ));
16231                            }
16232                            struct __With(std::option::Option<i32>);
16233                            impl<'de> serde::de::Deserialize<'de> for __With {
16234                                fn deserialize<D>(
16235                                    deserializer: D,
16236                                ) -> std::result::Result<Self, D::Error>
16237                                where
16238                                    D: serde::de::Deserializer<'de>,
16239                                {
16240                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
16241                                }
16242                            }
16243                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
16244                        }
16245                        __FieldTag::__page_token => {
16246                            if !fields.insert(__FieldTag::__page_token) {
16247                                return std::result::Result::Err(A::Error::duplicate_field(
16248                                    "multiple values for page_token",
16249                                ));
16250                            }
16251                            result.page_token = map
16252                                .next_value::<std::option::Option<std::string::String>>()?
16253                                .unwrap_or_default();
16254                        }
16255                        __FieldTag::__show_deleted => {
16256                            if !fields.insert(__FieldTag::__show_deleted) {
16257                                return std::result::Result::Err(A::Error::duplicate_field(
16258                                    "multiple values for show_deleted",
16259                                ));
16260                            }
16261                            result.show_deleted = map
16262                                .next_value::<std::option::Option<bool>>()?
16263                                .unwrap_or_default();
16264                        }
16265                        __FieldTag::Unknown(key) => {
16266                            let value = map.next_value::<serde_json::Value>()?;
16267                            result._unknown_fields.insert(key, value);
16268                        }
16269                    }
16270                }
16271                std::result::Result::Ok(result)
16272            }
16273        }
16274        deserializer.deserialize_any(Visitor)
16275    }
16276}
16277
16278#[doc(hidden)]
16279impl serde::ser::Serialize for ListServicesRequest {
16280    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16281    where
16282        S: serde::ser::Serializer,
16283    {
16284        use serde::ser::SerializeMap;
16285        #[allow(unused_imports)]
16286        use std::option::Option::Some;
16287        let mut state = serializer.serialize_map(std::option::Option::None)?;
16288        if !self.parent.is_empty() {
16289            state.serialize_entry("parent", &self.parent)?;
16290        }
16291        if !wkt::internal::is_default(&self.page_size) {
16292            struct __With<'a>(&'a i32);
16293            impl<'a> serde::ser::Serialize for __With<'a> {
16294                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16295                where
16296                    S: serde::ser::Serializer,
16297                {
16298                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
16299                }
16300            }
16301            state.serialize_entry("pageSize", &__With(&self.page_size))?;
16302        }
16303        if !self.page_token.is_empty() {
16304            state.serialize_entry("pageToken", &self.page_token)?;
16305        }
16306        if !wkt::internal::is_default(&self.show_deleted) {
16307            state.serialize_entry("showDeleted", &self.show_deleted)?;
16308        }
16309        if !self._unknown_fields.is_empty() {
16310            for (key, value) in self._unknown_fields.iter() {
16311                state.serialize_entry(key, &value)?;
16312            }
16313        }
16314        state.end()
16315    }
16316}
16317
16318/// Response message containing a list of Services.
16319#[derive(Clone, Debug, Default, PartialEq)]
16320#[non_exhaustive]
16321pub struct ListServicesResponse {
16322    /// The resulting list of Services.
16323    pub services: std::vec::Vec<crate::model::Service>,
16324
16325    /// A token indicating there are more items than page_size. Use it in the next
16326    /// ListServices request to continue.
16327    pub next_page_token: std::string::String,
16328
16329    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16330}
16331
16332impl ListServicesResponse {
16333    pub fn new() -> Self {
16334        std::default::Default::default()
16335    }
16336
16337    /// Sets the value of [services][crate::model::ListServicesResponse::services].
16338    pub fn set_services<T, V>(mut self, v: T) -> Self
16339    where
16340        T: std::iter::IntoIterator<Item = V>,
16341        V: std::convert::Into<crate::model::Service>,
16342    {
16343        use std::iter::Iterator;
16344        self.services = v.into_iter().map(|i| i.into()).collect();
16345        self
16346    }
16347
16348    /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
16349    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16350        self.next_page_token = v.into();
16351        self
16352    }
16353}
16354
16355impl wkt::message::Message for ListServicesResponse {
16356    fn typename() -> &'static str {
16357        "type.googleapis.com/google.cloud.run.v2.ListServicesResponse"
16358    }
16359}
16360
16361#[doc(hidden)]
16362impl gax::paginator::internal::PageableResponse for ListServicesResponse {
16363    type PageItem = crate::model::Service;
16364
16365    fn items(self) -> std::vec::Vec<Self::PageItem> {
16366        self.services
16367    }
16368
16369    fn next_page_token(&self) -> std::string::String {
16370        use std::clone::Clone;
16371        self.next_page_token.clone()
16372    }
16373}
16374
16375#[doc(hidden)]
16376impl<'de> serde::de::Deserialize<'de> for ListServicesResponse {
16377    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16378    where
16379        D: serde::Deserializer<'de>,
16380    {
16381        #[allow(non_camel_case_types)]
16382        #[doc(hidden)]
16383        #[derive(PartialEq, Eq, Hash)]
16384        enum __FieldTag {
16385            __services,
16386            __next_page_token,
16387            Unknown(std::string::String),
16388        }
16389        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16390            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16391            where
16392                D: serde::Deserializer<'de>,
16393            {
16394                struct Visitor;
16395                impl<'de> serde::de::Visitor<'de> for Visitor {
16396                    type Value = __FieldTag;
16397                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16398                        formatter.write_str("a field name for ListServicesResponse")
16399                    }
16400                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16401                    where
16402                        E: serde::de::Error,
16403                    {
16404                        use std::result::Result::Ok;
16405                        use std::string::ToString;
16406                        match value {
16407                            "services" => Ok(__FieldTag::__services),
16408                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
16409                            "next_page_token" => Ok(__FieldTag::__next_page_token),
16410                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16411                        }
16412                    }
16413                }
16414                deserializer.deserialize_identifier(Visitor)
16415            }
16416        }
16417        struct Visitor;
16418        impl<'de> serde::de::Visitor<'de> for Visitor {
16419            type Value = ListServicesResponse;
16420            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16421                formatter.write_str("struct ListServicesResponse")
16422            }
16423            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16424            where
16425                A: serde::de::MapAccess<'de>,
16426            {
16427                #[allow(unused_imports)]
16428                use serde::de::Error;
16429                use std::option::Option::Some;
16430                let mut fields = std::collections::HashSet::new();
16431                let mut result = Self::Value::new();
16432                while let Some(tag) = map.next_key::<__FieldTag>()? {
16433                    #[allow(clippy::match_single_binding)]
16434                    match tag {
16435                        __FieldTag::__services => {
16436                            if !fields.insert(__FieldTag::__services) {
16437                                return std::result::Result::Err(A::Error::duplicate_field(
16438                                    "multiple values for services",
16439                                ));
16440                            }
16441                            result.services = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Service>>>()?.unwrap_or_default();
16442                        }
16443                        __FieldTag::__next_page_token => {
16444                            if !fields.insert(__FieldTag::__next_page_token) {
16445                                return std::result::Result::Err(A::Error::duplicate_field(
16446                                    "multiple values for next_page_token",
16447                                ));
16448                            }
16449                            result.next_page_token = map
16450                                .next_value::<std::option::Option<std::string::String>>()?
16451                                .unwrap_or_default();
16452                        }
16453                        __FieldTag::Unknown(key) => {
16454                            let value = map.next_value::<serde_json::Value>()?;
16455                            result._unknown_fields.insert(key, value);
16456                        }
16457                    }
16458                }
16459                std::result::Result::Ok(result)
16460            }
16461        }
16462        deserializer.deserialize_any(Visitor)
16463    }
16464}
16465
16466#[doc(hidden)]
16467impl serde::ser::Serialize for ListServicesResponse {
16468    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16469    where
16470        S: serde::ser::Serializer,
16471    {
16472        use serde::ser::SerializeMap;
16473        #[allow(unused_imports)]
16474        use std::option::Option::Some;
16475        let mut state = serializer.serialize_map(std::option::Option::None)?;
16476        if !self.services.is_empty() {
16477            state.serialize_entry("services", &self.services)?;
16478        }
16479        if !self.next_page_token.is_empty() {
16480            state.serialize_entry("nextPageToken", &self.next_page_token)?;
16481        }
16482        if !self._unknown_fields.is_empty() {
16483            for (key, value) in self._unknown_fields.iter() {
16484                state.serialize_entry(key, &value)?;
16485            }
16486        }
16487        state.end()
16488    }
16489}
16490
16491/// Request message for obtaining a Service by its full name.
16492#[derive(Clone, Debug, Default, PartialEq)]
16493#[non_exhaustive]
16494pub struct GetServiceRequest {
16495    /// Required. The full name of the Service.
16496    /// Format: projects/{project}/locations/{location}/services/{service}, where
16497    /// {project} can be project id or number.
16498    pub name: std::string::String,
16499
16500    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16501}
16502
16503impl GetServiceRequest {
16504    pub fn new() -> Self {
16505        std::default::Default::default()
16506    }
16507
16508    /// Sets the value of [name][crate::model::GetServiceRequest::name].
16509    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16510        self.name = v.into();
16511        self
16512    }
16513}
16514
16515impl wkt::message::Message for GetServiceRequest {
16516    fn typename() -> &'static str {
16517        "type.googleapis.com/google.cloud.run.v2.GetServiceRequest"
16518    }
16519}
16520
16521#[doc(hidden)]
16522impl<'de> serde::de::Deserialize<'de> for GetServiceRequest {
16523    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16524    where
16525        D: serde::Deserializer<'de>,
16526    {
16527        #[allow(non_camel_case_types)]
16528        #[doc(hidden)]
16529        #[derive(PartialEq, Eq, Hash)]
16530        enum __FieldTag {
16531            __name,
16532            Unknown(std::string::String),
16533        }
16534        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16535            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16536            where
16537                D: serde::Deserializer<'de>,
16538            {
16539                struct Visitor;
16540                impl<'de> serde::de::Visitor<'de> for Visitor {
16541                    type Value = __FieldTag;
16542                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16543                        formatter.write_str("a field name for GetServiceRequest")
16544                    }
16545                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16546                    where
16547                        E: serde::de::Error,
16548                    {
16549                        use std::result::Result::Ok;
16550                        use std::string::ToString;
16551                        match value {
16552                            "name" => Ok(__FieldTag::__name),
16553                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16554                        }
16555                    }
16556                }
16557                deserializer.deserialize_identifier(Visitor)
16558            }
16559        }
16560        struct Visitor;
16561        impl<'de> serde::de::Visitor<'de> for Visitor {
16562            type Value = GetServiceRequest;
16563            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16564                formatter.write_str("struct GetServiceRequest")
16565            }
16566            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16567            where
16568                A: serde::de::MapAccess<'de>,
16569            {
16570                #[allow(unused_imports)]
16571                use serde::de::Error;
16572                use std::option::Option::Some;
16573                let mut fields = std::collections::HashSet::new();
16574                let mut result = Self::Value::new();
16575                while let Some(tag) = map.next_key::<__FieldTag>()? {
16576                    #[allow(clippy::match_single_binding)]
16577                    match tag {
16578                        __FieldTag::__name => {
16579                            if !fields.insert(__FieldTag::__name) {
16580                                return std::result::Result::Err(A::Error::duplicate_field(
16581                                    "multiple values for name",
16582                                ));
16583                            }
16584                            result.name = map
16585                                .next_value::<std::option::Option<std::string::String>>()?
16586                                .unwrap_or_default();
16587                        }
16588                        __FieldTag::Unknown(key) => {
16589                            let value = map.next_value::<serde_json::Value>()?;
16590                            result._unknown_fields.insert(key, value);
16591                        }
16592                    }
16593                }
16594                std::result::Result::Ok(result)
16595            }
16596        }
16597        deserializer.deserialize_any(Visitor)
16598    }
16599}
16600
16601#[doc(hidden)]
16602impl serde::ser::Serialize for GetServiceRequest {
16603    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16604    where
16605        S: serde::ser::Serializer,
16606    {
16607        use serde::ser::SerializeMap;
16608        #[allow(unused_imports)]
16609        use std::option::Option::Some;
16610        let mut state = serializer.serialize_map(std::option::Option::None)?;
16611        if !self.name.is_empty() {
16612            state.serialize_entry("name", &self.name)?;
16613        }
16614        if !self._unknown_fields.is_empty() {
16615            for (key, value) in self._unknown_fields.iter() {
16616                state.serialize_entry(key, &value)?;
16617            }
16618        }
16619        state.end()
16620    }
16621}
16622
16623/// Request message to delete a Service by its full name.
16624#[derive(Clone, Debug, Default, PartialEq)]
16625#[non_exhaustive]
16626pub struct DeleteServiceRequest {
16627    /// Required. The full name of the Service.
16628    /// Format: projects/{project}/locations/{location}/services/{service}, where
16629    /// {project} can be project id or number.
16630    pub name: std::string::String,
16631
16632    /// Indicates that the request should be validated without actually
16633    /// deleting any resources.
16634    pub validate_only: bool,
16635
16636    /// A system-generated fingerprint for this version of the
16637    /// resource. May be used to detect modification conflict during updates.
16638    pub etag: std::string::String,
16639
16640    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16641}
16642
16643impl DeleteServiceRequest {
16644    pub fn new() -> Self {
16645        std::default::Default::default()
16646    }
16647
16648    /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
16649    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16650        self.name = v.into();
16651        self
16652    }
16653
16654    /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
16655    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16656        self.validate_only = v.into();
16657        self
16658    }
16659
16660    /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
16661    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16662        self.etag = v.into();
16663        self
16664    }
16665}
16666
16667impl wkt::message::Message for DeleteServiceRequest {
16668    fn typename() -> &'static str {
16669        "type.googleapis.com/google.cloud.run.v2.DeleteServiceRequest"
16670    }
16671}
16672
16673#[doc(hidden)]
16674impl<'de> serde::de::Deserialize<'de> for DeleteServiceRequest {
16675    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16676    where
16677        D: serde::Deserializer<'de>,
16678    {
16679        #[allow(non_camel_case_types)]
16680        #[doc(hidden)]
16681        #[derive(PartialEq, Eq, Hash)]
16682        enum __FieldTag {
16683            __name,
16684            __validate_only,
16685            __etag,
16686            Unknown(std::string::String),
16687        }
16688        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16689            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16690            where
16691                D: serde::Deserializer<'de>,
16692            {
16693                struct Visitor;
16694                impl<'de> serde::de::Visitor<'de> for Visitor {
16695                    type Value = __FieldTag;
16696                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16697                        formatter.write_str("a field name for DeleteServiceRequest")
16698                    }
16699                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16700                    where
16701                        E: serde::de::Error,
16702                    {
16703                        use std::result::Result::Ok;
16704                        use std::string::ToString;
16705                        match value {
16706                            "name" => Ok(__FieldTag::__name),
16707                            "validateOnly" => Ok(__FieldTag::__validate_only),
16708                            "validate_only" => Ok(__FieldTag::__validate_only),
16709                            "etag" => Ok(__FieldTag::__etag),
16710                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16711                        }
16712                    }
16713                }
16714                deserializer.deserialize_identifier(Visitor)
16715            }
16716        }
16717        struct Visitor;
16718        impl<'de> serde::de::Visitor<'de> for Visitor {
16719            type Value = DeleteServiceRequest;
16720            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16721                formatter.write_str("struct DeleteServiceRequest")
16722            }
16723            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16724            where
16725                A: serde::de::MapAccess<'de>,
16726            {
16727                #[allow(unused_imports)]
16728                use serde::de::Error;
16729                use std::option::Option::Some;
16730                let mut fields = std::collections::HashSet::new();
16731                let mut result = Self::Value::new();
16732                while let Some(tag) = map.next_key::<__FieldTag>()? {
16733                    #[allow(clippy::match_single_binding)]
16734                    match tag {
16735                        __FieldTag::__name => {
16736                            if !fields.insert(__FieldTag::__name) {
16737                                return std::result::Result::Err(A::Error::duplicate_field(
16738                                    "multiple values for name",
16739                                ));
16740                            }
16741                            result.name = map
16742                                .next_value::<std::option::Option<std::string::String>>()?
16743                                .unwrap_or_default();
16744                        }
16745                        __FieldTag::__validate_only => {
16746                            if !fields.insert(__FieldTag::__validate_only) {
16747                                return std::result::Result::Err(A::Error::duplicate_field(
16748                                    "multiple values for validate_only",
16749                                ));
16750                            }
16751                            result.validate_only = map
16752                                .next_value::<std::option::Option<bool>>()?
16753                                .unwrap_or_default();
16754                        }
16755                        __FieldTag::__etag => {
16756                            if !fields.insert(__FieldTag::__etag) {
16757                                return std::result::Result::Err(A::Error::duplicate_field(
16758                                    "multiple values for etag",
16759                                ));
16760                            }
16761                            result.etag = map
16762                                .next_value::<std::option::Option<std::string::String>>()?
16763                                .unwrap_or_default();
16764                        }
16765                        __FieldTag::Unknown(key) => {
16766                            let value = map.next_value::<serde_json::Value>()?;
16767                            result._unknown_fields.insert(key, value);
16768                        }
16769                    }
16770                }
16771                std::result::Result::Ok(result)
16772            }
16773        }
16774        deserializer.deserialize_any(Visitor)
16775    }
16776}
16777
16778#[doc(hidden)]
16779impl serde::ser::Serialize for DeleteServiceRequest {
16780    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16781    where
16782        S: serde::ser::Serializer,
16783    {
16784        use serde::ser::SerializeMap;
16785        #[allow(unused_imports)]
16786        use std::option::Option::Some;
16787        let mut state = serializer.serialize_map(std::option::Option::None)?;
16788        if !self.name.is_empty() {
16789            state.serialize_entry("name", &self.name)?;
16790        }
16791        if !wkt::internal::is_default(&self.validate_only) {
16792            state.serialize_entry("validateOnly", &self.validate_only)?;
16793        }
16794        if !self.etag.is_empty() {
16795            state.serialize_entry("etag", &self.etag)?;
16796        }
16797        if !self._unknown_fields.is_empty() {
16798            for (key, value) in self._unknown_fields.iter() {
16799                state.serialize_entry(key, &value)?;
16800            }
16801        }
16802        state.end()
16803    }
16804}
16805
16806/// Service acts as a top-level container that manages a set of
16807/// configurations and revision templates which implement a network service.
16808/// Service exists to provide a singular abstraction which can be access
16809/// controlled, reasoned about, and which encapsulates software lifecycle
16810/// decisions such as rollout policy and team resource ownership.
16811#[derive(Clone, Debug, Default, PartialEq)]
16812#[non_exhaustive]
16813pub struct Service {
16814    /// The fully qualified name of this Service. In CreateServiceRequest, this
16815    /// field is ignored, and instead composed from CreateServiceRequest.parent and
16816    /// CreateServiceRequest.service_id.
16817    ///
16818    /// Format:
16819    /// projects/{project}/locations/{location}/services/{service_id}
16820    pub name: std::string::String,
16821
16822    /// User-provided description of the Service. This field currently has a
16823    /// 512-character limit.
16824    pub description: std::string::String,
16825
16826    /// Output only. Server assigned unique identifier for the trigger. The value
16827    /// is a UUID4 string and guaranteed to remain unchanged until the resource is
16828    /// deleted.
16829    pub uid: std::string::String,
16830
16831    /// Output only. A number that monotonically increases every time the user
16832    /// modifies the desired state.
16833    /// Please note that unlike v1, this is an int64 value. As with most Google
16834    /// APIs, its JSON representation will be a `string` instead of an `integer`.
16835    pub generation: i64,
16836
16837    /// Optional. Unstructured key value map that can be used to organize and
16838    /// categorize objects. User-provided labels are shared with Google's billing
16839    /// system, so they can be used to filter, or break down billing charges by
16840    /// team, component, environment, state, etc. For more information, visit
16841    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
16842    /// <https://cloud.google.com/run/docs/configuring/labels>.
16843    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16844
16845    /// Optional. Unstructured key value map that may be set by external tools to
16846    /// store and arbitrary metadata. They are not queryable and should be
16847    /// preserved when modifying objects.
16848    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
16849
16850    /// Output only. The creation time.
16851    pub create_time: std::option::Option<wkt::Timestamp>,
16852
16853    /// Output only. The last-modified time.
16854    pub update_time: std::option::Option<wkt::Timestamp>,
16855
16856    /// Output only. The deletion time. It is only populated as a response to a
16857    /// Delete request.
16858    pub delete_time: std::option::Option<wkt::Timestamp>,
16859
16860    /// Output only. For a deleted resource, the time after which it will be
16861    /// permanently deleted.
16862    pub expire_time: std::option::Option<wkt::Timestamp>,
16863
16864    /// Output only. Email address of the authenticated creator.
16865    pub creator: std::string::String,
16866
16867    /// Output only. Email address of the last authenticated modifier.
16868    pub last_modifier: std::string::String,
16869
16870    /// Arbitrary identifier for the API client.
16871    pub client: std::string::String,
16872
16873    /// Arbitrary version identifier for the API client.
16874    pub client_version: std::string::String,
16875
16876    /// Optional. Provides the ingress settings for this Service. On output,
16877    /// returns the currently observed ingress settings, or
16878    /// INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
16879    pub ingress: crate::model::IngressTraffic,
16880
16881    /// Optional. The launch stage as defined by [Google Cloud Platform
16882    /// Launch Stages](https://cloud.google.com/terms/launch-stages).
16883    /// Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
16884    /// is assumed.
16885    /// Set the launch stage to a preview stage on input to allow use of preview
16886    /// features in that stage. On read (or output), describes whether the resource
16887    /// uses preview features.
16888    ///
16889    /// For example, if ALPHA is provided as input, but only BETA and GA-level
16890    /// features are used, this field will be BETA on output.
16891    pub launch_stage: api::model::LaunchStage,
16892
16893    /// Optional. Settings for the Binary Authorization feature.
16894    pub binary_authorization: std::option::Option<crate::model::BinaryAuthorization>,
16895
16896    /// Required. The template used to create revisions for this Service.
16897    pub template: std::option::Option<crate::model::RevisionTemplate>,
16898
16899    /// Optional. Specifies how to distribute traffic over a collection of
16900    /// Revisions belonging to the Service. If traffic is empty or not provided,
16901    /// defaults to 100% traffic to the latest `Ready` Revision.
16902    pub traffic: std::vec::Vec<crate::model::TrafficTarget>,
16903
16904    /// Optional. Specifies service-level scaling settings
16905    pub scaling: std::option::Option<crate::model::ServiceScaling>,
16906
16907    /// Optional. Disables IAM permission check for run.routes.invoke for callers
16908    /// of this service. This feature is available by invitation only. For more
16909    /// information, visit
16910    /// <https://cloud.google.com/run/docs/securing/managing-access#invoker_check>.
16911    pub invoker_iam_disabled: bool,
16912
16913    /// Optional. Disables public resolution of the default URI of this service.
16914    pub default_uri_disabled: bool,
16915
16916    /// Output only. All URLs serving traffic for this Service.
16917    pub urls: std::vec::Vec<std::string::String>,
16918
16919    /// One or more custom audiences that you want this service to support. Specify
16920    /// each custom audience as the full URL in a string. The custom audiences are
16921    /// encoded in the token and used to authenticate requests. For more
16922    /// information, see
16923    /// <https://cloud.google.com/run/docs/configuring/custom-audiences>.
16924    pub custom_audiences: std::vec::Vec<std::string::String>,
16925
16926    /// Output only. The generation of this Service currently serving traffic. See
16927    /// comments in `reconciling` for additional information on reconciliation
16928    /// process in Cloud Run. Please note that unlike v1, this is an int64 value.
16929    /// As with most Google APIs, its JSON representation will be a `string`
16930    /// instead of an `integer`.
16931    pub observed_generation: i64,
16932
16933    /// Output only. The Condition of this Service, containing its readiness
16934    /// status, and detailed error information in case it did not reach a serving
16935    /// state. See comments in `reconciling` for additional information on
16936    /// reconciliation process in Cloud Run.
16937    pub terminal_condition: std::option::Option<crate::model::Condition>,
16938
16939    /// Output only. The Conditions of all other associated sub-resources. They
16940    /// contain additional diagnostics information in case the Service does not
16941    /// reach its Serving state. See comments in `reconciling` for additional
16942    /// information on reconciliation process in Cloud Run.
16943    pub conditions: std::vec::Vec<crate::model::Condition>,
16944
16945    /// Output only. Name of the latest revision that is serving traffic. See
16946    /// comments in `reconciling` for additional information on reconciliation
16947    /// process in Cloud Run.
16948    pub latest_ready_revision: std::string::String,
16949
16950    /// Output only. Name of the last created revision. See comments in
16951    /// `reconciling` for additional information on reconciliation process in Cloud
16952    /// Run.
16953    pub latest_created_revision: std::string::String,
16954
16955    /// Output only. Detailed status information for corresponding traffic targets.
16956    /// See comments in `reconciling` for additional information on reconciliation
16957    /// process in Cloud Run.
16958    pub traffic_statuses: std::vec::Vec<crate::model::TrafficTargetStatus>,
16959
16960    /// Output only. The main URI in which this Service is serving traffic.
16961    pub uri: std::string::String,
16962
16963    /// Output only. Reserved for future use.
16964    pub satisfies_pzs: bool,
16965
16966    /// Optional. Configuration for building a Cloud Run function.
16967    pub build_config: std::option::Option<crate::model::BuildConfig>,
16968
16969    /// Output only. Returns true if the Service is currently being acted upon by
16970    /// the system to bring it into the desired state.
16971    ///
16972    /// When a new Service is created, or an existing one is updated, Cloud Run
16973    /// will asynchronously perform all necessary steps to bring the Service to the
16974    /// desired serving state. This process is called reconciliation.
16975    /// While reconciliation is in process, `observed_generation`,
16976    /// `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient
16977    /// values that might mismatch the intended state: Once reconciliation is over
16978    /// (and this field is false), there are two possible outcomes: reconciliation
16979    /// succeeded and the serving state matches the Service, or there was an error,
16980    /// and reconciliation failed. This state can be found in
16981    /// `terminal_condition.state`.
16982    ///
16983    /// If reconciliation succeeded, the following fields will match: `traffic` and
16984    /// `traffic_statuses`, `observed_generation` and `generation`,
16985    /// `latest_ready_revision` and `latest_created_revision`.
16986    ///
16987    /// If reconciliation failed, `traffic_statuses`, `observed_generation`, and
16988    /// `latest_ready_revision` will have the state of the last serving revision,
16989    /// or empty for newly created Services. Additional information on the failure
16990    /// can be found in `terminal_condition` and `conditions`.
16991    pub reconciling: bool,
16992
16993    /// Output only. A system-generated fingerprint for this version of the
16994    /// resource. May be used to detect modification conflict during updates.
16995    pub etag: std::string::String,
16996
16997    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16998}
16999
17000impl Service {
17001    pub fn new() -> Self {
17002        std::default::Default::default()
17003    }
17004
17005    /// Sets the value of [name][crate::model::Service::name].
17006    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17007        self.name = v.into();
17008        self
17009    }
17010
17011    /// Sets the value of [description][crate::model::Service::description].
17012    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17013        self.description = v.into();
17014        self
17015    }
17016
17017    /// Sets the value of [uid][crate::model::Service::uid].
17018    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17019        self.uid = v.into();
17020        self
17021    }
17022
17023    /// Sets the value of [generation][crate::model::Service::generation].
17024    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
17025        self.generation = v.into();
17026        self
17027    }
17028
17029    /// Sets the value of [labels][crate::model::Service::labels].
17030    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17031    where
17032        T: std::iter::IntoIterator<Item = (K, V)>,
17033        K: std::convert::Into<std::string::String>,
17034        V: std::convert::Into<std::string::String>,
17035    {
17036        use std::iter::Iterator;
17037        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17038        self
17039    }
17040
17041    /// Sets the value of [annotations][crate::model::Service::annotations].
17042    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
17043    where
17044        T: std::iter::IntoIterator<Item = (K, V)>,
17045        K: std::convert::Into<std::string::String>,
17046        V: std::convert::Into<std::string::String>,
17047    {
17048        use std::iter::Iterator;
17049        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17050        self
17051    }
17052
17053    /// Sets the value of [create_time][crate::model::Service::create_time].
17054    pub fn set_create_time<T>(mut self, v: T) -> Self
17055    where
17056        T: std::convert::Into<wkt::Timestamp>,
17057    {
17058        self.create_time = std::option::Option::Some(v.into());
17059        self
17060    }
17061
17062    /// Sets or clears the value of [create_time][crate::model::Service::create_time].
17063    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17064    where
17065        T: std::convert::Into<wkt::Timestamp>,
17066    {
17067        self.create_time = v.map(|x| x.into());
17068        self
17069    }
17070
17071    /// Sets the value of [update_time][crate::model::Service::update_time].
17072    pub fn set_update_time<T>(mut self, v: T) -> Self
17073    where
17074        T: std::convert::Into<wkt::Timestamp>,
17075    {
17076        self.update_time = std::option::Option::Some(v.into());
17077        self
17078    }
17079
17080    /// Sets or clears the value of [update_time][crate::model::Service::update_time].
17081    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17082    where
17083        T: std::convert::Into<wkt::Timestamp>,
17084    {
17085        self.update_time = v.map(|x| x.into());
17086        self
17087    }
17088
17089    /// Sets the value of [delete_time][crate::model::Service::delete_time].
17090    pub fn set_delete_time<T>(mut self, v: T) -> Self
17091    where
17092        T: std::convert::Into<wkt::Timestamp>,
17093    {
17094        self.delete_time = std::option::Option::Some(v.into());
17095        self
17096    }
17097
17098    /// Sets or clears the value of [delete_time][crate::model::Service::delete_time].
17099    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
17100    where
17101        T: std::convert::Into<wkt::Timestamp>,
17102    {
17103        self.delete_time = v.map(|x| x.into());
17104        self
17105    }
17106
17107    /// Sets the value of [expire_time][crate::model::Service::expire_time].
17108    pub fn set_expire_time<T>(mut self, v: T) -> Self
17109    where
17110        T: std::convert::Into<wkt::Timestamp>,
17111    {
17112        self.expire_time = std::option::Option::Some(v.into());
17113        self
17114    }
17115
17116    /// Sets or clears the value of [expire_time][crate::model::Service::expire_time].
17117    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
17118    where
17119        T: std::convert::Into<wkt::Timestamp>,
17120    {
17121        self.expire_time = v.map(|x| x.into());
17122        self
17123    }
17124
17125    /// Sets the value of [creator][crate::model::Service::creator].
17126    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17127        self.creator = v.into();
17128        self
17129    }
17130
17131    /// Sets the value of [last_modifier][crate::model::Service::last_modifier].
17132    pub fn set_last_modifier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17133        self.last_modifier = v.into();
17134        self
17135    }
17136
17137    /// Sets the value of [client][crate::model::Service::client].
17138    pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17139        self.client = v.into();
17140        self
17141    }
17142
17143    /// Sets the value of [client_version][crate::model::Service::client_version].
17144    pub fn set_client_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17145        self.client_version = v.into();
17146        self
17147    }
17148
17149    /// Sets the value of [ingress][crate::model::Service::ingress].
17150    pub fn set_ingress<T: std::convert::Into<crate::model::IngressTraffic>>(
17151        mut self,
17152        v: T,
17153    ) -> Self {
17154        self.ingress = v.into();
17155        self
17156    }
17157
17158    /// Sets the value of [launch_stage][crate::model::Service::launch_stage].
17159    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
17160        mut self,
17161        v: T,
17162    ) -> Self {
17163        self.launch_stage = v.into();
17164        self
17165    }
17166
17167    /// Sets the value of [binary_authorization][crate::model::Service::binary_authorization].
17168    pub fn set_binary_authorization<T>(mut self, v: T) -> Self
17169    where
17170        T: std::convert::Into<crate::model::BinaryAuthorization>,
17171    {
17172        self.binary_authorization = std::option::Option::Some(v.into());
17173        self
17174    }
17175
17176    /// Sets or clears the value of [binary_authorization][crate::model::Service::binary_authorization].
17177    pub fn set_or_clear_binary_authorization<T>(mut self, v: std::option::Option<T>) -> Self
17178    where
17179        T: std::convert::Into<crate::model::BinaryAuthorization>,
17180    {
17181        self.binary_authorization = v.map(|x| x.into());
17182        self
17183    }
17184
17185    /// Sets the value of [template][crate::model::Service::template].
17186    pub fn set_template<T>(mut self, v: T) -> Self
17187    where
17188        T: std::convert::Into<crate::model::RevisionTemplate>,
17189    {
17190        self.template = std::option::Option::Some(v.into());
17191        self
17192    }
17193
17194    /// Sets or clears the value of [template][crate::model::Service::template].
17195    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
17196    where
17197        T: std::convert::Into<crate::model::RevisionTemplate>,
17198    {
17199        self.template = v.map(|x| x.into());
17200        self
17201    }
17202
17203    /// Sets the value of [traffic][crate::model::Service::traffic].
17204    pub fn set_traffic<T, V>(mut self, v: T) -> Self
17205    where
17206        T: std::iter::IntoIterator<Item = V>,
17207        V: std::convert::Into<crate::model::TrafficTarget>,
17208    {
17209        use std::iter::Iterator;
17210        self.traffic = v.into_iter().map(|i| i.into()).collect();
17211        self
17212    }
17213
17214    /// Sets the value of [scaling][crate::model::Service::scaling].
17215    pub fn set_scaling<T>(mut self, v: T) -> Self
17216    where
17217        T: std::convert::Into<crate::model::ServiceScaling>,
17218    {
17219        self.scaling = std::option::Option::Some(v.into());
17220        self
17221    }
17222
17223    /// Sets or clears the value of [scaling][crate::model::Service::scaling].
17224    pub fn set_or_clear_scaling<T>(mut self, v: std::option::Option<T>) -> Self
17225    where
17226        T: std::convert::Into<crate::model::ServiceScaling>,
17227    {
17228        self.scaling = v.map(|x| x.into());
17229        self
17230    }
17231
17232    /// Sets the value of [invoker_iam_disabled][crate::model::Service::invoker_iam_disabled].
17233    pub fn set_invoker_iam_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17234        self.invoker_iam_disabled = v.into();
17235        self
17236    }
17237
17238    /// Sets the value of [default_uri_disabled][crate::model::Service::default_uri_disabled].
17239    pub fn set_default_uri_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17240        self.default_uri_disabled = v.into();
17241        self
17242    }
17243
17244    /// Sets the value of [urls][crate::model::Service::urls].
17245    pub fn set_urls<T, V>(mut self, v: T) -> Self
17246    where
17247        T: std::iter::IntoIterator<Item = V>,
17248        V: std::convert::Into<std::string::String>,
17249    {
17250        use std::iter::Iterator;
17251        self.urls = v.into_iter().map(|i| i.into()).collect();
17252        self
17253    }
17254
17255    /// Sets the value of [custom_audiences][crate::model::Service::custom_audiences].
17256    pub fn set_custom_audiences<T, V>(mut self, v: T) -> Self
17257    where
17258        T: std::iter::IntoIterator<Item = V>,
17259        V: std::convert::Into<std::string::String>,
17260    {
17261        use std::iter::Iterator;
17262        self.custom_audiences = v.into_iter().map(|i| i.into()).collect();
17263        self
17264    }
17265
17266    /// Sets the value of [observed_generation][crate::model::Service::observed_generation].
17267    pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
17268        self.observed_generation = v.into();
17269        self
17270    }
17271
17272    /// Sets the value of [terminal_condition][crate::model::Service::terminal_condition].
17273    pub fn set_terminal_condition<T>(mut self, v: T) -> Self
17274    where
17275        T: std::convert::Into<crate::model::Condition>,
17276    {
17277        self.terminal_condition = std::option::Option::Some(v.into());
17278        self
17279    }
17280
17281    /// Sets or clears the value of [terminal_condition][crate::model::Service::terminal_condition].
17282    pub fn set_or_clear_terminal_condition<T>(mut self, v: std::option::Option<T>) -> Self
17283    where
17284        T: std::convert::Into<crate::model::Condition>,
17285    {
17286        self.terminal_condition = v.map(|x| x.into());
17287        self
17288    }
17289
17290    /// Sets the value of [conditions][crate::model::Service::conditions].
17291    pub fn set_conditions<T, V>(mut self, v: T) -> Self
17292    where
17293        T: std::iter::IntoIterator<Item = V>,
17294        V: std::convert::Into<crate::model::Condition>,
17295    {
17296        use std::iter::Iterator;
17297        self.conditions = v.into_iter().map(|i| i.into()).collect();
17298        self
17299    }
17300
17301    /// Sets the value of [latest_ready_revision][crate::model::Service::latest_ready_revision].
17302    pub fn set_latest_ready_revision<T: std::convert::Into<std::string::String>>(
17303        mut self,
17304        v: T,
17305    ) -> Self {
17306        self.latest_ready_revision = v.into();
17307        self
17308    }
17309
17310    /// Sets the value of [latest_created_revision][crate::model::Service::latest_created_revision].
17311    pub fn set_latest_created_revision<T: std::convert::Into<std::string::String>>(
17312        mut self,
17313        v: T,
17314    ) -> Self {
17315        self.latest_created_revision = v.into();
17316        self
17317    }
17318
17319    /// Sets the value of [traffic_statuses][crate::model::Service::traffic_statuses].
17320    pub fn set_traffic_statuses<T, V>(mut self, v: T) -> Self
17321    where
17322        T: std::iter::IntoIterator<Item = V>,
17323        V: std::convert::Into<crate::model::TrafficTargetStatus>,
17324    {
17325        use std::iter::Iterator;
17326        self.traffic_statuses = v.into_iter().map(|i| i.into()).collect();
17327        self
17328    }
17329
17330    /// Sets the value of [uri][crate::model::Service::uri].
17331    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17332        self.uri = v.into();
17333        self
17334    }
17335
17336    /// Sets the value of [satisfies_pzs][crate::model::Service::satisfies_pzs].
17337    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17338        self.satisfies_pzs = v.into();
17339        self
17340    }
17341
17342    /// Sets the value of [build_config][crate::model::Service::build_config].
17343    pub fn set_build_config<T>(mut self, v: T) -> Self
17344    where
17345        T: std::convert::Into<crate::model::BuildConfig>,
17346    {
17347        self.build_config = std::option::Option::Some(v.into());
17348        self
17349    }
17350
17351    /// Sets or clears the value of [build_config][crate::model::Service::build_config].
17352    pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
17353    where
17354        T: std::convert::Into<crate::model::BuildConfig>,
17355    {
17356        self.build_config = v.map(|x| x.into());
17357        self
17358    }
17359
17360    /// Sets the value of [reconciling][crate::model::Service::reconciling].
17361    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17362        self.reconciling = v.into();
17363        self
17364    }
17365
17366    /// Sets the value of [etag][crate::model::Service::etag].
17367    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17368        self.etag = v.into();
17369        self
17370    }
17371}
17372
17373impl wkt::message::Message for Service {
17374    fn typename() -> &'static str {
17375        "type.googleapis.com/google.cloud.run.v2.Service"
17376    }
17377}
17378
17379#[doc(hidden)]
17380impl<'de> serde::de::Deserialize<'de> for Service {
17381    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17382    where
17383        D: serde::Deserializer<'de>,
17384    {
17385        #[allow(non_camel_case_types)]
17386        #[doc(hidden)]
17387        #[derive(PartialEq, Eq, Hash)]
17388        enum __FieldTag {
17389            __name,
17390            __description,
17391            __uid,
17392            __generation,
17393            __labels,
17394            __annotations,
17395            __create_time,
17396            __update_time,
17397            __delete_time,
17398            __expire_time,
17399            __creator,
17400            __last_modifier,
17401            __client,
17402            __client_version,
17403            __ingress,
17404            __launch_stage,
17405            __binary_authorization,
17406            __template,
17407            __traffic,
17408            __scaling,
17409            __invoker_iam_disabled,
17410            __default_uri_disabled,
17411            __urls,
17412            __custom_audiences,
17413            __observed_generation,
17414            __terminal_condition,
17415            __conditions,
17416            __latest_ready_revision,
17417            __latest_created_revision,
17418            __traffic_statuses,
17419            __uri,
17420            __satisfies_pzs,
17421            __build_config,
17422            __reconciling,
17423            __etag,
17424            Unknown(std::string::String),
17425        }
17426        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17427            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17428            where
17429                D: serde::Deserializer<'de>,
17430            {
17431                struct Visitor;
17432                impl<'de> serde::de::Visitor<'de> for Visitor {
17433                    type Value = __FieldTag;
17434                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17435                        formatter.write_str("a field name for Service")
17436                    }
17437                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17438                    where
17439                        E: serde::de::Error,
17440                    {
17441                        use std::result::Result::Ok;
17442                        use std::string::ToString;
17443                        match value {
17444                            "name" => Ok(__FieldTag::__name),
17445                            "description" => Ok(__FieldTag::__description),
17446                            "uid" => Ok(__FieldTag::__uid),
17447                            "generation" => Ok(__FieldTag::__generation),
17448                            "labels" => Ok(__FieldTag::__labels),
17449                            "annotations" => Ok(__FieldTag::__annotations),
17450                            "createTime" => Ok(__FieldTag::__create_time),
17451                            "create_time" => Ok(__FieldTag::__create_time),
17452                            "updateTime" => Ok(__FieldTag::__update_time),
17453                            "update_time" => Ok(__FieldTag::__update_time),
17454                            "deleteTime" => Ok(__FieldTag::__delete_time),
17455                            "delete_time" => Ok(__FieldTag::__delete_time),
17456                            "expireTime" => Ok(__FieldTag::__expire_time),
17457                            "expire_time" => Ok(__FieldTag::__expire_time),
17458                            "creator" => Ok(__FieldTag::__creator),
17459                            "lastModifier" => Ok(__FieldTag::__last_modifier),
17460                            "last_modifier" => Ok(__FieldTag::__last_modifier),
17461                            "client" => Ok(__FieldTag::__client),
17462                            "clientVersion" => Ok(__FieldTag::__client_version),
17463                            "client_version" => Ok(__FieldTag::__client_version),
17464                            "ingress" => Ok(__FieldTag::__ingress),
17465                            "launchStage" => Ok(__FieldTag::__launch_stage),
17466                            "launch_stage" => Ok(__FieldTag::__launch_stage),
17467                            "binaryAuthorization" => Ok(__FieldTag::__binary_authorization),
17468                            "binary_authorization" => Ok(__FieldTag::__binary_authorization),
17469                            "template" => Ok(__FieldTag::__template),
17470                            "traffic" => Ok(__FieldTag::__traffic),
17471                            "scaling" => Ok(__FieldTag::__scaling),
17472                            "invokerIamDisabled" => Ok(__FieldTag::__invoker_iam_disabled),
17473                            "invoker_iam_disabled" => Ok(__FieldTag::__invoker_iam_disabled),
17474                            "defaultUriDisabled" => Ok(__FieldTag::__default_uri_disabled),
17475                            "default_uri_disabled" => Ok(__FieldTag::__default_uri_disabled),
17476                            "urls" => Ok(__FieldTag::__urls),
17477                            "customAudiences" => Ok(__FieldTag::__custom_audiences),
17478                            "custom_audiences" => Ok(__FieldTag::__custom_audiences),
17479                            "observedGeneration" => Ok(__FieldTag::__observed_generation),
17480                            "observed_generation" => Ok(__FieldTag::__observed_generation),
17481                            "terminalCondition" => Ok(__FieldTag::__terminal_condition),
17482                            "terminal_condition" => Ok(__FieldTag::__terminal_condition),
17483                            "conditions" => Ok(__FieldTag::__conditions),
17484                            "latestReadyRevision" => Ok(__FieldTag::__latest_ready_revision),
17485                            "latest_ready_revision" => Ok(__FieldTag::__latest_ready_revision),
17486                            "latestCreatedRevision" => Ok(__FieldTag::__latest_created_revision),
17487                            "latest_created_revision" => Ok(__FieldTag::__latest_created_revision),
17488                            "trafficStatuses" => Ok(__FieldTag::__traffic_statuses),
17489                            "traffic_statuses" => Ok(__FieldTag::__traffic_statuses),
17490                            "uri" => Ok(__FieldTag::__uri),
17491                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
17492                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
17493                            "buildConfig" => Ok(__FieldTag::__build_config),
17494                            "build_config" => Ok(__FieldTag::__build_config),
17495                            "reconciling" => Ok(__FieldTag::__reconciling),
17496                            "etag" => Ok(__FieldTag::__etag),
17497                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17498                        }
17499                    }
17500                }
17501                deserializer.deserialize_identifier(Visitor)
17502            }
17503        }
17504        struct Visitor;
17505        impl<'de> serde::de::Visitor<'de> for Visitor {
17506            type Value = Service;
17507            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17508                formatter.write_str("struct Service")
17509            }
17510            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17511            where
17512                A: serde::de::MapAccess<'de>,
17513            {
17514                #[allow(unused_imports)]
17515                use serde::de::Error;
17516                use std::option::Option::Some;
17517                let mut fields = std::collections::HashSet::new();
17518                let mut result = Self::Value::new();
17519                while let Some(tag) = map.next_key::<__FieldTag>()? {
17520                    #[allow(clippy::match_single_binding)]
17521                    match tag {
17522                        __FieldTag::__name => {
17523                            if !fields.insert(__FieldTag::__name) {
17524                                return std::result::Result::Err(A::Error::duplicate_field(
17525                                    "multiple values for name",
17526                                ));
17527                            }
17528                            result.name = map
17529                                .next_value::<std::option::Option<std::string::String>>()?
17530                                .unwrap_or_default();
17531                        }
17532                        __FieldTag::__description => {
17533                            if !fields.insert(__FieldTag::__description) {
17534                                return std::result::Result::Err(A::Error::duplicate_field(
17535                                    "multiple values for description",
17536                                ));
17537                            }
17538                            result.description = map
17539                                .next_value::<std::option::Option<std::string::String>>()?
17540                                .unwrap_or_default();
17541                        }
17542                        __FieldTag::__uid => {
17543                            if !fields.insert(__FieldTag::__uid) {
17544                                return std::result::Result::Err(A::Error::duplicate_field(
17545                                    "multiple values for uid",
17546                                ));
17547                            }
17548                            result.uid = map
17549                                .next_value::<std::option::Option<std::string::String>>()?
17550                                .unwrap_or_default();
17551                        }
17552                        __FieldTag::__generation => {
17553                            if !fields.insert(__FieldTag::__generation) {
17554                                return std::result::Result::Err(A::Error::duplicate_field(
17555                                    "multiple values for generation",
17556                                ));
17557                            }
17558                            struct __With(std::option::Option<i64>);
17559                            impl<'de> serde::de::Deserialize<'de> for __With {
17560                                fn deserialize<D>(
17561                                    deserializer: D,
17562                                ) -> std::result::Result<Self, D::Error>
17563                                where
17564                                    D: serde::de::Deserializer<'de>,
17565                                {
17566                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
17567                                }
17568                            }
17569                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
17570                        }
17571                        __FieldTag::__labels => {
17572                            if !fields.insert(__FieldTag::__labels) {
17573                                return std::result::Result::Err(A::Error::duplicate_field(
17574                                    "multiple values for labels",
17575                                ));
17576                            }
17577                            result.labels = map
17578                                .next_value::<std::option::Option<
17579                                    std::collections::HashMap<
17580                                        std::string::String,
17581                                        std::string::String,
17582                                    >,
17583                                >>()?
17584                                .unwrap_or_default();
17585                        }
17586                        __FieldTag::__annotations => {
17587                            if !fields.insert(__FieldTag::__annotations) {
17588                                return std::result::Result::Err(A::Error::duplicate_field(
17589                                    "multiple values for annotations",
17590                                ));
17591                            }
17592                            result.annotations = map
17593                                .next_value::<std::option::Option<
17594                                    std::collections::HashMap<
17595                                        std::string::String,
17596                                        std::string::String,
17597                                    >,
17598                                >>()?
17599                                .unwrap_or_default();
17600                        }
17601                        __FieldTag::__create_time => {
17602                            if !fields.insert(__FieldTag::__create_time) {
17603                                return std::result::Result::Err(A::Error::duplicate_field(
17604                                    "multiple values for create_time",
17605                                ));
17606                            }
17607                            result.create_time =
17608                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17609                        }
17610                        __FieldTag::__update_time => {
17611                            if !fields.insert(__FieldTag::__update_time) {
17612                                return std::result::Result::Err(A::Error::duplicate_field(
17613                                    "multiple values for update_time",
17614                                ));
17615                            }
17616                            result.update_time =
17617                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17618                        }
17619                        __FieldTag::__delete_time => {
17620                            if !fields.insert(__FieldTag::__delete_time) {
17621                                return std::result::Result::Err(A::Error::duplicate_field(
17622                                    "multiple values for delete_time",
17623                                ));
17624                            }
17625                            result.delete_time =
17626                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17627                        }
17628                        __FieldTag::__expire_time => {
17629                            if !fields.insert(__FieldTag::__expire_time) {
17630                                return std::result::Result::Err(A::Error::duplicate_field(
17631                                    "multiple values for expire_time",
17632                                ));
17633                            }
17634                            result.expire_time =
17635                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17636                        }
17637                        __FieldTag::__creator => {
17638                            if !fields.insert(__FieldTag::__creator) {
17639                                return std::result::Result::Err(A::Error::duplicate_field(
17640                                    "multiple values for creator",
17641                                ));
17642                            }
17643                            result.creator = map
17644                                .next_value::<std::option::Option<std::string::String>>()?
17645                                .unwrap_or_default();
17646                        }
17647                        __FieldTag::__last_modifier => {
17648                            if !fields.insert(__FieldTag::__last_modifier) {
17649                                return std::result::Result::Err(A::Error::duplicate_field(
17650                                    "multiple values for last_modifier",
17651                                ));
17652                            }
17653                            result.last_modifier = map
17654                                .next_value::<std::option::Option<std::string::String>>()?
17655                                .unwrap_or_default();
17656                        }
17657                        __FieldTag::__client => {
17658                            if !fields.insert(__FieldTag::__client) {
17659                                return std::result::Result::Err(A::Error::duplicate_field(
17660                                    "multiple values for client",
17661                                ));
17662                            }
17663                            result.client = map
17664                                .next_value::<std::option::Option<std::string::String>>()?
17665                                .unwrap_or_default();
17666                        }
17667                        __FieldTag::__client_version => {
17668                            if !fields.insert(__FieldTag::__client_version) {
17669                                return std::result::Result::Err(A::Error::duplicate_field(
17670                                    "multiple values for client_version",
17671                                ));
17672                            }
17673                            result.client_version = map
17674                                .next_value::<std::option::Option<std::string::String>>()?
17675                                .unwrap_or_default();
17676                        }
17677                        __FieldTag::__ingress => {
17678                            if !fields.insert(__FieldTag::__ingress) {
17679                                return std::result::Result::Err(A::Error::duplicate_field(
17680                                    "multiple values for ingress",
17681                                ));
17682                            }
17683                            result.ingress = map
17684                                .next_value::<std::option::Option<crate::model::IngressTraffic>>()?
17685                                .unwrap_or_default();
17686                        }
17687                        __FieldTag::__launch_stage => {
17688                            if !fields.insert(__FieldTag::__launch_stage) {
17689                                return std::result::Result::Err(A::Error::duplicate_field(
17690                                    "multiple values for launch_stage",
17691                                ));
17692                            }
17693                            result.launch_stage = map
17694                                .next_value::<std::option::Option<api::model::LaunchStage>>()?
17695                                .unwrap_or_default();
17696                        }
17697                        __FieldTag::__binary_authorization => {
17698                            if !fields.insert(__FieldTag::__binary_authorization) {
17699                                return std::result::Result::Err(A::Error::duplicate_field(
17700                                    "multiple values for binary_authorization",
17701                                ));
17702                            }
17703                            result.binary_authorization = map.next_value::<std::option::Option<crate::model::BinaryAuthorization>>()?
17704                                ;
17705                        }
17706                        __FieldTag::__template => {
17707                            if !fields.insert(__FieldTag::__template) {
17708                                return std::result::Result::Err(A::Error::duplicate_field(
17709                                    "multiple values for template",
17710                                ));
17711                            }
17712                            result.template = map
17713                                .next_value::<std::option::Option<crate::model::RevisionTemplate>>(
17714                                )?;
17715                        }
17716                        __FieldTag::__traffic => {
17717                            if !fields.insert(__FieldTag::__traffic) {
17718                                return std::result::Result::Err(A::Error::duplicate_field(
17719                                    "multiple values for traffic",
17720                                ));
17721                            }
17722                            result.traffic = map.next_value::<std::option::Option<std::vec::Vec<crate::model::TrafficTarget>>>()?.unwrap_or_default();
17723                        }
17724                        __FieldTag::__scaling => {
17725                            if !fields.insert(__FieldTag::__scaling) {
17726                                return std::result::Result::Err(A::Error::duplicate_field(
17727                                    "multiple values for scaling",
17728                                ));
17729                            }
17730                            result.scaling = map
17731                                .next_value::<std::option::Option<crate::model::ServiceScaling>>(
17732                                )?;
17733                        }
17734                        __FieldTag::__invoker_iam_disabled => {
17735                            if !fields.insert(__FieldTag::__invoker_iam_disabled) {
17736                                return std::result::Result::Err(A::Error::duplicate_field(
17737                                    "multiple values for invoker_iam_disabled",
17738                                ));
17739                            }
17740                            result.invoker_iam_disabled = map
17741                                .next_value::<std::option::Option<bool>>()?
17742                                .unwrap_or_default();
17743                        }
17744                        __FieldTag::__default_uri_disabled => {
17745                            if !fields.insert(__FieldTag::__default_uri_disabled) {
17746                                return std::result::Result::Err(A::Error::duplicate_field(
17747                                    "multiple values for default_uri_disabled",
17748                                ));
17749                            }
17750                            result.default_uri_disabled = map
17751                                .next_value::<std::option::Option<bool>>()?
17752                                .unwrap_or_default();
17753                        }
17754                        __FieldTag::__urls => {
17755                            if !fields.insert(__FieldTag::__urls) {
17756                                return std::result::Result::Err(A::Error::duplicate_field(
17757                                    "multiple values for urls",
17758                                ));
17759                            }
17760                            result.urls = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
17761                        }
17762                        __FieldTag::__custom_audiences => {
17763                            if !fields.insert(__FieldTag::__custom_audiences) {
17764                                return std::result::Result::Err(A::Error::duplicate_field(
17765                                    "multiple values for custom_audiences",
17766                                ));
17767                            }
17768                            result.custom_audiences = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
17769                        }
17770                        __FieldTag::__observed_generation => {
17771                            if !fields.insert(__FieldTag::__observed_generation) {
17772                                return std::result::Result::Err(A::Error::duplicate_field(
17773                                    "multiple values for observed_generation",
17774                                ));
17775                            }
17776                            struct __With(std::option::Option<i64>);
17777                            impl<'de> serde::de::Deserialize<'de> for __With {
17778                                fn deserialize<D>(
17779                                    deserializer: D,
17780                                ) -> std::result::Result<Self, D::Error>
17781                                where
17782                                    D: serde::de::Deserializer<'de>,
17783                                {
17784                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
17785                                }
17786                            }
17787                            result.observed_generation =
17788                                map.next_value::<__With>()?.0.unwrap_or_default();
17789                        }
17790                        __FieldTag::__terminal_condition => {
17791                            if !fields.insert(__FieldTag::__terminal_condition) {
17792                                return std::result::Result::Err(A::Error::duplicate_field(
17793                                    "multiple values for terminal_condition",
17794                                ));
17795                            }
17796                            result.terminal_condition =
17797                                map.next_value::<std::option::Option<crate::model::Condition>>()?;
17798                        }
17799                        __FieldTag::__conditions => {
17800                            if !fields.insert(__FieldTag::__conditions) {
17801                                return std::result::Result::Err(A::Error::duplicate_field(
17802                                    "multiple values for conditions",
17803                                ));
17804                            }
17805                            result.conditions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Condition>>>()?.unwrap_or_default();
17806                        }
17807                        __FieldTag::__latest_ready_revision => {
17808                            if !fields.insert(__FieldTag::__latest_ready_revision) {
17809                                return std::result::Result::Err(A::Error::duplicate_field(
17810                                    "multiple values for latest_ready_revision",
17811                                ));
17812                            }
17813                            result.latest_ready_revision = map
17814                                .next_value::<std::option::Option<std::string::String>>()?
17815                                .unwrap_or_default();
17816                        }
17817                        __FieldTag::__latest_created_revision => {
17818                            if !fields.insert(__FieldTag::__latest_created_revision) {
17819                                return std::result::Result::Err(A::Error::duplicate_field(
17820                                    "multiple values for latest_created_revision",
17821                                ));
17822                            }
17823                            result.latest_created_revision = map
17824                                .next_value::<std::option::Option<std::string::String>>()?
17825                                .unwrap_or_default();
17826                        }
17827                        __FieldTag::__traffic_statuses => {
17828                            if !fields.insert(__FieldTag::__traffic_statuses) {
17829                                return std::result::Result::Err(A::Error::duplicate_field(
17830                                    "multiple values for traffic_statuses",
17831                                ));
17832                            }
17833                            result.traffic_statuses = map
17834                                .next_value::<std::option::Option<
17835                                    std::vec::Vec<crate::model::TrafficTargetStatus>,
17836                                >>()?
17837                                .unwrap_or_default();
17838                        }
17839                        __FieldTag::__uri => {
17840                            if !fields.insert(__FieldTag::__uri) {
17841                                return std::result::Result::Err(A::Error::duplicate_field(
17842                                    "multiple values for uri",
17843                                ));
17844                            }
17845                            result.uri = map
17846                                .next_value::<std::option::Option<std::string::String>>()?
17847                                .unwrap_or_default();
17848                        }
17849                        __FieldTag::__satisfies_pzs => {
17850                            if !fields.insert(__FieldTag::__satisfies_pzs) {
17851                                return std::result::Result::Err(A::Error::duplicate_field(
17852                                    "multiple values for satisfies_pzs",
17853                                ));
17854                            }
17855                            result.satisfies_pzs = map
17856                                .next_value::<std::option::Option<bool>>()?
17857                                .unwrap_or_default();
17858                        }
17859                        __FieldTag::__build_config => {
17860                            if !fields.insert(__FieldTag::__build_config) {
17861                                return std::result::Result::Err(A::Error::duplicate_field(
17862                                    "multiple values for build_config",
17863                                ));
17864                            }
17865                            result.build_config =
17866                                map.next_value::<std::option::Option<crate::model::BuildConfig>>()?;
17867                        }
17868                        __FieldTag::__reconciling => {
17869                            if !fields.insert(__FieldTag::__reconciling) {
17870                                return std::result::Result::Err(A::Error::duplicate_field(
17871                                    "multiple values for reconciling",
17872                                ));
17873                            }
17874                            result.reconciling = map
17875                                .next_value::<std::option::Option<bool>>()?
17876                                .unwrap_or_default();
17877                        }
17878                        __FieldTag::__etag => {
17879                            if !fields.insert(__FieldTag::__etag) {
17880                                return std::result::Result::Err(A::Error::duplicate_field(
17881                                    "multiple values for etag",
17882                                ));
17883                            }
17884                            result.etag = map
17885                                .next_value::<std::option::Option<std::string::String>>()?
17886                                .unwrap_or_default();
17887                        }
17888                        __FieldTag::Unknown(key) => {
17889                            let value = map.next_value::<serde_json::Value>()?;
17890                            result._unknown_fields.insert(key, value);
17891                        }
17892                    }
17893                }
17894                std::result::Result::Ok(result)
17895            }
17896        }
17897        deserializer.deserialize_any(Visitor)
17898    }
17899}
17900
17901#[doc(hidden)]
17902impl serde::ser::Serialize for Service {
17903    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17904    where
17905        S: serde::ser::Serializer,
17906    {
17907        use serde::ser::SerializeMap;
17908        #[allow(unused_imports)]
17909        use std::option::Option::Some;
17910        let mut state = serializer.serialize_map(std::option::Option::None)?;
17911        if !self.name.is_empty() {
17912            state.serialize_entry("name", &self.name)?;
17913        }
17914        if !self.description.is_empty() {
17915            state.serialize_entry("description", &self.description)?;
17916        }
17917        if !self.uid.is_empty() {
17918            state.serialize_entry("uid", &self.uid)?;
17919        }
17920        if !wkt::internal::is_default(&self.generation) {
17921            struct __With<'a>(&'a i64);
17922            impl<'a> serde::ser::Serialize for __With<'a> {
17923                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17924                where
17925                    S: serde::ser::Serializer,
17926                {
17927                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
17928                }
17929            }
17930            state.serialize_entry("generation", &__With(&self.generation))?;
17931        }
17932        if !self.labels.is_empty() {
17933            state.serialize_entry("labels", &self.labels)?;
17934        }
17935        if !self.annotations.is_empty() {
17936            state.serialize_entry("annotations", &self.annotations)?;
17937        }
17938        if self.create_time.is_some() {
17939            state.serialize_entry("createTime", &self.create_time)?;
17940        }
17941        if self.update_time.is_some() {
17942            state.serialize_entry("updateTime", &self.update_time)?;
17943        }
17944        if self.delete_time.is_some() {
17945            state.serialize_entry("deleteTime", &self.delete_time)?;
17946        }
17947        if self.expire_time.is_some() {
17948            state.serialize_entry("expireTime", &self.expire_time)?;
17949        }
17950        if !self.creator.is_empty() {
17951            state.serialize_entry("creator", &self.creator)?;
17952        }
17953        if !self.last_modifier.is_empty() {
17954            state.serialize_entry("lastModifier", &self.last_modifier)?;
17955        }
17956        if !self.client.is_empty() {
17957            state.serialize_entry("client", &self.client)?;
17958        }
17959        if !self.client_version.is_empty() {
17960            state.serialize_entry("clientVersion", &self.client_version)?;
17961        }
17962        if !wkt::internal::is_default(&self.ingress) {
17963            state.serialize_entry("ingress", &self.ingress)?;
17964        }
17965        if !wkt::internal::is_default(&self.launch_stage) {
17966            state.serialize_entry("launchStage", &self.launch_stage)?;
17967        }
17968        if self.binary_authorization.is_some() {
17969            state.serialize_entry("binaryAuthorization", &self.binary_authorization)?;
17970        }
17971        if self.template.is_some() {
17972            state.serialize_entry("template", &self.template)?;
17973        }
17974        if !self.traffic.is_empty() {
17975            state.serialize_entry("traffic", &self.traffic)?;
17976        }
17977        if self.scaling.is_some() {
17978            state.serialize_entry("scaling", &self.scaling)?;
17979        }
17980        if !wkt::internal::is_default(&self.invoker_iam_disabled) {
17981            state.serialize_entry("invokerIamDisabled", &self.invoker_iam_disabled)?;
17982        }
17983        if !wkt::internal::is_default(&self.default_uri_disabled) {
17984            state.serialize_entry("defaultUriDisabled", &self.default_uri_disabled)?;
17985        }
17986        if !self.urls.is_empty() {
17987            state.serialize_entry("urls", &self.urls)?;
17988        }
17989        if !self.custom_audiences.is_empty() {
17990            state.serialize_entry("customAudiences", &self.custom_audiences)?;
17991        }
17992        if !wkt::internal::is_default(&self.observed_generation) {
17993            struct __With<'a>(&'a i64);
17994            impl<'a> serde::ser::Serialize for __With<'a> {
17995                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17996                where
17997                    S: serde::ser::Serializer,
17998                {
17999                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
18000                }
18001            }
18002            state.serialize_entry("observedGeneration", &__With(&self.observed_generation))?;
18003        }
18004        if self.terminal_condition.is_some() {
18005            state.serialize_entry("terminalCondition", &self.terminal_condition)?;
18006        }
18007        if !self.conditions.is_empty() {
18008            state.serialize_entry("conditions", &self.conditions)?;
18009        }
18010        if !self.latest_ready_revision.is_empty() {
18011            state.serialize_entry("latestReadyRevision", &self.latest_ready_revision)?;
18012        }
18013        if !self.latest_created_revision.is_empty() {
18014            state.serialize_entry("latestCreatedRevision", &self.latest_created_revision)?;
18015        }
18016        if !self.traffic_statuses.is_empty() {
18017            state.serialize_entry("trafficStatuses", &self.traffic_statuses)?;
18018        }
18019        if !self.uri.is_empty() {
18020            state.serialize_entry("uri", &self.uri)?;
18021        }
18022        if !wkt::internal::is_default(&self.satisfies_pzs) {
18023            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
18024        }
18025        if self.build_config.is_some() {
18026            state.serialize_entry("buildConfig", &self.build_config)?;
18027        }
18028        if !wkt::internal::is_default(&self.reconciling) {
18029            state.serialize_entry("reconciling", &self.reconciling)?;
18030        }
18031        if !self.etag.is_empty() {
18032            state.serialize_entry("etag", &self.etag)?;
18033        }
18034        if !self._unknown_fields.is_empty() {
18035            for (key, value) in self._unknown_fields.iter() {
18036                state.serialize_entry(key, &value)?;
18037            }
18038        }
18039        state.end()
18040    }
18041}
18042
18043/// Effective settings for the current revision
18044#[derive(Clone, Debug, Default, PartialEq)]
18045#[non_exhaustive]
18046pub struct RevisionScalingStatus {
18047    /// The current number of min instances provisioned for this revision.
18048    pub desired_min_instance_count: i32,
18049
18050    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18051}
18052
18053impl RevisionScalingStatus {
18054    pub fn new() -> Self {
18055        std::default::Default::default()
18056    }
18057
18058    /// Sets the value of [desired_min_instance_count][crate::model::RevisionScalingStatus::desired_min_instance_count].
18059    pub fn set_desired_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18060        self.desired_min_instance_count = v.into();
18061        self
18062    }
18063}
18064
18065impl wkt::message::Message for RevisionScalingStatus {
18066    fn typename() -> &'static str {
18067        "type.googleapis.com/google.cloud.run.v2.RevisionScalingStatus"
18068    }
18069}
18070
18071#[doc(hidden)]
18072impl<'de> serde::de::Deserialize<'de> for RevisionScalingStatus {
18073    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18074    where
18075        D: serde::Deserializer<'de>,
18076    {
18077        #[allow(non_camel_case_types)]
18078        #[doc(hidden)]
18079        #[derive(PartialEq, Eq, Hash)]
18080        enum __FieldTag {
18081            __desired_min_instance_count,
18082            Unknown(std::string::String),
18083        }
18084        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18085            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18086            where
18087                D: serde::Deserializer<'de>,
18088            {
18089                struct Visitor;
18090                impl<'de> serde::de::Visitor<'de> for Visitor {
18091                    type Value = __FieldTag;
18092                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18093                        formatter.write_str("a field name for RevisionScalingStatus")
18094                    }
18095                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18096                    where
18097                        E: serde::de::Error,
18098                    {
18099                        use std::result::Result::Ok;
18100                        use std::string::ToString;
18101                        match value {
18102                            "desiredMinInstanceCount" => {
18103                                Ok(__FieldTag::__desired_min_instance_count)
18104                            }
18105                            "desired_min_instance_count" => {
18106                                Ok(__FieldTag::__desired_min_instance_count)
18107                            }
18108                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18109                        }
18110                    }
18111                }
18112                deserializer.deserialize_identifier(Visitor)
18113            }
18114        }
18115        struct Visitor;
18116        impl<'de> serde::de::Visitor<'de> for Visitor {
18117            type Value = RevisionScalingStatus;
18118            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18119                formatter.write_str("struct RevisionScalingStatus")
18120            }
18121            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18122            where
18123                A: serde::de::MapAccess<'de>,
18124            {
18125                #[allow(unused_imports)]
18126                use serde::de::Error;
18127                use std::option::Option::Some;
18128                let mut fields = std::collections::HashSet::new();
18129                let mut result = Self::Value::new();
18130                while let Some(tag) = map.next_key::<__FieldTag>()? {
18131                    #[allow(clippy::match_single_binding)]
18132                    match tag {
18133                        __FieldTag::__desired_min_instance_count => {
18134                            if !fields.insert(__FieldTag::__desired_min_instance_count) {
18135                                return std::result::Result::Err(A::Error::duplicate_field(
18136                                    "multiple values for desired_min_instance_count",
18137                                ));
18138                            }
18139                            struct __With(std::option::Option<i32>);
18140                            impl<'de> serde::de::Deserialize<'de> for __With {
18141                                fn deserialize<D>(
18142                                    deserializer: D,
18143                                ) -> std::result::Result<Self, D::Error>
18144                                where
18145                                    D: serde::de::Deserializer<'de>,
18146                                {
18147                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
18148                                }
18149                            }
18150                            result.desired_min_instance_count =
18151                                map.next_value::<__With>()?.0.unwrap_or_default();
18152                        }
18153                        __FieldTag::Unknown(key) => {
18154                            let value = map.next_value::<serde_json::Value>()?;
18155                            result._unknown_fields.insert(key, value);
18156                        }
18157                    }
18158                }
18159                std::result::Result::Ok(result)
18160            }
18161        }
18162        deserializer.deserialize_any(Visitor)
18163    }
18164}
18165
18166#[doc(hidden)]
18167impl serde::ser::Serialize for RevisionScalingStatus {
18168    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18169    where
18170        S: serde::ser::Serializer,
18171    {
18172        use serde::ser::SerializeMap;
18173        #[allow(unused_imports)]
18174        use std::option::Option::Some;
18175        let mut state = serializer.serialize_map(std::option::Option::None)?;
18176        if !wkt::internal::is_default(&self.desired_min_instance_count) {
18177            struct __With<'a>(&'a i32);
18178            impl<'a> serde::ser::Serialize for __With<'a> {
18179                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18180                where
18181                    S: serde::ser::Serializer,
18182                {
18183                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
18184                }
18185            }
18186            state.serialize_entry(
18187                "desiredMinInstanceCount",
18188                &__With(&self.desired_min_instance_count),
18189            )?;
18190        }
18191        if !self._unknown_fields.is_empty() {
18192            for (key, value) in self._unknown_fields.iter() {
18193                state.serialize_entry(key, &value)?;
18194            }
18195        }
18196        state.end()
18197    }
18198}
18199
18200/// Request message for obtaining a Task by its full name.
18201#[derive(Clone, Debug, Default, PartialEq)]
18202#[non_exhaustive]
18203pub struct GetTaskRequest {
18204    /// Required. The full name of the Task.
18205    /// Format:
18206    /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
18207    pub name: std::string::String,
18208
18209    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18210}
18211
18212impl GetTaskRequest {
18213    pub fn new() -> Self {
18214        std::default::Default::default()
18215    }
18216
18217    /// Sets the value of [name][crate::model::GetTaskRequest::name].
18218    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18219        self.name = v.into();
18220        self
18221    }
18222}
18223
18224impl wkt::message::Message for GetTaskRequest {
18225    fn typename() -> &'static str {
18226        "type.googleapis.com/google.cloud.run.v2.GetTaskRequest"
18227    }
18228}
18229
18230#[doc(hidden)]
18231impl<'de> serde::de::Deserialize<'de> for GetTaskRequest {
18232    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18233    where
18234        D: serde::Deserializer<'de>,
18235    {
18236        #[allow(non_camel_case_types)]
18237        #[doc(hidden)]
18238        #[derive(PartialEq, Eq, Hash)]
18239        enum __FieldTag {
18240            __name,
18241            Unknown(std::string::String),
18242        }
18243        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18244            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18245            where
18246                D: serde::Deserializer<'de>,
18247            {
18248                struct Visitor;
18249                impl<'de> serde::de::Visitor<'de> for Visitor {
18250                    type Value = __FieldTag;
18251                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18252                        formatter.write_str("a field name for GetTaskRequest")
18253                    }
18254                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18255                    where
18256                        E: serde::de::Error,
18257                    {
18258                        use std::result::Result::Ok;
18259                        use std::string::ToString;
18260                        match value {
18261                            "name" => Ok(__FieldTag::__name),
18262                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18263                        }
18264                    }
18265                }
18266                deserializer.deserialize_identifier(Visitor)
18267            }
18268        }
18269        struct Visitor;
18270        impl<'de> serde::de::Visitor<'de> for Visitor {
18271            type Value = GetTaskRequest;
18272            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18273                formatter.write_str("struct GetTaskRequest")
18274            }
18275            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18276            where
18277                A: serde::de::MapAccess<'de>,
18278            {
18279                #[allow(unused_imports)]
18280                use serde::de::Error;
18281                use std::option::Option::Some;
18282                let mut fields = std::collections::HashSet::new();
18283                let mut result = Self::Value::new();
18284                while let Some(tag) = map.next_key::<__FieldTag>()? {
18285                    #[allow(clippy::match_single_binding)]
18286                    match tag {
18287                        __FieldTag::__name => {
18288                            if !fields.insert(__FieldTag::__name) {
18289                                return std::result::Result::Err(A::Error::duplicate_field(
18290                                    "multiple values for name",
18291                                ));
18292                            }
18293                            result.name = map
18294                                .next_value::<std::option::Option<std::string::String>>()?
18295                                .unwrap_or_default();
18296                        }
18297                        __FieldTag::Unknown(key) => {
18298                            let value = map.next_value::<serde_json::Value>()?;
18299                            result._unknown_fields.insert(key, value);
18300                        }
18301                    }
18302                }
18303                std::result::Result::Ok(result)
18304            }
18305        }
18306        deserializer.deserialize_any(Visitor)
18307    }
18308}
18309
18310#[doc(hidden)]
18311impl serde::ser::Serialize for GetTaskRequest {
18312    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18313    where
18314        S: serde::ser::Serializer,
18315    {
18316        use serde::ser::SerializeMap;
18317        #[allow(unused_imports)]
18318        use std::option::Option::Some;
18319        let mut state = serializer.serialize_map(std::option::Option::None)?;
18320        if !self.name.is_empty() {
18321            state.serialize_entry("name", &self.name)?;
18322        }
18323        if !self._unknown_fields.is_empty() {
18324            for (key, value) in self._unknown_fields.iter() {
18325                state.serialize_entry(key, &value)?;
18326            }
18327        }
18328        state.end()
18329    }
18330}
18331
18332/// Request message for retrieving a list of Tasks.
18333#[derive(Clone, Debug, Default, PartialEq)]
18334#[non_exhaustive]
18335pub struct ListTasksRequest {
18336    /// Required. The Execution from which the Tasks should be listed.
18337    /// To list all Tasks across Executions of a Job, use "-" instead of Execution
18338    /// name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
18339    /// projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
18340    pub parent: std::string::String,
18341
18342    /// Maximum number of Tasks to return in this call.
18343    pub page_size: i32,
18344
18345    /// A page token received from a previous call to ListTasks.
18346    /// All other parameters must match.
18347    pub page_token: std::string::String,
18348
18349    /// If true, returns deleted (but unexpired) resources along with active ones.
18350    pub show_deleted: bool,
18351
18352    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18353}
18354
18355impl ListTasksRequest {
18356    pub fn new() -> Self {
18357        std::default::Default::default()
18358    }
18359
18360    /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
18361    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18362        self.parent = v.into();
18363        self
18364    }
18365
18366    /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
18367    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18368        self.page_size = v.into();
18369        self
18370    }
18371
18372    /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
18373    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18374        self.page_token = v.into();
18375        self
18376    }
18377
18378    /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
18379    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18380        self.show_deleted = v.into();
18381        self
18382    }
18383}
18384
18385impl wkt::message::Message for ListTasksRequest {
18386    fn typename() -> &'static str {
18387        "type.googleapis.com/google.cloud.run.v2.ListTasksRequest"
18388    }
18389}
18390
18391#[doc(hidden)]
18392impl<'de> serde::de::Deserialize<'de> for ListTasksRequest {
18393    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18394    where
18395        D: serde::Deserializer<'de>,
18396    {
18397        #[allow(non_camel_case_types)]
18398        #[doc(hidden)]
18399        #[derive(PartialEq, Eq, Hash)]
18400        enum __FieldTag {
18401            __parent,
18402            __page_size,
18403            __page_token,
18404            __show_deleted,
18405            Unknown(std::string::String),
18406        }
18407        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18408            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18409            where
18410                D: serde::Deserializer<'de>,
18411            {
18412                struct Visitor;
18413                impl<'de> serde::de::Visitor<'de> for Visitor {
18414                    type Value = __FieldTag;
18415                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18416                        formatter.write_str("a field name for ListTasksRequest")
18417                    }
18418                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18419                    where
18420                        E: serde::de::Error,
18421                    {
18422                        use std::result::Result::Ok;
18423                        use std::string::ToString;
18424                        match value {
18425                            "parent" => Ok(__FieldTag::__parent),
18426                            "pageSize" => Ok(__FieldTag::__page_size),
18427                            "page_size" => Ok(__FieldTag::__page_size),
18428                            "pageToken" => Ok(__FieldTag::__page_token),
18429                            "page_token" => Ok(__FieldTag::__page_token),
18430                            "showDeleted" => Ok(__FieldTag::__show_deleted),
18431                            "show_deleted" => Ok(__FieldTag::__show_deleted),
18432                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18433                        }
18434                    }
18435                }
18436                deserializer.deserialize_identifier(Visitor)
18437            }
18438        }
18439        struct Visitor;
18440        impl<'de> serde::de::Visitor<'de> for Visitor {
18441            type Value = ListTasksRequest;
18442            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18443                formatter.write_str("struct ListTasksRequest")
18444            }
18445            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18446            where
18447                A: serde::de::MapAccess<'de>,
18448            {
18449                #[allow(unused_imports)]
18450                use serde::de::Error;
18451                use std::option::Option::Some;
18452                let mut fields = std::collections::HashSet::new();
18453                let mut result = Self::Value::new();
18454                while let Some(tag) = map.next_key::<__FieldTag>()? {
18455                    #[allow(clippy::match_single_binding)]
18456                    match tag {
18457                        __FieldTag::__parent => {
18458                            if !fields.insert(__FieldTag::__parent) {
18459                                return std::result::Result::Err(A::Error::duplicate_field(
18460                                    "multiple values for parent",
18461                                ));
18462                            }
18463                            result.parent = map
18464                                .next_value::<std::option::Option<std::string::String>>()?
18465                                .unwrap_or_default();
18466                        }
18467                        __FieldTag::__page_size => {
18468                            if !fields.insert(__FieldTag::__page_size) {
18469                                return std::result::Result::Err(A::Error::duplicate_field(
18470                                    "multiple values for page_size",
18471                                ));
18472                            }
18473                            struct __With(std::option::Option<i32>);
18474                            impl<'de> serde::de::Deserialize<'de> for __With {
18475                                fn deserialize<D>(
18476                                    deserializer: D,
18477                                ) -> std::result::Result<Self, D::Error>
18478                                where
18479                                    D: serde::de::Deserializer<'de>,
18480                                {
18481                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
18482                                }
18483                            }
18484                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
18485                        }
18486                        __FieldTag::__page_token => {
18487                            if !fields.insert(__FieldTag::__page_token) {
18488                                return std::result::Result::Err(A::Error::duplicate_field(
18489                                    "multiple values for page_token",
18490                                ));
18491                            }
18492                            result.page_token = map
18493                                .next_value::<std::option::Option<std::string::String>>()?
18494                                .unwrap_or_default();
18495                        }
18496                        __FieldTag::__show_deleted => {
18497                            if !fields.insert(__FieldTag::__show_deleted) {
18498                                return std::result::Result::Err(A::Error::duplicate_field(
18499                                    "multiple values for show_deleted",
18500                                ));
18501                            }
18502                            result.show_deleted = map
18503                                .next_value::<std::option::Option<bool>>()?
18504                                .unwrap_or_default();
18505                        }
18506                        __FieldTag::Unknown(key) => {
18507                            let value = map.next_value::<serde_json::Value>()?;
18508                            result._unknown_fields.insert(key, value);
18509                        }
18510                    }
18511                }
18512                std::result::Result::Ok(result)
18513            }
18514        }
18515        deserializer.deserialize_any(Visitor)
18516    }
18517}
18518
18519#[doc(hidden)]
18520impl serde::ser::Serialize for ListTasksRequest {
18521    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18522    where
18523        S: serde::ser::Serializer,
18524    {
18525        use serde::ser::SerializeMap;
18526        #[allow(unused_imports)]
18527        use std::option::Option::Some;
18528        let mut state = serializer.serialize_map(std::option::Option::None)?;
18529        if !self.parent.is_empty() {
18530            state.serialize_entry("parent", &self.parent)?;
18531        }
18532        if !wkt::internal::is_default(&self.page_size) {
18533            struct __With<'a>(&'a i32);
18534            impl<'a> serde::ser::Serialize for __With<'a> {
18535                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18536                where
18537                    S: serde::ser::Serializer,
18538                {
18539                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
18540                }
18541            }
18542            state.serialize_entry("pageSize", &__With(&self.page_size))?;
18543        }
18544        if !self.page_token.is_empty() {
18545            state.serialize_entry("pageToken", &self.page_token)?;
18546        }
18547        if !wkt::internal::is_default(&self.show_deleted) {
18548            state.serialize_entry("showDeleted", &self.show_deleted)?;
18549        }
18550        if !self._unknown_fields.is_empty() {
18551            for (key, value) in self._unknown_fields.iter() {
18552                state.serialize_entry(key, &value)?;
18553            }
18554        }
18555        state.end()
18556    }
18557}
18558
18559/// Response message containing a list of Tasks.
18560#[derive(Clone, Debug, Default, PartialEq)]
18561#[non_exhaustive]
18562pub struct ListTasksResponse {
18563    /// The resulting list of Tasks.
18564    pub tasks: std::vec::Vec<crate::model::Task>,
18565
18566    /// A token indicating there are more items than page_size. Use it in the next
18567    /// ListTasks request to continue.
18568    pub next_page_token: std::string::String,
18569
18570    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18571}
18572
18573impl ListTasksResponse {
18574    pub fn new() -> Self {
18575        std::default::Default::default()
18576    }
18577
18578    /// Sets the value of [tasks][crate::model::ListTasksResponse::tasks].
18579    pub fn set_tasks<T, V>(mut self, v: T) -> Self
18580    where
18581        T: std::iter::IntoIterator<Item = V>,
18582        V: std::convert::Into<crate::model::Task>,
18583    {
18584        use std::iter::Iterator;
18585        self.tasks = v.into_iter().map(|i| i.into()).collect();
18586        self
18587    }
18588
18589    /// Sets the value of [next_page_token][crate::model::ListTasksResponse::next_page_token].
18590    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18591        self.next_page_token = v.into();
18592        self
18593    }
18594}
18595
18596impl wkt::message::Message for ListTasksResponse {
18597    fn typename() -> &'static str {
18598        "type.googleapis.com/google.cloud.run.v2.ListTasksResponse"
18599    }
18600}
18601
18602#[doc(hidden)]
18603impl gax::paginator::internal::PageableResponse for ListTasksResponse {
18604    type PageItem = crate::model::Task;
18605
18606    fn items(self) -> std::vec::Vec<Self::PageItem> {
18607        self.tasks
18608    }
18609
18610    fn next_page_token(&self) -> std::string::String {
18611        use std::clone::Clone;
18612        self.next_page_token.clone()
18613    }
18614}
18615
18616#[doc(hidden)]
18617impl<'de> serde::de::Deserialize<'de> for ListTasksResponse {
18618    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18619    where
18620        D: serde::Deserializer<'de>,
18621    {
18622        #[allow(non_camel_case_types)]
18623        #[doc(hidden)]
18624        #[derive(PartialEq, Eq, Hash)]
18625        enum __FieldTag {
18626            __tasks,
18627            __next_page_token,
18628            Unknown(std::string::String),
18629        }
18630        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18631            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18632            where
18633                D: serde::Deserializer<'de>,
18634            {
18635                struct Visitor;
18636                impl<'de> serde::de::Visitor<'de> for Visitor {
18637                    type Value = __FieldTag;
18638                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18639                        formatter.write_str("a field name for ListTasksResponse")
18640                    }
18641                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18642                    where
18643                        E: serde::de::Error,
18644                    {
18645                        use std::result::Result::Ok;
18646                        use std::string::ToString;
18647                        match value {
18648                            "tasks" => Ok(__FieldTag::__tasks),
18649                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
18650                            "next_page_token" => Ok(__FieldTag::__next_page_token),
18651                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18652                        }
18653                    }
18654                }
18655                deserializer.deserialize_identifier(Visitor)
18656            }
18657        }
18658        struct Visitor;
18659        impl<'de> serde::de::Visitor<'de> for Visitor {
18660            type Value = ListTasksResponse;
18661            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18662                formatter.write_str("struct ListTasksResponse")
18663            }
18664            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18665            where
18666                A: serde::de::MapAccess<'de>,
18667            {
18668                #[allow(unused_imports)]
18669                use serde::de::Error;
18670                use std::option::Option::Some;
18671                let mut fields = std::collections::HashSet::new();
18672                let mut result = Self::Value::new();
18673                while let Some(tag) = map.next_key::<__FieldTag>()? {
18674                    #[allow(clippy::match_single_binding)]
18675                    match tag {
18676                        __FieldTag::__tasks => {
18677                            if !fields.insert(__FieldTag::__tasks) {
18678                                return std::result::Result::Err(A::Error::duplicate_field(
18679                                    "multiple values for tasks",
18680                                ));
18681                            }
18682                            result.tasks = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Task>>>()?.unwrap_or_default();
18683                        }
18684                        __FieldTag::__next_page_token => {
18685                            if !fields.insert(__FieldTag::__next_page_token) {
18686                                return std::result::Result::Err(A::Error::duplicate_field(
18687                                    "multiple values for next_page_token",
18688                                ));
18689                            }
18690                            result.next_page_token = map
18691                                .next_value::<std::option::Option<std::string::String>>()?
18692                                .unwrap_or_default();
18693                        }
18694                        __FieldTag::Unknown(key) => {
18695                            let value = map.next_value::<serde_json::Value>()?;
18696                            result._unknown_fields.insert(key, value);
18697                        }
18698                    }
18699                }
18700                std::result::Result::Ok(result)
18701            }
18702        }
18703        deserializer.deserialize_any(Visitor)
18704    }
18705}
18706
18707#[doc(hidden)]
18708impl serde::ser::Serialize for ListTasksResponse {
18709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18710    where
18711        S: serde::ser::Serializer,
18712    {
18713        use serde::ser::SerializeMap;
18714        #[allow(unused_imports)]
18715        use std::option::Option::Some;
18716        let mut state = serializer.serialize_map(std::option::Option::None)?;
18717        if !self.tasks.is_empty() {
18718            state.serialize_entry("tasks", &self.tasks)?;
18719        }
18720        if !self.next_page_token.is_empty() {
18721            state.serialize_entry("nextPageToken", &self.next_page_token)?;
18722        }
18723        if !self._unknown_fields.is_empty() {
18724            for (key, value) in self._unknown_fields.iter() {
18725                state.serialize_entry(key, &value)?;
18726            }
18727        }
18728        state.end()
18729    }
18730}
18731
18732/// Task represents a single run of a container to completion.
18733#[derive(Clone, Debug, Default, PartialEq)]
18734#[non_exhaustive]
18735pub struct Task {
18736    /// Output only. The unique name of this Task.
18737    pub name: std::string::String,
18738
18739    /// Output only. Server assigned unique identifier for the Task. The value is a
18740    /// UUID4 string and guaranteed to remain unchanged until the resource is
18741    /// deleted.
18742    pub uid: std::string::String,
18743
18744    /// Output only. A number that monotonically increases every time the user
18745    /// modifies the desired state.
18746    pub generation: i64,
18747
18748    /// Output only. Unstructured key value map that can be used to organize and
18749    /// categorize objects. User-provided labels are shared with Google's billing
18750    /// system, so they can be used to filter, or break down billing charges by
18751    /// team, component, environment, state, etc. For more information, visit
18752    /// <https://cloud.google.com/resource-manager/docs/creating-managing-labels> or
18753    /// <https://cloud.google.com/run/docs/configuring/labels>
18754    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18755
18756    /// Output only. Unstructured key value map that may
18757    /// be set by external tools to store and arbitrary metadata.
18758    /// They are not queryable and should be preserved
18759    /// when modifying objects.
18760    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
18761
18762    /// Output only. Represents time when the task was created by the system.
18763    /// It is not guaranteed to be set in happens-before order across separate
18764    /// operations.
18765    pub create_time: std::option::Option<wkt::Timestamp>,
18766
18767    /// Output only. Represents time when the task was scheduled to run by the
18768    /// system. It is not guaranteed to be set in happens-before order across
18769    /// separate operations.
18770    pub scheduled_time: std::option::Option<wkt::Timestamp>,
18771
18772    /// Output only. Represents time when the task started to run.
18773    /// It is not guaranteed to be set in happens-before order across separate
18774    /// operations.
18775    pub start_time: std::option::Option<wkt::Timestamp>,
18776
18777    /// Output only. Represents time when the Task was completed. It is not
18778    /// guaranteed to be set in happens-before order across separate operations.
18779    pub completion_time: std::option::Option<wkt::Timestamp>,
18780
18781    /// Output only. The last-modified time.
18782    pub update_time: std::option::Option<wkt::Timestamp>,
18783
18784    /// Output only. For a deleted resource, the deletion time. It is only
18785    /// populated as a response to a Delete request.
18786    pub delete_time: std::option::Option<wkt::Timestamp>,
18787
18788    /// Output only. For a deleted resource, the time after which it will be
18789    /// permamently deleted. It is only populated as a response to a Delete
18790    /// request.
18791    pub expire_time: std::option::Option<wkt::Timestamp>,
18792
18793    /// Output only. The name of the parent Job.
18794    pub job: std::string::String,
18795
18796    /// Output only. The name of the parent Execution.
18797    pub execution: std::string::String,
18798
18799    /// Holds the single container that defines the unit of execution for this
18800    /// task.
18801    pub containers: std::vec::Vec<crate::model::Container>,
18802
18803    /// A list of Volumes to make available to containers.
18804    pub volumes: std::vec::Vec<crate::model::Volume>,
18805
18806    /// Number of retries allowed per Task, before marking this Task failed.
18807    pub max_retries: i32,
18808
18809    /// Max allowed time duration the Task may be active before the system will
18810    /// actively try to mark it failed and kill associated containers. This applies
18811    /// per attempt of a task, meaning each retry can run for the full timeout.
18812    pub timeout: std::option::Option<wkt::Duration>,
18813
18814    /// Email address of the IAM service account associated with the Task of a
18815    /// Job. The service account represents the identity of the
18816    /// running task, and determines what permissions the task has. If
18817    /// not provided, the task will use the project's default service account.
18818    pub service_account: std::string::String,
18819
18820    /// The execution environment being used to host this Task.
18821    pub execution_environment: crate::model::ExecutionEnvironment,
18822
18823    /// Output only. Indicates whether the resource's reconciliation is still in
18824    /// progress. See comments in `Job.reconciling` for additional information on
18825    /// reconciliation process in Cloud Run.
18826    pub reconciling: bool,
18827
18828    /// Output only. The Condition of this Task, containing its readiness status,
18829    /// and detailed error information in case it did not reach the desired state.
18830    pub conditions: std::vec::Vec<crate::model::Condition>,
18831
18832    /// Output only. The generation of this Task. See comments in `Job.reconciling`
18833    /// for additional information on reconciliation process in Cloud Run.
18834    pub observed_generation: i64,
18835
18836    /// Output only. Index of the Task, unique per execution, and beginning at 0.
18837    pub index: i32,
18838
18839    /// Output only. The number of times this Task was retried.
18840    /// Tasks are retried when they fail up to the maxRetries limit.
18841    pub retried: i32,
18842
18843    /// Output only. Result of the last attempt of this Task.
18844    pub last_attempt_result: std::option::Option<crate::model::TaskAttemptResult>,
18845
18846    /// Output only. A reference to a customer managed encryption key (CMEK) to use
18847    /// to encrypt this container image. For more information, go to
18848    /// <https://cloud.google.com/run/docs/securing/using-cmek>
18849    pub encryption_key: std::string::String,
18850
18851    /// Output only. VPC Access configuration to use for this Task. For more
18852    /// information, visit
18853    /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
18854    pub vpc_access: std::option::Option<crate::model::VpcAccess>,
18855
18856    /// Output only. URI where logs for this execution can be found in Cloud
18857    /// Console.
18858    pub log_uri: std::string::String,
18859
18860    /// Output only. Reserved for future use.
18861    pub satisfies_pzs: bool,
18862
18863    /// Output only. The node selector for the task.
18864    pub node_selector: std::option::Option<crate::model::NodeSelector>,
18865
18866    /// Output only. A system-generated fingerprint for this version of the
18867    /// resource. May be used to detect modification conflict during updates.
18868    pub etag: std::string::String,
18869
18870    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18871}
18872
18873impl Task {
18874    pub fn new() -> Self {
18875        std::default::Default::default()
18876    }
18877
18878    /// Sets the value of [name][crate::model::Task::name].
18879    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18880        self.name = v.into();
18881        self
18882    }
18883
18884    /// Sets the value of [uid][crate::model::Task::uid].
18885    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18886        self.uid = v.into();
18887        self
18888    }
18889
18890    /// Sets the value of [generation][crate::model::Task::generation].
18891    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
18892        self.generation = v.into();
18893        self
18894    }
18895
18896    /// Sets the value of [labels][crate::model::Task::labels].
18897    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18898    where
18899        T: std::iter::IntoIterator<Item = (K, V)>,
18900        K: std::convert::Into<std::string::String>,
18901        V: std::convert::Into<std::string::String>,
18902    {
18903        use std::iter::Iterator;
18904        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18905        self
18906    }
18907
18908    /// Sets the value of [annotations][crate::model::Task::annotations].
18909    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
18910    where
18911        T: std::iter::IntoIterator<Item = (K, V)>,
18912        K: std::convert::Into<std::string::String>,
18913        V: std::convert::Into<std::string::String>,
18914    {
18915        use std::iter::Iterator;
18916        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18917        self
18918    }
18919
18920    /// Sets the value of [create_time][crate::model::Task::create_time].
18921    pub fn set_create_time<T>(mut self, v: T) -> Self
18922    where
18923        T: std::convert::Into<wkt::Timestamp>,
18924    {
18925        self.create_time = std::option::Option::Some(v.into());
18926        self
18927    }
18928
18929    /// Sets or clears the value of [create_time][crate::model::Task::create_time].
18930    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18931    where
18932        T: std::convert::Into<wkt::Timestamp>,
18933    {
18934        self.create_time = v.map(|x| x.into());
18935        self
18936    }
18937
18938    /// Sets the value of [scheduled_time][crate::model::Task::scheduled_time].
18939    pub fn set_scheduled_time<T>(mut self, v: T) -> Self
18940    where
18941        T: std::convert::Into<wkt::Timestamp>,
18942    {
18943        self.scheduled_time = std::option::Option::Some(v.into());
18944        self
18945    }
18946
18947    /// Sets or clears the value of [scheduled_time][crate::model::Task::scheduled_time].
18948    pub fn set_or_clear_scheduled_time<T>(mut self, v: std::option::Option<T>) -> Self
18949    where
18950        T: std::convert::Into<wkt::Timestamp>,
18951    {
18952        self.scheduled_time = v.map(|x| x.into());
18953        self
18954    }
18955
18956    /// Sets the value of [start_time][crate::model::Task::start_time].
18957    pub fn set_start_time<T>(mut self, v: T) -> Self
18958    where
18959        T: std::convert::Into<wkt::Timestamp>,
18960    {
18961        self.start_time = std::option::Option::Some(v.into());
18962        self
18963    }
18964
18965    /// Sets or clears the value of [start_time][crate::model::Task::start_time].
18966    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
18967    where
18968        T: std::convert::Into<wkt::Timestamp>,
18969    {
18970        self.start_time = v.map(|x| x.into());
18971        self
18972    }
18973
18974    /// Sets the value of [completion_time][crate::model::Task::completion_time].
18975    pub fn set_completion_time<T>(mut self, v: T) -> Self
18976    where
18977        T: std::convert::Into<wkt::Timestamp>,
18978    {
18979        self.completion_time = std::option::Option::Some(v.into());
18980        self
18981    }
18982
18983    /// Sets or clears the value of [completion_time][crate::model::Task::completion_time].
18984    pub fn set_or_clear_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
18985    where
18986        T: std::convert::Into<wkt::Timestamp>,
18987    {
18988        self.completion_time = v.map(|x| x.into());
18989        self
18990    }
18991
18992    /// Sets the value of [update_time][crate::model::Task::update_time].
18993    pub fn set_update_time<T>(mut self, v: T) -> Self
18994    where
18995        T: std::convert::Into<wkt::Timestamp>,
18996    {
18997        self.update_time = std::option::Option::Some(v.into());
18998        self
18999    }
19000
19001    /// Sets or clears the value of [update_time][crate::model::Task::update_time].
19002    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19003    where
19004        T: std::convert::Into<wkt::Timestamp>,
19005    {
19006        self.update_time = v.map(|x| x.into());
19007        self
19008    }
19009
19010    /// Sets the value of [delete_time][crate::model::Task::delete_time].
19011    pub fn set_delete_time<T>(mut self, v: T) -> Self
19012    where
19013        T: std::convert::Into<wkt::Timestamp>,
19014    {
19015        self.delete_time = std::option::Option::Some(v.into());
19016        self
19017    }
19018
19019    /// Sets or clears the value of [delete_time][crate::model::Task::delete_time].
19020    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
19021    where
19022        T: std::convert::Into<wkt::Timestamp>,
19023    {
19024        self.delete_time = v.map(|x| x.into());
19025        self
19026    }
19027
19028    /// Sets the value of [expire_time][crate::model::Task::expire_time].
19029    pub fn set_expire_time<T>(mut self, v: T) -> Self
19030    where
19031        T: std::convert::Into<wkt::Timestamp>,
19032    {
19033        self.expire_time = std::option::Option::Some(v.into());
19034        self
19035    }
19036
19037    /// Sets or clears the value of [expire_time][crate::model::Task::expire_time].
19038    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
19039    where
19040        T: std::convert::Into<wkt::Timestamp>,
19041    {
19042        self.expire_time = v.map(|x| x.into());
19043        self
19044    }
19045
19046    /// Sets the value of [job][crate::model::Task::job].
19047    pub fn set_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19048        self.job = v.into();
19049        self
19050    }
19051
19052    /// Sets the value of [execution][crate::model::Task::execution].
19053    pub fn set_execution<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19054        self.execution = v.into();
19055        self
19056    }
19057
19058    /// Sets the value of [containers][crate::model::Task::containers].
19059    pub fn set_containers<T, V>(mut self, v: T) -> Self
19060    where
19061        T: std::iter::IntoIterator<Item = V>,
19062        V: std::convert::Into<crate::model::Container>,
19063    {
19064        use std::iter::Iterator;
19065        self.containers = v.into_iter().map(|i| i.into()).collect();
19066        self
19067    }
19068
19069    /// Sets the value of [volumes][crate::model::Task::volumes].
19070    pub fn set_volumes<T, V>(mut self, v: T) -> Self
19071    where
19072        T: std::iter::IntoIterator<Item = V>,
19073        V: std::convert::Into<crate::model::Volume>,
19074    {
19075        use std::iter::Iterator;
19076        self.volumes = v.into_iter().map(|i| i.into()).collect();
19077        self
19078    }
19079
19080    /// Sets the value of [max_retries][crate::model::Task::max_retries].
19081    pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19082        self.max_retries = v.into();
19083        self
19084    }
19085
19086    /// Sets the value of [timeout][crate::model::Task::timeout].
19087    pub fn set_timeout<T>(mut self, v: T) -> Self
19088    where
19089        T: std::convert::Into<wkt::Duration>,
19090    {
19091        self.timeout = std::option::Option::Some(v.into());
19092        self
19093    }
19094
19095    /// Sets or clears the value of [timeout][crate::model::Task::timeout].
19096    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
19097    where
19098        T: std::convert::Into<wkt::Duration>,
19099    {
19100        self.timeout = v.map(|x| x.into());
19101        self
19102    }
19103
19104    /// Sets the value of [service_account][crate::model::Task::service_account].
19105    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19106        self.service_account = v.into();
19107        self
19108    }
19109
19110    /// Sets the value of [execution_environment][crate::model::Task::execution_environment].
19111    pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
19112        mut self,
19113        v: T,
19114    ) -> Self {
19115        self.execution_environment = v.into();
19116        self
19117    }
19118
19119    /// Sets the value of [reconciling][crate::model::Task::reconciling].
19120    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19121        self.reconciling = v.into();
19122        self
19123    }
19124
19125    /// Sets the value of [conditions][crate::model::Task::conditions].
19126    pub fn set_conditions<T, V>(mut self, v: T) -> Self
19127    where
19128        T: std::iter::IntoIterator<Item = V>,
19129        V: std::convert::Into<crate::model::Condition>,
19130    {
19131        use std::iter::Iterator;
19132        self.conditions = v.into_iter().map(|i| i.into()).collect();
19133        self
19134    }
19135
19136    /// Sets the value of [observed_generation][crate::model::Task::observed_generation].
19137    pub fn set_observed_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19138        self.observed_generation = v.into();
19139        self
19140    }
19141
19142    /// Sets the value of [index][crate::model::Task::index].
19143    pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19144        self.index = v.into();
19145        self
19146    }
19147
19148    /// Sets the value of [retried][crate::model::Task::retried].
19149    pub fn set_retried<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19150        self.retried = v.into();
19151        self
19152    }
19153
19154    /// Sets the value of [last_attempt_result][crate::model::Task::last_attempt_result].
19155    pub fn set_last_attempt_result<T>(mut self, v: T) -> Self
19156    where
19157        T: std::convert::Into<crate::model::TaskAttemptResult>,
19158    {
19159        self.last_attempt_result = std::option::Option::Some(v.into());
19160        self
19161    }
19162
19163    /// Sets or clears the value of [last_attempt_result][crate::model::Task::last_attempt_result].
19164    pub fn set_or_clear_last_attempt_result<T>(mut self, v: std::option::Option<T>) -> Self
19165    where
19166        T: std::convert::Into<crate::model::TaskAttemptResult>,
19167    {
19168        self.last_attempt_result = v.map(|x| x.into());
19169        self
19170    }
19171
19172    /// Sets the value of [encryption_key][crate::model::Task::encryption_key].
19173    pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19174        self.encryption_key = v.into();
19175        self
19176    }
19177
19178    /// Sets the value of [vpc_access][crate::model::Task::vpc_access].
19179    pub fn set_vpc_access<T>(mut self, v: T) -> Self
19180    where
19181        T: std::convert::Into<crate::model::VpcAccess>,
19182    {
19183        self.vpc_access = std::option::Option::Some(v.into());
19184        self
19185    }
19186
19187    /// Sets or clears the value of [vpc_access][crate::model::Task::vpc_access].
19188    pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
19189    where
19190        T: std::convert::Into<crate::model::VpcAccess>,
19191    {
19192        self.vpc_access = v.map(|x| x.into());
19193        self
19194    }
19195
19196    /// Sets the value of [log_uri][crate::model::Task::log_uri].
19197    pub fn set_log_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19198        self.log_uri = v.into();
19199        self
19200    }
19201
19202    /// Sets the value of [satisfies_pzs][crate::model::Task::satisfies_pzs].
19203    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19204        self.satisfies_pzs = v.into();
19205        self
19206    }
19207
19208    /// Sets the value of [node_selector][crate::model::Task::node_selector].
19209    pub fn set_node_selector<T>(mut self, v: T) -> Self
19210    where
19211        T: std::convert::Into<crate::model::NodeSelector>,
19212    {
19213        self.node_selector = std::option::Option::Some(v.into());
19214        self
19215    }
19216
19217    /// Sets or clears the value of [node_selector][crate::model::Task::node_selector].
19218    pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
19219    where
19220        T: std::convert::Into<crate::model::NodeSelector>,
19221    {
19222        self.node_selector = v.map(|x| x.into());
19223        self
19224    }
19225
19226    /// Sets the value of [etag][crate::model::Task::etag].
19227    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19228        self.etag = v.into();
19229        self
19230    }
19231}
19232
19233impl wkt::message::Message for Task {
19234    fn typename() -> &'static str {
19235        "type.googleapis.com/google.cloud.run.v2.Task"
19236    }
19237}
19238
19239#[doc(hidden)]
19240impl<'de> serde::de::Deserialize<'de> for Task {
19241    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19242    where
19243        D: serde::Deserializer<'de>,
19244    {
19245        #[allow(non_camel_case_types)]
19246        #[doc(hidden)]
19247        #[derive(PartialEq, Eq, Hash)]
19248        enum __FieldTag {
19249            __name,
19250            __uid,
19251            __generation,
19252            __labels,
19253            __annotations,
19254            __create_time,
19255            __scheduled_time,
19256            __start_time,
19257            __completion_time,
19258            __update_time,
19259            __delete_time,
19260            __expire_time,
19261            __job,
19262            __execution,
19263            __containers,
19264            __volumes,
19265            __max_retries,
19266            __timeout,
19267            __service_account,
19268            __execution_environment,
19269            __reconciling,
19270            __conditions,
19271            __observed_generation,
19272            __index,
19273            __retried,
19274            __last_attempt_result,
19275            __encryption_key,
19276            __vpc_access,
19277            __log_uri,
19278            __satisfies_pzs,
19279            __node_selector,
19280            __etag,
19281            Unknown(std::string::String),
19282        }
19283        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19284            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19285            where
19286                D: serde::Deserializer<'de>,
19287            {
19288                struct Visitor;
19289                impl<'de> serde::de::Visitor<'de> for Visitor {
19290                    type Value = __FieldTag;
19291                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19292                        formatter.write_str("a field name for Task")
19293                    }
19294                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19295                    where
19296                        E: serde::de::Error,
19297                    {
19298                        use std::result::Result::Ok;
19299                        use std::string::ToString;
19300                        match value {
19301                            "name" => Ok(__FieldTag::__name),
19302                            "uid" => Ok(__FieldTag::__uid),
19303                            "generation" => Ok(__FieldTag::__generation),
19304                            "labels" => Ok(__FieldTag::__labels),
19305                            "annotations" => Ok(__FieldTag::__annotations),
19306                            "createTime" => Ok(__FieldTag::__create_time),
19307                            "create_time" => Ok(__FieldTag::__create_time),
19308                            "scheduledTime" => Ok(__FieldTag::__scheduled_time),
19309                            "scheduled_time" => Ok(__FieldTag::__scheduled_time),
19310                            "startTime" => Ok(__FieldTag::__start_time),
19311                            "start_time" => Ok(__FieldTag::__start_time),
19312                            "completionTime" => Ok(__FieldTag::__completion_time),
19313                            "completion_time" => Ok(__FieldTag::__completion_time),
19314                            "updateTime" => Ok(__FieldTag::__update_time),
19315                            "update_time" => Ok(__FieldTag::__update_time),
19316                            "deleteTime" => Ok(__FieldTag::__delete_time),
19317                            "delete_time" => Ok(__FieldTag::__delete_time),
19318                            "expireTime" => Ok(__FieldTag::__expire_time),
19319                            "expire_time" => Ok(__FieldTag::__expire_time),
19320                            "job" => Ok(__FieldTag::__job),
19321                            "execution" => Ok(__FieldTag::__execution),
19322                            "containers" => Ok(__FieldTag::__containers),
19323                            "volumes" => Ok(__FieldTag::__volumes),
19324                            "maxRetries" => Ok(__FieldTag::__max_retries),
19325                            "max_retries" => Ok(__FieldTag::__max_retries),
19326                            "timeout" => Ok(__FieldTag::__timeout),
19327                            "serviceAccount" => Ok(__FieldTag::__service_account),
19328                            "service_account" => Ok(__FieldTag::__service_account),
19329                            "executionEnvironment" => Ok(__FieldTag::__execution_environment),
19330                            "execution_environment" => Ok(__FieldTag::__execution_environment),
19331                            "reconciling" => Ok(__FieldTag::__reconciling),
19332                            "conditions" => Ok(__FieldTag::__conditions),
19333                            "observedGeneration" => Ok(__FieldTag::__observed_generation),
19334                            "observed_generation" => Ok(__FieldTag::__observed_generation),
19335                            "index" => Ok(__FieldTag::__index),
19336                            "retried" => Ok(__FieldTag::__retried),
19337                            "lastAttemptResult" => Ok(__FieldTag::__last_attempt_result),
19338                            "last_attempt_result" => Ok(__FieldTag::__last_attempt_result),
19339                            "encryptionKey" => Ok(__FieldTag::__encryption_key),
19340                            "encryption_key" => Ok(__FieldTag::__encryption_key),
19341                            "vpcAccess" => Ok(__FieldTag::__vpc_access),
19342                            "vpc_access" => Ok(__FieldTag::__vpc_access),
19343                            "logUri" => Ok(__FieldTag::__log_uri),
19344                            "log_uri" => Ok(__FieldTag::__log_uri),
19345                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
19346                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
19347                            "nodeSelector" => Ok(__FieldTag::__node_selector),
19348                            "node_selector" => Ok(__FieldTag::__node_selector),
19349                            "etag" => Ok(__FieldTag::__etag),
19350                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19351                        }
19352                    }
19353                }
19354                deserializer.deserialize_identifier(Visitor)
19355            }
19356        }
19357        struct Visitor;
19358        impl<'de> serde::de::Visitor<'de> for Visitor {
19359            type Value = Task;
19360            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19361                formatter.write_str("struct Task")
19362            }
19363            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19364            where
19365                A: serde::de::MapAccess<'de>,
19366            {
19367                #[allow(unused_imports)]
19368                use serde::de::Error;
19369                use std::option::Option::Some;
19370                let mut fields = std::collections::HashSet::new();
19371                let mut result = Self::Value::new();
19372                while let Some(tag) = map.next_key::<__FieldTag>()? {
19373                    #[allow(clippy::match_single_binding)]
19374                    match tag {
19375                        __FieldTag::__name => {
19376                            if !fields.insert(__FieldTag::__name) {
19377                                return std::result::Result::Err(A::Error::duplicate_field(
19378                                    "multiple values for name",
19379                                ));
19380                            }
19381                            result.name = map
19382                                .next_value::<std::option::Option<std::string::String>>()?
19383                                .unwrap_or_default();
19384                        }
19385                        __FieldTag::__uid => {
19386                            if !fields.insert(__FieldTag::__uid) {
19387                                return std::result::Result::Err(A::Error::duplicate_field(
19388                                    "multiple values for uid",
19389                                ));
19390                            }
19391                            result.uid = map
19392                                .next_value::<std::option::Option<std::string::String>>()?
19393                                .unwrap_or_default();
19394                        }
19395                        __FieldTag::__generation => {
19396                            if !fields.insert(__FieldTag::__generation) {
19397                                return std::result::Result::Err(A::Error::duplicate_field(
19398                                    "multiple values for generation",
19399                                ));
19400                            }
19401                            struct __With(std::option::Option<i64>);
19402                            impl<'de> serde::de::Deserialize<'de> for __With {
19403                                fn deserialize<D>(
19404                                    deserializer: D,
19405                                ) -> std::result::Result<Self, D::Error>
19406                                where
19407                                    D: serde::de::Deserializer<'de>,
19408                                {
19409                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
19410                                }
19411                            }
19412                            result.generation = map.next_value::<__With>()?.0.unwrap_or_default();
19413                        }
19414                        __FieldTag::__labels => {
19415                            if !fields.insert(__FieldTag::__labels) {
19416                                return std::result::Result::Err(A::Error::duplicate_field(
19417                                    "multiple values for labels",
19418                                ));
19419                            }
19420                            result.labels = map
19421                                .next_value::<std::option::Option<
19422                                    std::collections::HashMap<
19423                                        std::string::String,
19424                                        std::string::String,
19425                                    >,
19426                                >>()?
19427                                .unwrap_or_default();
19428                        }
19429                        __FieldTag::__annotations => {
19430                            if !fields.insert(__FieldTag::__annotations) {
19431                                return std::result::Result::Err(A::Error::duplicate_field(
19432                                    "multiple values for annotations",
19433                                ));
19434                            }
19435                            result.annotations = map
19436                                .next_value::<std::option::Option<
19437                                    std::collections::HashMap<
19438                                        std::string::String,
19439                                        std::string::String,
19440                                    >,
19441                                >>()?
19442                                .unwrap_or_default();
19443                        }
19444                        __FieldTag::__create_time => {
19445                            if !fields.insert(__FieldTag::__create_time) {
19446                                return std::result::Result::Err(A::Error::duplicate_field(
19447                                    "multiple values for create_time",
19448                                ));
19449                            }
19450                            result.create_time =
19451                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19452                        }
19453                        __FieldTag::__scheduled_time => {
19454                            if !fields.insert(__FieldTag::__scheduled_time) {
19455                                return std::result::Result::Err(A::Error::duplicate_field(
19456                                    "multiple values for scheduled_time",
19457                                ));
19458                            }
19459                            result.scheduled_time =
19460                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19461                        }
19462                        __FieldTag::__start_time => {
19463                            if !fields.insert(__FieldTag::__start_time) {
19464                                return std::result::Result::Err(A::Error::duplicate_field(
19465                                    "multiple values for start_time",
19466                                ));
19467                            }
19468                            result.start_time =
19469                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19470                        }
19471                        __FieldTag::__completion_time => {
19472                            if !fields.insert(__FieldTag::__completion_time) {
19473                                return std::result::Result::Err(A::Error::duplicate_field(
19474                                    "multiple values for completion_time",
19475                                ));
19476                            }
19477                            result.completion_time =
19478                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19479                        }
19480                        __FieldTag::__update_time => {
19481                            if !fields.insert(__FieldTag::__update_time) {
19482                                return std::result::Result::Err(A::Error::duplicate_field(
19483                                    "multiple values for update_time",
19484                                ));
19485                            }
19486                            result.update_time =
19487                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19488                        }
19489                        __FieldTag::__delete_time => {
19490                            if !fields.insert(__FieldTag::__delete_time) {
19491                                return std::result::Result::Err(A::Error::duplicate_field(
19492                                    "multiple values for delete_time",
19493                                ));
19494                            }
19495                            result.delete_time =
19496                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19497                        }
19498                        __FieldTag::__expire_time => {
19499                            if !fields.insert(__FieldTag::__expire_time) {
19500                                return std::result::Result::Err(A::Error::duplicate_field(
19501                                    "multiple values for expire_time",
19502                                ));
19503                            }
19504                            result.expire_time =
19505                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19506                        }
19507                        __FieldTag::__job => {
19508                            if !fields.insert(__FieldTag::__job) {
19509                                return std::result::Result::Err(A::Error::duplicate_field(
19510                                    "multiple values for job",
19511                                ));
19512                            }
19513                            result.job = map
19514                                .next_value::<std::option::Option<std::string::String>>()?
19515                                .unwrap_or_default();
19516                        }
19517                        __FieldTag::__execution => {
19518                            if !fields.insert(__FieldTag::__execution) {
19519                                return std::result::Result::Err(A::Error::duplicate_field(
19520                                    "multiple values for execution",
19521                                ));
19522                            }
19523                            result.execution = map
19524                                .next_value::<std::option::Option<std::string::String>>()?
19525                                .unwrap_or_default();
19526                        }
19527                        __FieldTag::__containers => {
19528                            if !fields.insert(__FieldTag::__containers) {
19529                                return std::result::Result::Err(A::Error::duplicate_field(
19530                                    "multiple values for containers",
19531                                ));
19532                            }
19533                            result.containers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Container>>>()?.unwrap_or_default();
19534                        }
19535                        __FieldTag::__volumes => {
19536                            if !fields.insert(__FieldTag::__volumes) {
19537                                return std::result::Result::Err(A::Error::duplicate_field(
19538                                    "multiple values for volumes",
19539                                ));
19540                            }
19541                            result.volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Volume>>>()?.unwrap_or_default();
19542                        }
19543                        __FieldTag::__max_retries => {
19544                            if !fields.insert(__FieldTag::__max_retries) {
19545                                return std::result::Result::Err(A::Error::duplicate_field(
19546                                    "multiple values for max_retries",
19547                                ));
19548                            }
19549                            struct __With(std::option::Option<i32>);
19550                            impl<'de> serde::de::Deserialize<'de> for __With {
19551                                fn deserialize<D>(
19552                                    deserializer: D,
19553                                ) -> std::result::Result<Self, D::Error>
19554                                where
19555                                    D: serde::de::Deserializer<'de>,
19556                                {
19557                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19558                                }
19559                            }
19560                            result.max_retries = map.next_value::<__With>()?.0.unwrap_or_default();
19561                        }
19562                        __FieldTag::__timeout => {
19563                            if !fields.insert(__FieldTag::__timeout) {
19564                                return std::result::Result::Err(A::Error::duplicate_field(
19565                                    "multiple values for timeout",
19566                                ));
19567                            }
19568                            result.timeout =
19569                                map.next_value::<std::option::Option<wkt::Duration>>()?;
19570                        }
19571                        __FieldTag::__service_account => {
19572                            if !fields.insert(__FieldTag::__service_account) {
19573                                return std::result::Result::Err(A::Error::duplicate_field(
19574                                    "multiple values for service_account",
19575                                ));
19576                            }
19577                            result.service_account = map
19578                                .next_value::<std::option::Option<std::string::String>>()?
19579                                .unwrap_or_default();
19580                        }
19581                        __FieldTag::__execution_environment => {
19582                            if !fields.insert(__FieldTag::__execution_environment) {
19583                                return std::result::Result::Err(A::Error::duplicate_field(
19584                                    "multiple values for execution_environment",
19585                                ));
19586                            }
19587                            result.execution_environment = map.next_value::<std::option::Option<crate::model::ExecutionEnvironment>>()?.unwrap_or_default();
19588                        }
19589                        __FieldTag::__reconciling => {
19590                            if !fields.insert(__FieldTag::__reconciling) {
19591                                return std::result::Result::Err(A::Error::duplicate_field(
19592                                    "multiple values for reconciling",
19593                                ));
19594                            }
19595                            result.reconciling = map
19596                                .next_value::<std::option::Option<bool>>()?
19597                                .unwrap_or_default();
19598                        }
19599                        __FieldTag::__conditions => {
19600                            if !fields.insert(__FieldTag::__conditions) {
19601                                return std::result::Result::Err(A::Error::duplicate_field(
19602                                    "multiple values for conditions",
19603                                ));
19604                            }
19605                            result.conditions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Condition>>>()?.unwrap_or_default();
19606                        }
19607                        __FieldTag::__observed_generation => {
19608                            if !fields.insert(__FieldTag::__observed_generation) {
19609                                return std::result::Result::Err(A::Error::duplicate_field(
19610                                    "multiple values for observed_generation",
19611                                ));
19612                            }
19613                            struct __With(std::option::Option<i64>);
19614                            impl<'de> serde::de::Deserialize<'de> for __With {
19615                                fn deserialize<D>(
19616                                    deserializer: D,
19617                                ) -> std::result::Result<Self, D::Error>
19618                                where
19619                                    D: serde::de::Deserializer<'de>,
19620                                {
19621                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
19622                                }
19623                            }
19624                            result.observed_generation =
19625                                map.next_value::<__With>()?.0.unwrap_or_default();
19626                        }
19627                        __FieldTag::__index => {
19628                            if !fields.insert(__FieldTag::__index) {
19629                                return std::result::Result::Err(A::Error::duplicate_field(
19630                                    "multiple values for index",
19631                                ));
19632                            }
19633                            struct __With(std::option::Option<i32>);
19634                            impl<'de> serde::de::Deserialize<'de> for __With {
19635                                fn deserialize<D>(
19636                                    deserializer: D,
19637                                ) -> std::result::Result<Self, D::Error>
19638                                where
19639                                    D: serde::de::Deserializer<'de>,
19640                                {
19641                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19642                                }
19643                            }
19644                            result.index = map.next_value::<__With>()?.0.unwrap_or_default();
19645                        }
19646                        __FieldTag::__retried => {
19647                            if !fields.insert(__FieldTag::__retried) {
19648                                return std::result::Result::Err(A::Error::duplicate_field(
19649                                    "multiple values for retried",
19650                                ));
19651                            }
19652                            struct __With(std::option::Option<i32>);
19653                            impl<'de> serde::de::Deserialize<'de> for __With {
19654                                fn deserialize<D>(
19655                                    deserializer: D,
19656                                ) -> std::result::Result<Self, D::Error>
19657                                where
19658                                    D: serde::de::Deserializer<'de>,
19659                                {
19660                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19661                                }
19662                            }
19663                            result.retried = map.next_value::<__With>()?.0.unwrap_or_default();
19664                        }
19665                        __FieldTag::__last_attempt_result => {
19666                            if !fields.insert(__FieldTag::__last_attempt_result) {
19667                                return std::result::Result::Err(A::Error::duplicate_field(
19668                                    "multiple values for last_attempt_result",
19669                                ));
19670                            }
19671                            result.last_attempt_result = map
19672                                .next_value::<std::option::Option<crate::model::TaskAttemptResult>>(
19673                                )?;
19674                        }
19675                        __FieldTag::__encryption_key => {
19676                            if !fields.insert(__FieldTag::__encryption_key) {
19677                                return std::result::Result::Err(A::Error::duplicate_field(
19678                                    "multiple values for encryption_key",
19679                                ));
19680                            }
19681                            result.encryption_key = map
19682                                .next_value::<std::option::Option<std::string::String>>()?
19683                                .unwrap_or_default();
19684                        }
19685                        __FieldTag::__vpc_access => {
19686                            if !fields.insert(__FieldTag::__vpc_access) {
19687                                return std::result::Result::Err(A::Error::duplicate_field(
19688                                    "multiple values for vpc_access",
19689                                ));
19690                            }
19691                            result.vpc_access =
19692                                map.next_value::<std::option::Option<crate::model::VpcAccess>>()?;
19693                        }
19694                        __FieldTag::__log_uri => {
19695                            if !fields.insert(__FieldTag::__log_uri) {
19696                                return std::result::Result::Err(A::Error::duplicate_field(
19697                                    "multiple values for log_uri",
19698                                ));
19699                            }
19700                            result.log_uri = map
19701                                .next_value::<std::option::Option<std::string::String>>()?
19702                                .unwrap_or_default();
19703                        }
19704                        __FieldTag::__satisfies_pzs => {
19705                            if !fields.insert(__FieldTag::__satisfies_pzs) {
19706                                return std::result::Result::Err(A::Error::duplicate_field(
19707                                    "multiple values for satisfies_pzs",
19708                                ));
19709                            }
19710                            result.satisfies_pzs = map
19711                                .next_value::<std::option::Option<bool>>()?
19712                                .unwrap_or_default();
19713                        }
19714                        __FieldTag::__node_selector => {
19715                            if !fields.insert(__FieldTag::__node_selector) {
19716                                return std::result::Result::Err(A::Error::duplicate_field(
19717                                    "multiple values for node_selector",
19718                                ));
19719                            }
19720                            result.node_selector = map
19721                                .next_value::<std::option::Option<crate::model::NodeSelector>>()?;
19722                        }
19723                        __FieldTag::__etag => {
19724                            if !fields.insert(__FieldTag::__etag) {
19725                                return std::result::Result::Err(A::Error::duplicate_field(
19726                                    "multiple values for etag",
19727                                ));
19728                            }
19729                            result.etag = map
19730                                .next_value::<std::option::Option<std::string::String>>()?
19731                                .unwrap_or_default();
19732                        }
19733                        __FieldTag::Unknown(key) => {
19734                            let value = map.next_value::<serde_json::Value>()?;
19735                            result._unknown_fields.insert(key, value);
19736                        }
19737                    }
19738                }
19739                std::result::Result::Ok(result)
19740            }
19741        }
19742        deserializer.deserialize_any(Visitor)
19743    }
19744}
19745
19746#[doc(hidden)]
19747impl serde::ser::Serialize for Task {
19748    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19749    where
19750        S: serde::ser::Serializer,
19751    {
19752        use serde::ser::SerializeMap;
19753        #[allow(unused_imports)]
19754        use std::option::Option::Some;
19755        let mut state = serializer.serialize_map(std::option::Option::None)?;
19756        if !self.name.is_empty() {
19757            state.serialize_entry("name", &self.name)?;
19758        }
19759        if !self.uid.is_empty() {
19760            state.serialize_entry("uid", &self.uid)?;
19761        }
19762        if !wkt::internal::is_default(&self.generation) {
19763            struct __With<'a>(&'a i64);
19764            impl<'a> serde::ser::Serialize for __With<'a> {
19765                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19766                where
19767                    S: serde::ser::Serializer,
19768                {
19769                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
19770                }
19771            }
19772            state.serialize_entry("generation", &__With(&self.generation))?;
19773        }
19774        if !self.labels.is_empty() {
19775            state.serialize_entry("labels", &self.labels)?;
19776        }
19777        if !self.annotations.is_empty() {
19778            state.serialize_entry("annotations", &self.annotations)?;
19779        }
19780        if self.create_time.is_some() {
19781            state.serialize_entry("createTime", &self.create_time)?;
19782        }
19783        if self.scheduled_time.is_some() {
19784            state.serialize_entry("scheduledTime", &self.scheduled_time)?;
19785        }
19786        if self.start_time.is_some() {
19787            state.serialize_entry("startTime", &self.start_time)?;
19788        }
19789        if self.completion_time.is_some() {
19790            state.serialize_entry("completionTime", &self.completion_time)?;
19791        }
19792        if self.update_time.is_some() {
19793            state.serialize_entry("updateTime", &self.update_time)?;
19794        }
19795        if self.delete_time.is_some() {
19796            state.serialize_entry("deleteTime", &self.delete_time)?;
19797        }
19798        if self.expire_time.is_some() {
19799            state.serialize_entry("expireTime", &self.expire_time)?;
19800        }
19801        if !self.job.is_empty() {
19802            state.serialize_entry("job", &self.job)?;
19803        }
19804        if !self.execution.is_empty() {
19805            state.serialize_entry("execution", &self.execution)?;
19806        }
19807        if !self.containers.is_empty() {
19808            state.serialize_entry("containers", &self.containers)?;
19809        }
19810        if !self.volumes.is_empty() {
19811            state.serialize_entry("volumes", &self.volumes)?;
19812        }
19813        if !wkt::internal::is_default(&self.max_retries) {
19814            struct __With<'a>(&'a i32);
19815            impl<'a> serde::ser::Serialize for __With<'a> {
19816                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19817                where
19818                    S: serde::ser::Serializer,
19819                {
19820                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19821                }
19822            }
19823            state.serialize_entry("maxRetries", &__With(&self.max_retries))?;
19824        }
19825        if self.timeout.is_some() {
19826            state.serialize_entry("timeout", &self.timeout)?;
19827        }
19828        if !self.service_account.is_empty() {
19829            state.serialize_entry("serviceAccount", &self.service_account)?;
19830        }
19831        if !wkt::internal::is_default(&self.execution_environment) {
19832            state.serialize_entry("executionEnvironment", &self.execution_environment)?;
19833        }
19834        if !wkt::internal::is_default(&self.reconciling) {
19835            state.serialize_entry("reconciling", &self.reconciling)?;
19836        }
19837        if !self.conditions.is_empty() {
19838            state.serialize_entry("conditions", &self.conditions)?;
19839        }
19840        if !wkt::internal::is_default(&self.observed_generation) {
19841            struct __With<'a>(&'a i64);
19842            impl<'a> serde::ser::Serialize for __With<'a> {
19843                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19844                where
19845                    S: serde::ser::Serializer,
19846                {
19847                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
19848                }
19849            }
19850            state.serialize_entry("observedGeneration", &__With(&self.observed_generation))?;
19851        }
19852        if !wkt::internal::is_default(&self.index) {
19853            struct __With<'a>(&'a i32);
19854            impl<'a> serde::ser::Serialize for __With<'a> {
19855                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19856                where
19857                    S: serde::ser::Serializer,
19858                {
19859                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19860                }
19861            }
19862            state.serialize_entry("index", &__With(&self.index))?;
19863        }
19864        if !wkt::internal::is_default(&self.retried) {
19865            struct __With<'a>(&'a i32);
19866            impl<'a> serde::ser::Serialize for __With<'a> {
19867                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19868                where
19869                    S: serde::ser::Serializer,
19870                {
19871                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19872                }
19873            }
19874            state.serialize_entry("retried", &__With(&self.retried))?;
19875        }
19876        if self.last_attempt_result.is_some() {
19877            state.serialize_entry("lastAttemptResult", &self.last_attempt_result)?;
19878        }
19879        if !self.encryption_key.is_empty() {
19880            state.serialize_entry("encryptionKey", &self.encryption_key)?;
19881        }
19882        if self.vpc_access.is_some() {
19883            state.serialize_entry("vpcAccess", &self.vpc_access)?;
19884        }
19885        if !self.log_uri.is_empty() {
19886            state.serialize_entry("logUri", &self.log_uri)?;
19887        }
19888        if !wkt::internal::is_default(&self.satisfies_pzs) {
19889            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
19890        }
19891        if self.node_selector.is_some() {
19892            state.serialize_entry("nodeSelector", &self.node_selector)?;
19893        }
19894        if !self.etag.is_empty() {
19895            state.serialize_entry("etag", &self.etag)?;
19896        }
19897        if !self._unknown_fields.is_empty() {
19898            for (key, value) in self._unknown_fields.iter() {
19899                state.serialize_entry(key, &value)?;
19900            }
19901        }
19902        state.end()
19903    }
19904}
19905
19906/// Result of a task attempt.
19907#[derive(Clone, Debug, Default, PartialEq)]
19908#[non_exhaustive]
19909pub struct TaskAttemptResult {
19910    /// Output only. The status of this attempt.
19911    /// If the status code is OK, then the attempt succeeded.
19912    pub status: std::option::Option<rpc::model::Status>,
19913
19914    /// Output only. The exit code of this attempt.
19915    /// This may be unset if the container was unable to exit cleanly with a code
19916    /// due to some other failure.
19917    /// See status field for possible failure details.
19918    pub exit_code: i32,
19919
19920    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19921}
19922
19923impl TaskAttemptResult {
19924    pub fn new() -> Self {
19925        std::default::Default::default()
19926    }
19927
19928    /// Sets the value of [status][crate::model::TaskAttemptResult::status].
19929    pub fn set_status<T>(mut self, v: T) -> Self
19930    where
19931        T: std::convert::Into<rpc::model::Status>,
19932    {
19933        self.status = std::option::Option::Some(v.into());
19934        self
19935    }
19936
19937    /// Sets or clears the value of [status][crate::model::TaskAttemptResult::status].
19938    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
19939    where
19940        T: std::convert::Into<rpc::model::Status>,
19941    {
19942        self.status = v.map(|x| x.into());
19943        self
19944    }
19945
19946    /// Sets the value of [exit_code][crate::model::TaskAttemptResult::exit_code].
19947    pub fn set_exit_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19948        self.exit_code = v.into();
19949        self
19950    }
19951}
19952
19953impl wkt::message::Message for TaskAttemptResult {
19954    fn typename() -> &'static str {
19955        "type.googleapis.com/google.cloud.run.v2.TaskAttemptResult"
19956    }
19957}
19958
19959#[doc(hidden)]
19960impl<'de> serde::de::Deserialize<'de> for TaskAttemptResult {
19961    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19962    where
19963        D: serde::Deserializer<'de>,
19964    {
19965        #[allow(non_camel_case_types)]
19966        #[doc(hidden)]
19967        #[derive(PartialEq, Eq, Hash)]
19968        enum __FieldTag {
19969            __status,
19970            __exit_code,
19971            Unknown(std::string::String),
19972        }
19973        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19974            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19975            where
19976                D: serde::Deserializer<'de>,
19977            {
19978                struct Visitor;
19979                impl<'de> serde::de::Visitor<'de> for Visitor {
19980                    type Value = __FieldTag;
19981                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19982                        formatter.write_str("a field name for TaskAttemptResult")
19983                    }
19984                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19985                    where
19986                        E: serde::de::Error,
19987                    {
19988                        use std::result::Result::Ok;
19989                        use std::string::ToString;
19990                        match value {
19991                            "status" => Ok(__FieldTag::__status),
19992                            "exitCode" => Ok(__FieldTag::__exit_code),
19993                            "exit_code" => Ok(__FieldTag::__exit_code),
19994                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19995                        }
19996                    }
19997                }
19998                deserializer.deserialize_identifier(Visitor)
19999            }
20000        }
20001        struct Visitor;
20002        impl<'de> serde::de::Visitor<'de> for Visitor {
20003            type Value = TaskAttemptResult;
20004            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20005                formatter.write_str("struct TaskAttemptResult")
20006            }
20007            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20008            where
20009                A: serde::de::MapAccess<'de>,
20010            {
20011                #[allow(unused_imports)]
20012                use serde::de::Error;
20013                use std::option::Option::Some;
20014                let mut fields = std::collections::HashSet::new();
20015                let mut result = Self::Value::new();
20016                while let Some(tag) = map.next_key::<__FieldTag>()? {
20017                    #[allow(clippy::match_single_binding)]
20018                    match tag {
20019                        __FieldTag::__status => {
20020                            if !fields.insert(__FieldTag::__status) {
20021                                return std::result::Result::Err(A::Error::duplicate_field(
20022                                    "multiple values for status",
20023                                ));
20024                            }
20025                            result.status =
20026                                map.next_value::<std::option::Option<rpc::model::Status>>()?;
20027                        }
20028                        __FieldTag::__exit_code => {
20029                            if !fields.insert(__FieldTag::__exit_code) {
20030                                return std::result::Result::Err(A::Error::duplicate_field(
20031                                    "multiple values for exit_code",
20032                                ));
20033                            }
20034                            struct __With(std::option::Option<i32>);
20035                            impl<'de> serde::de::Deserialize<'de> for __With {
20036                                fn deserialize<D>(
20037                                    deserializer: D,
20038                                ) -> std::result::Result<Self, D::Error>
20039                                where
20040                                    D: serde::de::Deserializer<'de>,
20041                                {
20042                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20043                                }
20044                            }
20045                            result.exit_code = map.next_value::<__With>()?.0.unwrap_or_default();
20046                        }
20047                        __FieldTag::Unknown(key) => {
20048                            let value = map.next_value::<serde_json::Value>()?;
20049                            result._unknown_fields.insert(key, value);
20050                        }
20051                    }
20052                }
20053                std::result::Result::Ok(result)
20054            }
20055        }
20056        deserializer.deserialize_any(Visitor)
20057    }
20058}
20059
20060#[doc(hidden)]
20061impl serde::ser::Serialize for TaskAttemptResult {
20062    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20063    where
20064        S: serde::ser::Serializer,
20065    {
20066        use serde::ser::SerializeMap;
20067        #[allow(unused_imports)]
20068        use std::option::Option::Some;
20069        let mut state = serializer.serialize_map(std::option::Option::None)?;
20070        if self.status.is_some() {
20071            state.serialize_entry("status", &self.status)?;
20072        }
20073        if !wkt::internal::is_default(&self.exit_code) {
20074            struct __With<'a>(&'a i32);
20075            impl<'a> serde::ser::Serialize for __With<'a> {
20076                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20077                where
20078                    S: serde::ser::Serializer,
20079                {
20080                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20081                }
20082            }
20083            state.serialize_entry("exitCode", &__With(&self.exit_code))?;
20084        }
20085        if !self._unknown_fields.is_empty() {
20086            for (key, value) in self._unknown_fields.iter() {
20087                state.serialize_entry(key, &value)?;
20088            }
20089        }
20090        state.end()
20091    }
20092}
20093
20094/// TaskTemplate describes the data a task should have when created
20095/// from a template.
20096#[derive(Clone, Debug, Default, PartialEq)]
20097#[non_exhaustive]
20098pub struct TaskTemplate {
20099    /// Holds the single container that defines the unit of execution for this
20100    /// task.
20101    pub containers: std::vec::Vec<crate::model::Container>,
20102
20103    /// Optional. A list of Volumes to make available to containers.
20104    pub volumes: std::vec::Vec<crate::model::Volume>,
20105
20106    /// Optional. Max allowed time duration the Task may be active before the
20107    /// system will actively try to mark it failed and kill associated containers.
20108    /// This applies per attempt of a task, meaning each retry can run for the full
20109    /// timeout. Defaults to 600 seconds.
20110    pub timeout: std::option::Option<wkt::Duration>,
20111
20112    /// Optional. Email address of the IAM service account associated with the Task
20113    /// of a Job. The service account represents the identity of the running task,
20114    /// and determines what permissions the task has. If not provided, the task
20115    /// will use the project's default service account.
20116    pub service_account: std::string::String,
20117
20118    /// Optional. The execution environment being used to host this Task.
20119    pub execution_environment: crate::model::ExecutionEnvironment,
20120
20121    /// A reference to a customer managed encryption key (CMEK) to use to encrypt
20122    /// this container image. For more information, go to
20123    /// <https://cloud.google.com/run/docs/securing/using-cmek>
20124    pub encryption_key: std::string::String,
20125
20126    /// Optional. VPC Access configuration to use for this Task. For more
20127    /// information, visit
20128    /// <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
20129    pub vpc_access: std::option::Option<crate::model::VpcAccess>,
20130
20131    /// Optional. The node selector for the task template.
20132    pub node_selector: std::option::Option<crate::model::NodeSelector>,
20133
20134    pub retries: std::option::Option<crate::model::task_template::Retries>,
20135
20136    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20137}
20138
20139impl TaskTemplate {
20140    pub fn new() -> Self {
20141        std::default::Default::default()
20142    }
20143
20144    /// Sets the value of [containers][crate::model::TaskTemplate::containers].
20145    pub fn set_containers<T, V>(mut self, v: T) -> Self
20146    where
20147        T: std::iter::IntoIterator<Item = V>,
20148        V: std::convert::Into<crate::model::Container>,
20149    {
20150        use std::iter::Iterator;
20151        self.containers = v.into_iter().map(|i| i.into()).collect();
20152        self
20153    }
20154
20155    /// Sets the value of [volumes][crate::model::TaskTemplate::volumes].
20156    pub fn set_volumes<T, V>(mut self, v: T) -> Self
20157    where
20158        T: std::iter::IntoIterator<Item = V>,
20159        V: std::convert::Into<crate::model::Volume>,
20160    {
20161        use std::iter::Iterator;
20162        self.volumes = v.into_iter().map(|i| i.into()).collect();
20163        self
20164    }
20165
20166    /// Sets the value of [timeout][crate::model::TaskTemplate::timeout].
20167    pub fn set_timeout<T>(mut self, v: T) -> Self
20168    where
20169        T: std::convert::Into<wkt::Duration>,
20170    {
20171        self.timeout = std::option::Option::Some(v.into());
20172        self
20173    }
20174
20175    /// Sets or clears the value of [timeout][crate::model::TaskTemplate::timeout].
20176    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
20177    where
20178        T: std::convert::Into<wkt::Duration>,
20179    {
20180        self.timeout = v.map(|x| x.into());
20181        self
20182    }
20183
20184    /// Sets the value of [service_account][crate::model::TaskTemplate::service_account].
20185    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20186        self.service_account = v.into();
20187        self
20188    }
20189
20190    /// Sets the value of [execution_environment][crate::model::TaskTemplate::execution_environment].
20191    pub fn set_execution_environment<T: std::convert::Into<crate::model::ExecutionEnvironment>>(
20192        mut self,
20193        v: T,
20194    ) -> Self {
20195        self.execution_environment = v.into();
20196        self
20197    }
20198
20199    /// Sets the value of [encryption_key][crate::model::TaskTemplate::encryption_key].
20200    pub fn set_encryption_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20201        self.encryption_key = v.into();
20202        self
20203    }
20204
20205    /// Sets the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
20206    pub fn set_vpc_access<T>(mut self, v: T) -> Self
20207    where
20208        T: std::convert::Into<crate::model::VpcAccess>,
20209    {
20210        self.vpc_access = std::option::Option::Some(v.into());
20211        self
20212    }
20213
20214    /// Sets or clears the value of [vpc_access][crate::model::TaskTemplate::vpc_access].
20215    pub fn set_or_clear_vpc_access<T>(mut self, v: std::option::Option<T>) -> Self
20216    where
20217        T: std::convert::Into<crate::model::VpcAccess>,
20218    {
20219        self.vpc_access = v.map(|x| x.into());
20220        self
20221    }
20222
20223    /// Sets the value of [node_selector][crate::model::TaskTemplate::node_selector].
20224    pub fn set_node_selector<T>(mut self, v: T) -> Self
20225    where
20226        T: std::convert::Into<crate::model::NodeSelector>,
20227    {
20228        self.node_selector = std::option::Option::Some(v.into());
20229        self
20230    }
20231
20232    /// Sets or clears the value of [node_selector][crate::model::TaskTemplate::node_selector].
20233    pub fn set_or_clear_node_selector<T>(mut self, v: std::option::Option<T>) -> Self
20234    where
20235        T: std::convert::Into<crate::model::NodeSelector>,
20236    {
20237        self.node_selector = v.map(|x| x.into());
20238        self
20239    }
20240
20241    /// Sets the value of [retries][crate::model::TaskTemplate::retries].
20242    ///
20243    /// Note that all the setters affecting `retries` are mutually
20244    /// exclusive.
20245    pub fn set_retries<
20246        T: std::convert::Into<std::option::Option<crate::model::task_template::Retries>>,
20247    >(
20248        mut self,
20249        v: T,
20250    ) -> Self {
20251        self.retries = v.into();
20252        self
20253    }
20254
20255    /// The value of [retries][crate::model::TaskTemplate::retries]
20256    /// if it holds a `MaxRetries`, `None` if the field is not set or
20257    /// holds a different branch.
20258    pub fn max_retries(&self) -> std::option::Option<&i32> {
20259        #[allow(unreachable_patterns)]
20260        self.retries.as_ref().and_then(|v| match v {
20261            crate::model::task_template::Retries::MaxRetries(v) => std::option::Option::Some(v),
20262            _ => std::option::Option::None,
20263        })
20264    }
20265
20266    /// Sets the value of [retries][crate::model::TaskTemplate::retries]
20267    /// to hold a `MaxRetries`.
20268    ///
20269    /// Note that all the setters affecting `retries` are
20270    /// mutually exclusive.
20271    pub fn set_max_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20272        self.retries =
20273            std::option::Option::Some(crate::model::task_template::Retries::MaxRetries(v.into()));
20274        self
20275    }
20276}
20277
20278impl wkt::message::Message for TaskTemplate {
20279    fn typename() -> &'static str {
20280        "type.googleapis.com/google.cloud.run.v2.TaskTemplate"
20281    }
20282}
20283
20284#[doc(hidden)]
20285impl<'de> serde::de::Deserialize<'de> for TaskTemplate {
20286    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20287    where
20288        D: serde::Deserializer<'de>,
20289    {
20290        #[allow(non_camel_case_types)]
20291        #[doc(hidden)]
20292        #[derive(PartialEq, Eq, Hash)]
20293        enum __FieldTag {
20294            __containers,
20295            __volumes,
20296            __max_retries,
20297            __timeout,
20298            __service_account,
20299            __execution_environment,
20300            __encryption_key,
20301            __vpc_access,
20302            __node_selector,
20303            Unknown(std::string::String),
20304        }
20305        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20306            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20307            where
20308                D: serde::Deserializer<'de>,
20309            {
20310                struct Visitor;
20311                impl<'de> serde::de::Visitor<'de> for Visitor {
20312                    type Value = __FieldTag;
20313                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20314                        formatter.write_str("a field name for TaskTemplate")
20315                    }
20316                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20317                    where
20318                        E: serde::de::Error,
20319                    {
20320                        use std::result::Result::Ok;
20321                        use std::string::ToString;
20322                        match value {
20323                            "containers" => Ok(__FieldTag::__containers),
20324                            "volumes" => Ok(__FieldTag::__volumes),
20325                            "maxRetries" => Ok(__FieldTag::__max_retries),
20326                            "max_retries" => Ok(__FieldTag::__max_retries),
20327                            "timeout" => Ok(__FieldTag::__timeout),
20328                            "serviceAccount" => Ok(__FieldTag::__service_account),
20329                            "service_account" => Ok(__FieldTag::__service_account),
20330                            "executionEnvironment" => Ok(__FieldTag::__execution_environment),
20331                            "execution_environment" => Ok(__FieldTag::__execution_environment),
20332                            "encryptionKey" => Ok(__FieldTag::__encryption_key),
20333                            "encryption_key" => Ok(__FieldTag::__encryption_key),
20334                            "vpcAccess" => Ok(__FieldTag::__vpc_access),
20335                            "vpc_access" => Ok(__FieldTag::__vpc_access),
20336                            "nodeSelector" => Ok(__FieldTag::__node_selector),
20337                            "node_selector" => Ok(__FieldTag::__node_selector),
20338                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20339                        }
20340                    }
20341                }
20342                deserializer.deserialize_identifier(Visitor)
20343            }
20344        }
20345        struct Visitor;
20346        impl<'de> serde::de::Visitor<'de> for Visitor {
20347            type Value = TaskTemplate;
20348            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20349                formatter.write_str("struct TaskTemplate")
20350            }
20351            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20352            where
20353                A: serde::de::MapAccess<'de>,
20354            {
20355                #[allow(unused_imports)]
20356                use serde::de::Error;
20357                use std::option::Option::Some;
20358                let mut fields = std::collections::HashSet::new();
20359                let mut result = Self::Value::new();
20360                while let Some(tag) = map.next_key::<__FieldTag>()? {
20361                    #[allow(clippy::match_single_binding)]
20362                    match tag {
20363                        __FieldTag::__containers => {
20364                            if !fields.insert(__FieldTag::__containers) {
20365                                return std::result::Result::Err(A::Error::duplicate_field(
20366                                    "multiple values for containers",
20367                                ));
20368                            }
20369                            result.containers = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Container>>>()?.unwrap_or_default();
20370                        }
20371                        __FieldTag::__volumes => {
20372                            if !fields.insert(__FieldTag::__volumes) {
20373                                return std::result::Result::Err(A::Error::duplicate_field(
20374                                    "multiple values for volumes",
20375                                ));
20376                            }
20377                            result.volumes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Volume>>>()?.unwrap_or_default();
20378                        }
20379                        __FieldTag::__max_retries => {
20380                            if !fields.insert(__FieldTag::__max_retries) {
20381                                return std::result::Result::Err(A::Error::duplicate_field(
20382                                    "multiple values for max_retries",
20383                                ));
20384                            }
20385                            struct __With(std::option::Option<i32>);
20386                            impl<'de> serde::de::Deserialize<'de> for __With {
20387                                fn deserialize<D>(
20388                                    deserializer: D,
20389                                ) -> std::result::Result<Self, D::Error>
20390                                where
20391                                    D: serde::de::Deserializer<'de>,
20392                                {
20393                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20394                                }
20395                            }
20396                            if result.retries.is_some() {
20397                                return std::result::Result::Err(A::Error::duplicate_field(
20398                                    "multiple values for `retries`, a oneof with full ID .google.cloud.run.v2.TaskTemplate.max_retries, latest field was maxRetries",
20399                                ));
20400                            }
20401                            result.retries = std::option::Option::Some(
20402                                crate::model::task_template::Retries::MaxRetries(
20403                                    map.next_value::<__With>()?.0.unwrap_or_default(),
20404                                ),
20405                            );
20406                        }
20407                        __FieldTag::__timeout => {
20408                            if !fields.insert(__FieldTag::__timeout) {
20409                                return std::result::Result::Err(A::Error::duplicate_field(
20410                                    "multiple values for timeout",
20411                                ));
20412                            }
20413                            result.timeout =
20414                                map.next_value::<std::option::Option<wkt::Duration>>()?;
20415                        }
20416                        __FieldTag::__service_account => {
20417                            if !fields.insert(__FieldTag::__service_account) {
20418                                return std::result::Result::Err(A::Error::duplicate_field(
20419                                    "multiple values for service_account",
20420                                ));
20421                            }
20422                            result.service_account = map
20423                                .next_value::<std::option::Option<std::string::String>>()?
20424                                .unwrap_or_default();
20425                        }
20426                        __FieldTag::__execution_environment => {
20427                            if !fields.insert(__FieldTag::__execution_environment) {
20428                                return std::result::Result::Err(A::Error::duplicate_field(
20429                                    "multiple values for execution_environment",
20430                                ));
20431                            }
20432                            result.execution_environment = map.next_value::<std::option::Option<crate::model::ExecutionEnvironment>>()?.unwrap_or_default();
20433                        }
20434                        __FieldTag::__encryption_key => {
20435                            if !fields.insert(__FieldTag::__encryption_key) {
20436                                return std::result::Result::Err(A::Error::duplicate_field(
20437                                    "multiple values for encryption_key",
20438                                ));
20439                            }
20440                            result.encryption_key = map
20441                                .next_value::<std::option::Option<std::string::String>>()?
20442                                .unwrap_or_default();
20443                        }
20444                        __FieldTag::__vpc_access => {
20445                            if !fields.insert(__FieldTag::__vpc_access) {
20446                                return std::result::Result::Err(A::Error::duplicate_field(
20447                                    "multiple values for vpc_access",
20448                                ));
20449                            }
20450                            result.vpc_access =
20451                                map.next_value::<std::option::Option<crate::model::VpcAccess>>()?;
20452                        }
20453                        __FieldTag::__node_selector => {
20454                            if !fields.insert(__FieldTag::__node_selector) {
20455                                return std::result::Result::Err(A::Error::duplicate_field(
20456                                    "multiple values for node_selector",
20457                                ));
20458                            }
20459                            result.node_selector = map
20460                                .next_value::<std::option::Option<crate::model::NodeSelector>>()?;
20461                        }
20462                        __FieldTag::Unknown(key) => {
20463                            let value = map.next_value::<serde_json::Value>()?;
20464                            result._unknown_fields.insert(key, value);
20465                        }
20466                    }
20467                }
20468                std::result::Result::Ok(result)
20469            }
20470        }
20471        deserializer.deserialize_any(Visitor)
20472    }
20473}
20474
20475#[doc(hidden)]
20476impl serde::ser::Serialize for TaskTemplate {
20477    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20478    where
20479        S: serde::ser::Serializer,
20480    {
20481        use serde::ser::SerializeMap;
20482        #[allow(unused_imports)]
20483        use std::option::Option::Some;
20484        let mut state = serializer.serialize_map(std::option::Option::None)?;
20485        if !self.containers.is_empty() {
20486            state.serialize_entry("containers", &self.containers)?;
20487        }
20488        if !self.volumes.is_empty() {
20489            state.serialize_entry("volumes", &self.volumes)?;
20490        }
20491        if let Some(value) = self.max_retries() {
20492            struct __With<'a>(&'a i32);
20493            impl<'a> serde::ser::Serialize for __With<'a> {
20494                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20495                where
20496                    S: serde::ser::Serializer,
20497                {
20498                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20499                }
20500            }
20501            state.serialize_entry("maxRetries", &__With(value))?;
20502        }
20503        if self.timeout.is_some() {
20504            state.serialize_entry("timeout", &self.timeout)?;
20505        }
20506        if !self.service_account.is_empty() {
20507            state.serialize_entry("serviceAccount", &self.service_account)?;
20508        }
20509        if !wkt::internal::is_default(&self.execution_environment) {
20510            state.serialize_entry("executionEnvironment", &self.execution_environment)?;
20511        }
20512        if !self.encryption_key.is_empty() {
20513            state.serialize_entry("encryptionKey", &self.encryption_key)?;
20514        }
20515        if self.vpc_access.is_some() {
20516            state.serialize_entry("vpcAccess", &self.vpc_access)?;
20517        }
20518        if self.node_selector.is_some() {
20519            state.serialize_entry("nodeSelector", &self.node_selector)?;
20520        }
20521        if !self._unknown_fields.is_empty() {
20522            for (key, value) in self._unknown_fields.iter() {
20523                state.serialize_entry(key, &value)?;
20524            }
20525        }
20526        state.end()
20527    }
20528}
20529
20530/// Defines additional types related to [TaskTemplate].
20531pub mod task_template {
20532    #[allow(unused_imports)]
20533    use super::*;
20534
20535    #[derive(Clone, Debug, PartialEq)]
20536    #[non_exhaustive]
20537    pub enum Retries {
20538        /// Number of retries allowed per Task, before marking this Task failed.
20539        /// Defaults to 3.
20540        MaxRetries(i32),
20541    }
20542}
20543
20544/// Holds a single traffic routing entry for the Service. Allocations can be done
20545/// to a specific Revision name, or pointing to the latest Ready Revision.
20546#[derive(Clone, Debug, Default, PartialEq)]
20547#[non_exhaustive]
20548pub struct TrafficTarget {
20549    /// The allocation type for this traffic target.
20550    pub r#type: crate::model::TrafficTargetAllocationType,
20551
20552    /// Revision to which to send this portion of traffic, if traffic allocation is
20553    /// by revision.
20554    pub revision: std::string::String,
20555
20556    /// Specifies percent of the traffic to this Revision.
20557    /// This defaults to zero if unspecified.
20558    pub percent: i32,
20559
20560    /// Indicates a string to be part of the URI to exclusively reference this
20561    /// target.
20562    pub tag: std::string::String,
20563
20564    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20565}
20566
20567impl TrafficTarget {
20568    pub fn new() -> Self {
20569        std::default::Default::default()
20570    }
20571
20572    /// Sets the value of [r#type][crate::model::TrafficTarget::type].
20573    pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
20574        mut self,
20575        v: T,
20576    ) -> Self {
20577        self.r#type = v.into();
20578        self
20579    }
20580
20581    /// Sets the value of [revision][crate::model::TrafficTarget::revision].
20582    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20583        self.revision = v.into();
20584        self
20585    }
20586
20587    /// Sets the value of [percent][crate::model::TrafficTarget::percent].
20588    pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20589        self.percent = v.into();
20590        self
20591    }
20592
20593    /// Sets the value of [tag][crate::model::TrafficTarget::tag].
20594    pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20595        self.tag = v.into();
20596        self
20597    }
20598}
20599
20600impl wkt::message::Message for TrafficTarget {
20601    fn typename() -> &'static str {
20602        "type.googleapis.com/google.cloud.run.v2.TrafficTarget"
20603    }
20604}
20605
20606#[doc(hidden)]
20607impl<'de> serde::de::Deserialize<'de> for TrafficTarget {
20608    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20609    where
20610        D: serde::Deserializer<'de>,
20611    {
20612        #[allow(non_camel_case_types)]
20613        #[doc(hidden)]
20614        #[derive(PartialEq, Eq, Hash)]
20615        enum __FieldTag {
20616            __type,
20617            __revision,
20618            __percent,
20619            __tag,
20620            Unknown(std::string::String),
20621        }
20622        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20623            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20624            where
20625                D: serde::Deserializer<'de>,
20626            {
20627                struct Visitor;
20628                impl<'de> serde::de::Visitor<'de> for Visitor {
20629                    type Value = __FieldTag;
20630                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20631                        formatter.write_str("a field name for TrafficTarget")
20632                    }
20633                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20634                    where
20635                        E: serde::de::Error,
20636                    {
20637                        use std::result::Result::Ok;
20638                        use std::string::ToString;
20639                        match value {
20640                            "type" => Ok(__FieldTag::__type),
20641                            "revision" => Ok(__FieldTag::__revision),
20642                            "percent" => Ok(__FieldTag::__percent),
20643                            "tag" => Ok(__FieldTag::__tag),
20644                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20645                        }
20646                    }
20647                }
20648                deserializer.deserialize_identifier(Visitor)
20649            }
20650        }
20651        struct Visitor;
20652        impl<'de> serde::de::Visitor<'de> for Visitor {
20653            type Value = TrafficTarget;
20654            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20655                formatter.write_str("struct TrafficTarget")
20656            }
20657            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20658            where
20659                A: serde::de::MapAccess<'de>,
20660            {
20661                #[allow(unused_imports)]
20662                use serde::de::Error;
20663                use std::option::Option::Some;
20664                let mut fields = std::collections::HashSet::new();
20665                let mut result = Self::Value::new();
20666                while let Some(tag) = map.next_key::<__FieldTag>()? {
20667                    #[allow(clippy::match_single_binding)]
20668                    match tag {
20669                        __FieldTag::__type => {
20670                            if !fields.insert(__FieldTag::__type) {
20671                                return std::result::Result::Err(A::Error::duplicate_field(
20672                                    "multiple values for type",
20673                                ));
20674                            }
20675                            result.r#type = map.next_value::<std::option::Option<crate::model::TrafficTargetAllocationType>>()?.unwrap_or_default();
20676                        }
20677                        __FieldTag::__revision => {
20678                            if !fields.insert(__FieldTag::__revision) {
20679                                return std::result::Result::Err(A::Error::duplicate_field(
20680                                    "multiple values for revision",
20681                                ));
20682                            }
20683                            result.revision = map
20684                                .next_value::<std::option::Option<std::string::String>>()?
20685                                .unwrap_or_default();
20686                        }
20687                        __FieldTag::__percent => {
20688                            if !fields.insert(__FieldTag::__percent) {
20689                                return std::result::Result::Err(A::Error::duplicate_field(
20690                                    "multiple values for percent",
20691                                ));
20692                            }
20693                            struct __With(std::option::Option<i32>);
20694                            impl<'de> serde::de::Deserialize<'de> for __With {
20695                                fn deserialize<D>(
20696                                    deserializer: D,
20697                                ) -> std::result::Result<Self, D::Error>
20698                                where
20699                                    D: serde::de::Deserializer<'de>,
20700                                {
20701                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20702                                }
20703                            }
20704                            result.percent = map.next_value::<__With>()?.0.unwrap_or_default();
20705                        }
20706                        __FieldTag::__tag => {
20707                            if !fields.insert(__FieldTag::__tag) {
20708                                return std::result::Result::Err(A::Error::duplicate_field(
20709                                    "multiple values for tag",
20710                                ));
20711                            }
20712                            result.tag = map
20713                                .next_value::<std::option::Option<std::string::String>>()?
20714                                .unwrap_or_default();
20715                        }
20716                        __FieldTag::Unknown(key) => {
20717                            let value = map.next_value::<serde_json::Value>()?;
20718                            result._unknown_fields.insert(key, value);
20719                        }
20720                    }
20721                }
20722                std::result::Result::Ok(result)
20723            }
20724        }
20725        deserializer.deserialize_any(Visitor)
20726    }
20727}
20728
20729#[doc(hidden)]
20730impl serde::ser::Serialize for TrafficTarget {
20731    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20732    where
20733        S: serde::ser::Serializer,
20734    {
20735        use serde::ser::SerializeMap;
20736        #[allow(unused_imports)]
20737        use std::option::Option::Some;
20738        let mut state = serializer.serialize_map(std::option::Option::None)?;
20739        if !wkt::internal::is_default(&self.r#type) {
20740            state.serialize_entry("type", &self.r#type)?;
20741        }
20742        if !self.revision.is_empty() {
20743            state.serialize_entry("revision", &self.revision)?;
20744        }
20745        if !wkt::internal::is_default(&self.percent) {
20746            struct __With<'a>(&'a i32);
20747            impl<'a> serde::ser::Serialize for __With<'a> {
20748                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20749                where
20750                    S: serde::ser::Serializer,
20751                {
20752                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20753                }
20754            }
20755            state.serialize_entry("percent", &__With(&self.percent))?;
20756        }
20757        if !self.tag.is_empty() {
20758            state.serialize_entry("tag", &self.tag)?;
20759        }
20760        if !self._unknown_fields.is_empty() {
20761            for (key, value) in self._unknown_fields.iter() {
20762                state.serialize_entry(key, &value)?;
20763            }
20764        }
20765        state.end()
20766    }
20767}
20768
20769/// Represents the observed state of a single `TrafficTarget` entry.
20770#[derive(Clone, Debug, Default, PartialEq)]
20771#[non_exhaustive]
20772pub struct TrafficTargetStatus {
20773    /// The allocation type for this traffic target.
20774    pub r#type: crate::model::TrafficTargetAllocationType,
20775
20776    /// Revision to which this traffic is sent.
20777    pub revision: std::string::String,
20778
20779    /// Specifies percent of the traffic to this Revision.
20780    pub percent: i32,
20781
20782    /// Indicates the string used in the URI to exclusively reference this target.
20783    pub tag: std::string::String,
20784
20785    /// Displays the target URI.
20786    pub uri: std::string::String,
20787
20788    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20789}
20790
20791impl TrafficTargetStatus {
20792    pub fn new() -> Self {
20793        std::default::Default::default()
20794    }
20795
20796    /// Sets the value of [r#type][crate::model::TrafficTargetStatus::type].
20797    pub fn set_type<T: std::convert::Into<crate::model::TrafficTargetAllocationType>>(
20798        mut self,
20799        v: T,
20800    ) -> Self {
20801        self.r#type = v.into();
20802        self
20803    }
20804
20805    /// Sets the value of [revision][crate::model::TrafficTargetStatus::revision].
20806    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20807        self.revision = v.into();
20808        self
20809    }
20810
20811    /// Sets the value of [percent][crate::model::TrafficTargetStatus::percent].
20812    pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20813        self.percent = v.into();
20814        self
20815    }
20816
20817    /// Sets the value of [tag][crate::model::TrafficTargetStatus::tag].
20818    pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20819        self.tag = v.into();
20820        self
20821    }
20822
20823    /// Sets the value of [uri][crate::model::TrafficTargetStatus::uri].
20824    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20825        self.uri = v.into();
20826        self
20827    }
20828}
20829
20830impl wkt::message::Message for TrafficTargetStatus {
20831    fn typename() -> &'static str {
20832        "type.googleapis.com/google.cloud.run.v2.TrafficTargetStatus"
20833    }
20834}
20835
20836#[doc(hidden)]
20837impl<'de> serde::de::Deserialize<'de> for TrafficTargetStatus {
20838    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20839    where
20840        D: serde::Deserializer<'de>,
20841    {
20842        #[allow(non_camel_case_types)]
20843        #[doc(hidden)]
20844        #[derive(PartialEq, Eq, Hash)]
20845        enum __FieldTag {
20846            __type,
20847            __revision,
20848            __percent,
20849            __tag,
20850            __uri,
20851            Unknown(std::string::String),
20852        }
20853        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20854            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20855            where
20856                D: serde::Deserializer<'de>,
20857            {
20858                struct Visitor;
20859                impl<'de> serde::de::Visitor<'de> for Visitor {
20860                    type Value = __FieldTag;
20861                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20862                        formatter.write_str("a field name for TrafficTargetStatus")
20863                    }
20864                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20865                    where
20866                        E: serde::de::Error,
20867                    {
20868                        use std::result::Result::Ok;
20869                        use std::string::ToString;
20870                        match value {
20871                            "type" => Ok(__FieldTag::__type),
20872                            "revision" => Ok(__FieldTag::__revision),
20873                            "percent" => Ok(__FieldTag::__percent),
20874                            "tag" => Ok(__FieldTag::__tag),
20875                            "uri" => Ok(__FieldTag::__uri),
20876                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20877                        }
20878                    }
20879                }
20880                deserializer.deserialize_identifier(Visitor)
20881            }
20882        }
20883        struct Visitor;
20884        impl<'de> serde::de::Visitor<'de> for Visitor {
20885            type Value = TrafficTargetStatus;
20886            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20887                formatter.write_str("struct TrafficTargetStatus")
20888            }
20889            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20890            where
20891                A: serde::de::MapAccess<'de>,
20892            {
20893                #[allow(unused_imports)]
20894                use serde::de::Error;
20895                use std::option::Option::Some;
20896                let mut fields = std::collections::HashSet::new();
20897                let mut result = Self::Value::new();
20898                while let Some(tag) = map.next_key::<__FieldTag>()? {
20899                    #[allow(clippy::match_single_binding)]
20900                    match tag {
20901                        __FieldTag::__type => {
20902                            if !fields.insert(__FieldTag::__type) {
20903                                return std::result::Result::Err(A::Error::duplicate_field(
20904                                    "multiple values for type",
20905                                ));
20906                            }
20907                            result.r#type = map.next_value::<std::option::Option<crate::model::TrafficTargetAllocationType>>()?.unwrap_or_default();
20908                        }
20909                        __FieldTag::__revision => {
20910                            if !fields.insert(__FieldTag::__revision) {
20911                                return std::result::Result::Err(A::Error::duplicate_field(
20912                                    "multiple values for revision",
20913                                ));
20914                            }
20915                            result.revision = map
20916                                .next_value::<std::option::Option<std::string::String>>()?
20917                                .unwrap_or_default();
20918                        }
20919                        __FieldTag::__percent => {
20920                            if !fields.insert(__FieldTag::__percent) {
20921                                return std::result::Result::Err(A::Error::duplicate_field(
20922                                    "multiple values for percent",
20923                                ));
20924                            }
20925                            struct __With(std::option::Option<i32>);
20926                            impl<'de> serde::de::Deserialize<'de> for __With {
20927                                fn deserialize<D>(
20928                                    deserializer: D,
20929                                ) -> std::result::Result<Self, D::Error>
20930                                where
20931                                    D: serde::de::Deserializer<'de>,
20932                                {
20933                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20934                                }
20935                            }
20936                            result.percent = map.next_value::<__With>()?.0.unwrap_or_default();
20937                        }
20938                        __FieldTag::__tag => {
20939                            if !fields.insert(__FieldTag::__tag) {
20940                                return std::result::Result::Err(A::Error::duplicate_field(
20941                                    "multiple values for tag",
20942                                ));
20943                            }
20944                            result.tag = map
20945                                .next_value::<std::option::Option<std::string::String>>()?
20946                                .unwrap_or_default();
20947                        }
20948                        __FieldTag::__uri => {
20949                            if !fields.insert(__FieldTag::__uri) {
20950                                return std::result::Result::Err(A::Error::duplicate_field(
20951                                    "multiple values for uri",
20952                                ));
20953                            }
20954                            result.uri = map
20955                                .next_value::<std::option::Option<std::string::String>>()?
20956                                .unwrap_or_default();
20957                        }
20958                        __FieldTag::Unknown(key) => {
20959                            let value = map.next_value::<serde_json::Value>()?;
20960                            result._unknown_fields.insert(key, value);
20961                        }
20962                    }
20963                }
20964                std::result::Result::Ok(result)
20965            }
20966        }
20967        deserializer.deserialize_any(Visitor)
20968    }
20969}
20970
20971#[doc(hidden)]
20972impl serde::ser::Serialize for TrafficTargetStatus {
20973    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20974    where
20975        S: serde::ser::Serializer,
20976    {
20977        use serde::ser::SerializeMap;
20978        #[allow(unused_imports)]
20979        use std::option::Option::Some;
20980        let mut state = serializer.serialize_map(std::option::Option::None)?;
20981        if !wkt::internal::is_default(&self.r#type) {
20982            state.serialize_entry("type", &self.r#type)?;
20983        }
20984        if !self.revision.is_empty() {
20985            state.serialize_entry("revision", &self.revision)?;
20986        }
20987        if !wkt::internal::is_default(&self.percent) {
20988            struct __With<'a>(&'a i32);
20989            impl<'a> serde::ser::Serialize for __With<'a> {
20990                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20991                where
20992                    S: serde::ser::Serializer,
20993                {
20994                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20995                }
20996            }
20997            state.serialize_entry("percent", &__With(&self.percent))?;
20998        }
20999        if !self.tag.is_empty() {
21000            state.serialize_entry("tag", &self.tag)?;
21001        }
21002        if !self.uri.is_empty() {
21003            state.serialize_entry("uri", &self.uri)?;
21004        }
21005        if !self._unknown_fields.is_empty() {
21006            for (key, value) in self._unknown_fields.iter() {
21007                state.serialize_entry(key, &value)?;
21008            }
21009        }
21010        state.end()
21011    }
21012}
21013
21014/// VPC Access settings. For more information on sending traffic to a VPC
21015/// network, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>.
21016#[derive(Clone, Debug, Default, PartialEq)]
21017#[non_exhaustive]
21018pub struct VpcAccess {
21019    /// VPC Access connector name.
21020    /// Format: `projects/{project}/locations/{location}/connectors/{connector}`,
21021    /// where `{project}` can be project id or number.
21022    /// For more information on sending traffic to a VPC network via a connector,
21023    /// visit <https://cloud.google.com/run/docs/configuring/vpc-connectors>.
21024    pub connector: std::string::String,
21025
21026    /// Optional. Traffic VPC egress settings. If not provided, it defaults to
21027    /// PRIVATE_RANGES_ONLY.
21028    pub egress: crate::model::vpc_access::VpcEgress,
21029
21030    /// Optional. Direct VPC egress settings. Currently only single network
21031    /// interface is supported.
21032    pub network_interfaces: std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
21033
21034    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21035}
21036
21037impl VpcAccess {
21038    pub fn new() -> Self {
21039        std::default::Default::default()
21040    }
21041
21042    /// Sets the value of [connector][crate::model::VpcAccess::connector].
21043    pub fn set_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21044        self.connector = v.into();
21045        self
21046    }
21047
21048    /// Sets the value of [egress][crate::model::VpcAccess::egress].
21049    pub fn set_egress<T: std::convert::Into<crate::model::vpc_access::VpcEgress>>(
21050        mut self,
21051        v: T,
21052    ) -> Self {
21053        self.egress = v.into();
21054        self
21055    }
21056
21057    /// Sets the value of [network_interfaces][crate::model::VpcAccess::network_interfaces].
21058    pub fn set_network_interfaces<T, V>(mut self, v: T) -> Self
21059    where
21060        T: std::iter::IntoIterator<Item = V>,
21061        V: std::convert::Into<crate::model::vpc_access::NetworkInterface>,
21062    {
21063        use std::iter::Iterator;
21064        self.network_interfaces = v.into_iter().map(|i| i.into()).collect();
21065        self
21066    }
21067}
21068
21069impl wkt::message::Message for VpcAccess {
21070    fn typename() -> &'static str {
21071        "type.googleapis.com/google.cloud.run.v2.VpcAccess"
21072    }
21073}
21074
21075#[doc(hidden)]
21076impl<'de> serde::de::Deserialize<'de> for VpcAccess {
21077    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21078    where
21079        D: serde::Deserializer<'de>,
21080    {
21081        #[allow(non_camel_case_types)]
21082        #[doc(hidden)]
21083        #[derive(PartialEq, Eq, Hash)]
21084        enum __FieldTag {
21085            __connector,
21086            __egress,
21087            __network_interfaces,
21088            Unknown(std::string::String),
21089        }
21090        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21091            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21092            where
21093                D: serde::Deserializer<'de>,
21094            {
21095                struct Visitor;
21096                impl<'de> serde::de::Visitor<'de> for Visitor {
21097                    type Value = __FieldTag;
21098                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21099                        formatter.write_str("a field name for VpcAccess")
21100                    }
21101                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21102                    where
21103                        E: serde::de::Error,
21104                    {
21105                        use std::result::Result::Ok;
21106                        use std::string::ToString;
21107                        match value {
21108                            "connector" => Ok(__FieldTag::__connector),
21109                            "egress" => Ok(__FieldTag::__egress),
21110                            "networkInterfaces" => Ok(__FieldTag::__network_interfaces),
21111                            "network_interfaces" => Ok(__FieldTag::__network_interfaces),
21112                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21113                        }
21114                    }
21115                }
21116                deserializer.deserialize_identifier(Visitor)
21117            }
21118        }
21119        struct Visitor;
21120        impl<'de> serde::de::Visitor<'de> for Visitor {
21121            type Value = VpcAccess;
21122            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21123                formatter.write_str("struct VpcAccess")
21124            }
21125            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21126            where
21127                A: serde::de::MapAccess<'de>,
21128            {
21129                #[allow(unused_imports)]
21130                use serde::de::Error;
21131                use std::option::Option::Some;
21132                let mut fields = std::collections::HashSet::new();
21133                let mut result = Self::Value::new();
21134                while let Some(tag) = map.next_key::<__FieldTag>()? {
21135                    #[allow(clippy::match_single_binding)]
21136                    match tag {
21137                        __FieldTag::__connector => {
21138                            if !fields.insert(__FieldTag::__connector) {
21139                                return std::result::Result::Err(A::Error::duplicate_field(
21140                                    "multiple values for connector",
21141                                ));
21142                            }
21143                            result.connector = map
21144                                .next_value::<std::option::Option<std::string::String>>()?
21145                                .unwrap_or_default();
21146                        }
21147                        __FieldTag::__egress => {
21148                            if !fields.insert(__FieldTag::__egress) {
21149                                return std::result::Result::Err(A::Error::duplicate_field(
21150                                    "multiple values for egress",
21151                                ));
21152                            }
21153                            result.egress = map.next_value::<std::option::Option<crate::model::vpc_access::VpcEgress>>()?.unwrap_or_default();
21154                        }
21155                        __FieldTag::__network_interfaces => {
21156                            if !fields.insert(__FieldTag::__network_interfaces) {
21157                                return std::result::Result::Err(A::Error::duplicate_field(
21158                                    "multiple values for network_interfaces",
21159                                ));
21160                            }
21161                            result.network_interfaces = map
21162                                .next_value::<std::option::Option<
21163                                    std::vec::Vec<crate::model::vpc_access::NetworkInterface>,
21164                                >>()?
21165                                .unwrap_or_default();
21166                        }
21167                        __FieldTag::Unknown(key) => {
21168                            let value = map.next_value::<serde_json::Value>()?;
21169                            result._unknown_fields.insert(key, value);
21170                        }
21171                    }
21172                }
21173                std::result::Result::Ok(result)
21174            }
21175        }
21176        deserializer.deserialize_any(Visitor)
21177    }
21178}
21179
21180#[doc(hidden)]
21181impl serde::ser::Serialize for VpcAccess {
21182    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21183    where
21184        S: serde::ser::Serializer,
21185    {
21186        use serde::ser::SerializeMap;
21187        #[allow(unused_imports)]
21188        use std::option::Option::Some;
21189        let mut state = serializer.serialize_map(std::option::Option::None)?;
21190        if !self.connector.is_empty() {
21191            state.serialize_entry("connector", &self.connector)?;
21192        }
21193        if !wkt::internal::is_default(&self.egress) {
21194            state.serialize_entry("egress", &self.egress)?;
21195        }
21196        if !self.network_interfaces.is_empty() {
21197            state.serialize_entry("networkInterfaces", &self.network_interfaces)?;
21198        }
21199        if !self._unknown_fields.is_empty() {
21200            for (key, value) in self._unknown_fields.iter() {
21201                state.serialize_entry(key, &value)?;
21202            }
21203        }
21204        state.end()
21205    }
21206}
21207
21208/// Defines additional types related to [VpcAccess].
21209pub mod vpc_access {
21210    #[allow(unused_imports)]
21211    use super::*;
21212
21213    /// Direct VPC egress settings.
21214    #[derive(Clone, Debug, Default, PartialEq)]
21215    #[non_exhaustive]
21216    pub struct NetworkInterface {
21217        /// Optional. The VPC network that the Cloud Run resource will be able to
21218        /// send traffic to. At least one of network or subnetwork must be specified.
21219        /// If both network and subnetwork are specified, the given VPC subnetwork
21220        /// must belong to the given VPC network. If network is not specified, it
21221        /// will be looked up from the subnetwork.
21222        pub network: std::string::String,
21223
21224        /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs
21225        /// from. At least one of network or subnetwork must be specified. If both
21226        /// network and subnetwork are specified, the given VPC subnetwork must
21227        /// belong to the given VPC network. If subnetwork is not specified, the
21228        /// subnetwork with the same name with the network will be used.
21229        pub subnetwork: std::string::String,
21230
21231        /// Optional. Network tags applied to this Cloud Run resource.
21232        pub tags: std::vec::Vec<std::string::String>,
21233
21234        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21235    }
21236
21237    impl NetworkInterface {
21238        pub fn new() -> Self {
21239            std::default::Default::default()
21240        }
21241
21242        /// Sets the value of [network][crate::model::vpc_access::NetworkInterface::network].
21243        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21244            self.network = v.into();
21245            self
21246        }
21247
21248        /// Sets the value of [subnetwork][crate::model::vpc_access::NetworkInterface::subnetwork].
21249        pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21250            self.subnetwork = v.into();
21251            self
21252        }
21253
21254        /// Sets the value of [tags][crate::model::vpc_access::NetworkInterface::tags].
21255        pub fn set_tags<T, V>(mut self, v: T) -> Self
21256        where
21257            T: std::iter::IntoIterator<Item = V>,
21258            V: std::convert::Into<std::string::String>,
21259        {
21260            use std::iter::Iterator;
21261            self.tags = v.into_iter().map(|i| i.into()).collect();
21262            self
21263        }
21264    }
21265
21266    impl wkt::message::Message for NetworkInterface {
21267        fn typename() -> &'static str {
21268            "type.googleapis.com/google.cloud.run.v2.VpcAccess.NetworkInterface"
21269        }
21270    }
21271
21272    #[doc(hidden)]
21273    impl<'de> serde::de::Deserialize<'de> for NetworkInterface {
21274        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21275        where
21276            D: serde::Deserializer<'de>,
21277        {
21278            #[allow(non_camel_case_types)]
21279            #[doc(hidden)]
21280            #[derive(PartialEq, Eq, Hash)]
21281            enum __FieldTag {
21282                __network,
21283                __subnetwork,
21284                __tags,
21285                Unknown(std::string::String),
21286            }
21287            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21288                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21289                where
21290                    D: serde::Deserializer<'de>,
21291                {
21292                    struct Visitor;
21293                    impl<'de> serde::de::Visitor<'de> for Visitor {
21294                        type Value = __FieldTag;
21295                        fn expecting(
21296                            &self,
21297                            formatter: &mut std::fmt::Formatter,
21298                        ) -> std::fmt::Result {
21299                            formatter.write_str("a field name for NetworkInterface")
21300                        }
21301                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21302                        where
21303                            E: serde::de::Error,
21304                        {
21305                            use std::result::Result::Ok;
21306                            use std::string::ToString;
21307                            match value {
21308                                "network" => Ok(__FieldTag::__network),
21309                                "subnetwork" => Ok(__FieldTag::__subnetwork),
21310                                "tags" => Ok(__FieldTag::__tags),
21311                                _ => Ok(__FieldTag::Unknown(value.to_string())),
21312                            }
21313                        }
21314                    }
21315                    deserializer.deserialize_identifier(Visitor)
21316                }
21317            }
21318            struct Visitor;
21319            impl<'de> serde::de::Visitor<'de> for Visitor {
21320                type Value = NetworkInterface;
21321                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21322                    formatter.write_str("struct NetworkInterface")
21323                }
21324                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21325                where
21326                    A: serde::de::MapAccess<'de>,
21327                {
21328                    #[allow(unused_imports)]
21329                    use serde::de::Error;
21330                    use std::option::Option::Some;
21331                    let mut fields = std::collections::HashSet::new();
21332                    let mut result = Self::Value::new();
21333                    while let Some(tag) = map.next_key::<__FieldTag>()? {
21334                        #[allow(clippy::match_single_binding)]
21335                        match tag {
21336                            __FieldTag::__network => {
21337                                if !fields.insert(__FieldTag::__network) {
21338                                    return std::result::Result::Err(A::Error::duplicate_field(
21339                                        "multiple values for network",
21340                                    ));
21341                                }
21342                                result.network = map
21343                                    .next_value::<std::option::Option<std::string::String>>()?
21344                                    .unwrap_or_default();
21345                            }
21346                            __FieldTag::__subnetwork => {
21347                                if !fields.insert(__FieldTag::__subnetwork) {
21348                                    return std::result::Result::Err(A::Error::duplicate_field(
21349                                        "multiple values for subnetwork",
21350                                    ));
21351                                }
21352                                result.subnetwork = map
21353                                    .next_value::<std::option::Option<std::string::String>>()?
21354                                    .unwrap_or_default();
21355                            }
21356                            __FieldTag::__tags => {
21357                                if !fields.insert(__FieldTag::__tags) {
21358                                    return std::result::Result::Err(A::Error::duplicate_field(
21359                                        "multiple values for tags",
21360                                    ));
21361                                }
21362                                result.tags = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21363                            }
21364                            __FieldTag::Unknown(key) => {
21365                                let value = map.next_value::<serde_json::Value>()?;
21366                                result._unknown_fields.insert(key, value);
21367                            }
21368                        }
21369                    }
21370                    std::result::Result::Ok(result)
21371                }
21372            }
21373            deserializer.deserialize_any(Visitor)
21374        }
21375    }
21376
21377    #[doc(hidden)]
21378    impl serde::ser::Serialize for NetworkInterface {
21379        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21380        where
21381            S: serde::ser::Serializer,
21382        {
21383            use serde::ser::SerializeMap;
21384            #[allow(unused_imports)]
21385            use std::option::Option::Some;
21386            let mut state = serializer.serialize_map(std::option::Option::None)?;
21387            if !self.network.is_empty() {
21388                state.serialize_entry("network", &self.network)?;
21389            }
21390            if !self.subnetwork.is_empty() {
21391                state.serialize_entry("subnetwork", &self.subnetwork)?;
21392            }
21393            if !self.tags.is_empty() {
21394                state.serialize_entry("tags", &self.tags)?;
21395            }
21396            if !self._unknown_fields.is_empty() {
21397                for (key, value) in self._unknown_fields.iter() {
21398                    state.serialize_entry(key, &value)?;
21399                }
21400            }
21401            state.end()
21402        }
21403    }
21404
21405    /// Egress options for VPC access.
21406    ///
21407    /// # Working with unknown values
21408    ///
21409    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21410    /// additional enum variants at any time. Adding new variants is not considered
21411    /// a breaking change. Applications should write their code in anticipation of:
21412    ///
21413    /// - New values appearing in future releases of the client library, **and**
21414    /// - New values received dynamically, without application changes.
21415    ///
21416    /// Please consult the [Working with enums] section in the user guide for some
21417    /// guidelines.
21418    ///
21419    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21420    #[derive(Clone, Debug, PartialEq)]
21421    #[non_exhaustive]
21422    pub enum VpcEgress {
21423        /// Unspecified
21424        Unspecified,
21425        /// All outbound traffic is routed through the VPC connector.
21426        AllTraffic,
21427        /// Only private IP ranges are routed through the VPC connector.
21428        PrivateRangesOnly,
21429        /// If set, the enum was initialized with an unknown value.
21430        ///
21431        /// Applications can examine the value using [VpcEgress::value] or
21432        /// [VpcEgress::name].
21433        UnknownValue(vpc_egress::UnknownValue),
21434    }
21435
21436    #[doc(hidden)]
21437    pub mod vpc_egress {
21438        #[allow(unused_imports)]
21439        use super::*;
21440        #[derive(Clone, Debug, PartialEq)]
21441        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21442    }
21443
21444    impl VpcEgress {
21445        /// Gets the enum value.
21446        ///
21447        /// Returns `None` if the enum contains an unknown value deserialized from
21448        /// the string representation of enums.
21449        pub fn value(&self) -> std::option::Option<i32> {
21450            match self {
21451                Self::Unspecified => std::option::Option::Some(0),
21452                Self::AllTraffic => std::option::Option::Some(1),
21453                Self::PrivateRangesOnly => std::option::Option::Some(2),
21454                Self::UnknownValue(u) => u.0.value(),
21455            }
21456        }
21457
21458        /// Gets the enum value as a string.
21459        ///
21460        /// Returns `None` if the enum contains an unknown value deserialized from
21461        /// the integer representation of enums.
21462        pub fn name(&self) -> std::option::Option<&str> {
21463            match self {
21464                Self::Unspecified => std::option::Option::Some("VPC_EGRESS_UNSPECIFIED"),
21465                Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
21466                Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
21467                Self::UnknownValue(u) => u.0.name(),
21468            }
21469        }
21470    }
21471
21472    impl std::default::Default for VpcEgress {
21473        fn default() -> Self {
21474            use std::convert::From;
21475            Self::from(0)
21476        }
21477    }
21478
21479    impl std::fmt::Display for VpcEgress {
21480        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21481            wkt::internal::display_enum(f, self.name(), self.value())
21482        }
21483    }
21484
21485    impl std::convert::From<i32> for VpcEgress {
21486        fn from(value: i32) -> Self {
21487            match value {
21488                0 => Self::Unspecified,
21489                1 => Self::AllTraffic,
21490                2 => Self::PrivateRangesOnly,
21491                _ => Self::UnknownValue(vpc_egress::UnknownValue(
21492                    wkt::internal::UnknownEnumValue::Integer(value),
21493                )),
21494            }
21495        }
21496    }
21497
21498    impl std::convert::From<&str> for VpcEgress {
21499        fn from(value: &str) -> Self {
21500            use std::string::ToString;
21501            match value {
21502                "VPC_EGRESS_UNSPECIFIED" => Self::Unspecified,
21503                "ALL_TRAFFIC" => Self::AllTraffic,
21504                "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
21505                _ => Self::UnknownValue(vpc_egress::UnknownValue(
21506                    wkt::internal::UnknownEnumValue::String(value.to_string()),
21507                )),
21508            }
21509        }
21510    }
21511
21512    impl serde::ser::Serialize for VpcEgress {
21513        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21514        where
21515            S: serde::Serializer,
21516        {
21517            match self {
21518                Self::Unspecified => serializer.serialize_i32(0),
21519                Self::AllTraffic => serializer.serialize_i32(1),
21520                Self::PrivateRangesOnly => serializer.serialize_i32(2),
21521                Self::UnknownValue(u) => u.0.serialize(serializer),
21522            }
21523        }
21524    }
21525
21526    impl<'de> serde::de::Deserialize<'de> for VpcEgress {
21527        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21528        where
21529            D: serde::Deserializer<'de>,
21530        {
21531            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VpcEgress>::new(
21532                ".google.cloud.run.v2.VpcAccess.VpcEgress",
21533            ))
21534        }
21535    }
21536}
21537
21538/// Settings for Binary Authorization feature.
21539#[derive(Clone, Debug, Default, PartialEq)]
21540#[non_exhaustive]
21541pub struct BinaryAuthorization {
21542    /// Optional. If present, indicates to use Breakglass using this justification.
21543    /// If use_default is False, then it must be empty.
21544    /// For more information on breakglass, see
21545    /// <https://cloud.google.com/binary-authorization/docs/using-breakglass>
21546    pub breakglass_justification: std::string::String,
21547
21548    pub binauthz_method: std::option::Option<crate::model::binary_authorization::BinauthzMethod>,
21549
21550    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21551}
21552
21553impl BinaryAuthorization {
21554    pub fn new() -> Self {
21555        std::default::Default::default()
21556    }
21557
21558    /// Sets the value of [breakglass_justification][crate::model::BinaryAuthorization::breakglass_justification].
21559    pub fn set_breakglass_justification<T: std::convert::Into<std::string::String>>(
21560        mut self,
21561        v: T,
21562    ) -> Self {
21563        self.breakglass_justification = v.into();
21564        self
21565    }
21566
21567    /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method].
21568    ///
21569    /// Note that all the setters affecting `binauthz_method` are mutually
21570    /// exclusive.
21571    pub fn set_binauthz_method<
21572        T: std::convert::Into<std::option::Option<crate::model::binary_authorization::BinauthzMethod>>,
21573    >(
21574        mut self,
21575        v: T,
21576    ) -> Self {
21577        self.binauthz_method = v.into();
21578        self
21579    }
21580
21581    /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
21582    /// if it holds a `UseDefault`, `None` if the field is not set or
21583    /// holds a different branch.
21584    pub fn use_default(&self) -> std::option::Option<&bool> {
21585        #[allow(unreachable_patterns)]
21586        self.binauthz_method.as_ref().and_then(|v| match v {
21587            crate::model::binary_authorization::BinauthzMethod::UseDefault(v) => {
21588                std::option::Option::Some(v)
21589            }
21590            _ => std::option::Option::None,
21591        })
21592    }
21593
21594    /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
21595    /// to hold a `UseDefault`.
21596    ///
21597    /// Note that all the setters affecting `binauthz_method` are
21598    /// mutually exclusive.
21599    pub fn set_use_default<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21600        self.binauthz_method = std::option::Option::Some(
21601            crate::model::binary_authorization::BinauthzMethod::UseDefault(v.into()),
21602        );
21603        self
21604    }
21605
21606    /// The value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
21607    /// if it holds a `Policy`, `None` if the field is not set or
21608    /// holds a different branch.
21609    pub fn policy(&self) -> std::option::Option<&std::string::String> {
21610        #[allow(unreachable_patterns)]
21611        self.binauthz_method.as_ref().and_then(|v| match v {
21612            crate::model::binary_authorization::BinauthzMethod::Policy(v) => {
21613                std::option::Option::Some(v)
21614            }
21615            _ => std::option::Option::None,
21616        })
21617    }
21618
21619    /// Sets the value of [binauthz_method][crate::model::BinaryAuthorization::binauthz_method]
21620    /// to hold a `Policy`.
21621    ///
21622    /// Note that all the setters affecting `binauthz_method` are
21623    /// mutually exclusive.
21624    pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21625        self.binauthz_method = std::option::Option::Some(
21626            crate::model::binary_authorization::BinauthzMethod::Policy(v.into()),
21627        );
21628        self
21629    }
21630}
21631
21632impl wkt::message::Message for BinaryAuthorization {
21633    fn typename() -> &'static str {
21634        "type.googleapis.com/google.cloud.run.v2.BinaryAuthorization"
21635    }
21636}
21637
21638#[doc(hidden)]
21639impl<'de> serde::de::Deserialize<'de> for BinaryAuthorization {
21640    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21641    where
21642        D: serde::Deserializer<'de>,
21643    {
21644        #[allow(non_camel_case_types)]
21645        #[doc(hidden)]
21646        #[derive(PartialEq, Eq, Hash)]
21647        enum __FieldTag {
21648            __use_default,
21649            __policy,
21650            __breakglass_justification,
21651            Unknown(std::string::String),
21652        }
21653        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21654            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21655            where
21656                D: serde::Deserializer<'de>,
21657            {
21658                struct Visitor;
21659                impl<'de> serde::de::Visitor<'de> for Visitor {
21660                    type Value = __FieldTag;
21661                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21662                        formatter.write_str("a field name for BinaryAuthorization")
21663                    }
21664                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21665                    where
21666                        E: serde::de::Error,
21667                    {
21668                        use std::result::Result::Ok;
21669                        use std::string::ToString;
21670                        match value {
21671                            "useDefault" => Ok(__FieldTag::__use_default),
21672                            "use_default" => Ok(__FieldTag::__use_default),
21673                            "policy" => Ok(__FieldTag::__policy),
21674                            "breakglassJustification" => Ok(__FieldTag::__breakglass_justification),
21675                            "breakglass_justification" => {
21676                                Ok(__FieldTag::__breakglass_justification)
21677                            }
21678                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21679                        }
21680                    }
21681                }
21682                deserializer.deserialize_identifier(Visitor)
21683            }
21684        }
21685        struct Visitor;
21686        impl<'de> serde::de::Visitor<'de> for Visitor {
21687            type Value = BinaryAuthorization;
21688            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21689                formatter.write_str("struct BinaryAuthorization")
21690            }
21691            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21692            where
21693                A: serde::de::MapAccess<'de>,
21694            {
21695                #[allow(unused_imports)]
21696                use serde::de::Error;
21697                use std::option::Option::Some;
21698                let mut fields = std::collections::HashSet::new();
21699                let mut result = Self::Value::new();
21700                while let Some(tag) = map.next_key::<__FieldTag>()? {
21701                    #[allow(clippy::match_single_binding)]
21702                    match tag {
21703                        __FieldTag::__use_default => {
21704                            if !fields.insert(__FieldTag::__use_default) {
21705                                return std::result::Result::Err(A::Error::duplicate_field(
21706                                    "multiple values for use_default",
21707                                ));
21708                            }
21709                            if result.binauthz_method.is_some() {
21710                                return std::result::Result::Err(A::Error::duplicate_field(
21711                                    "multiple values for `binauthz_method`, a oneof with full ID .google.cloud.run.v2.BinaryAuthorization.use_default, latest field was useDefault",
21712                                ));
21713                            }
21714                            result.binauthz_method = std::option::Option::Some(
21715                                crate::model::binary_authorization::BinauthzMethod::UseDefault(
21716                                    map.next_value::<std::option::Option<bool>>()?
21717                                        .unwrap_or_default(),
21718                                ),
21719                            );
21720                        }
21721                        __FieldTag::__policy => {
21722                            if !fields.insert(__FieldTag::__policy) {
21723                                return std::result::Result::Err(A::Error::duplicate_field(
21724                                    "multiple values for policy",
21725                                ));
21726                            }
21727                            if result.binauthz_method.is_some() {
21728                                return std::result::Result::Err(A::Error::duplicate_field(
21729                                    "multiple values for `binauthz_method`, a oneof with full ID .google.cloud.run.v2.BinaryAuthorization.policy, latest field was policy",
21730                                ));
21731                            }
21732                            result.binauthz_method = std::option::Option::Some(
21733                                crate::model::binary_authorization::BinauthzMethod::Policy(
21734                                    map.next_value::<std::option::Option<std::string::String>>()?
21735                                        .unwrap_or_default(),
21736                                ),
21737                            );
21738                        }
21739                        __FieldTag::__breakglass_justification => {
21740                            if !fields.insert(__FieldTag::__breakglass_justification) {
21741                                return std::result::Result::Err(A::Error::duplicate_field(
21742                                    "multiple values for breakglass_justification",
21743                                ));
21744                            }
21745                            result.breakglass_justification = map
21746                                .next_value::<std::option::Option<std::string::String>>()?
21747                                .unwrap_or_default();
21748                        }
21749                        __FieldTag::Unknown(key) => {
21750                            let value = map.next_value::<serde_json::Value>()?;
21751                            result._unknown_fields.insert(key, value);
21752                        }
21753                    }
21754                }
21755                std::result::Result::Ok(result)
21756            }
21757        }
21758        deserializer.deserialize_any(Visitor)
21759    }
21760}
21761
21762#[doc(hidden)]
21763impl serde::ser::Serialize for BinaryAuthorization {
21764    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21765    where
21766        S: serde::ser::Serializer,
21767    {
21768        use serde::ser::SerializeMap;
21769        #[allow(unused_imports)]
21770        use std::option::Option::Some;
21771        let mut state = serializer.serialize_map(std::option::Option::None)?;
21772        if let Some(value) = self.use_default() {
21773            state.serialize_entry("useDefault", value)?;
21774        }
21775        if let Some(value) = self.policy() {
21776            state.serialize_entry("policy", value)?;
21777        }
21778        if !self.breakglass_justification.is_empty() {
21779            state.serialize_entry("breakglassJustification", &self.breakglass_justification)?;
21780        }
21781        if !self._unknown_fields.is_empty() {
21782            for (key, value) in self._unknown_fields.iter() {
21783                state.serialize_entry(key, &value)?;
21784            }
21785        }
21786        state.end()
21787    }
21788}
21789
21790/// Defines additional types related to [BinaryAuthorization].
21791pub mod binary_authorization {
21792    #[allow(unused_imports)]
21793    use super::*;
21794
21795    #[derive(Clone, Debug, PartialEq)]
21796    #[non_exhaustive]
21797    pub enum BinauthzMethod {
21798        /// Optional. If True, indicates to use the default project's binary
21799        /// authorization policy. If False, binary authorization will be disabled.
21800        UseDefault(bool),
21801        /// Optional. The path to a binary authorization policy.
21802        /// Format: `projects/{project}/platforms/cloudRun/{policy-name}`
21803        Policy(std::string::String),
21804    }
21805}
21806
21807/// Settings for revision-level scaling settings.
21808#[derive(Clone, Debug, Default, PartialEq)]
21809#[non_exhaustive]
21810pub struct RevisionScaling {
21811    /// Optional. Minimum number of serving instances that this resource should
21812    /// have.
21813    pub min_instance_count: i32,
21814
21815    /// Optional. Maximum number of serving instances that this resource should
21816    /// have. When unspecified, the field is set to the server default value of
21817    /// 100. For more information see
21818    /// <https://cloud.google.com/run/docs/configuring/max-instances>
21819    pub max_instance_count: i32,
21820
21821    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21822}
21823
21824impl RevisionScaling {
21825    pub fn new() -> Self {
21826        std::default::Default::default()
21827    }
21828
21829    /// Sets the value of [min_instance_count][crate::model::RevisionScaling::min_instance_count].
21830    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21831        self.min_instance_count = v.into();
21832        self
21833    }
21834
21835    /// Sets the value of [max_instance_count][crate::model::RevisionScaling::max_instance_count].
21836    pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21837        self.max_instance_count = v.into();
21838        self
21839    }
21840}
21841
21842impl wkt::message::Message for RevisionScaling {
21843    fn typename() -> &'static str {
21844        "type.googleapis.com/google.cloud.run.v2.RevisionScaling"
21845    }
21846}
21847
21848#[doc(hidden)]
21849impl<'de> serde::de::Deserialize<'de> for RevisionScaling {
21850    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21851    where
21852        D: serde::Deserializer<'de>,
21853    {
21854        #[allow(non_camel_case_types)]
21855        #[doc(hidden)]
21856        #[derive(PartialEq, Eq, Hash)]
21857        enum __FieldTag {
21858            __min_instance_count,
21859            __max_instance_count,
21860            Unknown(std::string::String),
21861        }
21862        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21863            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21864            where
21865                D: serde::Deserializer<'de>,
21866            {
21867                struct Visitor;
21868                impl<'de> serde::de::Visitor<'de> for Visitor {
21869                    type Value = __FieldTag;
21870                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21871                        formatter.write_str("a field name for RevisionScaling")
21872                    }
21873                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21874                    where
21875                        E: serde::de::Error,
21876                    {
21877                        use std::result::Result::Ok;
21878                        use std::string::ToString;
21879                        match value {
21880                            "minInstanceCount" => Ok(__FieldTag::__min_instance_count),
21881                            "min_instance_count" => Ok(__FieldTag::__min_instance_count),
21882                            "maxInstanceCount" => Ok(__FieldTag::__max_instance_count),
21883                            "max_instance_count" => Ok(__FieldTag::__max_instance_count),
21884                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21885                        }
21886                    }
21887                }
21888                deserializer.deserialize_identifier(Visitor)
21889            }
21890        }
21891        struct Visitor;
21892        impl<'de> serde::de::Visitor<'de> for Visitor {
21893            type Value = RevisionScaling;
21894            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21895                formatter.write_str("struct RevisionScaling")
21896            }
21897            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21898            where
21899                A: serde::de::MapAccess<'de>,
21900            {
21901                #[allow(unused_imports)]
21902                use serde::de::Error;
21903                use std::option::Option::Some;
21904                let mut fields = std::collections::HashSet::new();
21905                let mut result = Self::Value::new();
21906                while let Some(tag) = map.next_key::<__FieldTag>()? {
21907                    #[allow(clippy::match_single_binding)]
21908                    match tag {
21909                        __FieldTag::__min_instance_count => {
21910                            if !fields.insert(__FieldTag::__min_instance_count) {
21911                                return std::result::Result::Err(A::Error::duplicate_field(
21912                                    "multiple values for min_instance_count",
21913                                ));
21914                            }
21915                            struct __With(std::option::Option<i32>);
21916                            impl<'de> serde::de::Deserialize<'de> for __With {
21917                                fn deserialize<D>(
21918                                    deserializer: D,
21919                                ) -> std::result::Result<Self, D::Error>
21920                                where
21921                                    D: serde::de::Deserializer<'de>,
21922                                {
21923                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
21924                                }
21925                            }
21926                            result.min_instance_count =
21927                                map.next_value::<__With>()?.0.unwrap_or_default();
21928                        }
21929                        __FieldTag::__max_instance_count => {
21930                            if !fields.insert(__FieldTag::__max_instance_count) {
21931                                return std::result::Result::Err(A::Error::duplicate_field(
21932                                    "multiple values for max_instance_count",
21933                                ));
21934                            }
21935                            struct __With(std::option::Option<i32>);
21936                            impl<'de> serde::de::Deserialize<'de> for __With {
21937                                fn deserialize<D>(
21938                                    deserializer: D,
21939                                ) -> std::result::Result<Self, D::Error>
21940                                where
21941                                    D: serde::de::Deserializer<'de>,
21942                                {
21943                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
21944                                }
21945                            }
21946                            result.max_instance_count =
21947                                map.next_value::<__With>()?.0.unwrap_or_default();
21948                        }
21949                        __FieldTag::Unknown(key) => {
21950                            let value = map.next_value::<serde_json::Value>()?;
21951                            result._unknown_fields.insert(key, value);
21952                        }
21953                    }
21954                }
21955                std::result::Result::Ok(result)
21956            }
21957        }
21958        deserializer.deserialize_any(Visitor)
21959    }
21960}
21961
21962#[doc(hidden)]
21963impl serde::ser::Serialize for RevisionScaling {
21964    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21965    where
21966        S: serde::ser::Serializer,
21967    {
21968        use serde::ser::SerializeMap;
21969        #[allow(unused_imports)]
21970        use std::option::Option::Some;
21971        let mut state = serializer.serialize_map(std::option::Option::None)?;
21972        if !wkt::internal::is_default(&self.min_instance_count) {
21973            struct __With<'a>(&'a i32);
21974            impl<'a> serde::ser::Serialize for __With<'a> {
21975                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21976                where
21977                    S: serde::ser::Serializer,
21978                {
21979                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
21980                }
21981            }
21982            state.serialize_entry("minInstanceCount", &__With(&self.min_instance_count))?;
21983        }
21984        if !wkt::internal::is_default(&self.max_instance_count) {
21985            struct __With<'a>(&'a i32);
21986            impl<'a> serde::ser::Serialize for __With<'a> {
21987                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21988                where
21989                    S: serde::ser::Serializer,
21990                {
21991                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
21992                }
21993            }
21994            state.serialize_entry("maxInstanceCount", &__With(&self.max_instance_count))?;
21995        }
21996        if !self._unknown_fields.is_empty() {
21997            for (key, value) in self._unknown_fields.iter() {
21998                state.serialize_entry(key, &value)?;
21999            }
22000        }
22001        state.end()
22002    }
22003}
22004
22005/// Settings for Cloud Service Mesh. For more information see
22006/// <https://cloud.google.com/service-mesh/docs/overview>.
22007#[derive(Clone, Debug, Default, PartialEq)]
22008#[non_exhaustive]
22009pub struct ServiceMesh {
22010    /// The Mesh resource name. Format:
22011    /// `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can
22012    /// be project id or number.
22013    pub mesh: std::string::String,
22014
22015    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22016}
22017
22018impl ServiceMesh {
22019    pub fn new() -> Self {
22020        std::default::Default::default()
22021    }
22022
22023    /// Sets the value of [mesh][crate::model::ServiceMesh::mesh].
22024    pub fn set_mesh<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22025        self.mesh = v.into();
22026        self
22027    }
22028}
22029
22030impl wkt::message::Message for ServiceMesh {
22031    fn typename() -> &'static str {
22032        "type.googleapis.com/google.cloud.run.v2.ServiceMesh"
22033    }
22034}
22035
22036#[doc(hidden)]
22037impl<'de> serde::de::Deserialize<'de> for ServiceMesh {
22038    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22039    where
22040        D: serde::Deserializer<'de>,
22041    {
22042        #[allow(non_camel_case_types)]
22043        #[doc(hidden)]
22044        #[derive(PartialEq, Eq, Hash)]
22045        enum __FieldTag {
22046            __mesh,
22047            Unknown(std::string::String),
22048        }
22049        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22050            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22051            where
22052                D: serde::Deserializer<'de>,
22053            {
22054                struct Visitor;
22055                impl<'de> serde::de::Visitor<'de> for Visitor {
22056                    type Value = __FieldTag;
22057                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22058                        formatter.write_str("a field name for ServiceMesh")
22059                    }
22060                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22061                    where
22062                        E: serde::de::Error,
22063                    {
22064                        use std::result::Result::Ok;
22065                        use std::string::ToString;
22066                        match value {
22067                            "mesh" => Ok(__FieldTag::__mesh),
22068                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22069                        }
22070                    }
22071                }
22072                deserializer.deserialize_identifier(Visitor)
22073            }
22074        }
22075        struct Visitor;
22076        impl<'de> serde::de::Visitor<'de> for Visitor {
22077            type Value = ServiceMesh;
22078            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22079                formatter.write_str("struct ServiceMesh")
22080            }
22081            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22082            where
22083                A: serde::de::MapAccess<'de>,
22084            {
22085                #[allow(unused_imports)]
22086                use serde::de::Error;
22087                use std::option::Option::Some;
22088                let mut fields = std::collections::HashSet::new();
22089                let mut result = Self::Value::new();
22090                while let Some(tag) = map.next_key::<__FieldTag>()? {
22091                    #[allow(clippy::match_single_binding)]
22092                    match tag {
22093                        __FieldTag::__mesh => {
22094                            if !fields.insert(__FieldTag::__mesh) {
22095                                return std::result::Result::Err(A::Error::duplicate_field(
22096                                    "multiple values for mesh",
22097                                ));
22098                            }
22099                            result.mesh = map
22100                                .next_value::<std::option::Option<std::string::String>>()?
22101                                .unwrap_or_default();
22102                        }
22103                        __FieldTag::Unknown(key) => {
22104                            let value = map.next_value::<serde_json::Value>()?;
22105                            result._unknown_fields.insert(key, value);
22106                        }
22107                    }
22108                }
22109                std::result::Result::Ok(result)
22110            }
22111        }
22112        deserializer.deserialize_any(Visitor)
22113    }
22114}
22115
22116#[doc(hidden)]
22117impl serde::ser::Serialize for ServiceMesh {
22118    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22119    where
22120        S: serde::ser::Serializer,
22121    {
22122        use serde::ser::SerializeMap;
22123        #[allow(unused_imports)]
22124        use std::option::Option::Some;
22125        let mut state = serializer.serialize_map(std::option::Option::None)?;
22126        if !self.mesh.is_empty() {
22127            state.serialize_entry("mesh", &self.mesh)?;
22128        }
22129        if !self._unknown_fields.is_empty() {
22130            for (key, value) in self._unknown_fields.iter() {
22131                state.serialize_entry(key, &value)?;
22132            }
22133        }
22134        state.end()
22135    }
22136}
22137
22138/// Scaling settings applied at the service level rather than
22139/// at the revision level.
22140#[derive(Clone, Debug, Default, PartialEq)]
22141#[non_exhaustive]
22142pub struct ServiceScaling {
22143    /// Optional. total min instances for the service. This number of instances is
22144    /// divided among all revisions with specified traffic based on the percent
22145    /// of traffic they are receiving.
22146    pub min_instance_count: i32,
22147
22148    /// Optional. The scaling mode for the service.
22149    pub scaling_mode: crate::model::service_scaling::ScalingMode,
22150
22151    /// Optional. total instance count for the service in manual scaling mode. This
22152    /// number of instances is divided among all revisions with specified traffic
22153    /// based on the percent of traffic they are receiving.
22154    pub manual_instance_count: std::option::Option<i32>,
22155
22156    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22157}
22158
22159impl ServiceScaling {
22160    pub fn new() -> Self {
22161        std::default::Default::default()
22162    }
22163
22164    /// Sets the value of [min_instance_count][crate::model::ServiceScaling::min_instance_count].
22165    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22166        self.min_instance_count = v.into();
22167        self
22168    }
22169
22170    /// Sets the value of [scaling_mode][crate::model::ServiceScaling::scaling_mode].
22171    pub fn set_scaling_mode<T: std::convert::Into<crate::model::service_scaling::ScalingMode>>(
22172        mut self,
22173        v: T,
22174    ) -> Self {
22175        self.scaling_mode = v.into();
22176        self
22177    }
22178
22179    /// Sets the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
22180    pub fn set_manual_instance_count<T>(mut self, v: T) -> Self
22181    where
22182        T: std::convert::Into<i32>,
22183    {
22184        self.manual_instance_count = std::option::Option::Some(v.into());
22185        self
22186    }
22187
22188    /// Sets or clears the value of [manual_instance_count][crate::model::ServiceScaling::manual_instance_count].
22189    pub fn set_or_clear_manual_instance_count<T>(mut self, v: std::option::Option<T>) -> Self
22190    where
22191        T: std::convert::Into<i32>,
22192    {
22193        self.manual_instance_count = v.map(|x| x.into());
22194        self
22195    }
22196}
22197
22198impl wkt::message::Message for ServiceScaling {
22199    fn typename() -> &'static str {
22200        "type.googleapis.com/google.cloud.run.v2.ServiceScaling"
22201    }
22202}
22203
22204#[doc(hidden)]
22205impl<'de> serde::de::Deserialize<'de> for ServiceScaling {
22206    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22207    where
22208        D: serde::Deserializer<'de>,
22209    {
22210        #[allow(non_camel_case_types)]
22211        #[doc(hidden)]
22212        #[derive(PartialEq, Eq, Hash)]
22213        enum __FieldTag {
22214            __min_instance_count,
22215            __scaling_mode,
22216            __manual_instance_count,
22217            Unknown(std::string::String),
22218        }
22219        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22220            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22221            where
22222                D: serde::Deserializer<'de>,
22223            {
22224                struct Visitor;
22225                impl<'de> serde::de::Visitor<'de> for Visitor {
22226                    type Value = __FieldTag;
22227                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22228                        formatter.write_str("a field name for ServiceScaling")
22229                    }
22230                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22231                    where
22232                        E: serde::de::Error,
22233                    {
22234                        use std::result::Result::Ok;
22235                        use std::string::ToString;
22236                        match value {
22237                            "minInstanceCount" => Ok(__FieldTag::__min_instance_count),
22238                            "min_instance_count" => Ok(__FieldTag::__min_instance_count),
22239                            "scalingMode" => Ok(__FieldTag::__scaling_mode),
22240                            "scaling_mode" => Ok(__FieldTag::__scaling_mode),
22241                            "manualInstanceCount" => Ok(__FieldTag::__manual_instance_count),
22242                            "manual_instance_count" => Ok(__FieldTag::__manual_instance_count),
22243                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22244                        }
22245                    }
22246                }
22247                deserializer.deserialize_identifier(Visitor)
22248            }
22249        }
22250        struct Visitor;
22251        impl<'de> serde::de::Visitor<'de> for Visitor {
22252            type Value = ServiceScaling;
22253            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22254                formatter.write_str("struct ServiceScaling")
22255            }
22256            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22257            where
22258                A: serde::de::MapAccess<'de>,
22259            {
22260                #[allow(unused_imports)]
22261                use serde::de::Error;
22262                use std::option::Option::Some;
22263                let mut fields = std::collections::HashSet::new();
22264                let mut result = Self::Value::new();
22265                while let Some(tag) = map.next_key::<__FieldTag>()? {
22266                    #[allow(clippy::match_single_binding)]
22267                    match tag {
22268                        __FieldTag::__min_instance_count => {
22269                            if !fields.insert(__FieldTag::__min_instance_count) {
22270                                return std::result::Result::Err(A::Error::duplicate_field(
22271                                    "multiple values for min_instance_count",
22272                                ));
22273                            }
22274                            struct __With(std::option::Option<i32>);
22275                            impl<'de> serde::de::Deserialize<'de> for __With {
22276                                fn deserialize<D>(
22277                                    deserializer: D,
22278                                ) -> std::result::Result<Self, D::Error>
22279                                where
22280                                    D: serde::de::Deserializer<'de>,
22281                                {
22282                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
22283                                }
22284                            }
22285                            result.min_instance_count =
22286                                map.next_value::<__With>()?.0.unwrap_or_default();
22287                        }
22288                        __FieldTag::__scaling_mode => {
22289                            if !fields.insert(__FieldTag::__scaling_mode) {
22290                                return std::result::Result::Err(A::Error::duplicate_field(
22291                                    "multiple values for scaling_mode",
22292                                ));
22293                            }
22294                            result.scaling_mode = map.next_value::<std::option::Option<crate::model::service_scaling::ScalingMode>>()?.unwrap_or_default();
22295                        }
22296                        __FieldTag::__manual_instance_count => {
22297                            if !fields.insert(__FieldTag::__manual_instance_count) {
22298                                return std::result::Result::Err(A::Error::duplicate_field(
22299                                    "multiple values for manual_instance_count",
22300                                ));
22301                            }
22302                            struct __With(std::option::Option<i32>);
22303                            impl<'de> serde::de::Deserialize<'de> for __With {
22304                                fn deserialize<D>(
22305                                    deserializer: D,
22306                                ) -> std::result::Result<Self, D::Error>
22307                                where
22308                                    D: serde::de::Deserializer<'de>,
22309                                {
22310                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
22311                                }
22312                            }
22313                            result.manual_instance_count = map.next_value::<__With>()?.0;
22314                        }
22315                        __FieldTag::Unknown(key) => {
22316                            let value = map.next_value::<serde_json::Value>()?;
22317                            result._unknown_fields.insert(key, value);
22318                        }
22319                    }
22320                }
22321                std::result::Result::Ok(result)
22322            }
22323        }
22324        deserializer.deserialize_any(Visitor)
22325    }
22326}
22327
22328#[doc(hidden)]
22329impl serde::ser::Serialize for ServiceScaling {
22330    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22331    where
22332        S: serde::ser::Serializer,
22333    {
22334        use serde::ser::SerializeMap;
22335        #[allow(unused_imports)]
22336        use std::option::Option::Some;
22337        let mut state = serializer.serialize_map(std::option::Option::None)?;
22338        if !wkt::internal::is_default(&self.min_instance_count) {
22339            struct __With<'a>(&'a i32);
22340            impl<'a> serde::ser::Serialize for __With<'a> {
22341                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22342                where
22343                    S: serde::ser::Serializer,
22344                {
22345                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
22346                }
22347            }
22348            state.serialize_entry("minInstanceCount", &__With(&self.min_instance_count))?;
22349        }
22350        if !wkt::internal::is_default(&self.scaling_mode) {
22351            state.serialize_entry("scalingMode", &self.scaling_mode)?;
22352        }
22353        if self.manual_instance_count.is_some() {
22354            struct __With<'a>(&'a std::option::Option<i32>);
22355            impl<'a> serde::ser::Serialize for __With<'a> {
22356                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22357                where
22358                    S: serde::ser::Serializer,
22359                {
22360                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
22361                        self.0, serializer,
22362                    )
22363                }
22364            }
22365            state.serialize_entry("manualInstanceCount", &__With(&self.manual_instance_count))?;
22366        }
22367        if !self._unknown_fields.is_empty() {
22368            for (key, value) in self._unknown_fields.iter() {
22369                state.serialize_entry(key, &value)?;
22370            }
22371        }
22372        state.end()
22373    }
22374}
22375
22376/// Defines additional types related to [ServiceScaling].
22377pub mod service_scaling {
22378    #[allow(unused_imports)]
22379    use super::*;
22380
22381    /// The scaling mode for the service. If not provided, it defaults to
22382    /// AUTOMATIC.
22383    ///
22384    /// # Working with unknown values
22385    ///
22386    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22387    /// additional enum variants at any time. Adding new variants is not considered
22388    /// a breaking change. Applications should write their code in anticipation of:
22389    ///
22390    /// - New values appearing in future releases of the client library, **and**
22391    /// - New values received dynamically, without application changes.
22392    ///
22393    /// Please consult the [Working with enums] section in the user guide for some
22394    /// guidelines.
22395    ///
22396    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22397    #[derive(Clone, Debug, PartialEq)]
22398    #[non_exhaustive]
22399    pub enum ScalingMode {
22400        /// Unspecified.
22401        Unspecified,
22402        /// Scale based on traffic between min and max instances.
22403        Automatic,
22404        /// Scale to exactly min instances and ignore max instances.
22405        Manual,
22406        /// If set, the enum was initialized with an unknown value.
22407        ///
22408        /// Applications can examine the value using [ScalingMode::value] or
22409        /// [ScalingMode::name].
22410        UnknownValue(scaling_mode::UnknownValue),
22411    }
22412
22413    #[doc(hidden)]
22414    pub mod scaling_mode {
22415        #[allow(unused_imports)]
22416        use super::*;
22417        #[derive(Clone, Debug, PartialEq)]
22418        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22419    }
22420
22421    impl ScalingMode {
22422        /// Gets the enum value.
22423        ///
22424        /// Returns `None` if the enum contains an unknown value deserialized from
22425        /// the string representation of enums.
22426        pub fn value(&self) -> std::option::Option<i32> {
22427            match self {
22428                Self::Unspecified => std::option::Option::Some(0),
22429                Self::Automatic => std::option::Option::Some(1),
22430                Self::Manual => std::option::Option::Some(2),
22431                Self::UnknownValue(u) => u.0.value(),
22432            }
22433        }
22434
22435        /// Gets the enum value as a string.
22436        ///
22437        /// Returns `None` if the enum contains an unknown value deserialized from
22438        /// the integer representation of enums.
22439        pub fn name(&self) -> std::option::Option<&str> {
22440            match self {
22441                Self::Unspecified => std::option::Option::Some("SCALING_MODE_UNSPECIFIED"),
22442                Self::Automatic => std::option::Option::Some("AUTOMATIC"),
22443                Self::Manual => std::option::Option::Some("MANUAL"),
22444                Self::UnknownValue(u) => u.0.name(),
22445            }
22446        }
22447    }
22448
22449    impl std::default::Default for ScalingMode {
22450        fn default() -> Self {
22451            use std::convert::From;
22452            Self::from(0)
22453        }
22454    }
22455
22456    impl std::fmt::Display for ScalingMode {
22457        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22458            wkt::internal::display_enum(f, self.name(), self.value())
22459        }
22460    }
22461
22462    impl std::convert::From<i32> for ScalingMode {
22463        fn from(value: i32) -> Self {
22464            match value {
22465                0 => Self::Unspecified,
22466                1 => Self::Automatic,
22467                2 => Self::Manual,
22468                _ => Self::UnknownValue(scaling_mode::UnknownValue(
22469                    wkt::internal::UnknownEnumValue::Integer(value),
22470                )),
22471            }
22472        }
22473    }
22474
22475    impl std::convert::From<&str> for ScalingMode {
22476        fn from(value: &str) -> Self {
22477            use std::string::ToString;
22478            match value {
22479                "SCALING_MODE_UNSPECIFIED" => Self::Unspecified,
22480                "AUTOMATIC" => Self::Automatic,
22481                "MANUAL" => Self::Manual,
22482                _ => Self::UnknownValue(scaling_mode::UnknownValue(
22483                    wkt::internal::UnknownEnumValue::String(value.to_string()),
22484                )),
22485            }
22486        }
22487    }
22488
22489    impl serde::ser::Serialize for ScalingMode {
22490        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22491        where
22492            S: serde::Serializer,
22493        {
22494            match self {
22495                Self::Unspecified => serializer.serialize_i32(0),
22496                Self::Automatic => serializer.serialize_i32(1),
22497                Self::Manual => serializer.serialize_i32(2),
22498                Self::UnknownValue(u) => u.0.serialize(serializer),
22499            }
22500        }
22501    }
22502
22503    impl<'de> serde::de::Deserialize<'de> for ScalingMode {
22504        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22505        where
22506            D: serde::Deserializer<'de>,
22507        {
22508            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScalingMode>::new(
22509                ".google.cloud.run.v2.ServiceScaling.ScalingMode",
22510            ))
22511        }
22512    }
22513}
22514
22515/// Hardware constraints configuration.
22516#[derive(Clone, Debug, Default, PartialEq)]
22517#[non_exhaustive]
22518pub struct NodeSelector {
22519    /// Required. GPU accelerator type to attach to an instance.
22520    pub accelerator: std::string::String,
22521
22522    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22523}
22524
22525impl NodeSelector {
22526    pub fn new() -> Self {
22527        std::default::Default::default()
22528    }
22529
22530    /// Sets the value of [accelerator][crate::model::NodeSelector::accelerator].
22531    pub fn set_accelerator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22532        self.accelerator = v.into();
22533        self
22534    }
22535}
22536
22537impl wkt::message::Message for NodeSelector {
22538    fn typename() -> &'static str {
22539        "type.googleapis.com/google.cloud.run.v2.NodeSelector"
22540    }
22541}
22542
22543#[doc(hidden)]
22544impl<'de> serde::de::Deserialize<'de> for NodeSelector {
22545    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22546    where
22547        D: serde::Deserializer<'de>,
22548    {
22549        #[allow(non_camel_case_types)]
22550        #[doc(hidden)]
22551        #[derive(PartialEq, Eq, Hash)]
22552        enum __FieldTag {
22553            __accelerator,
22554            Unknown(std::string::String),
22555        }
22556        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22557            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22558            where
22559                D: serde::Deserializer<'de>,
22560            {
22561                struct Visitor;
22562                impl<'de> serde::de::Visitor<'de> for Visitor {
22563                    type Value = __FieldTag;
22564                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22565                        formatter.write_str("a field name for NodeSelector")
22566                    }
22567                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22568                    where
22569                        E: serde::de::Error,
22570                    {
22571                        use std::result::Result::Ok;
22572                        use std::string::ToString;
22573                        match value {
22574                            "accelerator" => Ok(__FieldTag::__accelerator),
22575                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22576                        }
22577                    }
22578                }
22579                deserializer.deserialize_identifier(Visitor)
22580            }
22581        }
22582        struct Visitor;
22583        impl<'de> serde::de::Visitor<'de> for Visitor {
22584            type Value = NodeSelector;
22585            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22586                formatter.write_str("struct NodeSelector")
22587            }
22588            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22589            where
22590                A: serde::de::MapAccess<'de>,
22591            {
22592                #[allow(unused_imports)]
22593                use serde::de::Error;
22594                use std::option::Option::Some;
22595                let mut fields = std::collections::HashSet::new();
22596                let mut result = Self::Value::new();
22597                while let Some(tag) = map.next_key::<__FieldTag>()? {
22598                    #[allow(clippy::match_single_binding)]
22599                    match tag {
22600                        __FieldTag::__accelerator => {
22601                            if !fields.insert(__FieldTag::__accelerator) {
22602                                return std::result::Result::Err(A::Error::duplicate_field(
22603                                    "multiple values for accelerator",
22604                                ));
22605                            }
22606                            result.accelerator = map
22607                                .next_value::<std::option::Option<std::string::String>>()?
22608                                .unwrap_or_default();
22609                        }
22610                        __FieldTag::Unknown(key) => {
22611                            let value = map.next_value::<serde_json::Value>()?;
22612                            result._unknown_fields.insert(key, value);
22613                        }
22614                    }
22615                }
22616                std::result::Result::Ok(result)
22617            }
22618        }
22619        deserializer.deserialize_any(Visitor)
22620    }
22621}
22622
22623#[doc(hidden)]
22624impl serde::ser::Serialize for NodeSelector {
22625    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22626    where
22627        S: serde::ser::Serializer,
22628    {
22629        use serde::ser::SerializeMap;
22630        #[allow(unused_imports)]
22631        use std::option::Option::Some;
22632        let mut state = serializer.serialize_map(std::option::Option::None)?;
22633        if !self.accelerator.is_empty() {
22634            state.serialize_entry("accelerator", &self.accelerator)?;
22635        }
22636        if !self._unknown_fields.is_empty() {
22637            for (key, value) in self._unknown_fields.iter() {
22638                state.serialize_entry(key, &value)?;
22639            }
22640        }
22641        state.end()
22642    }
22643}
22644
22645/// Describes the Build step of the function that builds a container from the
22646/// given source.
22647#[derive(Clone, Debug, Default, PartialEq)]
22648#[non_exhaustive]
22649pub struct BuildConfig {
22650    /// Output only. The Cloud Build name of the latest successful deployment of
22651    /// the function.
22652    pub name: std::string::String,
22653
22654    /// The Cloud Storage bucket URI where the function source code is located.
22655    pub source_location: std::string::String,
22656
22657    /// Optional. The name of the function (as defined in source code) that will be
22658    /// executed. Defaults to the resource name suffix, if not specified. For
22659    /// backward compatibility, if function with given name is not found, then the
22660    /// system will try to use function named "function".
22661    pub function_target: std::string::String,
22662
22663    /// Optional. Artifact Registry URI to store the built image.
22664    pub image_uri: std::string::String,
22665
22666    /// Optional. The base image used to build the function.
22667    pub base_image: std::string::String,
22668
22669    /// Optional. Sets whether the function will receive automatic base image
22670    /// updates.
22671    pub enable_automatic_updates: bool,
22672
22673    /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to
22674    /// build the Cloud Run function. The format of this field is
22675    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
22676    /// `{project}` and `{region}` are the project id and region respectively where
22677    /// the worker pool is defined and `{workerPool}` is the short name of the
22678    /// worker pool.
22679    pub worker_pool: std::string::String,
22680
22681    /// Optional. User-provided build-time environment variables for the function
22682    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
22683
22684    /// Optional. Service account to be used for building the container. The format
22685    /// of this field is
22686    /// `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
22687    pub service_account: std::string::String,
22688
22689    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22690}
22691
22692impl BuildConfig {
22693    pub fn new() -> Self {
22694        std::default::Default::default()
22695    }
22696
22697    /// Sets the value of [name][crate::model::BuildConfig::name].
22698    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22699        self.name = v.into();
22700        self
22701    }
22702
22703    /// Sets the value of [source_location][crate::model::BuildConfig::source_location].
22704    pub fn set_source_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22705        self.source_location = v.into();
22706        self
22707    }
22708
22709    /// Sets the value of [function_target][crate::model::BuildConfig::function_target].
22710    pub fn set_function_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22711        self.function_target = v.into();
22712        self
22713    }
22714
22715    /// Sets the value of [image_uri][crate::model::BuildConfig::image_uri].
22716    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22717        self.image_uri = v.into();
22718        self
22719    }
22720
22721    /// Sets the value of [base_image][crate::model::BuildConfig::base_image].
22722    pub fn set_base_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22723        self.base_image = v.into();
22724        self
22725    }
22726
22727    /// Sets the value of [enable_automatic_updates][crate::model::BuildConfig::enable_automatic_updates].
22728    pub fn set_enable_automatic_updates<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22729        self.enable_automatic_updates = v.into();
22730        self
22731    }
22732
22733    /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
22734    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22735        self.worker_pool = v.into();
22736        self
22737    }
22738
22739    /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
22740    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
22741    where
22742        T: std::iter::IntoIterator<Item = (K, V)>,
22743        K: std::convert::Into<std::string::String>,
22744        V: std::convert::Into<std::string::String>,
22745    {
22746        use std::iter::Iterator;
22747        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22748        self
22749    }
22750
22751    /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
22752    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22753        self.service_account = v.into();
22754        self
22755    }
22756}
22757
22758impl wkt::message::Message for BuildConfig {
22759    fn typename() -> &'static str {
22760        "type.googleapis.com/google.cloud.run.v2.BuildConfig"
22761    }
22762}
22763
22764#[doc(hidden)]
22765impl<'de> serde::de::Deserialize<'de> for BuildConfig {
22766    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22767    where
22768        D: serde::Deserializer<'de>,
22769    {
22770        #[allow(non_camel_case_types)]
22771        #[doc(hidden)]
22772        #[derive(PartialEq, Eq, Hash)]
22773        enum __FieldTag {
22774            __name,
22775            __source_location,
22776            __function_target,
22777            __image_uri,
22778            __base_image,
22779            __enable_automatic_updates,
22780            __worker_pool,
22781            __environment_variables,
22782            __service_account,
22783            Unknown(std::string::String),
22784        }
22785        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22786            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22787            where
22788                D: serde::Deserializer<'de>,
22789            {
22790                struct Visitor;
22791                impl<'de> serde::de::Visitor<'de> for Visitor {
22792                    type Value = __FieldTag;
22793                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22794                        formatter.write_str("a field name for BuildConfig")
22795                    }
22796                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22797                    where
22798                        E: serde::de::Error,
22799                    {
22800                        use std::result::Result::Ok;
22801                        use std::string::ToString;
22802                        match value {
22803                            "name" => Ok(__FieldTag::__name),
22804                            "sourceLocation" => Ok(__FieldTag::__source_location),
22805                            "source_location" => Ok(__FieldTag::__source_location),
22806                            "functionTarget" => Ok(__FieldTag::__function_target),
22807                            "function_target" => Ok(__FieldTag::__function_target),
22808                            "imageUri" => Ok(__FieldTag::__image_uri),
22809                            "image_uri" => Ok(__FieldTag::__image_uri),
22810                            "baseImage" => Ok(__FieldTag::__base_image),
22811                            "base_image" => Ok(__FieldTag::__base_image),
22812                            "enableAutomaticUpdates" => Ok(__FieldTag::__enable_automatic_updates),
22813                            "enable_automatic_updates" => {
22814                                Ok(__FieldTag::__enable_automatic_updates)
22815                            }
22816                            "workerPool" => Ok(__FieldTag::__worker_pool),
22817                            "worker_pool" => Ok(__FieldTag::__worker_pool),
22818                            "environmentVariables" => Ok(__FieldTag::__environment_variables),
22819                            "environment_variables" => Ok(__FieldTag::__environment_variables),
22820                            "serviceAccount" => Ok(__FieldTag::__service_account),
22821                            "service_account" => Ok(__FieldTag::__service_account),
22822                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22823                        }
22824                    }
22825                }
22826                deserializer.deserialize_identifier(Visitor)
22827            }
22828        }
22829        struct Visitor;
22830        impl<'de> serde::de::Visitor<'de> for Visitor {
22831            type Value = BuildConfig;
22832            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22833                formatter.write_str("struct BuildConfig")
22834            }
22835            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22836            where
22837                A: serde::de::MapAccess<'de>,
22838            {
22839                #[allow(unused_imports)]
22840                use serde::de::Error;
22841                use std::option::Option::Some;
22842                let mut fields = std::collections::HashSet::new();
22843                let mut result = Self::Value::new();
22844                while let Some(tag) = map.next_key::<__FieldTag>()? {
22845                    #[allow(clippy::match_single_binding)]
22846                    match tag {
22847                        __FieldTag::__name => {
22848                            if !fields.insert(__FieldTag::__name) {
22849                                return std::result::Result::Err(A::Error::duplicate_field(
22850                                    "multiple values for name",
22851                                ));
22852                            }
22853                            result.name = map
22854                                .next_value::<std::option::Option<std::string::String>>()?
22855                                .unwrap_or_default();
22856                        }
22857                        __FieldTag::__source_location => {
22858                            if !fields.insert(__FieldTag::__source_location) {
22859                                return std::result::Result::Err(A::Error::duplicate_field(
22860                                    "multiple values for source_location",
22861                                ));
22862                            }
22863                            result.source_location = map
22864                                .next_value::<std::option::Option<std::string::String>>()?
22865                                .unwrap_or_default();
22866                        }
22867                        __FieldTag::__function_target => {
22868                            if !fields.insert(__FieldTag::__function_target) {
22869                                return std::result::Result::Err(A::Error::duplicate_field(
22870                                    "multiple values for function_target",
22871                                ));
22872                            }
22873                            result.function_target = map
22874                                .next_value::<std::option::Option<std::string::String>>()?
22875                                .unwrap_or_default();
22876                        }
22877                        __FieldTag::__image_uri => {
22878                            if !fields.insert(__FieldTag::__image_uri) {
22879                                return std::result::Result::Err(A::Error::duplicate_field(
22880                                    "multiple values for image_uri",
22881                                ));
22882                            }
22883                            result.image_uri = map
22884                                .next_value::<std::option::Option<std::string::String>>()?
22885                                .unwrap_or_default();
22886                        }
22887                        __FieldTag::__base_image => {
22888                            if !fields.insert(__FieldTag::__base_image) {
22889                                return std::result::Result::Err(A::Error::duplicate_field(
22890                                    "multiple values for base_image",
22891                                ));
22892                            }
22893                            result.base_image = map
22894                                .next_value::<std::option::Option<std::string::String>>()?
22895                                .unwrap_or_default();
22896                        }
22897                        __FieldTag::__enable_automatic_updates => {
22898                            if !fields.insert(__FieldTag::__enable_automatic_updates) {
22899                                return std::result::Result::Err(A::Error::duplicate_field(
22900                                    "multiple values for enable_automatic_updates",
22901                                ));
22902                            }
22903                            result.enable_automatic_updates = map
22904                                .next_value::<std::option::Option<bool>>()?
22905                                .unwrap_or_default();
22906                        }
22907                        __FieldTag::__worker_pool => {
22908                            if !fields.insert(__FieldTag::__worker_pool) {
22909                                return std::result::Result::Err(A::Error::duplicate_field(
22910                                    "multiple values for worker_pool",
22911                                ));
22912                            }
22913                            result.worker_pool = map
22914                                .next_value::<std::option::Option<std::string::String>>()?
22915                                .unwrap_or_default();
22916                        }
22917                        __FieldTag::__environment_variables => {
22918                            if !fields.insert(__FieldTag::__environment_variables) {
22919                                return std::result::Result::Err(A::Error::duplicate_field(
22920                                    "multiple values for environment_variables",
22921                                ));
22922                            }
22923                            result.environment_variables = map
22924                                .next_value::<std::option::Option<
22925                                    std::collections::HashMap<
22926                                        std::string::String,
22927                                        std::string::String,
22928                                    >,
22929                                >>()?
22930                                .unwrap_or_default();
22931                        }
22932                        __FieldTag::__service_account => {
22933                            if !fields.insert(__FieldTag::__service_account) {
22934                                return std::result::Result::Err(A::Error::duplicate_field(
22935                                    "multiple values for service_account",
22936                                ));
22937                            }
22938                            result.service_account = map
22939                                .next_value::<std::option::Option<std::string::String>>()?
22940                                .unwrap_or_default();
22941                        }
22942                        __FieldTag::Unknown(key) => {
22943                            let value = map.next_value::<serde_json::Value>()?;
22944                            result._unknown_fields.insert(key, value);
22945                        }
22946                    }
22947                }
22948                std::result::Result::Ok(result)
22949            }
22950        }
22951        deserializer.deserialize_any(Visitor)
22952    }
22953}
22954
22955#[doc(hidden)]
22956impl serde::ser::Serialize for BuildConfig {
22957    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22958    where
22959        S: serde::ser::Serializer,
22960    {
22961        use serde::ser::SerializeMap;
22962        #[allow(unused_imports)]
22963        use std::option::Option::Some;
22964        let mut state = serializer.serialize_map(std::option::Option::None)?;
22965        if !self.name.is_empty() {
22966            state.serialize_entry("name", &self.name)?;
22967        }
22968        if !self.source_location.is_empty() {
22969            state.serialize_entry("sourceLocation", &self.source_location)?;
22970        }
22971        if !self.function_target.is_empty() {
22972            state.serialize_entry("functionTarget", &self.function_target)?;
22973        }
22974        if !self.image_uri.is_empty() {
22975            state.serialize_entry("imageUri", &self.image_uri)?;
22976        }
22977        if !self.base_image.is_empty() {
22978            state.serialize_entry("baseImage", &self.base_image)?;
22979        }
22980        if !wkt::internal::is_default(&self.enable_automatic_updates) {
22981            state.serialize_entry("enableAutomaticUpdates", &self.enable_automatic_updates)?;
22982        }
22983        if !self.worker_pool.is_empty() {
22984            state.serialize_entry("workerPool", &self.worker_pool)?;
22985        }
22986        if !self.environment_variables.is_empty() {
22987            state.serialize_entry("environmentVariables", &self.environment_variables)?;
22988        }
22989        if !self.service_account.is_empty() {
22990            state.serialize_entry("serviceAccount", &self.service_account)?;
22991        }
22992        if !self._unknown_fields.is_empty() {
22993            for (key, value) in self._unknown_fields.iter() {
22994                state.serialize_entry(key, &value)?;
22995            }
22996        }
22997        state.end()
22998    }
22999}
23000
23001/// The type of instance allocation.
23002///
23003/// # Working with unknown values
23004///
23005/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23006/// additional enum variants at any time. Adding new variants is not considered
23007/// a breaking change. Applications should write their code in anticipation of:
23008///
23009/// - New values appearing in future releases of the client library, **and**
23010/// - New values received dynamically, without application changes.
23011///
23012/// Please consult the [Working with enums] section in the user guide for some
23013/// guidelines.
23014///
23015/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23016#[derive(Clone, Debug, PartialEq)]
23017#[non_exhaustive]
23018pub enum TrafficTargetAllocationType {
23019    /// Unspecified instance allocation type.
23020    Unspecified,
23021    /// Allocates instances to the Service's latest ready Revision.
23022    Latest,
23023    /// Allocates instances to a Revision by name.
23024    Revision,
23025    /// If set, the enum was initialized with an unknown value.
23026    ///
23027    /// Applications can examine the value using [TrafficTargetAllocationType::value] or
23028    /// [TrafficTargetAllocationType::name].
23029    UnknownValue(traffic_target_allocation_type::UnknownValue),
23030}
23031
23032#[doc(hidden)]
23033pub mod traffic_target_allocation_type {
23034    #[allow(unused_imports)]
23035    use super::*;
23036    #[derive(Clone, Debug, PartialEq)]
23037    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23038}
23039
23040impl TrafficTargetAllocationType {
23041    /// Gets the enum value.
23042    ///
23043    /// Returns `None` if the enum contains an unknown value deserialized from
23044    /// the string representation of enums.
23045    pub fn value(&self) -> std::option::Option<i32> {
23046        match self {
23047            Self::Unspecified => std::option::Option::Some(0),
23048            Self::Latest => std::option::Option::Some(1),
23049            Self::Revision => std::option::Option::Some(2),
23050            Self::UnknownValue(u) => u.0.value(),
23051        }
23052    }
23053
23054    /// Gets the enum value as a string.
23055    ///
23056    /// Returns `None` if the enum contains an unknown value deserialized from
23057    /// the integer representation of enums.
23058    pub fn name(&self) -> std::option::Option<&str> {
23059        match self {
23060            Self::Unspecified => {
23061                std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED")
23062            }
23063            Self::Latest => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
23064            Self::Revision => std::option::Option::Some("TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"),
23065            Self::UnknownValue(u) => u.0.name(),
23066        }
23067    }
23068}
23069
23070impl std::default::Default for TrafficTargetAllocationType {
23071    fn default() -> Self {
23072        use std::convert::From;
23073        Self::from(0)
23074    }
23075}
23076
23077impl std::fmt::Display for TrafficTargetAllocationType {
23078    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23079        wkt::internal::display_enum(f, self.name(), self.value())
23080    }
23081}
23082
23083impl std::convert::From<i32> for TrafficTargetAllocationType {
23084    fn from(value: i32) -> Self {
23085        match value {
23086            0 => Self::Unspecified,
23087            1 => Self::Latest,
23088            2 => Self::Revision,
23089            _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
23090                wkt::internal::UnknownEnumValue::Integer(value),
23091            )),
23092        }
23093    }
23094}
23095
23096impl std::convert::From<&str> for TrafficTargetAllocationType {
23097    fn from(value: &str) -> Self {
23098        use std::string::ToString;
23099        match value {
23100            "TRAFFIC_TARGET_ALLOCATION_TYPE_UNSPECIFIED" => Self::Unspecified,
23101            "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST" => Self::Latest,
23102            "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION" => Self::Revision,
23103            _ => Self::UnknownValue(traffic_target_allocation_type::UnknownValue(
23104                wkt::internal::UnknownEnumValue::String(value.to_string()),
23105            )),
23106        }
23107    }
23108}
23109
23110impl serde::ser::Serialize for TrafficTargetAllocationType {
23111    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23112    where
23113        S: serde::Serializer,
23114    {
23115        match self {
23116            Self::Unspecified => serializer.serialize_i32(0),
23117            Self::Latest => serializer.serialize_i32(1),
23118            Self::Revision => serializer.serialize_i32(2),
23119            Self::UnknownValue(u) => u.0.serialize(serializer),
23120        }
23121    }
23122}
23123
23124impl<'de> serde::de::Deserialize<'de> for TrafficTargetAllocationType {
23125    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23126    where
23127        D: serde::Deserializer<'de>,
23128    {
23129        deserializer.deserialize_any(
23130            wkt::internal::EnumVisitor::<TrafficTargetAllocationType>::new(
23131                ".google.cloud.run.v2.TrafficTargetAllocationType",
23132            ),
23133        )
23134    }
23135}
23136
23137/// Allowed ingress traffic for the Container.
23138///
23139/// # Working with unknown values
23140///
23141/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23142/// additional enum variants at any time. Adding new variants is not considered
23143/// a breaking change. Applications should write their code in anticipation of:
23144///
23145/// - New values appearing in future releases of the client library, **and**
23146/// - New values received dynamically, without application changes.
23147///
23148/// Please consult the [Working with enums] section in the user guide for some
23149/// guidelines.
23150///
23151/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23152#[derive(Clone, Debug, PartialEq)]
23153#[non_exhaustive]
23154pub enum IngressTraffic {
23155    /// Unspecified
23156    Unspecified,
23157    /// All inbound traffic is allowed.
23158    All,
23159    /// Only internal traffic is allowed.
23160    InternalOnly,
23161    /// Both internal and Google Cloud Load Balancer traffic is allowed.
23162    InternalLoadBalancer,
23163    /// No ingress traffic is allowed.
23164    None,
23165    /// If set, the enum was initialized with an unknown value.
23166    ///
23167    /// Applications can examine the value using [IngressTraffic::value] or
23168    /// [IngressTraffic::name].
23169    UnknownValue(ingress_traffic::UnknownValue),
23170}
23171
23172#[doc(hidden)]
23173pub mod ingress_traffic {
23174    #[allow(unused_imports)]
23175    use super::*;
23176    #[derive(Clone, Debug, PartialEq)]
23177    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23178}
23179
23180impl IngressTraffic {
23181    /// Gets the enum value.
23182    ///
23183    /// Returns `None` if the enum contains an unknown value deserialized from
23184    /// the string representation of enums.
23185    pub fn value(&self) -> std::option::Option<i32> {
23186        match self {
23187            Self::Unspecified => std::option::Option::Some(0),
23188            Self::All => std::option::Option::Some(1),
23189            Self::InternalOnly => std::option::Option::Some(2),
23190            Self::InternalLoadBalancer => std::option::Option::Some(3),
23191            Self::None => std::option::Option::Some(4),
23192            Self::UnknownValue(u) => u.0.value(),
23193        }
23194    }
23195
23196    /// Gets the enum value as a string.
23197    ///
23198    /// Returns `None` if the enum contains an unknown value deserialized from
23199    /// the integer representation of enums.
23200    pub fn name(&self) -> std::option::Option<&str> {
23201        match self {
23202            Self::Unspecified => std::option::Option::Some("INGRESS_TRAFFIC_UNSPECIFIED"),
23203            Self::All => std::option::Option::Some("INGRESS_TRAFFIC_ALL"),
23204            Self::InternalOnly => std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_ONLY"),
23205            Self::InternalLoadBalancer => {
23206                std::option::Option::Some("INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER")
23207            }
23208            Self::None => std::option::Option::Some("INGRESS_TRAFFIC_NONE"),
23209            Self::UnknownValue(u) => u.0.name(),
23210        }
23211    }
23212}
23213
23214impl std::default::Default for IngressTraffic {
23215    fn default() -> Self {
23216        use std::convert::From;
23217        Self::from(0)
23218    }
23219}
23220
23221impl std::fmt::Display for IngressTraffic {
23222    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23223        wkt::internal::display_enum(f, self.name(), self.value())
23224    }
23225}
23226
23227impl std::convert::From<i32> for IngressTraffic {
23228    fn from(value: i32) -> Self {
23229        match value {
23230            0 => Self::Unspecified,
23231            1 => Self::All,
23232            2 => Self::InternalOnly,
23233            3 => Self::InternalLoadBalancer,
23234            4 => Self::None,
23235            _ => Self::UnknownValue(ingress_traffic::UnknownValue(
23236                wkt::internal::UnknownEnumValue::Integer(value),
23237            )),
23238        }
23239    }
23240}
23241
23242impl std::convert::From<&str> for IngressTraffic {
23243    fn from(value: &str) -> Self {
23244        use std::string::ToString;
23245        match value {
23246            "INGRESS_TRAFFIC_UNSPECIFIED" => Self::Unspecified,
23247            "INGRESS_TRAFFIC_ALL" => Self::All,
23248            "INGRESS_TRAFFIC_INTERNAL_ONLY" => Self::InternalOnly,
23249            "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER" => Self::InternalLoadBalancer,
23250            "INGRESS_TRAFFIC_NONE" => Self::None,
23251            _ => Self::UnknownValue(ingress_traffic::UnknownValue(
23252                wkt::internal::UnknownEnumValue::String(value.to_string()),
23253            )),
23254        }
23255    }
23256}
23257
23258impl serde::ser::Serialize for IngressTraffic {
23259    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23260    where
23261        S: serde::Serializer,
23262    {
23263        match self {
23264            Self::Unspecified => serializer.serialize_i32(0),
23265            Self::All => serializer.serialize_i32(1),
23266            Self::InternalOnly => serializer.serialize_i32(2),
23267            Self::InternalLoadBalancer => serializer.serialize_i32(3),
23268            Self::None => serializer.serialize_i32(4),
23269            Self::UnknownValue(u) => u.0.serialize(serializer),
23270        }
23271    }
23272}
23273
23274impl<'de> serde::de::Deserialize<'de> for IngressTraffic {
23275    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23276    where
23277        D: serde::Deserializer<'de>,
23278    {
23279        deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressTraffic>::new(
23280            ".google.cloud.run.v2.IngressTraffic",
23281        ))
23282    }
23283}
23284
23285/// Alternatives for execution environments.
23286///
23287/// # Working with unknown values
23288///
23289/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23290/// additional enum variants at any time. Adding new variants is not considered
23291/// a breaking change. Applications should write their code in anticipation of:
23292///
23293/// - New values appearing in future releases of the client library, **and**
23294/// - New values received dynamically, without application changes.
23295///
23296/// Please consult the [Working with enums] section in the user guide for some
23297/// guidelines.
23298///
23299/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23300#[derive(Clone, Debug, PartialEq)]
23301#[non_exhaustive]
23302pub enum ExecutionEnvironment {
23303    /// Unspecified
23304    Unspecified,
23305    /// Uses the First Generation environment.
23306    Gen1,
23307    /// Uses Second Generation environment.
23308    Gen2,
23309    /// If set, the enum was initialized with an unknown value.
23310    ///
23311    /// Applications can examine the value using [ExecutionEnvironment::value] or
23312    /// [ExecutionEnvironment::name].
23313    UnknownValue(execution_environment::UnknownValue),
23314}
23315
23316#[doc(hidden)]
23317pub mod execution_environment {
23318    #[allow(unused_imports)]
23319    use super::*;
23320    #[derive(Clone, Debug, PartialEq)]
23321    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23322}
23323
23324impl ExecutionEnvironment {
23325    /// Gets the enum value.
23326    ///
23327    /// Returns `None` if the enum contains an unknown value deserialized from
23328    /// the string representation of enums.
23329    pub fn value(&self) -> std::option::Option<i32> {
23330        match self {
23331            Self::Unspecified => std::option::Option::Some(0),
23332            Self::Gen1 => std::option::Option::Some(1),
23333            Self::Gen2 => std::option::Option::Some(2),
23334            Self::UnknownValue(u) => u.0.value(),
23335        }
23336    }
23337
23338    /// Gets the enum value as a string.
23339    ///
23340    /// Returns `None` if the enum contains an unknown value deserialized from
23341    /// the integer representation of enums.
23342    pub fn name(&self) -> std::option::Option<&str> {
23343        match self {
23344            Self::Unspecified => std::option::Option::Some("EXECUTION_ENVIRONMENT_UNSPECIFIED"),
23345            Self::Gen1 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN1"),
23346            Self::Gen2 => std::option::Option::Some("EXECUTION_ENVIRONMENT_GEN2"),
23347            Self::UnknownValue(u) => u.0.name(),
23348        }
23349    }
23350}
23351
23352impl std::default::Default for ExecutionEnvironment {
23353    fn default() -> Self {
23354        use std::convert::From;
23355        Self::from(0)
23356    }
23357}
23358
23359impl std::fmt::Display for ExecutionEnvironment {
23360    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23361        wkt::internal::display_enum(f, self.name(), self.value())
23362    }
23363}
23364
23365impl std::convert::From<i32> for ExecutionEnvironment {
23366    fn from(value: i32) -> Self {
23367        match value {
23368            0 => Self::Unspecified,
23369            1 => Self::Gen1,
23370            2 => Self::Gen2,
23371            _ => Self::UnknownValue(execution_environment::UnknownValue(
23372                wkt::internal::UnknownEnumValue::Integer(value),
23373            )),
23374        }
23375    }
23376}
23377
23378impl std::convert::From<&str> for ExecutionEnvironment {
23379    fn from(value: &str) -> Self {
23380        use std::string::ToString;
23381        match value {
23382            "EXECUTION_ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
23383            "EXECUTION_ENVIRONMENT_GEN1" => Self::Gen1,
23384            "EXECUTION_ENVIRONMENT_GEN2" => Self::Gen2,
23385            _ => Self::UnknownValue(execution_environment::UnknownValue(
23386                wkt::internal::UnknownEnumValue::String(value.to_string()),
23387            )),
23388        }
23389    }
23390}
23391
23392impl serde::ser::Serialize for ExecutionEnvironment {
23393    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23394    where
23395        S: serde::Serializer,
23396    {
23397        match self {
23398            Self::Unspecified => serializer.serialize_i32(0),
23399            Self::Gen1 => serializer.serialize_i32(1),
23400            Self::Gen2 => serializer.serialize_i32(2),
23401            Self::UnknownValue(u) => u.0.serialize(serializer),
23402        }
23403    }
23404}
23405
23406impl<'de> serde::de::Deserialize<'de> for ExecutionEnvironment {
23407    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23408    where
23409        D: serde::Deserializer<'de>,
23410    {
23411        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionEnvironment>::new(
23412            ".google.cloud.run.v2.ExecutionEnvironment",
23413        ))
23414    }
23415}
23416
23417/// Specifies behavior if an encryption key used by a resource is revoked.
23418///
23419/// # Working with unknown values
23420///
23421/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23422/// additional enum variants at any time. Adding new variants is not considered
23423/// a breaking change. Applications should write their code in anticipation of:
23424///
23425/// - New values appearing in future releases of the client library, **and**
23426/// - New values received dynamically, without application changes.
23427///
23428/// Please consult the [Working with enums] section in the user guide for some
23429/// guidelines.
23430///
23431/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23432#[derive(Clone, Debug, PartialEq)]
23433#[non_exhaustive]
23434pub enum EncryptionKeyRevocationAction {
23435    /// Unspecified
23436    Unspecified,
23437    /// Prevents the creation of new instances.
23438    PreventNew,
23439    /// Shuts down existing instances, and prevents creation of new ones.
23440    Shutdown,
23441    /// If set, the enum was initialized with an unknown value.
23442    ///
23443    /// Applications can examine the value using [EncryptionKeyRevocationAction::value] or
23444    /// [EncryptionKeyRevocationAction::name].
23445    UnknownValue(encryption_key_revocation_action::UnknownValue),
23446}
23447
23448#[doc(hidden)]
23449pub mod encryption_key_revocation_action {
23450    #[allow(unused_imports)]
23451    use super::*;
23452    #[derive(Clone, Debug, PartialEq)]
23453    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23454}
23455
23456impl EncryptionKeyRevocationAction {
23457    /// Gets the enum value.
23458    ///
23459    /// Returns `None` if the enum contains an unknown value deserialized from
23460    /// the string representation of enums.
23461    pub fn value(&self) -> std::option::Option<i32> {
23462        match self {
23463            Self::Unspecified => std::option::Option::Some(0),
23464            Self::PreventNew => std::option::Option::Some(1),
23465            Self::Shutdown => std::option::Option::Some(2),
23466            Self::UnknownValue(u) => u.0.value(),
23467        }
23468    }
23469
23470    /// Gets the enum value as a string.
23471    ///
23472    /// Returns `None` if the enum contains an unknown value deserialized from
23473    /// the integer representation of enums.
23474    pub fn name(&self) -> std::option::Option<&str> {
23475        match self {
23476            Self::Unspecified => {
23477                std::option::Option::Some("ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED")
23478            }
23479            Self::PreventNew => std::option::Option::Some("PREVENT_NEW"),
23480            Self::Shutdown => std::option::Option::Some("SHUTDOWN"),
23481            Self::UnknownValue(u) => u.0.name(),
23482        }
23483    }
23484}
23485
23486impl std::default::Default for EncryptionKeyRevocationAction {
23487    fn default() -> Self {
23488        use std::convert::From;
23489        Self::from(0)
23490    }
23491}
23492
23493impl std::fmt::Display for EncryptionKeyRevocationAction {
23494    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23495        wkt::internal::display_enum(f, self.name(), self.value())
23496    }
23497}
23498
23499impl std::convert::From<i32> for EncryptionKeyRevocationAction {
23500    fn from(value: i32) -> Self {
23501        match value {
23502            0 => Self::Unspecified,
23503            1 => Self::PreventNew,
23504            2 => Self::Shutdown,
23505            _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
23506                wkt::internal::UnknownEnumValue::Integer(value),
23507            )),
23508        }
23509    }
23510}
23511
23512impl std::convert::From<&str> for EncryptionKeyRevocationAction {
23513    fn from(value: &str) -> Self {
23514        use std::string::ToString;
23515        match value {
23516            "ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED" => Self::Unspecified,
23517            "PREVENT_NEW" => Self::PreventNew,
23518            "SHUTDOWN" => Self::Shutdown,
23519            _ => Self::UnknownValue(encryption_key_revocation_action::UnknownValue(
23520                wkt::internal::UnknownEnumValue::String(value.to_string()),
23521            )),
23522        }
23523    }
23524}
23525
23526impl serde::ser::Serialize for EncryptionKeyRevocationAction {
23527    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23528    where
23529        S: serde::Serializer,
23530    {
23531        match self {
23532            Self::Unspecified => serializer.serialize_i32(0),
23533            Self::PreventNew => serializer.serialize_i32(1),
23534            Self::Shutdown => serializer.serialize_i32(2),
23535            Self::UnknownValue(u) => u.0.serialize(serializer),
23536        }
23537    }
23538}
23539
23540impl<'de> serde::de::Deserialize<'de> for EncryptionKeyRevocationAction {
23541    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23542    where
23543        D: serde::Deserializer<'de>,
23544    {
23545        deserializer.deserialize_any(
23546            wkt::internal::EnumVisitor::<EncryptionKeyRevocationAction>::new(
23547                ".google.cloud.run.v2.EncryptionKeyRevocationAction",
23548            ),
23549        )
23550    }
23551}