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