google-cloud-longrunning 1.9.0

Google Cloud Client Libraries for Rust - Long Running Operations API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// This resource represents a long-running operation that is the result of a
/// network API call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Operation {
    /// The server-assigned name, which is only unique within the same service that
    /// originally returns it. If you use the default HTTP mapping, the
    /// `name` should be a resource name ending with `operations/{unique_id}`.
    pub name: std::string::String,

    /// Service-specific metadata associated with the operation.  It typically
    /// contains progress information and common metadata such as create time.
    /// Some services might not provide such metadata.  Any method that returns a
    /// long-running operation should document the metadata type, if any.
    pub metadata: std::option::Option<wkt::Any>,

    /// If the value is `false`, it means the operation is still in progress.
    /// If `true`, the operation is completed, and either `error` or `response` is
    /// available.
    pub done: bool,

    /// The operation result, which can be either an `error` or a valid `response`.
    /// If `done` == `false`, neither `error` nor `response` is set.
    /// If `done` == `true`, exactly one of `error` or `response` can be set.
    /// Some services might not provide the result.
    pub result: std::option::Option<crate::model::operation::Result>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Operation {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Operation::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// let x = Operation::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [metadata][crate::model::Operation::metadata].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// use wkt::Any;
    /// let x = Operation::new().set_metadata(Any::default()/* use setters */);
    /// ```
    pub fn set_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Any>,
    {
        self.metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata][crate::model::Operation::metadata].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// use wkt::Any;
    /// let x = Operation::new().set_or_clear_metadata(Some(Any::default()/* use setters */));
    /// let x = Operation::new().set_or_clear_metadata(None::<Any>);
    /// ```
    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Any>,
    {
        self.metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [done][crate::model::Operation::done].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// let x = Operation::new().set_done(true);
    /// ```
    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.done = v.into();
        self
    }

    /// Sets the value of [result][crate::model::Operation::result].
    ///
    /// Note that all the setters affecting `result` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// use google_cloud_rpc::model::Status;
    /// let x = Operation::new().set_result(Some(
    ///     google_cloud_longrunning::model::operation::Result::Error(Status::default().into())));
    /// ```
    pub fn set_result<
        T: std::convert::Into<std::option::Option<crate::model::operation::Result>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.result = v.into();
        self
    }

    /// The value of [result][crate::model::Operation::result]
    /// if it holds a `Error`, `None` if the field is not set or
    /// holds a different branch.
    pub fn error(&self) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>> {
        #[allow(unreachable_patterns)]
        self.result.as_ref().and_then(|v| match v {
            crate::model::operation::Result::Error(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [result][crate::model::Operation::result]
    /// to hold a `Error`.
    ///
    /// Note that all the setters affecting `result` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// use google_cloud_rpc::model::Status;
    /// let x = Operation::new().set_error(Status::default()/* use setters */);
    /// assert!(x.error().is_some());
    /// assert!(x.response().is_none());
    /// ```
    pub fn set_error<T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>>(
        mut self,
        v: T,
    ) -> Self {
        self.result = std::option::Option::Some(crate::model::operation::Result::Error(v.into()));
        self
    }

    /// The value of [result][crate::model::Operation::result]
    /// if it holds a `Response`, `None` if the field is not set or
    /// holds a different branch.
    pub fn response(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
        #[allow(unreachable_patterns)]
        self.result.as_ref().and_then(|v| match v {
            crate::model::operation::Result::Response(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [result][crate::model::Operation::result]
    /// to hold a `Response`.
    ///
    /// Note that all the setters affecting `result` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::Operation;
    /// use wkt::Any;
    /// let x = Operation::new().set_response(Any::default()/* use setters */);
    /// assert!(x.response().is_some());
    /// assert!(x.error().is_none());
    /// ```
    pub fn set_response<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(mut self, v: T) -> Self {
        self.result =
            std::option::Option::Some(crate::model::operation::Result::Response(v.into()));
        self
    }
}

impl wkt::message::Message for Operation {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.Operation"
    }
}

/// Defines additional types related to [Operation].
pub mod operation {
    #[allow(unused_imports)]
    use super::*;

    /// The operation result, which can be either an `error` or a valid `response`.
    /// If `done` == `false`, neither `error` nor `response` is set.
    /// If `done` == `true`, exactly one of `error` or `response` can be set.
    /// Some services might not provide the result.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Result {
        /// The error result of the operation in case of failure or cancellation.
        Error(std::boxed::Box<google_cloud_rpc::model::Status>),
        /// The normal, successful response of the operation.  If the original
        /// method returns no data on success, such as `Delete`, the response is
        /// `google.protobuf.Empty`.  If the original method is standard
        /// `Get`/`Create`/`Update`, the response should be the resource.  For other
        /// methods, the response should have the type `XxxResponse`, where `Xxx`
        /// is the original method name.  For example, if the original method name
        /// is `TakeSnapshot()`, the inferred response type is
        /// `TakeSnapshotResponse`.
        Response(std::boxed::Box<wkt::Any>),
    }
}

/// The request message for
/// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
///
/// [google.longrunning.Operations.GetOperation]: google-cloud-longrunning::client::Operations::get_operation
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetOperationRequest {
    /// The name of the operation resource.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetOperationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetOperationRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::GetOperationRequest;
    /// let x = GetOperationRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetOperationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.GetOperationRequest"
    }
}

/// The request message for
/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
///
/// [google.longrunning.Operations.ListOperations]: google-cloud-longrunning::client::Operations::list_operations
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOperationsRequest {
    /// The name of the operation's parent resource.
    pub name: std::string::String,

    /// The standard list filter.
    pub filter: std::string::String,

    /// The standard list page size.
    pub page_size: i32,

    /// The standard list page token.
    pub page_token: std::string::String,

    /// When set to `true`, operations that are reachable are returned as normal,
    /// and those that are unreachable are returned in the
    /// [ListOperationsResponse.unreachable] field.
    ///
    /// This can only be `true` when reading across collections e.g. when `parent`
    /// is set to `"projects/example/locations/-"`.
    ///
    /// This field is not by default supported and will result in an
    /// `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
    /// service or product specific documentation.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListOperationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ListOperationsRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsRequest;
    /// let x = ListOperationsRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListOperationsRequest::filter].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsRequest;
    /// let x = ListOperationsRequest::new().set_filter("example");
    /// ```
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListOperationsRequest::page_size].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsRequest;
    /// let x = ListOperationsRequest::new().set_page_size(42);
    /// ```
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListOperationsRequest::page_token].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsRequest;
    /// let x = ListOperationsRequest::new().set_page_token("example");
    /// ```
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListOperationsRequest::return_partial_success].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsRequest;
    /// let x = ListOperationsRequest::new().set_return_partial_success(true);
    /// ```
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListOperationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.ListOperationsRequest"
    }
}

