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