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, Debug, 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
344/// Defines additional types related to [Operation].
345pub mod operation {
346    #[allow(unused_imports)]
347    use super::*;
348
349    /// The operation result, which can be either an `error` or a valid `response`.
350    /// If `done` == `false`, neither `error` nor `response` is set.
351    /// If `done` == `true`, exactly one of `error` or `response` can be set.
352    /// Some services might not provide the result.
353    #[derive(Clone, Debug, PartialEq)]
354    #[non_exhaustive]
355    pub enum Result {
356        /// The error result of the operation in case of failure or cancellation.
357        Error(std::boxed::Box<rpc::model::Status>),
358        /// The normal, successful response of the operation.  If the original
359        /// method returns no data on success, such as `Delete`, the response is
360        /// `google.protobuf.Empty`.  If the original method is standard
361        /// `Get`/`Create`/`Update`, the response should be the resource.  For other
362        /// methods, the response should have the type `XxxResponse`, where `Xxx`
363        /// is the original method name.  For example, if the original method name
364        /// is `TakeSnapshot()`, the inferred response type is
365        /// `TakeSnapshotResponse`.
366        Response(std::boxed::Box<wkt::Any>),
367    }
368}
369
370/// The request message for
371/// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
372///
373/// [google.longrunning.Operations.GetOperation]: crate::client::Operations::get_operation
374#[derive(Clone, Debug, Default, PartialEq)]
375#[non_exhaustive]
376pub struct GetOperationRequest {
377    /// The name of the operation resource.
378    pub name: std::string::String,
379
380    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
381}
382
383impl GetOperationRequest {
384    pub fn new() -> Self {
385        std::default::Default::default()
386    }
387
388    /// Sets the value of [name][crate::model::GetOperationRequest::name].
389    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390        self.name = v.into();
391        self
392    }
393}
394
395impl wkt::message::Message for GetOperationRequest {
396    fn typename() -> &'static str {
397        "type.googleapis.com/google.longrunning.GetOperationRequest"
398    }
399}
400
401#[doc(hidden)]
402impl<'de> serde::de::Deserialize<'de> for GetOperationRequest {
403    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
404    where
405        D: serde::Deserializer<'de>,
406    {
407        #[allow(non_camel_case_types)]
408        #[doc(hidden)]
409        #[derive(PartialEq, Eq, Hash)]
410        enum __FieldTag {
411            __name,
412            Unknown(std::string::String),
413        }
414        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
415            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
416            where
417                D: serde::Deserializer<'de>,
418            {
419                struct Visitor;
420                impl<'de> serde::de::Visitor<'de> for Visitor {
421                    type Value = __FieldTag;
422                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
423                        formatter.write_str("a field name for GetOperationRequest")
424                    }
425                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
426                    where
427                        E: serde::de::Error,
428                    {
429                        use std::result::Result::Ok;
430                        use std::string::ToString;
431                        match value {
432                            "name" => Ok(__FieldTag::__name),
433                            _ => Ok(__FieldTag::Unknown(value.to_string())),
434                        }
435                    }
436                }
437                deserializer.deserialize_identifier(Visitor)
438            }
439        }
440        struct Visitor;
441        impl<'de> serde::de::Visitor<'de> for Visitor {
442            type Value = GetOperationRequest;
443            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
444                formatter.write_str("struct GetOperationRequest")
445            }
446            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
447            where
448                A: serde::de::MapAccess<'de>,
449            {
450                #[allow(unused_imports)]
451                use serde::de::Error;
452                use std::option::Option::Some;
453                let mut fields = std::collections::HashSet::new();
454                let mut result = Self::Value::new();
455                while let Some(tag) = map.next_key::<__FieldTag>()? {
456                    #[allow(clippy::match_single_binding)]
457                    match tag {
458                        __FieldTag::__name => {
459                            if !fields.insert(__FieldTag::__name) {
460                                return std::result::Result::Err(A::Error::duplicate_field(
461                                    "multiple values for name",
462                                ));
463                            }
464                            result.name = map
465                                .next_value::<std::option::Option<std::string::String>>()?
466                                .unwrap_or_default();
467                        }
468                        __FieldTag::Unknown(key) => {
469                            let value = map.next_value::<serde_json::Value>()?;
470                            result._unknown_fields.insert(key, value);
471                        }
472                    }
473                }
474                std::result::Result::Ok(result)
475            }
476        }
477        deserializer.deserialize_any(Visitor)
478    }
479}
480
481#[doc(hidden)]
482impl serde::ser::Serialize for GetOperationRequest {
483    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
484    where
485        S: serde::ser::Serializer,
486    {
487        use serde::ser::SerializeMap;
488        #[allow(unused_imports)]
489        use std::option::Option::Some;
490        let mut state = serializer.serialize_map(std::option::Option::None)?;
491        if !self.name.is_empty() {
492            state.serialize_entry("name", &self.name)?;
493        }
494        if !self._unknown_fields.is_empty() {
495            for (key, value) in self._unknown_fields.iter() {
496                state.serialize_entry(key, &value)?;
497            }
498        }
499        state.end()
500    }
501}
502
503/// The request message for
504/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
505///
506/// [google.longrunning.Operations.ListOperations]: crate::client::Operations::list_operations
507#[derive(Clone, Debug, Default, PartialEq)]
508#[non_exhaustive]
509pub struct ListOperationsRequest {
510    /// The name of the operation's parent resource.
511    pub name: std::string::String,
512
513    /// The standard list filter.
514    pub filter: std::string::String,
515
516    /// The standard list page size.
517    pub page_size: i32,
518
519    /// The standard list page token.
520    pub page_token: std::string::String,
521
522    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
523}
524
525impl ListOperationsRequest {
526    pub fn new() -> Self {
527        std::default::Default::default()
528    }
529
530    /// Sets the value of [name][crate::model::ListOperationsRequest::name].
531    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
532        self.name = v.into();
533        self
534    }
535
536    /// Sets the value of [filter][crate::model::ListOperationsRequest::filter].
537    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
538        self.filter = v.into();
539        self
540    }
541
542    /// Sets the value of [page_size][crate::model::ListOperationsRequest::page_size].
543    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
544        self.page_size = v.into();
545        self
546    }
547
548    /// Sets the value of [page_token][crate::model::ListOperationsRequest::page_token].
549    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
550        self.page_token = v.into();
551        self
552    }
553}
554
555impl wkt::message::Message for ListOperationsRequest {
556    fn typename() -> &'static str {
557        "type.googleapis.com/google.longrunning.ListOperationsRequest"
558    }
559}
560
561#[doc(hidden)]
562impl<'de> serde::de::Deserialize<'de> for ListOperationsRequest {
563    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
564    where
565        D: serde::Deserializer<'de>,
566    {
567        #[allow(non_camel_case_types)]
568        #[doc(hidden)]
569        #[derive(PartialEq, Eq, Hash)]
570        enum __FieldTag {
571            __name,
572            __filter,
573            __page_size,
574            __page_token,
575            Unknown(std::string::String),
576        }
577        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
578            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
579            where
580                D: serde::Deserializer<'de>,
581            {
582                struct Visitor;
583                impl<'de> serde::de::Visitor<'de> for Visitor {
584                    type Value = __FieldTag;
585                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
586                        formatter.write_str("a field name for ListOperationsRequest")
587                    }
588                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
589                    where
590                        E: serde::de::Error,
591                    {
592                        use std::result::Result::Ok;
593                        use std::string::ToString;
594                        match value {
595                            "name" => Ok(__FieldTag::__name),
596                            "filter" => Ok(__FieldTag::__filter),
597                            "pageSize" => Ok(__FieldTag::__page_size),
598                            "page_size" => Ok(__FieldTag::__page_size),
599                            "pageToken" => Ok(__FieldTag::__page_token),
600                            "page_token" => Ok(__FieldTag::__page_token),
601                            _ => Ok(__FieldTag::Unknown(value.to_string())),
602                        }
603                    }
604                }
605                deserializer.deserialize_identifier(Visitor)
606            }
607        }
608        struct Visitor;
609        impl<'de> serde::de::Visitor<'de> for Visitor {
610            type Value = ListOperationsRequest;
611            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
612                formatter.write_str("struct ListOperationsRequest")
613            }
614            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
615            where
616                A: serde::de::MapAccess<'de>,
617            {
618                #[allow(unused_imports)]
619                use serde::de::Error;
620                use std::option::Option::Some;
621                let mut fields = std::collections::HashSet::new();
622                let mut result = Self::Value::new();
623                while let Some(tag) = map.next_key::<__FieldTag>()? {
624                    #[allow(clippy::match_single_binding)]
625                    match tag {
626                        __FieldTag::__name => {
627                            if !fields.insert(__FieldTag::__name) {
628                                return std::result::Result::Err(A::Error::duplicate_field(
629                                    "multiple values for name",
630                                ));
631                            }
632                            result.name = map
633                                .next_value::<std::option::Option<std::string::String>>()?
634                                .unwrap_or_default();
635                        }
636                        __FieldTag::__filter => {
637                            if !fields.insert(__FieldTag::__filter) {
638                                return std::result::Result::Err(A::Error::duplicate_field(
639                                    "multiple values for filter",
640                                ));
641                            }
642                            result.filter = map
643                                .next_value::<std::option::Option<std::string::String>>()?
644                                .unwrap_or_default();
645                        }
646                        __FieldTag::__page_size => {
647                            if !fields.insert(__FieldTag::__page_size) {
648                                return std::result::Result::Err(A::Error::duplicate_field(
649                                    "multiple values for page_size",
650                                ));
651                            }
652                            struct __With(std::option::Option<i32>);
653                            impl<'de> serde::de::Deserialize<'de> for __With {
654                                fn deserialize<D>(
655                                    deserializer: D,
656                                ) -> std::result::Result<Self, D::Error>
657                                where
658                                    D: serde::de::Deserializer<'de>,
659                                {
660                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
661                                }
662                            }
663                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
664                        }
665                        __FieldTag::__page_token => {
666                            if !fields.insert(__FieldTag::__page_token) {
667                                return std::result::Result::Err(A::Error::duplicate_field(
668                                    "multiple values for page_token",
669                                ));
670                            }
671                            result.page_token = map
672                                .next_value::<std::option::Option<std::string::String>>()?
673                                .unwrap_or_default();
674                        }
675                        __FieldTag::Unknown(key) => {
676                            let value = map.next_value::<serde_json::Value>()?;
677                            result._unknown_fields.insert(key, value);
678                        }
679                    }
680                }
681                std::result::Result::Ok(result)
682            }
683        }
684        deserializer.deserialize_any(Visitor)
685    }
686}
687
688#[doc(hidden)]
689impl serde::ser::Serialize for ListOperationsRequest {
690    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
691    where
692        S: serde::ser::Serializer,
693    {
694        use serde::ser::SerializeMap;
695        #[allow(unused_imports)]
696        use std::option::Option::Some;
697        let mut state = serializer.serialize_map(std::option::Option::None)?;
698        if !self.name.is_empty() {
699            state.serialize_entry("name", &self.name)?;
700        }
701        if !self.filter.is_empty() {
702            state.serialize_entry("filter", &self.filter)?;
703        }
704        if !wkt::internal::is_default(&self.page_size) {
705            struct __With<'a>(&'a i32);
706            impl<'a> serde::ser::Serialize for __With<'a> {
707                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
708                where
709                    S: serde::ser::Serializer,
710                {
711                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
712                }
713            }
714            state.serialize_entry("pageSize", &__With(&self.page_size))?;
715        }
716        if !self.page_token.is_empty() {
717            state.serialize_entry("pageToken", &self.page_token)?;
718        }
719        if !self._unknown_fields.is_empty() {
720            for (key, value) in self._unknown_fields.iter() {
721                state.serialize_entry(key, &value)?;
722            }
723        }
724        state.end()
725    }
726}
727
728/// The response message for
729/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
730///
731/// [google.longrunning.Operations.ListOperations]: crate::client::Operations::list_operations
732#[derive(Clone, Debug, Default, PartialEq)]
733#[non_exhaustive]
734pub struct ListOperationsResponse {
735    /// A list of operations that matches the specified filter in the request.
736    pub operations: std::vec::Vec<crate::model::Operation>,
737
738    /// The standard List next-page token.
739    pub next_page_token: std::string::String,
740
741    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
742}
743
744impl ListOperationsResponse {
745    pub fn new() -> Self {
746        std::default::Default::default()
747    }
748
749    /// Sets the value of [operations][crate::model::ListOperationsResponse::operations].
750    pub fn set_operations<T, V>(mut self, v: T) -> Self
751    where
752        T: std::iter::IntoIterator<Item = V>,
753        V: std::convert::Into<crate::model::Operation>,
754    {
755        use std::iter::Iterator;
756        self.operations = v.into_iter().map(|i| i.into()).collect();
757        self
758    }
759
760    /// Sets the value of [next_page_token][crate::model::ListOperationsResponse::next_page_token].
761    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
762        self.next_page_token = v.into();
763        self
764    }
765}
766
767impl wkt::message::Message for ListOperationsResponse {
768    fn typename() -> &'static str {
769        "type.googleapis.com/google.longrunning.ListOperationsResponse"
770    }
771}
772
773#[doc(hidden)]
774impl gax::paginator::internal::PageableResponse for ListOperationsResponse {
775    type PageItem = crate::model::Operation;
776
777    fn items(self) -> std::vec::Vec<Self::PageItem> {
778        self.operations
779    }
780
781    fn next_page_token(&self) -> std::string::String {
782        use std::clone::Clone;
783        self.next_page_token.clone()
784    }
785}
786
787#[doc(hidden)]
788impl<'de> serde::de::Deserialize<'de> for ListOperationsResponse {
789    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
790    where
791        D: serde::Deserializer<'de>,
792    {
793        #[allow(non_camel_case_types)]
794        #[doc(hidden)]
795        #[derive(PartialEq, Eq, Hash)]
796        enum __FieldTag {
797            __operations,
798            __next_page_token,
799            Unknown(std::string::String),
800        }
801        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
802            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
803            where
804                D: serde::Deserializer<'de>,
805            {
806                struct Visitor;
807                impl<'de> serde::de::Visitor<'de> for Visitor {
808                    type Value = __FieldTag;
809                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
810                        formatter.write_str("a field name for ListOperationsResponse")
811                    }
812                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
813                    where
814                        E: serde::de::Error,
815                    {
816                        use std::result::Result::Ok;
817                        use std::string::ToString;
818                        match value {
819                            "operations" => Ok(__FieldTag::__operations),
820                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
821                            "next_page_token" => Ok(__FieldTag::__next_page_token),
822                            _ => Ok(__FieldTag::Unknown(value.to_string())),
823                        }
824                    }
825                }
826                deserializer.deserialize_identifier(Visitor)
827            }
828        }
829        struct Visitor;
830        impl<'de> serde::de::Visitor<'de> for Visitor {
831            type Value = ListOperationsResponse;
832            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
833                formatter.write_str("struct ListOperationsResponse")
834            }
835            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
836            where
837                A: serde::de::MapAccess<'de>,
838            {
839                #[allow(unused_imports)]
840                use serde::de::Error;
841                use std::option::Option::Some;
842                let mut fields = std::collections::HashSet::new();
843                let mut result = Self::Value::new();
844                while let Some(tag) = map.next_key::<__FieldTag>()? {
845                    #[allow(clippy::match_single_binding)]
846                    match tag {
847                        __FieldTag::__operations => {
848                            if !fields.insert(__FieldTag::__operations) {
849                                return std::result::Result::Err(A::Error::duplicate_field(
850                                    "multiple values for operations",
851                                ));
852                            }
853                            result.operations = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Operation>>>()?.unwrap_or_default();
854                        }
855                        __FieldTag::__next_page_token => {
856                            if !fields.insert(__FieldTag::__next_page_token) {
857                                return std::result::Result::Err(A::Error::duplicate_field(
858                                    "multiple values for next_page_token",
859                                ));
860                            }
861                            result.next_page_token = map
862                                .next_value::<std::option::Option<std::string::String>>()?
863                                .unwrap_or_default();
864                        }
865                        __FieldTag::Unknown(key) => {
866                            let value = map.next_value::<serde_json::Value>()?;
867                            result._unknown_fields.insert(key, value);
868                        }
869                    }
870                }
871                std::result::Result::Ok(result)
872            }
873        }
874        deserializer.deserialize_any(Visitor)
875    }
876}
877
878#[doc(hidden)]
879impl serde::ser::Serialize for ListOperationsResponse {
880    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
881    where
882        S: serde::ser::Serializer,
883    {
884        use serde::ser::SerializeMap;
885        #[allow(unused_imports)]
886        use std::option::Option::Some;
887        let mut state = serializer.serialize_map(std::option::Option::None)?;
888        if !self.operations.is_empty() {
889            state.serialize_entry("operations", &self.operations)?;
890        }
891        if !self.next_page_token.is_empty() {
892            state.serialize_entry("nextPageToken", &self.next_page_token)?;
893        }
894        if !self._unknown_fields.is_empty() {
895            for (key, value) in self._unknown_fields.iter() {
896                state.serialize_entry(key, &value)?;
897            }
898        }
899        state.end()
900    }
901}
902
903/// The request message for
904/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
905///
906/// [google.longrunning.Operations.CancelOperation]: crate::client::Operations::cancel_operation
907#[derive(Clone, Debug, Default, PartialEq)]
908#[non_exhaustive]
909pub struct CancelOperationRequest {
910    /// The name of the operation resource to be cancelled.
911    pub name: std::string::String,
912
913    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
914}
915
916impl CancelOperationRequest {
917    pub fn new() -> Self {
918        std::default::Default::default()
919    }
920
921    /// Sets the value of [name][crate::model::CancelOperationRequest::name].
922    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
923        self.name = v.into();
924        self
925    }
926}
927
928impl wkt::message::Message for CancelOperationRequest {
929    fn typename() -> &'static str {
930        "type.googleapis.com/google.longrunning.CancelOperationRequest"
931    }
932}
933
934#[doc(hidden)]
935impl<'de> serde::de::Deserialize<'de> for CancelOperationRequest {
936    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
937    where
938        D: serde::Deserializer<'de>,
939    {
940        #[allow(non_camel_case_types)]
941        #[doc(hidden)]
942        #[derive(PartialEq, Eq, Hash)]
943        enum __FieldTag {
944            __name,
945            Unknown(std::string::String),
946        }
947        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
948            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
949            where
950                D: serde::Deserializer<'de>,
951            {
952                struct Visitor;
953                impl<'de> serde::de::Visitor<'de> for Visitor {
954                    type Value = __FieldTag;
955                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
956                        formatter.write_str("a field name for CancelOperationRequest")
957                    }
958                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
959                    where
960                        E: serde::de::Error,
961                    {
962                        use std::result::Result::Ok;
963                        use std::string::ToString;
964                        match value {
965                            "name" => Ok(__FieldTag::__name),
966                            _ => Ok(__FieldTag::Unknown(value.to_string())),
967                        }
968                    }
969                }
970                deserializer.deserialize_identifier(Visitor)
971            }
972        }
973        struct Visitor;
974        impl<'de> serde::de::Visitor<'de> for Visitor {
975            type Value = CancelOperationRequest;
976            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
977                formatter.write_str("struct CancelOperationRequest")
978            }
979            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
980            where
981                A: serde::de::MapAccess<'de>,
982            {
983                #[allow(unused_imports)]
984                use serde::de::Error;
985                use std::option::Option::Some;
986                let mut fields = std::collections::HashSet::new();
987                let mut result = Self::Value::new();
988                while let Some(tag) = map.next_key::<__FieldTag>()? {
989                    #[allow(clippy::match_single_binding)]
990                    match tag {
991                        __FieldTag::__name => {
992                            if !fields.insert(__FieldTag::__name) {
993                                return std::result::Result::Err(A::Error::duplicate_field(
994                                    "multiple values for name",
995                                ));
996                            }
997                            result.name = map
998                                .next_value::<std::option::Option<std::string::String>>()?
999                                .unwrap_or_default();
1000                        }
1001                        __FieldTag::Unknown(key) => {
1002                            let value = map.next_value::<serde_json::Value>()?;
1003                            result._unknown_fields.insert(key, value);
1004                        }
1005                    }
1006                }
1007                std::result::Result::Ok(result)
1008            }
1009        }
1010        deserializer.deserialize_any(Visitor)
1011    }
1012}
1013
1014#[doc(hidden)]
1015impl serde::ser::Serialize for CancelOperationRequest {
1016    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1017    where
1018        S: serde::ser::Serializer,
1019    {
1020        use serde::ser::SerializeMap;
1021        #[allow(unused_imports)]
1022        use std::option::Option::Some;
1023        let mut state = serializer.serialize_map(std::option::Option::None)?;
1024        if !self.name.is_empty() {
1025            state.serialize_entry("name", &self.name)?;
1026        }
1027        if !self._unknown_fields.is_empty() {
1028            for (key, value) in self._unknown_fields.iter() {
1029                state.serialize_entry(key, &value)?;
1030            }
1031        }
1032        state.end()
1033    }
1034}
1035
1036/// The request message for
1037/// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
1038///
1039/// [google.longrunning.Operations.DeleteOperation]: crate::client::Operations::delete_operation
1040#[derive(Clone, Debug, Default, PartialEq)]
1041#[non_exhaustive]
1042pub struct DeleteOperationRequest {
1043    /// The name of the operation resource to be deleted.
1044    pub name: std::string::String,
1045
1046    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1047}
1048
1049impl DeleteOperationRequest {
1050    pub fn new() -> Self {
1051        std::default::Default::default()
1052    }
1053
1054    /// Sets the value of [name][crate::model::DeleteOperationRequest::name].
1055    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1056        self.name = v.into();
1057        self
1058    }
1059}
1060
1061impl wkt::message::Message for DeleteOperationRequest {
1062    fn typename() -> &'static str {
1063        "type.googleapis.com/google.longrunning.DeleteOperationRequest"
1064    }
1065}
1066
1067#[doc(hidden)]
1068impl<'de> serde::de::Deserialize<'de> for DeleteOperationRequest {
1069    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1070    where
1071        D: serde::Deserializer<'de>,
1072    {
1073        #[allow(non_camel_case_types)]
1074        #[doc(hidden)]
1075        #[derive(PartialEq, Eq, Hash)]
1076        enum __FieldTag {
1077            __name,
1078            Unknown(std::string::String),
1079        }
1080        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1081            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1082            where
1083                D: serde::Deserializer<'de>,
1084            {
1085                struct Visitor;
1086                impl<'de> serde::de::Visitor<'de> for Visitor {
1087                    type Value = __FieldTag;
1088                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1089                        formatter.write_str("a field name for DeleteOperationRequest")
1090                    }
1091                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1092                    where
1093                        E: serde::de::Error,
1094                    {
1095                        use std::result::Result::Ok;
1096                        use std::string::ToString;
1097                        match value {
1098                            "name" => Ok(__FieldTag::__name),
1099                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1100                        }
1101                    }
1102                }
1103                deserializer.deserialize_identifier(Visitor)
1104            }
1105        }
1106        struct Visitor;
1107        impl<'de> serde::de::Visitor<'de> for Visitor {
1108            type Value = DeleteOperationRequest;
1109            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1110                formatter.write_str("struct DeleteOperationRequest")
1111            }
1112            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1113            where
1114                A: serde::de::MapAccess<'de>,
1115            {
1116                #[allow(unused_imports)]
1117                use serde::de::Error;
1118                use std::option::Option::Some;
1119                let mut fields = std::collections::HashSet::new();
1120                let mut result = Self::Value::new();
1121                while let Some(tag) = map.next_key::<__FieldTag>()? {
1122                    #[allow(clippy::match_single_binding)]
1123                    match tag {
1124                        __FieldTag::__name => {
1125                            if !fields.insert(__FieldTag::__name) {
1126                                return std::result::Result::Err(A::Error::duplicate_field(
1127                                    "multiple values for name",
1128                                ));
1129                            }
1130                            result.name = map
1131                                .next_value::<std::option::Option<std::string::String>>()?
1132                                .unwrap_or_default();
1133                        }
1134                        __FieldTag::Unknown(key) => {
1135                            let value = map.next_value::<serde_json::Value>()?;
1136                            result._unknown_fields.insert(key, value);
1137                        }
1138                    }
1139                }
1140                std::result::Result::Ok(result)
1141            }
1142        }
1143        deserializer.deserialize_any(Visitor)
1144    }
1145}
1146
1147#[doc(hidden)]
1148impl serde::ser::Serialize for DeleteOperationRequest {
1149    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1150    where
1151        S: serde::ser::Serializer,
1152    {
1153        use serde::ser::SerializeMap;
1154        #[allow(unused_imports)]
1155        use std::option::Option::Some;
1156        let mut state = serializer.serialize_map(std::option::Option::None)?;
1157        if !self.name.is_empty() {
1158            state.serialize_entry("name", &self.name)?;
1159        }
1160        if !self._unknown_fields.is_empty() {
1161            for (key, value) in self._unknown_fields.iter() {
1162                state.serialize_entry(key, &value)?;
1163            }
1164        }
1165        state.end()
1166    }
1167}
1168
1169/// The request message for
1170/// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
1171#[derive(Clone, Debug, Default, PartialEq)]
1172#[non_exhaustive]
1173pub struct WaitOperationRequest {
1174    /// The name of the operation resource to wait on.
1175    pub name: std::string::String,
1176
1177    /// The maximum duration to wait before timing out. If left blank, the wait
1178    /// will be at most the time permitted by the underlying HTTP/RPC protocol.
1179    /// If RPC context deadline is also specified, the shorter one will be used.
1180    pub timeout: std::option::Option<wkt::Duration>,
1181
1182    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1183}
1184
1185impl WaitOperationRequest {
1186    pub fn new() -> Self {
1187        std::default::Default::default()
1188    }
1189
1190    /// Sets the value of [name][crate::model::WaitOperationRequest::name].
1191    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1192        self.name = v.into();
1193        self
1194    }
1195
1196    /// Sets the value of [timeout][crate::model::WaitOperationRequest::timeout].
1197    pub fn set_timeout<T>(mut self, v: T) -> Self
1198    where
1199        T: std::convert::Into<wkt::Duration>,
1200    {
1201        self.timeout = std::option::Option::Some(v.into());
1202        self
1203    }
1204
1205    /// Sets or clears the value of [timeout][crate::model::WaitOperationRequest::timeout].
1206    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1207    where
1208        T: std::convert::Into<wkt::Duration>,
1209    {
1210        self.timeout = v.map(|x| x.into());
1211        self
1212    }
1213}
1214
1215impl wkt::message::Message for WaitOperationRequest {
1216    fn typename() -> &'static str {
1217        "type.googleapis.com/google.longrunning.WaitOperationRequest"
1218    }
1219}
1220
1221#[doc(hidden)]
1222impl<'de> serde::de::Deserialize<'de> for WaitOperationRequest {
1223    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1224    where
1225        D: serde::Deserializer<'de>,
1226    {
1227        #[allow(non_camel_case_types)]
1228        #[doc(hidden)]
1229        #[derive(PartialEq, Eq, Hash)]
1230        enum __FieldTag {
1231            __name,
1232            __timeout,
1233            Unknown(std::string::String),
1234        }
1235        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1236            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1237            where
1238                D: serde::Deserializer<'de>,
1239            {
1240                struct Visitor;
1241                impl<'de> serde::de::Visitor<'de> for Visitor {
1242                    type Value = __FieldTag;
1243                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1244                        formatter.write_str("a field name for WaitOperationRequest")
1245                    }
1246                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1247                    where
1248                        E: serde::de::Error,
1249                    {
1250                        use std::result::Result::Ok;
1251                        use std::string::ToString;
1252                        match value {
1253                            "name" => Ok(__FieldTag::__name),
1254                            "timeout" => Ok(__FieldTag::__timeout),
1255                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1256                        }
1257                    }
1258                }
1259                deserializer.deserialize_identifier(Visitor)
1260            }
1261        }
1262        struct Visitor;
1263        impl<'de> serde::de::Visitor<'de> for Visitor {
1264            type Value = WaitOperationRequest;
1265            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1266                formatter.write_str("struct WaitOperationRequest")
1267            }
1268            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1269            where
1270                A: serde::de::MapAccess<'de>,
1271            {
1272                #[allow(unused_imports)]
1273                use serde::de::Error;
1274                use std::option::Option::Some;
1275                let mut fields = std::collections::HashSet::new();
1276                let mut result = Self::Value::new();
1277                while let Some(tag) = map.next_key::<__FieldTag>()? {
1278                    #[allow(clippy::match_single_binding)]
1279                    match tag {
1280                        __FieldTag::__name => {
1281                            if !fields.insert(__FieldTag::__name) {
1282                                return std::result::Result::Err(A::Error::duplicate_field(
1283                                    "multiple values for name",
1284                                ));
1285                            }
1286                            result.name = map
1287                                .next_value::<std::option::Option<std::string::String>>()?
1288                                .unwrap_or_default();
1289                        }
1290                        __FieldTag::__timeout => {
1291                            if !fields.insert(__FieldTag::__timeout) {
1292                                return std::result::Result::Err(A::Error::duplicate_field(
1293                                    "multiple values for timeout",
1294                                ));
1295                            }
1296                            result.timeout =
1297                                map.next_value::<std::option::Option<wkt::Duration>>()?;
1298                        }
1299                        __FieldTag::Unknown(key) => {
1300                            let value = map.next_value::<serde_json::Value>()?;
1301                            result._unknown_fields.insert(key, value);
1302                        }
1303                    }
1304                }
1305                std::result::Result::Ok(result)
1306            }
1307        }
1308        deserializer.deserialize_any(Visitor)
1309    }
1310}
1311
1312#[doc(hidden)]
1313impl serde::ser::Serialize for WaitOperationRequest {
1314    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1315    where
1316        S: serde::ser::Serializer,
1317    {
1318        use serde::ser::SerializeMap;
1319        #[allow(unused_imports)]
1320        use std::option::Option::Some;
1321        let mut state = serializer.serialize_map(std::option::Option::None)?;
1322        if !self.name.is_empty() {
1323            state.serialize_entry("name", &self.name)?;
1324        }
1325        if self.timeout.is_some() {
1326            state.serialize_entry("timeout", &self.timeout)?;
1327        }
1328        if !self._unknown_fields.is_empty() {
1329            for (key, value) in self._unknown_fields.iter() {
1330                state.serialize_entry(key, &value)?;
1331            }
1332        }
1333        state.end()
1334    }
1335}
1336
1337/// A message representing the message types used by a long-running operation.
1338///
1339/// Example:
1340///
1341/// ```norust
1342/// rpc Export(ExportRequest) returns (google.longrunning.Operation) {
1343///   option (google.longrunning.operation_info) = {
1344///     response_type: "ExportResponse"
1345///     metadata_type: "ExportMetadata"
1346///   };
1347/// }
1348/// ```
1349#[derive(Clone, Debug, Default, PartialEq)]
1350#[non_exhaustive]
1351pub struct OperationInfo {
1352    /// Required. The message name of the primary return type for this
1353    /// long-running operation.
1354    /// This type will be used to deserialize the LRO's response.
1355    ///
1356    /// If the response is in a different package from the rpc, a fully-qualified
1357    /// message name must be used (e.g. `google.protobuf.Struct`).
1358    ///
1359    /// Note: Altering this value constitutes a breaking change.
1360    pub response_type: std::string::String,
1361
1362    /// Required. The message name of the metadata type for this long-running
1363    /// operation.
1364    ///
1365    /// If the response is in a different package from the rpc, a fully-qualified
1366    /// message name must be used (e.g. `google.protobuf.Struct`).
1367    ///
1368    /// Note: Altering this value constitutes a breaking change.
1369    pub metadata_type: std::string::String,
1370
1371    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1372}
1373
1374impl OperationInfo {
1375    pub fn new() -> Self {
1376        std::default::Default::default()
1377    }
1378
1379    /// Sets the value of [response_type][crate::model::OperationInfo::response_type].
1380    pub fn set_response_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1381        self.response_type = v.into();
1382        self
1383    }
1384
1385    /// Sets the value of [metadata_type][crate::model::OperationInfo::metadata_type].
1386    pub fn set_metadata_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1387        self.metadata_type = v.into();
1388        self
1389    }
1390}
1391
1392impl wkt::message::Message for OperationInfo {
1393    fn typename() -> &'static str {
1394        "type.googleapis.com/google.longrunning.OperationInfo"
1395    }
1396}
1397
1398#[doc(hidden)]
1399impl<'de> serde::de::Deserialize<'de> for OperationInfo {
1400    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1401    where
1402        D: serde::Deserializer<'de>,
1403    {
1404        #[allow(non_camel_case_types)]
1405        #[doc(hidden)]
1406        #[derive(PartialEq, Eq, Hash)]
1407        enum __FieldTag {
1408            __response_type,
1409            __metadata_type,
1410            Unknown(std::string::String),
1411        }
1412        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1413            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1414            where
1415                D: serde::Deserializer<'de>,
1416            {
1417                struct Visitor;
1418                impl<'de> serde::de::Visitor<'de> for Visitor {
1419                    type Value = __FieldTag;
1420                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1421                        formatter.write_str("a field name for OperationInfo")
1422                    }
1423                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1424                    where
1425                        E: serde::de::Error,
1426                    {
1427                        use std::result::Result::Ok;
1428                        use std::string::ToString;
1429                        match value {
1430                            "responseType" => Ok(__FieldTag::__response_type),
1431                            "response_type" => Ok(__FieldTag::__response_type),
1432                            "metadataType" => Ok(__FieldTag::__metadata_type),
1433                            "metadata_type" => Ok(__FieldTag::__metadata_type),
1434                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1435                        }
1436                    }
1437                }
1438                deserializer.deserialize_identifier(Visitor)
1439            }
1440        }
1441        struct Visitor;
1442        impl<'de> serde::de::Visitor<'de> for Visitor {
1443            type Value = OperationInfo;
1444            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1445                formatter.write_str("struct OperationInfo")
1446            }
1447            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1448            where
1449                A: serde::de::MapAccess<'de>,
1450            {
1451                #[allow(unused_imports)]
1452                use serde::de::Error;
1453                use std::option::Option::Some;
1454                let mut fields = std::collections::HashSet::new();
1455                let mut result = Self::Value::new();
1456                while let Some(tag) = map.next_key::<__FieldTag>()? {
1457                    #[allow(clippy::match_single_binding)]
1458                    match tag {
1459                        __FieldTag::__response_type => {
1460                            if !fields.insert(__FieldTag::__response_type) {
1461                                return std::result::Result::Err(A::Error::duplicate_field(
1462                                    "multiple values for response_type",
1463                                ));
1464                            }
1465                            result.response_type = map
1466                                .next_value::<std::option::Option<std::string::String>>()?
1467                                .unwrap_or_default();
1468                        }
1469                        __FieldTag::__metadata_type => {
1470                            if !fields.insert(__FieldTag::__metadata_type) {
1471                                return std::result::Result::Err(A::Error::duplicate_field(
1472                                    "multiple values for metadata_type",
1473                                ));
1474                            }
1475                            result.metadata_type = map
1476                                .next_value::<std::option::Option<std::string::String>>()?
1477                                .unwrap_or_default();
1478                        }
1479                        __FieldTag::Unknown(key) => {
1480                            let value = map.next_value::<serde_json::Value>()?;
1481                            result._unknown_fields.insert(key, value);
1482                        }
1483                    }
1484                }
1485                std::result::Result::Ok(result)
1486            }
1487        }
1488        deserializer.deserialize_any(Visitor)
1489    }
1490}
1491
1492#[doc(hidden)]
1493impl serde::ser::Serialize for OperationInfo {
1494    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1495    where
1496        S: serde::ser::Serializer,
1497    {
1498        use serde::ser::SerializeMap;
1499        #[allow(unused_imports)]
1500        use std::option::Option::Some;
1501        let mut state = serializer.serialize_map(std::option::Option::None)?;
1502        if !self.response_type.is_empty() {
1503            state.serialize_entry("responseType", &self.response_type)?;
1504        }
1505        if !self.metadata_type.is_empty() {
1506            state.serialize_entry("metadataType", &self.metadata_type)?;
1507        }
1508        if !self._unknown_fields.is_empty() {
1509            for (key, value) in self._unknown_fields.iter() {
1510                state.serialize_entry(key, &value)?;
1511            }
1512        }
1513        state.end()
1514    }
1515}