/// The response message for
/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
///
/// [google.longrunning.Operations.ListOperations]: google-cloud-longrunning::client::Operations::list_operations
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOperationsResponse {
    /// A list of operations that matches the specified filter in the request.
    pub operations: std::vec::Vec<crate::model::Operation>,

    /// The standard List next-page token.
    pub next_page_token: std::string::String,

    /// Unordered list. Unreachable resources. Populated when the request sets
    /// `ListOperationsRequest.return_partial_success` and reads across
    /// collections e.g. when attempting to list all resources across all supported
    /// locations.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListOperationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operations][crate::model::ListOperationsResponse::operations].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsResponse;
    /// use google_cloud_longrunning::model::Operation;
    /// let x = ListOperationsResponse::new()
    ///     .set_operations([
    ///         Operation::default()/* use setters */,
    ///         Operation::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_operations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Operation>,
    {
        use std::iter::Iterator;
        self.operations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListOperationsResponse::next_page_token].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsResponse;
    /// let x = ListOperationsResponse::new().set_next_page_token("example");
    /// ```
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListOperationsResponse::unreachable].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::ListOperationsResponse;
    /// let x = ListOperationsResponse::new().set_unreachable(["a", "b", "c"]);
    /// ```
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListOperationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.ListOperationsResponse"
    }
}

