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 lazy_static;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Workflow program to be executed by Workflows.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Workflow {
45 /// The resource name of the workflow.
46 /// Format: projects/{project}/locations/{location}/workflows/{workflow}.
47 /// This is a workflow-wide field and is not tied to a specific revision.
48 pub name: std::string::String,
49
50 /// Description of the workflow provided by the user.
51 /// Must be at most 1000 Unicode characters long.
52 /// This is a workflow-wide field and is not tied to a specific revision.
53 pub description: std::string::String,
54
55 /// Output only. State of the workflow deployment.
56 pub state: crate::model::workflow::State,
57
58 /// Output only. The revision of the workflow.
59 /// A new revision of a workflow is created as a result of updating the
60 /// following properties of a workflow:
61 ///
62 /// - [Service account][google.cloud.workflows.v1.Workflow.service_account]
63 /// - [Workflow code to be
64 /// executed][google.cloud.workflows.v1.Workflow.source_contents]
65 ///
66 /// The format is "000001-a4d", where the first six characters define
67 /// the zero-padded revision ordinal number. They are followed by a hyphen and
68 /// three hexadecimal random characters.
69 ///
70 /// [google.cloud.workflows.v1.Workflow.service_account]: crate::model::Workflow::service_account
71 /// [google.cloud.workflows.v1.Workflow.source_contents]: crate::model::Workflow::source_code
72 pub revision_id: std::string::String,
73
74 /// Output only. The timestamp for when the workflow was created.
75 /// This is a workflow-wide field and is not tied to a specific revision.
76 pub create_time: std::option::Option<wkt::Timestamp>,
77
78 /// Output only. The timestamp for when the workflow was last updated.
79 /// This is a workflow-wide field and is not tied to a specific revision.
80 pub update_time: std::option::Option<wkt::Timestamp>,
81
82 /// Output only. The timestamp for the latest revision of the workflow's
83 /// creation.
84 pub revision_create_time: std::option::Option<wkt::Timestamp>,
85
86 /// Labels associated with this workflow.
87 /// Labels can contain at most 64 entries. Keys and values can be no longer
88 /// than 63 characters and can only contain lowercase letters, numeric
89 /// characters, underscores, and dashes. Label keys must start with a letter.
90 /// International characters are allowed.
91 /// This is a workflow-wide field and is not tied to a specific revision.
92 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
93
94 /// The service account associated with the latest workflow version.
95 /// This service account represents the identity of the workflow and determines
96 /// what permissions the workflow has.
97 /// Format: projects/{project}/serviceAccounts/{account} or {account}
98 ///
99 /// Using `-` as a wildcard for the `{project}` or not providing one at all
100 /// will infer the project from the account. The `{account}` value can be the
101 /// `email` address or the `unique_id` of the service account.
102 ///
103 /// If not provided, workflow will use the project's default service account.
104 /// Modifying this field for an existing workflow results in a new workflow
105 /// revision.
106 pub service_account: std::string::String,
107
108 /// Optional. The resource name of a KMS crypto key used to encrypt or decrypt
109 /// the data associated with the workflow.
110 ///
111 /// Format:
112 /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
113 ///
114 /// Using `-` as a wildcard for the `{project}` or not providing one at all
115 /// will infer the project from the account.
116 ///
117 /// If not provided, data associated with the workflow will not be
118 /// CMEK-encrypted.
119 pub crypto_key_name: std::string::String,
120
121 /// Output only. Error regarding the state of the workflow. For example, this
122 /// field will have error details if the execution data is unavailable due to
123 /// revoked KMS key permissions.
124 pub state_error: std::option::Option<crate::model::workflow::StateError>,
125
126 /// Optional. Describes the level of platform logging to apply to calls and
127 /// call responses during executions of this workflow. If both the workflow and
128 /// the execution specify a logging level, the execution level takes
129 /// precedence.
130 pub call_log_level: crate::model::workflow::CallLogLevel,
131
132 /// Optional. User-defined environment variables associated with this workflow
133 /// revision. This map has a maximum length of 20. Each string can take up to
134 /// 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or
135 /// "WORKFLOWS".
136 pub user_env_vars: std::collections::HashMap<std::string::String, std::string::String>,
137
138 /// Optional. Describes the execution history level to apply to this workflow.
139 pub execution_history_level: crate::model::ExecutionHistoryLevel,
140
141 /// Output only. A list of all KMS crypto keys used to encrypt or decrypt the
142 /// data associated with the workflow.
143 pub all_kms_keys: std::vec::Vec<std::string::String>,
144
145 /// Output only. A list of all KMS crypto key versions used to encrypt or
146 /// decrypt the data associated with the workflow.
147 pub all_kms_keys_versions: std::vec::Vec<std::string::String>,
148
149 /// Output only. The resource name of a KMS crypto key version used to encrypt
150 /// or decrypt the data associated with the workflow.
151 ///
152 /// Format:
153 /// projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}
154 pub crypto_key_version: std::string::String,
155
156 /// Optional. Input only. Immutable. Tags associated with this workflow.
157 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
158
159 /// Required. Location of the workflow source code.
160 /// Modifying this field for an existing workflow results in a new workflow
161 /// revision.
162 pub source_code: std::option::Option<crate::model::workflow::SourceCode>,
163
164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
165}
166
167impl Workflow {
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 pub fn new() -> Self {
604 std::default::Default::default()
605 }
606
607 /// Sets the value of [details][crate::model::workflow::StateError::details].
608 ///
609 /// # Example
610 /// ```ignore,no_run
611 /// # use google_cloud_workflows_v1::model::workflow::StateError;
612 /// let x = StateError::new().set_details("example");
613 /// ```
614 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
615 self.details = v.into();
616 self
617 }
618
619 /// Sets the value of [r#type][crate::model::workflow::StateError::type].
620 ///
621 /// # Example
622 /// ```ignore,no_run
623 /// # use google_cloud_workflows_v1::model::workflow::StateError;
624 /// use google_cloud_workflows_v1::model::workflow::state_error::Type;
625 /// let x0 = StateError::new().set_type(Type::KmsError);
626 /// ```
627 pub fn set_type<T: std::convert::Into<crate::model::workflow::state_error::Type>>(
628 mut self,
629 v: T,
630 ) -> Self {
631 self.r#type = v.into();
632 self
633 }
634 }
635
636 impl wkt::message::Message for StateError {
637 fn typename() -> &'static str {
638 "type.googleapis.com/google.cloud.workflows.v1.Workflow.StateError"
639 }
640 }
641
642 /// Defines additional types related to [StateError].
643 pub mod state_error {
644 #[allow(unused_imports)]
645 use super::*;
646
647 /// Describes the possibled types of a state error.
648 ///
649 /// # Working with unknown values
650 ///
651 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
652 /// additional enum variants at any time. Adding new variants is not considered
653 /// a breaking change. Applications should write their code in anticipation of:
654 ///
655 /// - New values appearing in future releases of the client library, **and**
656 /// - New values received dynamically, without application changes.
657 ///
658 /// Please consult the [Working with enums] section in the user guide for some
659 /// guidelines.
660 ///
661 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
662 #[derive(Clone, Debug, PartialEq)]
663 #[non_exhaustive]
664 pub enum Type {
665 /// No type specified.
666 Unspecified,
667 /// Caused by an issue with KMS.
668 KmsError,
669 /// If set, the enum was initialized with an unknown value.
670 ///
671 /// Applications can examine the value using [Type::value] or
672 /// [Type::name].
673 UnknownValue(r#type::UnknownValue),
674 }
675
676 #[doc(hidden)]
677 pub mod r#type {
678 #[allow(unused_imports)]
679 use super::*;
680 #[derive(Clone, Debug, PartialEq)]
681 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
682 }
683
684 impl Type {
685 /// Gets the enum value.
686 ///
687 /// Returns `None` if the enum contains an unknown value deserialized from
688 /// the string representation of enums.
689 pub fn value(&self) -> std::option::Option<i32> {
690 match self {
691 Self::Unspecified => std::option::Option::Some(0),
692 Self::KmsError => std::option::Option::Some(1),
693 Self::UnknownValue(u) => u.0.value(),
694 }
695 }
696
697 /// Gets the enum value as a string.
698 ///
699 /// Returns `None` if the enum contains an unknown value deserialized from
700 /// the integer representation of enums.
701 pub fn name(&self) -> std::option::Option<&str> {
702 match self {
703 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
704 Self::KmsError => std::option::Option::Some("KMS_ERROR"),
705 Self::UnknownValue(u) => u.0.name(),
706 }
707 }
708 }
709
710 impl std::default::Default for Type {
711 fn default() -> Self {
712 use std::convert::From;
713 Self::from(0)
714 }
715 }
716
717 impl std::fmt::Display for Type {
718 fn fmt(
719 &self,
720 f: &mut std::fmt::Formatter<'_>,
721 ) -> std::result::Result<(), std::fmt::Error> {
722 wkt::internal::display_enum(f, self.name(), self.value())
723 }
724 }
725
726 impl std::convert::From<i32> for Type {
727 fn from(value: i32) -> Self {
728 match value {
729 0 => Self::Unspecified,
730 1 => Self::KmsError,
731 _ => Self::UnknownValue(r#type::UnknownValue(
732 wkt::internal::UnknownEnumValue::Integer(value),
733 )),
734 }
735 }
736 }
737
738 impl std::convert::From<&str> for Type {
739 fn from(value: &str) -> Self {
740 use std::string::ToString;
741 match value {
742 "TYPE_UNSPECIFIED" => Self::Unspecified,
743 "KMS_ERROR" => Self::KmsError,
744 _ => Self::UnknownValue(r#type::UnknownValue(
745 wkt::internal::UnknownEnumValue::String(value.to_string()),
746 )),
747 }
748 }
749 }
750
751 impl serde::ser::Serialize for Type {
752 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
753 where
754 S: serde::Serializer,
755 {
756 match self {
757 Self::Unspecified => serializer.serialize_i32(0),
758 Self::KmsError => serializer.serialize_i32(1),
759 Self::UnknownValue(u) => u.0.serialize(serializer),
760 }
761 }
762 }
763
764 impl<'de> serde::de::Deserialize<'de> for Type {
765 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
766 where
767 D: serde::Deserializer<'de>,
768 {
769 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
770 ".google.cloud.workflows.v1.Workflow.StateError.Type",
771 ))
772 }
773 }
774 }
775
776 /// Describes the current state of workflow deployment.
777 ///
778 /// # Working with unknown values
779 ///
780 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
781 /// additional enum variants at any time. Adding new variants is not considered
782 /// a breaking change. Applications should write their code in anticipation of:
783 ///
784 /// - New values appearing in future releases of the client library, **and**
785 /// - New values received dynamically, without application changes.
786 ///
787 /// Please consult the [Working with enums] section in the user guide for some
788 /// guidelines.
789 ///
790 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
791 #[derive(Clone, Debug, PartialEq)]
792 #[non_exhaustive]
793 pub enum State {
794 /// Invalid state.
795 Unspecified,
796 /// The workflow has been deployed successfully and is serving.
797 Active,
798 /// Workflow data is unavailable. See the `state_error` field.
799 Unavailable,
800 /// If set, the enum was initialized with an unknown value.
801 ///
802 /// Applications can examine the value using [State::value] or
803 /// [State::name].
804 UnknownValue(state::UnknownValue),
805 }
806
807 #[doc(hidden)]
808 pub mod state {
809 #[allow(unused_imports)]
810 use super::*;
811 #[derive(Clone, Debug, PartialEq)]
812 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
813 }
814
815 impl State {
816 /// Gets the enum value.
817 ///
818 /// Returns `None` if the enum contains an unknown value deserialized from
819 /// the string representation of enums.
820 pub fn value(&self) -> std::option::Option<i32> {
821 match self {
822 Self::Unspecified => std::option::Option::Some(0),
823 Self::Active => std::option::Option::Some(1),
824 Self::Unavailable => std::option::Option::Some(2),
825 Self::UnknownValue(u) => u.0.value(),
826 }
827 }
828
829 /// Gets the enum value as a string.
830 ///
831 /// Returns `None` if the enum contains an unknown value deserialized from
832 /// the integer representation of enums.
833 pub fn name(&self) -> std::option::Option<&str> {
834 match self {
835 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
836 Self::Active => std::option::Option::Some("ACTIVE"),
837 Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
838 Self::UnknownValue(u) => u.0.name(),
839 }
840 }
841 }
842
843 impl std::default::Default for State {
844 fn default() -> Self {
845 use std::convert::From;
846 Self::from(0)
847 }
848 }
849
850 impl std::fmt::Display for State {
851 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
852 wkt::internal::display_enum(f, self.name(), self.value())
853 }
854 }
855
856 impl std::convert::From<i32> for State {
857 fn from(value: i32) -> Self {
858 match value {
859 0 => Self::Unspecified,
860 1 => Self::Active,
861 2 => Self::Unavailable,
862 _ => Self::UnknownValue(state::UnknownValue(
863 wkt::internal::UnknownEnumValue::Integer(value),
864 )),
865 }
866 }
867 }
868
869 impl std::convert::From<&str> for State {
870 fn from(value: &str) -> Self {
871 use std::string::ToString;
872 match value {
873 "STATE_UNSPECIFIED" => Self::Unspecified,
874 "ACTIVE" => Self::Active,
875 "UNAVAILABLE" => Self::Unavailable,
876 _ => Self::UnknownValue(state::UnknownValue(
877 wkt::internal::UnknownEnumValue::String(value.to_string()),
878 )),
879 }
880 }
881 }
882
883 impl serde::ser::Serialize for State {
884 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
885 where
886 S: serde::Serializer,
887 {
888 match self {
889 Self::Unspecified => serializer.serialize_i32(0),
890 Self::Active => serializer.serialize_i32(1),
891 Self::Unavailable => serializer.serialize_i32(2),
892 Self::UnknownValue(u) => u.0.serialize(serializer),
893 }
894 }
895 }
896
897 impl<'de> serde::de::Deserialize<'de> for State {
898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
899 where
900 D: serde::Deserializer<'de>,
901 {
902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
903 ".google.cloud.workflows.v1.Workflow.State",
904 ))
905 }
906 }
907
908 /// Describes the level of platform logging to apply to calls and call
909 /// responses during workflow executions.
910 ///
911 /// # Working with unknown values
912 ///
913 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
914 /// additional enum variants at any time. Adding new variants is not considered
915 /// a breaking change. Applications should write their code in anticipation of:
916 ///
917 /// - New values appearing in future releases of the client library, **and**
918 /// - New values received dynamically, without application changes.
919 ///
920 /// Please consult the [Working with enums] section in the user guide for some
921 /// guidelines.
922 ///
923 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
924 #[derive(Clone, Debug, PartialEq)]
925 #[non_exhaustive]
926 pub enum CallLogLevel {
927 /// No call logging level specified.
928 Unspecified,
929 /// Log all call steps within workflows, all call returns, and all exceptions
930 /// raised.
931 LogAllCalls,
932 /// Log only exceptions that are raised from call steps within workflows.
933 LogErrorsOnly,
934 /// Explicitly log nothing.
935 LogNone,
936 /// If set, the enum was initialized with an unknown value.
937 ///
938 /// Applications can examine the value using [CallLogLevel::value] or
939 /// [CallLogLevel::name].
940 UnknownValue(call_log_level::UnknownValue),
941 }
942
943 #[doc(hidden)]
944 pub mod call_log_level {
945 #[allow(unused_imports)]
946 use super::*;
947 #[derive(Clone, Debug, PartialEq)]
948 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
949 }
950
951 impl CallLogLevel {
952 /// Gets the enum value.
953 ///
954 /// Returns `None` if the enum contains an unknown value deserialized from
955 /// the string representation of enums.
956 pub fn value(&self) -> std::option::Option<i32> {
957 match self {
958 Self::Unspecified => std::option::Option::Some(0),
959 Self::LogAllCalls => std::option::Option::Some(1),
960 Self::LogErrorsOnly => std::option::Option::Some(2),
961 Self::LogNone => std::option::Option::Some(3),
962 Self::UnknownValue(u) => u.0.value(),
963 }
964 }
965
966 /// Gets the enum value as a string.
967 ///
968 /// Returns `None` if the enum contains an unknown value deserialized from
969 /// the integer representation of enums.
970 pub fn name(&self) -> std::option::Option<&str> {
971 match self {
972 Self::Unspecified => std::option::Option::Some("CALL_LOG_LEVEL_UNSPECIFIED"),
973 Self::LogAllCalls => std::option::Option::Some("LOG_ALL_CALLS"),
974 Self::LogErrorsOnly => std::option::Option::Some("LOG_ERRORS_ONLY"),
975 Self::LogNone => std::option::Option::Some("LOG_NONE"),
976 Self::UnknownValue(u) => u.0.name(),
977 }
978 }
979 }
980
981 impl std::default::Default for CallLogLevel {
982 fn default() -> Self {
983 use std::convert::From;
984 Self::from(0)
985 }
986 }
987
988 impl std::fmt::Display for CallLogLevel {
989 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
990 wkt::internal::display_enum(f, self.name(), self.value())
991 }
992 }
993
994 impl std::convert::From<i32> for CallLogLevel {
995 fn from(value: i32) -> Self {
996 match value {
997 0 => Self::Unspecified,
998 1 => Self::LogAllCalls,
999 2 => Self::LogErrorsOnly,
1000 3 => Self::LogNone,
1001 _ => Self::UnknownValue(call_log_level::UnknownValue(
1002 wkt::internal::UnknownEnumValue::Integer(value),
1003 )),
1004 }
1005 }
1006 }
1007
1008 impl std::convert::From<&str> for CallLogLevel {
1009 fn from(value: &str) -> Self {
1010 use std::string::ToString;
1011 match value {
1012 "CALL_LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
1013 "LOG_ALL_CALLS" => Self::LogAllCalls,
1014 "LOG_ERRORS_ONLY" => Self::LogErrorsOnly,
1015 "LOG_NONE" => Self::LogNone,
1016 _ => Self::UnknownValue(call_log_level::UnknownValue(
1017 wkt::internal::UnknownEnumValue::String(value.to_string()),
1018 )),
1019 }
1020 }
1021 }
1022
1023 impl serde::ser::Serialize for CallLogLevel {
1024 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1025 where
1026 S: serde::Serializer,
1027 {
1028 match self {
1029 Self::Unspecified => serializer.serialize_i32(0),
1030 Self::LogAllCalls => serializer.serialize_i32(1),
1031 Self::LogErrorsOnly => serializer.serialize_i32(2),
1032 Self::LogNone => serializer.serialize_i32(3),
1033 Self::UnknownValue(u) => u.0.serialize(serializer),
1034 }
1035 }
1036 }
1037
1038 impl<'de> serde::de::Deserialize<'de> for CallLogLevel {
1039 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1040 where
1041 D: serde::Deserializer<'de>,
1042 {
1043 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CallLogLevel>::new(
1044 ".google.cloud.workflows.v1.Workflow.CallLogLevel",
1045 ))
1046 }
1047 }
1048
1049 /// Required. Location of the workflow source code.
1050 /// Modifying this field for an existing workflow results in a new workflow
1051 /// revision.
1052 #[derive(Clone, Debug, PartialEq)]
1053 #[non_exhaustive]
1054 pub enum SourceCode {
1055 /// Workflow code to be executed. The size limit is 128KB.
1056 SourceContents(std::string::String),
1057 }
1058}
1059
1060/// Request for the
1061/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
1062/// method.
1063///
1064/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
1065#[derive(Clone, Default, PartialEq)]
1066#[non_exhaustive]
1067pub struct ListWorkflowsRequest {
1068 /// Required. Project and location from which the workflows should be listed.
1069 /// Format: projects/{project}/locations/{location}
1070 pub parent: std::string::String,
1071
1072 /// Maximum number of workflows to return per call. The service might return
1073 /// fewer than this value even if not at the end of the collection. If a value
1074 /// is not specified, a default value of 500 is used. The maximum permitted
1075 /// value is 1000 and values greater than 1000 are coerced down to 1000.
1076 pub page_size: i32,
1077
1078 /// A page token, received from a previous `ListWorkflows` call.
1079 /// Provide this to retrieve the subsequent page.
1080 ///
1081 /// When paginating, all other parameters provided to `ListWorkflows` must
1082 /// match the call that provided the page token.
1083 pub page_token: std::string::String,
1084
1085 /// Filter to restrict results to specific workflows.
1086 /// For details, see <a href="https://google.aip.dev/160"
1087 /// class="external"\>AIP-160</a>.
1088 ///
1089 /// For example, if you are using the Google APIs Explorer:
1090 ///
1091 /// `state="SUCCEEDED"`
1092 ///
1093 /// or
1094 ///
1095 /// `createTime>"2023-08-01" AND state="FAILED"`
1096 pub filter: std::string::String,
1097
1098 /// Comma-separated list of fields that specify the order of the results.
1099 /// Default sorting order for a field is ascending. To specify descending order
1100 /// for a field, append a "desc" suffix.
1101 /// If not specified, the results are returned in an unspecified order.
1102 pub order_by: std::string::String,
1103
1104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1105}
1106
1107impl ListWorkflowsRequest {
1108 pub fn new() -> Self {
1109 std::default::Default::default()
1110 }
1111
1112 /// Sets the value of [parent][crate::model::ListWorkflowsRequest::parent].
1113 ///
1114 /// # Example
1115 /// ```ignore,no_run
1116 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1117 /// let x = ListWorkflowsRequest::new().set_parent("example");
1118 /// ```
1119 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1120 self.parent = v.into();
1121 self
1122 }
1123
1124 /// Sets the value of [page_size][crate::model::ListWorkflowsRequest::page_size].
1125 ///
1126 /// # Example
1127 /// ```ignore,no_run
1128 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1129 /// let x = ListWorkflowsRequest::new().set_page_size(42);
1130 /// ```
1131 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1132 self.page_size = v.into();
1133 self
1134 }
1135
1136 /// Sets the value of [page_token][crate::model::ListWorkflowsRequest::page_token].
1137 ///
1138 /// # Example
1139 /// ```ignore,no_run
1140 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1141 /// let x = ListWorkflowsRequest::new().set_page_token("example");
1142 /// ```
1143 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1144 self.page_token = v.into();
1145 self
1146 }
1147
1148 /// Sets the value of [filter][crate::model::ListWorkflowsRequest::filter].
1149 ///
1150 /// # Example
1151 /// ```ignore,no_run
1152 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1153 /// let x = ListWorkflowsRequest::new().set_filter("example");
1154 /// ```
1155 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1156 self.filter = v.into();
1157 self
1158 }
1159
1160 /// Sets the value of [order_by][crate::model::ListWorkflowsRequest::order_by].
1161 ///
1162 /// # Example
1163 /// ```ignore,no_run
1164 /// # use google_cloud_workflows_v1::model::ListWorkflowsRequest;
1165 /// let x = ListWorkflowsRequest::new().set_order_by("example");
1166 /// ```
1167 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1168 self.order_by = v.into();
1169 self
1170 }
1171}
1172
1173impl wkt::message::Message for ListWorkflowsRequest {
1174 fn typename() -> &'static str {
1175 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsRequest"
1176 }
1177}
1178
1179/// Response for the
1180/// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
1181/// method.
1182///
1183/// [google.cloud.workflows.v1.Workflows.ListWorkflows]: crate::client::Workflows::list_workflows
1184#[derive(Clone, Default, PartialEq)]
1185#[non_exhaustive]
1186pub struct ListWorkflowsResponse {
1187 /// The workflows that match the request.
1188 pub workflows: std::vec::Vec<crate::model::Workflow>,
1189
1190 /// A token, which can be sent as `page_token` to retrieve the next page.
1191 /// If this field is omitted, there are no subsequent pages.
1192 pub next_page_token: std::string::String,
1193
1194 /// Unreachable resources.
1195 pub unreachable: std::vec::Vec<std::string::String>,
1196
1197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1198}
1199
1200impl ListWorkflowsResponse {
1201 pub fn new() -> Self {
1202 std::default::Default::default()
1203 }
1204
1205 /// Sets the value of [workflows][crate::model::ListWorkflowsResponse::workflows].
1206 ///
1207 /// # Example
1208 /// ```ignore,no_run
1209 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1210 /// use google_cloud_workflows_v1::model::Workflow;
1211 /// let x = ListWorkflowsResponse::new()
1212 /// .set_workflows([
1213 /// Workflow::default()/* use setters */,
1214 /// Workflow::default()/* use (different) setters */,
1215 /// ]);
1216 /// ```
1217 pub fn set_workflows<T, V>(mut self, v: T) -> Self
1218 where
1219 T: std::iter::IntoIterator<Item = V>,
1220 V: std::convert::Into<crate::model::Workflow>,
1221 {
1222 use std::iter::Iterator;
1223 self.workflows = v.into_iter().map(|i| i.into()).collect();
1224 self
1225 }
1226
1227 /// Sets the value of [next_page_token][crate::model::ListWorkflowsResponse::next_page_token].
1228 ///
1229 /// # Example
1230 /// ```ignore,no_run
1231 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1232 /// let x = ListWorkflowsResponse::new().set_next_page_token("example");
1233 /// ```
1234 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1235 self.next_page_token = v.into();
1236 self
1237 }
1238
1239 /// Sets the value of [unreachable][crate::model::ListWorkflowsResponse::unreachable].
1240 ///
1241 /// # Example
1242 /// ```ignore,no_run
1243 /// # use google_cloud_workflows_v1::model::ListWorkflowsResponse;
1244 /// let x = ListWorkflowsResponse::new().set_unreachable(["a", "b", "c"]);
1245 /// ```
1246 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1247 where
1248 T: std::iter::IntoIterator<Item = V>,
1249 V: std::convert::Into<std::string::String>,
1250 {
1251 use std::iter::Iterator;
1252 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1253 self
1254 }
1255}
1256
1257impl wkt::message::Message for ListWorkflowsResponse {
1258 fn typename() -> &'static str {
1259 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowsResponse"
1260 }
1261}
1262
1263#[doc(hidden)]
1264impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowsResponse {
1265 type PageItem = crate::model::Workflow;
1266
1267 fn items(self) -> std::vec::Vec<Self::PageItem> {
1268 self.workflows
1269 }
1270
1271 fn next_page_token(&self) -> std::string::String {
1272 use std::clone::Clone;
1273 self.next_page_token.clone()
1274 }
1275}
1276
1277/// Request for the
1278/// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
1279///
1280/// [google.cloud.workflows.v1.Workflows.GetWorkflow]: crate::client::Workflows::get_workflow
1281#[derive(Clone, Default, PartialEq)]
1282#[non_exhaustive]
1283pub struct GetWorkflowRequest {
1284 /// Required. Name of the workflow for which information should be retrieved.
1285 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1286 pub name: std::string::String,
1287
1288 /// Optional. The revision of the workflow to retrieve. If the revision_id is
1289 /// empty, the latest revision is retrieved.
1290 /// The format is "000001-a4d", where the first six characters define
1291 /// the zero-padded decimal revision number. They are followed by a hyphen and
1292 /// three hexadecimal characters.
1293 pub revision_id: std::string::String,
1294
1295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1296}
1297
1298impl GetWorkflowRequest {
1299 pub fn new() -> Self {
1300 std::default::Default::default()
1301 }
1302
1303 /// Sets the value of [name][crate::model::GetWorkflowRequest::name].
1304 ///
1305 /// # Example
1306 /// ```ignore,no_run
1307 /// # use google_cloud_workflows_v1::model::GetWorkflowRequest;
1308 /// let x = GetWorkflowRequest::new().set_name("example");
1309 /// ```
1310 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1311 self.name = v.into();
1312 self
1313 }
1314
1315 /// Sets the value of [revision_id][crate::model::GetWorkflowRequest::revision_id].
1316 ///
1317 /// # Example
1318 /// ```ignore,no_run
1319 /// # use google_cloud_workflows_v1::model::GetWorkflowRequest;
1320 /// let x = GetWorkflowRequest::new().set_revision_id("example");
1321 /// ```
1322 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1323 self.revision_id = v.into();
1324 self
1325 }
1326}
1327
1328impl wkt::message::Message for GetWorkflowRequest {
1329 fn typename() -> &'static str {
1330 "type.googleapis.com/google.cloud.workflows.v1.GetWorkflowRequest"
1331 }
1332}
1333
1334/// Request for the
1335/// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
1336/// method.
1337///
1338/// [google.cloud.workflows.v1.Workflows.CreateWorkflow]: crate::client::Workflows::create_workflow
1339#[derive(Clone, Default, PartialEq)]
1340#[non_exhaustive]
1341pub struct CreateWorkflowRequest {
1342 /// Required. Project and location in which the workflow should be created.
1343 /// Format: projects/{project}/locations/{location}
1344 pub parent: std::string::String,
1345
1346 /// Required. Workflow to be created.
1347 pub workflow: std::option::Option<crate::model::Workflow>,
1348
1349 /// Required. The ID of the workflow to be created. It has to fulfill the
1350 /// following requirements:
1351 ///
1352 /// * Must contain only letters, numbers, underscores and hyphens.
1353 /// * Must start with a letter.
1354 /// * Must be between 1-64 characters.
1355 /// * Must end with a number or a letter.
1356 /// * Must be unique within the customer project and location.
1357 pub workflow_id: std::string::String,
1358
1359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1360}
1361
1362impl CreateWorkflowRequest {
1363 pub fn new() -> Self {
1364 std::default::Default::default()
1365 }
1366
1367 /// Sets the value of [parent][crate::model::CreateWorkflowRequest::parent].
1368 ///
1369 /// # Example
1370 /// ```ignore,no_run
1371 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1372 /// let x = CreateWorkflowRequest::new().set_parent("example");
1373 /// ```
1374 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1375 self.parent = v.into();
1376 self
1377 }
1378
1379 /// Sets the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
1380 ///
1381 /// # Example
1382 /// ```ignore,no_run
1383 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1384 /// use google_cloud_workflows_v1::model::Workflow;
1385 /// let x = CreateWorkflowRequest::new().set_workflow(Workflow::default()/* use setters */);
1386 /// ```
1387 pub fn set_workflow<T>(mut self, v: T) -> Self
1388 where
1389 T: std::convert::Into<crate::model::Workflow>,
1390 {
1391 self.workflow = std::option::Option::Some(v.into());
1392 self
1393 }
1394
1395 /// Sets or clears the value of [workflow][crate::model::CreateWorkflowRequest::workflow].
1396 ///
1397 /// # Example
1398 /// ```ignore,no_run
1399 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1400 /// use google_cloud_workflows_v1::model::Workflow;
1401 /// let x = CreateWorkflowRequest::new().set_or_clear_workflow(Some(Workflow::default()/* use setters */));
1402 /// let x = CreateWorkflowRequest::new().set_or_clear_workflow(None::<Workflow>);
1403 /// ```
1404 pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
1405 where
1406 T: std::convert::Into<crate::model::Workflow>,
1407 {
1408 self.workflow = v.map(|x| x.into());
1409 self
1410 }
1411
1412 /// Sets the value of [workflow_id][crate::model::CreateWorkflowRequest::workflow_id].
1413 ///
1414 /// # Example
1415 /// ```ignore,no_run
1416 /// # use google_cloud_workflows_v1::model::CreateWorkflowRequest;
1417 /// let x = CreateWorkflowRequest::new().set_workflow_id("example");
1418 /// ```
1419 pub fn set_workflow_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1420 self.workflow_id = v.into();
1421 self
1422 }
1423}
1424
1425impl wkt::message::Message for CreateWorkflowRequest {
1426 fn typename() -> &'static str {
1427 "type.googleapis.com/google.cloud.workflows.v1.CreateWorkflowRequest"
1428 }
1429}
1430
1431/// Request for the
1432/// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
1433/// method.
1434///
1435/// [google.cloud.workflows.v1.Workflows.DeleteWorkflow]: crate::client::Workflows::delete_workflow
1436#[derive(Clone, Default, PartialEq)]
1437#[non_exhaustive]
1438pub struct DeleteWorkflowRequest {
1439 /// Required. Name of the workflow to be deleted.
1440 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1441 pub name: std::string::String,
1442
1443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1444}
1445
1446impl DeleteWorkflowRequest {
1447 pub fn new() -> Self {
1448 std::default::Default::default()
1449 }
1450
1451 /// Sets the value of [name][crate::model::DeleteWorkflowRequest::name].
1452 ///
1453 /// # Example
1454 /// ```ignore,no_run
1455 /// # use google_cloud_workflows_v1::model::DeleteWorkflowRequest;
1456 /// let x = DeleteWorkflowRequest::new().set_name("example");
1457 /// ```
1458 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1459 self.name = v.into();
1460 self
1461 }
1462}
1463
1464impl wkt::message::Message for DeleteWorkflowRequest {
1465 fn typename() -> &'static str {
1466 "type.googleapis.com/google.cloud.workflows.v1.DeleteWorkflowRequest"
1467 }
1468}
1469
1470/// Request for the
1471/// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
1472/// method.
1473///
1474/// [google.cloud.workflows.v1.Workflows.UpdateWorkflow]: crate::client::Workflows::update_workflow
1475#[derive(Clone, Default, PartialEq)]
1476#[non_exhaustive]
1477pub struct UpdateWorkflowRequest {
1478 /// Required. Workflow to be updated.
1479 pub workflow: std::option::Option<crate::model::Workflow>,
1480
1481 /// List of fields to be updated. If not present, the entire workflow
1482 /// will be updated.
1483 pub update_mask: std::option::Option<wkt::FieldMask>,
1484
1485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1486}
1487
1488impl UpdateWorkflowRequest {
1489 pub fn new() -> Self {
1490 std::default::Default::default()
1491 }
1492
1493 /// Sets the value of [workflow][crate::model::UpdateWorkflowRequest::workflow].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1498 /// use google_cloud_workflows_v1::model::Workflow;
1499 /// let x = UpdateWorkflowRequest::new().set_workflow(Workflow::default()/* use setters */);
1500 /// ```
1501 pub fn set_workflow<T>(mut self, v: T) -> Self
1502 where
1503 T: std::convert::Into<crate::model::Workflow>,
1504 {
1505 self.workflow = std::option::Option::Some(v.into());
1506 self
1507 }
1508
1509 /// Sets or clears 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_or_clear_workflow(Some(Workflow::default()/* use setters */));
1516 /// let x = UpdateWorkflowRequest::new().set_or_clear_workflow(None::<Workflow>);
1517 /// ```
1518 pub fn set_or_clear_workflow<T>(mut self, v: std::option::Option<T>) -> Self
1519 where
1520 T: std::convert::Into<crate::model::Workflow>,
1521 {
1522 self.workflow = v.map(|x| x.into());
1523 self
1524 }
1525
1526 /// Sets the value of [update_mask][crate::model::UpdateWorkflowRequest::update_mask].
1527 ///
1528 /// # Example
1529 /// ```ignore,no_run
1530 /// # use google_cloud_workflows_v1::model::UpdateWorkflowRequest;
1531 /// use wkt::FieldMask;
1532 /// let x = UpdateWorkflowRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1533 /// ```
1534 pub fn set_update_mask<T>(mut self, v: T) -> Self
1535 where
1536 T: std::convert::Into<wkt::FieldMask>,
1537 {
1538 self.update_mask = std::option::Option::Some(v.into());
1539 self
1540 }
1541
1542 /// Sets or clears 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_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1549 /// let x = UpdateWorkflowRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1550 /// ```
1551 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1552 where
1553 T: std::convert::Into<wkt::FieldMask>,
1554 {
1555 self.update_mask = v.map(|x| x.into());
1556 self
1557 }
1558}
1559
1560impl wkt::message::Message for UpdateWorkflowRequest {
1561 fn typename() -> &'static str {
1562 "type.googleapis.com/google.cloud.workflows.v1.UpdateWorkflowRequest"
1563 }
1564}
1565
1566/// Represents the metadata of the long-running operation.
1567#[derive(Clone, Default, PartialEq)]
1568#[non_exhaustive]
1569pub struct OperationMetadata {
1570 /// The time the operation was created.
1571 pub create_time: std::option::Option<wkt::Timestamp>,
1572
1573 /// The time the operation finished running.
1574 pub end_time: std::option::Option<wkt::Timestamp>,
1575
1576 /// Server-defined resource path for the target of the operation.
1577 pub target: std::string::String,
1578
1579 /// Name of the verb executed by the operation.
1580 pub verb: std::string::String,
1581
1582 /// API version used to start the operation.
1583 pub api_version: std::string::String,
1584
1585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1586}
1587
1588impl OperationMetadata {
1589 pub fn new() -> Self {
1590 std::default::Default::default()
1591 }
1592
1593 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1594 ///
1595 /// # Example
1596 /// ```ignore,no_run
1597 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1598 /// use wkt::Timestamp;
1599 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
1600 /// ```
1601 pub fn set_create_time<T>(mut self, v: T) -> Self
1602 where
1603 T: std::convert::Into<wkt::Timestamp>,
1604 {
1605 self.create_time = std::option::Option::Some(v.into());
1606 self
1607 }
1608
1609 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1614 /// use wkt::Timestamp;
1615 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1616 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
1617 /// ```
1618 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1619 where
1620 T: std::convert::Into<wkt::Timestamp>,
1621 {
1622 self.create_time = v.map(|x| x.into());
1623 self
1624 }
1625
1626 /// Sets the value of [end_time][crate::model::OperationMetadata::end_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_end_time(Timestamp::default()/* use setters */);
1633 /// ```
1634 pub fn set_end_time<T>(mut self, v: T) -> Self
1635 where
1636 T: std::convert::Into<wkt::Timestamp>,
1637 {
1638 self.end_time = std::option::Option::Some(v.into());
1639 self
1640 }
1641
1642 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1643 ///
1644 /// # Example
1645 /// ```ignore,no_run
1646 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1647 /// use wkt::Timestamp;
1648 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1649 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1650 /// ```
1651 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1652 where
1653 T: std::convert::Into<wkt::Timestamp>,
1654 {
1655 self.end_time = v.map(|x| x.into());
1656 self
1657 }
1658
1659 /// Sets the value of [target][crate::model::OperationMetadata::target].
1660 ///
1661 /// # Example
1662 /// ```ignore,no_run
1663 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1664 /// let x = OperationMetadata::new().set_target("example");
1665 /// ```
1666 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1667 self.target = v.into();
1668 self
1669 }
1670
1671 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1672 ///
1673 /// # Example
1674 /// ```ignore,no_run
1675 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1676 /// let x = OperationMetadata::new().set_verb("example");
1677 /// ```
1678 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1679 self.verb = v.into();
1680 self
1681 }
1682
1683 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1684 ///
1685 /// # Example
1686 /// ```ignore,no_run
1687 /// # use google_cloud_workflows_v1::model::OperationMetadata;
1688 /// let x = OperationMetadata::new().set_api_version("example");
1689 /// ```
1690 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.api_version = v.into();
1692 self
1693 }
1694}
1695
1696impl wkt::message::Message for OperationMetadata {
1697 fn typename() -> &'static str {
1698 "type.googleapis.com/google.cloud.workflows.v1.OperationMetadata"
1699 }
1700}
1701
1702/// Request for the
1703/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1704/// method.
1705///
1706/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1707#[derive(Clone, Default, PartialEq)]
1708#[non_exhaustive]
1709pub struct ListWorkflowRevisionsRequest {
1710 /// Required. Workflow for which the revisions should be listed.
1711 /// Format: projects/{project}/locations/{location}/workflows/{workflow}
1712 pub name: std::string::String,
1713
1714 /// The maximum number of revisions to return per page. If a value is not
1715 /// specified, a default value of 20 is used. The maximum permitted value is
1716 /// 100. Values greater than 100 are coerced down to 100.
1717 pub page_size: i32,
1718
1719 /// The page token, received from a previous ListWorkflowRevisions call.
1720 /// Provide this to retrieve the subsequent page.
1721 pub page_token: std::string::String,
1722
1723 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1724}
1725
1726impl ListWorkflowRevisionsRequest {
1727 pub fn new() -> Self {
1728 std::default::Default::default()
1729 }
1730
1731 /// Sets the value of [name][crate::model::ListWorkflowRevisionsRequest::name].
1732 ///
1733 /// # Example
1734 /// ```ignore,no_run
1735 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1736 /// let x = ListWorkflowRevisionsRequest::new().set_name("example");
1737 /// ```
1738 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1739 self.name = v.into();
1740 self
1741 }
1742
1743 /// Sets the value of [page_size][crate::model::ListWorkflowRevisionsRequest::page_size].
1744 ///
1745 /// # Example
1746 /// ```ignore,no_run
1747 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1748 /// let x = ListWorkflowRevisionsRequest::new().set_page_size(42);
1749 /// ```
1750 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1751 self.page_size = v.into();
1752 self
1753 }
1754
1755 /// Sets the value of [page_token][crate::model::ListWorkflowRevisionsRequest::page_token].
1756 ///
1757 /// # Example
1758 /// ```ignore,no_run
1759 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsRequest;
1760 /// let x = ListWorkflowRevisionsRequest::new().set_page_token("example");
1761 /// ```
1762 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1763 self.page_token = v.into();
1764 self
1765 }
1766}
1767
1768impl wkt::message::Message for ListWorkflowRevisionsRequest {
1769 fn typename() -> &'static str {
1770 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsRequest"
1771 }
1772}
1773
1774/// Response for the
1775/// [ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1776/// method.
1777///
1778/// [google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]: crate::client::Workflows::list_workflow_revisions
1779#[derive(Clone, Default, PartialEq)]
1780#[non_exhaustive]
1781pub struct ListWorkflowRevisionsResponse {
1782 /// The revisions of the workflow, ordered in reverse chronological order.
1783 pub workflows: std::vec::Vec<crate::model::Workflow>,
1784
1785 /// A token, which can be sent as `page_token` to retrieve the next page.
1786 /// If this field is omitted, there are no subsequent pages.
1787 pub next_page_token: std::string::String,
1788
1789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1790}
1791
1792impl ListWorkflowRevisionsResponse {
1793 pub fn new() -> Self {
1794 std::default::Default::default()
1795 }
1796
1797 /// Sets the value of [workflows][crate::model::ListWorkflowRevisionsResponse::workflows].
1798 ///
1799 /// # Example
1800 /// ```ignore,no_run
1801 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsResponse;
1802 /// use google_cloud_workflows_v1::model::Workflow;
1803 /// let x = ListWorkflowRevisionsResponse::new()
1804 /// .set_workflows([
1805 /// Workflow::default()/* use setters */,
1806 /// Workflow::default()/* use (different) setters */,
1807 /// ]);
1808 /// ```
1809 pub fn set_workflows<T, V>(mut self, v: T) -> Self
1810 where
1811 T: std::iter::IntoIterator<Item = V>,
1812 V: std::convert::Into<crate::model::Workflow>,
1813 {
1814 use std::iter::Iterator;
1815 self.workflows = v.into_iter().map(|i| i.into()).collect();
1816 self
1817 }
1818
1819 /// Sets the value of [next_page_token][crate::model::ListWorkflowRevisionsResponse::next_page_token].
1820 ///
1821 /// # Example
1822 /// ```ignore,no_run
1823 /// # use google_cloud_workflows_v1::model::ListWorkflowRevisionsResponse;
1824 /// let x = ListWorkflowRevisionsResponse::new().set_next_page_token("example");
1825 /// ```
1826 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1827 self.next_page_token = v.into();
1828 self
1829 }
1830}
1831
1832impl wkt::message::Message for ListWorkflowRevisionsResponse {
1833 fn typename() -> &'static str {
1834 "type.googleapis.com/google.cloud.workflows.v1.ListWorkflowRevisionsResponse"
1835 }
1836}
1837
1838#[doc(hidden)]
1839impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowRevisionsResponse {
1840 type PageItem = crate::model::Workflow;
1841
1842 fn items(self) -> std::vec::Vec<Self::PageItem> {
1843 self.workflows
1844 }
1845
1846 fn next_page_token(&self) -> std::string::String {
1847 use std::clone::Clone;
1848 self.next_page_token.clone()
1849 }
1850}
1851
1852/// Define possible options for enabling the execution history level.
1853///
1854/// # Working with unknown values
1855///
1856/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1857/// additional enum variants at any time. Adding new variants is not considered
1858/// a breaking change. Applications should write their code in anticipation of:
1859///
1860/// - New values appearing in future releases of the client library, **and**
1861/// - New values received dynamically, without application changes.
1862///
1863/// Please consult the [Working with enums] section in the user guide for some
1864/// guidelines.
1865///
1866/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1867#[derive(Clone, Debug, PartialEq)]
1868#[non_exhaustive]
1869pub enum ExecutionHistoryLevel {
1870 /// The default/unset value.
1871 Unspecified,
1872 /// Enable execution history basic feature.
1873 ExecutionHistoryBasic,
1874 /// Enable execution history detailed feature.
1875 ExecutionHistoryDetailed,
1876 /// If set, the enum was initialized with an unknown value.
1877 ///
1878 /// Applications can examine the value using [ExecutionHistoryLevel::value] or
1879 /// [ExecutionHistoryLevel::name].
1880 UnknownValue(execution_history_level::UnknownValue),
1881}
1882
1883#[doc(hidden)]
1884pub mod execution_history_level {
1885 #[allow(unused_imports)]
1886 use super::*;
1887 #[derive(Clone, Debug, PartialEq)]
1888 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1889}
1890
1891impl ExecutionHistoryLevel {
1892 /// Gets the enum value.
1893 ///
1894 /// Returns `None` if the enum contains an unknown value deserialized from
1895 /// the string representation of enums.
1896 pub fn value(&self) -> std::option::Option<i32> {
1897 match self {
1898 Self::Unspecified => std::option::Option::Some(0),
1899 Self::ExecutionHistoryBasic => std::option::Option::Some(1),
1900 Self::ExecutionHistoryDetailed => std::option::Option::Some(2),
1901 Self::UnknownValue(u) => u.0.value(),
1902 }
1903 }
1904
1905 /// Gets the enum value as a string.
1906 ///
1907 /// Returns `None` if the enum contains an unknown value deserialized from
1908 /// the integer representation of enums.
1909 pub fn name(&self) -> std::option::Option<&str> {
1910 match self {
1911 Self::Unspecified => std::option::Option::Some("EXECUTION_HISTORY_LEVEL_UNSPECIFIED"),
1912 Self::ExecutionHistoryBasic => std::option::Option::Some("EXECUTION_HISTORY_BASIC"),
1913 Self::ExecutionHistoryDetailed => {
1914 std::option::Option::Some("EXECUTION_HISTORY_DETAILED")
1915 }
1916 Self::UnknownValue(u) => u.0.name(),
1917 }
1918 }
1919}
1920
1921impl std::default::Default for ExecutionHistoryLevel {
1922 fn default() -> Self {
1923 use std::convert::From;
1924 Self::from(0)
1925 }
1926}
1927
1928impl std::fmt::Display for ExecutionHistoryLevel {
1929 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1930 wkt::internal::display_enum(f, self.name(), self.value())
1931 }
1932}
1933
1934impl std::convert::From<i32> for ExecutionHistoryLevel {
1935 fn from(value: i32) -> Self {
1936 match value {
1937 0 => Self::Unspecified,
1938 1 => Self::ExecutionHistoryBasic,
1939 2 => Self::ExecutionHistoryDetailed,
1940 _ => Self::UnknownValue(execution_history_level::UnknownValue(
1941 wkt::internal::UnknownEnumValue::Integer(value),
1942 )),
1943 }
1944 }
1945}
1946
1947impl std::convert::From<&str> for ExecutionHistoryLevel {
1948 fn from(value: &str) -> Self {
1949 use std::string::ToString;
1950 match value {
1951 "EXECUTION_HISTORY_LEVEL_UNSPECIFIED" => Self::Unspecified,
1952 "EXECUTION_HISTORY_BASIC" => Self::ExecutionHistoryBasic,
1953 "EXECUTION_HISTORY_DETAILED" => Self::ExecutionHistoryDetailed,
1954 _ => Self::UnknownValue(execution_history_level::UnknownValue(
1955 wkt::internal::UnknownEnumValue::String(value.to_string()),
1956 )),
1957 }
1958 }
1959}
1960
1961impl serde::ser::Serialize for ExecutionHistoryLevel {
1962 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1963 where
1964 S: serde::Serializer,
1965 {
1966 match self {
1967 Self::Unspecified => serializer.serialize_i32(0),
1968 Self::ExecutionHistoryBasic => serializer.serialize_i32(1),
1969 Self::ExecutionHistoryDetailed => serializer.serialize_i32(2),
1970 Self::UnknownValue(u) => u.0.serialize(serializer),
1971 }
1972 }
1973}
1974
1975impl<'de> serde::de::Deserialize<'de> for ExecutionHistoryLevel {
1976 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1977 where
1978 D: serde::Deserializer<'de>,
1979 {
1980 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionHistoryLevel>::new(
1981 ".google.cloud.workflows.v1.ExecutionHistoryLevel",
1982 ))
1983 }
1984}