google_cloud_workflows_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#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::bare_urls)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_location;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Workflow program to be executed by Workflows.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Workflow {
44 /// The resource name of the workflow.
45 /// Format: projects/{project}/locations/{location}/workflows/{workflow}.
46 /// This is a workflow-wide field and is not tied to a specific revision.
47 pub name: std::string::String,
48
49 /// Description of the workflow provided by the user.
50 /// Must be at most 1000 Unicode characters long.
51 /// This is a workflow-wide field and is not tied to a specific revision.
52 pub description: std::string::String,
53
54 /// Output only. State of the workflow deployment.
55 pub state: crate::model::workflow::State,
56
57 /// Output only. The revision of the workflow.
58 /// A new revision of a workflow is created as a result of updating the
59 /// following properties of a workflow:
60 ///
61 /// - [Service account][google.cloud.workflows.v1.Workflow.service_account]
62 /// - [Workflow code to be
63 /// executed][google.cloud.workflows.v1.Workflow.source_contents]
64 ///
65 /// The format is "000001-a4d", where the first six characters define
66 /// the zero-padded revision ordinal number. They are followed by a hyphen and
67 /// three hexadecimal random characters.
68 ///
69 /// [google.cloud.workflows.v1.Workflow.service_account]: crate::model::Workflow::service_account
70 /// [google.cloud.workflows.v1.Workflow.source_contents]: crate::model::Workflow::source_code
71 pub revision_id: std::string::String,
72
73 /// Output only. The timestamp for when the workflow was created.
74 /// This is a workflow-wide field and is not tied to a specific revision.
75 pub create_time: std::option::Option<wkt::Timestamp>,
76
77 /// Output only. The timestamp for when the workflow was last updated.
78 /// This is a workflow-wide field and is not tied to a specific revision.
79 pub update_time: std::option::Option<wkt::Timestamp>,
80
81 /// Output only. The timestamp for the latest revision of the workflow's
82 /// creation.
83 pub revision_create_time: std::option::Option<wkt::Timestamp>,
84
85 /// Labels associated with this workflow.
86 /// Labels can contain at most 64 entries. Keys and values can be no longer
87 /// than 63 characters and can only contain lowercase letters, numeric
88 /// characters, underscores, and dashes. Label keys must start with a letter.
89 /// International characters are allowed.
90 /// This is a workflow-wide field and is not tied to a specific revision.
91 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
92
93 /// The service account associated with the latest workflow version.
94 /// This service account represents the identity of the workflow and determines
95 /// what permissions the workflow has.
96 /// Format: projects/{project}/serviceAccounts/{account} or {account}
97 ///
98 /// Using `-` as a wildcard for the `{project}` or not providing one at all
99 /// will infer the project from the account. The `{account}` value can be the
100 /// `email` address or the `unique_id` of the service account.
101 ///
102 /// If not provided, workflow will use the project's default service account.
103 /// Modifying this field for an existing workflow results in a new workflow
104 /// revision.
105 pub service_account: std::string::String,
106
107 /// Optional. The resource name of a KMS crypto key used to encrypt or decrypt
108 /// the data associated with the workflow.
109 ///
110 /// Format:
111 /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
112 ///
113 /// Using `-` as a wildcard for the `{project}` or not providing one at all
114 /// will infer the project from the account.
115 ///
116 /// If not provided, data associated with the workflow will not be
117 /// CMEK-encrypted.
118 pub crypto_key_name: std::string::String,
119
120 /// Output only. Error regarding the state of the workflow. For example, this
121 /// field will have error details if the execution data is unavailable due to
122 /// revoked KMS key permissions.
123 pub state_error: std::option::Option<crate::model::workflow::StateError>,
124
125 /// Optional. Describes the level of platform logging to apply to calls and
126 /// call responses during executions of this workflow. If both the workflow and
127 /// the execution specify a logging level, the execution level takes
128 /// precedence.
129 pub call_log_level: crate::model::workflow::CallLogLevel,
130
131 /// Optional. User-defined environment variables associated with this workflow
132 /// revision. This map has a maximum length of 20. Each string can take up to
133 /// 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or
134 /// "WORKFLOWS".
135 pub user_env_vars: std::collections::HashMap<std::string::String, std::string::String>,
136
137 /// Optional. Describes the execution history level to apply to this workflow.
138 pub execution_history_level: crate::model::ExecutionHistoryLevel,
139
140 /// Output only. A list of all KMS crypto keys used to encrypt or decrypt the
141 /// data associated with the workflow.
142 pub all_kms_keys: std::vec::Vec<std::string::String>,
143
144 /// Output only. A list of all KMS crypto key versions used to encrypt or
145 /// decrypt the data associated with the workflow.
146 pub all_kms_keys_versions: std::vec::Vec<std::string::String>,
147
148 /// Output only. The resource name of a KMS crypto key version used to encrypt
149 /// or decrypt the data associated with the workflow.
150 ///
151 /// Format:
152 /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}
153 pub crypto_key_version: std::string::String,
154
155 /// Optional. Input only. Immutable. Tags associated with this workflow.
156 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
157
158 /// Required. Location of the workflow source code.
159 /// Modifying this field for an existing workflow results in a new workflow
160 /// revision.
161 pub source_code: std::option::Option<crate::model::workflow::SourceCode>,
162
163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
164}
165
166impl Workflow {
167 /// Creates a new default instance.
168 pub fn new() -> Self {
169 std::default::Default::default()
170 }
171
172 /// Sets the value of [name][crate::model::Workflow::name].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_workflows_v1::model::Workflow;
177 /// # let project_id = "project_id";
178 /// # let location_id = "location_id";
179 /// # let workflow_id = "workflow_id";
180 /// let x = Workflow::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}"));
181 /// ```
182 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
183 self.name = v.into();
184 self
185 }
186
187 /// Sets the value of [description][crate::model::Workflow::description].
188 ///
189 /// # Example
190 /// ```ignore,no_run
191 /// # use google_cloud_workflows_v1::model::Workflow;
192 /// let x = Workflow::new().set_description("example");
193 /// ```
194 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
195 self.description = v.into();
196 self
197 }
198
199 /// Sets the value of [state][crate::model::Workflow::state].
200 ///
201 /// # Example
202 /// ```ignore,no_run
203 /// # use google_cloud_workflows_v1::model::Workflow;
204 /// use google_cloud_workflows_v1::model::workflow::State;
205 /// let x0 = Workflow::new().set_state(State::Active);
206 /// let x1 = Workflow::new().set_state(State::Unavailable);
207 /// ```
208 pub fn set_state<T: std::convert::Into<crate::model::workflow::State>>(mut self, v: T) -> Self {
209 self.state = v.into();
210 self
211 }
212
213 /// Sets the value of [revision_id][crate::model::Workflow::revision_id].
214 ///
215 /// # Example
216 /// ```ignore,no_run
217 /// # use google_cloud_workflows_v1::model::Workflow;
218 /// let x = Workflow::new().set_revision_id("example");
219 /// ```
220 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
221 self.revision_id = v.into();
222 self
223 }
224
225 /// Sets the value of [create_time][crate::model::Workflow::create_time].
226 ///
227 /// # Example
228 /// ```ignore,no_run
229 /// # use google_cloud_workflows_v1::model::Workflow;
230 /// use wkt::Timestamp;
231 /// let x = Workflow::new().set_create_time(Timestamp::default()/* use setters */);
232 /// ```
233 pub fn set_create_time<T>(mut self, v: T) -> Self
234 where
235 T: std::convert::Into<wkt::Timestamp>,
236 {
237 self.create_time = std::option::Option::Some(v.into());
238 self
239 }
240
241 /// Sets or clears the value of [create_time][crate::model::Workflow::create_time].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_workflows_v1::model::Workflow;
246 /// use wkt::Timestamp;
247 /// let x = Workflow::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
248 /// let x = Workflow::new().set_or_clear_create_time(None::<Timestamp>);
249 /// ```
250 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
251 where
252 T: std::convert::Into<wkt::Timestamp>,
253 {
254 self.create_time = v.map(|x| x.into());
255 self
256 }
257
258 /// Sets the value of [update_time][crate::model::Workflow::update_time].
259 ///
260 /// # Example
261 /// ```ignore,no_run
262 /// # use google_cloud_workflows_v1::model::Workflow;
263 /// use wkt::Timestamp;
264 /// let x = Workflow::new().set_update_time(Timestamp::default()/* use setters */);
265 /// ```
266 pub fn set_update_time<T>(mut self, v: T) -> Self
267 where
268 T: std::convert::Into<wkt::Timestamp>,
269 {
270 self.update_time = std::option::Option::Some(v.into());
271 self
272 }
273
274 /// Sets or clears the value of [update_time][crate::model::Workflow::update_time].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_workflows_v1::model::Workflow;
279 /// use wkt::Timestamp;
280 /// let x = Workflow::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
281 /// let x = Workflow::new().set_or_clear_update_time(None::<Timestamp>);
282 /// ```
283 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
284 where
285 T: std::convert::Into<wkt::Timestamp>,
286 {
287 self.update_time = v.map(|x| x.into());
288 self
289 }
290
291 /// Sets the value of [revision_create_time][crate::model::Workflow::revision_create_time].
292 ///
293 /// # Example
294 /// ```ignore,no_run
295 /// # use google_cloud_workflows_v1::model::Workflow;
296 /// use wkt::Timestamp;
297 /// let x = Workflow::new().set_revision_create_time(Timestamp::default()/* use setters */);
298 /// ```
299 pub fn set_revision_create_time<T>(mut self, v: T) -> Self
300 where
301 T: std::convert::Into<wkt::Timestamp>,
302 {
303 self.revision_create_time = std::option::Option::Some(v.into());
304 self
305 }
306
307 /// Sets or clears the value of [revision_create_time][crate::model::Workflow::revision_create_time].
308 ///
309 /// # Example
310 /// ```ignore,no_run
311 /// # use google_cloud_workflows_v1::model::Workflow;
312 /// use wkt::Timestamp;
313 /// let x = Workflow::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
314 /// let x = Workflow::new().set_or_clear_revision_create_time(None::<Timestamp>);
315 /// ```
316 pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
317 where
318 T: std::convert::Into<wkt::Timestamp>,
319 {
320 self.revision_create_time = v.map(|x| x.into());
321 self
322 }
323
324 /// Sets the value of [labels][crate::model::Workflow::labels].
325 ///
326 /// # Example
327 /// ```ignore,no_run
328 /// # use google_cloud_workflows_v1::model::Workflow;
329 /// let x = Workflow::new().set_labels([
330 /// ("key0", "abc"),
331 /// ("key1", "xyz"),
332 /// ]);
333 /// ```
334 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
335 where
336 T: std::iter::IntoIterator<Item = (K, V)>,
337 K: std::convert::Into<std::string::String>,
338 V: std::convert::Into<std::string::String>,
339 {
340 use std::iter::Iterator;
341 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
342 self
343 }
344
345 /// Sets the value of [service_account][crate::model::Workflow::service_account].
346 ///
347 /// # Example
348 /// ```ignore,no_run
349 /// # use google_cloud_workflows_v1::model::Workflow;
350 /// let x = Workflow::new().set_service_account("example");
351 /// ```
352 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
353 self.service_account = v.into();
354 self
355 }
356
357 /// Sets the value of [crypto_key_name][crate::model::Workflow::crypto_key_name].
358 ///
359 /// # Example
360 /// ```ignore,no_run
361 /// # use google_cloud_workflows_v1::model::Workflow;
362 /// let x = Workflow::new().set_crypto_key_name("example");
363 /// ```
364 pub fn set_crypto_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
365 self.crypto_key_name = v.into();
366 self
367 }
368
369 /// Sets the value of [state_error][crate::model::Workflow::state_error].
370 ///
371 /// # Example
372 /// ```ignore,no_run
373 /// # use google_cloud_workflows_v1::model::Workflow;
374 /// use google_cloud_workflows_v1::model::workflow::StateError;
375 /// let x = Workflow::new().set_state_error(StateError::default()/* use setters */);
376 /// ```
377 pub fn set_state_error<T>(mut self, v: T) -> Self
378 where
379 T: std::convert::Into<crate::model::workflow::StateError>,
380 {
381 self.state_error = std::option::Option::Some(v.into());
382 self
383 }
384
385 /// Sets or clears the value of [state_error][crate::model::Workflow::state_error].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_workflows_v1::model::Workflow;
390 /// use google_cloud_workflows_v1::model::workflow::StateError;
391 /// let x = Workflow::new().set_or_clear_state_error(Some(StateError::default()/* use setters */));
392 /// let x = Workflow::new().set_or_clear_state_error(None::<StateError>);
393 /// ```
394 pub fn set_or_clear_state_error<T>(mut self, v: std::option::Option<T>) -> Self
395 where
396 T: std::convert::Into<crate::model::workflow::StateError>,
397 {
398 self.state_error = v.map(|x| x.into());
399 self
400 }
401
402 /// Sets the value of [call_log_level][crate::model::Workflow::call_log_level].
403 ///
404 /// # Example
405 /// ```ignore,no_run
406 /// # use google_cloud_workflows_v1::model::Workflow;
407 /// use google_cloud_workflows_v1::model::workflow::CallLogLevel;
408 /// let x0 = Workflow::new().set_call_log_level(CallLogLevel::LogAllCalls);
409 /// let x1 = Workflow::new().set_call_log_level(CallLogLevel::LogErrorsOnly);
410 /// let x2 = Workflow::new().set_call_log_level(CallLogLevel::LogNone);
411 /// ```
412 pub fn set_call_log_level<T: std::convert::Into<crate::model::workflow::CallLogLevel>>(
413 mut self,
414 v: T,
415 ) -> Self {
416 self.call_log_level = v.into();
417 self
418 }
419
420 /// Sets the value of [user_env_vars][crate::model::Workflow::user_env_vars].
421 ///
422 /// # Example
423 /// ```ignore,no_run
424 /// # use google_cloud_workflows_v1::model::Workflow;
425 /// let x = Workflow::new().set_user_env_vars([
426 /// ("key0", "abc"),
427 /// ("key1", "xyz"),
428 /// ]);
429 /// ```
430 pub fn set_user_env_vars<T, K, V>(mut self, v: T) -> Self
431 where
432 T: std::iter::IntoIterator<Item = (K, V)>,
433 K: std::convert::Into<std::string::String>,
434 V: std::convert::Into<std::string::String>,
435 {
436 use std::iter::Iterator;
437 self.user_env_vars = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
438 self
439 }
440
441 /// Sets the value of [execution_history_level][crate::model::Workflow::execution_history_level].
442 ///
443 /// # Example
444 /// ```ignore,no_run
445 /// # use google_cloud_workflows_v1::model::Workflow;
446 /// use google_cloud_workflows_v1::model::ExecutionHistoryLevel;
447 /// let x0 = Workflow::new().set_execution_history_level(ExecutionHistoryLevel::ExecutionHistoryBasic);
448 /// let x1 = Workflow::new().set_execution_history_level(ExecutionHistoryLevel::ExecutionHistoryDetailed);
449 /// ```
450 pub fn set_execution_history_level<
451 T: std::convert::Into<crate::model::ExecutionHistoryLevel>,
452 >(
453 mut self,
454 v: T,
455 ) -> Self {
456 self.execution_history_level = v.into();
457 self
458 }
459
460 /// Sets the value of [all_kms_keys][crate::model::Workflow::all_kms_keys].
461 ///
462 /// # Example
463 /// ```ignore,no_run
464 /// # use google_cloud_workflows_v1::model::Workflow;
465 /// let x = Workflow::new().set_all_kms_keys(["a", "b", "c"]);
466 /// ```
467 pub fn set_all_kms_keys<T, V>(mut self, v: T) -> Self
468 where
469 T: std::iter::IntoIterator<Item = V>,
470 V: std::convert::Into<std::string::String>,
471 {
472 use std::iter::Iterator;
473 self.all_kms_keys = v.into_iter().map(|i| i.into()).collect();
474 self
475 }
476
477 /// Sets the value of [all_kms_keys_versions][crate::model::Workflow::all_kms_keys_versions].
478 ///
479 /// # Example
480 /// ```ignore,no_run
481 /// # use google_cloud_workflows_v1::model::Workflow;
482 /// let x = Workflow::new().set_all_kms_keys_versions(["a", "b", "c"]);
483 /// ```
484 pub fn set_all_kms_keys_versions<T, V>(mut self, v: T) -> Self
485 where
486 T: std::iter::IntoIterator<Item = V>,
487 V: std::convert::Into<std::string::String>,
488 {
489 use std::iter::Iterator;
490 self.all_kms_keys_versions = v.into_iter().map(|i| i.into()).collect();
491 self
492 }
493
494 /// Sets the value of [crypto_key_version][crate::model::Workflow::crypto_key_version].
495 ///
496 /// # Example
497 /// ```ignore,no_run
498 /// # use google_cloud_workflows_v1::model::Workflow;
499 /// let x = Workflow::new().set_crypto_key_version("example");
500 /// ```
501 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
502 mut self,
503 v: T,
504 ) -> Self {
505 self.crypto_key_version = v.into();
506 self
507 }
508
509 /// Sets the value of [tags][crate::model::Workflow::tags].
510 ///
511 /// # Example
512 /// ```ignore,no_run
513 /// # use google_cloud_workflows_v1::model::Workflow;
514 /// let x = Workflow::new().set_tags([
515 /// ("key0", "abc"),
516 /// ("key1", "xyz"),
517 /// ]);
518 /// ```
519 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
520 where
521 T: std::iter::IntoIterator<Item = (K, V)>,
522 K: std::convert::Into<std::string::String>,
523 V: std::convert::Into<std::string::String>,
524 {
525 use std::iter::Iterator;
526 self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
527 self
528 }
529
530 /// Sets the value of [source_code][crate::model::Workflow::source_code].
531 ///
532 /// Note that all the setters affecting `source_code` are mutually
533 /// exclusive.
534 ///
535 /// # Example
536 /// ```ignore,no_run
537 /// # use google_cloud_workflows_v1::model::Workflow;
538 /// use google_cloud_workflows_v1::model::workflow::SourceCode;
539 /// let x = Workflow::new().set_source_code(Some(SourceCode::SourceContents("example".to_string())));
540 /// ```
541 pub fn set_source_code<
542 T: std::convert::Into<std::option::Option<crate::model::workflow::SourceCode>>,
543 >(
544 mut self,
545 v: T,
546 ) -> Self {
547 self.source_code = v.into();
548 self
549 }
550
551 /// The value of [source_code][crate::model::Workflow::source_code]
552 /// if it holds a `SourceContents`, `None` if the field is not set or
553 /// holds a different branch.
554 pub fn source_contents(&self) -> std::option::Option<&std::string::String> {
555 #[allow(unreachable_patterns)]
556 self.source_code.as_ref().and_then(|v| match v {
557 crate::model::workflow::SourceCode::SourceContents(v) => std::option::Option::Some(v),
558 _ => std::option::Option::None,
559 })
560 }
561
562 /// Sets the value of [source_code][crate::model::Workflow::source_code]
563 /// to hold a `SourceContents`.
564 ///
565 /// Note that all the setters affecting `source_code` are
566 /// mutually exclusive.
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_workflows_v1::model::Workflow;
571 /// let x = Workflow::new().set_source_contents("example");
572 /// assert!(x.source_contents().is_some());
573 /// ```
574 pub fn set_source_contents<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
575 self.source_code =
576 std::option::Option::Some(crate::model::workflow::SourceCode::SourceContents(v.into()));
577 self
578 }
579}
580
581impl wkt::message::Message for Workflow {
582 fn typename() -> &'static str {
583 "type.googleapis.com/google.cloud.workflows.v1.Workflow"
584 }
585}
586
587/// Defines additional types related to [Workflow].
588pub mod workflow {
589 #[allow(unused_imports)]
590 use super::*;
591
592 /// Describes an error related to the current state of the workflow.
593 #[derive(Clone, Default, PartialEq)]
594 #[non_exhaustive]
595 pub struct StateError {
596 /// Provides specifics about the error.
597 pub details: std::string::String,
598
599 /// The type of this state error.
600 pub r#type: crate::model::workflow::state_error::Type,
601
602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
603 }
604
605 impl StateError {
606 /// Creates a new default instance.
607 pub fn new() -> Self {
608 std::default::Default::default()
609 }
610
611 /// Sets the value of [details][crate::model::workflow::StateError::details].
612 ///
613 /// # Example
614 /// ```ignore,no_run
615 /// # use google_cloud_workflows_v1::model::workflow::StateError;
616 /// let x = StateError::new().set_details("example");
617 /// ```
618 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
619 self.details = v.into();
620 self
621 }
622
623 /// Sets the value of [r#type][crate::model::workflow::StateError::type].
624 ///
625 /// # Example
626 /// ```ignore,no_run
627 /// # use google_cloud_workflows_v1::model::workflow::StateError;
628 /// use google_cloud_workflows_v1::model::workflow::state_error::Type;
629 /// let x0 = StateError::new().set_type(Type::KmsError);
630 /// ```
631 pub fn set_type<T: std::convert::Into<crate::model::workflow::state_error::Type>>(
632 mut self,
633 v: T,
634 ) -> Self {
635 self.r#type = v.into();
636 self
637 }
638 }
639
640 impl wkt::message::Message for StateError {
641 fn typename() -> &'static str {
642 "type.googleapis.com/google.cloud.workflows.v1.Workflow.StateError"
643 }
644 }
645
646 /// Defines additional types related to [StateError].
647 pub mod state_error {
648 #[allow(unused_imports)]
649 use super::*;
650
651 /// Describes the possibled types of a state error.
652 ///
653 /// # Working with unknown values
654 ///
655 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
656 /// additional enum variants at any time. Adding new variants is not considered
657 /// a breaking change. Applications should write their code in anticipation of:
658 ///
659 /// - New values appearing in future releases of the client library, **and**
660 /// - New values received dynamically, without application changes.
661 ///
662 /// Please consult the [Working with enums] section in the user guide for some
663 /// guidelines.
664 ///
665 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
666 #[derive(Clone, Debug, PartialEq)]
667 #[non_exhaustive]
668 pub enum Type {
669 /// No type specified.
670 Unspecified,
671 /// Caused by an issue with KMS.
672 KmsError,
673 /// If set, the enum was initialized with an unknown value.
674 ///
675 /// Applications can examine the value using [Type::value] or
676 /// [Type::name].
677 UnknownValue(r#type::UnknownValue),
678 }
679
680 #[doc(hidden)]
681 pub mod r#type {
682 #[allow(unused_imports)]
683 use super::*;
684 #[derive(Clone, Debug, PartialEq)]
685 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
686 }
687
688 impl Type {
689 /// Gets the enum value.
690 ///
691 /// Returns `None` if the enum contains an unknown value deserialized from
692 /// the string representation of enums.
693 pub fn value(&self) -> std::option::Option<i32> {
694 match self {
695 Self::Unspecified => std::option::Option::Some(0),
696 Self::KmsError => std::option::Option::Some(1),
697 Self::UnknownValue(u) => u.0.value(),
698 }
699 }
700
701 /// Gets the enum value as a string.
702 ///
703 /// Returns `None` if the enum contains an unknown value deserialized from
704 /// the integer representation of enums.
705 pub fn name(&self) -> std::option::Option<&str> {
706 match self {
707 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
708 Self::KmsError => std::option::Option::Some("KMS_ERROR"),
709 Self::UnknownValue(u) => u.0.name(),
710 }
711 }
712 }
713
714 impl std::default::Default for Type {
715 fn default() -> Self {
716 use std::convert::From;
717 Self::from(0)
718 }
719 }
720
721 impl std::fmt::Display for Type {
722 fn fmt(
723 &self,
724 f: &mut std::fmt::Formatter<'_>,
725 ) -> std::result::Result<(), std::fmt::Error> {
726 wkt::internal::display_enum(f, self.name(), self.value())
727 }
728 }
729
730 impl std::convert::From<i32> for Type {
731 fn from(value: i32) -> Self {
732 match value {
733 0 => Self::Unspecified,
734 1 => Self::KmsError,
735 _ => Self::UnknownValue(r#type::UnknownValue(
736 wkt::internal::UnknownEnumValue::Integer(value),
737 )),
738 }
739 }
740 }
741
742 impl std::convert::From<&str> for Type {
743 fn from(value: &str) -> Self {
744 use std::string::ToString;
745 match value {
746 "TYPE_UNSPECIFIED" => Self::Unspecified,
747 "KMS_ERROR" => Self::KmsError,
748 _ => Self::UnknownValue(r#type::UnknownValue(
749 wkt::internal::UnknownEnumValue::String(value.to_string()),
750 )),
751 }
752 }
753 }
754
755 impl serde::ser::Serialize for Type {
756 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
757 where
758 S: serde::Serializer,
759 {
760 match self {
761 Self::Unspecified => serializer.serialize_i32(0),
762 Self::KmsError => serializer.serialize_i32(1),
763 Self::UnknownValue(u) => u.0.serialize(serializer),
764 }
765 }
766 }
767
768 impl<'de> serde::de::Deserialize<'de> for Type {
769 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
770 where
771 D: serde::Deserializer<'de>,
772 {
773 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
774 ".google.cloud.workflows.v1.Workflow.StateError.Type",
775 ))
776 }
777 }
778 }
779
780 /// Describes the current state of workflow deployment.
781 ///
782 /// # Working with unknown values
783 ///
784 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
785 /// additional enum variants at any time. Adding new variants is not considered
786 /// a breaking change. Applications should write their code in anticipation of:
787 ///
788 /// - New values appearing in future releases of the client library, **and**
789 /// - New values received dynamically, without application changes.
790 ///
791 /// Please consult the [Working with enums] section in the user guide for some
792 /// guidelines.
793 ///
794 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
795 #[derive(Clone, Debug, PartialEq)]
796 #[non_exhaustive]
797 pub enum State {
798 /// Invalid state.
799 Unspecified,
800 /// The workflow has been deployed successfully and is serving.
801 Active,
802 /// Workflow data is unavailable. See the `state_error` field.
803 Unavailable,
804 /// If set, the enum was initialized with an unknown value.
805 ///
806 /// Applications can examine the value using [State::value] or
807 /// [State::name].
808 UnknownValue(state::UnknownValue),
809 }
810
811 #[doc(hidden)]
812 pub mod state {
813 #[allow(unused_imports)]
814 use super::*;
815 #[derive(Clone, Debug, PartialEq)]
816 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
817 }
818
819 impl State {
820 /// Gets the enum value.
821 ///
822 /// Returns `None` if the enum contains an unknown value deserialized from
823 /// the string representation of enums.
824 pub fn value(&self) -> std::option::Option<i32> {
825 match self {
826 Self::Unspecified => std::option::Option::Some(0),
827 Self::Active => std::option::Option::Some(1),
828 Self::Unavailable => std::option::Option::Some(2),
829 Self::UnknownValue(u) => u.0.value(),
830 }
831 }
832
833 /// Gets the enum value as a string.
834 ///
835 /// Returns `None` if the enum contains an unknown value deserialized from
836 /// the integer representation of enums.
837 pub fn name(&self) -> std::option::Option<&str> {
838 match self {
839 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
840 Self::Active => std::option::Option::Some("ACTIVE"),
841 Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
842 Self::UnknownValue(u) => u.0.name(),
843 }
844 }
845 }
846
847 impl std::default::Default for State {
848 fn default() -> Self {
849 use std::convert::From;
850 Self::from(0)
851 }
852 }
853
854 impl std::fmt::Display for State {
855 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
856 wkt::internal::display_enum(f, self.name(), self.value())
857 }
858 }
859
860 impl std::convert::From<i32> for State {
861 fn from(value: i32) -> Self {
862 match value {
863 0 => Self::Unspecified,
864 1 => Self::Active,
865 2 => Self::Unavailable,
866 _ => Self::UnknownValue(state::UnknownValue(
867 wkt::internal::UnknownEnumValue::Integer(value),
868 )),
869 }
870 }
871 }
872
873 impl std::convert::From<&str> for State {
874 fn from(value: &str) -> Self {
875 use std::string::ToString;
876 match value {
877 "STATE_UNSPECIFIED" => Self::Unspecified,
878 "ACTIVE" => Self::Active,
879 "UNAVAILABLE" => Self::Unavailable,
880 _ => Self::UnknownValue(state::UnknownValue(
881 wkt::internal::UnknownEnumValue::String(value.to_string()),
882 )),
883 }
884 }
885 }
886
887 impl serde::ser::Serialize for State {
888 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
889 where
890 S: serde::Serializer,
891 {
892 match self {
893 Self::Unspecified => serializer.serialize_i32(0),
894 Self::Active => serializer.serialize_i32(1),
895 Self::Unavailable => serializer.serialize_i32(2),
896 Self::UnknownValue(u) => u.0.serialize(serializer),
897 }
898 }
899 }
900
901 impl<'de> serde::de::Deserialize<'de> for State {
902 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
903 where
904 D: serde::Deserializer<'de>,
905 {
906 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
907 ".google.cloud.workflows.v1.Workflow.State",
908 ))
909 }
910 }
911
912 /// Describes the level of platform logging to apply to calls and call
913 /// responses during workflow executions.
914 ///
915 /// # Working with unknown values
916 ///
917 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
918 /// additional enum variants at any time. Adding new variants is not considered
919 /// a breaking change. Applications should write their code in anticipation of:
920 ///
921 /// - New values appearing in future releases of the client library, **and**
922 /// - New values received dynamically, without application changes.
923 ///
924 /// Please consult the [Working with enums] section in the user guide for some
925 /// guidelines.
926 ///
927 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
928 #[derive(Clone, Debug, PartialEq)]
929 #[non_exhaustive]
930 pub enum CallLogLevel {
931 /// No call logging level specified.
932 Unspecified,
933 /// Log all call steps within workflows, all call returns, and all exceptions
934 /// raised.
935 LogAllCalls,
936 /// Log only exceptions that are raised from call steps within workflows.
937 LogErrorsOnly,
938 /// Explicitly log nothing.
939 LogNone,
940 /// If set, the enum was initialized with an unknown value.
941 ///
942 /// Applications can examine the value using [CallLogLevel::value] or
943 /// [CallLogLevel::name].
944 UnknownValue(call_log_level::UnknownValue),
945 }
946
947 #[doc(hidden)]
948 pub mod call_log_level {
949 #[allow(unused_imports)]
950 use super::*;
951 #[derive(Clone, Debug, PartialEq)]
952 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
953 }
954
955 impl CallLogLevel {
956 /// Gets the enum value.
957 ///
958 /// Returns `None` if the enum contains an unknown value deserialized from
959 /// the string representation of enums.
960 pub fn value(&self) -> std::option::Option<i32> {
961 match self {
962 Self::Unspecified => std::option::Option::Some(0),
963 Self::LogAllCalls => std::option::Option::Some(1),
964 Self::LogErrorsOnly => std::option::Option::Some(2),
965 Self::LogNone => std::option::Option::Some(3),
966 Self::UnknownValue(u) => u.0.value(),
967 }
968 }
969
970 /// Gets the enum value as a string.
971 ///
972 /// Returns `None` if the enum contains an unknown value deserialized from
973 /// the integer representation of enums.
974 pub fn name(&self) -> std::option::Option<&str> {
975 match self {
976 Self::Unspecified => std::option::Option::Some("CALL_LOG_LEVEL_UNSPECIFIED"),
977 Self::LogAllCalls => std::option::Option::Some("LOG_ALL_CALLS"),
978 Self::LogErrorsOnly => std::option::Option::Some("LOG_ERRORS_ONLY"),
979 Self::LogNone => std::option::Option::Some("LOG_NONE"),
980 Self::UnknownValue(u) => u.0.name(),
981 }
982 }
983 }
984
985 impl std::default::Default for CallLogLevel {
986 fn default() -> Self {
987 use std::convert::From;
988 Self::from(0)
989 }
990 }
991
992 impl std::fmt::Display for CallLogLevel {
993 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
994 wkt::internal::display_enum(f, self.name(), self.value())
995 }
996 }
997
998 impl std::convert::From<i32> for CallLogLevel {
999 fn from(value: i32) -> Self {
1000 match value {
1001 0 => Self::Unspecified,
1002 1 => Self::LogAllCalls,
1003 2 => Self::LogErrorsOnly,
1004 3 => Self::LogNone,
1005 _ => Self::UnknownValue(call_log_level::UnknownValue(
1006 wkt::internal::UnknownEnumValue::Integer(value),
1007 )),
1008 }
1009 }
1010 }
1011
1012 impl std::convert::From<&str> for CallLogLevel {
1013 fn from(value: &str) -> Self {
1014 use std::string::ToString;
1015 match value {
1016 "CALL_LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
1017 "LOG_ALL_CALLS" => Self::LogAllCalls,
1018 "LOG_ERRORS_ONLY" => Self::LogErrorsOnly,
1019 "LOG_NONE" => Self::LogNone,
1020 _ => Self::UnknownValue(call_log_level::UnknownValue(
1021 wkt::internal::UnknownEnumValue::String(value.to_string()),
1022 )),
1023 }
1024 }
1025 }
1026
1027 impl serde::ser::Serialize for CallLogLevel {
1028 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1029 where
1030 S: serde::Serializer,
1031 {
1032 match self {
1033 Self::Unspecified => serializer.serialize_i32(0),
1034 Self::LogAllCalls => serializer.serialize_i32(1),
1035 Self::LogErrorsOnly => serializer.serialize_i32(2),
1036 Self::LogNone => serializer.serialize_i32(3),
1037 Self::UnknownValue(u) => u.0.serialize(serializer),
1038 }
1039 }
1040 }
1041
1042 impl<'de> serde::de::Deserialize<'de> for CallLogLevel {
1043 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1044 where
1045 D: serde::Deserializer<'de>,
1046 {
1047 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CallLogLevel>::new(
1048 ".google.cloud.workflows.v1.Workflow.CallLogLevel",
1049 ))
1050 }
1051 }
1052
1053 /// Required. Location of the workflow source code.
1054 /// Modifying this field for an existing workflow results in a new workflow
1055 /// revision.
1056 #[derive(Clone, Debug, PartialEq)]
1057 #[non_exhaustive]
1058 pub enum SourceCode {
1059 /// Workflow code to be executed. The size limit is 128KB.
1060 SourceContents(std::string::String),
1061 }
1062}
1063
1064/// Request for the
1065/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
1066/// method.
1067///
1068/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
1069#[derive(Clone, Default, PartialEq)]
1070#[non_exhaustive]
1071pub struct ListWorkflowsRequest {
1072 /// Required. Project and location from which the workflows should be listed.
1073 /// Format: projects/{project}/locations/{location}
1074 pub parent: std::string::String,
1075
1076 /// Maximum number of workflows to return per call. The service might return
1077 /// fewer than this value even if not at the end of the collection. If a value
1078 /// is not specified, a default value of 500 is used. The maximum permitted
1079 /// value is 1000 and values greater than 1000 are coerced down to 1000.
1080 pub page_size: i32,
1081
1082 /// A page token, received from a previous `ListWorkflows` call.
1083 /// Provide this to retrieve the subsequent page.
1084 ///
1085 /// When paginating, all other parameters provided to `ListWorkflows` must
1086 /// match the call that provided the page token.
1087 pub page_token: std::string::String,
1088
1089 /// Filter to restrict results to specific workflows.
1090 /// For details, see <a href="https://google.aip.dev/160"
1091 /// class="external"\>AIP-160</a>.
1092 ///
1093 /// For example, if you are using the Google APIs Explorer:
1094 ///
1095 /// `state="SUCCEEDED"`
1096 ///
1097 /// or
1098 ///
1099 /// `createTime>"2023-08-01" AND state="FAILED"`
1100 pub filter: std::string::String,
1101
1102 /// Comma-separated list of fields that specify the order of the results.
1103 /// Default sorting order for a field is ascending. To specify descending order
1104 /// for a field, append a "desc" suffix.
1105 /// If not specified, the results are returned in an unspecified order.
1106 pub order_by: std::string::String,
1107
1108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1109}
1110
1111impl ListWorkflowsRequest {
1112 /// Creates a new default instance.
1113 pub fn new() -> Self {
1114 std::default::Default::default()
1115 }
1116
1117 /// Sets the value of [parent][crate::model::ListWorkflowsRequest::parent].
1118 ///
1119 /// # Example
1120 /// ```ignore,no_run
1121 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1122 /// let x = ListWorkflowsRequest::new().set_parent("example");
1123 /// ```
1124 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1125 self.parent = v.into();
1126 self
1127 }
1128
1129 /// Sets the value of [page_size][crate::model::ListWorkflowsRequest::page_size].
1130 ///
1131 /// # Example
1132 /// ```ignore,no_run
1133 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1134 /// let x = ListWorkflowsRequest::new().set_page_size(42);
1135 /// ```
1136 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1137 self.page_size = v.into();
1138 self
1139 }
1140
1141 /// Sets the value of [page_token][crate::model::ListWorkflowsRequest::page_token].
1142 ///
1143 /// # Example
1144 /// ```ignore,no_run
1145 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1146 /// let x = ListWorkflowsRequest::new().set_page_token("example");
1147 /// ```
1148 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1149 self.page_token = v.into();
1150 self
1151 }
1152
1153 /// Sets the value of [filter][crate::model::ListWorkflowsRequest::filter].
1154 ///
1155 /// # Example
1156 /// ```ignore,no_run
1157 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1158 /// let x = ListWorkflowsRequest::new().set_filter("example");
1159 /// ```
1160 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1161 self.filter = v.into();
1162 self
1163 }
1164
1165 /// Sets the value of [order_by][crate::model::ListWorkflowsRequest::order_by].
1166 ///
1167 /// # Example
1168 /// ```ignore,no_run
1169 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1170 /// let x = ListWorkflowsRequest::new().set_order_by("example");
1171 /// ```
1172 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1173 self.order_by = v.into();
1174 self
1175 }
1176}
1177
1178impl wkt::message::Message for ListWorkflowsRequest {
1179 fn typename() -> &'static str {
1180 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsRequest"
1181 }
1182}
1183
1184/// Response for the
1185/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
1186/// method.
1187///
1188/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
1189#[derive(Clone, Default, PartialEq)]
1190#[non_exhaustive]
1191pub struct ListWorkflowsResponse {
1192 /// The workflows that match the request.
1193 pub workflows: std::vec::Vec<crate::model::Workflow>,
1194
1195 /// A token, which can be sent as `page_token` to retrieve the next page.
1196 /// If this field is omitted, there are no subsequent pages.
1197 pub next_page_token: std::string::String,
1198
1199 /// Unreachable resources.
1200 pub unreachable: std::vec::Vec<std::string::String>,
1201
1202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203}
1204
1205impl ListWorkflowsResponse {
1206 /// Creates a new default instance.
1207 pub fn new() -> Self {
1208 std::default::Default::default()
1209 }
1210
1211 /// Sets the value of [workflows][crate::model::ListWorkflowsResponse::workflows].
1212 ///
1213 /// # Example
1214 /// ```ignore,no_run
1215 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1216 /// use google_cloud_workflows_v1::model::Workflow;
1217 /// let x = ListWorkflowsResponse::new()
1218 /// .set_workflows([
1219 /// Workflow::default()/* use setters */,
1220 /// Workflow::default()/* use (different) setters */,
1221 /// ]);
1222 /// ```
1223 pub fn set_workflows<T, V>(mut self, v: T) -> Self
1224 where
1225 T: std::iter::IntoIterator<Item = V>,
1226 V: std::convert::Into<crate::model::Workflow>,
1227 {
1228 use std::iter::Iterator;
1229 self.workflows = v.into_iter().map(|i| i.into()).collect();
1230 self
1231 }
1232
1233 /// Sets the value of [next_page_token][crate::model::ListWorkflowsResponse::next_page_token].
1234 ///
1235 /// # Example
1236 /// ```ignore,no_run
1237 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1238 /// let x = ListWorkflowsResponse::new().set_next_page_token("example");
1239 /// ```
1240 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1241 self.next_page_token = v.into();
1242 self
1243 }
1244
1245 /// Sets the value of [unreachable][crate::model::ListWorkflowsResponse::unreachable].
1246 ///
1247 /// # Example
1248 /// ```ignore,no_run
1249 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1250 /// let x = ListWorkflowsResponse::new().set_unreachable(["a", "b", "c"]);
1251 /// ```
1252 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1253 where
1254 T: std::iter::IntoIterator<Item = V>,
1255 V: std::convert::Into<std::string::String>,
1256 {
1257 use std::iter::Iterator;
1258 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1259 self
1260 }
1261}
1262
1263impl wkt::message::Message for ListWorkflowsResponse {
1264 fn typename() -> &'static str {
1265 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsResponse"
1266 }
1267}
1268
1269#[doc(hidden)]
1270impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowsResponse {
1271 type PageItem = crate::model::Workflow;
1272
1273 fn items(self) -> std::vec::Vec<Self::PageItem> {
1274 self.workflows
1275 }
1276
1277 fn next_page_token(&self) -> std::string::String {
1278 use std::clone::Clone;
1279 self.next_page_token.clone()
1280 }
1281}
1282
1283/// Request for the
1284/// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
1285///
1286/// [google.cloud.workflows.v1.Workflows.GetWorkflow]: crate::client::Workflows::get_workflow
1287#[derive(Clone, Default, PartialEq)]
1288#[non_exhaustive]
1289pub struct GetWorkflowRequest {
1290 /// Required. Name of the workflow for which information should be retrieved.
1291 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1292 pub name: std::string::String,
1293
1294 /// Optional. The revision of the workflow to retrieve. If the revision_id is
1295 /// empty, the latest revision is retrieved.
1296 /// The format is "000001-a4d", where the first six characters define
1297 /// the zero-padded decimal revision number. They are followed by a hyphen and
1298 /// three hexadecimal characters.
1299 pub revision_id: std::string::String,
1300
1301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1302}
1303
1304impl GetWorkflowRequest {
1305 /// Creates a new default instance.
1306 pub fn new() -> Self {
1307 std::default::Default::default()
1308 }
1309
1310 /// Sets the value of [name][crate::model::GetWorkflowRequest::name].
1311 ///
1312 /// # Example
1313 /// ```ignore,no_run
1314 /// # use google_cloud_workflows_v1::model::GetWorkflowRequest;
1315 /// # let project_id = "project_id";
1316 /// # let location_id = "location_id";
1317 /// # let workflow_id = "workflow_id";
1318 /// let x = GetWorkflowRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}"));
1319 /// ```
1320 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1321 self.name = v.into();
1322 self
1323 }
1324
1325 /// Sets the value of [revision_id][crate::model::GetWorkflowRequest::revision_id].
1326 ///
1327 /// # Example
1328 /// ```ignore,no_run
1329 /// # use google_cloud_workflows_v1::model::GetWorkflowRequest;
1330 /// let x = GetWorkflowRequest::new().set_revision_id("example");
1331 /// ```
1332 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1333 self.revision_id = v.into();
1334 self
1335 }
1336}
1337
1338impl wkt::message::Message for GetWorkflowRequest {
1339 fn typename() -> &'static str {
1340 "type.googleapis.com/google.cloud.workflows.v1.GetWorkflowRequest"
1341 }
1342}
1343
1344/// Request for the
1345/// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
1346/// method.
1347///
1348/// [google.cloud.workflows.v1.Workflows.CreateWorkflow]: crate::client::Workflows::create_workflow
1349#[derive(Clone, Default, PartialEq)]
1350#[non_exhaustive]
1351pub struct CreateWorkflowRequest {
1352 /// Required. Project and location in which the workflow should be created.
1353 /// Format: projects/{project}/locations/{location}
1354 pub parent: std::string::String,
1355
1356 /// Required. Workflow to be created.
1357 pub workflow: std::option::Option<crate::model::Workflow>,
1358
1359 /// Required. The ID of the workflow to be created. It has to fulfill the
1360 /// following requirements:
1361 ///
1362 /// * Must contain only letters, numbers, underscores and hyphens.
1363 /// * Must start with a letter.
1364 /// * Must be between 1-64 characters.
1365 /// * Must end with a number or a letter.
1366 /// * Must be unique within the customer project and location.
1367 pub workflow_id: std::string::String,
1368
1369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1370}
1371
1372impl CreateWorkflowRequest {
1373 /// Creates a new default instance.
1374 pub fn new() -> Self {
1375 std::default::Default::default()
1376 }
1377
1378 /// Sets the value of [parent][crate::model::CreateWorkflowRequest::parent].
1379 ///
1380 /// # Example
1381 /// ```ignore,no_run
1382 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1383 /// let x = CreateWorkflowRequest::new().set_parent("example");
1384 /// ```
1385 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1386 self.parent = v.into();
1387 self
1388 }
1389
1390 /// Sets the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
1391 ///
1392 /// # Example
1393 /// ```ignore,no_run
1394 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1395 /// use google_cloud_workflows_v1::model::Workflow;
1396 /// let x = CreateWorkflowRequest::new().set_workflow(Workflow::default()/* use setters */);
1397 /// ```
1398 pub fn set_workflow<T>(mut self, v: T) -> Self
1399 where
1400 T: std::convert::Into<crate::model::Workflow>,
1401 {
1402 self.workflow = std::option::Option::Some(v.into());
1403 self
1404 }
1405
1406 /// Sets or clears the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
1407 ///
1408 /// # Example
1409 /// ```ignore,no_run
1410 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1411 /// use google_cloud_workflows_v1::model::Workflow;
1412 /// let x = CreateWorkflowRequest::new().set_or_clear_workflow(Some(Workflow::default()/* use setters */));
1413 /// let x = CreateWorkflowRequest::new().set_or_clear_workflow(None::<Workflow>);
1414 /// ```
1415 pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
1416 where
1417 T: std::convert::Into<crate::model::Workflow>,
1418 {
1419 self.workflow = v.map(|x| x.into());
1420 self
1421 }
1422
1423 /// Sets the value of [workflow_id][crate::model::CreateWorkflowRequest::workflow_id].
1424 ///
1425 /// # Example
1426 /// ```ignore,no_run
1427 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1428 /// let x = CreateWorkflowRequest::new().set_workflow_id("example");
1429 /// ```
1430 pub fn set_workflow_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1431 self.workflow_id = v.into();
1432 self
1433 }
1434}
1435
1436impl wkt::message::Message for CreateWorkflowRequest {
1437 fn typename() -> &'static str {
1438 "type.googleapis.com/google.cloud.workflows.v1.CreateWorkflowRequest"
1439 }
1440}
1441
1442/// Request for the
1443/// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
1444/// method.
1445///
1446/// [google.cloud.workflows.v1.Workflows.DeleteWorkflow]: crate::client::Workflows::delete_workflow
1447#[derive(Clone, Default, PartialEq)]
1448#[non_exhaustive]
1449pub struct DeleteWorkflowRequest {
1450 /// Required. Name of the workflow to be deleted.
1451 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1452 pub name: std::string::String,
1453
1454 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1455}
1456
1457impl DeleteWorkflowRequest {
1458 /// Creates a new default instance.
1459 pub fn new() -> Self {
1460 std::default::Default::default()
1461 }
1462
1463 /// Sets the value of [name][crate::model::DeleteWorkflowRequest::name].
1464 ///
1465 /// # Example
1466 /// ```ignore,no_run
1467 /// # use google_cloud_workflows_v1::model::DeleteWorkflowRequest;
1468 /// # let project_id = "project_id";
1469 /// # let location_id = "location_id";
1470 /// # let workflow_id = "workflow_id";
1471 /// let x = DeleteWorkflowRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}"));
1472 /// ```
1473 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1474 self.name = v.into();
1475 self
1476 }
1477}
1478
1479impl wkt::message::Message for DeleteWorkflowRequest {
1480 fn typename() -> &'static str {
1481 "type.googleapis.com/google.cloud.workflows.v1.DeleteWorkflowRequest"
1482 }
1483}
1484
1485/// Request for the
1486/// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
1487/// method.
1488///
1489/// [google.cloud.workflows.v1.Workflows.UpdateWorkflow]: crate::client::Workflows::update_workflow
1490#[derive(Clone, Default, PartialEq)]
1491#[non_exhaustive]
1492pub struct UpdateWorkflowRequest {
1493 /// Required. Workflow to be updated.
1494 pub workflow: std::option::Option<crate::model::Workflow>,
1495
1496 /// List of fields to be updated. If not present, the entire workflow
1497 /// will be updated.
1498 pub update_mask: std::option::Option<wkt::FieldMask>,
1499
1500 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1501}
1502
1503impl UpdateWorkflowRequest {
1504 /// Creates a new default instance.
1505 pub fn new() -> Self {
1506 std::default::Default::default()
1507 }
1508
1509 /// Sets the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
1510 ///
1511 /// # Example
1512 /// ```ignore,no_run
1513 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1514 /// use google_cloud_workflows_v1::model::Workflow;
1515 /// let x = UpdateWorkflowRequest::new().set_workflow(Workflow::default()/* use setters */);
1516 /// ```
1517 pub fn set_workflow<T>(mut self, v: T) -> Self
1518 where
1519 T: std::convert::Into<crate::model::Workflow>,
1520 {
1521 self.workflow = std::option::Option::Some(v.into());
1522 self
1523 }
1524
1525 /// Sets or clears the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
1526 ///
1527 /// # Example
1528 /// ```ignore,no_run
1529 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1530 /// use google_cloud_workflows_v1::model::Workflow;
1531 /// let x = UpdateWorkflowRequest::new().set_or_clear_workflow(Some(Workflow::default()/* use setters */));
1532 /// let x = UpdateWorkflowRequest::new().set_or_clear_workflow(None::<Workflow>);
1533 /// ```
1534 pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
1535 where
1536 T: std::convert::Into<crate::model::Workflow>,
1537 {
1538 self.workflow = v.map(|x| x.into());
1539 self
1540 }
1541
1542 /// Sets the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
1543 ///
1544 /// # Example
1545 /// ```ignore,no_run
1546 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1547 /// use wkt::FieldMask;
1548 /// let x = UpdateWorkflowRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1549 /// ```
1550 pub fn set_update_mask<T>(mut self, v: T) -> Self
1551 where
1552 T: std::convert::Into<wkt::FieldMask>,
1553 {
1554 self.update_mask = std::option::Option::Some(v.into());
1555 self
1556 }
1557
1558 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
1559 ///
1560 /// # Example
1561 /// ```ignore,no_run
1562 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1563 /// use wkt::FieldMask;
1564 /// let x = UpdateWorkflowRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1565 /// let x = UpdateWorkflowRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1566 /// ```
1567 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1568 where
1569 T: std::convert::Into<wkt::FieldMask>,
1570 {
1571 self.update_mask = v.map(|x| x.into());
1572 self
1573 }
1574}
1575
1576impl wkt::message::Message for UpdateWorkflowRequest {
1577 fn typename() -> &'static str {
1578 "type.googleapis.com/google.cloud.workflows.v1.UpdateWorkflowRequest"
1579 }
1580}
1581
1582/// Represents the metadata of the long-running operation.
1583#[derive(Clone, Default, PartialEq)]
1584#[non_exhaustive]
1585pub struct OperationMetadata {
1586 /// The time the operation was created.
1587 pub create_time: std::option::Option<wkt::Timestamp>,
1588
1589 /// The time the operation finished running.
1590 pub end_time: std::option::Option<wkt::Timestamp>,
1591
1592 /// Server-defined resource path for the target of the operation.
1593 pub target: std::string::String,
1594
1595 /// Name of the verb executed by the operation.
1596 pub verb: std::string::String,
1597
1598 /// API version used to start the operation.
1599 pub api_version: std::string::String,
1600
1601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1602}
1603
1604impl OperationMetadata {
1605 /// Creates a new default instance.
1606 pub fn new() -> Self {
1607 std::default::Default::default()
1608 }
1609
1610 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1611 ///
1612 /// # Example
1613 /// ```ignore,no_run
1614 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1615 /// use wkt::Timestamp;
1616 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
1617 /// ```
1618 pub fn set_create_time<T>(mut self, v: T) -> Self
1619 where
1620 T: std::convert::Into<wkt::Timestamp>,
1621 {
1622 self.create_time = std::option::Option::Some(v.into());
1623 self
1624 }
1625
1626 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1627 ///
1628 /// # Example
1629 /// ```ignore,no_run
1630 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1631 /// use wkt::Timestamp;
1632 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1633 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
1634 /// ```
1635 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1636 where
1637 T: std::convert::Into<wkt::Timestamp>,
1638 {
1639 self.create_time = v.map(|x| x.into());
1640 self
1641 }
1642
1643 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1644 ///
1645 /// # Example
1646 /// ```ignore,no_run
1647 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1648 /// use wkt::Timestamp;
1649 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1650 /// ```
1651 pub fn set_end_time<T>(mut self, v: T) -> Self
1652 where
1653 T: std::convert::Into<wkt::Timestamp>,
1654 {
1655 self.end_time = std::option::Option::Some(v.into());
1656 self
1657 }
1658
1659 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1660 ///
1661 /// # Example
1662 /// ```ignore,no_run
1663 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1664 /// use wkt::Timestamp;
1665 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1666 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1667 /// ```
1668 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1669 where
1670 T: std::convert::Into<wkt::Timestamp>,
1671 {
1672 self.end_time = v.map(|x| x.into());
1673 self
1674 }
1675
1676 /// Sets the value of [target][crate::model::OperationMetadata::target].
1677 ///
1678 /// # Example
1679 /// ```ignore,no_run
1680 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1681 /// let x = OperationMetadata::new().set_target("example");
1682 /// ```
1683 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1684 self.target = v.into();
1685 self
1686 }
1687
1688 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1689 ///
1690 /// # Example
1691 /// ```ignore,no_run
1692 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1693 /// let x = OperationMetadata::new().set_verb("example");
1694 /// ```
1695 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1696 self.verb = v.into();
1697 self
1698 }
1699
1700 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1701 ///
1702 /// # Example
1703 /// ```ignore,no_run
1704 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1705 /// let x = OperationMetadata::new().set_api_version("example");
1706 /// ```
1707 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1708 self.api_version = v.into();
1709 self
1710 }
1711}
1712
1713impl wkt::message::Message for OperationMetadata {
1714 fn typename() -> &'static str {
1715 "type.googleapis.com/google.cloud.workflows.v1.OperationMetadata"
1716 }
1717}
1718
1719/// Request for the
1720/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1721/// method.
1722///
1723/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1724#[derive(Clone, Default, PartialEq)]
1725#[non_exhaustive]
1726pub struct ListWorkflowRevisionsRequest {
1727 /// Required. Workflow for which the revisions should be listed.
1728 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1729 pub name: std::string::String,
1730
1731 /// The maximum number of revisions to return per page. If a value is not
1732 /// specified, a default value of 20 is used. The maximum permitted value is
1733 /// 100. Values greater than 100 are coerced down to 100.
1734 pub page_size: i32,
1735
1736 /// The page token, received from a previous ListWorkflowRevisions call.
1737 /// Provide this to retrieve the subsequent page.
1738 pub page_token: std::string::String,
1739
1740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1741}
1742
1743impl ListWorkflowRevisionsRequest {
1744 /// Creates a new default instance.
1745 pub fn new() -> Self {
1746 std::default::Default::default()
1747 }
1748
1749 /// Sets the value of [name][crate::model::ListWorkflowRevisionsRequest::name].
1750 ///
1751 /// # Example
1752 /// ```ignore,no_run
1753 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1754 /// # let project_id = "project_id";
1755 /// # let location_id = "location_id";
1756 /// # let workflow_id = "workflow_id";
1757 /// let x = ListWorkflowRevisionsRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/workflows/{workflow_id}"));
1758 /// ```
1759 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1760 self.name = v.into();
1761 self
1762 }
1763
1764 /// Sets the value of [page_size][crate::model::ListWorkflowRevisionsRequest::page_size].
1765 ///
1766 /// # Example
1767 /// ```ignore,no_run
1768 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1769 /// let x = ListWorkflowRevisionsRequest::new().set_page_size(42);
1770 /// ```
1771 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1772 self.page_size = v.into();
1773 self
1774 }
1775
1776 /// Sets the value of [page_token][crate::model::ListWorkflowRevisionsRequest::page_token].
1777 ///
1778 /// # Example
1779 /// ```ignore,no_run
1780 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1781 /// let x = ListWorkflowRevisionsRequest::new().set_page_token("example");
1782 /// ```
1783 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1784 self.page_token = v.into();
1785 self
1786 }
1787}
1788
1789impl wkt::message::Message for ListWorkflowRevisionsRequest {
1790 fn typename() -> &'static str {
1791 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsRequest"
1792 }
1793}
1794
1795/// Response for the
1796/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1797/// method.
1798///
1799/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1800#[derive(Clone, Default, PartialEq)]
1801#[non_exhaustive]
1802pub struct ListWorkflowRevisionsResponse {
1803 /// The revisions of the workflow, ordered in reverse chronological order.
1804 pub workflows: std::vec::Vec<crate::model::Workflow>,
1805
1806 /// A token, which can be sent as `page_token` to retrieve the next page.
1807 /// If this field is omitted, there are no subsequent pages.
1808 pub next_page_token: std::string::String,
1809
1810 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1811}
1812
1813impl ListWorkflowRevisionsResponse {
1814 /// Creates a new default instance.
1815 pub fn new() -> Self {
1816 std::default::Default::default()
1817 }
1818
1819 /// Sets the value of [workflows][crate::model::ListWorkflowRevisionsResponse::workflows].
1820 ///
1821 /// # Example
1822 /// ```ignore,no_run
1823 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsResponse;
1824 /// use google_cloud_workflows_v1::model::Workflow;
1825 /// let x = ListWorkflowRevisionsResponse::new()
1826 /// .set_workflows([
1827 /// Workflow::default()/* use setters */,
1828 /// Workflow::default()/* use (different) setters */,
1829 /// ]);
1830 /// ```
1831 pub fn set_workflows<T, V>(mut self, v: T) -> Self
1832 where
1833 T: std::iter::IntoIterator<Item = V>,
1834 V: std::convert::Into<crate::model::Workflow>,
1835 {
1836 use std::iter::Iterator;
1837 self.workflows = v.into_iter().map(|i| i.into()).collect();
1838 self
1839 }
1840
1841 /// Sets the value of [next_page_token][crate::model::ListWorkflowRevisionsResponse::next_page_token].
1842 ///
1843 /// # Example
1844 /// ```ignore,no_run
1845 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsResponse;
1846 /// let x = ListWorkflowRevisionsResponse::new().set_next_page_token("example");
1847 /// ```
1848 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1849 self.next_page_token = v.into();
1850 self
1851 }
1852}
1853
1854impl wkt::message::Message for ListWorkflowRevisionsResponse {
1855 fn typename() -> &'static str {
1856 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsResponse"
1857 }
1858}
1859
1860#[doc(hidden)]
1861impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowRevisionsResponse {
1862 type PageItem = crate::model::Workflow;
1863
1864 fn items(self) -> std::vec::Vec<Self::PageItem> {
1865 self.workflows
1866 }
1867
1868 fn next_page_token(&self) -> std::string::String {
1869 use std::clone::Clone;
1870 self.next_page_token.clone()
1871 }
1872}
1873
1874/// Define possible options for enabling the execution history level.
1875///
1876/// # Working with unknown values
1877///
1878/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1879/// additional enum variants at any time. Adding new variants is not considered
1880/// a breaking change. Applications should write their code in anticipation of:
1881///
1882/// - New values appearing in future releases of the client library, **and**
1883/// - New values received dynamically, without application changes.
1884///
1885/// Please consult the [Working with enums] section in the user guide for some
1886/// guidelines.
1887///
1888/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1889#[derive(Clone, Debug, PartialEq)]
1890#[non_exhaustive]
1891pub enum ExecutionHistoryLevel {
1892 /// The default/unset value.
1893 Unspecified,
1894 /// Enable execution history basic feature.
1895 ExecutionHistoryBasic,
1896 /// Enable execution history detailed feature.
1897 ExecutionHistoryDetailed,
1898 /// If set, the enum was initialized with an unknown value.
1899 ///
1900 /// Applications can examine the value using [ExecutionHistoryLevel::value] or
1901 /// [ExecutionHistoryLevel::name].
1902 UnknownValue(execution_history_level::UnknownValue),
1903}
1904
1905#[doc(hidden)]
1906pub mod execution_history_level {
1907 #[allow(unused_imports)]
1908 use super::*;
1909 #[derive(Clone, Debug, PartialEq)]
1910 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1911}
1912
1913impl ExecutionHistoryLevel {
1914 /// Gets the enum value.
1915 ///
1916 /// Returns `None` if the enum contains an unknown value deserialized from
1917 /// the string representation of enums.
1918 pub fn value(&self) -> std::option::Option<i32> {
1919 match self {
1920 Self::Unspecified => std::option::Option::Some(0),
1921 Self::ExecutionHistoryBasic => std::option::Option::Some(1),
1922 Self::ExecutionHistoryDetailed => std::option::Option::Some(2),
1923 Self::UnknownValue(u) => u.0.value(),
1924 }
1925 }
1926
1927 /// Gets the enum value as a string.
1928 ///
1929 /// Returns `None` if the enum contains an unknown value deserialized from
1930 /// the integer representation of enums.
1931 pub fn name(&self) -> std::option::Option<&str> {
1932 match self {
1933 Self::Unspecified => std::option::Option::Some("EXECUTION_HISTORY_LEVEL_UNSPECIFIED"),
1934 Self::ExecutionHistoryBasic => std::option::Option::Some("EXECUTION_HISTORY_BASIC"),
1935 Self::ExecutionHistoryDetailed => {
1936 std::option::Option::Some("EXECUTION_HISTORY_DETAILED")
1937 }
1938 Self::UnknownValue(u) => u.0.name(),
1939 }
1940 }
1941}
1942
1943impl std::default::Default for ExecutionHistoryLevel {
1944 fn default() -> Self {
1945 use std::convert::From;
1946 Self::from(0)
1947 }
1948}
1949
1950impl std::fmt::Display for ExecutionHistoryLevel {
1951 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1952 wkt::internal::display_enum(f, self.name(), self.value())
1953 }
1954}
1955
1956impl std::convert::From<i32> for ExecutionHistoryLevel {
1957 fn from(value: i32) -> Self {
1958 match value {
1959 0 => Self::Unspecified,
1960 1 => Self::ExecutionHistoryBasic,
1961 2 => Self::ExecutionHistoryDetailed,
1962 _ => Self::UnknownValue(execution_history_level::UnknownValue(
1963 wkt::internal::UnknownEnumValue::Integer(value),
1964 )),
1965 }
1966 }
1967}
1968
1969impl std::convert::From<&str> for ExecutionHistoryLevel {
1970 fn from(value: &str) -> Self {
1971 use std::string::ToString;
1972 match value {
1973 "EXECUTION_HISTORY_LEVEL_UNSPECIFIED" => Self::Unspecified,
1974 "EXECUTION_HISTORY_BASIC" => Self::ExecutionHistoryBasic,
1975 "EXECUTION_HISTORY_DETAILED" => Self::ExecutionHistoryDetailed,
1976 _ => Self::UnknownValue(execution_history_level::UnknownValue(
1977 wkt::internal::UnknownEnumValue::String(value.to_string()),
1978 )),
1979 }
1980 }
1981}
1982
1983impl serde::ser::Serialize for ExecutionHistoryLevel {
1984 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1985 where
1986 S: serde::Serializer,
1987 {
1988 match self {
1989 Self::Unspecified => serializer.serialize_i32(0),
1990 Self::ExecutionHistoryBasic => serializer.serialize_i32(1),
1991 Self::ExecutionHistoryDetailed => serializer.serialize_i32(2),
1992 Self::UnknownValue(u) => u.0.serialize(serializer),
1993 }
1994 }
1995}
1996
1997impl<'de> serde::de::Deserialize<'de> for ExecutionHistoryLevel {
1998 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1999 where
2000 D: serde::Deserializer<'de>,
2001 {
2002 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionHistoryLevel>::new(
2003 ".google.cloud.workflows.v1.ExecutionHistoryLevel",
2004 ))
2005 }
2006}