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