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, 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
451impl std::fmt::Debug for Endpoint {
452    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
453        let mut debug_struct = f.debug_struct("Endpoint");
454        debug_struct.field("name", &self.name);
455        debug_struct.field("create_time", &self.create_time);
456        debug_struct.field("update_time", &self.update_time);
457        debug_struct.field("labels", &self.labels);
458        debug_struct.field("network", &self.network);
459        debug_struct.field("endpoint_forwarding_rule", &self.endpoint_forwarding_rule);
460        debug_struct.field("endpoint_ip", &self.endpoint_ip);
461        debug_struct.field("description", &self.description);
462        debug_struct.field("severity", &self.severity);
463        debug_struct.field("state", &self.state);
464        debug_struct.field("traffic_logs", &self.traffic_logs);
465        if !self._unknown_fields.is_empty() {
466            debug_struct.field("_unknown_fields", &self._unknown_fields);
467        }
468        debug_struct.finish()
469    }
470}
471
472/// Defines additional types related to [Endpoint].
473pub mod endpoint {
474    #[allow(unused_imports)]
475    use super::*;
476
477    /// Threat severity levels.
478    ///
479    /// # Working with unknown values
480    ///
481    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
482    /// additional enum variants at any time. Adding new variants is not considered
483    /// a breaking change. Applications should write their code in anticipation of:
484    ///
485    /// - New values appearing in future releases of the client library, **and**
486    /// - New values received dynamically, without application changes.
487    ///
488    /// Please consult the [Working with enums] section in the user guide for some
489    /// guidelines.
490    ///
491    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
492    #[derive(Clone, Debug, PartialEq)]
493    #[non_exhaustive]
494    pub enum Severity {
495        /// Not set.
496        Unspecified,
497        /// Informational alerts.
498        Informational,
499        /// Low severity alerts.
500        Low,
501        /// Medium severity alerts.
502        Medium,
503        /// High severity alerts.
504        High,
505        /// Critical severity alerts.
506        Critical,
507        /// If set, the enum was initialized with an unknown value.
508        ///
509        /// Applications can examine the value using [Severity::value] or
510        /// [Severity::name].
511        UnknownValue(severity::UnknownValue),
512    }
513
514    #[doc(hidden)]
515    pub mod severity {
516        #[allow(unused_imports)]
517        use super::*;
518        #[derive(Clone, Debug, PartialEq)]
519        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
520    }
521
522    impl Severity {
523        /// Gets the enum value.
524        ///
525        /// Returns `None` if the enum contains an unknown value deserialized from
526        /// the string representation of enums.
527        pub fn value(&self) -> std::option::Option<i32> {
528            match self {
529                Self::Unspecified => std::option::Option::Some(0),
530                Self::Informational => std::option::Option::Some(1),
531                Self::Low => std::option::Option::Some(2),
532                Self::Medium => std::option::Option::Some(3),
533                Self::High => std::option::Option::Some(4),
534                Self::Critical => std::option::Option::Some(5),
535                Self::UnknownValue(u) => u.0.value(),
536            }
537        }
538
539        /// Gets the enum value as a string.
540        ///
541        /// Returns `None` if the enum contains an unknown value deserialized from
542        /// the integer representation of enums.
543        pub fn name(&self) -> std::option::Option<&str> {
544            match self {
545                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
546                Self::Informational => std::option::Option::Some("INFORMATIONAL"),
547                Self::Low => std::option::Option::Some("LOW"),
548                Self::Medium => std::option::Option::Some("MEDIUM"),
549                Self::High => std::option::Option::Some("HIGH"),
550                Self::Critical => std::option::Option::Some("CRITICAL"),
551                Self::UnknownValue(u) => u.0.name(),
552            }
553        }
554    }
555
556    impl std::default::Default for Severity {
557        fn default() -> Self {
558            use std::convert::From;
559            Self::from(0)
560        }
561    }
562
563    impl std::fmt::Display for Severity {
564        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
565            wkt::internal::display_enum(f, self.name(), self.value())
566        }
567    }
568
569    impl std::convert::From<i32> for Severity {
570        fn from(value: i32) -> Self {
571            match value {
572                0 => Self::Unspecified,
573                1 => Self::Informational,
574                2 => Self::Low,
575                3 => Self::Medium,
576                4 => Self::High,
577                5 => Self::Critical,
578                _ => Self::UnknownValue(severity::UnknownValue(
579                    wkt::internal::UnknownEnumValue::Integer(value),
580                )),
581            }
582        }
583    }
584
585    impl std::convert::From<&str> for Severity {
586        fn from(value: &str) -> Self {
587            use std::string::ToString;
588            match value {
589                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
590                "INFORMATIONAL" => Self::Informational,
591                "LOW" => Self::Low,
592                "MEDIUM" => Self::Medium,
593                "HIGH" => Self::High,
594                "CRITICAL" => Self::Critical,
595                _ => Self::UnknownValue(severity::UnknownValue(
596                    wkt::internal::UnknownEnumValue::String(value.to_string()),
597                )),
598            }
599        }
600    }
601
602    impl serde::ser::Serialize for Severity {
603        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
604        where
605            S: serde::Serializer,
606        {
607            match self {
608                Self::Unspecified => serializer.serialize_i32(0),
609                Self::Informational => serializer.serialize_i32(1),
610                Self::Low => serializer.serialize_i32(2),
611                Self::Medium => serializer.serialize_i32(3),
612                Self::High => serializer.serialize_i32(4),
613                Self::Critical => serializer.serialize_i32(5),
614                Self::UnknownValue(u) => u.0.serialize(serializer),
615            }
616        }
617    }
618
619    impl<'de> serde::de::Deserialize<'de> for Severity {
620        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
621        where
622            D: serde::Deserializer<'de>,
623        {
624            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
625                ".google.cloud.ids.v1.Endpoint.Severity",
626            ))
627        }
628    }
629
630    /// Endpoint state
631    ///
632    /// # Working with unknown values
633    ///
634    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
635    /// additional enum variants at any time. Adding new variants is not considered
636    /// a breaking change. Applications should write their code in anticipation of:
637    ///
638    /// - New values appearing in future releases of the client library, **and**
639    /// - New values received dynamically, without application changes.
640    ///
641    /// Please consult the [Working with enums] section in the user guide for some
642    /// guidelines.
643    ///
644    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
645    #[derive(Clone, Debug, PartialEq)]
646    #[non_exhaustive]
647    pub enum State {
648        /// Not set.
649        Unspecified,
650        /// Being created.
651        Creating,
652        /// Active and ready for traffic.
653        Ready,
654        /// Being deleted.
655        Deleting,
656        /// If set, the enum was initialized with an unknown value.
657        ///
658        /// Applications can examine the value using [State::value] or
659        /// [State::name].
660        UnknownValue(state::UnknownValue),
661    }
662
663    #[doc(hidden)]
664    pub mod state {
665        #[allow(unused_imports)]
666        use super::*;
667        #[derive(Clone, Debug, PartialEq)]
668        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
669    }
670
671    impl State {
672        /// Gets the enum value.
673        ///
674        /// Returns `None` if the enum contains an unknown value deserialized from
675        /// the string representation of enums.
676        pub fn value(&self) -> std::option::Option<i32> {
677            match self {
678                Self::Unspecified => std::option::Option::Some(0),
679                Self::Creating => std::option::Option::Some(1),
680                Self::Ready => std::option::Option::Some(2),
681                Self::Deleting => std::option::Option::Some(3),
682                Self::UnknownValue(u) => u.0.value(),
683            }
684        }
685
686        /// Gets the enum value as a string.
687        ///
688        /// Returns `None` if the enum contains an unknown value deserialized from
689        /// the integer representation of enums.
690        pub fn name(&self) -> std::option::Option<&str> {
691            match self {
692                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
693                Self::Creating => std::option::Option::Some("CREATING"),
694                Self::Ready => std::option::Option::Some("READY"),
695                Self::Deleting => std::option::Option::Some("DELETING"),
696                Self::UnknownValue(u) => u.0.name(),
697            }
698        }
699    }
700
701    impl std::default::Default for State {
702        fn default() -> Self {
703            use std::convert::From;
704            Self::from(0)
705        }
706    }
707
708    impl std::fmt::Display for State {
709        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
710            wkt::internal::display_enum(f, self.name(), self.value())
711        }
712    }
713
714    impl std::convert::From<i32> for State {
715        fn from(value: i32) -> Self {
716            match value {
717                0 => Self::Unspecified,
718                1 => Self::Creating,
719                2 => Self::Ready,
720                3 => Self::Deleting,
721                _ => Self::UnknownValue(state::UnknownValue(
722                    wkt::internal::UnknownEnumValue::Integer(value),
723                )),
724            }
725        }
726    }
727
728    impl std::convert::From<&str> for State {
729        fn from(value: &str) -> Self {
730            use std::string::ToString;
731            match value {
732                "STATE_UNSPECIFIED" => Self::Unspecified,
733                "CREATING" => Self::Creating,
734                "READY" => Self::Ready,
735                "DELETING" => Self::Deleting,
736                _ => Self::UnknownValue(state::UnknownValue(
737                    wkt::internal::UnknownEnumValue::String(value.to_string()),
738                )),
739            }
740        }
741    }
742
743    impl serde::ser::Serialize for State {
744        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
745        where
746            S: serde::Serializer,
747        {
748            match self {
749                Self::Unspecified => serializer.serialize_i32(0),
750                Self::Creating => serializer.serialize_i32(1),
751                Self::Ready => serializer.serialize_i32(2),
752                Self::Deleting => serializer.serialize_i32(3),
753                Self::UnknownValue(u) => u.0.serialize(serializer),
754            }
755        }
756    }
757
758    impl<'de> serde::de::Deserialize<'de> for State {
759        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
760        where
761            D: serde::Deserializer<'de>,
762        {
763            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
764                ".google.cloud.ids.v1.Endpoint.State",
765            ))
766        }
767    }
768}
769
770#[derive(Clone, Default, PartialEq)]
771#[non_exhaustive]
772pub struct ListEndpointsRequest {
773    /// Required. The parent, which owns this collection of endpoints.
774    pub parent: std::string::String,
775
776    /// Optional. The maximum number of endpoints to return. The service may return fewer
777    /// than this value.
778    pub page_size: i32,
779
780    /// Optional. A page token, received from a previous `ListEndpoints` call.
781    /// Provide this to retrieve the subsequent page.
782    ///
783    /// When paginating, all other parameters provided to `ListEndpoints` must
784    /// match the call that provided the page token.
785    pub page_token: std::string::String,
786
787    /// Optional. The filter expression, following the syntax outlined in
788    /// <https://google.aip.dev/160>.
789    pub filter: std::string::String,
790
791    /// Optional. One or more fields to compare and use to sort the output.
792    /// See <https://google.aip.dev/132#ordering>.
793    pub order_by: std::string::String,
794
795    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
796}
797
798impl ListEndpointsRequest {
799    pub fn new() -> Self {
800        std::default::Default::default()
801    }
802
803    /// Sets the value of [parent][crate::model::ListEndpointsRequest::parent].
804    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
805        self.parent = v.into();
806        self
807    }
808
809    /// Sets the value of [page_size][crate::model::ListEndpointsRequest::page_size].
810    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
811        self.page_size = v.into();
812        self
813    }
814
815    /// Sets the value of [page_token][crate::model::ListEndpointsRequest::page_token].
816    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
817        self.page_token = v.into();
818        self
819    }
820
821    /// Sets the value of [filter][crate::model::ListEndpointsRequest::filter].
822    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
823        self.filter = v.into();
824        self
825    }
826
827    /// Sets the value of [order_by][crate::model::ListEndpointsRequest::order_by].
828    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
829        self.order_by = v.into();
830        self
831    }
832}
833
834impl wkt::message::Message for ListEndpointsRequest {
835    fn typename() -> &'static str {
836        "type.googleapis.com/google.cloud.ids.v1.ListEndpointsRequest"
837    }
838}
839
840#[doc(hidden)]
841impl<'de> serde::de::Deserialize<'de> for ListEndpointsRequest {
842    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
843    where
844        D: serde::Deserializer<'de>,
845    {
846        #[allow(non_camel_case_types)]
847        #[doc(hidden)]
848        #[derive(PartialEq, Eq, Hash)]
849        enum __FieldTag {
850            __parent,
851            __page_size,
852            __page_token,
853            __filter,
854            __order_by,
855            Unknown(std::string::String),
856        }
857        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
858            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
859            where
860                D: serde::Deserializer<'de>,
861            {
862                struct Visitor;
863                impl<'de> serde::de::Visitor<'de> for Visitor {
864                    type Value = __FieldTag;
865                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
866                        formatter.write_str("a field name for ListEndpointsRequest")
867                    }
868                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
869                    where
870                        E: serde::de::Error,
871                    {
872                        use std::result::Result::Ok;
873                        use std::string::ToString;
874                        match value {
875                            "parent" => Ok(__FieldTag::__parent),
876                            "pageSize" => Ok(__FieldTag::__page_size),
877                            "page_size" => Ok(__FieldTag::__page_size),
878                            "pageToken" => Ok(__FieldTag::__page_token),
879                            "page_token" => Ok(__FieldTag::__page_token),
880                            "filter" => Ok(__FieldTag::__filter),
881                            "orderBy" => Ok(__FieldTag::__order_by),
882                            "order_by" => Ok(__FieldTag::__order_by),
883                            _ => Ok(__FieldTag::Unknown(value.to_string())),
884                        }
885                    }
886                }
887                deserializer.deserialize_identifier(Visitor)
888            }
889        }
890        struct Visitor;
891        impl<'de> serde::de::Visitor<'de> for Visitor {
892            type Value = ListEndpointsRequest;
893            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
894                formatter.write_str("struct ListEndpointsRequest")
895            }
896            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
897            where
898                A: serde::de::MapAccess<'de>,
899            {
900                #[allow(unused_imports)]
901                use serde::de::Error;
902                use std::option::Option::Some;
903                let mut fields = std::collections::HashSet::new();
904                let mut result = Self::Value::new();
905                while let Some(tag) = map.next_key::<__FieldTag>()? {
906                    #[allow(clippy::match_single_binding)]
907                    match tag {
908                        __FieldTag::__parent => {
909                            if !fields.insert(__FieldTag::__parent) {
910                                return std::result::Result::Err(A::Error::duplicate_field(
911                                    "multiple values for parent",
912                                ));
913                            }
914                            result.parent = map
915                                .next_value::<std::option::Option<std::string::String>>()?
916                                .unwrap_or_default();
917                        }
918                        __FieldTag::__page_size => {
919                            if !fields.insert(__FieldTag::__page_size) {
920                                return std::result::Result::Err(A::Error::duplicate_field(
921                                    "multiple values for page_size",
922                                ));
923                            }
924                            struct __With(std::option::Option<i32>);
925                            impl<'de> serde::de::Deserialize<'de> for __With {
926                                fn deserialize<D>(
927                                    deserializer: D,
928                                ) -> std::result::Result<Self, D::Error>
929                                where
930                                    D: serde::de::Deserializer<'de>,
931                                {
932                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
933                                }
934                            }
935                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
936                        }
937                        __FieldTag::__page_token => {
938                            if !fields.insert(__FieldTag::__page_token) {
939                                return std::result::Result::Err(A::Error::duplicate_field(
940                                    "multiple values for page_token",
941                                ));
942                            }
943                            result.page_token = map
944                                .next_value::<std::option::Option<std::string::String>>()?
945                                .unwrap_or_default();
946                        }
947                        __FieldTag::__filter => {
948                            if !fields.insert(__FieldTag::__filter) {
949                                return std::result::Result::Err(A::Error::duplicate_field(
950                                    "multiple values for filter",
951                                ));
952                            }
953                            result.filter = map
954                                .next_value::<std::option::Option<std::string::String>>()?
955                                .unwrap_or_default();
956                        }
957                        __FieldTag::__order_by => {
958                            if !fields.insert(__FieldTag::__order_by) {
959                                return std::result::Result::Err(A::Error::duplicate_field(
960                                    "multiple values for order_by",
961                                ));
962                            }
963                            result.order_by = map
964                                .next_value::<std::option::Option<std::string::String>>()?
965                                .unwrap_or_default();
966                        }
967                        __FieldTag::Unknown(key) => {
968                            let value = map.next_value::<serde_json::Value>()?;
969                            result._unknown_fields.insert(key, value);
970                        }
971                    }
972                }
973                std::result::Result::Ok(result)
974            }
975        }
976        deserializer.deserialize_any(Visitor)
977    }
978}
979
980#[doc(hidden)]
981impl serde::ser::Serialize for ListEndpointsRequest {
982    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
983    where
984        S: serde::ser::Serializer,
985    {
986        use serde::ser::SerializeMap;
987        #[allow(unused_imports)]
988        use std::option::Option::Some;
989        let mut state = serializer.serialize_map(std::option::Option::None)?;
990        if !self.parent.is_empty() {
991            state.serialize_entry("parent", &self.parent)?;
992        }
993        if !wkt::internal::is_default(&self.page_size) {
994            struct __With<'a>(&'a i32);
995            impl<'a> serde::ser::Serialize for __With<'a> {
996                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
997                where
998                    S: serde::ser::Serializer,
999                {
1000                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1001                }
1002            }
1003            state.serialize_entry("pageSize", &__With(&self.page_size))?;
1004        }
1005        if !self.page_token.is_empty() {
1006            state.serialize_entry("pageToken", &self.page_token)?;
1007        }
1008        if !self.filter.is_empty() {
1009            state.serialize_entry("filter", &self.filter)?;
1010        }
1011        if !self.order_by.is_empty() {
1012            state.serialize_entry("orderBy", &self.order_by)?;
1013        }
1014        if !self._unknown_fields.is_empty() {
1015            for (key, value) in self._unknown_fields.iter() {
1016                state.serialize_entry(key, &value)?;
1017            }
1018        }
1019        state.end()
1020    }
1021}
1022
1023impl std::fmt::Debug for ListEndpointsRequest {
1024    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1025        let mut debug_struct = f.debug_struct("ListEndpointsRequest");
1026        debug_struct.field("parent", &self.parent);
1027        debug_struct.field("page_size", &self.page_size);
1028        debug_struct.field("page_token", &self.page_token);
1029        debug_struct.field("filter", &self.filter);
1030        debug_struct.field("order_by", &self.order_by);
1031        if !self._unknown_fields.is_empty() {
1032            debug_struct.field("_unknown_fields", &self._unknown_fields);
1033        }
1034        debug_struct.finish()
1035    }
1036}
1037
1038#[derive(Clone, Default, PartialEq)]
1039#[non_exhaustive]
1040pub struct ListEndpointsResponse {
1041    /// The list of endpoints response.
1042    pub endpoints: std::vec::Vec<crate::model::Endpoint>,
1043
1044    /// A token, which can be sent as `page_token` to retrieve the next page.
1045    /// If this field is omitted, there are no subsequent pages.
1046    pub next_page_token: std::string::String,
1047
1048    /// Locations that could not be reached.
1049    pub unreachable: std::vec::Vec<std::string::String>,
1050
1051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1052}
1053
1054impl ListEndpointsResponse {
1055    pub fn new() -> Self {
1056        std::default::Default::default()
1057    }
1058
1059    /// Sets the value of [endpoints][crate::model::ListEndpointsResponse::endpoints].
1060    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
1061    where
1062        T: std::iter::IntoIterator<Item = V>,
1063        V: std::convert::Into<crate::model::Endpoint>,
1064    {
1065        use std::iter::Iterator;
1066        self.endpoints = v.into_iter().map(|i| i.into()).collect();
1067        self
1068    }
1069
1070    /// Sets the value of [next_page_token][crate::model::ListEndpointsResponse::next_page_token].
1071    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1072        self.next_page_token = v.into();
1073        self
1074    }
1075
1076    /// Sets the value of [unreachable][crate::model::ListEndpointsResponse::unreachable].
1077    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1078    where
1079        T: std::iter::IntoIterator<Item = V>,
1080        V: std::convert::Into<std::string::String>,
1081    {
1082        use std::iter::Iterator;
1083        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1084        self
1085    }
1086}
1087
1088impl wkt::message::Message for ListEndpointsResponse {
1089    fn typename() -> &'static str {
1090        "type.googleapis.com/google.cloud.ids.v1.ListEndpointsResponse"
1091    }
1092}
1093
1094#[doc(hidden)]
1095impl gax::paginator::internal::PageableResponse for ListEndpointsResponse {
1096    type PageItem = crate::model::Endpoint;
1097
1098    fn items(self) -> std::vec::Vec<Self::PageItem> {
1099        self.endpoints
1100    }
1101
1102    fn next_page_token(&self) -> std::string::String {
1103        use std::clone::Clone;
1104        self.next_page_token.clone()
1105    }
1106}
1107
1108#[doc(hidden)]
1109impl<'de> serde::de::Deserialize<'de> for ListEndpointsResponse {
1110    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1111    where
1112        D: serde::Deserializer<'de>,
1113    {
1114        #[allow(non_camel_case_types)]
1115        #[doc(hidden)]
1116        #[derive(PartialEq, Eq, Hash)]
1117        enum __FieldTag {
1118            __endpoints,
1119            __next_page_token,
1120            __unreachable,
1121            Unknown(std::string::String),
1122        }
1123        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1124            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1125            where
1126                D: serde::Deserializer<'de>,
1127            {
1128                struct Visitor;
1129                impl<'de> serde::de::Visitor<'de> for Visitor {
1130                    type Value = __FieldTag;
1131                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1132                        formatter.write_str("a field name for ListEndpointsResponse")
1133                    }
1134                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1135                    where
1136                        E: serde::de::Error,
1137                    {
1138                        use std::result::Result::Ok;
1139                        use std::string::ToString;
1140                        match value {
1141                            "endpoints" => Ok(__FieldTag::__endpoints),
1142                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1143                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1144                            "unreachable" => Ok(__FieldTag::__unreachable),
1145                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1146                        }
1147                    }
1148                }
1149                deserializer.deserialize_identifier(Visitor)
1150            }
1151        }
1152        struct Visitor;
1153        impl<'de> serde::de::Visitor<'de> for Visitor {
1154            type Value = ListEndpointsResponse;
1155            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1156                formatter.write_str("struct ListEndpointsResponse")
1157            }
1158            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1159            where
1160                A: serde::de::MapAccess<'de>,
1161            {
1162                #[allow(unused_imports)]
1163                use serde::de::Error;
1164                use std::option::Option::Some;
1165                let mut fields = std::collections::HashSet::new();
1166                let mut result = Self::Value::new();
1167                while let Some(tag) = map.next_key::<__FieldTag>()? {
1168                    #[allow(clippy::match_single_binding)]
1169                    match tag {
1170                        __FieldTag::__endpoints => {
1171                            if !fields.insert(__FieldTag::__endpoints) {
1172                                return std::result::Result::Err(A::Error::duplicate_field(
1173                                    "multiple values for endpoints",
1174                                ));
1175                            }
1176                            result.endpoints = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Endpoint>>>()?.unwrap_or_default();
1177                        }
1178                        __FieldTag::__next_page_token => {
1179                            if !fields.insert(__FieldTag::__next_page_token) {
1180                                return std::result::Result::Err(A::Error::duplicate_field(
1181                                    "multiple values for next_page_token",
1182                                ));
1183                            }
1184                            result.next_page_token = map
1185                                .next_value::<std::option::Option<std::string::String>>()?
1186                                .unwrap_or_default();
1187                        }
1188                        __FieldTag::__unreachable => {
1189                            if !fields.insert(__FieldTag::__unreachable) {
1190                                return std::result::Result::Err(A::Error::duplicate_field(
1191                                    "multiple values for unreachable",
1192                                ));
1193                            }
1194                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1195                        }
1196                        __FieldTag::Unknown(key) => {
1197                            let value = map.next_value::<serde_json::Value>()?;
1198                            result._unknown_fields.insert(key, value);
1199                        }
1200                    }
1201                }
1202                std::result::Result::Ok(result)
1203            }
1204        }
1205        deserializer.deserialize_any(Visitor)
1206    }
1207}
1208
1209#[doc(hidden)]
1210impl serde::ser::Serialize for ListEndpointsResponse {
1211    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1212    where
1213        S: serde::ser::Serializer,
1214    {
1215        use serde::ser::SerializeMap;
1216        #[allow(unused_imports)]
1217        use std::option::Option::Some;
1218        let mut state = serializer.serialize_map(std::option::Option::None)?;
1219        if !self.endpoints.is_empty() {
1220            state.serialize_entry("endpoints", &self.endpoints)?;
1221        }
1222        if !self.next_page_token.is_empty() {
1223            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1224        }
1225        if !self.unreachable.is_empty() {
1226            state.serialize_entry("unreachable", &self.unreachable)?;
1227        }
1228        if !self._unknown_fields.is_empty() {
1229            for (key, value) in self._unknown_fields.iter() {
1230                state.serialize_entry(key, &value)?;
1231            }
1232        }
1233        state.end()
1234    }
1235}
1236
1237impl std::fmt::Debug for ListEndpointsResponse {
1238    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1239        let mut debug_struct = f.debug_struct("ListEndpointsResponse");
1240        debug_struct.field("endpoints", &self.endpoints);
1241        debug_struct.field("next_page_token", &self.next_page_token);
1242        debug_struct.field("unreachable", &self.unreachable);
1243        if !self._unknown_fields.is_empty() {
1244            debug_struct.field("_unknown_fields", &self._unknown_fields);
1245        }
1246        debug_struct.finish()
1247    }
1248}
1249
1250#[derive(Clone, Default, PartialEq)]
1251#[non_exhaustive]
1252pub struct GetEndpointRequest {
1253    /// Required. The name of the endpoint to retrieve.
1254    /// Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
1255    pub name: std::string::String,
1256
1257    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1258}
1259
1260impl GetEndpointRequest {
1261    pub fn new() -> Self {
1262        std::default::Default::default()
1263    }
1264
1265    /// Sets the value of [name][crate::model::GetEndpointRequest::name].
1266    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267        self.name = v.into();
1268        self
1269    }
1270}
1271
1272impl wkt::message::Message for GetEndpointRequest {
1273    fn typename() -> &'static str {
1274        "type.googleapis.com/google.cloud.ids.v1.GetEndpointRequest"
1275    }
1276}
1277
1278#[doc(hidden)]
1279impl<'de> serde::de::Deserialize<'de> for GetEndpointRequest {
1280    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1281    where
1282        D: serde::Deserializer<'de>,
1283    {
1284        #[allow(non_camel_case_types)]
1285        #[doc(hidden)]
1286        #[derive(PartialEq, Eq, Hash)]
1287        enum __FieldTag {
1288            __name,
1289            Unknown(std::string::String),
1290        }
1291        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1292            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1293            where
1294                D: serde::Deserializer<'de>,
1295            {
1296                struct Visitor;
1297                impl<'de> serde::de::Visitor<'de> for Visitor {
1298                    type Value = __FieldTag;
1299                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1300                        formatter.write_str("a field name for GetEndpointRequest")
1301                    }
1302                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1303                    where
1304                        E: serde::de::Error,
1305                    {
1306                        use std::result::Result::Ok;
1307                        use std::string::ToString;
1308                        match value {
1309                            "name" => Ok(__FieldTag::__name),
1310                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1311                        }
1312                    }
1313                }
1314                deserializer.deserialize_identifier(Visitor)
1315            }
1316        }
1317        struct Visitor;
1318        impl<'de> serde::de::Visitor<'de> for Visitor {
1319            type Value = GetEndpointRequest;
1320            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1321                formatter.write_str("struct GetEndpointRequest")
1322            }
1323            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1324            where
1325                A: serde::de::MapAccess<'de>,
1326            {
1327                #[allow(unused_imports)]
1328                use serde::de::Error;
1329                use std::option::Option::Some;
1330                let mut fields = std::collections::HashSet::new();
1331                let mut result = Self::Value::new();
1332                while let Some(tag) = map.next_key::<__FieldTag>()? {
1333                    #[allow(clippy::match_single_binding)]
1334                    match tag {
1335                        __FieldTag::__name => {
1336                            if !fields.insert(__FieldTag::__name) {
1337                                return std::result::Result::Err(A::Error::duplicate_field(
1338                                    "multiple values for name",
1339                                ));
1340                            }
1341                            result.name = map
1342                                .next_value::<std::option::Option<std::string::String>>()?
1343                                .unwrap_or_default();
1344                        }
1345                        __FieldTag::Unknown(key) => {
1346                            let value = map.next_value::<serde_json::Value>()?;
1347                            result._unknown_fields.insert(key, value);
1348                        }
1349                    }
1350                }
1351                std::result::Result::Ok(result)
1352            }
1353        }
1354        deserializer.deserialize_any(Visitor)
1355    }
1356}
1357
1358#[doc(hidden)]
1359impl serde::ser::Serialize for GetEndpointRequest {
1360    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1361    where
1362        S: serde::ser::Serializer,
1363    {
1364        use serde::ser::SerializeMap;
1365        #[allow(unused_imports)]
1366        use std::option::Option::Some;
1367        let mut state = serializer.serialize_map(std::option::Option::None)?;
1368        if !self.name.is_empty() {
1369            state.serialize_entry("name", &self.name)?;
1370        }
1371        if !self._unknown_fields.is_empty() {
1372            for (key, value) in self._unknown_fields.iter() {
1373                state.serialize_entry(key, &value)?;
1374            }
1375        }
1376        state.end()
1377    }
1378}
1379
1380impl std::fmt::Debug for GetEndpointRequest {
1381    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1382        let mut debug_struct = f.debug_struct("GetEndpointRequest");
1383        debug_struct.field("name", &self.name);
1384        if !self._unknown_fields.is_empty() {
1385            debug_struct.field("_unknown_fields", &self._unknown_fields);
1386        }
1387        debug_struct.finish()
1388    }
1389}
1390
1391#[derive(Clone, Default, PartialEq)]
1392#[non_exhaustive]
1393pub struct CreateEndpointRequest {
1394    /// Required. The endpoint's parent.
1395    pub parent: std::string::String,
1396
1397    /// Required. The endpoint identifier. This will be part of the endpoint's
1398    /// resource name.
1399    /// This value must start with a lowercase letter followed by up to 62
1400    /// lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
1401    /// Values that do not match this pattern will trigger an INVALID_ARGUMENT
1402    /// error.
1403    pub endpoint_id: std::string::String,
1404
1405    /// Required. The endpoint to create.
1406    pub endpoint: std::option::Option<crate::model::Endpoint>,
1407
1408    /// An optional request ID to identify requests. Specify a unique request ID
1409    /// so that if you must retry your request, the server will know to ignore
1410    /// the request if it has already been completed. The server will guarantee
1411    /// that for at least 60 minutes since the first request.
1412    ///
1413    /// For example, consider a situation where you make an initial request and t
1414    /// he request times out. If you make the request again with the same request
1415    /// ID, the server can check if original operation with the same request ID
1416    /// was received, and if so, will ignore the second request. This prevents
1417    /// clients from accidentally creating duplicate commitments.
1418    ///
1419    /// The request ID must be a valid UUID with the exception that zero UUID is
1420    /// not supported (00000000-0000-0000-0000-000000000000).
1421    pub request_id: std::string::String,
1422
1423    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1424}
1425
1426impl CreateEndpointRequest {
1427    pub fn new() -> Self {
1428        std::default::Default::default()
1429    }
1430
1431    /// Sets the value of [parent][crate::model::CreateEndpointRequest::parent].
1432    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433        self.parent = v.into();
1434        self
1435    }
1436
1437    /// Sets the value of [endpoint_id][crate::model::CreateEndpointRequest::endpoint_id].
1438    pub fn set_endpoint_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1439        self.endpoint_id = v.into();
1440        self
1441    }
1442
1443    /// Sets the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1444    pub fn set_endpoint<T>(mut self, v: T) -> Self
1445    where
1446        T: std::convert::Into<crate::model::Endpoint>,
1447    {
1448        self.endpoint = std::option::Option::Some(v.into());
1449        self
1450    }
1451
1452    /// Sets or clears the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
1453    pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
1454    where
1455        T: std::convert::Into<crate::model::Endpoint>,
1456    {
1457        self.endpoint = v.map(|x| x.into());
1458        self
1459    }
1460
1461    /// Sets the value of [request_id][crate::model::CreateEndpointRequest::request_id].
1462    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1463        self.request_id = v.into();
1464        self
1465    }
1466}
1467
1468impl wkt::message::Message for CreateEndpointRequest {
1469    fn typename() -> &'static str {
1470        "type.googleapis.com/google.cloud.ids.v1.CreateEndpointRequest"
1471    }
1472}
1473
1474#[doc(hidden)]
1475impl<'de> serde::de::Deserialize<'de> for CreateEndpointRequest {
1476    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1477    where
1478        D: serde::Deserializer<'de>,
1479    {
1480        #[allow(non_camel_case_types)]
1481        #[doc(hidden)]
1482        #[derive(PartialEq, Eq, Hash)]
1483        enum __FieldTag {
1484            __parent,
1485            __endpoint_id,
1486            __endpoint,
1487            __request_id,
1488            Unknown(std::string::String),
1489        }
1490        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1491            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1492            where
1493                D: serde::Deserializer<'de>,
1494            {
1495                struct Visitor;
1496                impl<'de> serde::de::Visitor<'de> for Visitor {
1497                    type Value = __FieldTag;
1498                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1499                        formatter.write_str("a field name for CreateEndpointRequest")
1500                    }
1501                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1502                    where
1503                        E: serde::de::Error,
1504                    {
1505                        use std::result::Result::Ok;
1506                        use std::string::ToString;
1507                        match value {
1508                            "parent" => Ok(__FieldTag::__parent),
1509                            "endpointId" => Ok(__FieldTag::__endpoint_id),
1510                            "endpoint_id" => Ok(__FieldTag::__endpoint_id),
1511                            "endpoint" => Ok(__FieldTag::__endpoint),
1512                            "requestId" => Ok(__FieldTag::__request_id),
1513                            "request_id" => Ok(__FieldTag::__request_id),
1514                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1515                        }
1516                    }
1517                }
1518                deserializer.deserialize_identifier(Visitor)
1519            }
1520        }
1521        struct Visitor;
1522        impl<'de> serde::de::Visitor<'de> for Visitor {
1523            type Value = CreateEndpointRequest;
1524            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1525                formatter.write_str("struct CreateEndpointRequest")
1526            }
1527            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1528            where
1529                A: serde::de::MapAccess<'de>,
1530            {
1531                #[allow(unused_imports)]
1532                use serde::de::Error;
1533                use std::option::Option::Some;
1534                let mut fields = std::collections::HashSet::new();
1535                let mut result = Self::Value::new();
1536                while let Some(tag) = map.next_key::<__FieldTag>()? {
1537                    #[allow(clippy::match_single_binding)]
1538                    match tag {
1539                        __FieldTag::__parent => {
1540                            if !fields.insert(__FieldTag::__parent) {
1541                                return std::result::Result::Err(A::Error::duplicate_field(
1542                                    "multiple values for parent",
1543                                ));
1544                            }
1545                            result.parent = map
1546                                .next_value::<std::option::Option<std::string::String>>()?
1547                                .unwrap_or_default();
1548                        }
1549                        __FieldTag::__endpoint_id => {
1550                            if !fields.insert(__FieldTag::__endpoint_id) {
1551                                return std::result::Result::Err(A::Error::duplicate_field(
1552                                    "multiple values for endpoint_id",
1553                                ));
1554                            }
1555                            result.endpoint_id = map
1556                                .next_value::<std::option::Option<std::string::String>>()?
1557                                .unwrap_or_default();
1558                        }
1559                        __FieldTag::__endpoint => {
1560                            if !fields.insert(__FieldTag::__endpoint) {
1561                                return std::result::Result::Err(A::Error::duplicate_field(
1562                                    "multiple values for endpoint",
1563                                ));
1564                            }
1565                            result.endpoint =
1566                                map.next_value::<std::option::Option<crate::model::Endpoint>>()?;
1567                        }
1568                        __FieldTag::__request_id => {
1569                            if !fields.insert(__FieldTag::__request_id) {
1570                                return std::result::Result::Err(A::Error::duplicate_field(
1571                                    "multiple values for request_id",
1572                                ));
1573                            }
1574                            result.request_id = map
1575                                .next_value::<std::option::Option<std::string::String>>()?
1576                                .unwrap_or_default();
1577                        }
1578                        __FieldTag::Unknown(key) => {
1579                            let value = map.next_value::<serde_json::Value>()?;
1580                            result._unknown_fields.insert(key, value);
1581                        }
1582                    }
1583                }
1584                std::result::Result::Ok(result)
1585            }
1586        }
1587        deserializer.deserialize_any(Visitor)
1588    }
1589}
1590
1591#[doc(hidden)]
1592impl serde::ser::Serialize for CreateEndpointRequest {
1593    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1594    where
1595        S: serde::ser::Serializer,
1596    {
1597        use serde::ser::SerializeMap;
1598        #[allow(unused_imports)]
1599        use std::option::Option::Some;
1600        let mut state = serializer.serialize_map(std::option::Option::None)?;
1601        if !self.parent.is_empty() {
1602            state.serialize_entry("parent", &self.parent)?;
1603        }
1604        if !self.endpoint_id.is_empty() {
1605            state.serialize_entry("endpointId", &self.endpoint_id)?;
1606        }
1607        if self.endpoint.is_some() {
1608            state.serialize_entry("endpoint", &self.endpoint)?;
1609        }
1610        if !self.request_id.is_empty() {
1611            state.serialize_entry("requestId", &self.request_id)?;
1612        }
1613        if !self._unknown_fields.is_empty() {
1614            for (key, value) in self._unknown_fields.iter() {
1615                state.serialize_entry(key, &value)?;
1616            }
1617        }
1618        state.end()
1619    }
1620}
1621
1622impl std::fmt::Debug for CreateEndpointRequest {
1623    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1624        let mut debug_struct = f.debug_struct("CreateEndpointRequest");
1625        debug_struct.field("parent", &self.parent);
1626        debug_struct.field("endpoint_id", &self.endpoint_id);
1627        debug_struct.field("endpoint", &self.endpoint);
1628        debug_struct.field("request_id", &self.request_id);
1629        if !self._unknown_fields.is_empty() {
1630            debug_struct.field("_unknown_fields", &self._unknown_fields);
1631        }
1632        debug_struct.finish()
1633    }
1634}
1635
1636#[derive(Clone, Default, PartialEq)]
1637#[non_exhaustive]
1638pub struct DeleteEndpointRequest {
1639    /// Required. The name of the endpoint to delete.
1640    pub name: std::string::String,
1641
1642    /// An optional request ID to identify requests. Specify a unique request ID
1643    /// so that if you must retry your request, the server will know to ignore
1644    /// the request if it has already been completed. The server will guarantee
1645    /// that for at least 60 minutes after the first request.
1646    ///
1647    /// For example, consider a situation where you make an initial request and t
1648    /// he request times out. If you make the request again with the same request
1649    /// ID, the server can check if original operation with the same request ID
1650    /// was received, and if so, will ignore the second request. This prevents
1651    /// clients from accidentally creating duplicate commitments.
1652    ///
1653    /// The request ID must be a valid UUID with the exception that zero UUID is
1654    /// not supported (00000000-0000-0000-0000-000000000000).
1655    pub request_id: std::string::String,
1656
1657    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1658}
1659
1660impl DeleteEndpointRequest {
1661    pub fn new() -> Self {
1662        std::default::Default::default()
1663    }
1664
1665    /// Sets the value of [name][crate::model::DeleteEndpointRequest::name].
1666    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1667        self.name = v.into();
1668        self
1669    }
1670
1671    /// Sets the value of [request_id][crate::model::DeleteEndpointRequest::request_id].
1672    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1673        self.request_id = v.into();
1674        self
1675    }
1676}
1677
1678impl wkt::message::Message for DeleteEndpointRequest {
1679    fn typename() -> &'static str {
1680        "type.googleapis.com/google.cloud.ids.v1.DeleteEndpointRequest"
1681    }
1682}
1683
1684#[doc(hidden)]
1685impl<'de> serde::de::Deserialize<'de> for DeleteEndpointRequest {
1686    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1687    where
1688        D: serde::Deserializer<'de>,
1689    {
1690        #[allow(non_camel_case_types)]
1691        #[doc(hidden)]
1692        #[derive(PartialEq, Eq, Hash)]
1693        enum __FieldTag {
1694            __name,
1695            __request_id,
1696            Unknown(std::string::String),
1697        }
1698        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1699            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1700            where
1701                D: serde::Deserializer<'de>,
1702            {
1703                struct Visitor;
1704                impl<'de> serde::de::Visitor<'de> for Visitor {
1705                    type Value = __FieldTag;
1706                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1707                        formatter.write_str("a field name for DeleteEndpointRequest")
1708                    }
1709                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1710                    where
1711                        E: serde::de::Error,
1712                    {
1713                        use std::result::Result::Ok;
1714                        use std::string::ToString;
1715                        match value {
1716                            "name" => Ok(__FieldTag::__name),
1717                            "requestId" => Ok(__FieldTag::__request_id),
1718                            "request_id" => Ok(__FieldTag::__request_id),
1719                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1720                        }
1721                    }
1722                }
1723                deserializer.deserialize_identifier(Visitor)
1724            }
1725        }
1726        struct Visitor;
1727        impl<'de> serde::de::Visitor<'de> for Visitor {
1728            type Value = DeleteEndpointRequest;
1729            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1730                formatter.write_str("struct DeleteEndpointRequest")
1731            }
1732            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1733            where
1734                A: serde::de::MapAccess<'de>,
1735            {
1736                #[allow(unused_imports)]
1737                use serde::de::Error;
1738                use std::option::Option::Some;
1739                let mut fields = std::collections::HashSet::new();
1740                let mut result = Self::Value::new();
1741                while let Some(tag) = map.next_key::<__FieldTag>()? {
1742                    #[allow(clippy::match_single_binding)]
1743                    match tag {
1744                        __FieldTag::__name => {
1745                            if !fields.insert(__FieldTag::__name) {
1746                                return std::result::Result::Err(A::Error::duplicate_field(
1747                                    "multiple values for name",
1748                                ));
1749                            }
1750                            result.name = map
1751                                .next_value::<std::option::Option<std::string::String>>()?
1752                                .unwrap_or_default();
1753                        }
1754                        __FieldTag::__request_id => {
1755                            if !fields.insert(__FieldTag::__request_id) {
1756                                return std::result::Result::Err(A::Error::duplicate_field(
1757                                    "multiple values for request_id",
1758                                ));
1759                            }
1760                            result.request_id = map
1761                                .next_value::<std::option::Option<std::string::String>>()?
1762                                .unwrap_or_default();
1763                        }
1764                        __FieldTag::Unknown(key) => {
1765                            let value = map.next_value::<serde_json::Value>()?;
1766                            result._unknown_fields.insert(key, value);
1767                        }
1768                    }
1769                }
1770                std::result::Result::Ok(result)
1771            }
1772        }
1773        deserializer.deserialize_any(Visitor)
1774    }
1775}
1776
1777#[doc(hidden)]
1778impl serde::ser::Serialize for DeleteEndpointRequest {
1779    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1780    where
1781        S: serde::ser::Serializer,
1782    {
1783        use serde::ser::SerializeMap;
1784        #[allow(unused_imports)]
1785        use std::option::Option::Some;
1786        let mut state = serializer.serialize_map(std::option::Option::None)?;
1787        if !self.name.is_empty() {
1788            state.serialize_entry("name", &self.name)?;
1789        }
1790        if !self.request_id.is_empty() {
1791            state.serialize_entry("requestId", &self.request_id)?;
1792        }
1793        if !self._unknown_fields.is_empty() {
1794            for (key, value) in self._unknown_fields.iter() {
1795                state.serialize_entry(key, &value)?;
1796            }
1797        }
1798        state.end()
1799    }
1800}
1801
1802impl std::fmt::Debug for DeleteEndpointRequest {
1803    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1804        let mut debug_struct = f.debug_struct("DeleteEndpointRequest");
1805        debug_struct.field("name", &self.name);
1806        debug_struct.field("request_id", &self.request_id);
1807        if !self._unknown_fields.is_empty() {
1808            debug_struct.field("_unknown_fields", &self._unknown_fields);
1809        }
1810        debug_struct.finish()
1811    }
1812}
1813
1814/// Represents the metadata of the long-running operation.
1815#[derive(Clone, Default, PartialEq)]
1816#[non_exhaustive]
1817pub struct OperationMetadata {
1818    /// Output only. The time the operation was created.
1819    pub create_time: std::option::Option<wkt::Timestamp>,
1820
1821    /// Output only. The time the operation finished running.
1822    pub end_time: std::option::Option<wkt::Timestamp>,
1823
1824    /// Output only. Server-defined resource path for the target of the operation.
1825    pub target: std::string::String,
1826
1827    /// Output only. Name of the verb executed by the operation.
1828    pub verb: std::string::String,
1829
1830    /// Output only. Human-readable status of the operation, if any.
1831    pub status_message: std::string::String,
1832
1833    /// Output only. Identifies whether the user has requested cancellation
1834    /// of the operation. Operations that have successfully been cancelled
1835    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
1836    /// corresponding to `Code.CANCELLED`.
1837    ///
1838    /// [google.rpc.Status.code]: rpc::model::Status::code
1839    pub requested_cancellation: bool,
1840
1841    /// Output only. API version used to start the operation.
1842    pub api_version: std::string::String,
1843
1844    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1845}
1846
1847impl OperationMetadata {
1848    pub fn new() -> Self {
1849        std::default::Default::default()
1850    }
1851
1852    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1853    pub fn set_create_time<T>(mut self, v: T) -> Self
1854    where
1855        T: std::convert::Into<wkt::Timestamp>,
1856    {
1857        self.create_time = std::option::Option::Some(v.into());
1858        self
1859    }
1860
1861    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1862    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1863    where
1864        T: std::convert::Into<wkt::Timestamp>,
1865    {
1866        self.create_time = v.map(|x| x.into());
1867        self
1868    }
1869
1870    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1871    pub fn set_end_time<T>(mut self, v: T) -> Self
1872    where
1873        T: std::convert::Into<wkt::Timestamp>,
1874    {
1875        self.end_time = std::option::Option::Some(v.into());
1876        self
1877    }
1878
1879    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1880    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1881    where
1882        T: std::convert::Into<wkt::Timestamp>,
1883    {
1884        self.end_time = v.map(|x| x.into());
1885        self
1886    }
1887
1888    /// Sets the value of [target][crate::model::OperationMetadata::target].
1889    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1890        self.target = v.into();
1891        self
1892    }
1893
1894    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1895    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1896        self.verb = v.into();
1897        self
1898    }
1899
1900    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
1901    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1902        self.status_message = v.into();
1903        self
1904    }
1905
1906    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
1907    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1908        self.requested_cancellation = v.into();
1909        self
1910    }
1911
1912    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1913    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1914        self.api_version = v.into();
1915        self
1916    }
1917}
1918
1919impl wkt::message::Message for OperationMetadata {
1920    fn typename() -> &'static str {
1921        "type.googleapis.com/google.cloud.ids.v1.OperationMetadata"
1922    }
1923}
1924
1925#[doc(hidden)]
1926impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
1927    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1928    where
1929        D: serde::Deserializer<'de>,
1930    {
1931        #[allow(non_camel_case_types)]
1932        #[doc(hidden)]
1933        #[derive(PartialEq, Eq, Hash)]
1934        enum __FieldTag {
1935            __create_time,
1936            __end_time,
1937            __target,
1938            __verb,
1939            __status_message,
1940            __requested_cancellation,
1941            __api_version,
1942            Unknown(std::string::String),
1943        }
1944        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1945            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1946            where
1947                D: serde::Deserializer<'de>,
1948            {
1949                struct Visitor;
1950                impl<'de> serde::de::Visitor<'de> for Visitor {
1951                    type Value = __FieldTag;
1952                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1953                        formatter.write_str("a field name for OperationMetadata")
1954                    }
1955                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1956                    where
1957                        E: serde::de::Error,
1958                    {
1959                        use std::result::Result::Ok;
1960                        use std::string::ToString;
1961                        match value {
1962                            "createTime" => Ok(__FieldTag::__create_time),
1963                            "create_time" => Ok(__FieldTag::__create_time),
1964                            "endTime" => Ok(__FieldTag::__end_time),
1965                            "end_time" => Ok(__FieldTag::__end_time),
1966                            "target" => Ok(__FieldTag::__target),
1967                            "verb" => Ok(__FieldTag::__verb),
1968                            "statusMessage" => Ok(__FieldTag::__status_message),
1969                            "status_message" => Ok(__FieldTag::__status_message),
1970                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
1971                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
1972                            "apiVersion" => Ok(__FieldTag::__api_version),
1973                            "api_version" => Ok(__FieldTag::__api_version),
1974                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1975                        }
1976                    }
1977                }
1978                deserializer.deserialize_identifier(Visitor)
1979            }
1980        }
1981        struct Visitor;
1982        impl<'de> serde::de::Visitor<'de> for Visitor {
1983            type Value = OperationMetadata;
1984            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1985                formatter.write_str("struct OperationMetadata")
1986            }
1987            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1988            where
1989                A: serde::de::MapAccess<'de>,
1990            {
1991                #[allow(unused_imports)]
1992                use serde::de::Error;
1993                use std::option::Option::Some;
1994                let mut fields = std::collections::HashSet::new();
1995                let mut result = Self::Value::new();
1996                while let Some(tag) = map.next_key::<__FieldTag>()? {
1997                    #[allow(clippy::match_single_binding)]
1998                    match tag {
1999                        __FieldTag::__create_time => {
2000                            if !fields.insert(__FieldTag::__create_time) {
2001                                return std::result::Result::Err(A::Error::duplicate_field(
2002                                    "multiple values for create_time",
2003                                ));
2004                            }
2005                            result.create_time =
2006                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2007                        }
2008                        __FieldTag::__end_time => {
2009                            if !fields.insert(__FieldTag::__end_time) {
2010                                return std::result::Result::Err(A::Error::duplicate_field(
2011                                    "multiple values for end_time",
2012                                ));
2013                            }
2014                            result.end_time =
2015                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2016                        }
2017                        __FieldTag::__target => {
2018                            if !fields.insert(__FieldTag::__target) {
2019                                return std::result::Result::Err(A::Error::duplicate_field(
2020                                    "multiple values for target",
2021                                ));
2022                            }
2023                            result.target = map
2024                                .next_value::<std::option::Option<std::string::String>>()?
2025                                .unwrap_or_default();
2026                        }
2027                        __FieldTag::__verb => {
2028                            if !fields.insert(__FieldTag::__verb) {
2029                                return std::result::Result::Err(A::Error::duplicate_field(
2030                                    "multiple values for verb",
2031                                ));
2032                            }
2033                            result.verb = map
2034                                .next_value::<std::option::Option<std::string::String>>()?
2035                                .unwrap_or_default();
2036                        }
2037                        __FieldTag::__status_message => {
2038                            if !fields.insert(__FieldTag::__status_message) {
2039                                return std::result::Result::Err(A::Error::duplicate_field(
2040                                    "multiple values for status_message",
2041                                ));
2042                            }
2043                            result.status_message = map
2044                                .next_value::<std::option::Option<std::string::String>>()?
2045                                .unwrap_or_default();
2046                        }
2047                        __FieldTag::__requested_cancellation => {
2048                            if !fields.insert(__FieldTag::__requested_cancellation) {
2049                                return std::result::Result::Err(A::Error::duplicate_field(
2050                                    "multiple values for requested_cancellation",
2051                                ));
2052                            }
2053                            result.requested_cancellation = map
2054                                .next_value::<std::option::Option<bool>>()?
2055                                .unwrap_or_default();
2056                        }
2057                        __FieldTag::__api_version => {
2058                            if !fields.insert(__FieldTag::__api_version) {
2059                                return std::result::Result::Err(A::Error::duplicate_field(
2060                                    "multiple values for api_version",
2061                                ));
2062                            }
2063                            result.api_version = map
2064                                .next_value::<std::option::Option<std::string::String>>()?
2065                                .unwrap_or_default();
2066                        }
2067                        __FieldTag::Unknown(key) => {
2068                            let value = map.next_value::<serde_json::Value>()?;
2069                            result._unknown_fields.insert(key, value);
2070                        }
2071                    }
2072                }
2073                std::result::Result::Ok(result)
2074            }
2075        }
2076        deserializer.deserialize_any(Visitor)
2077    }
2078}
2079
2080#[doc(hidden)]
2081impl serde::ser::Serialize for OperationMetadata {
2082    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2083    where
2084        S: serde::ser::Serializer,
2085    {
2086        use serde::ser::SerializeMap;
2087        #[allow(unused_imports)]
2088        use std::option::Option::Some;
2089        let mut state = serializer.serialize_map(std::option::Option::None)?;
2090        if self.create_time.is_some() {
2091            state.serialize_entry("createTime", &self.create_time)?;
2092        }
2093        if self.end_time.is_some() {
2094            state.serialize_entry("endTime", &self.end_time)?;
2095        }
2096        if !self.target.is_empty() {
2097            state.serialize_entry("target", &self.target)?;
2098        }
2099        if !self.verb.is_empty() {
2100            state.serialize_entry("verb", &self.verb)?;
2101        }
2102        if !self.status_message.is_empty() {
2103            state.serialize_entry("statusMessage", &self.status_message)?;
2104        }
2105        if !wkt::internal::is_default(&self.requested_cancellation) {
2106            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
2107        }
2108        if !self.api_version.is_empty() {
2109            state.serialize_entry("apiVersion", &self.api_version)?;
2110        }
2111        if !self._unknown_fields.is_empty() {
2112            for (key, value) in self._unknown_fields.iter() {
2113                state.serialize_entry(key, &value)?;
2114            }
2115        }
2116        state.end()
2117    }
2118}
2119
2120impl std::fmt::Debug for OperationMetadata {
2121    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2122        let mut debug_struct = f.debug_struct("OperationMetadata");
2123        debug_struct.field("create_time", &self.create_time);
2124        debug_struct.field("end_time", &self.end_time);
2125        debug_struct.field("target", &self.target);
2126        debug_struct.field("verb", &self.verb);
2127        debug_struct.field("status_message", &self.status_message);
2128        debug_struct.field("requested_cancellation", &self.requested_cancellation);
2129        debug_struct.field("api_version", &self.api_version);
2130        if !self._unknown_fields.is_empty() {
2131            debug_struct.field("_unknown_fields", &self._unknown_fields);
2132        }
2133        debug_struct.finish()
2134    }
2135}