google_cloud_ids_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate longrunning;
26extern crate lro;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35/// Endpoint describes a single IDS endpoint. It defines a forwarding rule to
36/// which packets can be sent for IDS inspection.
37#[derive(Clone, Debug, Default, PartialEq)]
38#[non_exhaustive]
39pub struct Endpoint {
40    /// Output only. The name of the endpoint.
41    pub name: std::string::String,
42
43    /// Output only. The create time timestamp.
44    pub create_time: std::option::Option<wkt::Timestamp>,
45
46    /// Output only. The update time timestamp.
47    pub update_time: std::option::Option<wkt::Timestamp>,
48
49    /// The labels of the endpoint.
50    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
51
52    /// Required. The fully qualified URL of the network to which the IDS Endpoint is
53    /// attached.
54    pub network: std::string::String,
55
56    /// Output only. The fully qualified URL of the endpoint's ILB Forwarding Rule.
57    pub endpoint_forwarding_rule: std::string::String,
58
59    /// Output only. The IP address of the IDS Endpoint's ILB.
60    pub endpoint_ip: std::string::String,
61
62    /// User-provided description of the endpoint
63    pub description: std::string::String,
64
65    /// Required. Lowest threat severity that this endpoint will alert on.
66    pub severity: crate::model::endpoint::Severity,
67
68    /// Output only. Current state of the endpoint.
69    pub state: crate::model::endpoint::State,
70
71    /// Whether the endpoint should report traffic logs in addition to threat logs.
72    pub traffic_logs: bool,
73
74    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
75}
76
77impl Endpoint {
78    pub fn new() -> Self {
79        std::default::Default::default()
80    }
81
82    /// Sets the value of [name][crate::model::Endpoint::name].
83    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.name = v.into();
85        self
86    }
87
88    /// Sets the value of [create_time][crate::model::Endpoint::create_time].
89    pub fn set_create_time<T>(mut self, v: T) -> Self
90    where
91        T: std::convert::Into<wkt::Timestamp>,
92    {
93        self.create_time = std::option::Option::Some(v.into());
94        self
95    }
96
97    /// Sets or clears the value of [create_time][crate::model::Endpoint::create_time].
98    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
99    where
100        T: std::convert::Into<wkt::Timestamp>,
101    {
102        self.create_time = v.map(|x| x.into());
103        self
104    }
105
106    /// Sets the value of [update_time][crate::model::Endpoint::update_time].
107    pub fn set_update_time<T>(mut self, v: T) -> Self
108    where
109        T: std::convert::Into<wkt::Timestamp>,
110    {
111        self.update_time = std::option::Option::Some(v.into());
112        self
113    }
114
115    /// Sets or clears the value of [update_time][crate::model::Endpoint::update_time].
116    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
117    where
118        T: std::convert::Into<wkt::Timestamp>,
119    {
120        self.update_time = v.map(|x| x.into());
121        self
122    }
123
124    /// Sets the value of [labels][crate::model::Endpoint::labels].
125    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
126    where
127        T: std::iter::IntoIterator<Item = (K, V)>,
128        K: std::convert::Into<std::string::String>,
129        V: std::convert::Into<std::string::String>,
130    {
131        use std::iter::Iterator;
132        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
133        self
134    }
135
136    /// Sets the value of [network][crate::model::Endpoint::network].
137    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
138        self.network = v.into();
139        self
140    }
141
142    /// Sets the value of [endpoint_forwarding_rule][crate::model::Endpoint::endpoint_forwarding_rule].
143    pub fn set_endpoint_forwarding_rule<T: std::convert::Into<std::string::String>>(
144        mut self,
145        v: T,
146    ) -> Self {
147        self.endpoint_forwarding_rule = v.into();
148        self
149    }
150
151    /// Sets the value of [endpoint_ip][crate::model::Endpoint::endpoint_ip].
152    pub fn set_endpoint_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
153        self.endpoint_ip = v.into();
154        self
155    }
156
157    /// Sets the value of [description][crate::model::Endpoint::description].
158    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
159        self.description = v.into();
160        self
161    }
162
163    /// Sets the value of [severity][crate::model::Endpoint::severity].
164    pub fn set_severity<T: std::convert::Into<crate::model::endpoint::Severity>>(
165        mut self,
166        v: T,
167    ) -> Self {
168        self.severity = v.into();
169        self
170    }
171
172    /// Sets the value of [state][crate::model::Endpoint::state].
173    pub fn set_state<T: std::convert::Into<crate::model::endpoint::State>>(mut self, v: T) -> Self {
174        self.state = v.into();
175        self
176    }
177
178    /// Sets the value of [traffic_logs][crate::model::Endpoint::traffic_logs].
179    pub fn set_traffic_logs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
180        self.traffic_logs = v.into();
181        self
182    }
183}
184
185impl wkt::message::Message for Endpoint {
186    fn typename() -> &'static str {
187        "type.googleapis.com/google.cloud.ids.v1.Endpoint"
188    }
189}
190
191#[doc(hidden)]
192impl<'de> serde::de::Deserialize<'de> for Endpoint {
193    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
194    where
195        D: serde::Deserializer<'de>,
196    {
197        #[allow(non_camel_case_types)]
198        #[doc(hidden)]
199        #[derive(PartialEq, Eq, Hash)]
200        enum __FieldTag {
201            __name,
202            __create_time,
203            __update_time,
204            __labels,
205            __network,
206            __endpoint_forwarding_rule,
207            __endpoint_ip,
208            __description,
209            __severity,
210            __state,
211            __traffic_logs,
212            Unknown(std::string::String),
213        }
214        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
215            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
216            where
217                D: serde::Deserializer<'de>,
218            {
219                struct Visitor;
220                impl<'de> serde::de::Visitor<'de> for Visitor {
221                    type Value = __FieldTag;
222                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
223                        formatter.write_str("a field name for Endpoint")
224                    }
225                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
226                    where
227                        E: serde::de::Error,
228                    {
229                        use std::result::Result::Ok;
230                        use std::string::ToString;
231                        match value {
232                            "name" => Ok(__FieldTag::__name),
233                            "createTime" => Ok(__FieldTag::__create_time),
234                            "create_time" => Ok(__FieldTag::__create_time),
235                            "updateTime" => Ok(__FieldTag::__update_time),
236                            "update_time" => Ok(__FieldTag::__update_time),
237                            "labels" => Ok(__FieldTag::__labels),
238                            "network" => Ok(__FieldTag::__network),
239                            "endpointForwardingRule" => Ok(__FieldTag::__endpoint_forwarding_rule),
240                            "endpoint_forwarding_rule" => {
241                                Ok(__FieldTag::__endpoint_forwarding_rule)
242                            }
243                            "endpointIp" => Ok(__FieldTag::__endpoint_ip),
244                            "endpoint_ip" => Ok(__FieldTag::__endpoint_ip),
245                            "description" => Ok(__FieldTag::__description),
246                            "severity" => Ok(__FieldTag::__severity),
247                            "state" => Ok(__FieldTag::__state),
248                            "trafficLogs" => Ok(__FieldTag::__traffic_logs),
249                            "traffic_logs" => Ok(__FieldTag::__traffic_logs),
250                            _ => Ok(__FieldTag::Unknown(value.to_string())),
251                        }
252                    }
253                }
254                deserializer.deserialize_identifier(Visitor)
255            }
256        }
257        struct Visitor;
258        impl<'de> serde::de::Visitor<'de> for Visitor {
259            type Value = Endpoint;
260            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
261                formatter.write_str("struct Endpoint")
262            }
263            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
264            where
265                A: serde::de::MapAccess<'de>,
266            {
267                #[allow(unused_imports)]
268                use serde::de::Error;
269                use std::option::Option::Some;
270                let mut fields = std::collections::HashSet::new();
271                let mut result = Self::Value::new();
272                while let Some(tag) = map.next_key::<__FieldTag>()? {
273                    #[allow(clippy::match_single_binding)]
274                    match tag {
275                        __FieldTag::__name => {
276                            if !fields.insert(__FieldTag::__name) {
277                                return std::result::Result::Err(A::Error::duplicate_field(
278                                    "multiple values for name",
279                                ));
280                            }
281                            result.name = map
282                                .next_value::<std::option::Option<std::string::String>>()?
283                                .unwrap_or_default();
284                        }
285                        __FieldTag::__create_time => {
286                            if !fields.insert(__FieldTag::__create_time) {
287                                return std::result::Result::Err(A::Error::duplicate_field(
288                                    "multiple values for create_time",
289                                ));
290                            }
291                            result.create_time =
292                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
293                        }
294                        __FieldTag::__update_time => {
295                            if !fields.insert(__FieldTag::__update_time) {
296                                return std::result::Result::Err(A::Error::duplicate_field(
297                                    "multiple values for update_time",
298                                ));
299                            }
300                            result.update_time =
301                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
302                        }
303                        __FieldTag::__labels => {
304                            if !fields.insert(__FieldTag::__labels) {
305                                return std::result::Result::Err(A::Error::duplicate_field(
306                                    "multiple values for labels",
307                                ));
308                            }
309                            result.labels = map
310                                .next_value::<std::option::Option<
311                                    std::collections::HashMap<
312                                        std::string::String,
313                                        std::string::String,
314                                    >,
315                                >>()?
316                                .unwrap_or_default();
317                        }
318                        __FieldTag::__network => {
319                            if !fields.insert(__FieldTag::__network) {
320                                return std::result::Result::Err(A::Error::duplicate_field(
321                                    "multiple values for network",
322                                ));
323                            }
324                            result.network = map
325                                .next_value::<std::option::Option<std::string::String>>()?
326                                .unwrap_or_default();
327                        }
328                        __FieldTag::__endpoint_forwarding_rule => {
329                            if !fields.insert(__FieldTag::__endpoint_forwarding_rule) {
330                                return std::result::Result::Err(A::Error::duplicate_field(
331                                    "multiple values for endpoint_forwarding_rule",
332                                ));
333                            }
334                            result.endpoint_forwarding_rule = map
335                                .next_value::<std::option::Option<std::string::String>>()?
336                                .unwrap_or_default();
337                        }
338                        __FieldTag::__endpoint_ip => {
339                            if !fields.insert(__FieldTag::__endpoint_ip) {
340                                return std::result::Result::Err(A::Error::duplicate_field(
341                                    "multiple values for endpoint_ip",
342                                ));
343                            }
344                            result.endpoint_ip = map
345                                .next_value::<std::option::Option<std::string::String>>()?
346                                .unwrap_or_default();
347                        }
348                        __FieldTag::__description => {
349                            if !fields.insert(__FieldTag::__description) {
350                                return std::result::Result::Err(A::Error::duplicate_field(
351                                    "multiple values for description",
352                                ));
353                            }
354                            result.description = map
355                                .next_value::<std::option::Option<std::string::String>>()?
356                                .unwrap_or_default();
357                        }
358                        __FieldTag::__severity => {
359                            if !fields.insert(__FieldTag::__severity) {
360                                return std::result::Result::Err(A::Error::duplicate_field(
361                                    "multiple values for severity",
362                                ));
363                            }
364                            result.severity = map.next_value::<std::option::Option<crate::model::endpoint::Severity>>()?.unwrap_or_default();
365                        }
366                        __FieldTag::__state => {
367                            if !fields.insert(__FieldTag::__state) {
368                                return std::result::Result::Err(A::Error::duplicate_field(
369                                    "multiple values for state",
370                                ));
371                            }
372                            result.state = map
373                                .next_value::<std::option::Option<crate::model::endpoint::State>>()?
374                                .unwrap_or_default();
375                        }
376                        __FieldTag::__traffic_logs => {
377                            if !fields.insert(__FieldTag::__traffic_logs) {
378                                return std::result::Result::Err(A::Error::duplicate_field(
379                                    "multiple values for traffic_logs",
380                                ));
381                            }
382                            result.traffic_logs = map
383                                .next_value::<std::option::Option<bool>>()?
384                                .unwrap_or_default();
385                        }
386                        __FieldTag::Unknown(key) => {
387                            let value = map.next_value::<serde_json::Value>()?;
388                            result._unknown_fields.insert(key, value);
389                        }
390                    }
391                }
392                std::result::Result::Ok(result)
393            }
394        }
395        deserializer.deserialize_any(Visitor)
396    }
397}
398
399#[doc(hidden)]
400impl serde::ser::Serialize for Endpoint {
401    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
402    where
403        S: serde::ser::Serializer,
404    {
405        use serde::ser::SerializeMap;
406        #[allow(unused_imports)]
407        use std::option::Option::Some;
408        let mut state = serializer.serialize_map(std::option::Option::None)?;
409        if !self.name.is_empty() {
410            state.serialize_entry("name", &self.name)?;
411        }
412        if self.create_time.is_some() {
413            state.serialize_entry("createTime", &self.create_time)?;
414        }
415        if self.update_time.is_some() {
416            state.serialize_entry("updateTime", &self.update_time)?;
417        }
418        if !self.labels.is_empty() {
419            state.serialize_entry("labels", &self.labels)?;
420        }
421        if !self.network.is_empty() {
422            state.serialize_entry("network", &self.network)?;
423        }
424        if !self.endpoint_forwarding_rule.is_empty() {
425            state.serialize_entry("endpointForwardingRule", &self.endpoint_forwarding_rule)?;
426        }
427        if !self.endpoint_ip.is_empty() {
428            state.serialize_entry("endpointIp", &self.endpoint_ip)?;
429        }
430        if !self.description.is_empty() {
431            state.serialize_entry("description", &self.description)?;
432        }
433        if !wkt::internal::is_default(&self.severity) {
434            state.serialize_entry("severity", &self.severity)?;
435        }
436        if !wkt::internal::is_default(&self.state) {
437            state.serialize_entry("state", &self.state)?;
438        }
439        if !wkt::internal::is_default(&self.traffic_logs) {
440            state.serialize_entry("trafficLogs", &self.traffic_logs)?;
441        }
442        if !self._unknown_fields.is_empty() {
443            for (key, value) in self._unknown_fields.iter() {
444                state.serialize_entry(key, &value)?;
445            }
446        }
447        state.end()
448    }
449}
450
451/// Defines additional types related to [Endpoint].
452pub mod endpoint {
453    #[allow(unused_imports)]
454    use super::*;
455
456    /// Threat severity levels.
457    ///
458    /// # Working with unknown values
459    ///
460    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
461    /// additional enum variants at any time. Adding new variants is not considered
462    /// a breaking change. Applications should write their code in anticipation of:
463    ///
464    /// - New values appearing in future releases of the client library, **and**
465    /// - New values received dynamically, without application changes.
466    ///
467    /// Please consult the [Working with enums] section in the user guide for some
468    /// guidelines.
469    ///
470    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
471    #[derive(Clone, Debug, PartialEq)]
472    #[non_exhaustive]
473    pub enum Severity {
474        /// Not set.
475        Unspecified,
476        /// Informational alerts.
477        Informational,
478        /// Low severity alerts.
479        Low,
480        /// Medium severity alerts.
481        Medium,
482        /// High severity alerts.
483        High,
484        /// Critical severity alerts.
485        Critical,
486        /// If set, the enum was initialized with an unknown value.
487        ///
488        /// Applications can examine the value using [Severity::value] or
489        /// [Severity::name].
490        UnknownValue(severity::UnknownValue),
491    }
492
493    #[doc(hidden)]
494    pub mod severity {
495        #[allow(unused_imports)]
496        use super::*;
497        #[derive(Clone, Debug, PartialEq)]
498        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
499    }
500
501    impl Severity {
502        /// Gets the enum value.
503        ///
504        /// Returns `None` if the enum contains an unknown value deserialized from
505        /// the string representation of enums.
506        pub fn value(&self) -> std::option::Option<i32> {
507            match self {
508                Self::Unspecified => std::option::Option::Some(0),
509                Self::Informational => std::option::Option::Some(1),
510                Self::Low => std::option::Option::Some(2),
511                Self::Medium => std::option::Option::Some(3),
512                Self::High => std::option::Option::Some(4),
513                Self::Critical => std::option::Option::Some(5),
514                Self::UnknownValue(u) => u.0.value(),
515            }
516        }
517
518        /// Gets the enum value as a string.
519        ///
520        /// Returns `None` if the enum contains an unknown value deserialized from
521        /// the integer representation of enums.
522        pub fn name(&self) -> std::option::Option<&str> {
523            match self {
524                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
525                Self::Informational => std::option::Option::Some("INFORMATIONAL"),
526                Self::Low => std::option::Option::Some("LOW"),
527                Self::Medium => std::option::Option::Some("MEDIUM"),
528                Self::High => std::option::Option::Some("HIGH"),
529                Self::Critical => std::option::Option::Some("CRITICAL"),
530                Self::UnknownValue(u) => u.0.name(),
531            }
532        }
533    }
534
535    impl std::default::Default for Severity {
536        fn default() -> Self {
537            use std::convert::From;
538            Self::from(0)
539        }
540    }
541
542    impl std::fmt::Display for Severity {
543        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
544            wkt::internal::display_enum(f, self.name(), self.value())
545        }
546    }
547
548    impl std::convert::From<i32> for Severity {
549        fn from(value: i32) -> Self {
550            match value {
551                0 => Self::Unspecified,
552                1 => Self::Informational,
553                2 => Self::Low,
554                3 => Self::Medium,
555                4 => Self::High,
556                5 => Self::Critical,
557                _ => Self::UnknownValue(severity::UnknownValue(
558                    wkt::internal::UnknownEnumValue::Integer(value),
559                )),
560            }
561        }
562    }
563
564    impl std::convert::From<&str> for Severity {
565        fn from(value: &str) -> Self {
566            use std::string::ToString;
567            match value {
568                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
569                "INFORMATIONAL" => Self::Informational,
570                "LOW" => Self::Low,
571                "MEDIUM" => Self::Medium,
572                "HIGH" => Self::High,
573                "CRITICAL" => Self::Critical,
574                _ => Self::UnknownValue(severity::UnknownValue(
575                    wkt::internal::UnknownEnumValue::String(value.to_string()),
576                )),
577            }
578        }
579    }
580
581    impl serde::ser::Serialize for Severity {
582        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
583        where
584            S: serde::Serializer,
585        {
586            match self {
587                Self::Unspecified => serializer.serialize_i32(0),
588                Self::Informational => serializer.serialize_i32(1),
589                Self::Low => serializer.serialize_i32(2),
590                Self::Medium => serializer.serialize_i32(3),
591                Self::High => serializer.serialize_i32(4),
592                Self::Critical => serializer.serialize_i32(5),
593                Self::UnknownValue(u) => u.0.serialize(serializer),
594            }
595        }
596    }
597
598    impl<'de> serde::de::Deserialize<'de> for Severity {
599        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
600        where
601            D: serde::Deserializer<'de>,
602        {
603            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
604                ".google.cloud.ids.v1.Endpoint.Severity",
605            ))
606        }
607    }
608
609    /// Endpoint state
610    ///
611    /// # Working with unknown values
612    ///
613    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
614    /// additional enum variants at any time. Adding new variants is not considered
615    /// a breaking change. Applications should write their code in anticipation of:
616    ///
617    /// - New values appearing in future releases of the client library, **and**
618    /// - New values received dynamically, without application changes.
619    ///
620    /// Please consult the [Working with enums] section in the user guide for some
621    /// guidelines.
622    ///
623    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
624    #[derive(Clone, Debug, PartialEq)]
625    #[non_exhaustive]
626    pub enum State {
627        /// Not set.
628        Unspecified,
629        /// Being created.
630        Creating,
631        /// Active and ready for traffic.
632        Ready,
633        /// Being deleted.
634        Deleting,
635        /// If set, the enum was initialized with an unknown value.
636        ///
637        /// Applications can examine the value using [State::value] or
638        /// [State::name].
639        UnknownValue(state::UnknownValue),
640    }
641
642    #[doc(hidden)]
643    pub mod state {
644        #[allow(unused_imports)]
645        use super::*;
646        #[derive(Clone, Debug, PartialEq)]
647        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
648    }
649
650    impl State {
651        /// Gets the enum value.
652        ///
653        /// Returns `None` if the enum contains an unknown value deserialized from
654        /// the string representation of enums.
655        pub fn value(&self) -> std::option::Option<i32> {
656            match self {
657                Self::Unspecified => std::option::Option::Some(0),
658                Self::Creating => std::option::Option::Some(1),
659                Self::Ready => std::option::Option::Some(2),
660                Self::Deleting => std::option::Option::Some(3),
661                Self::UnknownValue(u) => u.0.value(),
662            }
663        }
664
665        /// Gets the enum value as a string.
666        ///
667        /// Returns `None` if the enum contains an unknown value deserialized from
668        /// the integer representation of enums.
669        pub fn name(&self) -> std::option::Option<&str> {
670            match self {
671                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
672                Self::Creating => std::option::Option::Some("CREATING"),
673                Self::Ready => std::option::Option::Some("READY"),
674                Self::Deleting => std::option::Option::Some("DELETING"),
675                Self::UnknownValue(u) => u.0.name(),
676            }
677        }
678    }
679
680    impl std::default::Default for State {
681        fn default() -> Self {
682            use std::convert::From;
683            Self::from(0)
684        }
685    }
686
687    impl std::fmt::Display for State {
688        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
689            wkt::internal::display_enum(f, self.name(), self.value())
690        }
691    }
692
693    impl std::convert::From<i32> for State {
694        fn from(value: i32) -> Self {
695            match value {
696                0 => Self::Unspecified,
697                1 => Self::Creating,
698                2 => Self::Ready,
699                3 => Self::Deleting,
700                _ => Self::UnknownValue(state::UnknownValue(
701                    wkt::internal::UnknownEnumValue::Integer(value),
702                )),
703            }
704        }
705    }
706
707    impl std::convert::From<&str> for State {
708        fn from(value: &str) -> Self {
709            use std::string::ToString;
710            match value {
711                "STATE_UNSPECIFIED" => Self::Unspecified,
712                "CREATING" => Self::Creating,
713                "READY" => Self::Ready,
714                "DELETING" => Self::Deleting,
715                _ => Self::UnknownValue(state::UnknownValue(
716                    wkt::internal::UnknownEnumValue::String(value.to_string()),
717                )),
718            }
719        }
720    }
721
722    impl serde::ser::Serialize for State {
723        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
724        where
725            S: serde::Serializer,
726        {
727            match self {
728                Self::Unspecified => serializer.serialize_i32(0),
729                Self::Creating => serializer.serialize_i32(1),
730                Self::Ready => serializer.serialize_i32(2),
731                Self::Deleting => serializer.serialize_i32(3),
732                Self::UnknownValue(u) => u.0.serialize(serializer),
733            }
734        }
735    }
736
737    impl<'de> serde::de::Deserialize<'de> for State {
738        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
739        where
740            D: serde::Deserializer<'de>,
741        {
742            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
743                ".google.cloud.ids.v1.Endpoint.State",
744            ))
745        }
746    }
747}
748
749#[derive(Clone, Debug, Default, PartialEq)]
750#[non_exhaustive]
751pub struct ListEndpointsRequest {
752    /// Required. The parent, which owns this collection of endpoints.
753    pub parent: std::string::String,
754
755    /// Optional. The maximum number of endpoints to return. The service may return fewer
756    /// than this value.
757    pub page_size: i32,
758
759    /// Optional. A page token, received from a previous `ListEndpoints` call.
760    /// Provide this to retrieve the subsequent page.
761    ///
762    /// When paginating, all other parameters provided to `ListEndpoints` must
763    /// match the call that provided the page token.
764    pub page_token: std::string::String,
765
766    /// Optional. The filter expression, following the syntax outlined in
767    /// <https://google.aip.dev/160>.
768    pub filter: std::string::String,
769
770    /// Optional. One or more fields to compare and use to sort the output.
771    /// See <https://google.aip.dev/132#ordering>.
772    pub order_by: std::string::String,
773
774    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
775}
776
777impl ListEndpointsRequest {
778    pub fn new() -> Self {
779        std::default::Default::default()
780    }
781
782    /// Sets the value of [parent][crate::model::ListEndpointsRequest::parent].
783    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
784        self.parent = v.into();
785        self
786    }
787
788    /// Sets the value of [page_size][crate::model::ListEndpointsRequest::page_size].
789    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
790        self.page_size = v.into();
791        self
792    }
793
794    /// Sets the value of [page_token][crate::model::ListEndpointsRequest::page_token].
795    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
796        self.page_token = v.into();
797        self
798    }
799
800    /// Sets the value of [filter][crate::model::ListEndpointsRequest::filter].
801    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
802        self.filter = v.into();
803        self
804    }
805
806    /// Sets the value of [order_by][crate::model::ListEndpointsRequest::order_by].
807    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
808        self.order_by = v.into();
809        self
810    }
811}
812
813impl wkt::message::Message for ListEndpointsRequest {
814    fn typename() -> &'static str {
815        "type.googleapis.com/google.cloud.ids.v1.ListEndpointsRequest"
816    }
817}
818
819#[doc(hidden)]
820impl<'de> serde::de::Deserialize<'de> for ListEndpointsRequest {
821    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
822    where
823        D: serde::Deserializer<'de>,
824    {
825        #[allow(non_camel_case_types)]
826        #[doc(hidden)]
827        #[derive(PartialEq, Eq, Hash)]
828        enum __FieldTag {
829            __parent,
830            __page_size,
831            __page_token,
832            __filter,
833            __order_by,
834            Unknown(std::string::String),
835        }
836        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
837            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
838            where
839                D: serde::Deserializer<'de>,
840            {
841                struct Visitor;
842                impl<'de> serde::de::Visitor<'de> for Visitor {
843                    type Value = __FieldTag;
844                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
845                        formatter.write_str("a field name for ListEndpointsRequest")
846                    }
847                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
848                    where
849                        E: serde::de::Error,
850                    {
851                        use std::result::Result::Ok;
852                        use std::string::ToString;
853                        match value {
854                            "parent" => Ok(__FieldTag::__parent),
855                            "pageSize" => Ok(__FieldTag::__page_size),
856                            "page_size" => Ok(__FieldTag::__page_size),
857                            "pageToken" => Ok(__FieldTag::__page_token),
858                            "page_token" => Ok(__FieldTag::__page_token),
859                            "filter" => Ok(__FieldTag::__filter),
860                            "orderBy" => Ok(__FieldTag::__order_by),
861                            "order_by" => Ok(__FieldTag::__order_by),
862                            _ => Ok(__FieldTag::Unknown(value.to_string())),
863                        }
864                    }
865                }
866                deserializer.deserialize_identifier(Visitor)
867            }
868        }
869        struct Visitor;
870        impl<'de> serde::de::Visitor<'de> for Visitor {
871            type Value = ListEndpointsRequest;
872            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
873                formatter.write_str("struct ListEndpointsRequest")
874            }
875            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
876            where
877                A: serde::de::MapAccess<'de>,
878            {
879                #[allow(unused_imports)]
880                use serde::de::Error;
881                use std::option::Option::Some;
882                let mut fields = std::collections::HashSet::new();
883                let mut result = Self::Value::new();
884                while let Some(tag) = map.next_key::<__FieldTag>()? {
885                    #[allow(clippy::match_single_binding)]
886                    match tag {
887                        __FieldTag::__parent => {
888                            if !fields.insert(__FieldTag::__parent) {
889                                return std::result::Result::Err(A::Error::duplicate_field(
890                                    "multiple values for parent",
891                                ));
892                            }
893                            result.parent = map
894                                .next_value::<std::option::Option<std::string::String>>()?
895                                .unwrap_or_default();
896                        }
897                        __FieldTag::__page_size => {
898                            if !fields.insert(__FieldTag::__page_size) {
899                                return std::result::Result::Err(A::Error::duplicate_field(
900                                    "multiple values for page_size",
901                                ));
902                            }
903                            struct __With(std::option::Option<i32>);
904                            impl<'de> serde::de::Deserialize<'de> for __With {
905                                fn deserialize<D>(
906                                    deserializer: D,
907                                ) -> std::result::Result<Self, D::Error>
908                                where
909                                    D: serde::de::Deserializer<'de>,
910                                {
911                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
912                                }
913                            }
914                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
915                        }
916                        __FieldTag::__page_token => {
917                            if !fields.insert(__FieldTag::__page_token) {
918                                return std::result::Result::Err(A::Error::duplicate_field(
919                                    "multiple values for page_token",
920                                ));
921                            }
922                            result.page_token = map
923                                .next_value::<std::option::Option<std::string::String>>()?
924                                .unwrap_or_default();
925                        }
926                        __FieldTag::__filter => {
927                            if !fields.insert(__FieldTag::__filter) {
928                                return std::result::Result::Err(A::Error::duplicate_field(
929                                    "multiple values for filter",
930                                ));
931                            }
932                            result.filter = map
933                                .next_value::<std::option::Option<std::string::String>>()?
934                                .unwrap_or_default();
935                        }
936                        __FieldTag::__order_by => {
937                            if !fields.insert(__FieldTag::__order_by) {
938                                return std::result::Result::Err(A::Error::duplicate_field(
939                                    "multiple values for order_by",
940                                ));
941                            }
942                            result.order_by = map
943                                .next_value::<std::option::Option<std::string::String>>()?
944                                .unwrap_or_default();
945                        }
946                        __FieldTag::Unknown(key) => {
947                            let value = map.next_value::<serde_json::Value>()?;
948                            result._unknown_fields.insert(key, value);
949                        }
950                    }
951                }
952                std::result::Result::Ok(result)
953            }
954        }
955        deserializer.deserialize_any(Visitor)
956    }
957}
958
959#[doc(hidden)]
960impl serde::ser::Serialize for ListEndpointsRequest {
961    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
962    where
963        S: serde::ser::Serializer,
964    {
965        use serde::ser::SerializeMap;
966        #[allow(unused_imports)]
967        use std::option::Option::Some;
968        let mut state = serializer.serialize_map(std::option::Option::None)?;
969        if !self.parent.is_empty() {
970            state.serialize_entry("parent", &self.parent)?;
971        }
972        if !wkt::internal::is_default(&self.page_size) {
973            struct __With<'a>(&'a i32);
974            impl<'a> serde::ser::Serialize for __With<'a> {
975                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
976                where
977                    S: serde::ser::Serializer,
978                {
979                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
980                }
981            }
982            state.serialize_entry("pageSize", &__With(&self.page_size))?;
983        }
984        if !self.page_token.is_empty() {
985            state.serialize_entry("pageToken", &self.page_token)?;
986        }
987        if !self.filter.is_empty() {
988            state.serialize_entry("filter", &self.filter)?;
989        }
990        if !self.order_by.is_empty() {
991            state.serialize_entry("orderBy", &self.order_by)?;
992        }
993        if !self._unknown_fields.is_empty() {
994            for (key, value) in self._unknown_fields.iter() {
995                state.serialize_entry(key, &value)?;
996            }
997        }
998        state.end()
999    }
1000}
1001
1002#[derive(Clone, Debug, Default, PartialEq)]
1003#[non_exhaustive]
1004pub struct ListEndpointsResponse {
1005    /// The list of endpoints response.
1006    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
1007
1008    /// A token, which can be sent as `page_token` to retrieve the next page.
1009    /// If this field is omitted, there are no subsequent pages.
1010    pub next_page_token: std::string::String,
1011
1012    /// Locations that could not be reached.
1013    pub unreachable: std::vec::Vec<std::string::String>,
1014
1015    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1016}
1017
1018impl ListEndpointsResponse {
1019    pub fn new() -> Self {
1020        std::default::Default::default()
1021    }
1022
1023    /// Sets the value of [endpoints][crate::model::ListEndpointsResponse::endpoints].
1024    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
1025    where
1026        T: std::iter::IntoIterator<Item = V>,
1027        V: std::convert::Into<crate::model::Endpoint>,
1028    {
1029        use std::iter::Iterator;
1030        self.endpoints = v.into_iter().map(|i| i.into()).collect();
1031        self
1032    }
1033
1034    /// Sets the value of [next_page_token][crate::model::ListEndpointsResponse::next_page_token].
1035    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1036        self.next_page_token = v.into();
1037        self
1038    }
1039
1040    /// Sets the value of [unreachable][crate::model::ListEndpointsResponse::unreachable].
1041    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1042    where
1043        T: std::iter::IntoIterator<Item = V>,
1044        V: std::convert::Into<std::string::String>,
1045    {
1046        use std::iter::Iterator;
1047        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1048        self
1049    }
1050}
1051
1052impl wkt::message::Message for ListEndpointsResponse {
1053    fn typename() -> &'static str {
1054        "type.googleapis.com/google.cloud.ids.v1.ListEndpointsResponse"
1055    }
1056}
1057
1058#[doc(hidden)]
1059impl gax::paginator::internal::PageableResponse for ListEndpointsResponse {
1060    type PageItem = crate::model::Endpoint;
1061
1062    fn items(self) -> std::vec::Vec<Self::PageItem> {
1063        self.endpoints
1064    }
1065
1066    fn next_page_token(&self) -> std::string::String {
1067        use std::clone::Clone;
1068        self.next_page_token.clone()
1069    }
1070}
1071
1072#[doc(hidden)]
1073impl<'de> serde::de::Deserialize<'de> for ListEndpointsResponse {
1074    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1075    where
1076        D: serde::Deserializer<'de>,
1077    {
1078        #[allow(non_camel_case_types)]
1079        #[doc(hidden)]
1080        #[derive(PartialEq, Eq, Hash)]
1081        enum __FieldTag {
1082            __endpoints,
1083            __next_page_token,
1084            __unreachable,
1085            Unknown(std::string::String),
1086        }
1087        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1088            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1089            where
1090                D: serde::Deserializer<'de>,
1091            {
1092                struct Visitor;
1093                impl<'de> serde::de::Visitor<'de> for Visitor {
1094                    type Value = __FieldTag;
1095                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1096                        formatter.write_str("a field name for ListEndpointsResponse")
1097                    }
1098                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1099                    where
1100                        E: serde::de::Error,
1101                    {
1102                        use std::result::Result::Ok;
1103                        use std::string::ToString;
1104                        match value {
1105                            "endpoints" => Ok(__FieldTag::__endpoints),
1106                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1107                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1108                            "unreachable" => Ok(__FieldTag::__unreachable),
1109                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1110                        }
1111                    }
1112                }
1113                deserializer.deserialize_identifier(Visitor)
1114            }
1115        }
1116        struct Visitor;
1117        impl<'de> serde::de::Visitor<'de> for Visitor {
1118            type Value = ListEndpointsResponse;
1119            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1120                formatter.write_str("struct ListEndpointsResponse")
1121            }
1122            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1123            where
1124                A: serde::de::MapAccess<'de>,
1125            {
1126                #[allow(unused_imports)]
1127                use serde::de::Error;
1128                use std::option::Option::Some;
1129                let mut fields = std::collections::HashSet::new();
1130                let mut result = Self::Value::new();
1131                while let Some(tag) = map.next_key::<__FieldTag>()? {
1132                    #[allow(clippy::match_single_binding)]
1133                    match tag {
1134                        __FieldTag::__endpoints => {
1135                            if !fields.insert(__FieldTag::__endpoints) {
1136                                return std::result::Result::Err(A::Error::duplicate_field(
1137                                    "multiple values for endpoints",
1138                                ));
1139                            }
1140                            result.endpoints = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Endpoint>>>()?.unwrap_or_default();
1141                        }
1142                        __FieldTag::__next_page_token => {
1143                            if !fields.insert(__FieldTag::__next_page_token) {
1144                                return std::result::Result::Err(A::Error::duplicate_field(
1145                                    "multiple values for next_page_token",
1146                                ));
1147                            }
1148                            result.next_page_token = map
1149                                .next_value::<std::option::Option<std::string::String>>()?
1150                                .unwrap_or_default();
1151                        }
1152                        __FieldTag::__unreachable => {
1153                            if !fields.insert(__FieldTag::__unreachable) {
1154                                return std::result::Result::Err(A::Error::duplicate_field(
1155                                    "multiple values for unreachable",
1156                                ));
1157                            }
1158                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1159                        }
1160                        __FieldTag::Unknown(key) => {
1161                            let value = map.next_value::<serde_json::Value>()?;
1162                            result._unknown_fields.insert(key, value);
1163                        }
1164                    }
1165                }
1166                std::result::Result::Ok(result)
1167            }
1168        }
1169        deserializer.deserialize_any(Visitor)
1170    }
1171}
1172
1173#[doc(hidden)]
1174impl serde::ser::Serialize for ListEndpointsResponse {
1175    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1176    where
1177        S: serde::ser::Serializer,
1178    {
1179        use serde::ser::SerializeMap;
1180        #[allow(unused_imports)]
1181        use std::option::Option::Some;
1182        let mut state = serializer.serialize_map(std::option::Option::None)?;
1183        if !self.endpoints.is_empty() {
1184            state.serialize_entry("endpoints", &self.endpoints)?;
1185        }
1186        if !self.next_page_token.is_empty() {
1187            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1188        }
1189        if !self.unreachable.is_empty() {
1190            state.serialize_entry("unreachable", &self.unreachable)?;
1191        }
1192        if !self._unknown_fields.is_empty() {
1193            for (key, value) in self._unknown_fields.iter() {
1194                state.serialize_entry(key, &value)?;
1195            }
1196        }
1197        state.end()
1198    }
1199}
1200
1201#[derive(Clone, Debug, Default, PartialEq)]
1202#[non_exhaustive]
1203pub struct GetEndpointRequest {
1204    /// Required. The name of the endpoint to retrieve.
1205    /// Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
1206    pub name: std::string::String,
1207
1208    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1209}
1210
1211impl GetEndpointRequest {
1212    pub fn new() -> Self {
1213        std::default::Default::default()
1214    }
1215
1216    /// Sets the value of [name][crate::model::GetEndpointRequest::name].
1217    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1218        self.name = v.into();
1219        self
1220    }
1221}
1222
1223impl wkt::message::Message for GetEndpointRequest {
1224    fn typename() -> &'static str {
1225        "type.googleapis.com/google.cloud.ids.v1.GetEndpointRequest"
1226    }
1227}
1228
1229#[doc(hidden)]
1230impl<'de> serde::de::Deserialize<'de> for GetEndpointRequest {
1231    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1232    where
1233        D: serde::Deserializer<'de>,
1234    {
1235        #[allow(non_camel_case_types)]
1236        #[doc(hidden)]
1237        #[derive(PartialEq, Eq, Hash)]
1238        enum __FieldTag {
1239            __name,
1240            Unknown(std::string::String),
1241        }
1242        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1243            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1244            where
1245                D: serde::Deserializer<'de>,
1246            {
1247                struct Visitor;
1248                impl<'de> serde::de::Visitor<'de> for Visitor {
1249                    type Value = __FieldTag;
1250                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1251                        formatter.write_str("a field name for GetEndpointRequest")
1252                    }
1253                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1254                    where
1255                        E: serde::de::Error,
1256                    {
1257                        use std::result::Result::Ok;
1258                        use std::string::ToString;
1259                        match value {
1260                            "name" => Ok(__FieldTag::__name),
1261                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1262                        }
1263                    }
1264                }
1265                deserializer.deserialize_identifier(Visitor)
1266            }
1267        }
1268        struct Visitor;
1269        impl<'de> serde::de::Visitor<'de> for Visitor {
1270            type Value = GetEndpointRequest;
1271            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1272                formatter.write_str("struct GetEndpointRequest")
1273            }
1274            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1275            where
1276                A: serde::de::MapAccess<'de>,
1277            {
1278                #[allow(unused_imports)]
1279                use serde::de::Error;
1280                use std::option::Option::Some;
1281                let mut fields = std::collections::HashSet::new();
1282                let mut result = Self::Value::new();
1283                while let Some(tag) = map.next_key::<__FieldTag>()? {
1284                    #[allow(clippy::match_single_binding)]
1285                    match tag {
1286                        __FieldTag::__name => {
1287                            if !fields.insert(__FieldTag::__name) {
1288                                return std::result::Result::Err(A::Error::duplicate_field(
1289                                    "multiple values for name",
1290                                ));
1291                            }
1292                            result.name = map
1293                                .next_value::<std::option::Option<std::string::String>>()?
1294                                .unwrap_or_default();
1295                        }
1296                        __FieldTag::Unknown(key) => {
1297                            let value = map.next_value::<serde_json::Value>()?;
1298                            result._unknown_fields.insert(key, value);
1299                        }
1300                    }
1301                }
1302                std::result::Result::Ok(result)
1303            }
1304        }
1305        deserializer.deserialize_any(Visitor)
1306    }
1307}
1308
1309#[doc(hidden)]
1310impl serde::ser::Serialize for GetEndpointRequest {
1311    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1312    where
1313        S: serde::ser::Serializer,
1314    {
1315        use serde::ser::SerializeMap;
1316        #[allow(unused_imports)]
1317        use std::option::Option::Some;
1318        let mut state = serializer.serialize_map(std::option::Option::None)?;
1319        if !self.name.is_empty() {
1320            state.serialize_entry("name", &self.name)?;
1321        }
1322        if !self._unknown_fields.is_empty() {
1323            for (key, value) in self._unknown_fields.iter() {
1324                state.serialize_entry(key, &value)?;
1325            }
1326        }
1327        state.end()
1328    }
1329}
1330
1331#[derive(Clone, Debug, Default, PartialEq)]
1332#[non_exhaustive]
1333pub struct CreateEndpointRequest {
1334    /// Required. The endpoint's parent.
1335    pub parent: std::string::String,
1336
1337    /// Required. The endpoint identifier. This will be part of the endpoint's
1338    /// resource name.
1339    /// This value must start with a lowercase letter followed by up to 62
1340    /// lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
1341    /// Values that do not match this pattern will trigger an INVALID_ARGUMENT
1342    /// error.
1343    pub endpoint_id: std::string::String,
1344
1345    /// Required. The endpoint to create.
1346    pub endpoint: std::option::Option<crate::model::Endpoint>,
1347
1348    /// An optional request ID to identify requests. Specify a unique request ID
1349    /// so that if you must retry your request, the server will know to ignore
1350    /// the request if it has already been completed. The server will guarantee
1351    /// that for at least 60 minutes since the first request.
1352    ///
1353    /// For example, consider a situation where you make an initial request and t
1354    /// he request times out. If you make the request again with the same request
1355    /// ID, the server can check if original operation with the same request ID
1356    /// was received, and if so, will ignore the second request. This prevents
1357    /// clients from accidentally creating duplicate commitments.
1358    ///
1359    /// The request ID must be a valid UUID with the exception that zero UUID is
1360    /// not supported (00000000-0000-0000-0000-000000000000).
1361    pub request_id: std::string::String,
1362
1363    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1364}
1365
1366impl CreateEndpointRequest {
1367    pub fn new() -> Self {
1368        std::default::Default::default()
1369    }
1370
1371    /// Sets the value of [parent][crate::model::CreateEndpointRequest::parent].
1372    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1373        self.parent = v.into();
1374        self
1375    }
1376
1377    /// Sets the value of [endpoint_id][crate::model::CreateEndpointRequest::endpoint_id].
1378    pub fn set_endpoint_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1379        self.endpoint_id = v.into();
1380        self
1381    }
1382
1383    /// Sets the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1384    pub fn set_endpoint<T>(mut self, v: T) -> Self
1385    where
1386        T: std::convert::Into<crate::model::Endpoint>,
1387    {
1388        self.endpoint = std::option::Option::Some(v.into());
1389        self
1390    }
1391
1392    /// Sets or clears the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1393    pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
1394    where
1395        T: std::convert::Into<crate::model::Endpoint>,
1396    {
1397        self.endpoint = v.map(|x| x.into());
1398        self
1399    }
1400
1401    /// Sets the value of [request_id][crate::model::CreateEndpointRequest::request_id].
1402    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1403        self.request_id = v.into();
1404        self
1405    }
1406}
1407
1408impl wkt::message::Message for CreateEndpointRequest {
1409    fn typename() -> &'static str {
1410        "type.googleapis.com/google.cloud.ids.v1.CreateEndpointRequest"
1411    }
1412}
1413
1414#[doc(hidden)]
1415impl<'de> serde::de::Deserialize<'de> for CreateEndpointRequest {
1416    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1417    where
1418        D: serde::Deserializer<'de>,
1419    {
1420        #[allow(non_camel_case_types)]
1421        #[doc(hidden)]
1422        #[derive(PartialEq, Eq, Hash)]
1423        enum __FieldTag {
1424            __parent,
1425            __endpoint_id,
1426            __endpoint,
1427            __request_id,
1428            Unknown(std::string::String),
1429        }
1430        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1431            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1432            where
1433                D: serde::Deserializer<'de>,
1434            {
1435                struct Visitor;
1436                impl<'de> serde::de::Visitor<'de> for Visitor {
1437                    type Value = __FieldTag;
1438                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1439                        formatter.write_str("a field name for CreateEndpointRequest")
1440                    }
1441                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1442                    where
1443                        E: serde::de::Error,
1444                    {
1445                        use std::result::Result::Ok;
1446                        use std::string::ToString;
1447                        match value {
1448                            "parent" => Ok(__FieldTag::__parent),
1449                            "endpointId" => Ok(__FieldTag::__endpoint_id),
1450                            "endpoint_id" => Ok(__FieldTag::__endpoint_id),
1451                            "endpoint" => Ok(__FieldTag::__endpoint),
1452                            "requestId" => Ok(__FieldTag::__request_id),
1453                            "request_id" => Ok(__FieldTag::__request_id),
1454                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1455                        }
1456                    }
1457                }
1458                deserializer.deserialize_identifier(Visitor)
1459            }
1460        }
1461        struct Visitor;
1462        impl<'de> serde::de::Visitor<'de> for Visitor {
1463            type Value = CreateEndpointRequest;
1464            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1465                formatter.write_str("struct CreateEndpointRequest")
1466            }
1467            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1468            where
1469                A: serde::de::MapAccess<'de>,
1470            {
1471                #[allow(unused_imports)]
1472                use serde::de::Error;
1473                use std::option::Option::Some;
1474                let mut fields = std::collections::HashSet::new();
1475                let mut result = Self::Value::new();
1476                while let Some(tag) = map.next_key::<__FieldTag>()? {
1477                    #[allow(clippy::match_single_binding)]
1478                    match tag {
1479                        __FieldTag::__parent => {
1480                            if !fields.insert(__FieldTag::__parent) {
1481                                return std::result::Result::Err(A::Error::duplicate_field(
1482                                    "multiple values for parent",
1483                                ));
1484                            }
1485                            result.parent = map
1486                                .next_value::<std::option::Option<std::string::String>>()?
1487                                .unwrap_or_default();
1488                        }
1489                        __FieldTag::__endpoint_id => {
1490                            if !fields.insert(__FieldTag::__endpoint_id) {
1491                                return std::result::Result::Err(A::Error::duplicate_field(
1492                                    "multiple values for endpoint_id",
1493                                ));
1494                            }
1495                            result.endpoint_id = map
1496                                .next_value::<std::option::Option<std::string::String>>()?
1497                                .unwrap_or_default();
1498                        }
1499                        __FieldTag::__endpoint => {
1500                            if !fields.insert(__FieldTag::__endpoint) {
1501                                return std::result::Result::Err(A::Error::duplicate_field(
1502                                    "multiple values for endpoint",
1503                                ));
1504                            }
1505                            result.endpoint =
1506                                map.next_value::<std::option::Option<crate::model::Endpoint>>()?;
1507                        }
1508                        __FieldTag::__request_id => {
1509                            if !fields.insert(__FieldTag::__request_id) {
1510                                return std::result::Result::Err(A::Error::duplicate_field(
1511                                    "multiple values for request_id",
1512                                ));
1513                            }
1514                            result.request_id = map
1515                                .next_value::<std::option::Option<std::string::String>>()?
1516                                .unwrap_or_default();
1517                        }
1518                        __FieldTag::Unknown(key) => {
1519                            let value = map.next_value::<serde_json::Value>()?;
1520                            result._unknown_fields.insert(key, value);
1521                        }
1522                    }
1523                }
1524                std::result::Result::Ok(result)
1525            }
1526        }
1527        deserializer.deserialize_any(Visitor)
1528    }
1529}
1530
1531#[doc(hidden)]
1532impl serde::ser::Serialize for CreateEndpointRequest {
1533    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1534    where
1535        S: serde::ser::Serializer,
1536    {
1537        use serde::ser::SerializeMap;
1538        #[allow(unused_imports)]
1539        use std::option::Option::Some;
1540        let mut state = serializer.serialize_map(std::option::Option::None)?;
1541        if !self.parent.is_empty() {
1542            state.serialize_entry("parent", &self.parent)?;
1543        }
1544        if !self.endpoint_id.is_empty() {
1545            state.serialize_entry("endpointId", &self.endpoint_id)?;
1546        }
1547        if self.endpoint.is_some() {
1548            state.serialize_entry("endpoint", &self.endpoint)?;
1549        }
1550        if !self.request_id.is_empty() {
1551            state.serialize_entry("requestId", &self.request_id)?;
1552        }
1553        if !self._unknown_fields.is_empty() {
1554            for (key, value) in self._unknown_fields.iter() {
1555                state.serialize_entry(key, &value)?;
1556            }
1557        }
1558        state.end()
1559    }
1560}
1561
1562#[derive(Clone, Debug, Default, PartialEq)]
1563#[non_exhaustive]
1564pub struct DeleteEndpointRequest {
1565    /// Required. The name of the endpoint to delete.
1566    pub name: std::string::String,
1567
1568    /// An optional request ID to identify requests. Specify a unique request ID
1569    /// so that if you must retry your request, the server will know to ignore
1570    /// the request if it has already been completed. The server will guarantee
1571    /// that for at least 60 minutes after the first request.
1572    ///
1573    /// For example, consider a situation where you make an initial request and t
1574    /// he request times out. If you make the request again with the same request
1575    /// ID, the server can check if original operation with the same request ID
1576    /// was received, and if so, will ignore the second request. This prevents
1577    /// clients from accidentally creating duplicate commitments.
1578    ///
1579    /// The request ID must be a valid UUID with the exception that zero UUID is
1580    /// not supported (00000000-0000-0000-0000-000000000000).
1581    pub request_id: std::string::String,
1582
1583    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1584}
1585
1586impl DeleteEndpointRequest {
1587    pub fn new() -> Self {
1588        std::default::Default::default()
1589    }
1590
1591    /// Sets the value of [name][crate::model::DeleteEndpointRequest::name].
1592    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1593        self.name = v.into();
1594        self
1595    }
1596
1597    /// Sets the value of [request_id][crate::model::DeleteEndpointRequest::request_id].
1598    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1599        self.request_id = v.into();
1600        self
1601    }
1602}
1603
1604impl wkt::message::Message for DeleteEndpointRequest {
1605    fn typename() -> &'static str {
1606        "type.googleapis.com/google.cloud.ids.v1.DeleteEndpointRequest"
1607    }
1608}
1609
1610#[doc(hidden)]
1611impl<'de> serde::de::Deserialize<'de> for DeleteEndpointRequest {
1612    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1613    where
1614        D: serde::Deserializer<'de>,
1615    {
1616        #[allow(non_camel_case_types)]
1617        #[doc(hidden)]
1618        #[derive(PartialEq, Eq, Hash)]
1619        enum __FieldTag {
1620            __name,
1621            __request_id,
1622            Unknown(std::string::String),
1623        }
1624        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1625            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1626            where
1627                D: serde::Deserializer<'de>,
1628            {
1629                struct Visitor;
1630                impl<'de> serde::de::Visitor<'de> for Visitor {
1631                    type Value = __FieldTag;
1632                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1633                        formatter.write_str("a field name for DeleteEndpointRequest")
1634                    }
1635                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1636                    where
1637                        E: serde::de::Error,
1638                    {
1639                        use std::result::Result::Ok;
1640                        use std::string::ToString;
1641                        match value {
1642                            "name" => Ok(__FieldTag::__name),
1643                            "requestId" => Ok(__FieldTag::__request_id),
1644                            "request_id" => Ok(__FieldTag::__request_id),
1645                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1646                        }
1647                    }
1648                }
1649                deserializer.deserialize_identifier(Visitor)
1650            }
1651        }
1652        struct Visitor;
1653        impl<'de> serde::de::Visitor<'de> for Visitor {
1654            type Value = DeleteEndpointRequest;
1655            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1656                formatter.write_str("struct DeleteEndpointRequest")
1657            }
1658            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1659            where
1660                A: serde::de::MapAccess<'de>,
1661            {
1662                #[allow(unused_imports)]
1663                use serde::de::Error;
1664                use std::option::Option::Some;
1665                let mut fields = std::collections::HashSet::new();
1666                let mut result = Self::Value::new();
1667                while let Some(tag) = map.next_key::<__FieldTag>()? {
1668                    #[allow(clippy::match_single_binding)]
1669                    match tag {
1670                        __FieldTag::__name => {
1671                            if !fields.insert(__FieldTag::__name) {
1672                                return std::result::Result::Err(A::Error::duplicate_field(
1673                                    "multiple values for name",
1674                                ));
1675                            }
1676                            result.name = map
1677                                .next_value::<std::option::Option<std::string::String>>()?
1678                                .unwrap_or_default();
1679                        }
1680                        __FieldTag::__request_id => {
1681                            if !fields.insert(__FieldTag::__request_id) {
1682                                return std::result::Result::Err(A::Error::duplicate_field(
1683                                    "multiple values for request_id",
1684                                ));
1685                            }
1686                            result.request_id = map
1687                                .next_value::<std::option::Option<std::string::String>>()?
1688                                .unwrap_or_default();
1689                        }
1690                        __FieldTag::Unknown(key) => {
1691                            let value = map.next_value::<serde_json::Value>()?;
1692                            result._unknown_fields.insert(key, value);
1693                        }
1694                    }
1695                }
1696                std::result::Result::Ok(result)
1697            }
1698        }
1699        deserializer.deserialize_any(Visitor)
1700    }
1701}
1702
1703#[doc(hidden)]
1704impl serde::ser::Serialize for DeleteEndpointRequest {
1705    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1706    where
1707        S: serde::ser::Serializer,
1708    {
1709        use serde::ser::SerializeMap;
1710        #[allow(unused_imports)]
1711        use std::option::Option::Some;
1712        let mut state = serializer.serialize_map(std::option::Option::None)?;
1713        if !self.name.is_empty() {
1714            state.serialize_entry("name", &self.name)?;
1715        }
1716        if !self.request_id.is_empty() {
1717            state.serialize_entry("requestId", &self.request_id)?;
1718        }
1719        if !self._unknown_fields.is_empty() {
1720            for (key, value) in self._unknown_fields.iter() {
1721                state.serialize_entry(key, &value)?;
1722            }
1723        }
1724        state.end()
1725    }
1726}
1727
1728/// Represents the metadata of the long-running operation.
1729#[derive(Clone, Debug, Default, PartialEq)]
1730#[non_exhaustive]
1731pub struct OperationMetadata {
1732    /// Output only. The time the operation was created.
1733    pub create_time: std::option::Option<wkt::Timestamp>,
1734
1735    /// Output only. The time the operation finished running.
1736    pub end_time: std::option::Option<wkt::Timestamp>,
1737
1738    /// Output only. Server-defined resource path for the target of the operation.
1739    pub target: std::string::String,
1740
1741    /// Output only. Name of the verb executed by the operation.
1742    pub verb: std::string::String,
1743
1744    /// Output only. Human-readable status of the operation, if any.
1745    pub status_message: std::string::String,
1746
1747    /// Output only. Identifies whether the user has requested cancellation
1748    /// of the operation. Operations that have successfully been cancelled
1749    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
1750    /// corresponding to `Code.CANCELLED`.
1751    ///
1752    /// [google.rpc.Status.code]: rpc::model::Status::code
1753    pub requested_cancellation: bool,
1754
1755    /// Output only. API version used to start the operation.
1756    pub api_version: std::string::String,
1757
1758    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1759}
1760
1761impl OperationMetadata {
1762    pub fn new() -> Self {
1763        std::default::Default::default()
1764    }
1765
1766    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1767    pub fn set_create_time<T>(mut self, v: T) -> Self
1768    where
1769        T: std::convert::Into<wkt::Timestamp>,
1770    {
1771        self.create_time = std::option::Option::Some(v.into());
1772        self
1773    }
1774
1775    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1776    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1777    where
1778        T: std::convert::Into<wkt::Timestamp>,
1779    {
1780        self.create_time = v.map(|x| x.into());
1781        self
1782    }
1783
1784    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1785    pub fn set_end_time<T>(mut self, v: T) -> Self
1786    where
1787        T: std::convert::Into<wkt::Timestamp>,
1788    {
1789        self.end_time = std::option::Option::Some(v.into());
1790        self
1791    }
1792
1793    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1794    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1795    where
1796        T: std::convert::Into<wkt::Timestamp>,
1797    {
1798        self.end_time = v.map(|x| x.into());
1799        self
1800    }
1801
1802    /// Sets the value of [target][crate::model::OperationMetadata::target].
1803    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1804        self.target = v.into();
1805        self
1806    }
1807
1808    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1809    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1810        self.verb = v.into();
1811        self
1812    }
1813
1814    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
1815    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1816        self.status_message = v.into();
1817        self
1818    }
1819
1820    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
1821    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1822        self.requested_cancellation = v.into();
1823        self
1824    }
1825
1826    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1827    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1828        self.api_version = v.into();
1829        self
1830    }
1831}
1832
1833impl wkt::message::Message for OperationMetadata {
1834    fn typename() -> &'static str {
1835        "type.googleapis.com/google.cloud.ids.v1.OperationMetadata"
1836    }
1837}
1838
1839#[doc(hidden)]
1840impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
1841    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1842    where
1843        D: serde::Deserializer<'de>,
1844    {
1845        #[allow(non_camel_case_types)]
1846        #[doc(hidden)]
1847        #[derive(PartialEq, Eq, Hash)]
1848        enum __FieldTag {
1849            __create_time,
1850            __end_time,
1851            __target,
1852            __verb,
1853            __status_message,
1854            __requested_cancellation,
1855            __api_version,
1856            Unknown(std::string::String),
1857        }
1858        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1859            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1860            where
1861                D: serde::Deserializer<'de>,
1862            {
1863                struct Visitor;
1864                impl<'de> serde::de::Visitor<'de> for Visitor {
1865                    type Value = __FieldTag;
1866                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1867                        formatter.write_str("a field name for OperationMetadata")
1868                    }
1869                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1870                    where
1871                        E: serde::de::Error,
1872                    {
1873                        use std::result::Result::Ok;
1874                        use std::string::ToString;
1875                        match value {
1876                            "createTime" => Ok(__FieldTag::__create_time),
1877                            "create_time" => Ok(__FieldTag::__create_time),
1878                            "endTime" => Ok(__FieldTag::__end_time),
1879                            "end_time" => Ok(__FieldTag::__end_time),
1880                            "target" => Ok(__FieldTag::__target),
1881                            "verb" => Ok(__FieldTag::__verb),
1882                            "statusMessage" => Ok(__FieldTag::__status_message),
1883                            "status_message" => Ok(__FieldTag::__status_message),
1884                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
1885                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
1886                            "apiVersion" => Ok(__FieldTag::__api_version),
1887                            "api_version" => Ok(__FieldTag::__api_version),
1888                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1889                        }
1890                    }
1891                }
1892                deserializer.deserialize_identifier(Visitor)
1893            }
1894        }
1895        struct Visitor;
1896        impl<'de> serde::de::Visitor<'de> for Visitor {
1897            type Value = OperationMetadata;
1898            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1899                formatter.write_str("struct OperationMetadata")
1900            }
1901            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1902            where
1903                A: serde::de::MapAccess<'de>,
1904            {
1905                #[allow(unused_imports)]
1906                use serde::de::Error;
1907                use std::option::Option::Some;
1908                let mut fields = std::collections::HashSet::new();
1909                let mut result = Self::Value::new();
1910                while let Some(tag) = map.next_key::<__FieldTag>()? {
1911                    #[allow(clippy::match_single_binding)]
1912                    match tag {
1913                        __FieldTag::__create_time => {
1914                            if !fields.insert(__FieldTag::__create_time) {
1915                                return std::result::Result::Err(A::Error::duplicate_field(
1916                                    "multiple values for create_time",
1917                                ));
1918                            }
1919                            result.create_time =
1920                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1921                        }
1922                        __FieldTag::__end_time => {
1923                            if !fields.insert(__FieldTag::__end_time) {
1924                                return std::result::Result::Err(A::Error::duplicate_field(
1925                                    "multiple values for end_time",
1926                                ));
1927                            }
1928                            result.end_time =
1929                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1930                        }
1931                        __FieldTag::__target => {
1932                            if !fields.insert(__FieldTag::__target) {
1933                                return std::result::Result::Err(A::Error::duplicate_field(
1934                                    "multiple values for target",
1935                                ));
1936                            }
1937                            result.target = map
1938                                .next_value::<std::option::Option<std::string::String>>()?
1939                                .unwrap_or_default();
1940                        }
1941                        __FieldTag::__verb => {
1942                            if !fields.insert(__FieldTag::__verb) {
1943                                return std::result::Result::Err(A::Error::duplicate_field(
1944                                    "multiple values for verb",
1945                                ));
1946                            }
1947                            result.verb = map
1948                                .next_value::<std::option::Option<std::string::String>>()?
1949                                .unwrap_or_default();
1950                        }
1951                        __FieldTag::__status_message => {
1952                            if !fields.insert(__FieldTag::__status_message) {
1953                                return std::result::Result::Err(A::Error::duplicate_field(
1954                                    "multiple values for status_message",
1955                                ));
1956                            }
1957                            result.status_message = map
1958                                .next_value::<std::option::Option<std::string::String>>()?
1959                                .unwrap_or_default();
1960                        }
1961                        __FieldTag::__requested_cancellation => {
1962                            if !fields.insert(__FieldTag::__requested_cancellation) {
1963                                return std::result::Result::Err(A::Error::duplicate_field(
1964                                    "multiple values for requested_cancellation",
1965                                ));
1966                            }
1967                            result.requested_cancellation = map
1968                                .next_value::<std::option::Option<bool>>()?
1969                                .unwrap_or_default();
1970                        }
1971                        __FieldTag::__api_version => {
1972                            if !fields.insert(__FieldTag::__api_version) {
1973                                return std::result::Result::Err(A::Error::duplicate_field(
1974                                    "multiple values for api_version",
1975                                ));
1976                            }
1977                            result.api_version = map
1978                                .next_value::<std::option::Option<std::string::String>>()?
1979                                .unwrap_or_default();
1980                        }
1981                        __FieldTag::Unknown(key) => {
1982                            let value = map.next_value::<serde_json::Value>()?;
1983                            result._unknown_fields.insert(key, value);
1984                        }
1985                    }
1986                }
1987                std::result::Result::Ok(result)
1988            }
1989        }
1990        deserializer.deserialize_any(Visitor)
1991    }
1992}
1993
1994#[doc(hidden)]
1995impl serde::ser::Serialize for OperationMetadata {
1996    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1997    where
1998        S: serde::ser::Serializer,
1999    {
2000        use serde::ser::SerializeMap;
2001        #[allow(unused_imports)]
2002        use std::option::Option::Some;
2003        let mut state = serializer.serialize_map(std::option::Option::None)?;
2004        if self.create_time.is_some() {
2005            state.serialize_entry("createTime", &self.create_time)?;
2006        }
2007        if self.end_time.is_some() {
2008            state.serialize_entry("endTime", &self.end_time)?;
2009        }
2010        if !self.target.is_empty() {
2011            state.serialize_entry("target", &self.target)?;
2012        }
2013        if !self.verb.is_empty() {
2014            state.serialize_entry("verb", &self.verb)?;
2015        }
2016        if !self.status_message.is_empty() {
2017            state.serialize_entry("statusMessage", &self.status_message)?;
2018        }
2019        if !wkt::internal::is_default(&self.requested_cancellation) {
2020            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
2021        }
2022        if !self.api_version.is_empty() {
2023            state.serialize_entry("apiVersion", &self.api_version)?;
2024        }
2025        if !self._unknown_fields.is_empty() {
2026            for (key, value) in self._unknown_fields.iter() {
2027                state.serialize_entry(key, &value)?;
2028            }
2029        }
2030        state.end()
2031    }
2032}