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