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