#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListOperationsResponse {
    type PageItem = crate::model::Operation;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.operations
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request message for
/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
///
/// [google.longrunning.Operations.CancelOperation]: google-cloud-longrunning::client::Operations::cancel_operation
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CancelOperationRequest {
    /// The name of the operation resource to be cancelled.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CancelOperationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::CancelOperationRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::CancelOperationRequest;
    /// let x = CancelOperationRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for CancelOperationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.CancelOperationRequest"
    }
}

/// The request message for
/// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
///
/// [google.longrunning.Operations.DeleteOperation]: google-cloud-longrunning::client::Operations::delete_operation
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteOperationRequest {
    /// The name of the operation resource to be deleted.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteOperationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteOperationRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::DeleteOperationRequest;
    /// let x = DeleteOperationRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteOperationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.DeleteOperationRequest"
    }
}

/// The request message for
/// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WaitOperationRequest {
    /// The name of the operation resource to wait on.
    pub name: std::string::String,

    /// The maximum duration to wait before timing out. If left blank, the wait
    /// will be at most the time permitted by the underlying HTTP/RPC protocol.
    /// If RPC context deadline is also specified, the shorter one will be used.
    pub timeout: std::option::Option<wkt::Duration>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl WaitOperationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::WaitOperationRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::WaitOperationRequest;
    /// let x = WaitOperationRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [timeout][crate::model::WaitOperationRequest::timeout].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::WaitOperationRequest;
    /// use wkt::Duration;
    /// let x = WaitOperationRequest::new().set_timeout(Duration::default()/* use setters */);
    /// ```
    pub fn set_timeout<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.timeout = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [timeout][crate::model::WaitOperationRequest::timeout].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::WaitOperationRequest;
    /// use wkt::Duration;
    /// let x = WaitOperationRequest::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
    /// let x = WaitOperationRequest::new().set_or_clear_timeout(None::<Duration>);
    /// ```
    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.timeout = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for WaitOperationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.WaitOperationRequest"
    }
}

/// A message representing the message types used by a long-running operation.
///
/// Example:
///
/// ```norust
/// rpc Export(ExportRequest) returns (google.longrunning.Operation) {
///   option (google.longrunning.operation_info) = {
///     response_type: "ExportResponse"
///     metadata_type: "ExportMetadata"
///   };
/// }
/// ```
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationInfo {
    /// Required. The message name of the primary return type for this
    /// long-running operation.
    /// This type will be used to deserialize the LRO's response.
    ///
    /// If the response is in a different package from the rpc, a fully-qualified
    /// message name must be used (e.g. `google.protobuf.Struct`).
    ///
    /// Note: Altering this value constitutes a breaking change.
    pub response_type: std::string::String,

    /// Required. The message name of the metadata type for this long-running
    /// operation.
    ///
    /// If the response is in a different package from the rpc, a fully-qualified
    /// message name must be used (e.g. `google.protobuf.Struct`).
    ///
    /// Note: Altering this value constitutes a breaking change.
    pub metadata_type: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [response_type][crate::model::OperationInfo::response_type].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::OperationInfo;
    /// let x = OperationInfo::new().set_response_type("example");
    /// ```
    pub fn set_response_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.response_type = v.into();
        self
    }

    /// Sets the value of [metadata_type][crate::model::OperationInfo::metadata_type].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_longrunning::model::OperationInfo;
    /// let x = OperationInfo::new().set_metadata_type("example");
    /// ```
    pub fn set_metadata_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.metadata_type = v.into();
        self
    }
}

impl wkt::message::Message for OperationInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.longrunning.OperationInfo"
    }
}