google_cloud_longrunning/
model.rs

1// Copyright 2024 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 reqwest;
26extern crate rpc;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34/// This resource represents a long-running operation that is the result of a
35/// network API call.
36#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct Operation {
39    /// The server-assigned name, which is only unique within the same service that
40    /// originally returns it. If you use the default HTTP mapping, the
41    /// `name` should be a resource name ending with `operations/{unique_id}`.
42    pub name: std::string::String,
43
44    /// Service-specific metadata associated with the operation.  It typically
45    /// contains progress information and common metadata such as create time.
46    /// Some services might not provide such metadata.  Any method that returns a
47    /// long-running operation should document the metadata type, if any.
48    pub metadata: std::option::Option<wkt::Any>,
49
50    /// If the value is `false`, it means the operation is still in progress.
51    /// If `true`, the operation is completed, and either `error` or `response` is
52    /// available.
53    pub done: bool,
54
55    /// The operation result, which can be either an `error` or a valid `response`.
56    /// If `done` == `false`, neither `error` nor `response` is set.
57    /// If `done` == `true`, exactly one of `error` or `response` can be set.
58    /// Some services might not provide the result.
59    pub result: std::option::Option<crate::model::operation::Result>,
60
61    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
62}
63
64impl Operation {
65    pub fn new() -> Self {
66        std::default::Default::default()
67    }
68
69    /// Sets the value of [name][crate::model::Operation::name].
70    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71        self.name = v.into();
72        self
73    }
74
75    /// Sets the value of [metadata][crate::model::Operation::metadata].
76    pub fn set_metadata<T>(mut self, v: T) -> Self
77    where
78        T: std::convert::Into<wkt::Any>,
79    {
80        self.metadata = std::option::Option::Some(v.into());
81        self
82    }
83
84    /// Sets or clears the value of [metadata][crate::model::Operation::metadata].
85    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
86    where
87        T: std::convert::Into<wkt::Any>,
88    {
89        self.metadata = v.map(|x| x.into());
90        self
91    }
92
93    /// Sets the value of [done][crate::model::Operation::done].
94    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
95        self.done = v.into();
96        self
97    }
98
99    /// Sets the value of [result][crate::model::Operation::result].
100    ///
101    /// Note that all the setters affecting `result` are mutually
102    /// exclusive.
103    pub fn set_result<
104        T: std::convert::Into<std::option::Option<crate::model::operation::Result>>,
105    >(
106        mut self,
107        v: T,
108    ) -> Self {
109        self.result = v.into();
110        self
111    }
112
113    /// The value of [result][crate::model::Operation::result]
114    /// if it holds a `Error`, `None` if the field is not set or
115    /// holds a different branch.
116    pub fn error(&self) -> std::option::Option<&std::boxed::Box<rpc::model::Status>> {
117        #[allow(unreachable_patterns)]
118        self.result.as_ref().and_then(|v| match v {
119            crate::model::operation::Result::Error(v) => std::option::Option::Some(v),
120            _ => std::option::Option::None,
121        })
122    }
123
124    /// Sets the value of [result][crate::model::Operation::result]
125    /// to hold a `Error`.
126    ///
127    /// Note that all the setters affecting `result` are
128    /// mutually exclusive.
129    pub fn set_error<T: std::convert::Into<std::boxed::Box<rpc::model::Status>>>(
130        mut self,
131        v: T,
132    ) -> Self {
133        self.result = std::option::Option::Some(crate::model::operation::Result::Error(v.into()));
134        self
135    }
136
137    /// The value of [result][crate::model::Operation::result]
138    /// if it holds a `Response`, `None` if the field is not set or
139    /// holds a different branch.
140    pub fn response(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
141        #[allow(unreachable_patterns)]
142        self.result.as_ref().and_then(|v| match v {
143            crate::model::operation::Result::Response(v) => std::option::Option::Some(v),
144            _ => std::option::Option::None,
145        })
146    }
147
148    /// Sets the value of [result][crate::model::Operation::result]
149    /// to hold a `Response`.
150    ///
151    /// Note that all the setters affecting `result` are
152    /// mutually exclusive.
153    pub fn set_response<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(mut self, v: T) -> Self {
154        self.result =
155            std::option::Option::Some(crate::model::operation::Result::Response(v.into()));
156        self
157    }
158}
159
160impl wkt::message::Message for Operation {
161    fn typename() -> &'static str {
162        "type.googleapis.com/google.longrunning.Operation"
163    }
164}
165
166#[doc(hidden)]
167impl<'de> serde::de::Deserialize<'de> for Operation {
168    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
169    where
170        D: serde::Deserializer<'de>,
171    {
172        #[allow(non_camel_case_types)]
173        #[doc(hidden)]
174        #[derive(PartialEq, Eq, Hash)]
175        enum __FieldTag {
176            __name,
177            __metadata,
178            __done,
179            __error,
180            __response,
181            Unknown(std::string::String),
182        }
183        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
184            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
185            where
186                D: serde::Deserializer<'de>,
187            {
188                struct Visitor;
189                impl<'de> serde::de::Visitor<'de> for Visitor {
190                    type Value = __FieldTag;
191                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
192                        formatter.write_str("a field name for Operation")
193                    }
194                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
195                    where
196                        E: serde::de::Error,
197                    {
198                        use std::result::Result::Ok;
199                        use std::string::ToString;
200                        match value {
201                            "name" => Ok(__FieldTag::__name),
202                            "metadata" => Ok(__FieldTag::__metadata),
203                            "done" => Ok(__FieldTag::__done),
204                            "error" => Ok(__FieldTag::__error),
205                            "response" => Ok(__FieldTag::__response),
206                            _ => Ok(__FieldTag::Unknown(value.to_string())),
207                        }
208                    }
209                }
210                deserializer.deserialize_identifier(Visitor)
211            }
212        }
213        struct Visitor;
214        impl<'de> serde::de::Visitor<'de> for Visitor {
215            type Value = Operation;
216            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
217                formatter.write_str("struct Operation")
218            }
219            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
220            where
221                A: serde::de::MapAccess<'de>,
222            {
223                #[allow(unused_imports)]
224                use serde::de::Error;
225                use std::option::Option::Some;
226                let mut fields = std::collections::HashSet::new();
227                let mut result = Self::Value::new();
228                while let Some(tag) = map.next_key::<__FieldTag>()? {
229                    #[allow(clippy::match_single_binding)]
230                    match tag {
231                        __FieldTag::__name => {
232                            if !fields.insert(__FieldTag::__name) {
233                                return std::result::Result::Err(A::Error::duplicate_field(
234                                    "multiple values for name",
235                                ));
236                            }
237                            result.name = map
238                                .next_value::<std::option::Option<std::string::String>>()?
239                                .unwrap_or_default();
240                        }
241                        __FieldTag::__metadata => {
242                            if !fields.insert(__FieldTag::__metadata) {
243                                return std::result::Result::Err(A::Error::duplicate_field(
244                                    "multiple values for metadata",
245                                ));
246                            }
247                            result.metadata = map.next_value::<std::option::Option<wkt::Any>>()?;
248                        }
249                        __FieldTag::__done => {
250                            if !fields.insert(__FieldTag::__done) {
251                                return std::result::Result::Err(A::Error::duplicate_field(
252                                    "multiple values for done",
253                                ));
254                            }
255                            result.done = map
256                                .next_value::<std::option::Option<bool>>()?
257                                .unwrap_or_default();
258                        }
259                        __FieldTag::__error => {
260                            if !fields.insert(__FieldTag::__error) {
261                                return std::result::Result::Err(A::Error::duplicate_field(
262                                    "multiple values for error",
263                                ));
264                            }
265                            if result.result.is_some() {
266                                return std::result::Result::Err(A::Error::duplicate_field(
267                                    "multiple values for `result`, a oneof with full ID .google.longrunning.Operation.error, latest field was error",
268                                ));
269                            }
270                            result.result =
271                                std::option::Option::Some(
272                                    crate::model::operation::Result::Error(
273                                        map.next_value::<std::option::Option<
274                                            std::boxed::Box<rpc::model::Status>,
275                                        >>()?
276                                        .unwrap_or_default(),
277                                    ),
278                                );
279                        }
280                        __FieldTag::__response => {
281                            if !fields.insert(__FieldTag::__response) {
282                                return std::result::Result::Err(A::Error::duplicate_field(
283                                    "multiple values for response",
284                                ));
285                            }
286                            if result.result.is_some() {
287                                return std::result::Result::Err(A::Error::duplicate_field(
288                                    "multiple values for `result`, a oneof with full ID .google.longrunning.Operation.response, latest field was response",
289                                ));
290                            }
291                            result.result = std::option::Option::Some(
292                                crate::model::operation::Result::Response(
293                                    map.next_value::<std::option::Option<std::boxed::Box<wkt::Any>>>()?.unwrap_or_default()
294                                ),
295                            );
296                        }
297                        __FieldTag::Unknown(key) => {
298                            let value = map.next_value::<serde_json::Value>()?;
299                            result._unknown_fields.insert(key, value);
300                        }
301                    }
302                }
303                std::result::Result::Ok(result)
304            }
305        }
306        deserializer.deserialize_any(Visitor)
307    }
308}
309
310#[doc(hidden)]
311impl serde::ser::Serialize for Operation {
312    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
313    where
314        S: serde::ser::Serializer,
315    {
316        use serde::ser::SerializeMap;
317        #[allow(unused_imports)]
318        use std::option::Option::Some;
319        let mut state = serializer.serialize_map(std::option::Option::None)?;
320        if !self.name.is_empty() {
321            state.serialize_entry("name", &self.name)?;
322        }
323        if self.metadata.is_some() {
324            state.serialize_entry("metadata", &self.metadata)?;
325        }
326        if !wkt::internal::is_default(&self.done) {
327            state.serialize_entry("done", &self.done)?;
328        }
329        if let Some(value) = self.error() {
330            state.serialize_entry("error", value)?;
331        }
332        if let Some(value) = self.response() {
333            state.serialize_entry("response", value)?;
334        }
335        if !self._unknown_fields.is_empty() {
336            for (key, value) in self._unknown_fields.iter() {
337                state.serialize_entry(key, &value)?;
338            }
339        }
340        state.end()
341    }
342}
343
344impl std::fmt::Debug for Operation {
345    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
346        let mut debug_struct = f.debug_struct("Operation");
347        debug_struct.field("name", &self.name);
348        debug_struct.field("metadata", &self.metadata);
349        debug_struct.field("done", &self.done);
350        debug_struct.field("result", &self.result);
351        if !self._unknown_fields.is_empty() {
352            debug_struct.field("_unknown_fields", &self._unknown_fields);
353        }
354        debug_struct.finish()
355    }
356}
357
358/// Defines additional types related to [Operation].
359pub mod operation {
360    #[allow(unused_imports)]
361    use super::*;
362
363    /// The operation result, which can be either an `error` or a valid `response`.
364    /// If `done` == `false`, neither `error` nor `response` is set.
365    /// If `done` == `true`, exactly one of `error` or `response` can be set.
366    /// Some services might not provide the result.
367    #[derive(Clone, Debug, PartialEq)]
368    #[non_exhaustive]
369    pub enum Result {
370        /// The error result of the operation in case of failure or cancellation.
371        Error(std::boxed::Box<rpc::model::Status>),
372        /// The normal, successful response of the operation.  If the original
373        /// method returns no data on success, such as `Delete`, the response is
374        /// `google.protobuf.Empty`.  If the original method is standard
375        /// `Get`/`Create`/`Update`, the response should be the resource.  For other
376        /// methods, the response should have the type `XxxResponse`, where `Xxx`
377        /// is the original method name.  For example, if the original method name
378        /// is `TakeSnapshot()`, the inferred response type is
379        /// `TakeSnapshotResponse`.
380        Response(std::boxed::Box<wkt::Any>),
381    }
382}
383
384/// The request message for
385/// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
386///
387/// [google.longrunning.Operations.GetOperation]: crate::client::Operations::get_operation
388#[derive(Clone, Default, PartialEq)]
389#[non_exhaustive]
390pub struct GetOperationRequest {
391    /// The name of the operation resource.
392    pub name: std::string::String,
393
394    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
395}
396
397impl GetOperationRequest {
398    pub fn new() -> Self {
399        std::default::Default::default()
400    }
401
402    /// Sets the value of [name][crate::model::GetOperationRequest::name].
403    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404        self.name = v.into();
405        self
406    }
407}
408
409impl wkt::message::Message for GetOperationRequest {
410    fn typename() -> &'static str {
411        "type.googleapis.com/google.longrunning.GetOperationRequest"
412    }
413}
414
415#[doc(hidden)]
416impl<'de> serde::de::Deserialize<'de> for GetOperationRequest {
417    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
418    where
419        D: serde::Deserializer<'de>,
420    {
421        #[allow(non_camel_case_types)]
422        #[doc(hidden)]
423        #[derive(PartialEq, Eq, Hash)]
424        enum __FieldTag {
425            __name,
426            Unknown(std::string::String),
427        }
428        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
429            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
430            where
431                D: serde::Deserializer<'de>,
432            {
433                struct Visitor;
434                impl<'de> serde::de::Visitor<'de> for Visitor {
435                    type Value = __FieldTag;
436                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
437                        formatter.write_str("a field name for GetOperationRequest")
438                    }
439                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
440                    where
441                        E: serde::de::Error,
442                    {
443                        use std::result::Result::Ok;
444                        use std::string::ToString;
445                        match value {
446                            "name" => Ok(__FieldTag::__name),
447                            _ => Ok(__FieldTag::Unknown(value.to_string())),
448                        }
449                    }
450                }
451                deserializer.deserialize_identifier(Visitor)
452            }
453        }
454        struct Visitor;
455        impl<'de> serde::de::Visitor<'de> for Visitor {
456            type Value = GetOperationRequest;
457            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
458                formatter.write_str("struct GetOperationRequest")
459            }
460            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
461            where
462                A: serde::de::MapAccess<'de>,
463            {
464                #[allow(unused_imports)]
465                use serde::de::Error;
466                use std::option::Option::Some;
467                let mut fields = std::collections::HashSet::new();
468                let mut result = Self::Value::new();
469                while let Some(tag) = map.next_key::<__FieldTag>()? {
470                    #[allow(clippy::match_single_binding)]
471                    match tag {
472                        __FieldTag::__name => {
473                            if !fields.insert(__FieldTag::__name) {
474                                return std::result::Result::Err(A::Error::duplicate_field(
475                                    "multiple values for name",
476                                ));
477                            }
478                            result.name = map
479                                .next_value::<std::option::Option<std::string::String>>()?
480                                .unwrap_or_default();
481                        }
482                        __FieldTag::Unknown(key) => {
483                            let value = map.next_value::<serde_json::Value>()?;
484                            result._unknown_fields.insert(key, value);
485                        }
486                    }
487                }
488                std::result::Result::Ok(result)
489            }
490        }
491        deserializer.deserialize_any(Visitor)
492    }
493}
494
495#[doc(hidden)]
496impl serde::ser::Serialize for GetOperationRequest {
497    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
498    where
499        S: serde::ser::Serializer,
500    {
501        use serde::ser::SerializeMap;
502        #[allow(unused_imports)]
503        use std::option::Option::Some;
504        let mut state = serializer.serialize_map(std::option::Option::None)?;
505        if !self.name.is_empty() {
506            state.serialize_entry("name", &self.name)?;
507        }
508        if !self._unknown_fields.is_empty() {
509            for (key, value) in self._unknown_fields.iter() {
510                state.serialize_entry(key, &value)?;
511            }
512        }
513        state.end()
514    }
515}
516
517impl std::fmt::Debug for GetOperationRequest {
518    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
519        let mut debug_struct = f.debug_struct("GetOperationRequest");
520        debug_struct.field("name", &self.name);
521        if !self._unknown_fields.is_empty() {
522            debug_struct.field("_unknown_fields", &self._unknown_fields);
523        }
524        debug_struct.finish()
525    }
526}
527
528/// The request message for
529/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
530///
531/// [google.longrunning.Operations.ListOperations]: crate::client::Operations::list_operations
532#[derive(Clone, Default, PartialEq)]
533#[non_exhaustive]
534pub struct ListOperationsRequest {
535    /// The name of the operation's parent resource.
536    pub name: std::string::String,
537
538    /// The standard list filter.
539    pub filter: std::string::String,
540
541    /// The standard list page size.
542    pub page_size: i32,
543
544    /// The standard list page token.
545    pub page_token: std::string::String,
546
547    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
548}
549
550impl ListOperationsRequest {
551    pub fn new() -> Self {
552        std::default::Default::default()
553    }
554
555    /// Sets the value of [name][crate::model::ListOperationsRequest::name].
556    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
557        self.name = v.into();
558        self
559    }
560
561    /// Sets the value of [filter][crate::model::ListOperationsRequest::filter].
562    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
563        self.filter = v.into();
564        self
565    }
566
567    /// Sets the value of [page_size][crate::model::ListOperationsRequest::page_size].
568    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
569        self.page_size = v.into();
570        self
571    }
572
573    /// Sets the value of [page_token][crate::model::ListOperationsRequest::page_token].
574    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
575        self.page_token = v.into();
576        self
577    }
578}
579
580impl wkt::message::Message for ListOperationsRequest {
581    fn typename() -> &'static str {
582        "type.googleapis.com/google.longrunning.ListOperationsRequest"
583    }
584}
585
586#[doc(hidden)]
587impl<'de> serde::de::Deserialize<'de> for ListOperationsRequest {
588    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
589    where
590        D: serde::Deserializer<'de>,
591    {
592        #[allow(non_camel_case_types)]
593        #[doc(hidden)]
594        #[derive(PartialEq, Eq, Hash)]
595        enum __FieldTag {
596            __name,
597            __filter,
598            __page_size,
599            __page_token,
600            Unknown(std::string::String),
601        }
602        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
603            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
604            where
605                D: serde::Deserializer<'de>,
606            {
607                struct Visitor;
608                impl<'de> serde::de::Visitor<'de> for Visitor {
609                    type Value = __FieldTag;
610                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
611                        formatter.write_str("a field name for ListOperationsRequest")
612                    }
613                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
614                    where
615                        E: serde::de::Error,
616                    {
617                        use std::result::Result::Ok;
618                        use std::string::ToString;
619                        match value {
620                            "name" => Ok(__FieldTag::__name),
621                            "filter" => Ok(__FieldTag::__filter),
622                            "pageSize" => Ok(__FieldTag::__page_size),
623                            "page_size" => Ok(__FieldTag::__page_size),
624                            "pageToken" => Ok(__FieldTag::__page_token),
625                            "page_token" => Ok(__FieldTag::__page_token),
626                            _ => Ok(__FieldTag::Unknown(value.to_string())),
627                        }
628                    }
629                }
630                deserializer.deserialize_identifier(Visitor)
631            }
632        }
633        struct Visitor;
634        impl<'de> serde::de::Visitor<'de> for Visitor {
635            type Value = ListOperationsRequest;
636            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
637                formatter.write_str("struct ListOperationsRequest")
638            }
639            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
640            where
641                A: serde::de::MapAccess<'de>,
642            {
643                #[allow(unused_imports)]
644                use serde::de::Error;
645                use std::option::Option::Some;
646                let mut fields = std::collections::HashSet::new();
647                let mut result = Self::Value::new();
648                while let Some(tag) = map.next_key::<__FieldTag>()? {
649                    #[allow(clippy::match_single_binding)]
650                    match tag {
651                        __FieldTag::__name => {
652                            if !fields.insert(__FieldTag::__name) {
653                                return std::result::Result::Err(A::Error::duplicate_field(
654                                    "multiple values for name",
655                                ));
656                            }
657                            result.name = map
658                                .next_value::<std::option::Option<std::string::String>>()?
659                                .unwrap_or_default();
660                        }
661                        __FieldTag::__filter => {
662                            if !fields.insert(__FieldTag::__filter) {
663                                return std::result::Result::Err(A::Error::duplicate_field(
664                                    "multiple values for filter",
665                                ));
666                            }
667                            result.filter = map
668                                .next_value::<std::option::Option<std::string::String>>()?
669                                .unwrap_or_default();
670                        }
671                        __FieldTag::__page_size => {
672                            if !fields.insert(__FieldTag::__page_size) {
673                                return std::result::Result::Err(A::Error::duplicate_field(
674                                    "multiple values for page_size",
675                                ));
676                            }
677                            struct __With(std::option::Option<i32>);
678                            impl<'de> serde::de::Deserialize<'de> for __With {
679                                fn deserialize<D>(
680                                    deserializer: D,
681                                ) -> std::result::Result<Self, D::Error>
682                                where
683                                    D: serde::de::Deserializer<'de>,
684                                {
685                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
686                                }
687                            }
688                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
689                        }
690                        __FieldTag::__page_token => {
691                            if !fields.insert(__FieldTag::__page_token) {
692                                return std::result::Result::Err(A::Error::duplicate_field(
693                                    "multiple values for page_token",
694                                ));
695                            }
696                            result.page_token = map
697                                .next_value::<std::option::Option<std::string::String>>()?
698                                .unwrap_or_default();
699                        }
700                        __FieldTag::Unknown(key) => {
701                            let value = map.next_value::<serde_json::Value>()?;
702                            result._unknown_fields.insert(key, value);
703                        }
704                    }
705                }
706                std::result::Result::Ok(result)
707            }
708        }
709        deserializer.deserialize_any(Visitor)
710    }
711}
712
713#[doc(hidden)]
714impl serde::ser::Serialize for ListOperationsRequest {
715    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
716    where
717        S: serde::ser::Serializer,
718    {
719        use serde::ser::SerializeMap;
720        #[allow(unused_imports)]
721        use std::option::Option::Some;
722        let mut state = serializer.serialize_map(std::option::Option::None)?;
723        if !self.name.is_empty() {
724            state.serialize_entry("name", &self.name)?;
725        }
726        if !self.filter.is_empty() {
727            state.serialize_entry("filter", &self.filter)?;
728        }
729        if !wkt::internal::is_default(&self.page_size) {
730            struct __With<'a>(&'a i32);
731            impl<'a> serde::ser::Serialize for __With<'a> {
732                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
733                where
734                    S: serde::ser::Serializer,
735                {
736                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
737                }
738            }
739            state.serialize_entry("pageSize", &__With(&self.page_size))?;
740        }
741        if !self.page_token.is_empty() {
742            state.serialize_entry("pageToken", &self.page_token)?;
743        }
744        if !self._unknown_fields.is_empty() {
745            for (key, value) in self._unknown_fields.iter() {
746                state.serialize_entry(key, &value)?;
747            }
748        }
749        state.end()
750    }
751}
752
753impl std::fmt::Debug for ListOperationsRequest {
754    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
755        let mut debug_struct = f.debug_struct("ListOperationsRequest");
756        debug_struct.field("name", &self.name);
757        debug_struct.field("filter", &self.filter);
758        debug_struct.field("page_size", &self.page_size);
759        debug_struct.field("page_token", &self.page_token);
760        if !self._unknown_fields.is_empty() {
761            debug_struct.field("_unknown_fields", &self._unknown_fields);
762        }
763        debug_struct.finish()
764    }
765}
766
767/// The response message for
768/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
769///
770/// [google.longrunning.Operations.ListOperations]: crate::client::Operations::list_operations
771#[derive(Clone, Default, PartialEq)]
772#[non_exhaustive]
773pub struct ListOperationsResponse {
774    /// A list of operations that matches the specified filter in the request.
775    pub operations: std::vec::Vec<crate::model::Operation>,
776
777    /// The standard List next-page token.
778    pub next_page_token: std::string::String,
779
780    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
781}
782
783impl ListOperationsResponse {
784    pub fn new() -> Self {
785        std::default::Default::default()
786    }
787
788    /// Sets the value of [operations][crate::model::ListOperationsResponse::operations].
789    pub fn set_operations<T, V>(mut self, v: T) -> Self
790    where
791        T: std::iter::IntoIterator<Item = V>,
792        V: std::convert::Into<crate::model::Operation>,
793    {
794        use std::iter::Iterator;
795        self.operations = v.into_iter().map(|i| i.into()).collect();
796        self
797    }
798
799    /// Sets the value of [next_page_token][crate::model::ListOperationsResponse::next_page_token].
800    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
801        self.next_page_token = v.into();
802        self
803    }
804}
805
806impl wkt::message::Message for ListOperationsResponse {
807    fn typename() -> &'static str {
808        "type.googleapis.com/google.longrunning.ListOperationsResponse"
809    }
810}
811
812#[doc(hidden)]
813impl gax::paginator::internal::PageableResponse for ListOperationsResponse {
814    type PageItem = crate::model::Operation;
815
816    fn items(self) -> std::vec::Vec<Self::PageItem> {
817        self.operations
818    }
819
820    fn next_page_token(&self) -> std::string::String {
821        use std::clone::Clone;
822        self.next_page_token.clone()
823    }
824}
825
826#[doc(hidden)]
827impl<'de> serde::de::Deserialize<'de> for ListOperationsResponse {
828    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
829    where
830        D: serde::Deserializer<'de>,
831    {
832        #[allow(non_camel_case_types)]
833        #[doc(hidden)]
834        #[derive(PartialEq, Eq, Hash)]
835        enum __FieldTag {
836            __operations,
837            __next_page_token,
838            Unknown(std::string::String),
839        }
840        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
841            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
842            where
843                D: serde::Deserializer<'de>,
844            {
845                struct Visitor;
846                impl<'de> serde::de::Visitor<'de> for Visitor {
847                    type Value = __FieldTag;
848                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
849                        formatter.write_str("a field name for ListOperationsResponse")
850                    }
851                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
852                    where
853                        E: serde::de::Error,
854                    {
855                        use std::result::Result::Ok;
856                        use std::string::ToString;
857                        match value {
858                            "operations" => Ok(__FieldTag::__operations),
859                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
860                            "next_page_token" => Ok(__FieldTag::__next_page_token),
861                            _ => Ok(__FieldTag::Unknown(value.to_string())),
862                        }
863                    }
864                }
865                deserializer.deserialize_identifier(Visitor)
866            }
867        }
868        struct Visitor;
869        impl<'de> serde::de::Visitor<'de> for Visitor {
870            type Value = ListOperationsResponse;
871            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
872                formatter.write_str("struct ListOperationsResponse")
873            }
874            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
875            where
876                A: serde::de::MapAccess<'de>,
877            {
878                #[allow(unused_imports)]
879                use serde::de::Error;
880                use std::option::Option::Some;
881                let mut fields = std::collections::HashSet::new();
882                let mut result = Self::Value::new();
883                while let Some(tag) = map.next_key::<__FieldTag>()? {
884                    #[allow(clippy::match_single_binding)]
885                    match tag {
886                        __FieldTag::__operations => {
887                            if !fields.insert(__FieldTag::__operations) {
888                                return std::result::Result::Err(A::Error::duplicate_field(
889                                    "multiple values for operations",
890                                ));
891                            }
892                            result.operations = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Operation>>>()?.unwrap_or_default();
893                        }
894                        __FieldTag::__next_page_token => {
895                            if !fields.insert(__FieldTag::__next_page_token) {
896                                return std::result::Result::Err(A::Error::duplicate_field(
897                                    "multiple values for next_page_token",
898                                ));
899                            }
900                            result.next_page_token = map
901                                .next_value::<std::option::Option<std::string::String>>()?
902                                .unwrap_or_default();
903                        }
904                        __FieldTag::Unknown(key) => {
905                            let value = map.next_value::<serde_json::Value>()?;
906                            result._unknown_fields.insert(key, value);
907                        }
908                    }
909                }
910                std::result::Result::Ok(result)
911            }
912        }
913        deserializer.deserialize_any(Visitor)
914    }
915}
916
917#[doc(hidden)]
918impl serde::ser::Serialize for ListOperationsResponse {
919    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
920    where
921        S: serde::ser::Serializer,
922    {
923        use serde::ser::SerializeMap;
924        #[allow(unused_imports)]
925        use std::option::Option::Some;
926        let mut state = serializer.serialize_map(std::option::Option::None)?;
927        if !self.operations.is_empty() {
928            state.serialize_entry("operations", &self.operations)?;
929        }
930        if !self.next_page_token.is_empty() {
931            state.serialize_entry("nextPageToken", &self.next_page_token)?;
932        }
933        if !self._unknown_fields.is_empty() {
934            for (key, value) in self._unknown_fields.iter() {
935                state.serialize_entry(key, &value)?;
936            }
937        }
938        state.end()
939    }
940}
941
942impl std::fmt::Debug for ListOperationsResponse {
943    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
944        let mut debug_struct = f.debug_struct("ListOperationsResponse");
945        debug_struct.field("operations", &self.operations);
946        debug_struct.field("next_page_token", &self.next_page_token);
947        if !self._unknown_fields.is_empty() {
948            debug_struct.field("_unknown_fields", &self._unknown_fields);
949        }
950        debug_struct.finish()
951    }
952}
953
954/// The request message for
955/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
956///
957/// [google.longrunning.Operations.CancelOperation]: crate::client::Operations::cancel_operation
958#[derive(Clone, Default, PartialEq)]
959#[non_exhaustive]
960pub struct CancelOperationRequest {
961    /// The name of the operation resource to be cancelled.
962    pub name: std::string::String,
963
964    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
965}
966
967impl CancelOperationRequest {
968    pub fn new() -> Self {
969        std::default::Default::default()
970    }
971
972    /// Sets the value of [name][crate::model::CancelOperationRequest::name].
973    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
974        self.name = v.into();
975        self
976    }
977}
978
979impl wkt::message::Message for CancelOperationRequest {
980    fn typename() -> &'static str {
981        "type.googleapis.com/google.longrunning.CancelOperationRequest"
982    }
983}
984
985#[doc(hidden)]
986impl<'de> serde::de::Deserialize<'de> for CancelOperationRequest {
987    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
988    where
989        D: serde::Deserializer<'de>,
990    {
991        #[allow(non_camel_case_types)]
992        #[doc(hidden)]
993        #[derive(PartialEq, Eq, Hash)]
994        enum __FieldTag {
995            __name,
996            Unknown(std::string::String),
997        }
998        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
999            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1000            where
1001                D: serde::Deserializer<'de>,
1002            {
1003                struct Visitor;
1004                impl<'de> serde::de::Visitor<'de> for Visitor {
1005                    type Value = __FieldTag;
1006                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1007                        formatter.write_str("a field name for CancelOperationRequest")
1008                    }
1009                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1010                    where
1011                        E: serde::de::Error,
1012                    {
1013                        use std::result::Result::Ok;
1014                        use std::string::ToString;
1015                        match value {
1016                            "name" => Ok(__FieldTag::__name),
1017                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1018                        }
1019                    }
1020                }
1021                deserializer.deserialize_identifier(Visitor)
1022            }
1023        }
1024        struct Visitor;
1025        impl<'de> serde::de::Visitor<'de> for Visitor {
1026            type Value = CancelOperationRequest;
1027            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1028                formatter.write_str("struct CancelOperationRequest")
1029            }
1030            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1031            where
1032                A: serde::de::MapAccess<'de>,
1033            {
1034                #[allow(unused_imports)]
1035                use serde::de::Error;
1036                use std::option::Option::Some;
1037                let mut fields = std::collections::HashSet::new();
1038                let mut result = Self::Value::new();
1039                while let Some(tag) = map.next_key::<__FieldTag>()? {
1040                    #[allow(clippy::match_single_binding)]
1041                    match tag {
1042                        __FieldTag::__name => {
1043                            if !fields.insert(__FieldTag::__name) {
1044                                return std::result::Result::Err(A::Error::duplicate_field(
1045                                    "multiple values for name",
1046                                ));
1047                            }
1048                            result.name = map
1049                                .next_value::<std::option::Option<std::string::String>>()?
1050                                .unwrap_or_default();
1051                        }
1052                        __FieldTag::Unknown(key) => {
1053                            let value = map.next_value::<serde_json::Value>()?;
1054                            result._unknown_fields.insert(key, value);
1055                        }
1056                    }
1057                }
1058                std::result::Result::Ok(result)
1059            }
1060        }
1061        deserializer.deserialize_any(Visitor)
1062    }
1063}
1064
1065#[doc(hidden)]
1066impl serde::ser::Serialize for CancelOperationRequest {
1067    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1068    where
1069        S: serde::ser::Serializer,
1070    {
1071        use serde::ser::SerializeMap;
1072        #[allow(unused_imports)]
1073        use std::option::Option::Some;
1074        let mut state = serializer.serialize_map(std::option::Option::None)?;
1075        if !self.name.is_empty() {
1076            state.serialize_entry("name", &self.name)?;
1077        }
1078        if !self._unknown_fields.is_empty() {
1079            for (key, value) in self._unknown_fields.iter() {
1080                state.serialize_entry(key, &value)?;
1081            }
1082        }
1083        state.end()
1084    }
1085}
1086
1087impl std::fmt::Debug for CancelOperationRequest {
1088    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1089        let mut debug_struct = f.debug_struct("CancelOperationRequest");
1090        debug_struct.field("name", &self.name);
1091        if !self._unknown_fields.is_empty() {
1092            debug_struct.field("_unknown_fields", &self._unknown_fields);
1093        }
1094        debug_struct.finish()
1095    }
1096}
1097
1098/// The request message for
1099/// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
1100///
1101/// [google.longrunning.Operations.DeleteOperation]: crate::client::Operations::delete_operation
1102#[derive(Clone, Default, PartialEq)]
1103#[non_exhaustive]
1104pub struct DeleteOperationRequest {
1105    /// The name of the operation resource to be deleted.
1106    pub name: std::string::String,
1107
1108    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1109}
1110
1111impl DeleteOperationRequest {
1112    pub fn new() -> Self {
1113        std::default::Default::default()
1114    }
1115
1116    /// Sets the value of [name][crate::model::DeleteOperationRequest::name].
1117    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1118        self.name = v.into();
1119        self
1120    }
1121}
1122
1123impl wkt::message::Message for DeleteOperationRequest {
1124    fn typename() -> &'static str {
1125        "type.googleapis.com/google.longrunning.DeleteOperationRequest"
1126    }
1127}
1128
1129#[doc(hidden)]
1130impl<'de> serde::de::Deserialize<'de> for DeleteOperationRequest {
1131    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1132    where
1133        D: serde::Deserializer<'de>,
1134    {
1135        #[allow(non_camel_case_types)]
1136        #[doc(hidden)]
1137        #[derive(PartialEq, Eq, Hash)]
1138        enum __FieldTag {
1139            __name,
1140            Unknown(std::string::String),
1141        }
1142        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1143            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1144            where
1145                D: serde::Deserializer<'de>,
1146            {
1147                struct Visitor;
1148                impl<'de> serde::de::Visitor<'de> for Visitor {
1149                    type Value = __FieldTag;
1150                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1151                        formatter.write_str("a field name for DeleteOperationRequest")
1152                    }
1153                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1154                    where
1155                        E: serde::de::Error,
1156                    {
1157                        use std::result::Result::Ok;
1158                        use std::string::ToString;
1159                        match value {
1160                            "name" => Ok(__FieldTag::__name),
1161                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1162                        }
1163                    }
1164                }
1165                deserializer.deserialize_identifier(Visitor)
1166            }
1167        }
1168        struct Visitor;
1169        impl<'de> serde::de::Visitor<'de> for Visitor {
1170            type Value = DeleteOperationRequest;
1171            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1172                formatter.write_str("struct DeleteOperationRequest")
1173            }
1174            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1175            where
1176                A: serde::de::MapAccess<'de>,
1177            {
1178                #[allow(unused_imports)]
1179                use serde::de::Error;
1180                use std::option::Option::Some;
1181                let mut fields = std::collections::HashSet::new();
1182                let mut result = Self::Value::new();
1183                while let Some(tag) = map.next_key::<__FieldTag>()? {
1184                    #[allow(clippy::match_single_binding)]
1185                    match tag {
1186                        __FieldTag::__name => {
1187                            if !fields.insert(__FieldTag::__name) {
1188                                return std::result::Result::Err(A::Error::duplicate_field(
1189                                    "multiple values for name",
1190                                ));
1191                            }
1192                            result.name = map
1193                                .next_value::<std::option::Option<std::string::String>>()?
1194                                .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 DeleteOperationRequest {
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.name.is_empty() {
1220            state.serialize_entry("name", &self.name)?;
1221        }
1222        if !self._unknown_fields.is_empty() {
1223            for (key, value) in self._unknown_fields.iter() {
1224                state.serialize_entry(key, &value)?;
1225            }
1226        }
1227        state.end()
1228    }
1229}
1230
1231impl std::fmt::Debug for DeleteOperationRequest {
1232    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1233        let mut debug_struct = f.debug_struct("DeleteOperationRequest");
1234        debug_struct.field("name", &self.name);
1235        if !self._unknown_fields.is_empty() {
1236            debug_struct.field("_unknown_fields", &self._unknown_fields);
1237        }
1238        debug_struct.finish()
1239    }
1240}
1241
1242/// The request message for
1243/// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
1244#[derive(Clone, Default, PartialEq)]
1245#[non_exhaustive]
1246pub struct WaitOperationRequest {
1247    /// The name of the operation resource to wait on.
1248    pub name: std::string::String,
1249
1250    /// The maximum duration to wait before timing out. If left blank, the wait
1251    /// will be at most the time permitted by the underlying HTTP/RPC protocol.
1252    /// If RPC context deadline is also specified, the shorter one will be used.
1253    pub timeout: std::option::Option<wkt::Duration>,
1254
1255    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1256}
1257
1258impl WaitOperationRequest {
1259    pub fn new() -> Self {
1260        std::default::Default::default()
1261    }
1262
1263    /// Sets the value of [name][crate::model::WaitOperationRequest::name].
1264    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1265        self.name = v.into();
1266        self
1267    }
1268
1269    /// Sets the value of [timeout][crate::model::WaitOperationRequest::timeout].
1270    pub fn set_timeout<T>(mut self, v: T) -> Self
1271    where
1272        T: std::convert::Into<wkt::Duration>,
1273    {
1274        self.timeout = std::option::Option::Some(v.into());
1275        self
1276    }
1277
1278    /// Sets or clears the value of [timeout][crate::model::WaitOperationRequest::timeout].
1279    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1280    where
1281        T: std::convert::Into<wkt::Duration>,
1282    {
1283        self.timeout = v.map(|x| x.into());
1284        self
1285    }
1286}
1287
1288impl wkt::message::Message for WaitOperationRequest {
1289    fn typename() -> &'static str {
1290        "type.googleapis.com/google.longrunning.WaitOperationRequest"
1291    }
1292}
1293
1294#[doc(hidden)]
1295impl<'de> serde::de::Deserialize<'de> for WaitOperationRequest {
1296    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1297    where
1298        D: serde::Deserializer<'de>,
1299    {
1300        #[allow(non_camel_case_types)]
1301        #[doc(hidden)]
1302        #[derive(PartialEq, Eq, Hash)]
1303        enum __FieldTag {
1304            __name,
1305            __timeout,
1306            Unknown(std::string::String),
1307        }
1308        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1309            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1310            where
1311                D: serde::Deserializer<'de>,
1312            {
1313                struct Visitor;
1314                impl<'de> serde::de::Visitor<'de> for Visitor {
1315                    type Value = __FieldTag;
1316                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1317                        formatter.write_str("a field name for WaitOperationRequest")
1318                    }
1319                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1320                    where
1321                        E: serde::de::Error,
1322                    {
1323                        use std::result::Result::Ok;
1324                        use std::string::ToString;
1325                        match value {
1326                            "name" => Ok(__FieldTag::__name),
1327                            "timeout" => Ok(__FieldTag::__timeout),
1328                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1329                        }
1330                    }
1331                }
1332                deserializer.deserialize_identifier(Visitor)
1333            }
1334        }
1335        struct Visitor;
1336        impl<'de> serde::de::Visitor<'de> for Visitor {
1337            type Value = WaitOperationRequest;
1338            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1339                formatter.write_str("struct WaitOperationRequest")
1340            }
1341            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1342            where
1343                A: serde::de::MapAccess<'de>,
1344            {
1345                #[allow(unused_imports)]
1346                use serde::de::Error;
1347                use std::option::Option::Some;
1348                let mut fields = std::collections::HashSet::new();
1349                let mut result = Self::Value::new();
1350                while let Some(tag) = map.next_key::<__FieldTag>()? {
1351                    #[allow(clippy::match_single_binding)]
1352                    match tag {
1353                        __FieldTag::__name => {
1354                            if !fields.insert(__FieldTag::__name) {
1355                                return std::result::Result::Err(A::Error::duplicate_field(
1356                                    "multiple values for name",
1357                                ));
1358                            }
1359                            result.name = map
1360                                .next_value::<std::option::Option<std::string::String>>()?
1361                                .unwrap_or_default();
1362                        }
1363                        __FieldTag::__timeout => {
1364                            if !fields.insert(__FieldTag::__timeout) {
1365                                return std::result::Result::Err(A::Error::duplicate_field(
1366                                    "multiple values for timeout",
1367                                ));
1368                            }
1369                            result.timeout =
1370                                map.next_value::<std::option::Option<wkt::Duration>>()?;
1371                        }
1372                        __FieldTag::Unknown(key) => {
1373                            let value = map.next_value::<serde_json::Value>()?;
1374                            result._unknown_fields.insert(key, value);
1375                        }
1376                    }
1377                }
1378                std::result::Result::Ok(result)
1379            }
1380        }
1381        deserializer.deserialize_any(Visitor)
1382    }
1383}
1384
1385#[doc(hidden)]
1386impl serde::ser::Serialize for WaitOperationRequest {
1387    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1388    where
1389        S: serde::ser::Serializer,
1390    {
1391        use serde::ser::SerializeMap;
1392        #[allow(unused_imports)]
1393        use std::option::Option::Some;
1394        let mut state = serializer.serialize_map(std::option::Option::None)?;
1395        if !self.name.is_empty() {
1396            state.serialize_entry("name", &self.name)?;
1397        }
1398        if self.timeout.is_some() {
1399            state.serialize_entry("timeout", &self.timeout)?;
1400        }
1401        if !self._unknown_fields.is_empty() {
1402            for (key, value) in self._unknown_fields.iter() {
1403                state.serialize_entry(key, &value)?;
1404            }
1405        }
1406        state.end()
1407    }
1408}
1409
1410impl std::fmt::Debug for WaitOperationRequest {
1411    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1412        let mut debug_struct = f.debug_struct("WaitOperationRequest");
1413        debug_struct.field("name", &self.name);
1414        debug_struct.field("timeout", &self.timeout);
1415        if !self._unknown_fields.is_empty() {
1416            debug_struct.field("_unknown_fields", &self._unknown_fields);
1417        }
1418        debug_struct.finish()
1419    }
1420}
1421
1422/// A message representing the message types used by a long-running operation.
1423///
1424/// Example:
1425///
1426/// ```norust
1427/// rpc Export(ExportRequest) returns (google.longrunning.Operation) {
1428///   option (google.longrunning.operation_info) = {
1429///     response_type: "ExportResponse"
1430///     metadata_type: "ExportMetadata"
1431///   };
1432/// }
1433/// ```
1434#[derive(Clone, Default, PartialEq)]
1435#[non_exhaustive]
1436pub struct OperationInfo {
1437    /// Required. The message name of the primary return type for this
1438    /// long-running operation.
1439    /// This type will be used to deserialize the LRO's response.
1440    ///
1441    /// If the response is in a different package from the rpc, a fully-qualified
1442    /// message name must be used (e.g. `google.protobuf.Struct`).
1443    ///
1444    /// Note: Altering this value constitutes a breaking change.
1445    pub response_type: std::string::String,
1446
1447    /// Required. The message name of the metadata type for this long-running
1448    /// operation.
1449    ///
1450    /// If the response is in a different package from the rpc, a fully-qualified
1451    /// message name must be used (e.g. `google.protobuf.Struct`).
1452    ///
1453    /// Note: Altering this value constitutes a breaking change.
1454    pub metadata_type: std::string::String,
1455
1456    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1457}
1458
1459impl OperationInfo {
1460    pub fn new() -> Self {
1461        std::default::Default::default()
1462    }
1463
1464    /// Sets the value of [response_type][crate::model::OperationInfo::response_type].
1465    pub fn set_response_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1466        self.response_type = v.into();
1467        self
1468    }
1469
1470    /// Sets the value of [metadata_type][crate::model::OperationInfo::metadata_type].
1471    pub fn set_metadata_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1472        self.metadata_type = v.into();
1473        self
1474    }
1475}
1476
1477impl wkt::message::Message for OperationInfo {
1478    fn typename() -> &'static str {
1479        "type.googleapis.com/google.longrunning.OperationInfo"
1480    }
1481}
1482
1483#[doc(hidden)]
1484impl<'de> serde::de::Deserialize<'de> for OperationInfo {
1485    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1486    where
1487        D: serde::Deserializer<'de>,
1488    {
1489        #[allow(non_camel_case_types)]
1490        #[doc(hidden)]
1491        #[derive(PartialEq, Eq, Hash)]
1492        enum __FieldTag {
1493            __response_type,
1494            __metadata_type,
1495            Unknown(std::string::String),
1496        }
1497        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1498            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1499            where
1500                D: serde::Deserializer<'de>,
1501            {
1502                struct Visitor;
1503                impl<'de> serde::de::Visitor<'de> for Visitor {
1504                    type Value = __FieldTag;
1505                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1506                        formatter.write_str("a field name for OperationInfo")
1507                    }
1508                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1509                    where
1510                        E: serde::de::Error,
1511                    {
1512                        use std::result::Result::Ok;
1513                        use std::string::ToString;
1514                        match value {
1515                            "responseType" => Ok(__FieldTag::__response_type),
1516                            "response_type" => Ok(__FieldTag::__response_type),
1517                            "metadataType" => Ok(__FieldTag::__metadata_type),
1518                            "metadata_type" => Ok(__FieldTag::__metadata_type),
1519                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1520                        }
1521                    }
1522                }
1523                deserializer.deserialize_identifier(Visitor)
1524            }
1525        }
1526        struct Visitor;
1527        impl<'de> serde::de::Visitor<'de> for Visitor {
1528            type Value = OperationInfo;
1529            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1530                formatter.write_str("struct OperationInfo")
1531            }
1532            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1533            where
1534                A: serde::de::MapAccess<'de>,
1535            {
1536                #[allow(unused_imports)]
1537                use serde::de::Error;
1538                use std::option::Option::Some;
1539                let mut fields = std::collections::HashSet::new();
1540                let mut result = Self::Value::new();
1541                while let Some(tag) = map.next_key::<__FieldTag>()? {
1542                    #[allow(clippy::match_single_binding)]
1543                    match tag {
1544                        __FieldTag::__response_type => {
1545                            if !fields.insert(__FieldTag::__response_type) {
1546                                return std::result::Result::Err(A::Error::duplicate_field(
1547                                    "multiple values for response_type",
1548                                ));
1549                            }
1550                            result.response_type = map
1551                                .next_value::<std::option::Option<std::string::String>>()?
1552                                .unwrap_or_default();
1553                        }
1554                        __FieldTag::__metadata_type => {
1555                            if !fields.insert(__FieldTag::__metadata_type) {
1556                                return std::result::Result::Err(A::Error::duplicate_field(
1557                                    "multiple values for metadata_type",
1558                                ));
1559                            }
1560                            result.metadata_type = map
1561                                .next_value::<std::option::Option<std::string::String>>()?
1562                                .unwrap_or_default();
1563                        }
1564                        __FieldTag::Unknown(key) => {
1565                            let value = map.next_value::<serde_json::Value>()?;
1566                            result._unknown_fields.insert(key, value);
1567                        }
1568                    }
1569                }
1570                std::result::Result::Ok(result)
1571            }
1572        }
1573        deserializer.deserialize_any(Visitor)
1574    }
1575}
1576
1577#[doc(hidden)]
1578impl serde::ser::Serialize for OperationInfo {
1579    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1580    where
1581        S: serde::ser::Serializer,
1582    {
1583        use serde::ser::SerializeMap;
1584        #[allow(unused_imports)]
1585        use std::option::Option::Some;
1586        let mut state = serializer.serialize_map(std::option::Option::None)?;
1587        if !self.response_type.is_empty() {
1588            state.serialize_entry("responseType", &self.response_type)?;
1589        }
1590        if !self.metadata_type.is_empty() {
1591            state.serialize_entry("metadataType", &self.metadata_type)?;
1592        }
1593        if !self._unknown_fields.is_empty() {
1594            for (key, value) in self._unknown_fields.iter() {
1595                state.serialize_entry(key, &value)?;
1596            }
1597        }
1598        state.end()
1599    }
1600}
1601
1602impl std::fmt::Debug for OperationInfo {
1603    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1604        let mut debug_struct = f.debug_struct("OperationInfo");
1605        debug_struct.field("response_type", &self.response_type);
1606        debug_struct.field("metadata_type", &self.metadata_type);
1607        if !self._unknown_fields.is_empty() {
1608            debug_struct.field("_unknown_fields", &self._unknown_fields);
1609        }
1610        debug_struct.finish()
1611    }
1612}