google_cloud_longrunning/
model.rs1#![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
34mod debug;
35mod deserialize;
36mod serialize;
37
38#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Operation {
43 pub name: std::string::String,
47
48 pub metadata: std::option::Option<wkt::Any>,
53
54 pub done: bool,
58
59 pub result: std::option::Option<crate::model::operation::Result>,
64
65 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl Operation {
69 pub fn new() -> Self {
70 std::default::Default::default()
71 }
72
73 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
75 self.name = v.into();
76 self
77 }
78
79 pub fn set_metadata<T>(mut self, v: T) -> Self
81 where
82 T: std::convert::Into<wkt::Any>,
83 {
84 self.metadata = std::option::Option::Some(v.into());
85 self
86 }
87
88 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
90 where
91 T: std::convert::Into<wkt::Any>,
92 {
93 self.metadata = v.map(|x| x.into());
94 self
95 }
96
97 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
99 self.done = v.into();
100 self
101 }
102
103 pub fn set_result<
108 T: std::convert::Into<std::option::Option<crate::model::operation::Result>>,
109 >(
110 mut self,
111 v: T,
112 ) -> Self {
113 self.result = v.into();
114 self
115 }
116
117 pub fn error(&self) -> std::option::Option<&std::boxed::Box<rpc::model::Status>> {
121 #[allow(unreachable_patterns)]
122 self.result.as_ref().and_then(|v| match v {
123 crate::model::operation::Result::Error(v) => std::option::Option::Some(v),
124 _ => std::option::Option::None,
125 })
126 }
127
128 pub fn set_error<T: std::convert::Into<std::boxed::Box<rpc::model::Status>>>(
134 mut self,
135 v: T,
136 ) -> Self {
137 self.result = std::option::Option::Some(crate::model::operation::Result::Error(v.into()));
138 self
139 }
140
141 pub fn response(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
145 #[allow(unreachable_patterns)]
146 self.result.as_ref().and_then(|v| match v {
147 crate::model::operation::Result::Response(v) => std::option::Option::Some(v),
148 _ => std::option::Option::None,
149 })
150 }
151
152 pub fn set_response<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(mut self, v: T) -> Self {
158 self.result =
159 std::option::Option::Some(crate::model::operation::Result::Response(v.into()));
160 self
161 }
162}
163
164impl wkt::message::Message for Operation {
165 fn typename() -> &'static str {
166 "type.googleapis.com/google.longrunning.Operation"
167 }
168}
169
170pub mod operation {
172 #[allow(unused_imports)]
173 use super::*;
174
175 #[derive(Clone, Debug, PartialEq)]
180 #[non_exhaustive]
181 pub enum Result {
182 Error(std::boxed::Box<rpc::model::Status>),
184 Response(std::boxed::Box<wkt::Any>),
193 }
194}
195
196#[derive(Clone, Default, PartialEq)]
201#[non_exhaustive]
202pub struct GetOperationRequest {
203 pub name: std::string::String,
205
206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
207}
208
209impl GetOperationRequest {
210 pub fn new() -> Self {
211 std::default::Default::default()
212 }
213
214 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
216 self.name = v.into();
217 self
218 }
219}
220
221impl wkt::message::Message for GetOperationRequest {
222 fn typename() -> &'static str {
223 "type.googleapis.com/google.longrunning.GetOperationRequest"
224 }
225}
226
227#[derive(Clone, Default, PartialEq)]
232#[non_exhaustive]
233pub struct ListOperationsRequest {
234 pub name: std::string::String,
236
237 pub filter: std::string::String,
239
240 pub page_size: i32,
242
243 pub page_token: std::string::String,
245
246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
247}
248
249impl ListOperationsRequest {
250 pub fn new() -> Self {
251 std::default::Default::default()
252 }
253
254 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
256 self.name = v.into();
257 self
258 }
259
260 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
262 self.filter = v.into();
263 self
264 }
265
266 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
268 self.page_size = v.into();
269 self
270 }
271
272 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
274 self.page_token = v.into();
275 self
276 }
277}
278
279impl wkt::message::Message for ListOperationsRequest {
280 fn typename() -> &'static str {
281 "type.googleapis.com/google.longrunning.ListOperationsRequest"
282 }
283}
284
285#[derive(Clone, Default, PartialEq)]
290#[non_exhaustive]
291pub struct ListOperationsResponse {
292 pub operations: std::vec::Vec<crate::model::Operation>,
294
295 pub next_page_token: std::string::String,
297
298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
299}
300
301impl ListOperationsResponse {
302 pub fn new() -> Self {
303 std::default::Default::default()
304 }
305
306 pub fn set_operations<T, V>(mut self, v: T) -> Self
308 where
309 T: std::iter::IntoIterator<Item = V>,
310 V: std::convert::Into<crate::model::Operation>,
311 {
312 use std::iter::Iterator;
313 self.operations = v.into_iter().map(|i| i.into()).collect();
314 self
315 }
316
317 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
319 self.next_page_token = v.into();
320 self
321 }
322}
323
324impl wkt::message::Message for ListOperationsResponse {
325 fn typename() -> &'static str {
326 "type.googleapis.com/google.longrunning.ListOperationsResponse"
327 }
328}
329
330#[doc(hidden)]
331impl gax::paginator::internal::PageableResponse for ListOperationsResponse {
332 type PageItem = crate::model::Operation;
333
334 fn items(self) -> std::vec::Vec<Self::PageItem> {
335 self.operations
336 }
337
338 fn next_page_token(&self) -> std::string::String {
339 use std::clone::Clone;
340 self.next_page_token.clone()
341 }
342}
343
344#[derive(Clone, Default, PartialEq)]
349#[non_exhaustive]
350pub struct CancelOperationRequest {
351 pub name: std::string::String,
353
354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
355}
356
357impl CancelOperationRequest {
358 pub fn new() -> Self {
359 std::default::Default::default()
360 }
361
362 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
364 self.name = v.into();
365 self
366 }
367}
368
369impl wkt::message::Message for CancelOperationRequest {
370 fn typename() -> &'static str {
371 "type.googleapis.com/google.longrunning.CancelOperationRequest"
372 }
373}
374
375#[derive(Clone, Default, PartialEq)]
380#[non_exhaustive]
381pub struct DeleteOperationRequest {
382 pub name: std::string::String,
384
385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386}
387
388impl DeleteOperationRequest {
389 pub fn new() -> Self {
390 std::default::Default::default()
391 }
392
393 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
395 self.name = v.into();
396 self
397 }
398}
399
400impl wkt::message::Message for DeleteOperationRequest {
401 fn typename() -> &'static str {
402 "type.googleapis.com/google.longrunning.DeleteOperationRequest"
403 }
404}
405
406#[derive(Clone, Default, PartialEq)]
409#[non_exhaustive]
410pub struct WaitOperationRequest {
411 pub name: std::string::String,
413
414 pub timeout: std::option::Option<wkt::Duration>,
418
419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
420}
421
422impl WaitOperationRequest {
423 pub fn new() -> Self {
424 std::default::Default::default()
425 }
426
427 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
429 self.name = v.into();
430 self
431 }
432
433 pub fn set_timeout<T>(mut self, v: T) -> Self
435 where
436 T: std::convert::Into<wkt::Duration>,
437 {
438 self.timeout = std::option::Option::Some(v.into());
439 self
440 }
441
442 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
444 where
445 T: std::convert::Into<wkt::Duration>,
446 {
447 self.timeout = v.map(|x| x.into());
448 self
449 }
450}
451
452impl wkt::message::Message for WaitOperationRequest {
453 fn typename() -> &'static str {
454 "type.googleapis.com/google.longrunning.WaitOperationRequest"
455 }
456}
457
458#[derive(Clone, Default, PartialEq)]
471#[non_exhaustive]
472pub struct OperationInfo {
473 pub response_type: std::string::String,
482
483 pub metadata_type: std::string::String,
491
492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
493}
494
495impl OperationInfo {
496 pub fn new() -> Self {
497 std::default::Default::default()
498 }
499
500 pub fn set_response_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
502 self.response_type = v.into();
503 self
504 }
505
506 pub fn set_metadata_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
508 self.metadata_type = v.into();
509 self
510 }
511}
512
513impl wkt::message::Message for OperationInfo {
514 fn typename() -> &'static str {
515 "type.googleapis.com/google.longrunning.OperationInfo"
516 }
517}