google_cloud_workflows_executions_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// A running instance of a
36/// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
37#[derive(Clone, Default, PartialEq)]
38#[non_exhaustive]
39pub struct Execution {
40 /// Output only. The resource name of the execution.
41 /// Format:
42 /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
43 pub name: std::string::String,
44
45 /// Output only. Marks the beginning of execution.
46 pub start_time: std::option::Option<wkt::Timestamp>,
47
48 /// Output only. Marks the end of execution, successful or not.
49 pub end_time: std::option::Option<wkt::Timestamp>,
50
51 /// Output only. Measures the duration of the execution.
52 pub duration: std::option::Option<wkt::Duration>,
53
54 /// Output only. Current state of the execution.
55 pub state: crate::model::execution::State,
56
57 /// Input parameters of the execution represented as a JSON string.
58 /// The size limit is 32KB.
59 ///
60 /// *Note*: If you are using the REST API directly to run your workflow, you
61 /// must escape any JSON string value of `argument`. Example:
62 /// `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
63 pub argument: std::string::String,
64
65 /// Output only. Output of the execution represented as a JSON string. The
66 /// value can only be present if the execution's state is `SUCCEEDED`.
67 pub result: std::string::String,
68
69 /// Output only. The error which caused the execution to finish prematurely.
70 /// The value is only present if the execution's state is `FAILED`
71 /// or `CANCELLED`.
72 pub error: std::option::Option<crate::model::execution::Error>,
73
74 /// Output only. Revision of the workflow this execution is using.
75 pub workflow_revision_id: std::string::String,
76
77 /// The call logging level associated to this execution.
78 pub call_log_level: crate::model::execution::CallLogLevel,
79
80 /// Output only. Status tracks the current steps and progress data of this
81 /// execution.
82 pub status: std::option::Option<crate::model::execution::Status>,
83
84 /// Labels associated with this execution.
85 /// Labels can contain at most 64 entries. Keys and values can be no longer
86 /// than 63 characters and can only contain lowercase letters, numeric
87 /// characters, underscores, and dashes. Label keys must start with a letter.
88 /// International characters are allowed.
89 /// By default, labels are inherited from the workflow but are overridden by
90 /// any labels associated with the execution.
91 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
92
93 /// Output only. Error regarding the state of the Execution resource. For
94 /// example, this field will have error details if the execution data is
95 /// unavailable due to revoked KMS key permissions.
96 pub state_error: std::option::Option<crate::model::execution::StateError>,
97
98 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
99}
100
101impl Execution {
102 /// Creates a new default instance.
103 pub fn new() -> Self {
104 std::default::Default::default()
105 }
106
107 /// Sets the value of [name][crate::model::Execution::name].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_workflows_executions_v1::model::Execution;
112 /// let x = Execution::new().set_name("example");
113 /// ```
114 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115 self.name = v.into();
116 self
117 }
118
119 /// Sets the value of [start_time][crate::model::Execution::start_time].
120 ///
121 /// # Example
122 /// ```ignore,no_run
123 /// # use google_cloud_workflows_executions_v1::model::Execution;
124 /// use wkt::Timestamp;
125 /// let x = Execution::new().set_start_time(Timestamp::default()/* use setters */);
126 /// ```
127 pub fn set_start_time<T>(mut self, v: T) -> Self
128 where
129 T: std::convert::Into<wkt::Timestamp>,
130 {
131 self.start_time = std::option::Option::Some(v.into());
132 self
133 }
134
135 /// Sets or clears the value of [start_time][crate::model::Execution::start_time].
136 ///
137 /// # Example
138 /// ```ignore,no_run
139 /// # use google_cloud_workflows_executions_v1::model::Execution;
140 /// use wkt::Timestamp;
141 /// let x = Execution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
142 /// let x = Execution::new().set_or_clear_start_time(None::<Timestamp>);
143 /// ```
144 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
145 where
146 T: std::convert::Into<wkt::Timestamp>,
147 {
148 self.start_time = v.map(|x| x.into());
149 self
150 }
151
152 /// Sets the value of [end_time][crate::model::Execution::end_time].
153 ///
154 /// # Example
155 /// ```ignore,no_run
156 /// # use google_cloud_workflows_executions_v1::model::Execution;
157 /// use wkt::Timestamp;
158 /// let x = Execution::new().set_end_time(Timestamp::default()/* use setters */);
159 /// ```
160 pub fn set_end_time<T>(mut self, v: T) -> Self
161 where
162 T: std::convert::Into<wkt::Timestamp>,
163 {
164 self.end_time = std::option::Option::Some(v.into());
165 self
166 }
167
168 /// Sets or clears the value of [end_time][crate::model::Execution::end_time].
169 ///
170 /// # Example
171 /// ```ignore,no_run
172 /// # use google_cloud_workflows_executions_v1::model::Execution;
173 /// use wkt::Timestamp;
174 /// let x = Execution::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
175 /// let x = Execution::new().set_or_clear_end_time(None::<Timestamp>);
176 /// ```
177 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
178 where
179 T: std::convert::Into<wkt::Timestamp>,
180 {
181 self.end_time = v.map(|x| x.into());
182 self
183 }
184
185 /// Sets the value of [duration][crate::model::Execution::duration].
186 ///
187 /// # Example
188 /// ```ignore,no_run
189 /// # use google_cloud_workflows_executions_v1::model::Execution;
190 /// use wkt::Duration;
191 /// let x = Execution::new().set_duration(Duration::default()/* use setters */);
192 /// ```
193 pub fn set_duration<T>(mut self, v: T) -> Self
194 where
195 T: std::convert::Into<wkt::Duration>,
196 {
197 self.duration = std::option::Option::Some(v.into());
198 self
199 }
200
201 /// Sets or clears the value of [duration][crate::model::Execution::duration].
202 ///
203 /// # Example
204 /// ```ignore,no_run
205 /// # use google_cloud_workflows_executions_v1::model::Execution;
206 /// use wkt::Duration;
207 /// let x = Execution::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
208 /// let x = Execution::new().set_or_clear_duration(None::<Duration>);
209 /// ```
210 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
211 where
212 T: std::convert::Into<wkt::Duration>,
213 {
214 self.duration = v.map(|x| x.into());
215 self
216 }
217
218 /// Sets the value of [state][crate::model::Execution::state].
219 ///
220 /// # Example
221 /// ```ignore,no_run
222 /// # use google_cloud_workflows_executions_v1::model::Execution;
223 /// use google_cloud_workflows_executions_v1::model::execution::State;
224 /// let x0 = Execution::new().set_state(State::Active);
225 /// let x1 = Execution::new().set_state(State::Succeeded);
226 /// let x2 = Execution::new().set_state(State::Failed);
227 /// ```
228 pub fn set_state<T: std::convert::Into<crate::model::execution::State>>(
229 mut self,
230 v: T,
231 ) -> Self {
232 self.state = v.into();
233 self
234 }
235
236 /// Sets the value of [argument][crate::model::Execution::argument].
237 ///
238 /// # Example
239 /// ```ignore,no_run
240 /// # use google_cloud_workflows_executions_v1::model::Execution;
241 /// let x = Execution::new().set_argument("example");
242 /// ```
243 pub fn set_argument<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244 self.argument = v.into();
245 self
246 }
247
248 /// Sets the value of [result][crate::model::Execution::result].
249 ///
250 /// # Example
251 /// ```ignore,no_run
252 /// # use google_cloud_workflows_executions_v1::model::Execution;
253 /// let x = Execution::new().set_result("example");
254 /// ```
255 pub fn set_result<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
256 self.result = v.into();
257 self
258 }
259
260 /// Sets the value of [error][crate::model::Execution::error].
261 ///
262 /// # Example
263 /// ```ignore,no_run
264 /// # use google_cloud_workflows_executions_v1::model::Execution;
265 /// use google_cloud_workflows_executions_v1::model::execution::Error;
266 /// let x = Execution::new().set_error(Error::default()/* use setters */);
267 /// ```
268 pub fn set_error<T>(mut self, v: T) -> Self
269 where
270 T: std::convert::Into<crate::model::execution::Error>,
271 {
272 self.error = std::option::Option::Some(v.into());
273 self
274 }
275
276 /// Sets or clears the value of [error][crate::model::Execution::error].
277 ///
278 /// # Example
279 /// ```ignore,no_run
280 /// # use google_cloud_workflows_executions_v1::model::Execution;
281 /// use google_cloud_workflows_executions_v1::model::execution::Error;
282 /// let x = Execution::new().set_or_clear_error(Some(Error::default()/* use setters */));
283 /// let x = Execution::new().set_or_clear_error(None::<Error>);
284 /// ```
285 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
286 where
287 T: std::convert::Into<crate::model::execution::Error>,
288 {
289 self.error = v.map(|x| x.into());
290 self
291 }
292
293 /// Sets the value of [workflow_revision_id][crate::model::Execution::workflow_revision_id].
294 ///
295 /// # Example
296 /// ```ignore,no_run
297 /// # use google_cloud_workflows_executions_v1::model::Execution;
298 /// let x = Execution::new().set_workflow_revision_id("example");
299 /// ```
300 pub fn set_workflow_revision_id<T: std::convert::Into<std::string::String>>(
301 mut self,
302 v: T,
303 ) -> Self {
304 self.workflow_revision_id = v.into();
305 self
306 }
307
308 /// Sets the value of [call_log_level][crate::model::Execution::call_log_level].
309 ///
310 /// # Example
311 /// ```ignore,no_run
312 /// # use google_cloud_workflows_executions_v1::model::Execution;
313 /// use google_cloud_workflows_executions_v1::model::execution::CallLogLevel;
314 /// let x0 = Execution::new().set_call_log_level(CallLogLevel::LogAllCalls);
315 /// let x1 = Execution::new().set_call_log_level(CallLogLevel::LogErrorsOnly);
316 /// let x2 = Execution::new().set_call_log_level(CallLogLevel::LogNone);
317 /// ```
318 pub fn set_call_log_level<T: std::convert::Into<crate::model::execution::CallLogLevel>>(
319 mut self,
320 v: T,
321 ) -> Self {
322 self.call_log_level = v.into();
323 self
324 }
325
326 /// Sets the value of [status][crate::model::Execution::status].
327 ///
328 /// # Example
329 /// ```ignore,no_run
330 /// # use google_cloud_workflows_executions_v1::model::Execution;
331 /// use google_cloud_workflows_executions_v1::model::execution::Status;
332 /// let x = Execution::new().set_status(Status::default()/* use setters */);
333 /// ```
334 pub fn set_status<T>(mut self, v: T) -> Self
335 where
336 T: std::convert::Into<crate::model::execution::Status>,
337 {
338 self.status = std::option::Option::Some(v.into());
339 self
340 }
341
342 /// Sets or clears the value of [status][crate::model::Execution::status].
343 ///
344 /// # Example
345 /// ```ignore,no_run
346 /// # use google_cloud_workflows_executions_v1::model::Execution;
347 /// use google_cloud_workflows_executions_v1::model::execution::Status;
348 /// let x = Execution::new().set_or_clear_status(Some(Status::default()/* use setters */));
349 /// let x = Execution::new().set_or_clear_status(None::<Status>);
350 /// ```
351 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
352 where
353 T: std::convert::Into<crate::model::execution::Status>,
354 {
355 self.status = v.map(|x| x.into());
356 self
357 }
358
359 /// Sets the value of [labels][crate::model::Execution::labels].
360 ///
361 /// # Example
362 /// ```ignore,no_run
363 /// # use google_cloud_workflows_executions_v1::model::Execution;
364 /// let x = Execution::new().set_labels([
365 /// ("key0", "abc"),
366 /// ("key1", "xyz"),
367 /// ]);
368 /// ```
369 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
370 where
371 T: std::iter::IntoIterator<Item = (K, V)>,
372 K: std::convert::Into<std::string::String>,
373 V: std::convert::Into<std::string::String>,
374 {
375 use std::iter::Iterator;
376 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
377 self
378 }
379
380 /// Sets the value of [state_error][crate::model::Execution::state_error].
381 ///
382 /// # Example
383 /// ```ignore,no_run
384 /// # use google_cloud_workflows_executions_v1::model::Execution;
385 /// use google_cloud_workflows_executions_v1::model::execution::StateError;
386 /// let x = Execution::new().set_state_error(StateError::default()/* use setters */);
387 /// ```
388 pub fn set_state_error<T>(mut self, v: T) -> Self
389 where
390 T: std::convert::Into<crate::model::execution::StateError>,
391 {
392 self.state_error = std::option::Option::Some(v.into());
393 self
394 }
395
396 /// Sets or clears the value of [state_error][crate::model::Execution::state_error].
397 ///
398 /// # Example
399 /// ```ignore,no_run
400 /// # use google_cloud_workflows_executions_v1::model::Execution;
401 /// use google_cloud_workflows_executions_v1::model::execution::StateError;
402 /// let x = Execution::new().set_or_clear_state_error(Some(StateError::default()/* use setters */));
403 /// let x = Execution::new().set_or_clear_state_error(None::<StateError>);
404 /// ```
405 pub fn set_or_clear_state_error<T>(mut self, v: std::option::Option<T>) -> Self
406 where
407 T: std::convert::Into<crate::model::execution::StateError>,
408 {
409 self.state_error = v.map(|x| x.into());
410 self
411 }
412}
413
414impl wkt::message::Message for Execution {
415 fn typename() -> &'static str {
416 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution"
417 }
418}
419
420/// Defines additional types related to [Execution].
421pub mod execution {
422 #[allow(unused_imports)]
423 use super::*;
424
425 /// A single stack element (frame) where an error occurred.
426 #[derive(Clone, Default, PartialEq)]
427 #[non_exhaustive]
428 pub struct StackTraceElement {
429 /// The step the error occurred at.
430 pub step: std::string::String,
431
432 /// The routine where the error occurred.
433 pub routine: std::string::String,
434
435 /// The source position information of the stack trace element.
436 pub position: std::option::Option<crate::model::execution::stack_trace_element::Position>,
437
438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
439 }
440
441 impl StackTraceElement {
442 /// Creates a new default instance.
443 pub fn new() -> Self {
444 std::default::Default::default()
445 }
446
447 /// Sets the value of [step][crate::model::execution::StackTraceElement::step].
448 ///
449 /// # Example
450 /// ```ignore,no_run
451 /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
452 /// let x = StackTraceElement::new().set_step("example");
453 /// ```
454 pub fn set_step<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455 self.step = v.into();
456 self
457 }
458
459 /// Sets the value of [routine][crate::model::execution::StackTraceElement::routine].
460 ///
461 /// # Example
462 /// ```ignore,no_run
463 /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
464 /// let x = StackTraceElement::new().set_routine("example");
465 /// ```
466 pub fn set_routine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
467 self.routine = v.into();
468 self
469 }
470
471 /// Sets the value of [position][crate::model::execution::StackTraceElement::position].
472 ///
473 /// # Example
474 /// ```ignore,no_run
475 /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
476 /// use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
477 /// let x = StackTraceElement::new().set_position(Position::default()/* use setters */);
478 /// ```
479 pub fn set_position<T>(mut self, v: T) -> Self
480 where
481 T: std::convert::Into<crate::model::execution::stack_trace_element::Position>,
482 {
483 self.position = std::option::Option::Some(v.into());
484 self
485 }
486
487 /// Sets or clears the value of [position][crate::model::execution::StackTraceElement::position].
488 ///
489 /// # Example
490 /// ```ignore,no_run
491 /// # use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
492 /// use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
493 /// let x = StackTraceElement::new().set_or_clear_position(Some(Position::default()/* use setters */));
494 /// let x = StackTraceElement::new().set_or_clear_position(None::<Position>);
495 /// ```
496 pub fn set_or_clear_position<T>(mut self, v: std::option::Option<T>) -> Self
497 where
498 T: std::convert::Into<crate::model::execution::stack_trace_element::Position>,
499 {
500 self.position = v.map(|x| x.into());
501 self
502 }
503 }
504
505 impl wkt::message::Message for StackTraceElement {
506 fn typename() -> &'static str {
507 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTraceElement"
508 }
509 }
510
511 /// Defines additional types related to [StackTraceElement].
512 pub mod stack_trace_element {
513 #[allow(unused_imports)]
514 use super::*;
515
516 /// Position contains source position information about the stack trace
517 /// element such as line number, column number and length of the code block
518 /// in bytes.
519 #[derive(Clone, Default, PartialEq)]
520 #[non_exhaustive]
521 pub struct Position {
522 /// The source code line number the current instruction was generated from.
523 pub line: i64,
524
525 /// The source code column position (of the line) the current instruction
526 /// was generated from.
527 pub column: i64,
528
529 /// The number of bytes of source code making up this stack trace element.
530 pub length: i64,
531
532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
533 }
534
535 impl Position {
536 /// Creates a new default instance.
537 pub fn new() -> Self {
538 std::default::Default::default()
539 }
540
541 /// Sets the value of [line][crate::model::execution::stack_trace_element::Position::line].
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
546 /// let x = Position::new().set_line(42);
547 /// ```
548 pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
549 self.line = v.into();
550 self
551 }
552
553 /// Sets the value of [column][crate::model::execution::stack_trace_element::Position::column].
554 ///
555 /// # Example
556 /// ```ignore,no_run
557 /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
558 /// let x = Position::new().set_column(42);
559 /// ```
560 pub fn set_column<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
561 self.column = v.into();
562 self
563 }
564
565 /// Sets the value of [length][crate::model::execution::stack_trace_element::Position::length].
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_workflows_executions_v1::model::execution::stack_trace_element::Position;
570 /// let x = Position::new().set_length(42);
571 /// ```
572 pub fn set_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
573 self.length = v.into();
574 self
575 }
576 }
577
578 impl wkt::message::Message for Position {
579 fn typename() -> &'static str {
580 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position"
581 }
582 }
583 }
584
585 /// A collection of stack elements (frames) where an error occurred.
586 #[derive(Clone, Default, PartialEq)]
587 #[non_exhaustive]
588 pub struct StackTrace {
589 /// An array of stack elements.
590 pub elements: std::vec::Vec<crate::model::execution::StackTraceElement>,
591
592 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
593 }
594
595 impl StackTrace {
596 /// Creates a new default instance.
597 pub fn new() -> Self {
598 std::default::Default::default()
599 }
600
601 /// Sets the value of [elements][crate::model::execution::StackTrace::elements].
602 ///
603 /// # Example
604 /// ```ignore,no_run
605 /// # use google_cloud_workflows_executions_v1::model::execution::StackTrace;
606 /// use google_cloud_workflows_executions_v1::model::execution::StackTraceElement;
607 /// let x = StackTrace::new()
608 /// .set_elements([
609 /// StackTraceElement::default()/* use setters */,
610 /// StackTraceElement::default()/* use (different) setters */,
611 /// ]);
612 /// ```
613 pub fn set_elements<T, V>(mut self, v: T) -> Self
614 where
615 T: std::iter::IntoIterator<Item = V>,
616 V: std::convert::Into<crate::model::execution::StackTraceElement>,
617 {
618 use std::iter::Iterator;
619 self.elements = v.into_iter().map(|i| i.into()).collect();
620 self
621 }
622 }
623
624 impl wkt::message::Message for StackTrace {
625 fn typename() -> &'static str {
626 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StackTrace"
627 }
628 }
629
630 /// Error describes why the execution was abnormally terminated.
631 #[derive(Clone, Default, PartialEq)]
632 #[non_exhaustive]
633 pub struct Error {
634 /// Error message and data returned represented as a JSON string.
635 pub payload: std::string::String,
636
637 /// Human-readable stack trace string.
638 pub context: std::string::String,
639
640 /// Stack trace with detailed information of where error was generated.
641 pub stack_trace: std::option::Option<crate::model::execution::StackTrace>,
642
643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
644 }
645
646 impl Error {
647 /// Creates a new default instance.
648 pub fn new() -> Self {
649 std::default::Default::default()
650 }
651
652 /// Sets the value of [payload][crate::model::execution::Error::payload].
653 ///
654 /// # Example
655 /// ```ignore,no_run
656 /// # use google_cloud_workflows_executions_v1::model::execution::Error;
657 /// let x = Error::new().set_payload("example");
658 /// ```
659 pub fn set_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
660 self.payload = v.into();
661 self
662 }
663
664 /// Sets the value of [context][crate::model::execution::Error::context].
665 ///
666 /// # Example
667 /// ```ignore,no_run
668 /// # use google_cloud_workflows_executions_v1::model::execution::Error;
669 /// let x = Error::new().set_context("example");
670 /// ```
671 pub fn set_context<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672 self.context = v.into();
673 self
674 }
675
676 /// Sets the value of [stack_trace][crate::model::execution::Error::stack_trace].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_workflows_executions_v1::model::execution::Error;
681 /// use google_cloud_workflows_executions_v1::model::execution::StackTrace;
682 /// let x = Error::new().set_stack_trace(StackTrace::default()/* use setters */);
683 /// ```
684 pub fn set_stack_trace<T>(mut self, v: T) -> Self
685 where
686 T: std::convert::Into<crate::model::execution::StackTrace>,
687 {
688 self.stack_trace = std::option::Option::Some(v.into());
689 self
690 }
691
692 /// Sets or clears the value of [stack_trace][crate::model::execution::Error::stack_trace].
693 ///
694 /// # Example
695 /// ```ignore,no_run
696 /// # use google_cloud_workflows_executions_v1::model::execution::Error;
697 /// use google_cloud_workflows_executions_v1::model::execution::StackTrace;
698 /// let x = Error::new().set_or_clear_stack_trace(Some(StackTrace::default()/* use setters */));
699 /// let x = Error::new().set_or_clear_stack_trace(None::<StackTrace>);
700 /// ```
701 pub fn set_or_clear_stack_trace<T>(mut self, v: std::option::Option<T>) -> Self
702 where
703 T: std::convert::Into<crate::model::execution::StackTrace>,
704 {
705 self.stack_trace = v.map(|x| x.into());
706 self
707 }
708 }
709
710 impl wkt::message::Message for Error {
711 fn typename() -> &'static str {
712 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Error"
713 }
714 }
715
716 /// Represents the current status of this execution.
717 #[derive(Clone, Default, PartialEq)]
718 #[non_exhaustive]
719 pub struct Status {
720 /// A list of currently executing or last executed step names for the
721 /// workflow execution currently running. If the workflow has succeeded or
722 /// failed, this is the last attempted or executed step. Presently, if the
723 /// current step is inside a subworkflow, the list only includes that step.
724 /// In the future, the list will contain items for each step in the call
725 /// stack, starting with the outermost step in the `main` subworkflow, and
726 /// ending with the most deeply nested step.
727 pub current_steps: std::vec::Vec<crate::model::execution::status::Step>,
728
729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
730 }
731
732 impl Status {
733 /// Creates a new default instance.
734 pub fn new() -> Self {
735 std::default::Default::default()
736 }
737
738 /// Sets the value of [current_steps][crate::model::execution::Status::current_steps].
739 ///
740 /// # Example
741 /// ```ignore,no_run
742 /// # use google_cloud_workflows_executions_v1::model::execution::Status;
743 /// use google_cloud_workflows_executions_v1::model::execution::status::Step;
744 /// let x = Status::new()
745 /// .set_current_steps([
746 /// Step::default()/* use setters */,
747 /// Step::default()/* use (different) setters */,
748 /// ]);
749 /// ```
750 pub fn set_current_steps<T, V>(mut self, v: T) -> Self
751 where
752 T: std::iter::IntoIterator<Item = V>,
753 V: std::convert::Into<crate::model::execution::status::Step>,
754 {
755 use std::iter::Iterator;
756 self.current_steps = v.into_iter().map(|i| i.into()).collect();
757 self
758 }
759 }
760
761 impl wkt::message::Message for Status {
762 fn typename() -> &'static str {
763 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Status"
764 }
765 }
766
767 /// Defines additional types related to [Status].
768 pub mod status {
769 #[allow(unused_imports)]
770 use super::*;
771
772 /// Represents a step of the workflow this execution is running.
773 #[derive(Clone, Default, PartialEq)]
774 #[non_exhaustive]
775 pub struct Step {
776 /// Name of a routine within the workflow.
777 pub routine: std::string::String,
778
779 /// Name of a step within the routine.
780 pub step: std::string::String,
781
782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
783 }
784
785 impl Step {
786 /// Creates a new default instance.
787 pub fn new() -> Self {
788 std::default::Default::default()
789 }
790
791 /// Sets the value of [routine][crate::model::execution::status::Step::routine].
792 ///
793 /// # Example
794 /// ```ignore,no_run
795 /// # use google_cloud_workflows_executions_v1::model::execution::status::Step;
796 /// let x = Step::new().set_routine("example");
797 /// ```
798 pub fn set_routine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
799 self.routine = v.into();
800 self
801 }
802
803 /// Sets the value of [step][crate::model::execution::status::Step::step].
804 ///
805 /// # Example
806 /// ```ignore,no_run
807 /// # use google_cloud_workflows_executions_v1::model::execution::status::Step;
808 /// let x = Step::new().set_step("example");
809 /// ```
810 pub fn set_step<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
811 self.step = v.into();
812 self
813 }
814 }
815
816 impl wkt::message::Message for Step {
817 fn typename() -> &'static str {
818 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.Status.Step"
819 }
820 }
821 }
822
823 /// Describes an error related to the current state of the Execution resource.
824 #[derive(Clone, Default, PartialEq)]
825 #[non_exhaustive]
826 pub struct StateError {
827 /// Provides specifics about the error.
828 pub details: std::string::String,
829
830 /// The type of this state error.
831 pub r#type: crate::model::execution::state_error::Type,
832
833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
834 }
835
836 impl StateError {
837 /// Creates a new default instance.
838 pub fn new() -> Self {
839 std::default::Default::default()
840 }
841
842 /// Sets the value of [details][crate::model::execution::StateError::details].
843 ///
844 /// # Example
845 /// ```ignore,no_run
846 /// # use google_cloud_workflows_executions_v1::model::execution::StateError;
847 /// let x = StateError::new().set_details("example");
848 /// ```
849 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
850 self.details = v.into();
851 self
852 }
853
854 /// Sets the value of [r#type][crate::model::execution::StateError::type].
855 ///
856 /// # Example
857 /// ```ignore,no_run
858 /// # use google_cloud_workflows_executions_v1::model::execution::StateError;
859 /// use google_cloud_workflows_executions_v1::model::execution::state_error::Type;
860 /// let x0 = StateError::new().set_type(Type::KmsError);
861 /// ```
862 pub fn set_type<T: std::convert::Into<crate::model::execution::state_error::Type>>(
863 mut self,
864 v: T,
865 ) -> Self {
866 self.r#type = v.into();
867 self
868 }
869 }
870
871 impl wkt::message::Message for StateError {
872 fn typename() -> &'static str {
873 "type.googleapis.com/google.cloud.workflows.executions.v1.Execution.StateError"
874 }
875 }
876
877 /// Defines additional types related to [StateError].
878 pub mod state_error {
879 #[allow(unused_imports)]
880 use super::*;
881
882 /// Describes the possible types of a state error.
883 ///
884 /// # Working with unknown values
885 ///
886 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
887 /// additional enum variants at any time. Adding new variants is not considered
888 /// a breaking change. Applications should write their code in anticipation of:
889 ///
890 /// - New values appearing in future releases of the client library, **and**
891 /// - New values received dynamically, without application changes.
892 ///
893 /// Please consult the [Working with enums] section in the user guide for some
894 /// guidelines.
895 ///
896 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
897 #[derive(Clone, Debug, PartialEq)]
898 #[non_exhaustive]
899 pub enum Type {
900 /// No type specified.
901 Unspecified,
902 /// Caused by an issue with KMS.
903 KmsError,
904 /// If set, the enum was initialized with an unknown value.
905 ///
906 /// Applications can examine the value using [Type::value] or
907 /// [Type::name].
908 UnknownValue(r#type::UnknownValue),
909 }
910
911 #[doc(hidden)]
912 pub mod r#type {
913 #[allow(unused_imports)]
914 use super::*;
915 #[derive(Clone, Debug, PartialEq)]
916 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
917 }
918
919 impl Type {
920 /// Gets the enum value.
921 ///
922 /// Returns `None` if the enum contains an unknown value deserialized from
923 /// the string representation of enums.
924 pub fn value(&self) -> std::option::Option<i32> {
925 match self {
926 Self::Unspecified => std::option::Option::Some(0),
927 Self::KmsError => std::option::Option::Some(1),
928 Self::UnknownValue(u) => u.0.value(),
929 }
930 }
931
932 /// Gets the enum value as a string.
933 ///
934 /// Returns `None` if the enum contains an unknown value deserialized from
935 /// the integer representation of enums.
936 pub fn name(&self) -> std::option::Option<&str> {
937 match self {
938 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
939 Self::KmsError => std::option::Option::Some("KMS_ERROR"),
940 Self::UnknownValue(u) => u.0.name(),
941 }
942 }
943 }
944
945 impl std::default::Default for Type {
946 fn default() -> Self {
947 use std::convert::From;
948 Self::from(0)
949 }
950 }
951
952 impl std::fmt::Display for Type {
953 fn fmt(
954 &self,
955 f: &mut std::fmt::Formatter<'_>,
956 ) -> std::result::Result<(), std::fmt::Error> {
957 wkt::internal::display_enum(f, self.name(), self.value())
958 }
959 }
960
961 impl std::convert::From<i32> for Type {
962 fn from(value: i32) -> Self {
963 match value {
964 0 => Self::Unspecified,
965 1 => Self::KmsError,
966 _ => Self::UnknownValue(r#type::UnknownValue(
967 wkt::internal::UnknownEnumValue::Integer(value),
968 )),
969 }
970 }
971 }
972
973 impl std::convert::From<&str> for Type {
974 fn from(value: &str) -> Self {
975 use std::string::ToString;
976 match value {
977 "TYPE_UNSPECIFIED" => Self::Unspecified,
978 "KMS_ERROR" => Self::KmsError,
979 _ => Self::UnknownValue(r#type::UnknownValue(
980 wkt::internal::UnknownEnumValue::String(value.to_string()),
981 )),
982 }
983 }
984 }
985
986 impl serde::ser::Serialize for Type {
987 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
988 where
989 S: serde::Serializer,
990 {
991 match self {
992 Self::Unspecified => serializer.serialize_i32(0),
993 Self::KmsError => serializer.serialize_i32(1),
994 Self::UnknownValue(u) => u.0.serialize(serializer),
995 }
996 }
997 }
998
999 impl<'de> serde::de::Deserialize<'de> for Type {
1000 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1001 where
1002 D: serde::Deserializer<'de>,
1003 {
1004 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1005 ".google.cloud.workflows.executions.v1.Execution.StateError.Type",
1006 ))
1007 }
1008 }
1009 }
1010
1011 /// Describes the current state of the execution. More states might be added
1012 /// in the future.
1013 ///
1014 /// # Working with unknown values
1015 ///
1016 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1017 /// additional enum variants at any time. Adding new variants is not considered
1018 /// a breaking change. Applications should write their code in anticipation of:
1019 ///
1020 /// - New values appearing in future releases of the client library, **and**
1021 /// - New values received dynamically, without application changes.
1022 ///
1023 /// Please consult the [Working with enums] section in the user guide for some
1024 /// guidelines.
1025 ///
1026 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1027 #[derive(Clone, Debug, PartialEq)]
1028 #[non_exhaustive]
1029 pub enum State {
1030 /// Invalid state.
1031 Unspecified,
1032 /// The execution is in progress.
1033 Active,
1034 /// The execution finished successfully.
1035 Succeeded,
1036 /// The execution failed with an error.
1037 Failed,
1038 /// The execution was stopped intentionally.
1039 Cancelled,
1040 /// Execution data is unavailable. See the `state_error` field.
1041 Unavailable,
1042 /// Request has been placed in the backlog for processing at a later time.
1043 Queued,
1044 /// If set, the enum was initialized with an unknown value.
1045 ///
1046 /// Applications can examine the value using [State::value] or
1047 /// [State::name].
1048 UnknownValue(state::UnknownValue),
1049 }
1050
1051 #[doc(hidden)]
1052 pub mod state {
1053 #[allow(unused_imports)]
1054 use super::*;
1055 #[derive(Clone, Debug, PartialEq)]
1056 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1057 }
1058
1059 impl State {
1060 /// Gets the enum value.
1061 ///
1062 /// Returns `None` if the enum contains an unknown value deserialized from
1063 /// the string representation of enums.
1064 pub fn value(&self) -> std::option::Option<i32> {
1065 match self {
1066 Self::Unspecified => std::option::Option::Some(0),
1067 Self::Active => std::option::Option::Some(1),
1068 Self::Succeeded => std::option::Option::Some(2),
1069 Self::Failed => std::option::Option::Some(3),
1070 Self::Cancelled => std::option::Option::Some(4),
1071 Self::Unavailable => std::option::Option::Some(5),
1072 Self::Queued => std::option::Option::Some(6),
1073 Self::UnknownValue(u) => u.0.value(),
1074 }
1075 }
1076
1077 /// Gets the enum value as a string.
1078 ///
1079 /// Returns `None` if the enum contains an unknown value deserialized from
1080 /// the integer representation of enums.
1081 pub fn name(&self) -> std::option::Option<&str> {
1082 match self {
1083 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1084 Self::Active => std::option::Option::Some("ACTIVE"),
1085 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1086 Self::Failed => std::option::Option::Some("FAILED"),
1087 Self::Cancelled => std::option::Option::Some("CANCELLED"),
1088 Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
1089 Self::Queued => std::option::Option::Some("QUEUED"),
1090 Self::UnknownValue(u) => u.0.name(),
1091 }
1092 }
1093 }
1094
1095 impl std::default::Default for State {
1096 fn default() -> Self {
1097 use std::convert::From;
1098 Self::from(0)
1099 }
1100 }
1101
1102 impl std::fmt::Display for State {
1103 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1104 wkt::internal::display_enum(f, self.name(), self.value())
1105 }
1106 }
1107
1108 impl std::convert::From<i32> for State {
1109 fn from(value: i32) -> Self {
1110 match value {
1111 0 => Self::Unspecified,
1112 1 => Self::Active,
1113 2 => Self::Succeeded,
1114 3 => Self::Failed,
1115 4 => Self::Cancelled,
1116 5 => Self::Unavailable,
1117 6 => Self::Queued,
1118 _ => Self::UnknownValue(state::UnknownValue(
1119 wkt::internal::UnknownEnumValue::Integer(value),
1120 )),
1121 }
1122 }
1123 }
1124
1125 impl std::convert::From<&str> for State {
1126 fn from(value: &str) -> Self {
1127 use std::string::ToString;
1128 match value {
1129 "STATE_UNSPECIFIED" => Self::Unspecified,
1130 "ACTIVE" => Self::Active,
1131 "SUCCEEDED" => Self::Succeeded,
1132 "FAILED" => Self::Failed,
1133 "CANCELLED" => Self::Cancelled,
1134 "UNAVAILABLE" => Self::Unavailable,
1135 "QUEUED" => Self::Queued,
1136 _ => Self::UnknownValue(state::UnknownValue(
1137 wkt::internal::UnknownEnumValue::String(value.to_string()),
1138 )),
1139 }
1140 }
1141 }
1142
1143 impl serde::ser::Serialize for State {
1144 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1145 where
1146 S: serde::Serializer,
1147 {
1148 match self {
1149 Self::Unspecified => serializer.serialize_i32(0),
1150 Self::Active => serializer.serialize_i32(1),
1151 Self::Succeeded => serializer.serialize_i32(2),
1152 Self::Failed => serializer.serialize_i32(3),
1153 Self::Cancelled => serializer.serialize_i32(4),
1154 Self::Unavailable => serializer.serialize_i32(5),
1155 Self::Queued => serializer.serialize_i32(6),
1156 Self::UnknownValue(u) => u.0.serialize(serializer),
1157 }
1158 }
1159 }
1160
1161 impl<'de> serde::de::Deserialize<'de> for State {
1162 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1163 where
1164 D: serde::Deserializer<'de>,
1165 {
1166 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1167 ".google.cloud.workflows.executions.v1.Execution.State",
1168 ))
1169 }
1170 }
1171
1172 /// Describes the level of platform logging to apply to calls and call
1173 /// responses during workflow executions.
1174 ///
1175 /// # Working with unknown values
1176 ///
1177 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1178 /// additional enum variants at any time. Adding new variants is not considered
1179 /// a breaking change. Applications should write their code in anticipation of:
1180 ///
1181 /// - New values appearing in future releases of the client library, **and**
1182 /// - New values received dynamically, without application changes.
1183 ///
1184 /// Please consult the [Working with enums] section in the user guide for some
1185 /// guidelines.
1186 ///
1187 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1188 #[derive(Clone, Debug, PartialEq)]
1189 #[non_exhaustive]
1190 pub enum CallLogLevel {
1191 /// No call logging level specified.
1192 Unspecified,
1193 /// Log all call steps within workflows, all call returns, and all exceptions
1194 /// raised.
1195 LogAllCalls,
1196 /// Log only exceptions that are raised from call steps within workflows.
1197 LogErrorsOnly,
1198 /// Explicitly log nothing.
1199 LogNone,
1200 /// If set, the enum was initialized with an unknown value.
1201 ///
1202 /// Applications can examine the value using [CallLogLevel::value] or
1203 /// [CallLogLevel::name].
1204 UnknownValue(call_log_level::UnknownValue),
1205 }
1206
1207 #[doc(hidden)]
1208 pub mod call_log_level {
1209 #[allow(unused_imports)]
1210 use super::*;
1211 #[derive(Clone, Debug, PartialEq)]
1212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1213 }
1214
1215 impl CallLogLevel {
1216 /// Gets the enum value.
1217 ///
1218 /// Returns `None` if the enum contains an unknown value deserialized from
1219 /// the string representation of enums.
1220 pub fn value(&self) -> std::option::Option<i32> {
1221 match self {
1222 Self::Unspecified => std::option::Option::Some(0),
1223 Self::LogAllCalls => std::option::Option::Some(1),
1224 Self::LogErrorsOnly => std::option::Option::Some(2),
1225 Self::LogNone => std::option::Option::Some(3),
1226 Self::UnknownValue(u) => u.0.value(),
1227 }
1228 }
1229
1230 /// Gets the enum value as a string.
1231 ///
1232 /// Returns `None` if the enum contains an unknown value deserialized from
1233 /// the integer representation of enums.
1234 pub fn name(&self) -> std::option::Option<&str> {
1235 match self {
1236 Self::Unspecified => std::option::Option::Some("CALL_LOG_LEVEL_UNSPECIFIED"),
1237 Self::LogAllCalls => std::option::Option::Some("LOG_ALL_CALLS"),
1238 Self::LogErrorsOnly => std::option::Option::Some("LOG_ERRORS_ONLY"),
1239 Self::LogNone => std::option::Option::Some("LOG_NONE"),
1240 Self::UnknownValue(u) => u.0.name(),
1241 }
1242 }
1243 }
1244
1245 impl std::default::Default for CallLogLevel {
1246 fn default() -> Self {
1247 use std::convert::From;
1248 Self::from(0)
1249 }
1250 }
1251
1252 impl std::fmt::Display for CallLogLevel {
1253 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1254 wkt::internal::display_enum(f, self.name(), self.value())
1255 }
1256 }
1257
1258 impl std::convert::From<i32> for CallLogLevel {
1259 fn from(value: i32) -> Self {
1260 match value {
1261 0 => Self::Unspecified,
1262 1 => Self::LogAllCalls,
1263 2 => Self::LogErrorsOnly,
1264 3 => Self::LogNone,
1265 _ => Self::UnknownValue(call_log_level::UnknownValue(
1266 wkt::internal::UnknownEnumValue::Integer(value),
1267 )),
1268 }
1269 }
1270 }
1271
1272 impl std::convert::From<&str> for CallLogLevel {
1273 fn from(value: &str) -> Self {
1274 use std::string::ToString;
1275 match value {
1276 "CALL_LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
1277 "LOG_ALL_CALLS" => Self::LogAllCalls,
1278 "LOG_ERRORS_ONLY" => Self::LogErrorsOnly,
1279 "LOG_NONE" => Self::LogNone,
1280 _ => Self::UnknownValue(call_log_level::UnknownValue(
1281 wkt::internal::UnknownEnumValue::String(value.to_string()),
1282 )),
1283 }
1284 }
1285 }
1286
1287 impl serde::ser::Serialize for CallLogLevel {
1288 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1289 where
1290 S: serde::Serializer,
1291 {
1292 match self {
1293 Self::Unspecified => serializer.serialize_i32(0),
1294 Self::LogAllCalls => serializer.serialize_i32(1),
1295 Self::LogErrorsOnly => serializer.serialize_i32(2),
1296 Self::LogNone => serializer.serialize_i32(3),
1297 Self::UnknownValue(u) => u.0.serialize(serializer),
1298 }
1299 }
1300 }
1301
1302 impl<'de> serde::de::Deserialize<'de> for CallLogLevel {
1303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1304 where
1305 D: serde::Deserializer<'de>,
1306 {
1307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CallLogLevel>::new(
1308 ".google.cloud.workflows.executions.v1.Execution.CallLogLevel",
1309 ))
1310 }
1311 }
1312}
1313
1314/// Request for the
1315/// [ListExecutions][]
1316/// method.
1317#[derive(Clone, Default, PartialEq)]
1318#[non_exhaustive]
1319pub struct ListExecutionsRequest {
1320 /// Required. Name of the workflow for which the executions should be listed.
1321 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1322 pub parent: std::string::String,
1323
1324 /// Maximum number of executions to return per call.
1325 /// Max supported value depends on the selected Execution view: it's 1000 for
1326 /// BASIC and 100 for FULL. The default value used if the field is not
1327 /// specified is 100, regardless of the selected view. Values greater than
1328 /// the max value will be coerced down to it.
1329 pub page_size: i32,
1330
1331 /// A page token, received from a previous `ListExecutions` call.
1332 /// Provide this to retrieve the subsequent page.
1333 ///
1334 /// When paginating, all other parameters provided to `ListExecutions` must
1335 /// match the call that provided the page token.
1336 ///
1337 /// Note that pagination is applied to dynamic data. The list of executions
1338 /// returned can change between page requests.
1339 pub page_token: std::string::String,
1340
1341 /// Optional. A view defining which fields should be filled in the returned
1342 /// executions. The API will default to the BASIC view.
1343 pub view: crate::model::ExecutionView,
1344
1345 /// Optional. Filters applied to the [Executions.ListExecutions] results.
1346 /// The following fields are supported for filtering:
1347 /// executionID, state, startTime, endTime, duration, workflowRevisionID,
1348 /// stepName, and label.
1349 pub filter: std::string::String,
1350
1351 /// Optional. The ordering applied to the [Executions.ListExecutions] results.
1352 /// By default the ordering is based on descending start time.
1353 /// The following fields are supported for order by:
1354 /// executionID, startTime, endTime, duration, state, and workflowRevisionID.
1355 pub order_by: std::string::String,
1356
1357 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1358}
1359
1360impl ListExecutionsRequest {
1361 /// Creates a new default instance.
1362 pub fn new() -> Self {
1363 std::default::Default::default()
1364 }
1365
1366 /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
1367 ///
1368 /// # Example
1369 /// ```ignore,no_run
1370 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1371 /// let x = ListExecutionsRequest::new().set_parent("example");
1372 /// ```
1373 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1374 self.parent = v.into();
1375 self
1376 }
1377
1378 /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
1379 ///
1380 /// # Example
1381 /// ```ignore,no_run
1382 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1383 /// let x = ListExecutionsRequest::new().set_page_size(42);
1384 /// ```
1385 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1386 self.page_size = v.into();
1387 self
1388 }
1389
1390 /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
1391 ///
1392 /// # Example
1393 /// ```ignore,no_run
1394 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1395 /// let x = ListExecutionsRequest::new().set_page_token("example");
1396 /// ```
1397 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1398 self.page_token = v.into();
1399 self
1400 }
1401
1402 /// Sets the value of [view][crate::model::ListExecutionsRequest::view].
1403 ///
1404 /// # Example
1405 /// ```ignore,no_run
1406 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1407 /// use google_cloud_workflows_executions_v1::model::ExecutionView;
1408 /// let x0 = ListExecutionsRequest::new().set_view(ExecutionView::Basic);
1409 /// let x1 = ListExecutionsRequest::new().set_view(ExecutionView::Full);
1410 /// ```
1411 pub fn set_view<T: std::convert::Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
1412 self.view = v.into();
1413 self
1414 }
1415
1416 /// Sets the value of [filter][crate::model::ListExecutionsRequest::filter].
1417 ///
1418 /// # Example
1419 /// ```ignore,no_run
1420 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1421 /// let x = ListExecutionsRequest::new().set_filter("example");
1422 /// ```
1423 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1424 self.filter = v.into();
1425 self
1426 }
1427
1428 /// Sets the value of [order_by][crate::model::ListExecutionsRequest::order_by].
1429 ///
1430 /// # Example
1431 /// ```ignore,no_run
1432 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsRequest;
1433 /// let x = ListExecutionsRequest::new().set_order_by("example");
1434 /// ```
1435 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1436 self.order_by = v.into();
1437 self
1438 }
1439}
1440
1441impl wkt::message::Message for ListExecutionsRequest {
1442 fn typename() -> &'static str {
1443 "type.googleapis.com/google.cloud.workflows.executions.v1.ListExecutionsRequest"
1444 }
1445}
1446
1447/// Response for the
1448/// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions]
1449/// method.
1450///
1451/// [google.cloud.workflows.executions.v1.Executions.ListExecutions]: crate::client::Executions::list_executions
1452#[derive(Clone, Default, PartialEq)]
1453#[non_exhaustive]
1454pub struct ListExecutionsResponse {
1455 /// The executions which match the request.
1456 pub executions: std::vec::Vec<crate::model::Execution>,
1457
1458 /// A token, which can be sent as `page_token` to retrieve the next page.
1459 /// If this field is omitted, there are no subsequent pages.
1460 pub next_page_token: std::string::String,
1461
1462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1463}
1464
1465impl ListExecutionsResponse {
1466 /// Creates a new default instance.
1467 pub fn new() -> Self {
1468 std::default::Default::default()
1469 }
1470
1471 /// Sets the value of [executions][crate::model::ListExecutionsResponse::executions].
1472 ///
1473 /// # Example
1474 /// ```ignore,no_run
1475 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsResponse;
1476 /// use google_cloud_workflows_executions_v1::model::Execution;
1477 /// let x = ListExecutionsResponse::new()
1478 /// .set_executions([
1479 /// Execution::default()/* use setters */,
1480 /// Execution::default()/* use (different) setters */,
1481 /// ]);
1482 /// ```
1483 pub fn set_executions<T, V>(mut self, v: T) -> Self
1484 where
1485 T: std::iter::IntoIterator<Item = V>,
1486 V: std::convert::Into<crate::model::Execution>,
1487 {
1488 use std::iter::Iterator;
1489 self.executions = v.into_iter().map(|i| i.into()).collect();
1490 self
1491 }
1492
1493 /// Sets the value of [next_page_token][crate::model::ListExecutionsResponse::next_page_token].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_workflows_executions_v1::model::ListExecutionsResponse;
1498 /// let x = ListExecutionsResponse::new().set_next_page_token("example");
1499 /// ```
1500 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1501 self.next_page_token = v.into();
1502 self
1503 }
1504}
1505
1506impl wkt::message::Message for ListExecutionsResponse {
1507 fn typename() -> &'static str {
1508 "type.googleapis.com/google.cloud.workflows.executions.v1.ListExecutionsResponse"
1509 }
1510}
1511
1512#[doc(hidden)]
1513impl google_cloud_gax::paginator::internal::PageableResponse for ListExecutionsResponse {
1514 type PageItem = crate::model::Execution;
1515
1516 fn items(self) -> std::vec::Vec<Self::PageItem> {
1517 self.executions
1518 }
1519
1520 fn next_page_token(&self) -> std::string::String {
1521 use std::clone::Clone;
1522 self.next_page_token.clone()
1523 }
1524}
1525
1526/// Request for the
1527/// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution]
1528/// method.
1529///
1530/// [google.cloud.workflows.executions.v1.Executions.CreateExecution]: crate::client::Executions::create_execution
1531#[derive(Clone, Default, PartialEq)]
1532#[non_exhaustive]
1533pub struct CreateExecutionRequest {
1534 /// Required. Name of the workflow for which an execution should be created.
1535 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1536 /// The latest revision of the workflow will be used.
1537 pub parent: std::string::String,
1538
1539 /// Required. Execution to be created.
1540 pub execution: std::option::Option<crate::model::Execution>,
1541
1542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1543}
1544
1545impl CreateExecutionRequest {
1546 /// Creates a new default instance.
1547 pub fn new() -> Self {
1548 std::default::Default::default()
1549 }
1550
1551 /// Sets the value of [parent][crate::model::CreateExecutionRequest::parent].
1552 ///
1553 /// # Example
1554 /// ```ignore,no_run
1555 /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1556 /// let x = CreateExecutionRequest::new().set_parent("example");
1557 /// ```
1558 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1559 self.parent = v.into();
1560 self
1561 }
1562
1563 /// Sets the value of [execution][crate::model::CreateExecutionRequest::execution].
1564 ///
1565 /// # Example
1566 /// ```ignore,no_run
1567 /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1568 /// use google_cloud_workflows_executions_v1::model::Execution;
1569 /// let x = CreateExecutionRequest::new().set_execution(Execution::default()/* use setters */);
1570 /// ```
1571 pub fn set_execution<T>(mut self, v: T) -> Self
1572 where
1573 T: std::convert::Into<crate::model::Execution>,
1574 {
1575 self.execution = std::option::Option::Some(v.into());
1576 self
1577 }
1578
1579 /// Sets or clears the value of [execution][crate::model::CreateExecutionRequest::execution].
1580 ///
1581 /// # Example
1582 /// ```ignore,no_run
1583 /// # use google_cloud_workflows_executions_v1::model::CreateExecutionRequest;
1584 /// use google_cloud_workflows_executions_v1::model::Execution;
1585 /// let x = CreateExecutionRequest::new().set_or_clear_execution(Some(Execution::default()/* use setters */));
1586 /// let x = CreateExecutionRequest::new().set_or_clear_execution(None::<Execution>);
1587 /// ```
1588 pub fn set_or_clear_execution<T>(mut self, v: std::option::Option<T>) -> Self
1589 where
1590 T: std::convert::Into<crate::model::Execution>,
1591 {
1592 self.execution = v.map(|x| x.into());
1593 self
1594 }
1595}
1596
1597impl wkt::message::Message for CreateExecutionRequest {
1598 fn typename() -> &'static str {
1599 "type.googleapis.com/google.cloud.workflows.executions.v1.CreateExecutionRequest"
1600 }
1601}
1602
1603/// Request for the
1604/// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution]
1605/// method.
1606///
1607/// [google.cloud.workflows.executions.v1.Executions.GetExecution]: crate::client::Executions::get_execution
1608#[derive(Clone, Default, PartialEq)]
1609#[non_exhaustive]
1610pub struct GetExecutionRequest {
1611 /// Required. Name of the execution to be retrieved.
1612 /// Format:
1613 /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
1614 pub name: std::string::String,
1615
1616 /// Optional. A view defining which fields should be filled in the returned
1617 /// execution. The API will default to the FULL view.
1618 pub view: crate::model::ExecutionView,
1619
1620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1621}
1622
1623impl GetExecutionRequest {
1624 /// Creates a new default instance.
1625 pub fn new() -> Self {
1626 std::default::Default::default()
1627 }
1628
1629 /// Sets the value of [name][crate::model::GetExecutionRequest::name].
1630 ///
1631 /// # Example
1632 /// ```ignore,no_run
1633 /// # use google_cloud_workflows_executions_v1::model::GetExecutionRequest;
1634 /// let x = GetExecutionRequest::new().set_name("example");
1635 /// ```
1636 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1637 self.name = v.into();
1638 self
1639 }
1640
1641 /// Sets the value of [view][crate::model::GetExecutionRequest::view].
1642 ///
1643 /// # Example
1644 /// ```ignore,no_run
1645 /// # use google_cloud_workflows_executions_v1::model::GetExecutionRequest;
1646 /// use google_cloud_workflows_executions_v1::model::ExecutionView;
1647 /// let x0 = GetExecutionRequest::new().set_view(ExecutionView::Basic);
1648 /// let x1 = GetExecutionRequest::new().set_view(ExecutionView::Full);
1649 /// ```
1650 pub fn set_view<T: std::convert::Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
1651 self.view = v.into();
1652 self
1653 }
1654}
1655
1656impl wkt::message::Message for GetExecutionRequest {
1657 fn typename() -> &'static str {
1658 "type.googleapis.com/google.cloud.workflows.executions.v1.GetExecutionRequest"
1659 }
1660}
1661
1662/// Request for the
1663/// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution]
1664/// method.
1665///
1666/// [google.cloud.workflows.executions.v1.Executions.CancelExecution]: crate::client::Executions::cancel_execution
1667#[derive(Clone, Default, PartialEq)]
1668#[non_exhaustive]
1669pub struct CancelExecutionRequest {
1670 /// Required. Name of the execution to be cancelled.
1671 /// Format:
1672 /// projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
1673 pub name: std::string::String,
1674
1675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1676}
1677
1678impl CancelExecutionRequest {
1679 /// Creates a new default instance.
1680 pub fn new() -> Self {
1681 std::default::Default::default()
1682 }
1683
1684 /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
1685 ///
1686 /// # Example
1687 /// ```ignore,no_run
1688 /// # use google_cloud_workflows_executions_v1::model::CancelExecutionRequest;
1689 /// let x = CancelExecutionRequest::new().set_name("example");
1690 /// ```
1691 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1692 self.name = v.into();
1693 self
1694 }
1695}
1696
1697impl wkt::message::Message for CancelExecutionRequest {
1698 fn typename() -> &'static str {
1699 "type.googleapis.com/google.cloud.workflows.executions.v1.CancelExecutionRequest"
1700 }
1701}
1702
1703/// Defines possible views for execution resource.
1704///
1705/// # Working with unknown values
1706///
1707/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1708/// additional enum variants at any time. Adding new variants is not considered
1709/// a breaking change. Applications should write their code in anticipation of:
1710///
1711/// - New values appearing in future releases of the client library, **and**
1712/// - New values received dynamically, without application changes.
1713///
1714/// Please consult the [Working with enums] section in the user guide for some
1715/// guidelines.
1716///
1717/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1718#[derive(Clone, Debug, PartialEq)]
1719#[non_exhaustive]
1720pub enum ExecutionView {
1721 /// The default / unset value.
1722 Unspecified,
1723 /// Includes only basic metadata about the execution.
1724 /// The following fields are returned: name, start_time, end_time, duration,
1725 /// state, and workflow_revision_id.
1726 Basic,
1727 /// Includes all data.
1728 Full,
1729 /// If set, the enum was initialized with an unknown value.
1730 ///
1731 /// Applications can examine the value using [ExecutionView::value] or
1732 /// [ExecutionView::name].
1733 UnknownValue(execution_view::UnknownValue),
1734}
1735
1736#[doc(hidden)]
1737pub mod execution_view {
1738 #[allow(unused_imports)]
1739 use super::*;
1740 #[derive(Clone, Debug, PartialEq)]
1741 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1742}
1743
1744impl ExecutionView {
1745 /// Gets the enum value.
1746 ///
1747 /// Returns `None` if the enum contains an unknown value deserialized from
1748 /// the string representation of enums.
1749 pub fn value(&self) -> std::option::Option<i32> {
1750 match self {
1751 Self::Unspecified => std::option::Option::Some(0),
1752 Self::Basic => std::option::Option::Some(1),
1753 Self::Full => std::option::Option::Some(2),
1754 Self::UnknownValue(u) => u.0.value(),
1755 }
1756 }
1757
1758 /// Gets the enum value as a string.
1759 ///
1760 /// Returns `None` if the enum contains an unknown value deserialized from
1761 /// the integer representation of enums.
1762 pub fn name(&self) -> std::option::Option<&str> {
1763 match self {
1764 Self::Unspecified => std::option::Option::Some("EXECUTION_VIEW_UNSPECIFIED"),
1765 Self::Basic => std::option::Option::Some("BASIC"),
1766 Self::Full => std::option::Option::Some("FULL"),
1767 Self::UnknownValue(u) => u.0.name(),
1768 }
1769 }
1770}
1771
1772impl std::default::Default for ExecutionView {
1773 fn default() -> Self {
1774 use std::convert::From;
1775 Self::from(0)
1776 }
1777}
1778
1779impl std::fmt::Display for ExecutionView {
1780 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1781 wkt::internal::display_enum(f, self.name(), self.value())
1782 }
1783}
1784
1785impl std::convert::From<i32> for ExecutionView {
1786 fn from(value: i32) -> Self {
1787 match value {
1788 0 => Self::Unspecified,
1789 1 => Self::Basic,
1790 2 => Self::Full,
1791 _ => Self::UnknownValue(execution_view::UnknownValue(
1792 wkt::internal::UnknownEnumValue::Integer(value),
1793 )),
1794 }
1795 }
1796}
1797
1798impl std::convert::From<&str> for ExecutionView {
1799 fn from(value: &str) -> Self {
1800 use std::string::ToString;
1801 match value {
1802 "EXECUTION_VIEW_UNSPECIFIED" => Self::Unspecified,
1803 "BASIC" => Self::Basic,
1804 "FULL" => Self::Full,
1805 _ => Self::UnknownValue(execution_view::UnknownValue(
1806 wkt::internal::UnknownEnumValue::String(value.to_string()),
1807 )),
1808 }
1809 }
1810}
1811
1812impl serde::ser::Serialize for ExecutionView {
1813 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1814 where
1815 S: serde::Serializer,
1816 {
1817 match self {
1818 Self::Unspecified => serializer.serialize_i32(0),
1819 Self::Basic => serializer.serialize_i32(1),
1820 Self::Full => serializer.serialize_i32(2),
1821 Self::UnknownValue(u) => u.0.serialize(serializer),
1822 }
1823 }
1824}
1825
1826impl<'de> serde::de::Deserialize<'de> for ExecutionView {
1827 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1828 where
1829 D: serde::Deserializer<'de>,
1830 {
1831 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionView>::new(
1832 ".google.cloud.workflows.executions.v1.ExecutionView",
1833 ))
1834 }
1835}