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