google_cloud_bigquery_migration_v2/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#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_rpc;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// A migration workflow which specifies what needs to be done for an EDW
38/// migration.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct MigrationWorkflow {
42 /// Output only. Immutable. Identifier. The unique identifier for the migration
43 /// workflow. The ID is server-generated.
44 ///
45 /// Example: `projects/123/locations/us/workflows/345`
46 pub name: std::string::String,
47
48 /// The display name of the workflow. This can be set to give a workflow
49 /// a descriptive name. There is no guarantee or enforcement of uniqueness.
50 pub display_name: std::string::String,
51
52 /// The tasks in a workflow in a named map. The name (i.e. key) has no
53 /// meaning and is merely a convenient way to address a specific task
54 /// in a workflow.
55 pub tasks: std::collections::HashMap<std::string::String, crate::model::MigrationTask>,
56
57 /// Output only. That status of the workflow.
58 pub state: crate::model::migration_workflow::State,
59
60 /// Time when the workflow was created.
61 pub create_time: std::option::Option<wkt::Timestamp>,
62
63 /// Time when the workflow was last updated.
64 pub last_update_time: std::option::Option<wkt::Timestamp>,
65
66 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl MigrationWorkflow {
70 pub fn new() -> Self {
71 std::default::Default::default()
72 }
73
74 /// Sets the value of [name][crate::model::MigrationWorkflow::name].
75 ///
76 /// # Example
77 /// ```ignore,no_run
78 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
79 /// let x = MigrationWorkflow::new().set_name("example");
80 /// ```
81 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82 self.name = v.into();
83 self
84 }
85
86 /// Sets the value of [display_name][crate::model::MigrationWorkflow::display_name].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
91 /// let x = MigrationWorkflow::new().set_display_name("example");
92 /// ```
93 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.display_name = v.into();
95 self
96 }
97
98 /// Sets the value of [tasks][crate::model::MigrationWorkflow::tasks].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
103 /// use google_cloud_bigquery_migration_v2::model::MigrationTask;
104 /// let x = MigrationWorkflow::new().set_tasks([
105 /// ("key0", MigrationTask::default()/* use setters */),
106 /// ("key1", MigrationTask::default()/* use (different) setters */),
107 /// ]);
108 /// ```
109 pub fn set_tasks<T, K, V>(mut self, v: T) -> Self
110 where
111 T: std::iter::IntoIterator<Item = (K, V)>,
112 K: std::convert::Into<std::string::String>,
113 V: std::convert::Into<crate::model::MigrationTask>,
114 {
115 use std::iter::Iterator;
116 self.tasks = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
117 self
118 }
119
120 /// Sets the value of [state][crate::model::MigrationWorkflow::state].
121 ///
122 /// # Example
123 /// ```ignore,no_run
124 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
125 /// use google_cloud_bigquery_migration_v2::model::migration_workflow::State;
126 /// let x0 = MigrationWorkflow::new().set_state(State::Draft);
127 /// let x1 = MigrationWorkflow::new().set_state(State::Running);
128 /// let x2 = MigrationWorkflow::new().set_state(State::Paused);
129 /// ```
130 pub fn set_state<T: std::convert::Into<crate::model::migration_workflow::State>>(
131 mut self,
132 v: T,
133 ) -> Self {
134 self.state = v.into();
135 self
136 }
137
138 /// Sets the value of [create_time][crate::model::MigrationWorkflow::create_time].
139 ///
140 /// # Example
141 /// ```ignore,no_run
142 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
143 /// use wkt::Timestamp;
144 /// let x = MigrationWorkflow::new().set_create_time(Timestamp::default()/* use setters */);
145 /// ```
146 pub fn set_create_time<T>(mut self, v: T) -> Self
147 where
148 T: std::convert::Into<wkt::Timestamp>,
149 {
150 self.create_time = std::option::Option::Some(v.into());
151 self
152 }
153
154 /// Sets or clears the value of [create_time][crate::model::MigrationWorkflow::create_time].
155 ///
156 /// # Example
157 /// ```ignore,no_run
158 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
159 /// use wkt::Timestamp;
160 /// let x = MigrationWorkflow::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
161 /// let x = MigrationWorkflow::new().set_or_clear_create_time(None::<Timestamp>);
162 /// ```
163 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
164 where
165 T: std::convert::Into<wkt::Timestamp>,
166 {
167 self.create_time = v.map(|x| x.into());
168 self
169 }
170
171 /// Sets the value of [last_update_time][crate::model::MigrationWorkflow::last_update_time].
172 ///
173 /// # Example
174 /// ```ignore,no_run
175 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
176 /// use wkt::Timestamp;
177 /// let x = MigrationWorkflow::new().set_last_update_time(Timestamp::default()/* use setters */);
178 /// ```
179 pub fn set_last_update_time<T>(mut self, v: T) -> Self
180 where
181 T: std::convert::Into<wkt::Timestamp>,
182 {
183 self.last_update_time = std::option::Option::Some(v.into());
184 self
185 }
186
187 /// Sets or clears the value of [last_update_time][crate::model::MigrationWorkflow::last_update_time].
188 ///
189 /// # Example
190 /// ```ignore,no_run
191 /// # use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
192 /// use wkt::Timestamp;
193 /// let x = MigrationWorkflow::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
194 /// let x = MigrationWorkflow::new().set_or_clear_last_update_time(None::<Timestamp>);
195 /// ```
196 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
197 where
198 T: std::convert::Into<wkt::Timestamp>,
199 {
200 self.last_update_time = v.map(|x| x.into());
201 self
202 }
203}
204
205impl wkt::message::Message for MigrationWorkflow {
206 fn typename() -> &'static str {
207 "type.googleapis.com/google.cloud.bigquery.migration.v2.MigrationWorkflow"
208 }
209}
210
211/// Defines additional types related to [MigrationWorkflow].
212pub mod migration_workflow {
213 #[allow(unused_imports)]
214 use super::*;
215
216 /// Possible migration workflow states.
217 ///
218 /// # Working with unknown values
219 ///
220 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
221 /// additional enum variants at any time. Adding new variants is not considered
222 /// a breaking change. Applications should write their code in anticipation of:
223 ///
224 /// - New values appearing in future releases of the client library, **and**
225 /// - New values received dynamically, without application changes.
226 ///
227 /// Please consult the [Working with enums] section in the user guide for some
228 /// guidelines.
229 ///
230 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
231 #[derive(Clone, Debug, PartialEq)]
232 #[non_exhaustive]
233 pub enum State {
234 /// Workflow state is unspecified.
235 Unspecified,
236 /// Workflow is in draft status, i.e. tasks are not yet eligible for
237 /// execution.
238 Draft,
239 /// Workflow is running (i.e. tasks are eligible for execution).
240 Running,
241 /// Workflow is paused. Tasks currently in progress may continue, but no
242 /// further tasks will be scheduled.
243 Paused,
244 /// Workflow is complete. There should not be any task in a non-terminal
245 /// state, but if they are (e.g. forced termination), they will not be
246 /// scheduled.
247 Completed,
248 /// If set, the enum was initialized with an unknown value.
249 ///
250 /// Applications can examine the value using [State::value] or
251 /// [State::name].
252 UnknownValue(state::UnknownValue),
253 }
254
255 #[doc(hidden)]
256 pub mod state {
257 #[allow(unused_imports)]
258 use super::*;
259 #[derive(Clone, Debug, PartialEq)]
260 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
261 }
262
263 impl State {
264 /// Gets the enum value.
265 ///
266 /// Returns `None` if the enum contains an unknown value deserialized from
267 /// the string representation of enums.
268 pub fn value(&self) -> std::option::Option<i32> {
269 match self {
270 Self::Unspecified => std::option::Option::Some(0),
271 Self::Draft => std::option::Option::Some(1),
272 Self::Running => std::option::Option::Some(2),
273 Self::Paused => std::option::Option::Some(3),
274 Self::Completed => std::option::Option::Some(4),
275 Self::UnknownValue(u) => u.0.value(),
276 }
277 }
278
279 /// Gets the enum value as a string.
280 ///
281 /// Returns `None` if the enum contains an unknown value deserialized from
282 /// the integer representation of enums.
283 pub fn name(&self) -> std::option::Option<&str> {
284 match self {
285 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
286 Self::Draft => std::option::Option::Some("DRAFT"),
287 Self::Running => std::option::Option::Some("RUNNING"),
288 Self::Paused => std::option::Option::Some("PAUSED"),
289 Self::Completed => std::option::Option::Some("COMPLETED"),
290 Self::UnknownValue(u) => u.0.name(),
291 }
292 }
293 }
294
295 impl std::default::Default for State {
296 fn default() -> Self {
297 use std::convert::From;
298 Self::from(0)
299 }
300 }
301
302 impl std::fmt::Display for State {
303 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
304 wkt::internal::display_enum(f, self.name(), self.value())
305 }
306 }
307
308 impl std::convert::From<i32> for State {
309 fn from(value: i32) -> Self {
310 match value {
311 0 => Self::Unspecified,
312 1 => Self::Draft,
313 2 => Self::Running,
314 3 => Self::Paused,
315 4 => Self::Completed,
316 _ => Self::UnknownValue(state::UnknownValue(
317 wkt::internal::UnknownEnumValue::Integer(value),
318 )),
319 }
320 }
321 }
322
323 impl std::convert::From<&str> for State {
324 fn from(value: &str) -> Self {
325 use std::string::ToString;
326 match value {
327 "STATE_UNSPECIFIED" => Self::Unspecified,
328 "DRAFT" => Self::Draft,
329 "RUNNING" => Self::Running,
330 "PAUSED" => Self::Paused,
331 "COMPLETED" => Self::Completed,
332 _ => Self::UnknownValue(state::UnknownValue(
333 wkt::internal::UnknownEnumValue::String(value.to_string()),
334 )),
335 }
336 }
337 }
338
339 impl serde::ser::Serialize for State {
340 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
341 where
342 S: serde::Serializer,
343 {
344 match self {
345 Self::Unspecified => serializer.serialize_i32(0),
346 Self::Draft => serializer.serialize_i32(1),
347 Self::Running => serializer.serialize_i32(2),
348 Self::Paused => serializer.serialize_i32(3),
349 Self::Completed => serializer.serialize_i32(4),
350 Self::UnknownValue(u) => u.0.serialize(serializer),
351 }
352 }
353 }
354
355 impl<'de> serde::de::Deserialize<'de> for State {
356 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
357 where
358 D: serde::Deserializer<'de>,
359 {
360 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
361 ".google.cloud.bigquery.migration.v2.MigrationWorkflow.State",
362 ))
363 }
364 }
365}
366
367/// A single task for a migration which has details about the configuration of
368/// the task.
369#[derive(Clone, Default, PartialEq)]
370#[non_exhaustive]
371pub struct MigrationTask {
372 /// Output only. Immutable. The unique identifier for the migration task. The
373 /// ID is server-generated.
374 pub id: std::string::String,
375
376 /// The type of the task. This must be one of the supported task types:
377 /// Translation_Teradata2BQ, Translation_Redshift2BQ, Translation_Bteq2BQ,
378 /// Translation_Oracle2BQ, Translation_HiveQL2BQ, Translation_SparkSQL2BQ,
379 /// Translation_Snowflake2BQ, Translation_Netezza2BQ,
380 /// Translation_AzureSynapse2BQ, Translation_Vertica2BQ,
381 /// Translation_SQLServer2BQ, Translation_Presto2BQ, Translation_MySQL2BQ,
382 /// Translation_Postgresql2BQ, Translation_SQLite2BQ, Translation_Greenplum2BQ.
383 pub r#type: std::string::String,
384
385 /// Output only. The current state of the task.
386 pub state: crate::model::migration_task::State,
387
388 /// Output only. An explanation that may be populated when the task is in
389 /// FAILED state.
390 pub processing_error: std::option::Option<google_cloud_rpc::model::ErrorInfo>,
391
392 /// Time when the task was created.
393 pub create_time: std::option::Option<wkt::Timestamp>,
394
395 /// Time when the task was last updated.
396 pub last_update_time: std::option::Option<wkt::Timestamp>,
397
398 /// Output only. Provides details to errors and issues encountered while
399 /// processing the task. Presence of error details does not mean that the task
400 /// failed.
401 pub resource_error_details: std::vec::Vec<crate::model::ResourceErrorDetail>,
402
403 /// The number or resources with errors. Note: This is not the total
404 /// number of errors as each resource can have more than one error.
405 /// This is used to indicate truncation by having a `resource_error_count`
406 /// that is higher than the size of `resource_error_details`.
407 pub resource_error_count: i32,
408
409 /// The metrics for the task.
410 pub metrics: std::vec::Vec<crate::model::TimeSeries>,
411
412 /// Output only. The result of the task.
413 pub task_result: std::option::Option<crate::model::MigrationTaskResult>,
414
415 /// Count of all the processing errors in this task and its subtasks.
416 pub total_processing_error_count: i32,
417
418 /// Count of all the resource errors in this task and its subtasks.
419 pub total_resource_error_count: i32,
420
421 /// The details of the task.
422 pub task_details: std::option::Option<crate::model::migration_task::TaskDetails>,
423
424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
425}
426
427impl MigrationTask {
428 pub fn new() -> Self {
429 std::default::Default::default()
430 }
431
432 /// Sets the value of [id][crate::model::MigrationTask::id].
433 ///
434 /// # Example
435 /// ```ignore,no_run
436 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
437 /// let x = MigrationTask::new().set_id("example");
438 /// ```
439 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
440 self.id = v.into();
441 self
442 }
443
444 /// Sets the value of [r#type][crate::model::MigrationTask::type].
445 ///
446 /// # Example
447 /// ```ignore,no_run
448 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
449 /// let x = MigrationTask::new().set_type("example");
450 /// ```
451 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
452 self.r#type = v.into();
453 self
454 }
455
456 /// Sets the value of [state][crate::model::MigrationTask::state].
457 ///
458 /// # Example
459 /// ```ignore,no_run
460 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
461 /// use google_cloud_bigquery_migration_v2::model::migration_task::State;
462 /// let x0 = MigrationTask::new().set_state(State::Pending);
463 /// let x1 = MigrationTask::new().set_state(State::Orchestrating);
464 /// let x2 = MigrationTask::new().set_state(State::Running);
465 /// ```
466 pub fn set_state<T: std::convert::Into<crate::model::migration_task::State>>(
467 mut self,
468 v: T,
469 ) -> Self {
470 self.state = v.into();
471 self
472 }
473
474 /// Sets the value of [processing_error][crate::model::MigrationTask::processing_error].
475 ///
476 /// # Example
477 /// ```ignore,no_run
478 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
479 /// use google_cloud_rpc::model::ErrorInfo;
480 /// let x = MigrationTask::new().set_processing_error(ErrorInfo::default()/* use setters */);
481 /// ```
482 pub fn set_processing_error<T>(mut self, v: T) -> Self
483 where
484 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
485 {
486 self.processing_error = std::option::Option::Some(v.into());
487 self
488 }
489
490 /// Sets or clears the value of [processing_error][crate::model::MigrationTask::processing_error].
491 ///
492 /// # Example
493 /// ```ignore,no_run
494 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
495 /// use google_cloud_rpc::model::ErrorInfo;
496 /// let x = MigrationTask::new().set_or_clear_processing_error(Some(ErrorInfo::default()/* use setters */));
497 /// let x = MigrationTask::new().set_or_clear_processing_error(None::<ErrorInfo>);
498 /// ```
499 pub fn set_or_clear_processing_error<T>(mut self, v: std::option::Option<T>) -> Self
500 where
501 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
502 {
503 self.processing_error = v.map(|x| x.into());
504 self
505 }
506
507 /// Sets the value of [create_time][crate::model::MigrationTask::create_time].
508 ///
509 /// # Example
510 /// ```ignore,no_run
511 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
512 /// use wkt::Timestamp;
513 /// let x = MigrationTask::new().set_create_time(Timestamp::default()/* use setters */);
514 /// ```
515 pub fn set_create_time<T>(mut self, v: T) -> Self
516 where
517 T: std::convert::Into<wkt::Timestamp>,
518 {
519 self.create_time = std::option::Option::Some(v.into());
520 self
521 }
522
523 /// Sets or clears the value of [create_time][crate::model::MigrationTask::create_time].
524 ///
525 /// # Example
526 /// ```ignore,no_run
527 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
528 /// use wkt::Timestamp;
529 /// let x = MigrationTask::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
530 /// let x = MigrationTask::new().set_or_clear_create_time(None::<Timestamp>);
531 /// ```
532 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
533 where
534 T: std::convert::Into<wkt::Timestamp>,
535 {
536 self.create_time = v.map(|x| x.into());
537 self
538 }
539
540 /// Sets the value of [last_update_time][crate::model::MigrationTask::last_update_time].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
545 /// use wkt::Timestamp;
546 /// let x = MigrationTask::new().set_last_update_time(Timestamp::default()/* use setters */);
547 /// ```
548 pub fn set_last_update_time<T>(mut self, v: T) -> Self
549 where
550 T: std::convert::Into<wkt::Timestamp>,
551 {
552 self.last_update_time = std::option::Option::Some(v.into());
553 self
554 }
555
556 /// Sets or clears the value of [last_update_time][crate::model::MigrationTask::last_update_time].
557 ///
558 /// # Example
559 /// ```ignore,no_run
560 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
561 /// use wkt::Timestamp;
562 /// let x = MigrationTask::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
563 /// let x = MigrationTask::new().set_or_clear_last_update_time(None::<Timestamp>);
564 /// ```
565 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
566 where
567 T: std::convert::Into<wkt::Timestamp>,
568 {
569 self.last_update_time = v.map(|x| x.into());
570 self
571 }
572
573 /// Sets the value of [resource_error_details][crate::model::MigrationTask::resource_error_details].
574 ///
575 /// # Example
576 /// ```ignore,no_run
577 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
578 /// use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
579 /// let x = MigrationTask::new()
580 /// .set_resource_error_details([
581 /// ResourceErrorDetail::default()/* use setters */,
582 /// ResourceErrorDetail::default()/* use (different) setters */,
583 /// ]);
584 /// ```
585 pub fn set_resource_error_details<T, V>(mut self, v: T) -> Self
586 where
587 T: std::iter::IntoIterator<Item = V>,
588 V: std::convert::Into<crate::model::ResourceErrorDetail>,
589 {
590 use std::iter::Iterator;
591 self.resource_error_details = v.into_iter().map(|i| i.into()).collect();
592 self
593 }
594
595 /// Sets the value of [resource_error_count][crate::model::MigrationTask::resource_error_count].
596 ///
597 /// # Example
598 /// ```ignore,no_run
599 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
600 /// let x = MigrationTask::new().set_resource_error_count(42);
601 /// ```
602 pub fn set_resource_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
603 self.resource_error_count = v.into();
604 self
605 }
606
607 /// Sets the value of [metrics][crate::model::MigrationTask::metrics].
608 ///
609 /// # Example
610 /// ```ignore,no_run
611 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
612 /// use google_cloud_bigquery_migration_v2::model::TimeSeries;
613 /// let x = MigrationTask::new()
614 /// .set_metrics([
615 /// TimeSeries::default()/* use setters */,
616 /// TimeSeries::default()/* use (different) setters */,
617 /// ]);
618 /// ```
619 pub fn set_metrics<T, V>(mut self, v: T) -> Self
620 where
621 T: std::iter::IntoIterator<Item = V>,
622 V: std::convert::Into<crate::model::TimeSeries>,
623 {
624 use std::iter::Iterator;
625 self.metrics = v.into_iter().map(|i| i.into()).collect();
626 self
627 }
628
629 /// Sets the value of [task_result][crate::model::MigrationTask::task_result].
630 ///
631 /// # Example
632 /// ```ignore,no_run
633 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
634 /// use google_cloud_bigquery_migration_v2::model::MigrationTaskResult;
635 /// let x = MigrationTask::new().set_task_result(MigrationTaskResult::default()/* use setters */);
636 /// ```
637 pub fn set_task_result<T>(mut self, v: T) -> Self
638 where
639 T: std::convert::Into<crate::model::MigrationTaskResult>,
640 {
641 self.task_result = std::option::Option::Some(v.into());
642 self
643 }
644
645 /// Sets or clears the value of [task_result][crate::model::MigrationTask::task_result].
646 ///
647 /// # Example
648 /// ```ignore,no_run
649 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
650 /// use google_cloud_bigquery_migration_v2::model::MigrationTaskResult;
651 /// let x = MigrationTask::new().set_or_clear_task_result(Some(MigrationTaskResult::default()/* use setters */));
652 /// let x = MigrationTask::new().set_or_clear_task_result(None::<MigrationTaskResult>);
653 /// ```
654 pub fn set_or_clear_task_result<T>(mut self, v: std::option::Option<T>) -> Self
655 where
656 T: std::convert::Into<crate::model::MigrationTaskResult>,
657 {
658 self.task_result = v.map(|x| x.into());
659 self
660 }
661
662 /// Sets the value of [total_processing_error_count][crate::model::MigrationTask::total_processing_error_count].
663 ///
664 /// # Example
665 /// ```ignore,no_run
666 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
667 /// let x = MigrationTask::new().set_total_processing_error_count(42);
668 /// ```
669 pub fn set_total_processing_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
670 self.total_processing_error_count = v.into();
671 self
672 }
673
674 /// Sets the value of [total_resource_error_count][crate::model::MigrationTask::total_resource_error_count].
675 ///
676 /// # Example
677 /// ```ignore,no_run
678 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
679 /// let x = MigrationTask::new().set_total_resource_error_count(42);
680 /// ```
681 pub fn set_total_resource_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
682 self.total_resource_error_count = v.into();
683 self
684 }
685
686 /// Sets the value of [task_details][crate::model::MigrationTask::task_details].
687 ///
688 /// Note that all the setters affecting `task_details` are mutually
689 /// exclusive.
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
694 /// use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
695 /// let x = MigrationTask::new().set_task_details(Some(
696 /// google_cloud_bigquery_migration_v2::model::migration_task::TaskDetails::TranslationConfigDetails(TranslationConfigDetails::default().into())));
697 /// ```
698 pub fn set_task_details<
699 T: std::convert::Into<std::option::Option<crate::model::migration_task::TaskDetails>>,
700 >(
701 mut self,
702 v: T,
703 ) -> Self {
704 self.task_details = v.into();
705 self
706 }
707
708 /// The value of [task_details][crate::model::MigrationTask::task_details]
709 /// if it holds a `TranslationConfigDetails`, `None` if the field is not set or
710 /// holds a different branch.
711 pub fn translation_config_details(
712 &self,
713 ) -> std::option::Option<&std::boxed::Box<crate::model::TranslationConfigDetails>> {
714 #[allow(unreachable_patterns)]
715 self.task_details.as_ref().and_then(|v| match v {
716 crate::model::migration_task::TaskDetails::TranslationConfigDetails(v) => {
717 std::option::Option::Some(v)
718 }
719 _ => std::option::Option::None,
720 })
721 }
722
723 /// Sets the value of [task_details][crate::model::MigrationTask::task_details]
724 /// to hold a `TranslationConfigDetails`.
725 ///
726 /// Note that all the setters affecting `task_details` are
727 /// mutually exclusive.
728 ///
729 /// # Example
730 /// ```ignore,no_run
731 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
732 /// use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
733 /// let x = MigrationTask::new().set_translation_config_details(TranslationConfigDetails::default()/* use setters */);
734 /// assert!(x.translation_config_details().is_some());
735 /// assert!(x.translation_details().is_none());
736 /// ```
737 pub fn set_translation_config_details<
738 T: std::convert::Into<std::boxed::Box<crate::model::TranslationConfigDetails>>,
739 >(
740 mut self,
741 v: T,
742 ) -> Self {
743 self.task_details = std::option::Option::Some(
744 crate::model::migration_task::TaskDetails::TranslationConfigDetails(v.into()),
745 );
746 self
747 }
748
749 /// The value of [task_details][crate::model::MigrationTask::task_details]
750 /// if it holds a `TranslationDetails`, `None` if the field is not set or
751 /// holds a different branch.
752 pub fn translation_details(
753 &self,
754 ) -> std::option::Option<&std::boxed::Box<crate::model::TranslationDetails>> {
755 #[allow(unreachable_patterns)]
756 self.task_details.as_ref().and_then(|v| match v {
757 crate::model::migration_task::TaskDetails::TranslationDetails(v) => {
758 std::option::Option::Some(v)
759 }
760 _ => std::option::Option::None,
761 })
762 }
763
764 /// Sets the value of [task_details][crate::model::MigrationTask::task_details]
765 /// to hold a `TranslationDetails`.
766 ///
767 /// Note that all the setters affecting `task_details` are
768 /// mutually exclusive.
769 ///
770 /// # Example
771 /// ```ignore,no_run
772 /// # use google_cloud_bigquery_migration_v2::model::MigrationTask;
773 /// use google_cloud_bigquery_migration_v2::model::TranslationDetails;
774 /// let x = MigrationTask::new().set_translation_details(TranslationDetails::default()/* use setters */);
775 /// assert!(x.translation_details().is_some());
776 /// assert!(x.translation_config_details().is_none());
777 /// ```
778 pub fn set_translation_details<
779 T: std::convert::Into<std::boxed::Box<crate::model::TranslationDetails>>,
780 >(
781 mut self,
782 v: T,
783 ) -> Self {
784 self.task_details = std::option::Option::Some(
785 crate::model::migration_task::TaskDetails::TranslationDetails(v.into()),
786 );
787 self
788 }
789}
790
791impl wkt::message::Message for MigrationTask {
792 fn typename() -> &'static str {
793 "type.googleapis.com/google.cloud.bigquery.migration.v2.MigrationTask"
794 }
795}
796
797/// Defines additional types related to [MigrationTask].
798pub mod migration_task {
799 #[allow(unused_imports)]
800 use super::*;
801
802 /// Possible states of a migration task.
803 ///
804 /// # Working with unknown values
805 ///
806 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
807 /// additional enum variants at any time. Adding new variants is not considered
808 /// a breaking change. Applications should write their code in anticipation of:
809 ///
810 /// - New values appearing in future releases of the client library, **and**
811 /// - New values received dynamically, without application changes.
812 ///
813 /// Please consult the [Working with enums] section in the user guide for some
814 /// guidelines.
815 ///
816 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
817 #[derive(Clone, Debug, PartialEq)]
818 #[non_exhaustive]
819 pub enum State {
820 /// The state is unspecified.
821 Unspecified,
822 /// The task is waiting for orchestration.
823 Pending,
824 /// The task is assigned to an orchestrator.
825 Orchestrating,
826 /// The task is running, i.e. its subtasks are ready for execution.
827 Running,
828 /// Tha task is paused. Assigned subtasks can continue, but no new subtasks
829 /// will be scheduled.
830 Paused,
831 /// The task finished successfully.
832 Succeeded,
833 /// The task finished unsuccessfully.
834 Failed,
835 /// If set, the enum was initialized with an unknown value.
836 ///
837 /// Applications can examine the value using [State::value] or
838 /// [State::name].
839 UnknownValue(state::UnknownValue),
840 }
841
842 #[doc(hidden)]
843 pub mod state {
844 #[allow(unused_imports)]
845 use super::*;
846 #[derive(Clone, Debug, PartialEq)]
847 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
848 }
849
850 impl State {
851 /// Gets the enum value.
852 ///
853 /// Returns `None` if the enum contains an unknown value deserialized from
854 /// the string representation of enums.
855 pub fn value(&self) -> std::option::Option<i32> {
856 match self {
857 Self::Unspecified => std::option::Option::Some(0),
858 Self::Pending => std::option::Option::Some(1),
859 Self::Orchestrating => std::option::Option::Some(2),
860 Self::Running => std::option::Option::Some(3),
861 Self::Paused => std::option::Option::Some(4),
862 Self::Succeeded => std::option::Option::Some(5),
863 Self::Failed => std::option::Option::Some(6),
864 Self::UnknownValue(u) => u.0.value(),
865 }
866 }
867
868 /// Gets the enum value as a string.
869 ///
870 /// Returns `None` if the enum contains an unknown value deserialized from
871 /// the integer representation of enums.
872 pub fn name(&self) -> std::option::Option<&str> {
873 match self {
874 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
875 Self::Pending => std::option::Option::Some("PENDING"),
876 Self::Orchestrating => std::option::Option::Some("ORCHESTRATING"),
877 Self::Running => std::option::Option::Some("RUNNING"),
878 Self::Paused => std::option::Option::Some("PAUSED"),
879 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
880 Self::Failed => std::option::Option::Some("FAILED"),
881 Self::UnknownValue(u) => u.0.name(),
882 }
883 }
884 }
885
886 impl std::default::Default for State {
887 fn default() -> Self {
888 use std::convert::From;
889 Self::from(0)
890 }
891 }
892
893 impl std::fmt::Display for State {
894 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
895 wkt::internal::display_enum(f, self.name(), self.value())
896 }
897 }
898
899 impl std::convert::From<i32> for State {
900 fn from(value: i32) -> Self {
901 match value {
902 0 => Self::Unspecified,
903 1 => Self::Pending,
904 2 => Self::Orchestrating,
905 3 => Self::Running,
906 4 => Self::Paused,
907 5 => Self::Succeeded,
908 6 => Self::Failed,
909 _ => Self::UnknownValue(state::UnknownValue(
910 wkt::internal::UnknownEnumValue::Integer(value),
911 )),
912 }
913 }
914 }
915
916 impl std::convert::From<&str> for State {
917 fn from(value: &str) -> Self {
918 use std::string::ToString;
919 match value {
920 "STATE_UNSPECIFIED" => Self::Unspecified,
921 "PENDING" => Self::Pending,
922 "ORCHESTRATING" => Self::Orchestrating,
923 "RUNNING" => Self::Running,
924 "PAUSED" => Self::Paused,
925 "SUCCEEDED" => Self::Succeeded,
926 "FAILED" => Self::Failed,
927 _ => Self::UnknownValue(state::UnknownValue(
928 wkt::internal::UnknownEnumValue::String(value.to_string()),
929 )),
930 }
931 }
932 }
933
934 impl serde::ser::Serialize for State {
935 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
936 where
937 S: serde::Serializer,
938 {
939 match self {
940 Self::Unspecified => serializer.serialize_i32(0),
941 Self::Pending => serializer.serialize_i32(1),
942 Self::Orchestrating => serializer.serialize_i32(2),
943 Self::Running => serializer.serialize_i32(3),
944 Self::Paused => serializer.serialize_i32(4),
945 Self::Succeeded => serializer.serialize_i32(5),
946 Self::Failed => serializer.serialize_i32(6),
947 Self::UnknownValue(u) => u.0.serialize(serializer),
948 }
949 }
950 }
951
952 impl<'de> serde::de::Deserialize<'de> for State {
953 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
954 where
955 D: serde::Deserializer<'de>,
956 {
957 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
958 ".google.cloud.bigquery.migration.v2.MigrationTask.State",
959 ))
960 }
961 }
962
963 /// The details of the task.
964 #[derive(Clone, Debug, PartialEq)]
965 #[non_exhaustive]
966 pub enum TaskDetails {
967 /// Task configuration for CW Batch/Offline SQL Translation.
968 TranslationConfigDetails(std::boxed::Box<crate::model::TranslationConfigDetails>),
969 /// Task details for unified SQL Translation.
970 TranslationDetails(std::boxed::Box<crate::model::TranslationDetails>),
971 }
972}
973
974/// A subtask for a migration which carries details about the configuration of
975/// the subtask. The content of the details should not matter to the end user,
976/// but is a contract between the subtask creator and subtask worker.
977#[derive(Clone, Default, PartialEq)]
978#[non_exhaustive]
979pub struct MigrationSubtask {
980 /// Output only. Immutable. The resource name for the migration subtask. The ID
981 /// is server-generated.
982 ///
983 /// Example: `projects/123/locations/us/workflows/345/subtasks/678`
984 pub name: std::string::String,
985
986 /// The unique ID of the task to which this subtask belongs.
987 pub task_id: std::string::String,
988
989 /// The type of the Subtask. The migration service does not check whether this
990 /// is a known type. It is up to the task creator (i.e. orchestrator or worker)
991 /// to ensure it only creates subtasks for which there are compatible workers
992 /// polling for Subtasks.
993 pub r#type: std::string::String,
994
995 /// Output only. The current state of the subtask.
996 pub state: crate::model::migration_subtask::State,
997
998 /// Output only. An explanation that may be populated when the task is in
999 /// FAILED state.
1000 pub processing_error: std::option::Option<google_cloud_rpc::model::ErrorInfo>,
1001
1002 /// Output only. Provides details to errors and issues encountered while
1003 /// processing the subtask. Presence of error details does not mean that the
1004 /// subtask failed.
1005 pub resource_error_details: std::vec::Vec<crate::model::ResourceErrorDetail>,
1006
1007 /// The number or resources with errors. Note: This is not the total
1008 /// number of errors as each resource can have more than one error.
1009 /// This is used to indicate truncation by having a `resource_error_count`
1010 /// that is higher than the size of `resource_error_details`.
1011 pub resource_error_count: i32,
1012
1013 /// Time when the subtask was created.
1014 pub create_time: std::option::Option<wkt::Timestamp>,
1015
1016 /// Time when the subtask was last updated.
1017 pub last_update_time: std::option::Option<wkt::Timestamp>,
1018
1019 /// The metrics for the subtask.
1020 pub metrics: std::vec::Vec<crate::model::TimeSeries>,
1021
1022 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1023}
1024
1025impl MigrationSubtask {
1026 pub fn new() -> Self {
1027 std::default::Default::default()
1028 }
1029
1030 /// Sets the value of [name][crate::model::MigrationSubtask::name].
1031 ///
1032 /// # Example
1033 /// ```ignore,no_run
1034 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1035 /// let x = MigrationSubtask::new().set_name("example");
1036 /// ```
1037 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1038 self.name = v.into();
1039 self
1040 }
1041
1042 /// Sets the value of [task_id][crate::model::MigrationSubtask::task_id].
1043 ///
1044 /// # Example
1045 /// ```ignore,no_run
1046 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1047 /// let x = MigrationSubtask::new().set_task_id("example");
1048 /// ```
1049 pub fn set_task_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1050 self.task_id = v.into();
1051 self
1052 }
1053
1054 /// Sets the value of [r#type][crate::model::MigrationSubtask::type].
1055 ///
1056 /// # Example
1057 /// ```ignore,no_run
1058 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1059 /// let x = MigrationSubtask::new().set_type("example");
1060 /// ```
1061 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1062 self.r#type = v.into();
1063 self
1064 }
1065
1066 /// Sets the value of [state][crate::model::MigrationSubtask::state].
1067 ///
1068 /// # Example
1069 /// ```ignore,no_run
1070 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1071 /// use google_cloud_bigquery_migration_v2::model::migration_subtask::State;
1072 /// let x0 = MigrationSubtask::new().set_state(State::Active);
1073 /// let x1 = MigrationSubtask::new().set_state(State::Running);
1074 /// let x2 = MigrationSubtask::new().set_state(State::Succeeded);
1075 /// ```
1076 pub fn set_state<T: std::convert::Into<crate::model::migration_subtask::State>>(
1077 mut self,
1078 v: T,
1079 ) -> Self {
1080 self.state = v.into();
1081 self
1082 }
1083
1084 /// Sets the value of [processing_error][crate::model::MigrationSubtask::processing_error].
1085 ///
1086 /// # Example
1087 /// ```ignore,no_run
1088 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1089 /// use google_cloud_rpc::model::ErrorInfo;
1090 /// let x = MigrationSubtask::new().set_processing_error(ErrorInfo::default()/* use setters */);
1091 /// ```
1092 pub fn set_processing_error<T>(mut self, v: T) -> Self
1093 where
1094 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
1095 {
1096 self.processing_error = std::option::Option::Some(v.into());
1097 self
1098 }
1099
1100 /// Sets or clears the value of [processing_error][crate::model::MigrationSubtask::processing_error].
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1105 /// use google_cloud_rpc::model::ErrorInfo;
1106 /// let x = MigrationSubtask::new().set_or_clear_processing_error(Some(ErrorInfo::default()/* use setters */));
1107 /// let x = MigrationSubtask::new().set_or_clear_processing_error(None::<ErrorInfo>);
1108 /// ```
1109 pub fn set_or_clear_processing_error<T>(mut self, v: std::option::Option<T>) -> Self
1110 where
1111 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
1112 {
1113 self.processing_error = v.map(|x| x.into());
1114 self
1115 }
1116
1117 /// Sets the value of [resource_error_details][crate::model::MigrationSubtask::resource_error_details].
1118 ///
1119 /// # Example
1120 /// ```ignore,no_run
1121 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1122 /// use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
1123 /// let x = MigrationSubtask::new()
1124 /// .set_resource_error_details([
1125 /// ResourceErrorDetail::default()/* use setters */,
1126 /// ResourceErrorDetail::default()/* use (different) setters */,
1127 /// ]);
1128 /// ```
1129 pub fn set_resource_error_details<T, V>(mut self, v: T) -> Self
1130 where
1131 T: std::iter::IntoIterator<Item = V>,
1132 V: std::convert::Into<crate::model::ResourceErrorDetail>,
1133 {
1134 use std::iter::Iterator;
1135 self.resource_error_details = v.into_iter().map(|i| i.into()).collect();
1136 self
1137 }
1138
1139 /// Sets the value of [resource_error_count][crate::model::MigrationSubtask::resource_error_count].
1140 ///
1141 /// # Example
1142 /// ```ignore,no_run
1143 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1144 /// let x = MigrationSubtask::new().set_resource_error_count(42);
1145 /// ```
1146 pub fn set_resource_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1147 self.resource_error_count = v.into();
1148 self
1149 }
1150
1151 /// Sets the value of [create_time][crate::model::MigrationSubtask::create_time].
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1156 /// use wkt::Timestamp;
1157 /// let x = MigrationSubtask::new().set_create_time(Timestamp::default()/* use setters */);
1158 /// ```
1159 pub fn set_create_time<T>(mut self, v: T) -> Self
1160 where
1161 T: std::convert::Into<wkt::Timestamp>,
1162 {
1163 self.create_time = std::option::Option::Some(v.into());
1164 self
1165 }
1166
1167 /// Sets or clears the value of [create_time][crate::model::MigrationSubtask::create_time].
1168 ///
1169 /// # Example
1170 /// ```ignore,no_run
1171 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1172 /// use wkt::Timestamp;
1173 /// let x = MigrationSubtask::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1174 /// let x = MigrationSubtask::new().set_or_clear_create_time(None::<Timestamp>);
1175 /// ```
1176 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1177 where
1178 T: std::convert::Into<wkt::Timestamp>,
1179 {
1180 self.create_time = v.map(|x| x.into());
1181 self
1182 }
1183
1184 /// Sets the value of [last_update_time][crate::model::MigrationSubtask::last_update_time].
1185 ///
1186 /// # Example
1187 /// ```ignore,no_run
1188 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1189 /// use wkt::Timestamp;
1190 /// let x = MigrationSubtask::new().set_last_update_time(Timestamp::default()/* use setters */);
1191 /// ```
1192 pub fn set_last_update_time<T>(mut self, v: T) -> Self
1193 where
1194 T: std::convert::Into<wkt::Timestamp>,
1195 {
1196 self.last_update_time = std::option::Option::Some(v.into());
1197 self
1198 }
1199
1200 /// Sets or clears the value of [last_update_time][crate::model::MigrationSubtask::last_update_time].
1201 ///
1202 /// # Example
1203 /// ```ignore,no_run
1204 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1205 /// use wkt::Timestamp;
1206 /// let x = MigrationSubtask::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
1207 /// let x = MigrationSubtask::new().set_or_clear_last_update_time(None::<Timestamp>);
1208 /// ```
1209 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1210 where
1211 T: std::convert::Into<wkt::Timestamp>,
1212 {
1213 self.last_update_time = v.map(|x| x.into());
1214 self
1215 }
1216
1217 /// Sets the value of [metrics][crate::model::MigrationSubtask::metrics].
1218 ///
1219 /// # Example
1220 /// ```ignore,no_run
1221 /// # use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
1222 /// use google_cloud_bigquery_migration_v2::model::TimeSeries;
1223 /// let x = MigrationSubtask::new()
1224 /// .set_metrics([
1225 /// TimeSeries::default()/* use setters */,
1226 /// TimeSeries::default()/* use (different) setters */,
1227 /// ]);
1228 /// ```
1229 pub fn set_metrics<T, V>(mut self, v: T) -> Self
1230 where
1231 T: std::iter::IntoIterator<Item = V>,
1232 V: std::convert::Into<crate::model::TimeSeries>,
1233 {
1234 use std::iter::Iterator;
1235 self.metrics = v.into_iter().map(|i| i.into()).collect();
1236 self
1237 }
1238}
1239
1240impl wkt::message::Message for MigrationSubtask {
1241 fn typename() -> &'static str {
1242 "type.googleapis.com/google.cloud.bigquery.migration.v2.MigrationSubtask"
1243 }
1244}
1245
1246/// Defines additional types related to [MigrationSubtask].
1247pub mod migration_subtask {
1248 #[allow(unused_imports)]
1249 use super::*;
1250
1251 /// Possible states of a migration subtask.
1252 ///
1253 /// # Working with unknown values
1254 ///
1255 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1256 /// additional enum variants at any time. Adding new variants is not considered
1257 /// a breaking change. Applications should write their code in anticipation of:
1258 ///
1259 /// - New values appearing in future releases of the client library, **and**
1260 /// - New values received dynamically, without application changes.
1261 ///
1262 /// Please consult the [Working with enums] section in the user guide for some
1263 /// guidelines.
1264 ///
1265 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1266 #[derive(Clone, Debug, PartialEq)]
1267 #[non_exhaustive]
1268 pub enum State {
1269 /// The state is unspecified.
1270 Unspecified,
1271 /// The subtask is ready, i.e. it is ready for execution.
1272 Active,
1273 /// The subtask is running, i.e. it is assigned to a worker for execution.
1274 Running,
1275 /// The subtask finished successfully.
1276 Succeeded,
1277 /// The subtask finished unsuccessfully.
1278 Failed,
1279 /// The subtask is paused, i.e., it will not be scheduled. If it was already
1280 /// assigned,it might still finish but no new lease renewals will be granted.
1281 Paused,
1282 /// The subtask is pending a dependency. It will be scheduled once its
1283 /// dependencies are done.
1284 PendingDependency,
1285 /// If set, the enum was initialized with an unknown value.
1286 ///
1287 /// Applications can examine the value using [State::value] or
1288 /// [State::name].
1289 UnknownValue(state::UnknownValue),
1290 }
1291
1292 #[doc(hidden)]
1293 pub mod state {
1294 #[allow(unused_imports)]
1295 use super::*;
1296 #[derive(Clone, Debug, PartialEq)]
1297 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1298 }
1299
1300 impl State {
1301 /// Gets the enum value.
1302 ///
1303 /// Returns `None` if the enum contains an unknown value deserialized from
1304 /// the string representation of enums.
1305 pub fn value(&self) -> std::option::Option<i32> {
1306 match self {
1307 Self::Unspecified => std::option::Option::Some(0),
1308 Self::Active => std::option::Option::Some(1),
1309 Self::Running => std::option::Option::Some(2),
1310 Self::Succeeded => std::option::Option::Some(3),
1311 Self::Failed => std::option::Option::Some(4),
1312 Self::Paused => std::option::Option::Some(5),
1313 Self::PendingDependency => std::option::Option::Some(6),
1314 Self::UnknownValue(u) => u.0.value(),
1315 }
1316 }
1317
1318 /// Gets the enum value as a string.
1319 ///
1320 /// Returns `None` if the enum contains an unknown value deserialized from
1321 /// the integer representation of enums.
1322 pub fn name(&self) -> std::option::Option<&str> {
1323 match self {
1324 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1325 Self::Active => std::option::Option::Some("ACTIVE"),
1326 Self::Running => std::option::Option::Some("RUNNING"),
1327 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1328 Self::Failed => std::option::Option::Some("FAILED"),
1329 Self::Paused => std::option::Option::Some("PAUSED"),
1330 Self::PendingDependency => std::option::Option::Some("PENDING_DEPENDENCY"),
1331 Self::UnknownValue(u) => u.0.name(),
1332 }
1333 }
1334 }
1335
1336 impl std::default::Default for State {
1337 fn default() -> Self {
1338 use std::convert::From;
1339 Self::from(0)
1340 }
1341 }
1342
1343 impl std::fmt::Display for State {
1344 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1345 wkt::internal::display_enum(f, self.name(), self.value())
1346 }
1347 }
1348
1349 impl std::convert::From<i32> for State {
1350 fn from(value: i32) -> Self {
1351 match value {
1352 0 => Self::Unspecified,
1353 1 => Self::Active,
1354 2 => Self::Running,
1355 3 => Self::Succeeded,
1356 4 => Self::Failed,
1357 5 => Self::Paused,
1358 6 => Self::PendingDependency,
1359 _ => Self::UnknownValue(state::UnknownValue(
1360 wkt::internal::UnknownEnumValue::Integer(value),
1361 )),
1362 }
1363 }
1364 }
1365
1366 impl std::convert::From<&str> for State {
1367 fn from(value: &str) -> Self {
1368 use std::string::ToString;
1369 match value {
1370 "STATE_UNSPECIFIED" => Self::Unspecified,
1371 "ACTIVE" => Self::Active,
1372 "RUNNING" => Self::Running,
1373 "SUCCEEDED" => Self::Succeeded,
1374 "FAILED" => Self::Failed,
1375 "PAUSED" => Self::Paused,
1376 "PENDING_DEPENDENCY" => Self::PendingDependency,
1377 _ => Self::UnknownValue(state::UnknownValue(
1378 wkt::internal::UnknownEnumValue::String(value.to_string()),
1379 )),
1380 }
1381 }
1382 }
1383
1384 impl serde::ser::Serialize for State {
1385 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1386 where
1387 S: serde::Serializer,
1388 {
1389 match self {
1390 Self::Unspecified => serializer.serialize_i32(0),
1391 Self::Active => serializer.serialize_i32(1),
1392 Self::Running => serializer.serialize_i32(2),
1393 Self::Succeeded => serializer.serialize_i32(3),
1394 Self::Failed => serializer.serialize_i32(4),
1395 Self::Paused => serializer.serialize_i32(5),
1396 Self::PendingDependency => serializer.serialize_i32(6),
1397 Self::UnknownValue(u) => u.0.serialize(serializer),
1398 }
1399 }
1400 }
1401
1402 impl<'de> serde::de::Deserialize<'de> for State {
1403 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1404 where
1405 D: serde::Deserializer<'de>,
1406 {
1407 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1408 ".google.cloud.bigquery.migration.v2.MigrationSubtask.State",
1409 ))
1410 }
1411 }
1412}
1413
1414/// The migration task result.
1415#[derive(Clone, Default, PartialEq)]
1416#[non_exhaustive]
1417pub struct MigrationTaskResult {
1418 /// Details specific to the task type.
1419 pub details: std::option::Option<crate::model::migration_task_result::Details>,
1420
1421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1422}
1423
1424impl MigrationTaskResult {
1425 pub fn new() -> Self {
1426 std::default::Default::default()
1427 }
1428
1429 /// Sets the value of [details][crate::model::MigrationTaskResult::details].
1430 ///
1431 /// Note that all the setters affecting `details` are mutually
1432 /// exclusive.
1433 ///
1434 /// # Example
1435 /// ```ignore,no_run
1436 /// # use google_cloud_bigquery_migration_v2::model::MigrationTaskResult;
1437 /// use google_cloud_bigquery_migration_v2::model::TranslationTaskResult;
1438 /// let x = MigrationTaskResult::new().set_details(Some(
1439 /// google_cloud_bigquery_migration_v2::model::migration_task_result::Details::TranslationTaskResult(TranslationTaskResult::default().into())));
1440 /// ```
1441 pub fn set_details<
1442 T: std::convert::Into<std::option::Option<crate::model::migration_task_result::Details>>,
1443 >(
1444 mut self,
1445 v: T,
1446 ) -> Self {
1447 self.details = v.into();
1448 self
1449 }
1450
1451 /// The value of [details][crate::model::MigrationTaskResult::details]
1452 /// if it holds a `TranslationTaskResult`, `None` if the field is not set or
1453 /// holds a different branch.
1454 pub fn translation_task_result(
1455 &self,
1456 ) -> std::option::Option<&std::boxed::Box<crate::model::TranslationTaskResult>> {
1457 #[allow(unreachable_patterns)]
1458 self.details.as_ref().and_then(|v| match v {
1459 crate::model::migration_task_result::Details::TranslationTaskResult(v) => {
1460 std::option::Option::Some(v)
1461 }
1462 _ => std::option::Option::None,
1463 })
1464 }
1465
1466 /// Sets the value of [details][crate::model::MigrationTaskResult::details]
1467 /// to hold a `TranslationTaskResult`.
1468 ///
1469 /// Note that all the setters affecting `details` are
1470 /// mutually exclusive.
1471 ///
1472 /// # Example
1473 /// ```ignore,no_run
1474 /// # use google_cloud_bigquery_migration_v2::model::MigrationTaskResult;
1475 /// use google_cloud_bigquery_migration_v2::model::TranslationTaskResult;
1476 /// let x = MigrationTaskResult::new().set_translation_task_result(TranslationTaskResult::default()/* use setters */);
1477 /// assert!(x.translation_task_result().is_some());
1478 /// ```
1479 pub fn set_translation_task_result<
1480 T: std::convert::Into<std::boxed::Box<crate::model::TranslationTaskResult>>,
1481 >(
1482 mut self,
1483 v: T,
1484 ) -> Self {
1485 self.details = std::option::Option::Some(
1486 crate::model::migration_task_result::Details::TranslationTaskResult(v.into()),
1487 );
1488 self
1489 }
1490}
1491
1492impl wkt::message::Message for MigrationTaskResult {
1493 fn typename() -> &'static str {
1494 "type.googleapis.com/google.cloud.bigquery.migration.v2.MigrationTaskResult"
1495 }
1496}
1497
1498/// Defines additional types related to [MigrationTaskResult].
1499pub mod migration_task_result {
1500 #[allow(unused_imports)]
1501 use super::*;
1502
1503 /// Details specific to the task type.
1504 #[derive(Clone, Debug, PartialEq)]
1505 #[non_exhaustive]
1506 pub enum Details {
1507 /// Details specific to translation task types.
1508 TranslationTaskResult(std::boxed::Box<crate::model::TranslationTaskResult>),
1509 }
1510}
1511
1512/// Translation specific result details from the migration task.
1513#[derive(Clone, Default, PartialEq)]
1514#[non_exhaustive]
1515pub struct TranslationTaskResult {
1516 /// The list of the translated literals.
1517 pub translated_literals: std::vec::Vec<crate::model::Literal>,
1518
1519 /// The records from the aggregate CSV report for a migration workflow.
1520 pub report_log_messages: std::vec::Vec<crate::model::GcsReportLogMessage>,
1521
1522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1523}
1524
1525impl TranslationTaskResult {
1526 pub fn new() -> Self {
1527 std::default::Default::default()
1528 }
1529
1530 /// Sets the value of [translated_literals][crate::model::TranslationTaskResult::translated_literals].
1531 ///
1532 /// # Example
1533 /// ```ignore,no_run
1534 /// # use google_cloud_bigquery_migration_v2::model::TranslationTaskResult;
1535 /// use google_cloud_bigquery_migration_v2::model::Literal;
1536 /// let x = TranslationTaskResult::new()
1537 /// .set_translated_literals([
1538 /// Literal::default()/* use setters */,
1539 /// Literal::default()/* use (different) setters */,
1540 /// ]);
1541 /// ```
1542 pub fn set_translated_literals<T, V>(mut self, v: T) -> Self
1543 where
1544 T: std::iter::IntoIterator<Item = V>,
1545 V: std::convert::Into<crate::model::Literal>,
1546 {
1547 use std::iter::Iterator;
1548 self.translated_literals = v.into_iter().map(|i| i.into()).collect();
1549 self
1550 }
1551
1552 /// Sets the value of [report_log_messages][crate::model::TranslationTaskResult::report_log_messages].
1553 ///
1554 /// # Example
1555 /// ```ignore,no_run
1556 /// # use google_cloud_bigquery_migration_v2::model::TranslationTaskResult;
1557 /// use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
1558 /// let x = TranslationTaskResult::new()
1559 /// .set_report_log_messages([
1560 /// GcsReportLogMessage::default()/* use setters */,
1561 /// GcsReportLogMessage::default()/* use (different) setters */,
1562 /// ]);
1563 /// ```
1564 pub fn set_report_log_messages<T, V>(mut self, v: T) -> Self
1565 where
1566 T: std::iter::IntoIterator<Item = V>,
1567 V: std::convert::Into<crate::model::GcsReportLogMessage>,
1568 {
1569 use std::iter::Iterator;
1570 self.report_log_messages = v.into_iter().map(|i| i.into()).collect();
1571 self
1572 }
1573}
1574
1575impl wkt::message::Message for TranslationTaskResult {
1576 fn typename() -> &'static str {
1577 "type.googleapis.com/google.cloud.bigquery.migration.v2.TranslationTaskResult"
1578 }
1579}
1580
1581/// Provides details for errors and the corresponding resources.
1582#[derive(Clone, Default, PartialEq)]
1583#[non_exhaustive]
1584pub struct ResourceErrorDetail {
1585 /// Required. Information about the resource where the error is located.
1586 pub resource_info: std::option::Option<google_cloud_rpc::model::ResourceInfo>,
1587
1588 /// Required. The error details for the resource.
1589 pub error_details: std::vec::Vec<crate::model::ErrorDetail>,
1590
1591 /// Required. How many errors there are in total for the resource. Truncation
1592 /// can be indicated by having an `error_count` that is higher than the size of
1593 /// `error_details`.
1594 pub error_count: i32,
1595
1596 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1597}
1598
1599impl ResourceErrorDetail {
1600 pub fn new() -> Self {
1601 std::default::Default::default()
1602 }
1603
1604 /// Sets the value of [resource_info][crate::model::ResourceErrorDetail::resource_info].
1605 ///
1606 /// # Example
1607 /// ```ignore,no_run
1608 /// # use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
1609 /// use google_cloud_rpc::model::ResourceInfo;
1610 /// let x = ResourceErrorDetail::new().set_resource_info(ResourceInfo::default()/* use setters */);
1611 /// ```
1612 pub fn set_resource_info<T>(mut self, v: T) -> Self
1613 where
1614 T: std::convert::Into<google_cloud_rpc::model::ResourceInfo>,
1615 {
1616 self.resource_info = std::option::Option::Some(v.into());
1617 self
1618 }
1619
1620 /// Sets or clears the value of [resource_info][crate::model::ResourceErrorDetail::resource_info].
1621 ///
1622 /// # Example
1623 /// ```ignore,no_run
1624 /// # use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
1625 /// use google_cloud_rpc::model::ResourceInfo;
1626 /// let x = ResourceErrorDetail::new().set_or_clear_resource_info(Some(ResourceInfo::default()/* use setters */));
1627 /// let x = ResourceErrorDetail::new().set_or_clear_resource_info(None::<ResourceInfo>);
1628 /// ```
1629 pub fn set_or_clear_resource_info<T>(mut self, v: std::option::Option<T>) -> Self
1630 where
1631 T: std::convert::Into<google_cloud_rpc::model::ResourceInfo>,
1632 {
1633 self.resource_info = v.map(|x| x.into());
1634 self
1635 }
1636
1637 /// Sets the value of [error_details][crate::model::ResourceErrorDetail::error_details].
1638 ///
1639 /// # Example
1640 /// ```ignore,no_run
1641 /// # use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
1642 /// use google_cloud_bigquery_migration_v2::model::ErrorDetail;
1643 /// let x = ResourceErrorDetail::new()
1644 /// .set_error_details([
1645 /// ErrorDetail::default()/* use setters */,
1646 /// ErrorDetail::default()/* use (different) setters */,
1647 /// ]);
1648 /// ```
1649 pub fn set_error_details<T, V>(mut self, v: T) -> Self
1650 where
1651 T: std::iter::IntoIterator<Item = V>,
1652 V: std::convert::Into<crate::model::ErrorDetail>,
1653 {
1654 use std::iter::Iterator;
1655 self.error_details = v.into_iter().map(|i| i.into()).collect();
1656 self
1657 }
1658
1659 /// Sets the value of [error_count][crate::model::ResourceErrorDetail::error_count].
1660 ///
1661 /// # Example
1662 /// ```ignore,no_run
1663 /// # use google_cloud_bigquery_migration_v2::model::ResourceErrorDetail;
1664 /// let x = ResourceErrorDetail::new().set_error_count(42);
1665 /// ```
1666 pub fn set_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1667 self.error_count = v.into();
1668 self
1669 }
1670}
1671
1672impl wkt::message::Message for ResourceErrorDetail {
1673 fn typename() -> &'static str {
1674 "type.googleapis.com/google.cloud.bigquery.migration.v2.ResourceErrorDetail"
1675 }
1676}
1677
1678/// Provides details for errors, e.g. issues that where encountered when
1679/// processing a subtask.
1680#[derive(Clone, Default, PartialEq)]
1681#[non_exhaustive]
1682pub struct ErrorDetail {
1683 /// Optional. The exact location within the resource (if applicable).
1684 pub location: std::option::Option<crate::model::ErrorLocation>,
1685
1686 /// Required. Describes the cause of the error with structured detail.
1687 pub error_info: std::option::Option<google_cloud_rpc::model::ErrorInfo>,
1688
1689 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1690}
1691
1692impl ErrorDetail {
1693 pub fn new() -> Self {
1694 std::default::Default::default()
1695 }
1696
1697 /// Sets the value of [location][crate::model::ErrorDetail::location].
1698 ///
1699 /// # Example
1700 /// ```ignore,no_run
1701 /// # use google_cloud_bigquery_migration_v2::model::ErrorDetail;
1702 /// use google_cloud_bigquery_migration_v2::model::ErrorLocation;
1703 /// let x = ErrorDetail::new().set_location(ErrorLocation::default()/* use setters */);
1704 /// ```
1705 pub fn set_location<T>(mut self, v: T) -> Self
1706 where
1707 T: std::convert::Into<crate::model::ErrorLocation>,
1708 {
1709 self.location = std::option::Option::Some(v.into());
1710 self
1711 }
1712
1713 /// Sets or clears the value of [location][crate::model::ErrorDetail::location].
1714 ///
1715 /// # Example
1716 /// ```ignore,no_run
1717 /// # use google_cloud_bigquery_migration_v2::model::ErrorDetail;
1718 /// use google_cloud_bigquery_migration_v2::model::ErrorLocation;
1719 /// let x = ErrorDetail::new().set_or_clear_location(Some(ErrorLocation::default()/* use setters */));
1720 /// let x = ErrorDetail::new().set_or_clear_location(None::<ErrorLocation>);
1721 /// ```
1722 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
1723 where
1724 T: std::convert::Into<crate::model::ErrorLocation>,
1725 {
1726 self.location = v.map(|x| x.into());
1727 self
1728 }
1729
1730 /// Sets the value of [error_info][crate::model::ErrorDetail::error_info].
1731 ///
1732 /// # Example
1733 /// ```ignore,no_run
1734 /// # use google_cloud_bigquery_migration_v2::model::ErrorDetail;
1735 /// use google_cloud_rpc::model::ErrorInfo;
1736 /// let x = ErrorDetail::new().set_error_info(ErrorInfo::default()/* use setters */);
1737 /// ```
1738 pub fn set_error_info<T>(mut self, v: T) -> Self
1739 where
1740 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
1741 {
1742 self.error_info = std::option::Option::Some(v.into());
1743 self
1744 }
1745
1746 /// Sets or clears the value of [error_info][crate::model::ErrorDetail::error_info].
1747 ///
1748 /// # Example
1749 /// ```ignore,no_run
1750 /// # use google_cloud_bigquery_migration_v2::model::ErrorDetail;
1751 /// use google_cloud_rpc::model::ErrorInfo;
1752 /// let x = ErrorDetail::new().set_or_clear_error_info(Some(ErrorInfo::default()/* use setters */));
1753 /// let x = ErrorDetail::new().set_or_clear_error_info(None::<ErrorInfo>);
1754 /// ```
1755 pub fn set_or_clear_error_info<T>(mut self, v: std::option::Option<T>) -> Self
1756 where
1757 T: std::convert::Into<google_cloud_rpc::model::ErrorInfo>,
1758 {
1759 self.error_info = v.map(|x| x.into());
1760 self
1761 }
1762}
1763
1764impl wkt::message::Message for ErrorDetail {
1765 fn typename() -> &'static str {
1766 "type.googleapis.com/google.cloud.bigquery.migration.v2.ErrorDetail"
1767 }
1768}
1769
1770/// Holds information about where the error is located.
1771#[derive(Clone, Default, PartialEq)]
1772#[non_exhaustive]
1773pub struct ErrorLocation {
1774 /// Optional. If applicable, denotes the line where the error occurred. A zero
1775 /// value means that there is no line information.
1776 pub line: i32,
1777
1778 /// Optional. If applicable, denotes the column where the error occurred. A
1779 /// zero value means that there is no columns information.
1780 pub column: i32,
1781
1782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1783}
1784
1785impl ErrorLocation {
1786 pub fn new() -> Self {
1787 std::default::Default::default()
1788 }
1789
1790 /// Sets the value of [line][crate::model::ErrorLocation::line].
1791 ///
1792 /// # Example
1793 /// ```ignore,no_run
1794 /// # use google_cloud_bigquery_migration_v2::model::ErrorLocation;
1795 /// let x = ErrorLocation::new().set_line(42);
1796 /// ```
1797 pub fn set_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1798 self.line = v.into();
1799 self
1800 }
1801
1802 /// Sets the value of [column][crate::model::ErrorLocation::column].
1803 ///
1804 /// # Example
1805 /// ```ignore,no_run
1806 /// # use google_cloud_bigquery_migration_v2::model::ErrorLocation;
1807 /// let x = ErrorLocation::new().set_column(42);
1808 /// ```
1809 pub fn set_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1810 self.column = v.into();
1811 self
1812 }
1813}
1814
1815impl wkt::message::Message for ErrorLocation {
1816 fn typename() -> &'static str {
1817 "type.googleapis.com/google.cloud.bigquery.migration.v2.ErrorLocation"
1818 }
1819}
1820
1821/// The metrics object for a SubTask.
1822#[derive(Clone, Default, PartialEq)]
1823#[non_exhaustive]
1824pub struct TimeSeries {
1825 /// Required. The name of the metric.
1826 ///
1827 /// If the metric is not known by the service yet, it will be auto-created.
1828 pub metric: std::string::String,
1829
1830 /// Required. The value type of the time series.
1831 pub value_type: google_cloud_api::model::metric_descriptor::ValueType,
1832
1833 /// Optional. The metric kind of the time series.
1834 ///
1835 /// If present, it must be the same as the metric kind of the associated
1836 /// metric. If the associated metric's descriptor must be auto-created, then
1837 /// this field specifies the metric kind of the new descriptor and must be
1838 /// either `GAUGE` (the default) or `CUMULATIVE`.
1839 pub metric_kind: google_cloud_api::model::metric_descriptor::MetricKind,
1840
1841 /// Required. The data points of this time series. When listing time series,
1842 /// points are returned in reverse time order.
1843 ///
1844 /// When creating a time series, this field must contain exactly one point and
1845 /// the point's type must be the same as the value type of the associated
1846 /// metric. If the associated metric's descriptor must be auto-created, then
1847 /// the value type of the descriptor is determined by the point's type, which
1848 /// must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
1849 pub points: std::vec::Vec<crate::model::Point>,
1850
1851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1852}
1853
1854impl TimeSeries {
1855 pub fn new() -> Self {
1856 std::default::Default::default()
1857 }
1858
1859 /// Sets the value of [metric][crate::model::TimeSeries::metric].
1860 ///
1861 /// # Example
1862 /// ```ignore,no_run
1863 /// # use google_cloud_bigquery_migration_v2::model::TimeSeries;
1864 /// let x = TimeSeries::new().set_metric("example");
1865 /// ```
1866 pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1867 self.metric = v.into();
1868 self
1869 }
1870
1871 /// Sets the value of [value_type][crate::model::TimeSeries::value_type].
1872 ///
1873 /// # Example
1874 /// ```ignore,no_run
1875 /// # use google_cloud_bigquery_migration_v2::model::TimeSeries;
1876 /// use google_cloud_api::model::metric_descriptor::ValueType;
1877 /// let x0 = TimeSeries::new().set_value_type(ValueType::Bool);
1878 /// let x1 = TimeSeries::new().set_value_type(ValueType::Int64);
1879 /// let x2 = TimeSeries::new().set_value_type(ValueType::Double);
1880 /// ```
1881 pub fn set_value_type<
1882 T: std::convert::Into<google_cloud_api::model::metric_descriptor::ValueType>,
1883 >(
1884 mut self,
1885 v: T,
1886 ) -> Self {
1887 self.value_type = v.into();
1888 self
1889 }
1890
1891 /// Sets the value of [metric_kind][crate::model::TimeSeries::metric_kind].
1892 ///
1893 /// # Example
1894 /// ```ignore,no_run
1895 /// # use google_cloud_bigquery_migration_v2::model::TimeSeries;
1896 /// use google_cloud_api::model::metric_descriptor::MetricKind;
1897 /// let x0 = TimeSeries::new().set_metric_kind(MetricKind::Gauge);
1898 /// let x1 = TimeSeries::new().set_metric_kind(MetricKind::Delta);
1899 /// let x2 = TimeSeries::new().set_metric_kind(MetricKind::Cumulative);
1900 /// ```
1901 pub fn set_metric_kind<
1902 T: std::convert::Into<google_cloud_api::model::metric_descriptor::MetricKind>,
1903 >(
1904 mut self,
1905 v: T,
1906 ) -> Self {
1907 self.metric_kind = v.into();
1908 self
1909 }
1910
1911 /// Sets the value of [points][crate::model::TimeSeries::points].
1912 ///
1913 /// # Example
1914 /// ```ignore,no_run
1915 /// # use google_cloud_bigquery_migration_v2::model::TimeSeries;
1916 /// use google_cloud_bigquery_migration_v2::model::Point;
1917 /// let x = TimeSeries::new()
1918 /// .set_points([
1919 /// Point::default()/* use setters */,
1920 /// Point::default()/* use (different) setters */,
1921 /// ]);
1922 /// ```
1923 pub fn set_points<T, V>(mut self, v: T) -> Self
1924 where
1925 T: std::iter::IntoIterator<Item = V>,
1926 V: std::convert::Into<crate::model::Point>,
1927 {
1928 use std::iter::Iterator;
1929 self.points = v.into_iter().map(|i| i.into()).collect();
1930 self
1931 }
1932}
1933
1934impl wkt::message::Message for TimeSeries {
1935 fn typename() -> &'static str {
1936 "type.googleapis.com/google.cloud.bigquery.migration.v2.TimeSeries"
1937 }
1938}
1939
1940/// A single data point in a time series.
1941#[derive(Clone, Default, PartialEq)]
1942#[non_exhaustive]
1943pub struct Point {
1944 /// The time interval to which the data point applies. For `GAUGE` metrics,
1945 /// the start time does not need to be supplied, but if it is supplied, it must
1946 /// equal the end time. For `DELTA` metrics, the start and end time should
1947 /// specify a non-zero interval, with subsequent points specifying contiguous
1948 /// and non-overlapping intervals. For `CUMULATIVE` metrics, the start and end
1949 /// time should specify a non-zero interval, with subsequent points specifying
1950 /// the same start time and increasing end times, until an event resets the
1951 /// cumulative value to zero and sets a new start time for the following
1952 /// points.
1953 pub interval: std::option::Option<crate::model::TimeInterval>,
1954
1955 /// The value of the data point.
1956 pub value: std::option::Option<crate::model::TypedValue>,
1957
1958 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1959}
1960
1961impl Point {
1962 pub fn new() -> Self {
1963 std::default::Default::default()
1964 }
1965
1966 /// Sets the value of [interval][crate::model::Point::interval].
1967 ///
1968 /// # Example
1969 /// ```ignore,no_run
1970 /// # use google_cloud_bigquery_migration_v2::model::Point;
1971 /// use google_cloud_bigquery_migration_v2::model::TimeInterval;
1972 /// let x = Point::new().set_interval(TimeInterval::default()/* use setters */);
1973 /// ```
1974 pub fn set_interval<T>(mut self, v: T) -> Self
1975 where
1976 T: std::convert::Into<crate::model::TimeInterval>,
1977 {
1978 self.interval = std::option::Option::Some(v.into());
1979 self
1980 }
1981
1982 /// Sets or clears the value of [interval][crate::model::Point::interval].
1983 ///
1984 /// # Example
1985 /// ```ignore,no_run
1986 /// # use google_cloud_bigquery_migration_v2::model::Point;
1987 /// use google_cloud_bigquery_migration_v2::model::TimeInterval;
1988 /// let x = Point::new().set_or_clear_interval(Some(TimeInterval::default()/* use setters */));
1989 /// let x = Point::new().set_or_clear_interval(None::<TimeInterval>);
1990 /// ```
1991 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
1992 where
1993 T: std::convert::Into<crate::model::TimeInterval>,
1994 {
1995 self.interval = v.map(|x| x.into());
1996 self
1997 }
1998
1999 /// Sets the value of [value][crate::model::Point::value].
2000 ///
2001 /// # Example
2002 /// ```ignore,no_run
2003 /// # use google_cloud_bigquery_migration_v2::model::Point;
2004 /// use google_cloud_bigquery_migration_v2::model::TypedValue;
2005 /// let x = Point::new().set_value(TypedValue::default()/* use setters */);
2006 /// ```
2007 pub fn set_value<T>(mut self, v: T) -> Self
2008 where
2009 T: std::convert::Into<crate::model::TypedValue>,
2010 {
2011 self.value = std::option::Option::Some(v.into());
2012 self
2013 }
2014
2015 /// Sets or clears the value of [value][crate::model::Point::value].
2016 ///
2017 /// # Example
2018 /// ```ignore,no_run
2019 /// # use google_cloud_bigquery_migration_v2::model::Point;
2020 /// use google_cloud_bigquery_migration_v2::model::TypedValue;
2021 /// let x = Point::new().set_or_clear_value(Some(TypedValue::default()/* use setters */));
2022 /// let x = Point::new().set_or_clear_value(None::<TypedValue>);
2023 /// ```
2024 pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
2025 where
2026 T: std::convert::Into<crate::model::TypedValue>,
2027 {
2028 self.value = v.map(|x| x.into());
2029 self
2030 }
2031}
2032
2033impl wkt::message::Message for Point {
2034 fn typename() -> &'static str {
2035 "type.googleapis.com/google.cloud.bigquery.migration.v2.Point"
2036 }
2037}
2038
2039/// A time interval extending just after a start time through an end time.
2040/// If the start time is the same as the end time, then the interval
2041/// represents a single point in time.
2042#[derive(Clone, Default, PartialEq)]
2043#[non_exhaustive]
2044pub struct TimeInterval {
2045 /// Optional. The beginning of the time interval. The default value
2046 /// for the start time is the end time. The start time must not be
2047 /// later than the end time.
2048 pub start_time: std::option::Option<wkt::Timestamp>,
2049
2050 /// Required. The end of the time interval.
2051 pub end_time: std::option::Option<wkt::Timestamp>,
2052
2053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2054}
2055
2056impl TimeInterval {
2057 pub fn new() -> Self {
2058 std::default::Default::default()
2059 }
2060
2061 /// Sets the value of [start_time][crate::model::TimeInterval::start_time].
2062 ///
2063 /// # Example
2064 /// ```ignore,no_run
2065 /// # use google_cloud_bigquery_migration_v2::model::TimeInterval;
2066 /// use wkt::Timestamp;
2067 /// let x = TimeInterval::new().set_start_time(Timestamp::default()/* use setters */);
2068 /// ```
2069 pub fn set_start_time<T>(mut self, v: T) -> Self
2070 where
2071 T: std::convert::Into<wkt::Timestamp>,
2072 {
2073 self.start_time = std::option::Option::Some(v.into());
2074 self
2075 }
2076
2077 /// Sets or clears the value of [start_time][crate::model::TimeInterval::start_time].
2078 ///
2079 /// # Example
2080 /// ```ignore,no_run
2081 /// # use google_cloud_bigquery_migration_v2::model::TimeInterval;
2082 /// use wkt::Timestamp;
2083 /// let x = TimeInterval::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2084 /// let x = TimeInterval::new().set_or_clear_start_time(None::<Timestamp>);
2085 /// ```
2086 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2087 where
2088 T: std::convert::Into<wkt::Timestamp>,
2089 {
2090 self.start_time = v.map(|x| x.into());
2091 self
2092 }
2093
2094 /// Sets the value of [end_time][crate::model::TimeInterval::end_time].
2095 ///
2096 /// # Example
2097 /// ```ignore,no_run
2098 /// # use google_cloud_bigquery_migration_v2::model::TimeInterval;
2099 /// use wkt::Timestamp;
2100 /// let x = TimeInterval::new().set_end_time(Timestamp::default()/* use setters */);
2101 /// ```
2102 pub fn set_end_time<T>(mut self, v: T) -> Self
2103 where
2104 T: std::convert::Into<wkt::Timestamp>,
2105 {
2106 self.end_time = std::option::Option::Some(v.into());
2107 self
2108 }
2109
2110 /// Sets or clears the value of [end_time][crate::model::TimeInterval::end_time].
2111 ///
2112 /// # Example
2113 /// ```ignore,no_run
2114 /// # use google_cloud_bigquery_migration_v2::model::TimeInterval;
2115 /// use wkt::Timestamp;
2116 /// let x = TimeInterval::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2117 /// let x = TimeInterval::new().set_or_clear_end_time(None::<Timestamp>);
2118 /// ```
2119 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2120 where
2121 T: std::convert::Into<wkt::Timestamp>,
2122 {
2123 self.end_time = v.map(|x| x.into());
2124 self
2125 }
2126}
2127
2128impl wkt::message::Message for TimeInterval {
2129 fn typename() -> &'static str {
2130 "type.googleapis.com/google.cloud.bigquery.migration.v2.TimeInterval"
2131 }
2132}
2133
2134/// A single strongly-typed value.
2135#[derive(Clone, Default, PartialEq)]
2136#[non_exhaustive]
2137pub struct TypedValue {
2138 /// The typed value field.
2139 pub value: std::option::Option<crate::model::typed_value::Value>,
2140
2141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2142}
2143
2144impl TypedValue {
2145 pub fn new() -> Self {
2146 std::default::Default::default()
2147 }
2148
2149 /// Sets the value of [value][crate::model::TypedValue::value].
2150 ///
2151 /// Note that all the setters affecting `value` are mutually
2152 /// exclusive.
2153 ///
2154 /// # Example
2155 /// ```ignore,no_run
2156 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2157 /// use google_cloud_bigquery_migration_v2::model::typed_value::Value;
2158 /// let x = TypedValue::new().set_value(Some(Value::BoolValue(true)));
2159 /// ```
2160 pub fn set_value<
2161 T: std::convert::Into<std::option::Option<crate::model::typed_value::Value>>,
2162 >(
2163 mut self,
2164 v: T,
2165 ) -> Self {
2166 self.value = v.into();
2167 self
2168 }
2169
2170 /// The value of [value][crate::model::TypedValue::value]
2171 /// if it holds a `BoolValue`, `None` if the field is not set or
2172 /// holds a different branch.
2173 pub fn bool_value(&self) -> std::option::Option<&bool> {
2174 #[allow(unreachable_patterns)]
2175 self.value.as_ref().and_then(|v| match v {
2176 crate::model::typed_value::Value::BoolValue(v) => std::option::Option::Some(v),
2177 _ => std::option::Option::None,
2178 })
2179 }
2180
2181 /// Sets the value of [value][crate::model::TypedValue::value]
2182 /// to hold a `BoolValue`.
2183 ///
2184 /// Note that all the setters affecting `value` are
2185 /// mutually exclusive.
2186 ///
2187 /// # Example
2188 /// ```ignore,no_run
2189 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2190 /// let x = TypedValue::new().set_bool_value(true);
2191 /// assert!(x.bool_value().is_some());
2192 /// assert!(x.int64_value().is_none());
2193 /// assert!(x.double_value().is_none());
2194 /// assert!(x.string_value().is_none());
2195 /// assert!(x.distribution_value().is_none());
2196 /// ```
2197 pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2198 self.value =
2199 std::option::Option::Some(crate::model::typed_value::Value::BoolValue(v.into()));
2200 self
2201 }
2202
2203 /// The value of [value][crate::model::TypedValue::value]
2204 /// if it holds a `Int64Value`, `None` if the field is not set or
2205 /// holds a different branch.
2206 pub fn int64_value(&self) -> std::option::Option<&i64> {
2207 #[allow(unreachable_patterns)]
2208 self.value.as_ref().and_then(|v| match v {
2209 crate::model::typed_value::Value::Int64Value(v) => std::option::Option::Some(v),
2210 _ => std::option::Option::None,
2211 })
2212 }
2213
2214 /// Sets the value of [value][crate::model::TypedValue::value]
2215 /// to hold a `Int64Value`.
2216 ///
2217 /// Note that all the setters affecting `value` are
2218 /// mutually exclusive.
2219 ///
2220 /// # Example
2221 /// ```ignore,no_run
2222 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2223 /// let x = TypedValue::new().set_int64_value(42);
2224 /// assert!(x.int64_value().is_some());
2225 /// assert!(x.bool_value().is_none());
2226 /// assert!(x.double_value().is_none());
2227 /// assert!(x.string_value().is_none());
2228 /// assert!(x.distribution_value().is_none());
2229 /// ```
2230 pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2231 self.value =
2232 std::option::Option::Some(crate::model::typed_value::Value::Int64Value(v.into()));
2233 self
2234 }
2235
2236 /// The value of [value][crate::model::TypedValue::value]
2237 /// if it holds a `DoubleValue`, `None` if the field is not set or
2238 /// holds a different branch.
2239 pub fn double_value(&self) -> std::option::Option<&f64> {
2240 #[allow(unreachable_patterns)]
2241 self.value.as_ref().and_then(|v| match v {
2242 crate::model::typed_value::Value::DoubleValue(v) => std::option::Option::Some(v),
2243 _ => std::option::Option::None,
2244 })
2245 }
2246
2247 /// Sets the value of [value][crate::model::TypedValue::value]
2248 /// to hold a `DoubleValue`.
2249 ///
2250 /// Note that all the setters affecting `value` are
2251 /// mutually exclusive.
2252 ///
2253 /// # Example
2254 /// ```ignore,no_run
2255 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2256 /// let x = TypedValue::new().set_double_value(42.0);
2257 /// assert!(x.double_value().is_some());
2258 /// assert!(x.bool_value().is_none());
2259 /// assert!(x.int64_value().is_none());
2260 /// assert!(x.string_value().is_none());
2261 /// assert!(x.distribution_value().is_none());
2262 /// ```
2263 pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2264 self.value =
2265 std::option::Option::Some(crate::model::typed_value::Value::DoubleValue(v.into()));
2266 self
2267 }
2268
2269 /// The value of [value][crate::model::TypedValue::value]
2270 /// if it holds a `StringValue`, `None` if the field is not set or
2271 /// holds a different branch.
2272 pub fn string_value(&self) -> std::option::Option<&std::string::String> {
2273 #[allow(unreachable_patterns)]
2274 self.value.as_ref().and_then(|v| match v {
2275 crate::model::typed_value::Value::StringValue(v) => std::option::Option::Some(v),
2276 _ => std::option::Option::None,
2277 })
2278 }
2279
2280 /// Sets the value of [value][crate::model::TypedValue::value]
2281 /// to hold a `StringValue`.
2282 ///
2283 /// Note that all the setters affecting `value` are
2284 /// mutually exclusive.
2285 ///
2286 /// # Example
2287 /// ```ignore,no_run
2288 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2289 /// let x = TypedValue::new().set_string_value("example");
2290 /// assert!(x.string_value().is_some());
2291 /// assert!(x.bool_value().is_none());
2292 /// assert!(x.int64_value().is_none());
2293 /// assert!(x.double_value().is_none());
2294 /// assert!(x.distribution_value().is_none());
2295 /// ```
2296 pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2297 self.value =
2298 std::option::Option::Some(crate::model::typed_value::Value::StringValue(v.into()));
2299 self
2300 }
2301
2302 /// The value of [value][crate::model::TypedValue::value]
2303 /// if it holds a `DistributionValue`, `None` if the field is not set or
2304 /// holds a different branch.
2305 pub fn distribution_value(
2306 &self,
2307 ) -> std::option::Option<&std::boxed::Box<google_cloud_api::model::Distribution>> {
2308 #[allow(unreachable_patterns)]
2309 self.value.as_ref().and_then(|v| match v {
2310 crate::model::typed_value::Value::DistributionValue(v) => std::option::Option::Some(v),
2311 _ => std::option::Option::None,
2312 })
2313 }
2314
2315 /// Sets the value of [value][crate::model::TypedValue::value]
2316 /// to hold a `DistributionValue`.
2317 ///
2318 /// Note that all the setters affecting `value` are
2319 /// mutually exclusive.
2320 ///
2321 /// # Example
2322 /// ```ignore,no_run
2323 /// # use google_cloud_bigquery_migration_v2::model::TypedValue;
2324 /// use google_cloud_api::model::Distribution;
2325 /// let x = TypedValue::new().set_distribution_value(Distribution::default()/* use setters */);
2326 /// assert!(x.distribution_value().is_some());
2327 /// assert!(x.bool_value().is_none());
2328 /// assert!(x.int64_value().is_none());
2329 /// assert!(x.double_value().is_none());
2330 /// assert!(x.string_value().is_none());
2331 /// ```
2332 pub fn set_distribution_value<
2333 T: std::convert::Into<std::boxed::Box<google_cloud_api::model::Distribution>>,
2334 >(
2335 mut self,
2336 v: T,
2337 ) -> Self {
2338 self.value = std::option::Option::Some(
2339 crate::model::typed_value::Value::DistributionValue(v.into()),
2340 );
2341 self
2342 }
2343}
2344
2345impl wkt::message::Message for TypedValue {
2346 fn typename() -> &'static str {
2347 "type.googleapis.com/google.cloud.bigquery.migration.v2.TypedValue"
2348 }
2349}
2350
2351/// Defines additional types related to [TypedValue].
2352pub mod typed_value {
2353 #[allow(unused_imports)]
2354 use super::*;
2355
2356 /// The typed value field.
2357 #[derive(Clone, Debug, PartialEq)]
2358 #[non_exhaustive]
2359 pub enum Value {
2360 /// A Boolean value: `true` or `false`.
2361 BoolValue(bool),
2362 /// A 64-bit integer. Its range is approximately `+/-9.2x10^18`.
2363 Int64Value(i64),
2364 /// A 64-bit double-precision floating-point number. Its magnitude
2365 /// is approximately `+/-10^(+/-300)` and it has 16 significant digits of
2366 /// precision.
2367 DoubleValue(f64),
2368 /// A variable-length string value.
2369 StringValue(std::string::String),
2370 /// A distribution value.
2371 DistributionValue(std::boxed::Box<google_cloud_api::model::Distribution>),
2372 }
2373}
2374
2375/// Request to create a migration workflow resource.
2376#[derive(Clone, Default, PartialEq)]
2377#[non_exhaustive]
2378pub struct CreateMigrationWorkflowRequest {
2379 /// Required. The name of the project to which this migration workflow belongs.
2380 /// Example: `projects/foo/locations/bar`
2381 pub parent: std::string::String,
2382
2383 /// Required. The migration workflow to create.
2384 pub migration_workflow: std::option::Option<crate::model::MigrationWorkflow>,
2385
2386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2387}
2388
2389impl CreateMigrationWorkflowRequest {
2390 pub fn new() -> Self {
2391 std::default::Default::default()
2392 }
2393
2394 /// Sets the value of [parent][crate::model::CreateMigrationWorkflowRequest::parent].
2395 ///
2396 /// # Example
2397 /// ```ignore,no_run
2398 /// # use google_cloud_bigquery_migration_v2::model::CreateMigrationWorkflowRequest;
2399 /// let x = CreateMigrationWorkflowRequest::new().set_parent("example");
2400 /// ```
2401 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2402 self.parent = v.into();
2403 self
2404 }
2405
2406 /// Sets the value of [migration_workflow][crate::model::CreateMigrationWorkflowRequest::migration_workflow].
2407 ///
2408 /// # Example
2409 /// ```ignore,no_run
2410 /// # use google_cloud_bigquery_migration_v2::model::CreateMigrationWorkflowRequest;
2411 /// use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
2412 /// let x = CreateMigrationWorkflowRequest::new().set_migration_workflow(MigrationWorkflow::default()/* use setters */);
2413 /// ```
2414 pub fn set_migration_workflow<T>(mut self, v: T) -> Self
2415 where
2416 T: std::convert::Into<crate::model::MigrationWorkflow>,
2417 {
2418 self.migration_workflow = std::option::Option::Some(v.into());
2419 self
2420 }
2421
2422 /// Sets or clears the value of [migration_workflow][crate::model::CreateMigrationWorkflowRequest::migration_workflow].
2423 ///
2424 /// # Example
2425 /// ```ignore,no_run
2426 /// # use google_cloud_bigquery_migration_v2::model::CreateMigrationWorkflowRequest;
2427 /// use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
2428 /// let x = CreateMigrationWorkflowRequest::new().set_or_clear_migration_workflow(Some(MigrationWorkflow::default()/* use setters */));
2429 /// let x = CreateMigrationWorkflowRequest::new().set_or_clear_migration_workflow(None::<MigrationWorkflow>);
2430 /// ```
2431 pub fn set_or_clear_migration_workflow<T>(mut self, v: std::option::Option<T>) -> Self
2432 where
2433 T: std::convert::Into<crate::model::MigrationWorkflow>,
2434 {
2435 self.migration_workflow = v.map(|x| x.into());
2436 self
2437 }
2438}
2439
2440impl wkt::message::Message for CreateMigrationWorkflowRequest {
2441 fn typename() -> &'static str {
2442 "type.googleapis.com/google.cloud.bigquery.migration.v2.CreateMigrationWorkflowRequest"
2443 }
2444}
2445
2446/// A request to get a previously created migration workflow.
2447#[derive(Clone, Default, PartialEq)]
2448#[non_exhaustive]
2449pub struct GetMigrationWorkflowRequest {
2450 /// Required. The unique identifier for the migration workflow.
2451 /// Example: `projects/123/locations/us/workflows/1234`
2452 pub name: std::string::String,
2453
2454 /// The list of fields to be retrieved.
2455 pub read_mask: std::option::Option<wkt::FieldMask>,
2456
2457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2458}
2459
2460impl GetMigrationWorkflowRequest {
2461 pub fn new() -> Self {
2462 std::default::Default::default()
2463 }
2464
2465 /// Sets the value of [name][crate::model::GetMigrationWorkflowRequest::name].
2466 ///
2467 /// # Example
2468 /// ```ignore,no_run
2469 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationWorkflowRequest;
2470 /// let x = GetMigrationWorkflowRequest::new().set_name("example");
2471 /// ```
2472 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2473 self.name = v.into();
2474 self
2475 }
2476
2477 /// Sets the value of [read_mask][crate::model::GetMigrationWorkflowRequest::read_mask].
2478 ///
2479 /// # Example
2480 /// ```ignore,no_run
2481 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationWorkflowRequest;
2482 /// use wkt::FieldMask;
2483 /// let x = GetMigrationWorkflowRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2484 /// ```
2485 pub fn set_read_mask<T>(mut self, v: T) -> Self
2486 where
2487 T: std::convert::Into<wkt::FieldMask>,
2488 {
2489 self.read_mask = std::option::Option::Some(v.into());
2490 self
2491 }
2492
2493 /// Sets or clears the value of [read_mask][crate::model::GetMigrationWorkflowRequest::read_mask].
2494 ///
2495 /// # Example
2496 /// ```ignore,no_run
2497 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationWorkflowRequest;
2498 /// use wkt::FieldMask;
2499 /// let x = GetMigrationWorkflowRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2500 /// let x = GetMigrationWorkflowRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2501 /// ```
2502 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2503 where
2504 T: std::convert::Into<wkt::FieldMask>,
2505 {
2506 self.read_mask = v.map(|x| x.into());
2507 self
2508 }
2509}
2510
2511impl wkt::message::Message for GetMigrationWorkflowRequest {
2512 fn typename() -> &'static str {
2513 "type.googleapis.com/google.cloud.bigquery.migration.v2.GetMigrationWorkflowRequest"
2514 }
2515}
2516
2517/// A request to list previously created migration workflows.
2518#[derive(Clone, Default, PartialEq)]
2519#[non_exhaustive]
2520pub struct ListMigrationWorkflowsRequest {
2521 /// Required. The project and location of the migration workflows to list.
2522 /// Example: `projects/123/locations/us`
2523 pub parent: std::string::String,
2524
2525 /// The list of fields to be retrieved.
2526 pub read_mask: std::option::Option<wkt::FieldMask>,
2527
2528 /// The maximum number of migration workflows to return. The service may return
2529 /// fewer than this number.
2530 pub page_size: i32,
2531
2532 /// A page token, received from previous `ListMigrationWorkflows` call.
2533 /// Provide this to retrieve the subsequent page.
2534 ///
2535 /// When paginating, all other parameters provided to `ListMigrationWorkflows`
2536 /// must match the call that provided the page token.
2537 pub page_token: std::string::String,
2538
2539 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2540}
2541
2542impl ListMigrationWorkflowsRequest {
2543 pub fn new() -> Self {
2544 std::default::Default::default()
2545 }
2546
2547 /// Sets the value of [parent][crate::model::ListMigrationWorkflowsRequest::parent].
2548 ///
2549 /// # Example
2550 /// ```ignore,no_run
2551 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsRequest;
2552 /// let x = ListMigrationWorkflowsRequest::new().set_parent("example");
2553 /// ```
2554 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2555 self.parent = v.into();
2556 self
2557 }
2558
2559 /// Sets the value of [read_mask][crate::model::ListMigrationWorkflowsRequest::read_mask].
2560 ///
2561 /// # Example
2562 /// ```ignore,no_run
2563 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsRequest;
2564 /// use wkt::FieldMask;
2565 /// let x = ListMigrationWorkflowsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2566 /// ```
2567 pub fn set_read_mask<T>(mut self, v: T) -> Self
2568 where
2569 T: std::convert::Into<wkt::FieldMask>,
2570 {
2571 self.read_mask = std::option::Option::Some(v.into());
2572 self
2573 }
2574
2575 /// Sets or clears the value of [read_mask][crate::model::ListMigrationWorkflowsRequest::read_mask].
2576 ///
2577 /// # Example
2578 /// ```ignore,no_run
2579 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsRequest;
2580 /// use wkt::FieldMask;
2581 /// let x = ListMigrationWorkflowsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2582 /// let x = ListMigrationWorkflowsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2583 /// ```
2584 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2585 where
2586 T: std::convert::Into<wkt::FieldMask>,
2587 {
2588 self.read_mask = v.map(|x| x.into());
2589 self
2590 }
2591
2592 /// Sets the value of [page_size][crate::model::ListMigrationWorkflowsRequest::page_size].
2593 ///
2594 /// # Example
2595 /// ```ignore,no_run
2596 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsRequest;
2597 /// let x = ListMigrationWorkflowsRequest::new().set_page_size(42);
2598 /// ```
2599 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2600 self.page_size = v.into();
2601 self
2602 }
2603
2604 /// Sets the value of [page_token][crate::model::ListMigrationWorkflowsRequest::page_token].
2605 ///
2606 /// # Example
2607 /// ```ignore,no_run
2608 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsRequest;
2609 /// let x = ListMigrationWorkflowsRequest::new().set_page_token("example");
2610 /// ```
2611 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2612 self.page_token = v.into();
2613 self
2614 }
2615}
2616
2617impl wkt::message::Message for ListMigrationWorkflowsRequest {
2618 fn typename() -> &'static str {
2619 "type.googleapis.com/google.cloud.bigquery.migration.v2.ListMigrationWorkflowsRequest"
2620 }
2621}
2622
2623/// Response object for a `ListMigrationWorkflows` call.
2624#[derive(Clone, Default, PartialEq)]
2625#[non_exhaustive]
2626pub struct ListMigrationWorkflowsResponse {
2627 /// The migration workflows for the specified project / location.
2628 pub migration_workflows: std::vec::Vec<crate::model::MigrationWorkflow>,
2629
2630 /// A token, which can be sent as `page_token` to retrieve the next page.
2631 /// If this field is omitted, there are no subsequent pages.
2632 pub next_page_token: std::string::String,
2633
2634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2635}
2636
2637impl ListMigrationWorkflowsResponse {
2638 pub fn new() -> Self {
2639 std::default::Default::default()
2640 }
2641
2642 /// Sets the value of [migration_workflows][crate::model::ListMigrationWorkflowsResponse::migration_workflows].
2643 ///
2644 /// # Example
2645 /// ```ignore,no_run
2646 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsResponse;
2647 /// use google_cloud_bigquery_migration_v2::model::MigrationWorkflow;
2648 /// let x = ListMigrationWorkflowsResponse::new()
2649 /// .set_migration_workflows([
2650 /// MigrationWorkflow::default()/* use setters */,
2651 /// MigrationWorkflow::default()/* use (different) setters */,
2652 /// ]);
2653 /// ```
2654 pub fn set_migration_workflows<T, V>(mut self, v: T) -> Self
2655 where
2656 T: std::iter::IntoIterator<Item = V>,
2657 V: std::convert::Into<crate::model::MigrationWorkflow>,
2658 {
2659 use std::iter::Iterator;
2660 self.migration_workflows = v.into_iter().map(|i| i.into()).collect();
2661 self
2662 }
2663
2664 /// Sets the value of [next_page_token][crate::model::ListMigrationWorkflowsResponse::next_page_token].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationWorkflowsResponse;
2669 /// let x = ListMigrationWorkflowsResponse::new().set_next_page_token("example");
2670 /// ```
2671 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2672 self.next_page_token = v.into();
2673 self
2674 }
2675}
2676
2677impl wkt::message::Message for ListMigrationWorkflowsResponse {
2678 fn typename() -> &'static str {
2679 "type.googleapis.com/google.cloud.bigquery.migration.v2.ListMigrationWorkflowsResponse"
2680 }
2681}
2682
2683#[doc(hidden)]
2684impl google_cloud_gax::paginator::internal::PageableResponse for ListMigrationWorkflowsResponse {
2685 type PageItem = crate::model::MigrationWorkflow;
2686
2687 fn items(self) -> std::vec::Vec<Self::PageItem> {
2688 self.migration_workflows
2689 }
2690
2691 fn next_page_token(&self) -> std::string::String {
2692 use std::clone::Clone;
2693 self.next_page_token.clone()
2694 }
2695}
2696
2697/// A request to delete a previously created migration workflow.
2698#[derive(Clone, Default, PartialEq)]
2699#[non_exhaustive]
2700pub struct DeleteMigrationWorkflowRequest {
2701 /// Required. The unique identifier for the migration workflow.
2702 /// Example: `projects/123/locations/us/workflows/1234`
2703 pub name: std::string::String,
2704
2705 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2706}
2707
2708impl DeleteMigrationWorkflowRequest {
2709 pub fn new() -> Self {
2710 std::default::Default::default()
2711 }
2712
2713 /// Sets the value of [name][crate::model::DeleteMigrationWorkflowRequest::name].
2714 ///
2715 /// # Example
2716 /// ```ignore,no_run
2717 /// # use google_cloud_bigquery_migration_v2::model::DeleteMigrationWorkflowRequest;
2718 /// let x = DeleteMigrationWorkflowRequest::new().set_name("example");
2719 /// ```
2720 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2721 self.name = v.into();
2722 self
2723 }
2724}
2725
2726impl wkt::message::Message for DeleteMigrationWorkflowRequest {
2727 fn typename() -> &'static str {
2728 "type.googleapis.com/google.cloud.bigquery.migration.v2.DeleteMigrationWorkflowRequest"
2729 }
2730}
2731
2732/// A request to start a previously created migration workflow.
2733#[derive(Clone, Default, PartialEq)]
2734#[non_exhaustive]
2735pub struct StartMigrationWorkflowRequest {
2736 /// Required. The unique identifier for the migration workflow.
2737 /// Example: `projects/123/locations/us/workflows/1234`
2738 pub name: std::string::String,
2739
2740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2741}
2742
2743impl StartMigrationWorkflowRequest {
2744 pub fn new() -> Self {
2745 std::default::Default::default()
2746 }
2747
2748 /// Sets the value of [name][crate::model::StartMigrationWorkflowRequest::name].
2749 ///
2750 /// # Example
2751 /// ```ignore,no_run
2752 /// # use google_cloud_bigquery_migration_v2::model::StartMigrationWorkflowRequest;
2753 /// let x = StartMigrationWorkflowRequest::new().set_name("example");
2754 /// ```
2755 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2756 self.name = v.into();
2757 self
2758 }
2759}
2760
2761impl wkt::message::Message for StartMigrationWorkflowRequest {
2762 fn typename() -> &'static str {
2763 "type.googleapis.com/google.cloud.bigquery.migration.v2.StartMigrationWorkflowRequest"
2764 }
2765}
2766
2767/// A request to get a previously created migration subtasks.
2768#[derive(Clone, Default, PartialEq)]
2769#[non_exhaustive]
2770pub struct GetMigrationSubtaskRequest {
2771 /// Required. The unique identifier for the migration subtask.
2772 /// Example: `projects/123/locations/us/workflows/1234/subtasks/543`
2773 pub name: std::string::String,
2774
2775 /// Optional. The list of fields to be retrieved.
2776 pub read_mask: std::option::Option<wkt::FieldMask>,
2777
2778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2779}
2780
2781impl GetMigrationSubtaskRequest {
2782 pub fn new() -> Self {
2783 std::default::Default::default()
2784 }
2785
2786 /// Sets the value of [name][crate::model::GetMigrationSubtaskRequest::name].
2787 ///
2788 /// # Example
2789 /// ```ignore,no_run
2790 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationSubtaskRequest;
2791 /// let x = GetMigrationSubtaskRequest::new().set_name("example");
2792 /// ```
2793 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2794 self.name = v.into();
2795 self
2796 }
2797
2798 /// Sets the value of [read_mask][crate::model::GetMigrationSubtaskRequest::read_mask].
2799 ///
2800 /// # Example
2801 /// ```ignore,no_run
2802 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationSubtaskRequest;
2803 /// use wkt::FieldMask;
2804 /// let x = GetMigrationSubtaskRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2805 /// ```
2806 pub fn set_read_mask<T>(mut self, v: T) -> Self
2807 where
2808 T: std::convert::Into<wkt::FieldMask>,
2809 {
2810 self.read_mask = std::option::Option::Some(v.into());
2811 self
2812 }
2813
2814 /// Sets or clears the value of [read_mask][crate::model::GetMigrationSubtaskRequest::read_mask].
2815 ///
2816 /// # Example
2817 /// ```ignore,no_run
2818 /// # use google_cloud_bigquery_migration_v2::model::GetMigrationSubtaskRequest;
2819 /// use wkt::FieldMask;
2820 /// let x = GetMigrationSubtaskRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2821 /// let x = GetMigrationSubtaskRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2822 /// ```
2823 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2824 where
2825 T: std::convert::Into<wkt::FieldMask>,
2826 {
2827 self.read_mask = v.map(|x| x.into());
2828 self
2829 }
2830}
2831
2832impl wkt::message::Message for GetMigrationSubtaskRequest {
2833 fn typename() -> &'static str {
2834 "type.googleapis.com/google.cloud.bigquery.migration.v2.GetMigrationSubtaskRequest"
2835 }
2836}
2837
2838/// A request to list previously created migration subtasks.
2839#[derive(Clone, Default, PartialEq)]
2840#[non_exhaustive]
2841pub struct ListMigrationSubtasksRequest {
2842 /// Required. The migration task of the subtasks to list.
2843 /// Example: `projects/123/locations/us/workflows/1234`
2844 pub parent: std::string::String,
2845
2846 /// Optional. The list of fields to be retrieved.
2847 pub read_mask: std::option::Option<wkt::FieldMask>,
2848
2849 /// Optional. The maximum number of migration tasks to return. The service may
2850 /// return fewer than this number.
2851 pub page_size: i32,
2852
2853 /// Optional. A page token, received from previous `ListMigrationSubtasks`
2854 /// call. Provide this to retrieve the subsequent page.
2855 ///
2856 /// When paginating, all other parameters provided to `ListMigrationSubtasks`
2857 /// must match the call that provided the page token.
2858 pub page_token: std::string::String,
2859
2860 /// Optional. The filter to apply. This can be used to get the subtasks of a
2861 /// specific tasks in a workflow, e.g. `migration_task = "ab012"` where
2862 /// `"ab012"` is the task ID (not the name in the named map).
2863 pub filter: std::string::String,
2864
2865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2866}
2867
2868impl ListMigrationSubtasksRequest {
2869 pub fn new() -> Self {
2870 std::default::Default::default()
2871 }
2872
2873 /// Sets the value of [parent][crate::model::ListMigrationSubtasksRequest::parent].
2874 ///
2875 /// # Example
2876 /// ```ignore,no_run
2877 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2878 /// let x = ListMigrationSubtasksRequest::new().set_parent("example");
2879 /// ```
2880 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2881 self.parent = v.into();
2882 self
2883 }
2884
2885 /// Sets the value of [read_mask][crate::model::ListMigrationSubtasksRequest::read_mask].
2886 ///
2887 /// # Example
2888 /// ```ignore,no_run
2889 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2890 /// use wkt::FieldMask;
2891 /// let x = ListMigrationSubtasksRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2892 /// ```
2893 pub fn set_read_mask<T>(mut self, v: T) -> Self
2894 where
2895 T: std::convert::Into<wkt::FieldMask>,
2896 {
2897 self.read_mask = std::option::Option::Some(v.into());
2898 self
2899 }
2900
2901 /// Sets or clears the value of [read_mask][crate::model::ListMigrationSubtasksRequest::read_mask].
2902 ///
2903 /// # Example
2904 /// ```ignore,no_run
2905 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2906 /// use wkt::FieldMask;
2907 /// let x = ListMigrationSubtasksRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2908 /// let x = ListMigrationSubtasksRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2909 /// ```
2910 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2911 where
2912 T: std::convert::Into<wkt::FieldMask>,
2913 {
2914 self.read_mask = v.map(|x| x.into());
2915 self
2916 }
2917
2918 /// Sets the value of [page_size][crate::model::ListMigrationSubtasksRequest::page_size].
2919 ///
2920 /// # Example
2921 /// ```ignore,no_run
2922 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2923 /// let x = ListMigrationSubtasksRequest::new().set_page_size(42);
2924 /// ```
2925 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2926 self.page_size = v.into();
2927 self
2928 }
2929
2930 /// Sets the value of [page_token][crate::model::ListMigrationSubtasksRequest::page_token].
2931 ///
2932 /// # Example
2933 /// ```ignore,no_run
2934 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2935 /// let x = ListMigrationSubtasksRequest::new().set_page_token("example");
2936 /// ```
2937 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2938 self.page_token = v.into();
2939 self
2940 }
2941
2942 /// Sets the value of [filter][crate::model::ListMigrationSubtasksRequest::filter].
2943 ///
2944 /// # Example
2945 /// ```ignore,no_run
2946 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksRequest;
2947 /// let x = ListMigrationSubtasksRequest::new().set_filter("example");
2948 /// ```
2949 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2950 self.filter = v.into();
2951 self
2952 }
2953}
2954
2955impl wkt::message::Message for ListMigrationSubtasksRequest {
2956 fn typename() -> &'static str {
2957 "type.googleapis.com/google.cloud.bigquery.migration.v2.ListMigrationSubtasksRequest"
2958 }
2959}
2960
2961/// Response object for a `ListMigrationSubtasks` call.
2962#[derive(Clone, Default, PartialEq)]
2963#[non_exhaustive]
2964pub struct ListMigrationSubtasksResponse {
2965 /// The migration subtasks for the specified task.
2966 pub migration_subtasks: std::vec::Vec<crate::model::MigrationSubtask>,
2967
2968 /// A token, which can be sent as `page_token` to retrieve the next page.
2969 /// If this field is omitted, there are no subsequent pages.
2970 pub next_page_token: std::string::String,
2971
2972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2973}
2974
2975impl ListMigrationSubtasksResponse {
2976 pub fn new() -> Self {
2977 std::default::Default::default()
2978 }
2979
2980 /// Sets the value of [migration_subtasks][crate::model::ListMigrationSubtasksResponse::migration_subtasks].
2981 ///
2982 /// # Example
2983 /// ```ignore,no_run
2984 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksResponse;
2985 /// use google_cloud_bigquery_migration_v2::model::MigrationSubtask;
2986 /// let x = ListMigrationSubtasksResponse::new()
2987 /// .set_migration_subtasks([
2988 /// MigrationSubtask::default()/* use setters */,
2989 /// MigrationSubtask::default()/* use (different) setters */,
2990 /// ]);
2991 /// ```
2992 pub fn set_migration_subtasks<T, V>(mut self, v: T) -> Self
2993 where
2994 T: std::iter::IntoIterator<Item = V>,
2995 V: std::convert::Into<crate::model::MigrationSubtask>,
2996 {
2997 use std::iter::Iterator;
2998 self.migration_subtasks = v.into_iter().map(|i| i.into()).collect();
2999 self
3000 }
3001
3002 /// Sets the value of [next_page_token][crate::model::ListMigrationSubtasksResponse::next_page_token].
3003 ///
3004 /// # Example
3005 /// ```ignore,no_run
3006 /// # use google_cloud_bigquery_migration_v2::model::ListMigrationSubtasksResponse;
3007 /// let x = ListMigrationSubtasksResponse::new().set_next_page_token("example");
3008 /// ```
3009 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3010 self.next_page_token = v.into();
3011 self
3012 }
3013}
3014
3015impl wkt::message::Message for ListMigrationSubtasksResponse {
3016 fn typename() -> &'static str {
3017 "type.googleapis.com/google.cloud.bigquery.migration.v2.ListMigrationSubtasksResponse"
3018 }
3019}
3020
3021#[doc(hidden)]
3022impl google_cloud_gax::paginator::internal::PageableResponse for ListMigrationSubtasksResponse {
3023 type PageItem = crate::model::MigrationSubtask;
3024
3025 fn items(self) -> std::vec::Vec<Self::PageItem> {
3026 self.migration_subtasks
3027 }
3028
3029 fn next_page_token(&self) -> std::string::String {
3030 use std::clone::Clone;
3031 self.next_page_token.clone()
3032 }
3033}
3034
3035/// The translation config to capture necessary settings for a translation task
3036/// and subtask.
3037#[derive(Clone, Default, PartialEq)]
3038#[non_exhaustive]
3039pub struct TranslationConfigDetails {
3040 /// The dialect of the input files.
3041 pub source_dialect: std::option::Option<crate::model::Dialect>,
3042
3043 /// The target dialect for the engine to translate the input to.
3044 pub target_dialect: std::option::Option<crate::model::Dialect>,
3045
3046 /// The default source environment values for the translation.
3047 pub source_env: std::option::Option<crate::model::SourceEnv>,
3048
3049 /// The indicator to show translation request initiator.
3050 pub request_source: std::string::String,
3051
3052 /// The types of output to generate, e.g. sql, metadata etc. If not specified,
3053 /// a default set of targets will be generated. Some additional target types
3054 /// may be slower to generate. See the documentation for the set of available
3055 /// target types.
3056 pub target_types: std::vec::Vec<std::string::String>,
3057
3058 /// The chosen path where the source for input files will be found.
3059 pub source_location:
3060 std::option::Option<crate::model::translation_config_details::SourceLocation>,
3061
3062 /// The chosen path where the destination for output files will be found.
3063 pub target_location:
3064 std::option::Option<crate::model::translation_config_details::TargetLocation>,
3065
3066 /// The mapping of full SQL object names from their current state to the
3067 /// desired output.
3068 pub output_name_mapping:
3069 std::option::Option<crate::model::translation_config_details::OutputNameMapping>,
3070
3071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3072}
3073
3074impl TranslationConfigDetails {
3075 pub fn new() -> Self {
3076 std::default::Default::default()
3077 }
3078
3079 /// Sets the value of [source_dialect][crate::model::TranslationConfigDetails::source_dialect].
3080 ///
3081 /// # Example
3082 /// ```ignore,no_run
3083 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3084 /// use google_cloud_bigquery_migration_v2::model::Dialect;
3085 /// let x = TranslationConfigDetails::new().set_source_dialect(Dialect::default()/* use setters */);
3086 /// ```
3087 pub fn set_source_dialect<T>(mut self, v: T) -> Self
3088 where
3089 T: std::convert::Into<crate::model::Dialect>,
3090 {
3091 self.source_dialect = std::option::Option::Some(v.into());
3092 self
3093 }
3094
3095 /// Sets or clears the value of [source_dialect][crate::model::TranslationConfigDetails::source_dialect].
3096 ///
3097 /// # Example
3098 /// ```ignore,no_run
3099 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3100 /// use google_cloud_bigquery_migration_v2::model::Dialect;
3101 /// let x = TranslationConfigDetails::new().set_or_clear_source_dialect(Some(Dialect::default()/* use setters */));
3102 /// let x = TranslationConfigDetails::new().set_or_clear_source_dialect(None::<Dialect>);
3103 /// ```
3104 pub fn set_or_clear_source_dialect<T>(mut self, v: std::option::Option<T>) -> Self
3105 where
3106 T: std::convert::Into<crate::model::Dialect>,
3107 {
3108 self.source_dialect = v.map(|x| x.into());
3109 self
3110 }
3111
3112 /// Sets the value of [target_dialect][crate::model::TranslationConfigDetails::target_dialect].
3113 ///
3114 /// # Example
3115 /// ```ignore,no_run
3116 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3117 /// use google_cloud_bigquery_migration_v2::model::Dialect;
3118 /// let x = TranslationConfigDetails::new().set_target_dialect(Dialect::default()/* use setters */);
3119 /// ```
3120 pub fn set_target_dialect<T>(mut self, v: T) -> Self
3121 where
3122 T: std::convert::Into<crate::model::Dialect>,
3123 {
3124 self.target_dialect = std::option::Option::Some(v.into());
3125 self
3126 }
3127
3128 /// Sets or clears the value of [target_dialect][crate::model::TranslationConfigDetails::target_dialect].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3133 /// use google_cloud_bigquery_migration_v2::model::Dialect;
3134 /// let x = TranslationConfigDetails::new().set_or_clear_target_dialect(Some(Dialect::default()/* use setters */));
3135 /// let x = TranslationConfigDetails::new().set_or_clear_target_dialect(None::<Dialect>);
3136 /// ```
3137 pub fn set_or_clear_target_dialect<T>(mut self, v: std::option::Option<T>) -> Self
3138 where
3139 T: std::convert::Into<crate::model::Dialect>,
3140 {
3141 self.target_dialect = v.map(|x| x.into());
3142 self
3143 }
3144
3145 /// Sets the value of [source_env][crate::model::TranslationConfigDetails::source_env].
3146 ///
3147 /// # Example
3148 /// ```ignore,no_run
3149 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3150 /// use google_cloud_bigquery_migration_v2::model::SourceEnv;
3151 /// let x = TranslationConfigDetails::new().set_source_env(SourceEnv::default()/* use setters */);
3152 /// ```
3153 pub fn set_source_env<T>(mut self, v: T) -> Self
3154 where
3155 T: std::convert::Into<crate::model::SourceEnv>,
3156 {
3157 self.source_env = std::option::Option::Some(v.into());
3158 self
3159 }
3160
3161 /// Sets or clears the value of [source_env][crate::model::TranslationConfigDetails::source_env].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3166 /// use google_cloud_bigquery_migration_v2::model::SourceEnv;
3167 /// let x = TranslationConfigDetails::new().set_or_clear_source_env(Some(SourceEnv::default()/* use setters */));
3168 /// let x = TranslationConfigDetails::new().set_or_clear_source_env(None::<SourceEnv>);
3169 /// ```
3170 pub fn set_or_clear_source_env<T>(mut self, v: std::option::Option<T>) -> Self
3171 where
3172 T: std::convert::Into<crate::model::SourceEnv>,
3173 {
3174 self.source_env = v.map(|x| x.into());
3175 self
3176 }
3177
3178 /// Sets the value of [request_source][crate::model::TranslationConfigDetails::request_source].
3179 ///
3180 /// # Example
3181 /// ```ignore,no_run
3182 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3183 /// let x = TranslationConfigDetails::new().set_request_source("example");
3184 /// ```
3185 pub fn set_request_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3186 self.request_source = v.into();
3187 self
3188 }
3189
3190 /// Sets the value of [target_types][crate::model::TranslationConfigDetails::target_types].
3191 ///
3192 /// # Example
3193 /// ```ignore,no_run
3194 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3195 /// let x = TranslationConfigDetails::new().set_target_types(["a", "b", "c"]);
3196 /// ```
3197 pub fn set_target_types<T, V>(mut self, v: T) -> Self
3198 where
3199 T: std::iter::IntoIterator<Item = V>,
3200 V: std::convert::Into<std::string::String>,
3201 {
3202 use std::iter::Iterator;
3203 self.target_types = v.into_iter().map(|i| i.into()).collect();
3204 self
3205 }
3206
3207 /// Sets the value of [source_location][crate::model::TranslationConfigDetails::source_location].
3208 ///
3209 /// Note that all the setters affecting `source_location` are mutually
3210 /// exclusive.
3211 ///
3212 /// # Example
3213 /// ```ignore,no_run
3214 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3215 /// use google_cloud_bigquery_migration_v2::model::translation_config_details::SourceLocation;
3216 /// let x = TranslationConfigDetails::new().set_source_location(Some(SourceLocation::GcsSourcePath("example".to_string())));
3217 /// ```
3218 pub fn set_source_location<
3219 T: std::convert::Into<
3220 std::option::Option<crate::model::translation_config_details::SourceLocation>,
3221 >,
3222 >(
3223 mut self,
3224 v: T,
3225 ) -> Self {
3226 self.source_location = v.into();
3227 self
3228 }
3229
3230 /// The value of [source_location][crate::model::TranslationConfigDetails::source_location]
3231 /// if it holds a `GcsSourcePath`, `None` if the field is not set or
3232 /// holds a different branch.
3233 pub fn gcs_source_path(&self) -> std::option::Option<&std::string::String> {
3234 #[allow(unreachable_patterns)]
3235 self.source_location.as_ref().and_then(|v| match v {
3236 crate::model::translation_config_details::SourceLocation::GcsSourcePath(v) => {
3237 std::option::Option::Some(v)
3238 }
3239 _ => std::option::Option::None,
3240 })
3241 }
3242
3243 /// Sets the value of [source_location][crate::model::TranslationConfigDetails::source_location]
3244 /// to hold a `GcsSourcePath`.
3245 ///
3246 /// Note that all the setters affecting `source_location` are
3247 /// mutually exclusive.
3248 ///
3249 /// # Example
3250 /// ```ignore,no_run
3251 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3252 /// let x = TranslationConfigDetails::new().set_gcs_source_path("example");
3253 /// assert!(x.gcs_source_path().is_some());
3254 /// ```
3255 pub fn set_gcs_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3256 self.source_location = std::option::Option::Some(
3257 crate::model::translation_config_details::SourceLocation::GcsSourcePath(v.into()),
3258 );
3259 self
3260 }
3261
3262 /// Sets the value of [target_location][crate::model::TranslationConfigDetails::target_location].
3263 ///
3264 /// Note that all the setters affecting `target_location` are mutually
3265 /// exclusive.
3266 ///
3267 /// # Example
3268 /// ```ignore,no_run
3269 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3270 /// use google_cloud_bigquery_migration_v2::model::translation_config_details::TargetLocation;
3271 /// let x = TranslationConfigDetails::new().set_target_location(Some(TargetLocation::GcsTargetPath("example".to_string())));
3272 /// ```
3273 pub fn set_target_location<
3274 T: std::convert::Into<
3275 std::option::Option<crate::model::translation_config_details::TargetLocation>,
3276 >,
3277 >(
3278 mut self,
3279 v: T,
3280 ) -> Self {
3281 self.target_location = v.into();
3282 self
3283 }
3284
3285 /// The value of [target_location][crate::model::TranslationConfigDetails::target_location]
3286 /// if it holds a `GcsTargetPath`, `None` if the field is not set or
3287 /// holds a different branch.
3288 pub fn gcs_target_path(&self) -> std::option::Option<&std::string::String> {
3289 #[allow(unreachable_patterns)]
3290 self.target_location.as_ref().and_then(|v| match v {
3291 crate::model::translation_config_details::TargetLocation::GcsTargetPath(v) => {
3292 std::option::Option::Some(v)
3293 }
3294 _ => std::option::Option::None,
3295 })
3296 }
3297
3298 /// Sets the value of [target_location][crate::model::TranslationConfigDetails::target_location]
3299 /// to hold a `GcsTargetPath`.
3300 ///
3301 /// Note that all the setters affecting `target_location` are
3302 /// mutually exclusive.
3303 ///
3304 /// # Example
3305 /// ```ignore,no_run
3306 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3307 /// let x = TranslationConfigDetails::new().set_gcs_target_path("example");
3308 /// assert!(x.gcs_target_path().is_some());
3309 /// ```
3310 pub fn set_gcs_target_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3311 self.target_location = std::option::Option::Some(
3312 crate::model::translation_config_details::TargetLocation::GcsTargetPath(v.into()),
3313 );
3314 self
3315 }
3316
3317 /// Sets the value of [output_name_mapping][crate::model::TranslationConfigDetails::output_name_mapping].
3318 ///
3319 /// Note that all the setters affecting `output_name_mapping` are mutually
3320 /// exclusive.
3321 ///
3322 /// # Example
3323 /// ```ignore,no_run
3324 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3325 /// use google_cloud_bigquery_migration_v2::model::ObjectNameMappingList;
3326 /// let x = TranslationConfigDetails::new().set_output_name_mapping(Some(
3327 /// google_cloud_bigquery_migration_v2::model::translation_config_details::OutputNameMapping::NameMappingList(ObjectNameMappingList::default().into())));
3328 /// ```
3329 pub fn set_output_name_mapping<
3330 T: std::convert::Into<
3331 std::option::Option<crate::model::translation_config_details::OutputNameMapping>,
3332 >,
3333 >(
3334 mut self,
3335 v: T,
3336 ) -> Self {
3337 self.output_name_mapping = v.into();
3338 self
3339 }
3340
3341 /// The value of [output_name_mapping][crate::model::TranslationConfigDetails::output_name_mapping]
3342 /// if it holds a `NameMappingList`, `None` if the field is not set or
3343 /// holds a different branch.
3344 pub fn name_mapping_list(
3345 &self,
3346 ) -> std::option::Option<&std::boxed::Box<crate::model::ObjectNameMappingList>> {
3347 #[allow(unreachable_patterns)]
3348 self.output_name_mapping.as_ref().and_then(|v| match v {
3349 crate::model::translation_config_details::OutputNameMapping::NameMappingList(v) => {
3350 std::option::Option::Some(v)
3351 }
3352 _ => std::option::Option::None,
3353 })
3354 }
3355
3356 /// Sets the value of [output_name_mapping][crate::model::TranslationConfigDetails::output_name_mapping]
3357 /// to hold a `NameMappingList`.
3358 ///
3359 /// Note that all the setters affecting `output_name_mapping` are
3360 /// mutually exclusive.
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_bigquery_migration_v2::model::TranslationConfigDetails;
3365 /// use google_cloud_bigquery_migration_v2::model::ObjectNameMappingList;
3366 /// let x = TranslationConfigDetails::new().set_name_mapping_list(ObjectNameMappingList::default()/* use setters */);
3367 /// assert!(x.name_mapping_list().is_some());
3368 /// ```
3369 pub fn set_name_mapping_list<
3370 T: std::convert::Into<std::boxed::Box<crate::model::ObjectNameMappingList>>,
3371 >(
3372 mut self,
3373 v: T,
3374 ) -> Self {
3375 self.output_name_mapping = std::option::Option::Some(
3376 crate::model::translation_config_details::OutputNameMapping::NameMappingList(v.into()),
3377 );
3378 self
3379 }
3380}
3381
3382impl wkt::message::Message for TranslationConfigDetails {
3383 fn typename() -> &'static str {
3384 "type.googleapis.com/google.cloud.bigquery.migration.v2.TranslationConfigDetails"
3385 }
3386}
3387
3388/// Defines additional types related to [TranslationConfigDetails].
3389pub mod translation_config_details {
3390 #[allow(unused_imports)]
3391 use super::*;
3392
3393 /// The chosen path where the source for input files will be found.
3394 #[derive(Clone, Debug, PartialEq)]
3395 #[non_exhaustive]
3396 pub enum SourceLocation {
3397 /// The Cloud Storage path for a directory of files to translate in a task.
3398 GcsSourcePath(std::string::String),
3399 }
3400
3401 /// The chosen path where the destination for output files will be found.
3402 #[derive(Clone, Debug, PartialEq)]
3403 #[non_exhaustive]
3404 pub enum TargetLocation {
3405 /// The Cloud Storage path to write back the corresponding input files to.
3406 GcsTargetPath(std::string::String),
3407 }
3408
3409 /// The mapping of full SQL object names from their current state to the
3410 /// desired output.
3411 #[derive(Clone, Debug, PartialEq)]
3412 #[non_exhaustive]
3413 pub enum OutputNameMapping {
3414 /// The mapping of objects to their desired output names in list form.
3415 NameMappingList(std::boxed::Box<crate::model::ObjectNameMappingList>),
3416 }
3417}
3418
3419/// The possible dialect options for translation.
3420#[derive(Clone, Default, PartialEq)]
3421#[non_exhaustive]
3422pub struct Dialect {
3423 /// The possible dialect options that this message represents.
3424 pub dialect_value: std::option::Option<crate::model::dialect::DialectValue>,
3425
3426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3427}
3428
3429impl Dialect {
3430 pub fn new() -> Self {
3431 std::default::Default::default()
3432 }
3433
3434 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value].
3435 ///
3436 /// Note that all the setters affecting `dialect_value` are mutually
3437 /// exclusive.
3438 ///
3439 /// # Example
3440 /// ```ignore,no_run
3441 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3442 /// use google_cloud_bigquery_migration_v2::model::BigQueryDialect;
3443 /// let x = Dialect::new().set_dialect_value(Some(
3444 /// google_cloud_bigquery_migration_v2::model::dialect::DialectValue::BigqueryDialect(BigQueryDialect::default().into())));
3445 /// ```
3446 pub fn set_dialect_value<
3447 T: std::convert::Into<std::option::Option<crate::model::dialect::DialectValue>>,
3448 >(
3449 mut self,
3450 v: T,
3451 ) -> Self {
3452 self.dialect_value = v.into();
3453 self
3454 }
3455
3456 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3457 /// if it holds a `BigqueryDialect`, `None` if the field is not set or
3458 /// holds a different branch.
3459 pub fn bigquery_dialect(
3460 &self,
3461 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQueryDialect>> {
3462 #[allow(unreachable_patterns)]
3463 self.dialect_value.as_ref().and_then(|v| match v {
3464 crate::model::dialect::DialectValue::BigqueryDialect(v) => std::option::Option::Some(v),
3465 _ => std::option::Option::None,
3466 })
3467 }
3468
3469 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3470 /// to hold a `BigqueryDialect`.
3471 ///
3472 /// Note that all the setters affecting `dialect_value` are
3473 /// mutually exclusive.
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3478 /// use google_cloud_bigquery_migration_v2::model::BigQueryDialect;
3479 /// let x = Dialect::new().set_bigquery_dialect(BigQueryDialect::default()/* use setters */);
3480 /// assert!(x.bigquery_dialect().is_some());
3481 /// assert!(x.hiveql_dialect().is_none());
3482 /// assert!(x.redshift_dialect().is_none());
3483 /// assert!(x.teradata_dialect().is_none());
3484 /// assert!(x.oracle_dialect().is_none());
3485 /// assert!(x.sparksql_dialect().is_none());
3486 /// assert!(x.snowflake_dialect().is_none());
3487 /// assert!(x.netezza_dialect().is_none());
3488 /// assert!(x.azure_synapse_dialect().is_none());
3489 /// assert!(x.vertica_dialect().is_none());
3490 /// assert!(x.sql_server_dialect().is_none());
3491 /// assert!(x.postgresql_dialect().is_none());
3492 /// assert!(x.presto_dialect().is_none());
3493 /// assert!(x.mysql_dialect().is_none());
3494 /// assert!(x.db2_dialect().is_none());
3495 /// assert!(x.sqlite_dialect().is_none());
3496 /// assert!(x.greenplum_dialect().is_none());
3497 /// ```
3498 pub fn set_bigquery_dialect<
3499 T: std::convert::Into<std::boxed::Box<crate::model::BigQueryDialect>>,
3500 >(
3501 mut self,
3502 v: T,
3503 ) -> Self {
3504 self.dialect_value = std::option::Option::Some(
3505 crate::model::dialect::DialectValue::BigqueryDialect(v.into()),
3506 );
3507 self
3508 }
3509
3510 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3511 /// if it holds a `HiveqlDialect`, `None` if the field is not set or
3512 /// holds a different branch.
3513 pub fn hiveql_dialect(
3514 &self,
3515 ) -> std::option::Option<&std::boxed::Box<crate::model::HiveQLDialect>> {
3516 #[allow(unreachable_patterns)]
3517 self.dialect_value.as_ref().and_then(|v| match v {
3518 crate::model::dialect::DialectValue::HiveqlDialect(v) => std::option::Option::Some(v),
3519 _ => std::option::Option::None,
3520 })
3521 }
3522
3523 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3524 /// to hold a `HiveqlDialect`.
3525 ///
3526 /// Note that all the setters affecting `dialect_value` are
3527 /// mutually exclusive.
3528 ///
3529 /// # Example
3530 /// ```ignore,no_run
3531 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3532 /// use google_cloud_bigquery_migration_v2::model::HiveQLDialect;
3533 /// let x = Dialect::new().set_hiveql_dialect(HiveQLDialect::default()/* use setters */);
3534 /// assert!(x.hiveql_dialect().is_some());
3535 /// assert!(x.bigquery_dialect().is_none());
3536 /// assert!(x.redshift_dialect().is_none());
3537 /// assert!(x.teradata_dialect().is_none());
3538 /// assert!(x.oracle_dialect().is_none());
3539 /// assert!(x.sparksql_dialect().is_none());
3540 /// assert!(x.snowflake_dialect().is_none());
3541 /// assert!(x.netezza_dialect().is_none());
3542 /// assert!(x.azure_synapse_dialect().is_none());
3543 /// assert!(x.vertica_dialect().is_none());
3544 /// assert!(x.sql_server_dialect().is_none());
3545 /// assert!(x.postgresql_dialect().is_none());
3546 /// assert!(x.presto_dialect().is_none());
3547 /// assert!(x.mysql_dialect().is_none());
3548 /// assert!(x.db2_dialect().is_none());
3549 /// assert!(x.sqlite_dialect().is_none());
3550 /// assert!(x.greenplum_dialect().is_none());
3551 /// ```
3552 pub fn set_hiveql_dialect<
3553 T: std::convert::Into<std::boxed::Box<crate::model::HiveQLDialect>>,
3554 >(
3555 mut self,
3556 v: T,
3557 ) -> Self {
3558 self.dialect_value =
3559 std::option::Option::Some(crate::model::dialect::DialectValue::HiveqlDialect(v.into()));
3560 self
3561 }
3562
3563 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3564 /// if it holds a `RedshiftDialect`, `None` if the field is not set or
3565 /// holds a different branch.
3566 pub fn redshift_dialect(
3567 &self,
3568 ) -> std::option::Option<&std::boxed::Box<crate::model::RedshiftDialect>> {
3569 #[allow(unreachable_patterns)]
3570 self.dialect_value.as_ref().and_then(|v| match v {
3571 crate::model::dialect::DialectValue::RedshiftDialect(v) => std::option::Option::Some(v),
3572 _ => std::option::Option::None,
3573 })
3574 }
3575
3576 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3577 /// to hold a `RedshiftDialect`.
3578 ///
3579 /// Note that all the setters affecting `dialect_value` are
3580 /// mutually exclusive.
3581 ///
3582 /// # Example
3583 /// ```ignore,no_run
3584 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3585 /// use google_cloud_bigquery_migration_v2::model::RedshiftDialect;
3586 /// let x = Dialect::new().set_redshift_dialect(RedshiftDialect::default()/* use setters */);
3587 /// assert!(x.redshift_dialect().is_some());
3588 /// assert!(x.bigquery_dialect().is_none());
3589 /// assert!(x.hiveql_dialect().is_none());
3590 /// assert!(x.teradata_dialect().is_none());
3591 /// assert!(x.oracle_dialect().is_none());
3592 /// assert!(x.sparksql_dialect().is_none());
3593 /// assert!(x.snowflake_dialect().is_none());
3594 /// assert!(x.netezza_dialect().is_none());
3595 /// assert!(x.azure_synapse_dialect().is_none());
3596 /// assert!(x.vertica_dialect().is_none());
3597 /// assert!(x.sql_server_dialect().is_none());
3598 /// assert!(x.postgresql_dialect().is_none());
3599 /// assert!(x.presto_dialect().is_none());
3600 /// assert!(x.mysql_dialect().is_none());
3601 /// assert!(x.db2_dialect().is_none());
3602 /// assert!(x.sqlite_dialect().is_none());
3603 /// assert!(x.greenplum_dialect().is_none());
3604 /// ```
3605 pub fn set_redshift_dialect<
3606 T: std::convert::Into<std::boxed::Box<crate::model::RedshiftDialect>>,
3607 >(
3608 mut self,
3609 v: T,
3610 ) -> Self {
3611 self.dialect_value = std::option::Option::Some(
3612 crate::model::dialect::DialectValue::RedshiftDialect(v.into()),
3613 );
3614 self
3615 }
3616
3617 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3618 /// if it holds a `TeradataDialect`, `None` if the field is not set or
3619 /// holds a different branch.
3620 pub fn teradata_dialect(
3621 &self,
3622 ) -> std::option::Option<&std::boxed::Box<crate::model::TeradataDialect>> {
3623 #[allow(unreachable_patterns)]
3624 self.dialect_value.as_ref().and_then(|v| match v {
3625 crate::model::dialect::DialectValue::TeradataDialect(v) => std::option::Option::Some(v),
3626 _ => std::option::Option::None,
3627 })
3628 }
3629
3630 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3631 /// to hold a `TeradataDialect`.
3632 ///
3633 /// Note that all the setters affecting `dialect_value` are
3634 /// mutually exclusive.
3635 ///
3636 /// # Example
3637 /// ```ignore,no_run
3638 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3639 /// use google_cloud_bigquery_migration_v2::model::TeradataDialect;
3640 /// let x = Dialect::new().set_teradata_dialect(TeradataDialect::default()/* use setters */);
3641 /// assert!(x.teradata_dialect().is_some());
3642 /// assert!(x.bigquery_dialect().is_none());
3643 /// assert!(x.hiveql_dialect().is_none());
3644 /// assert!(x.redshift_dialect().is_none());
3645 /// assert!(x.oracle_dialect().is_none());
3646 /// assert!(x.sparksql_dialect().is_none());
3647 /// assert!(x.snowflake_dialect().is_none());
3648 /// assert!(x.netezza_dialect().is_none());
3649 /// assert!(x.azure_synapse_dialect().is_none());
3650 /// assert!(x.vertica_dialect().is_none());
3651 /// assert!(x.sql_server_dialect().is_none());
3652 /// assert!(x.postgresql_dialect().is_none());
3653 /// assert!(x.presto_dialect().is_none());
3654 /// assert!(x.mysql_dialect().is_none());
3655 /// assert!(x.db2_dialect().is_none());
3656 /// assert!(x.sqlite_dialect().is_none());
3657 /// assert!(x.greenplum_dialect().is_none());
3658 /// ```
3659 pub fn set_teradata_dialect<
3660 T: std::convert::Into<std::boxed::Box<crate::model::TeradataDialect>>,
3661 >(
3662 mut self,
3663 v: T,
3664 ) -> Self {
3665 self.dialect_value = std::option::Option::Some(
3666 crate::model::dialect::DialectValue::TeradataDialect(v.into()),
3667 );
3668 self
3669 }
3670
3671 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3672 /// if it holds a `OracleDialect`, `None` if the field is not set or
3673 /// holds a different branch.
3674 pub fn oracle_dialect(
3675 &self,
3676 ) -> std::option::Option<&std::boxed::Box<crate::model::OracleDialect>> {
3677 #[allow(unreachable_patterns)]
3678 self.dialect_value.as_ref().and_then(|v| match v {
3679 crate::model::dialect::DialectValue::OracleDialect(v) => std::option::Option::Some(v),
3680 _ => std::option::Option::None,
3681 })
3682 }
3683
3684 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3685 /// to hold a `OracleDialect`.
3686 ///
3687 /// Note that all the setters affecting `dialect_value` are
3688 /// mutually exclusive.
3689 ///
3690 /// # Example
3691 /// ```ignore,no_run
3692 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3693 /// use google_cloud_bigquery_migration_v2::model::OracleDialect;
3694 /// let x = Dialect::new().set_oracle_dialect(OracleDialect::default()/* use setters */);
3695 /// assert!(x.oracle_dialect().is_some());
3696 /// assert!(x.bigquery_dialect().is_none());
3697 /// assert!(x.hiveql_dialect().is_none());
3698 /// assert!(x.redshift_dialect().is_none());
3699 /// assert!(x.teradata_dialect().is_none());
3700 /// assert!(x.sparksql_dialect().is_none());
3701 /// assert!(x.snowflake_dialect().is_none());
3702 /// assert!(x.netezza_dialect().is_none());
3703 /// assert!(x.azure_synapse_dialect().is_none());
3704 /// assert!(x.vertica_dialect().is_none());
3705 /// assert!(x.sql_server_dialect().is_none());
3706 /// assert!(x.postgresql_dialect().is_none());
3707 /// assert!(x.presto_dialect().is_none());
3708 /// assert!(x.mysql_dialect().is_none());
3709 /// assert!(x.db2_dialect().is_none());
3710 /// assert!(x.sqlite_dialect().is_none());
3711 /// assert!(x.greenplum_dialect().is_none());
3712 /// ```
3713 pub fn set_oracle_dialect<
3714 T: std::convert::Into<std::boxed::Box<crate::model::OracleDialect>>,
3715 >(
3716 mut self,
3717 v: T,
3718 ) -> Self {
3719 self.dialect_value =
3720 std::option::Option::Some(crate::model::dialect::DialectValue::OracleDialect(v.into()));
3721 self
3722 }
3723
3724 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3725 /// if it holds a `SparksqlDialect`, `None` if the field is not set or
3726 /// holds a different branch.
3727 pub fn sparksql_dialect(
3728 &self,
3729 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSQLDialect>> {
3730 #[allow(unreachable_patterns)]
3731 self.dialect_value.as_ref().and_then(|v| match v {
3732 crate::model::dialect::DialectValue::SparksqlDialect(v) => std::option::Option::Some(v),
3733 _ => std::option::Option::None,
3734 })
3735 }
3736
3737 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3738 /// to hold a `SparksqlDialect`.
3739 ///
3740 /// Note that all the setters affecting `dialect_value` are
3741 /// mutually exclusive.
3742 ///
3743 /// # Example
3744 /// ```ignore,no_run
3745 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3746 /// use google_cloud_bigquery_migration_v2::model::SparkSQLDialect;
3747 /// let x = Dialect::new().set_sparksql_dialect(SparkSQLDialect::default()/* use setters */);
3748 /// assert!(x.sparksql_dialect().is_some());
3749 /// assert!(x.bigquery_dialect().is_none());
3750 /// assert!(x.hiveql_dialect().is_none());
3751 /// assert!(x.redshift_dialect().is_none());
3752 /// assert!(x.teradata_dialect().is_none());
3753 /// assert!(x.oracle_dialect().is_none());
3754 /// assert!(x.snowflake_dialect().is_none());
3755 /// assert!(x.netezza_dialect().is_none());
3756 /// assert!(x.azure_synapse_dialect().is_none());
3757 /// assert!(x.vertica_dialect().is_none());
3758 /// assert!(x.sql_server_dialect().is_none());
3759 /// assert!(x.postgresql_dialect().is_none());
3760 /// assert!(x.presto_dialect().is_none());
3761 /// assert!(x.mysql_dialect().is_none());
3762 /// assert!(x.db2_dialect().is_none());
3763 /// assert!(x.sqlite_dialect().is_none());
3764 /// assert!(x.greenplum_dialect().is_none());
3765 /// ```
3766 pub fn set_sparksql_dialect<
3767 T: std::convert::Into<std::boxed::Box<crate::model::SparkSQLDialect>>,
3768 >(
3769 mut self,
3770 v: T,
3771 ) -> Self {
3772 self.dialect_value = std::option::Option::Some(
3773 crate::model::dialect::DialectValue::SparksqlDialect(v.into()),
3774 );
3775 self
3776 }
3777
3778 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3779 /// if it holds a `SnowflakeDialect`, `None` if the field is not set or
3780 /// holds a different branch.
3781 pub fn snowflake_dialect(
3782 &self,
3783 ) -> std::option::Option<&std::boxed::Box<crate::model::SnowflakeDialect>> {
3784 #[allow(unreachable_patterns)]
3785 self.dialect_value.as_ref().and_then(|v| match v {
3786 crate::model::dialect::DialectValue::SnowflakeDialect(v) => {
3787 std::option::Option::Some(v)
3788 }
3789 _ => std::option::Option::None,
3790 })
3791 }
3792
3793 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3794 /// to hold a `SnowflakeDialect`.
3795 ///
3796 /// Note that all the setters affecting `dialect_value` are
3797 /// mutually exclusive.
3798 ///
3799 /// # Example
3800 /// ```ignore,no_run
3801 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3802 /// use google_cloud_bigquery_migration_v2::model::SnowflakeDialect;
3803 /// let x = Dialect::new().set_snowflake_dialect(SnowflakeDialect::default()/* use setters */);
3804 /// assert!(x.snowflake_dialect().is_some());
3805 /// assert!(x.bigquery_dialect().is_none());
3806 /// assert!(x.hiveql_dialect().is_none());
3807 /// assert!(x.redshift_dialect().is_none());
3808 /// assert!(x.teradata_dialect().is_none());
3809 /// assert!(x.oracle_dialect().is_none());
3810 /// assert!(x.sparksql_dialect().is_none());
3811 /// assert!(x.netezza_dialect().is_none());
3812 /// assert!(x.azure_synapse_dialect().is_none());
3813 /// assert!(x.vertica_dialect().is_none());
3814 /// assert!(x.sql_server_dialect().is_none());
3815 /// assert!(x.postgresql_dialect().is_none());
3816 /// assert!(x.presto_dialect().is_none());
3817 /// assert!(x.mysql_dialect().is_none());
3818 /// assert!(x.db2_dialect().is_none());
3819 /// assert!(x.sqlite_dialect().is_none());
3820 /// assert!(x.greenplum_dialect().is_none());
3821 /// ```
3822 pub fn set_snowflake_dialect<
3823 T: std::convert::Into<std::boxed::Box<crate::model::SnowflakeDialect>>,
3824 >(
3825 mut self,
3826 v: T,
3827 ) -> Self {
3828 self.dialect_value = std::option::Option::Some(
3829 crate::model::dialect::DialectValue::SnowflakeDialect(v.into()),
3830 );
3831 self
3832 }
3833
3834 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3835 /// if it holds a `NetezzaDialect`, `None` if the field is not set or
3836 /// holds a different branch.
3837 pub fn netezza_dialect(
3838 &self,
3839 ) -> std::option::Option<&std::boxed::Box<crate::model::NetezzaDialect>> {
3840 #[allow(unreachable_patterns)]
3841 self.dialect_value.as_ref().and_then(|v| match v {
3842 crate::model::dialect::DialectValue::NetezzaDialect(v) => std::option::Option::Some(v),
3843 _ => std::option::Option::None,
3844 })
3845 }
3846
3847 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3848 /// to hold a `NetezzaDialect`.
3849 ///
3850 /// Note that all the setters affecting `dialect_value` are
3851 /// mutually exclusive.
3852 ///
3853 /// # Example
3854 /// ```ignore,no_run
3855 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3856 /// use google_cloud_bigquery_migration_v2::model::NetezzaDialect;
3857 /// let x = Dialect::new().set_netezza_dialect(NetezzaDialect::default()/* use setters */);
3858 /// assert!(x.netezza_dialect().is_some());
3859 /// assert!(x.bigquery_dialect().is_none());
3860 /// assert!(x.hiveql_dialect().is_none());
3861 /// assert!(x.redshift_dialect().is_none());
3862 /// assert!(x.teradata_dialect().is_none());
3863 /// assert!(x.oracle_dialect().is_none());
3864 /// assert!(x.sparksql_dialect().is_none());
3865 /// assert!(x.snowflake_dialect().is_none());
3866 /// assert!(x.azure_synapse_dialect().is_none());
3867 /// assert!(x.vertica_dialect().is_none());
3868 /// assert!(x.sql_server_dialect().is_none());
3869 /// assert!(x.postgresql_dialect().is_none());
3870 /// assert!(x.presto_dialect().is_none());
3871 /// assert!(x.mysql_dialect().is_none());
3872 /// assert!(x.db2_dialect().is_none());
3873 /// assert!(x.sqlite_dialect().is_none());
3874 /// assert!(x.greenplum_dialect().is_none());
3875 /// ```
3876 pub fn set_netezza_dialect<
3877 T: std::convert::Into<std::boxed::Box<crate::model::NetezzaDialect>>,
3878 >(
3879 mut self,
3880 v: T,
3881 ) -> Self {
3882 self.dialect_value = std::option::Option::Some(
3883 crate::model::dialect::DialectValue::NetezzaDialect(v.into()),
3884 );
3885 self
3886 }
3887
3888 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3889 /// if it holds a `AzureSynapseDialect`, `None` if the field is not set or
3890 /// holds a different branch.
3891 pub fn azure_synapse_dialect(
3892 &self,
3893 ) -> std::option::Option<&std::boxed::Box<crate::model::AzureSynapseDialect>> {
3894 #[allow(unreachable_patterns)]
3895 self.dialect_value.as_ref().and_then(|v| match v {
3896 crate::model::dialect::DialectValue::AzureSynapseDialect(v) => {
3897 std::option::Option::Some(v)
3898 }
3899 _ => std::option::Option::None,
3900 })
3901 }
3902
3903 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3904 /// to hold a `AzureSynapseDialect`.
3905 ///
3906 /// Note that all the setters affecting `dialect_value` are
3907 /// mutually exclusive.
3908 ///
3909 /// # Example
3910 /// ```ignore,no_run
3911 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3912 /// use google_cloud_bigquery_migration_v2::model::AzureSynapseDialect;
3913 /// let x = Dialect::new().set_azure_synapse_dialect(AzureSynapseDialect::default()/* use setters */);
3914 /// assert!(x.azure_synapse_dialect().is_some());
3915 /// assert!(x.bigquery_dialect().is_none());
3916 /// assert!(x.hiveql_dialect().is_none());
3917 /// assert!(x.redshift_dialect().is_none());
3918 /// assert!(x.teradata_dialect().is_none());
3919 /// assert!(x.oracle_dialect().is_none());
3920 /// assert!(x.sparksql_dialect().is_none());
3921 /// assert!(x.snowflake_dialect().is_none());
3922 /// assert!(x.netezza_dialect().is_none());
3923 /// assert!(x.vertica_dialect().is_none());
3924 /// assert!(x.sql_server_dialect().is_none());
3925 /// assert!(x.postgresql_dialect().is_none());
3926 /// assert!(x.presto_dialect().is_none());
3927 /// assert!(x.mysql_dialect().is_none());
3928 /// assert!(x.db2_dialect().is_none());
3929 /// assert!(x.sqlite_dialect().is_none());
3930 /// assert!(x.greenplum_dialect().is_none());
3931 /// ```
3932 pub fn set_azure_synapse_dialect<
3933 T: std::convert::Into<std::boxed::Box<crate::model::AzureSynapseDialect>>,
3934 >(
3935 mut self,
3936 v: T,
3937 ) -> Self {
3938 self.dialect_value = std::option::Option::Some(
3939 crate::model::dialect::DialectValue::AzureSynapseDialect(v.into()),
3940 );
3941 self
3942 }
3943
3944 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3945 /// if it holds a `VerticaDialect`, `None` if the field is not set or
3946 /// holds a different branch.
3947 pub fn vertica_dialect(
3948 &self,
3949 ) -> std::option::Option<&std::boxed::Box<crate::model::VerticaDialect>> {
3950 #[allow(unreachable_patterns)]
3951 self.dialect_value.as_ref().and_then(|v| match v {
3952 crate::model::dialect::DialectValue::VerticaDialect(v) => std::option::Option::Some(v),
3953 _ => std::option::Option::None,
3954 })
3955 }
3956
3957 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
3958 /// to hold a `VerticaDialect`.
3959 ///
3960 /// Note that all the setters affecting `dialect_value` are
3961 /// mutually exclusive.
3962 ///
3963 /// # Example
3964 /// ```ignore,no_run
3965 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
3966 /// use google_cloud_bigquery_migration_v2::model::VerticaDialect;
3967 /// let x = Dialect::new().set_vertica_dialect(VerticaDialect::default()/* use setters */);
3968 /// assert!(x.vertica_dialect().is_some());
3969 /// assert!(x.bigquery_dialect().is_none());
3970 /// assert!(x.hiveql_dialect().is_none());
3971 /// assert!(x.redshift_dialect().is_none());
3972 /// assert!(x.teradata_dialect().is_none());
3973 /// assert!(x.oracle_dialect().is_none());
3974 /// assert!(x.sparksql_dialect().is_none());
3975 /// assert!(x.snowflake_dialect().is_none());
3976 /// assert!(x.netezza_dialect().is_none());
3977 /// assert!(x.azure_synapse_dialect().is_none());
3978 /// assert!(x.sql_server_dialect().is_none());
3979 /// assert!(x.postgresql_dialect().is_none());
3980 /// assert!(x.presto_dialect().is_none());
3981 /// assert!(x.mysql_dialect().is_none());
3982 /// assert!(x.db2_dialect().is_none());
3983 /// assert!(x.sqlite_dialect().is_none());
3984 /// assert!(x.greenplum_dialect().is_none());
3985 /// ```
3986 pub fn set_vertica_dialect<
3987 T: std::convert::Into<std::boxed::Box<crate::model::VerticaDialect>>,
3988 >(
3989 mut self,
3990 v: T,
3991 ) -> Self {
3992 self.dialect_value = std::option::Option::Some(
3993 crate::model::dialect::DialectValue::VerticaDialect(v.into()),
3994 );
3995 self
3996 }
3997
3998 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
3999 /// if it holds a `SqlServerDialect`, `None` if the field is not set or
4000 /// holds a different branch.
4001 pub fn sql_server_dialect(
4002 &self,
4003 ) -> std::option::Option<&std::boxed::Box<crate::model::SQLServerDialect>> {
4004 #[allow(unreachable_patterns)]
4005 self.dialect_value.as_ref().and_then(|v| match v {
4006 crate::model::dialect::DialectValue::SqlServerDialect(v) => {
4007 std::option::Option::Some(v)
4008 }
4009 _ => std::option::Option::None,
4010 })
4011 }
4012
4013 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4014 /// to hold a `SqlServerDialect`.
4015 ///
4016 /// Note that all the setters affecting `dialect_value` are
4017 /// mutually exclusive.
4018 ///
4019 /// # Example
4020 /// ```ignore,no_run
4021 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4022 /// use google_cloud_bigquery_migration_v2::model::SQLServerDialect;
4023 /// let x = Dialect::new().set_sql_server_dialect(SQLServerDialect::default()/* use setters */);
4024 /// assert!(x.sql_server_dialect().is_some());
4025 /// assert!(x.bigquery_dialect().is_none());
4026 /// assert!(x.hiveql_dialect().is_none());
4027 /// assert!(x.redshift_dialect().is_none());
4028 /// assert!(x.teradata_dialect().is_none());
4029 /// assert!(x.oracle_dialect().is_none());
4030 /// assert!(x.sparksql_dialect().is_none());
4031 /// assert!(x.snowflake_dialect().is_none());
4032 /// assert!(x.netezza_dialect().is_none());
4033 /// assert!(x.azure_synapse_dialect().is_none());
4034 /// assert!(x.vertica_dialect().is_none());
4035 /// assert!(x.postgresql_dialect().is_none());
4036 /// assert!(x.presto_dialect().is_none());
4037 /// assert!(x.mysql_dialect().is_none());
4038 /// assert!(x.db2_dialect().is_none());
4039 /// assert!(x.sqlite_dialect().is_none());
4040 /// assert!(x.greenplum_dialect().is_none());
4041 /// ```
4042 pub fn set_sql_server_dialect<
4043 T: std::convert::Into<std::boxed::Box<crate::model::SQLServerDialect>>,
4044 >(
4045 mut self,
4046 v: T,
4047 ) -> Self {
4048 self.dialect_value = std::option::Option::Some(
4049 crate::model::dialect::DialectValue::SqlServerDialect(v.into()),
4050 );
4051 self
4052 }
4053
4054 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4055 /// if it holds a `PostgresqlDialect`, `None` if the field is not set or
4056 /// holds a different branch.
4057 pub fn postgresql_dialect(
4058 &self,
4059 ) -> std::option::Option<&std::boxed::Box<crate::model::PostgresqlDialect>> {
4060 #[allow(unreachable_patterns)]
4061 self.dialect_value.as_ref().and_then(|v| match v {
4062 crate::model::dialect::DialectValue::PostgresqlDialect(v) => {
4063 std::option::Option::Some(v)
4064 }
4065 _ => std::option::Option::None,
4066 })
4067 }
4068
4069 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4070 /// to hold a `PostgresqlDialect`.
4071 ///
4072 /// Note that all the setters affecting `dialect_value` are
4073 /// mutually exclusive.
4074 ///
4075 /// # Example
4076 /// ```ignore,no_run
4077 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4078 /// use google_cloud_bigquery_migration_v2::model::PostgresqlDialect;
4079 /// let x = Dialect::new().set_postgresql_dialect(PostgresqlDialect::default()/* use setters */);
4080 /// assert!(x.postgresql_dialect().is_some());
4081 /// assert!(x.bigquery_dialect().is_none());
4082 /// assert!(x.hiveql_dialect().is_none());
4083 /// assert!(x.redshift_dialect().is_none());
4084 /// assert!(x.teradata_dialect().is_none());
4085 /// assert!(x.oracle_dialect().is_none());
4086 /// assert!(x.sparksql_dialect().is_none());
4087 /// assert!(x.snowflake_dialect().is_none());
4088 /// assert!(x.netezza_dialect().is_none());
4089 /// assert!(x.azure_synapse_dialect().is_none());
4090 /// assert!(x.vertica_dialect().is_none());
4091 /// assert!(x.sql_server_dialect().is_none());
4092 /// assert!(x.presto_dialect().is_none());
4093 /// assert!(x.mysql_dialect().is_none());
4094 /// assert!(x.db2_dialect().is_none());
4095 /// assert!(x.sqlite_dialect().is_none());
4096 /// assert!(x.greenplum_dialect().is_none());
4097 /// ```
4098 pub fn set_postgresql_dialect<
4099 T: std::convert::Into<std::boxed::Box<crate::model::PostgresqlDialect>>,
4100 >(
4101 mut self,
4102 v: T,
4103 ) -> Self {
4104 self.dialect_value = std::option::Option::Some(
4105 crate::model::dialect::DialectValue::PostgresqlDialect(v.into()),
4106 );
4107 self
4108 }
4109
4110 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4111 /// if it holds a `PrestoDialect`, `None` if the field is not set or
4112 /// holds a different branch.
4113 pub fn presto_dialect(
4114 &self,
4115 ) -> std::option::Option<&std::boxed::Box<crate::model::PrestoDialect>> {
4116 #[allow(unreachable_patterns)]
4117 self.dialect_value.as_ref().and_then(|v| match v {
4118 crate::model::dialect::DialectValue::PrestoDialect(v) => std::option::Option::Some(v),
4119 _ => std::option::Option::None,
4120 })
4121 }
4122
4123 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4124 /// to hold a `PrestoDialect`.
4125 ///
4126 /// Note that all the setters affecting `dialect_value` are
4127 /// mutually exclusive.
4128 ///
4129 /// # Example
4130 /// ```ignore,no_run
4131 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4132 /// use google_cloud_bigquery_migration_v2::model::PrestoDialect;
4133 /// let x = Dialect::new().set_presto_dialect(PrestoDialect::default()/* use setters */);
4134 /// assert!(x.presto_dialect().is_some());
4135 /// assert!(x.bigquery_dialect().is_none());
4136 /// assert!(x.hiveql_dialect().is_none());
4137 /// assert!(x.redshift_dialect().is_none());
4138 /// assert!(x.teradata_dialect().is_none());
4139 /// assert!(x.oracle_dialect().is_none());
4140 /// assert!(x.sparksql_dialect().is_none());
4141 /// assert!(x.snowflake_dialect().is_none());
4142 /// assert!(x.netezza_dialect().is_none());
4143 /// assert!(x.azure_synapse_dialect().is_none());
4144 /// assert!(x.vertica_dialect().is_none());
4145 /// assert!(x.sql_server_dialect().is_none());
4146 /// assert!(x.postgresql_dialect().is_none());
4147 /// assert!(x.mysql_dialect().is_none());
4148 /// assert!(x.db2_dialect().is_none());
4149 /// assert!(x.sqlite_dialect().is_none());
4150 /// assert!(x.greenplum_dialect().is_none());
4151 /// ```
4152 pub fn set_presto_dialect<
4153 T: std::convert::Into<std::boxed::Box<crate::model::PrestoDialect>>,
4154 >(
4155 mut self,
4156 v: T,
4157 ) -> Self {
4158 self.dialect_value =
4159 std::option::Option::Some(crate::model::dialect::DialectValue::PrestoDialect(v.into()));
4160 self
4161 }
4162
4163 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4164 /// if it holds a `MysqlDialect`, `None` if the field is not set or
4165 /// holds a different branch.
4166 pub fn mysql_dialect(
4167 &self,
4168 ) -> std::option::Option<&std::boxed::Box<crate::model::MySQLDialect>> {
4169 #[allow(unreachable_patterns)]
4170 self.dialect_value.as_ref().and_then(|v| match v {
4171 crate::model::dialect::DialectValue::MysqlDialect(v) => std::option::Option::Some(v),
4172 _ => std::option::Option::None,
4173 })
4174 }
4175
4176 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4177 /// to hold a `MysqlDialect`.
4178 ///
4179 /// Note that all the setters affecting `dialect_value` are
4180 /// mutually exclusive.
4181 ///
4182 /// # Example
4183 /// ```ignore,no_run
4184 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4185 /// use google_cloud_bigquery_migration_v2::model::MySQLDialect;
4186 /// let x = Dialect::new().set_mysql_dialect(MySQLDialect::default()/* use setters */);
4187 /// assert!(x.mysql_dialect().is_some());
4188 /// assert!(x.bigquery_dialect().is_none());
4189 /// assert!(x.hiveql_dialect().is_none());
4190 /// assert!(x.redshift_dialect().is_none());
4191 /// assert!(x.teradata_dialect().is_none());
4192 /// assert!(x.oracle_dialect().is_none());
4193 /// assert!(x.sparksql_dialect().is_none());
4194 /// assert!(x.snowflake_dialect().is_none());
4195 /// assert!(x.netezza_dialect().is_none());
4196 /// assert!(x.azure_synapse_dialect().is_none());
4197 /// assert!(x.vertica_dialect().is_none());
4198 /// assert!(x.sql_server_dialect().is_none());
4199 /// assert!(x.postgresql_dialect().is_none());
4200 /// assert!(x.presto_dialect().is_none());
4201 /// assert!(x.db2_dialect().is_none());
4202 /// assert!(x.sqlite_dialect().is_none());
4203 /// assert!(x.greenplum_dialect().is_none());
4204 /// ```
4205 pub fn set_mysql_dialect<T: std::convert::Into<std::boxed::Box<crate::model::MySQLDialect>>>(
4206 mut self,
4207 v: T,
4208 ) -> Self {
4209 self.dialect_value =
4210 std::option::Option::Some(crate::model::dialect::DialectValue::MysqlDialect(v.into()));
4211 self
4212 }
4213
4214 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4215 /// if it holds a `Db2Dialect`, `None` if the field is not set or
4216 /// holds a different branch.
4217 pub fn db2_dialect(&self) -> std::option::Option<&std::boxed::Box<crate::model::DB2Dialect>> {
4218 #[allow(unreachable_patterns)]
4219 self.dialect_value.as_ref().and_then(|v| match v {
4220 crate::model::dialect::DialectValue::Db2Dialect(v) => std::option::Option::Some(v),
4221 _ => std::option::Option::None,
4222 })
4223 }
4224
4225 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4226 /// to hold a `Db2Dialect`.
4227 ///
4228 /// Note that all the setters affecting `dialect_value` are
4229 /// mutually exclusive.
4230 ///
4231 /// # Example
4232 /// ```ignore,no_run
4233 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4234 /// use google_cloud_bigquery_migration_v2::model::DB2Dialect;
4235 /// let x = Dialect::new().set_db2_dialect(DB2Dialect::default()/* use setters */);
4236 /// assert!(x.db2_dialect().is_some());
4237 /// assert!(x.bigquery_dialect().is_none());
4238 /// assert!(x.hiveql_dialect().is_none());
4239 /// assert!(x.redshift_dialect().is_none());
4240 /// assert!(x.teradata_dialect().is_none());
4241 /// assert!(x.oracle_dialect().is_none());
4242 /// assert!(x.sparksql_dialect().is_none());
4243 /// assert!(x.snowflake_dialect().is_none());
4244 /// assert!(x.netezza_dialect().is_none());
4245 /// assert!(x.azure_synapse_dialect().is_none());
4246 /// assert!(x.vertica_dialect().is_none());
4247 /// assert!(x.sql_server_dialect().is_none());
4248 /// assert!(x.postgresql_dialect().is_none());
4249 /// assert!(x.presto_dialect().is_none());
4250 /// assert!(x.mysql_dialect().is_none());
4251 /// assert!(x.sqlite_dialect().is_none());
4252 /// assert!(x.greenplum_dialect().is_none());
4253 /// ```
4254 pub fn set_db2_dialect<T: std::convert::Into<std::boxed::Box<crate::model::DB2Dialect>>>(
4255 mut self,
4256 v: T,
4257 ) -> Self {
4258 self.dialect_value =
4259 std::option::Option::Some(crate::model::dialect::DialectValue::Db2Dialect(v.into()));
4260 self
4261 }
4262
4263 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4264 /// if it holds a `SqliteDialect`, `None` if the field is not set or
4265 /// holds a different branch.
4266 pub fn sqlite_dialect(
4267 &self,
4268 ) -> std::option::Option<&std::boxed::Box<crate::model::SQLiteDialect>> {
4269 #[allow(unreachable_patterns)]
4270 self.dialect_value.as_ref().and_then(|v| match v {
4271 crate::model::dialect::DialectValue::SqliteDialect(v) => std::option::Option::Some(v),
4272 _ => std::option::Option::None,
4273 })
4274 }
4275
4276 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4277 /// to hold a `SqliteDialect`.
4278 ///
4279 /// Note that all the setters affecting `dialect_value` are
4280 /// mutually exclusive.
4281 ///
4282 /// # Example
4283 /// ```ignore,no_run
4284 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4285 /// use google_cloud_bigquery_migration_v2::model::SQLiteDialect;
4286 /// let x = Dialect::new().set_sqlite_dialect(SQLiteDialect::default()/* use setters */);
4287 /// assert!(x.sqlite_dialect().is_some());
4288 /// assert!(x.bigquery_dialect().is_none());
4289 /// assert!(x.hiveql_dialect().is_none());
4290 /// assert!(x.redshift_dialect().is_none());
4291 /// assert!(x.teradata_dialect().is_none());
4292 /// assert!(x.oracle_dialect().is_none());
4293 /// assert!(x.sparksql_dialect().is_none());
4294 /// assert!(x.snowflake_dialect().is_none());
4295 /// assert!(x.netezza_dialect().is_none());
4296 /// assert!(x.azure_synapse_dialect().is_none());
4297 /// assert!(x.vertica_dialect().is_none());
4298 /// assert!(x.sql_server_dialect().is_none());
4299 /// assert!(x.postgresql_dialect().is_none());
4300 /// assert!(x.presto_dialect().is_none());
4301 /// assert!(x.mysql_dialect().is_none());
4302 /// assert!(x.db2_dialect().is_none());
4303 /// assert!(x.greenplum_dialect().is_none());
4304 /// ```
4305 pub fn set_sqlite_dialect<
4306 T: std::convert::Into<std::boxed::Box<crate::model::SQLiteDialect>>,
4307 >(
4308 mut self,
4309 v: T,
4310 ) -> Self {
4311 self.dialect_value =
4312 std::option::Option::Some(crate::model::dialect::DialectValue::SqliteDialect(v.into()));
4313 self
4314 }
4315
4316 /// The value of [dialect_value][crate::model::Dialect::dialect_value]
4317 /// if it holds a `GreenplumDialect`, `None` if the field is not set or
4318 /// holds a different branch.
4319 pub fn greenplum_dialect(
4320 &self,
4321 ) -> std::option::Option<&std::boxed::Box<crate::model::GreenplumDialect>> {
4322 #[allow(unreachable_patterns)]
4323 self.dialect_value.as_ref().and_then(|v| match v {
4324 crate::model::dialect::DialectValue::GreenplumDialect(v) => {
4325 std::option::Option::Some(v)
4326 }
4327 _ => std::option::Option::None,
4328 })
4329 }
4330
4331 /// Sets the value of [dialect_value][crate::model::Dialect::dialect_value]
4332 /// to hold a `GreenplumDialect`.
4333 ///
4334 /// Note that all the setters affecting `dialect_value` are
4335 /// mutually exclusive.
4336 ///
4337 /// # Example
4338 /// ```ignore,no_run
4339 /// # use google_cloud_bigquery_migration_v2::model::Dialect;
4340 /// use google_cloud_bigquery_migration_v2::model::GreenplumDialect;
4341 /// let x = Dialect::new().set_greenplum_dialect(GreenplumDialect::default()/* use setters */);
4342 /// assert!(x.greenplum_dialect().is_some());
4343 /// assert!(x.bigquery_dialect().is_none());
4344 /// assert!(x.hiveql_dialect().is_none());
4345 /// assert!(x.redshift_dialect().is_none());
4346 /// assert!(x.teradata_dialect().is_none());
4347 /// assert!(x.oracle_dialect().is_none());
4348 /// assert!(x.sparksql_dialect().is_none());
4349 /// assert!(x.snowflake_dialect().is_none());
4350 /// assert!(x.netezza_dialect().is_none());
4351 /// assert!(x.azure_synapse_dialect().is_none());
4352 /// assert!(x.vertica_dialect().is_none());
4353 /// assert!(x.sql_server_dialect().is_none());
4354 /// assert!(x.postgresql_dialect().is_none());
4355 /// assert!(x.presto_dialect().is_none());
4356 /// assert!(x.mysql_dialect().is_none());
4357 /// assert!(x.db2_dialect().is_none());
4358 /// assert!(x.sqlite_dialect().is_none());
4359 /// ```
4360 pub fn set_greenplum_dialect<
4361 T: std::convert::Into<std::boxed::Box<crate::model::GreenplumDialect>>,
4362 >(
4363 mut self,
4364 v: T,
4365 ) -> Self {
4366 self.dialect_value = std::option::Option::Some(
4367 crate::model::dialect::DialectValue::GreenplumDialect(v.into()),
4368 );
4369 self
4370 }
4371}
4372
4373impl wkt::message::Message for Dialect {
4374 fn typename() -> &'static str {
4375 "type.googleapis.com/google.cloud.bigquery.migration.v2.Dialect"
4376 }
4377}
4378
4379/// Defines additional types related to [Dialect].
4380pub mod dialect {
4381 #[allow(unused_imports)]
4382 use super::*;
4383
4384 /// The possible dialect options that this message represents.
4385 #[derive(Clone, Debug, PartialEq)]
4386 #[non_exhaustive]
4387 pub enum DialectValue {
4388 /// The BigQuery dialect
4389 BigqueryDialect(std::boxed::Box<crate::model::BigQueryDialect>),
4390 /// The HiveQL dialect
4391 HiveqlDialect(std::boxed::Box<crate::model::HiveQLDialect>),
4392 /// The Redshift dialect
4393 RedshiftDialect(std::boxed::Box<crate::model::RedshiftDialect>),
4394 /// The Teradata dialect
4395 TeradataDialect(std::boxed::Box<crate::model::TeradataDialect>),
4396 /// The Oracle dialect
4397 OracleDialect(std::boxed::Box<crate::model::OracleDialect>),
4398 /// The SparkSQL dialect
4399 SparksqlDialect(std::boxed::Box<crate::model::SparkSQLDialect>),
4400 /// The Snowflake dialect
4401 SnowflakeDialect(std::boxed::Box<crate::model::SnowflakeDialect>),
4402 /// The Netezza dialect
4403 NetezzaDialect(std::boxed::Box<crate::model::NetezzaDialect>),
4404 /// The Azure Synapse dialect
4405 AzureSynapseDialect(std::boxed::Box<crate::model::AzureSynapseDialect>),
4406 /// The Vertica dialect
4407 VerticaDialect(std::boxed::Box<crate::model::VerticaDialect>),
4408 /// The SQL Server dialect
4409 SqlServerDialect(std::boxed::Box<crate::model::SQLServerDialect>),
4410 /// The Postgresql dialect
4411 PostgresqlDialect(std::boxed::Box<crate::model::PostgresqlDialect>),
4412 /// The Presto dialect
4413 PrestoDialect(std::boxed::Box<crate::model::PrestoDialect>),
4414 /// The MySQL dialect
4415 MysqlDialect(std::boxed::Box<crate::model::MySQLDialect>),
4416 /// DB2 dialect
4417 Db2Dialect(std::boxed::Box<crate::model::DB2Dialect>),
4418 /// SQLite dialect
4419 SqliteDialect(std::boxed::Box<crate::model::SQLiteDialect>),
4420 /// Greenplum dialect
4421 GreenplumDialect(std::boxed::Box<crate::model::GreenplumDialect>),
4422 }
4423}
4424
4425/// The dialect definition for BigQuery.
4426#[derive(Clone, Default, PartialEq)]
4427#[non_exhaustive]
4428pub struct BigQueryDialect {
4429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4430}
4431
4432impl BigQueryDialect {
4433 pub fn new() -> Self {
4434 std::default::Default::default()
4435 }
4436}
4437
4438impl wkt::message::Message for BigQueryDialect {
4439 fn typename() -> &'static str {
4440 "type.googleapis.com/google.cloud.bigquery.migration.v2.BigQueryDialect"
4441 }
4442}
4443
4444/// The dialect definition for HiveQL.
4445#[derive(Clone, Default, PartialEq)]
4446#[non_exhaustive]
4447pub struct HiveQLDialect {
4448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4449}
4450
4451impl HiveQLDialect {
4452 pub fn new() -> Self {
4453 std::default::Default::default()
4454 }
4455}
4456
4457impl wkt::message::Message for HiveQLDialect {
4458 fn typename() -> &'static str {
4459 "type.googleapis.com/google.cloud.bigquery.migration.v2.HiveQLDialect"
4460 }
4461}
4462
4463/// The dialect definition for Redshift.
4464#[derive(Clone, Default, PartialEq)]
4465#[non_exhaustive]
4466pub struct RedshiftDialect {
4467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4468}
4469
4470impl RedshiftDialect {
4471 pub fn new() -> Self {
4472 std::default::Default::default()
4473 }
4474}
4475
4476impl wkt::message::Message for RedshiftDialect {
4477 fn typename() -> &'static str {
4478 "type.googleapis.com/google.cloud.bigquery.migration.v2.RedshiftDialect"
4479 }
4480}
4481
4482/// The dialect definition for Teradata.
4483#[derive(Clone, Default, PartialEq)]
4484#[non_exhaustive]
4485pub struct TeradataDialect {
4486 /// Which Teradata sub-dialect mode the user specifies.
4487 pub mode: crate::model::teradata_dialect::Mode,
4488
4489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4490}
4491
4492impl TeradataDialect {
4493 pub fn new() -> Self {
4494 std::default::Default::default()
4495 }
4496
4497 /// Sets the value of [mode][crate::model::TeradataDialect::mode].
4498 ///
4499 /// # Example
4500 /// ```ignore,no_run
4501 /// # use google_cloud_bigquery_migration_v2::model::TeradataDialect;
4502 /// use google_cloud_bigquery_migration_v2::model::teradata_dialect::Mode;
4503 /// let x0 = TeradataDialect::new().set_mode(Mode::Sql);
4504 /// let x1 = TeradataDialect::new().set_mode(Mode::Bteq);
4505 /// ```
4506 pub fn set_mode<T: std::convert::Into<crate::model::teradata_dialect::Mode>>(
4507 mut self,
4508 v: T,
4509 ) -> Self {
4510 self.mode = v.into();
4511 self
4512 }
4513}
4514
4515impl wkt::message::Message for TeradataDialect {
4516 fn typename() -> &'static str {
4517 "type.googleapis.com/google.cloud.bigquery.migration.v2.TeradataDialect"
4518 }
4519}
4520
4521/// Defines additional types related to [TeradataDialect].
4522pub mod teradata_dialect {
4523 #[allow(unused_imports)]
4524 use super::*;
4525
4526 /// The sub-dialect options for Teradata.
4527 ///
4528 /// # Working with unknown values
4529 ///
4530 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4531 /// additional enum variants at any time. Adding new variants is not considered
4532 /// a breaking change. Applications should write their code in anticipation of:
4533 ///
4534 /// - New values appearing in future releases of the client library, **and**
4535 /// - New values received dynamically, without application changes.
4536 ///
4537 /// Please consult the [Working with enums] section in the user guide for some
4538 /// guidelines.
4539 ///
4540 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4541 #[derive(Clone, Debug, PartialEq)]
4542 #[non_exhaustive]
4543 pub enum Mode {
4544 /// Unspecified mode.
4545 Unspecified,
4546 /// Teradata SQL mode.
4547 Sql,
4548 /// BTEQ mode (which includes SQL).
4549 Bteq,
4550 /// If set, the enum was initialized with an unknown value.
4551 ///
4552 /// Applications can examine the value using [Mode::value] or
4553 /// [Mode::name].
4554 UnknownValue(mode::UnknownValue),
4555 }
4556
4557 #[doc(hidden)]
4558 pub mod mode {
4559 #[allow(unused_imports)]
4560 use super::*;
4561 #[derive(Clone, Debug, PartialEq)]
4562 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4563 }
4564
4565 impl Mode {
4566 /// Gets the enum value.
4567 ///
4568 /// Returns `None` if the enum contains an unknown value deserialized from
4569 /// the string representation of enums.
4570 pub fn value(&self) -> std::option::Option<i32> {
4571 match self {
4572 Self::Unspecified => std::option::Option::Some(0),
4573 Self::Sql => std::option::Option::Some(1),
4574 Self::Bteq => std::option::Option::Some(2),
4575 Self::UnknownValue(u) => u.0.value(),
4576 }
4577 }
4578
4579 /// Gets the enum value as a string.
4580 ///
4581 /// Returns `None` if the enum contains an unknown value deserialized from
4582 /// the integer representation of enums.
4583 pub fn name(&self) -> std::option::Option<&str> {
4584 match self {
4585 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
4586 Self::Sql => std::option::Option::Some("SQL"),
4587 Self::Bteq => std::option::Option::Some("BTEQ"),
4588 Self::UnknownValue(u) => u.0.name(),
4589 }
4590 }
4591 }
4592
4593 impl std::default::Default for Mode {
4594 fn default() -> Self {
4595 use std::convert::From;
4596 Self::from(0)
4597 }
4598 }
4599
4600 impl std::fmt::Display for Mode {
4601 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4602 wkt::internal::display_enum(f, self.name(), self.value())
4603 }
4604 }
4605
4606 impl std::convert::From<i32> for Mode {
4607 fn from(value: i32) -> Self {
4608 match value {
4609 0 => Self::Unspecified,
4610 1 => Self::Sql,
4611 2 => Self::Bteq,
4612 _ => Self::UnknownValue(mode::UnknownValue(
4613 wkt::internal::UnknownEnumValue::Integer(value),
4614 )),
4615 }
4616 }
4617 }
4618
4619 impl std::convert::From<&str> for Mode {
4620 fn from(value: &str) -> Self {
4621 use std::string::ToString;
4622 match value {
4623 "MODE_UNSPECIFIED" => Self::Unspecified,
4624 "SQL" => Self::Sql,
4625 "BTEQ" => Self::Bteq,
4626 _ => Self::UnknownValue(mode::UnknownValue(
4627 wkt::internal::UnknownEnumValue::String(value.to_string()),
4628 )),
4629 }
4630 }
4631 }
4632
4633 impl serde::ser::Serialize for Mode {
4634 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4635 where
4636 S: serde::Serializer,
4637 {
4638 match self {
4639 Self::Unspecified => serializer.serialize_i32(0),
4640 Self::Sql => serializer.serialize_i32(1),
4641 Self::Bteq => serializer.serialize_i32(2),
4642 Self::UnknownValue(u) => u.0.serialize(serializer),
4643 }
4644 }
4645 }
4646
4647 impl<'de> serde::de::Deserialize<'de> for Mode {
4648 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4649 where
4650 D: serde::Deserializer<'de>,
4651 {
4652 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
4653 ".google.cloud.bigquery.migration.v2.TeradataDialect.Mode",
4654 ))
4655 }
4656 }
4657}
4658
4659/// The dialect definition for Oracle.
4660#[derive(Clone, Default, PartialEq)]
4661#[non_exhaustive]
4662pub struct OracleDialect {
4663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4664}
4665
4666impl OracleDialect {
4667 pub fn new() -> Self {
4668 std::default::Default::default()
4669 }
4670}
4671
4672impl wkt::message::Message for OracleDialect {
4673 fn typename() -> &'static str {
4674 "type.googleapis.com/google.cloud.bigquery.migration.v2.OracleDialect"
4675 }
4676}
4677
4678/// The dialect definition for SparkSQL.
4679#[derive(Clone, Default, PartialEq)]
4680#[non_exhaustive]
4681pub struct SparkSQLDialect {
4682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4683}
4684
4685impl SparkSQLDialect {
4686 pub fn new() -> Self {
4687 std::default::Default::default()
4688 }
4689}
4690
4691impl wkt::message::Message for SparkSQLDialect {
4692 fn typename() -> &'static str {
4693 "type.googleapis.com/google.cloud.bigquery.migration.v2.SparkSQLDialect"
4694 }
4695}
4696
4697/// The dialect definition for Snowflake.
4698#[derive(Clone, Default, PartialEq)]
4699#[non_exhaustive]
4700pub struct SnowflakeDialect {
4701 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4702}
4703
4704impl SnowflakeDialect {
4705 pub fn new() -> Self {
4706 std::default::Default::default()
4707 }
4708}
4709
4710impl wkt::message::Message for SnowflakeDialect {
4711 fn typename() -> &'static str {
4712 "type.googleapis.com/google.cloud.bigquery.migration.v2.SnowflakeDialect"
4713 }
4714}
4715
4716/// The dialect definition for Netezza.
4717#[derive(Clone, Default, PartialEq)]
4718#[non_exhaustive]
4719pub struct NetezzaDialect {
4720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4721}
4722
4723impl NetezzaDialect {
4724 pub fn new() -> Self {
4725 std::default::Default::default()
4726 }
4727}
4728
4729impl wkt::message::Message for NetezzaDialect {
4730 fn typename() -> &'static str {
4731 "type.googleapis.com/google.cloud.bigquery.migration.v2.NetezzaDialect"
4732 }
4733}
4734
4735/// The dialect definition for Azure Synapse.
4736#[derive(Clone, Default, PartialEq)]
4737#[non_exhaustive]
4738pub struct AzureSynapseDialect {
4739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4740}
4741
4742impl AzureSynapseDialect {
4743 pub fn new() -> Self {
4744 std::default::Default::default()
4745 }
4746}
4747
4748impl wkt::message::Message for AzureSynapseDialect {
4749 fn typename() -> &'static str {
4750 "type.googleapis.com/google.cloud.bigquery.migration.v2.AzureSynapseDialect"
4751 }
4752}
4753
4754/// The dialect definition for Vertica.
4755#[derive(Clone, Default, PartialEq)]
4756#[non_exhaustive]
4757pub struct VerticaDialect {
4758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4759}
4760
4761impl VerticaDialect {
4762 pub fn new() -> Self {
4763 std::default::Default::default()
4764 }
4765}
4766
4767impl wkt::message::Message for VerticaDialect {
4768 fn typename() -> &'static str {
4769 "type.googleapis.com/google.cloud.bigquery.migration.v2.VerticaDialect"
4770 }
4771}
4772
4773/// The dialect definition for SQL Server.
4774#[derive(Clone, Default, PartialEq)]
4775#[non_exhaustive]
4776pub struct SQLServerDialect {
4777 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4778}
4779
4780impl SQLServerDialect {
4781 pub fn new() -> Self {
4782 std::default::Default::default()
4783 }
4784}
4785
4786impl wkt::message::Message for SQLServerDialect {
4787 fn typename() -> &'static str {
4788 "type.googleapis.com/google.cloud.bigquery.migration.v2.SQLServerDialect"
4789 }
4790}
4791
4792/// The dialect definition for Postgresql.
4793#[derive(Clone, Default, PartialEq)]
4794#[non_exhaustive]
4795pub struct PostgresqlDialect {
4796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4797}
4798
4799impl PostgresqlDialect {
4800 pub fn new() -> Self {
4801 std::default::Default::default()
4802 }
4803}
4804
4805impl wkt::message::Message for PostgresqlDialect {
4806 fn typename() -> &'static str {
4807 "type.googleapis.com/google.cloud.bigquery.migration.v2.PostgresqlDialect"
4808 }
4809}
4810
4811/// The dialect definition for Presto.
4812#[derive(Clone, Default, PartialEq)]
4813#[non_exhaustive]
4814pub struct PrestoDialect {
4815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4816}
4817
4818impl PrestoDialect {
4819 pub fn new() -> Self {
4820 std::default::Default::default()
4821 }
4822}
4823
4824impl wkt::message::Message for PrestoDialect {
4825 fn typename() -> &'static str {
4826 "type.googleapis.com/google.cloud.bigquery.migration.v2.PrestoDialect"
4827 }
4828}
4829
4830/// The dialect definition for MySQL.
4831#[derive(Clone, Default, PartialEq)]
4832#[non_exhaustive]
4833pub struct MySQLDialect {
4834 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4835}
4836
4837impl MySQLDialect {
4838 pub fn new() -> Self {
4839 std::default::Default::default()
4840 }
4841}
4842
4843impl wkt::message::Message for MySQLDialect {
4844 fn typename() -> &'static str {
4845 "type.googleapis.com/google.cloud.bigquery.migration.v2.MySQLDialect"
4846 }
4847}
4848
4849/// The dialect definition for DB2.
4850#[derive(Clone, Default, PartialEq)]
4851#[non_exhaustive]
4852pub struct DB2Dialect {
4853 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4854}
4855
4856impl DB2Dialect {
4857 pub fn new() -> Self {
4858 std::default::Default::default()
4859 }
4860}
4861
4862impl wkt::message::Message for DB2Dialect {
4863 fn typename() -> &'static str {
4864 "type.googleapis.com/google.cloud.bigquery.migration.v2.DB2Dialect"
4865 }
4866}
4867
4868/// The dialect definition for SQLite.
4869#[derive(Clone, Default, PartialEq)]
4870#[non_exhaustive]
4871pub struct SQLiteDialect {
4872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4873}
4874
4875impl SQLiteDialect {
4876 pub fn new() -> Self {
4877 std::default::Default::default()
4878 }
4879}
4880
4881impl wkt::message::Message for SQLiteDialect {
4882 fn typename() -> &'static str {
4883 "type.googleapis.com/google.cloud.bigquery.migration.v2.SQLiteDialect"
4884 }
4885}
4886
4887/// The dialect definition for Greenplum.
4888#[derive(Clone, Default, PartialEq)]
4889#[non_exhaustive]
4890pub struct GreenplumDialect {
4891 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4892}
4893
4894impl GreenplumDialect {
4895 pub fn new() -> Self {
4896 std::default::Default::default()
4897 }
4898}
4899
4900impl wkt::message::Message for GreenplumDialect {
4901 fn typename() -> &'static str {
4902 "type.googleapis.com/google.cloud.bigquery.migration.v2.GreenplumDialect"
4903 }
4904}
4905
4906/// Represents a map of name mappings using a list of key:value proto messages of
4907/// existing name to desired output name.
4908#[derive(Clone, Default, PartialEq)]
4909#[non_exhaustive]
4910pub struct ObjectNameMappingList {
4911 /// The elements of the object name map.
4912 pub name_map: std::vec::Vec<crate::model::ObjectNameMapping>,
4913
4914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4915}
4916
4917impl ObjectNameMappingList {
4918 pub fn new() -> Self {
4919 std::default::Default::default()
4920 }
4921
4922 /// Sets the value of [name_map][crate::model::ObjectNameMappingList::name_map].
4923 ///
4924 /// # Example
4925 /// ```ignore,no_run
4926 /// # use google_cloud_bigquery_migration_v2::model::ObjectNameMappingList;
4927 /// use google_cloud_bigquery_migration_v2::model::ObjectNameMapping;
4928 /// let x = ObjectNameMappingList::new()
4929 /// .set_name_map([
4930 /// ObjectNameMapping::default()/* use setters */,
4931 /// ObjectNameMapping::default()/* use (different) setters */,
4932 /// ]);
4933 /// ```
4934 pub fn set_name_map<T, V>(mut self, v: T) -> Self
4935 where
4936 T: std::iter::IntoIterator<Item = V>,
4937 V: std::convert::Into<crate::model::ObjectNameMapping>,
4938 {
4939 use std::iter::Iterator;
4940 self.name_map = v.into_iter().map(|i| i.into()).collect();
4941 self
4942 }
4943}
4944
4945impl wkt::message::Message for ObjectNameMappingList {
4946 fn typename() -> &'static str {
4947 "type.googleapis.com/google.cloud.bigquery.migration.v2.ObjectNameMappingList"
4948 }
4949}
4950
4951/// Represents a key-value pair of NameMappingKey to NameMappingValue to
4952/// represent the mapping of SQL names from the input value to desired output.
4953#[derive(Clone, Default, PartialEq)]
4954#[non_exhaustive]
4955pub struct ObjectNameMapping {
4956 /// The name of the object in source that is being mapped.
4957 pub source: std::option::Option<crate::model::NameMappingKey>,
4958
4959 /// The desired target name of the object that is being mapped.
4960 pub target: std::option::Option<crate::model::NameMappingValue>,
4961
4962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4963}
4964
4965impl ObjectNameMapping {
4966 pub fn new() -> Self {
4967 std::default::Default::default()
4968 }
4969
4970 /// Sets the value of [source][crate::model::ObjectNameMapping::source].
4971 ///
4972 /// # Example
4973 /// ```ignore,no_run
4974 /// # use google_cloud_bigquery_migration_v2::model::ObjectNameMapping;
4975 /// use google_cloud_bigquery_migration_v2::model::NameMappingKey;
4976 /// let x = ObjectNameMapping::new().set_source(NameMappingKey::default()/* use setters */);
4977 /// ```
4978 pub fn set_source<T>(mut self, v: T) -> Self
4979 where
4980 T: std::convert::Into<crate::model::NameMappingKey>,
4981 {
4982 self.source = std::option::Option::Some(v.into());
4983 self
4984 }
4985
4986 /// Sets or clears the value of [source][crate::model::ObjectNameMapping::source].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_bigquery_migration_v2::model::ObjectNameMapping;
4991 /// use google_cloud_bigquery_migration_v2::model::NameMappingKey;
4992 /// let x = ObjectNameMapping::new().set_or_clear_source(Some(NameMappingKey::default()/* use setters */));
4993 /// let x = ObjectNameMapping::new().set_or_clear_source(None::<NameMappingKey>);
4994 /// ```
4995 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
4996 where
4997 T: std::convert::Into<crate::model::NameMappingKey>,
4998 {
4999 self.source = v.map(|x| x.into());
5000 self
5001 }
5002
5003 /// Sets the value of [target][crate::model::ObjectNameMapping::target].
5004 ///
5005 /// # Example
5006 /// ```ignore,no_run
5007 /// # use google_cloud_bigquery_migration_v2::model::ObjectNameMapping;
5008 /// use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5009 /// let x = ObjectNameMapping::new().set_target(NameMappingValue::default()/* use setters */);
5010 /// ```
5011 pub fn set_target<T>(mut self, v: T) -> Self
5012 where
5013 T: std::convert::Into<crate::model::NameMappingValue>,
5014 {
5015 self.target = std::option::Option::Some(v.into());
5016 self
5017 }
5018
5019 /// Sets or clears the value of [target][crate::model::ObjectNameMapping::target].
5020 ///
5021 /// # Example
5022 /// ```ignore,no_run
5023 /// # use google_cloud_bigquery_migration_v2::model::ObjectNameMapping;
5024 /// use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5025 /// let x = ObjectNameMapping::new().set_or_clear_target(Some(NameMappingValue::default()/* use setters */));
5026 /// let x = ObjectNameMapping::new().set_or_clear_target(None::<NameMappingValue>);
5027 /// ```
5028 pub fn set_or_clear_target<T>(mut self, v: std::option::Option<T>) -> Self
5029 where
5030 T: std::convert::Into<crate::model::NameMappingValue>,
5031 {
5032 self.target = v.map(|x| x.into());
5033 self
5034 }
5035}
5036
5037impl wkt::message::Message for ObjectNameMapping {
5038 fn typename() -> &'static str {
5039 "type.googleapis.com/google.cloud.bigquery.migration.v2.ObjectNameMapping"
5040 }
5041}
5042
5043/// The potential components of a full name mapping that will be mapped
5044/// during translation in the source data warehouse.
5045#[derive(Clone, Default, PartialEq)]
5046#[non_exhaustive]
5047pub struct NameMappingKey {
5048 /// The type of object that is being mapped.
5049 pub r#type: crate::model::name_mapping_key::Type,
5050
5051 /// The database name (BigQuery project ID equivalent in the source data
5052 /// warehouse).
5053 pub database: std::string::String,
5054
5055 /// The schema name (BigQuery dataset equivalent in the source data warehouse).
5056 pub schema: std::string::String,
5057
5058 /// The relation name (BigQuery table or view equivalent in the source data
5059 /// warehouse).
5060 pub relation: std::string::String,
5061
5062 /// The attribute name (BigQuery column equivalent in the source data
5063 /// warehouse).
5064 pub attribute: std::string::String,
5065
5066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5067}
5068
5069impl NameMappingKey {
5070 pub fn new() -> Self {
5071 std::default::Default::default()
5072 }
5073
5074 /// Sets the value of [r#type][crate::model::NameMappingKey::type].
5075 ///
5076 /// # Example
5077 /// ```ignore,no_run
5078 /// # use google_cloud_bigquery_migration_v2::model::NameMappingKey;
5079 /// use google_cloud_bigquery_migration_v2::model::name_mapping_key::Type;
5080 /// let x0 = NameMappingKey::new().set_type(Type::Database);
5081 /// let x1 = NameMappingKey::new().set_type(Type::Schema);
5082 /// let x2 = NameMappingKey::new().set_type(Type::Relation);
5083 /// ```
5084 pub fn set_type<T: std::convert::Into<crate::model::name_mapping_key::Type>>(
5085 mut self,
5086 v: T,
5087 ) -> Self {
5088 self.r#type = v.into();
5089 self
5090 }
5091
5092 /// Sets the value of [database][crate::model::NameMappingKey::database].
5093 ///
5094 /// # Example
5095 /// ```ignore,no_run
5096 /// # use google_cloud_bigquery_migration_v2::model::NameMappingKey;
5097 /// let x = NameMappingKey::new().set_database("example");
5098 /// ```
5099 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5100 self.database = v.into();
5101 self
5102 }
5103
5104 /// Sets the value of [schema][crate::model::NameMappingKey::schema].
5105 ///
5106 /// # Example
5107 /// ```ignore,no_run
5108 /// # use google_cloud_bigquery_migration_v2::model::NameMappingKey;
5109 /// let x = NameMappingKey::new().set_schema("example");
5110 /// ```
5111 pub fn set_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5112 self.schema = v.into();
5113 self
5114 }
5115
5116 /// Sets the value of [relation][crate::model::NameMappingKey::relation].
5117 ///
5118 /// # Example
5119 /// ```ignore,no_run
5120 /// # use google_cloud_bigquery_migration_v2::model::NameMappingKey;
5121 /// let x = NameMappingKey::new().set_relation("example");
5122 /// ```
5123 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5124 self.relation = v.into();
5125 self
5126 }
5127
5128 /// Sets the value of [attribute][crate::model::NameMappingKey::attribute].
5129 ///
5130 /// # Example
5131 /// ```ignore,no_run
5132 /// # use google_cloud_bigquery_migration_v2::model::NameMappingKey;
5133 /// let x = NameMappingKey::new().set_attribute("example");
5134 /// ```
5135 pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5136 self.attribute = v.into();
5137 self
5138 }
5139}
5140
5141impl wkt::message::Message for NameMappingKey {
5142 fn typename() -> &'static str {
5143 "type.googleapis.com/google.cloud.bigquery.migration.v2.NameMappingKey"
5144 }
5145}
5146
5147/// Defines additional types related to [NameMappingKey].
5148pub mod name_mapping_key {
5149 #[allow(unused_imports)]
5150 use super::*;
5151
5152 /// The type of the object that is being mapped.
5153 ///
5154 /// # Working with unknown values
5155 ///
5156 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5157 /// additional enum variants at any time. Adding new variants is not considered
5158 /// a breaking change. Applications should write their code in anticipation of:
5159 ///
5160 /// - New values appearing in future releases of the client library, **and**
5161 /// - New values received dynamically, without application changes.
5162 ///
5163 /// Please consult the [Working with enums] section in the user guide for some
5164 /// guidelines.
5165 ///
5166 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5167 #[derive(Clone, Debug, PartialEq)]
5168 #[non_exhaustive]
5169 pub enum Type {
5170 /// Unspecified name mapping type.
5171 Unspecified,
5172 /// The object being mapped is a database.
5173 Database,
5174 /// The object being mapped is a schema.
5175 Schema,
5176 /// The object being mapped is a relation.
5177 Relation,
5178 /// The object being mapped is an attribute.
5179 Attribute,
5180 /// The object being mapped is a relation alias.
5181 RelationAlias,
5182 /// The object being mapped is a an attribute alias.
5183 AttributeAlias,
5184 /// The object being mapped is a function.
5185 Function,
5186 /// If set, the enum was initialized with an unknown value.
5187 ///
5188 /// Applications can examine the value using [Type::value] or
5189 /// [Type::name].
5190 UnknownValue(r#type::UnknownValue),
5191 }
5192
5193 #[doc(hidden)]
5194 pub mod r#type {
5195 #[allow(unused_imports)]
5196 use super::*;
5197 #[derive(Clone, Debug, PartialEq)]
5198 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5199 }
5200
5201 impl Type {
5202 /// Gets the enum value.
5203 ///
5204 /// Returns `None` if the enum contains an unknown value deserialized from
5205 /// the string representation of enums.
5206 pub fn value(&self) -> std::option::Option<i32> {
5207 match self {
5208 Self::Unspecified => std::option::Option::Some(0),
5209 Self::Database => std::option::Option::Some(1),
5210 Self::Schema => std::option::Option::Some(2),
5211 Self::Relation => std::option::Option::Some(3),
5212 Self::Attribute => std::option::Option::Some(4),
5213 Self::RelationAlias => std::option::Option::Some(5),
5214 Self::AttributeAlias => std::option::Option::Some(6),
5215 Self::Function => std::option::Option::Some(7),
5216 Self::UnknownValue(u) => u.0.value(),
5217 }
5218 }
5219
5220 /// Gets the enum value as a string.
5221 ///
5222 /// Returns `None` if the enum contains an unknown value deserialized from
5223 /// the integer representation of enums.
5224 pub fn name(&self) -> std::option::Option<&str> {
5225 match self {
5226 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
5227 Self::Database => std::option::Option::Some("DATABASE"),
5228 Self::Schema => std::option::Option::Some("SCHEMA"),
5229 Self::Relation => std::option::Option::Some("RELATION"),
5230 Self::Attribute => std::option::Option::Some("ATTRIBUTE"),
5231 Self::RelationAlias => std::option::Option::Some("RELATION_ALIAS"),
5232 Self::AttributeAlias => std::option::Option::Some("ATTRIBUTE_ALIAS"),
5233 Self::Function => std::option::Option::Some("FUNCTION"),
5234 Self::UnknownValue(u) => u.0.name(),
5235 }
5236 }
5237 }
5238
5239 impl std::default::Default for Type {
5240 fn default() -> Self {
5241 use std::convert::From;
5242 Self::from(0)
5243 }
5244 }
5245
5246 impl std::fmt::Display for Type {
5247 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5248 wkt::internal::display_enum(f, self.name(), self.value())
5249 }
5250 }
5251
5252 impl std::convert::From<i32> for Type {
5253 fn from(value: i32) -> Self {
5254 match value {
5255 0 => Self::Unspecified,
5256 1 => Self::Database,
5257 2 => Self::Schema,
5258 3 => Self::Relation,
5259 4 => Self::Attribute,
5260 5 => Self::RelationAlias,
5261 6 => Self::AttributeAlias,
5262 7 => Self::Function,
5263 _ => Self::UnknownValue(r#type::UnknownValue(
5264 wkt::internal::UnknownEnumValue::Integer(value),
5265 )),
5266 }
5267 }
5268 }
5269
5270 impl std::convert::From<&str> for Type {
5271 fn from(value: &str) -> Self {
5272 use std::string::ToString;
5273 match value {
5274 "TYPE_UNSPECIFIED" => Self::Unspecified,
5275 "DATABASE" => Self::Database,
5276 "SCHEMA" => Self::Schema,
5277 "RELATION" => Self::Relation,
5278 "ATTRIBUTE" => Self::Attribute,
5279 "RELATION_ALIAS" => Self::RelationAlias,
5280 "ATTRIBUTE_ALIAS" => Self::AttributeAlias,
5281 "FUNCTION" => Self::Function,
5282 _ => Self::UnknownValue(r#type::UnknownValue(
5283 wkt::internal::UnknownEnumValue::String(value.to_string()),
5284 )),
5285 }
5286 }
5287 }
5288
5289 impl serde::ser::Serialize for Type {
5290 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5291 where
5292 S: serde::Serializer,
5293 {
5294 match self {
5295 Self::Unspecified => serializer.serialize_i32(0),
5296 Self::Database => serializer.serialize_i32(1),
5297 Self::Schema => serializer.serialize_i32(2),
5298 Self::Relation => serializer.serialize_i32(3),
5299 Self::Attribute => serializer.serialize_i32(4),
5300 Self::RelationAlias => serializer.serialize_i32(5),
5301 Self::AttributeAlias => serializer.serialize_i32(6),
5302 Self::Function => serializer.serialize_i32(7),
5303 Self::UnknownValue(u) => u.0.serialize(serializer),
5304 }
5305 }
5306 }
5307
5308 impl<'de> serde::de::Deserialize<'de> for Type {
5309 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5310 where
5311 D: serde::Deserializer<'de>,
5312 {
5313 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
5314 ".google.cloud.bigquery.migration.v2.NameMappingKey.Type",
5315 ))
5316 }
5317 }
5318}
5319
5320/// The potential components of a full name mapping that will be mapped
5321/// during translation in the target data warehouse.
5322#[derive(Clone, Default, PartialEq)]
5323#[non_exhaustive]
5324pub struct NameMappingValue {
5325 /// The database name (BigQuery project ID equivalent in the target data
5326 /// warehouse).
5327 pub database: std::string::String,
5328
5329 /// The schema name (BigQuery dataset equivalent in the target data warehouse).
5330 pub schema: std::string::String,
5331
5332 /// The relation name (BigQuery table or view equivalent in the target data
5333 /// warehouse).
5334 pub relation: std::string::String,
5335
5336 /// The attribute name (BigQuery column equivalent in the target data
5337 /// warehouse).
5338 pub attribute: std::string::String,
5339
5340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5341}
5342
5343impl NameMappingValue {
5344 pub fn new() -> Self {
5345 std::default::Default::default()
5346 }
5347
5348 /// Sets the value of [database][crate::model::NameMappingValue::database].
5349 ///
5350 /// # Example
5351 /// ```ignore,no_run
5352 /// # use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5353 /// let x = NameMappingValue::new().set_database("example");
5354 /// ```
5355 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5356 self.database = v.into();
5357 self
5358 }
5359
5360 /// Sets the value of [schema][crate::model::NameMappingValue::schema].
5361 ///
5362 /// # Example
5363 /// ```ignore,no_run
5364 /// # use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5365 /// let x = NameMappingValue::new().set_schema("example");
5366 /// ```
5367 pub fn set_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5368 self.schema = v.into();
5369 self
5370 }
5371
5372 /// Sets the value of [relation][crate::model::NameMappingValue::relation].
5373 ///
5374 /// # Example
5375 /// ```ignore,no_run
5376 /// # use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5377 /// let x = NameMappingValue::new().set_relation("example");
5378 /// ```
5379 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5380 self.relation = v.into();
5381 self
5382 }
5383
5384 /// Sets the value of [attribute][crate::model::NameMappingValue::attribute].
5385 ///
5386 /// # Example
5387 /// ```ignore,no_run
5388 /// # use google_cloud_bigquery_migration_v2::model::NameMappingValue;
5389 /// let x = NameMappingValue::new().set_attribute("example");
5390 /// ```
5391 pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5392 self.attribute = v.into();
5393 self
5394 }
5395}
5396
5397impl wkt::message::Message for NameMappingValue {
5398 fn typename() -> &'static str {
5399 "type.googleapis.com/google.cloud.bigquery.migration.v2.NameMappingValue"
5400 }
5401}
5402
5403/// Represents the default source environment values for the translation.
5404#[derive(Clone, Default, PartialEq)]
5405#[non_exhaustive]
5406pub struct SourceEnv {
5407 /// The default database name to fully qualify SQL objects when their database
5408 /// name is missing.
5409 pub default_database: std::string::String,
5410
5411 /// The schema search path. When SQL objects are missing schema name,
5412 /// translation engine will search through this list to find the value.
5413 pub schema_search_path: std::vec::Vec<std::string::String>,
5414
5415 /// Optional. Expects a valid BigQuery dataset ID that exists, e.g.,
5416 /// project-123.metadata_store_123. If specified, translation will search and
5417 /// read the required schema information from a metadata store in this dataset.
5418 /// If metadata store doesn't exist, translation will parse the metadata file
5419 /// and upload the schema info to a temp table in the dataset to speed up
5420 /// future translation jobs.
5421 pub metadata_store_dataset: std::string::String,
5422
5423 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5424}
5425
5426impl SourceEnv {
5427 pub fn new() -> Self {
5428 std::default::Default::default()
5429 }
5430
5431 /// Sets the value of [default_database][crate::model::SourceEnv::default_database].
5432 ///
5433 /// # Example
5434 /// ```ignore,no_run
5435 /// # use google_cloud_bigquery_migration_v2::model::SourceEnv;
5436 /// let x = SourceEnv::new().set_default_database("example");
5437 /// ```
5438 pub fn set_default_database<T: std::convert::Into<std::string::String>>(
5439 mut self,
5440 v: T,
5441 ) -> Self {
5442 self.default_database = v.into();
5443 self
5444 }
5445
5446 /// Sets the value of [schema_search_path][crate::model::SourceEnv::schema_search_path].
5447 ///
5448 /// # Example
5449 /// ```ignore,no_run
5450 /// # use google_cloud_bigquery_migration_v2::model::SourceEnv;
5451 /// let x = SourceEnv::new().set_schema_search_path(["a", "b", "c"]);
5452 /// ```
5453 pub fn set_schema_search_path<T, V>(mut self, v: T) -> Self
5454 where
5455 T: std::iter::IntoIterator<Item = V>,
5456 V: std::convert::Into<std::string::String>,
5457 {
5458 use std::iter::Iterator;
5459 self.schema_search_path = v.into_iter().map(|i| i.into()).collect();
5460 self
5461 }
5462
5463 /// Sets the value of [metadata_store_dataset][crate::model::SourceEnv::metadata_store_dataset].
5464 ///
5465 /// # Example
5466 /// ```ignore,no_run
5467 /// # use google_cloud_bigquery_migration_v2::model::SourceEnv;
5468 /// let x = SourceEnv::new().set_metadata_store_dataset("example");
5469 /// ```
5470 pub fn set_metadata_store_dataset<T: std::convert::Into<std::string::String>>(
5471 mut self,
5472 v: T,
5473 ) -> Self {
5474 self.metadata_store_dataset = v.into();
5475 self
5476 }
5477}
5478
5479impl wkt::message::Message for SourceEnv {
5480 fn typename() -> &'static str {
5481 "type.googleapis.com/google.cloud.bigquery.migration.v2.SourceEnv"
5482 }
5483}
5484
5485/// The translation details to capture the necessary settings for a translation
5486/// job.
5487#[derive(Clone, Default, PartialEq)]
5488#[non_exhaustive]
5489pub struct TranslationDetails {
5490 /// The mapping from source to target SQL.
5491 pub source_target_mapping: std::vec::Vec<crate::model::SourceTargetMapping>,
5492
5493 /// The base URI for all writes to persistent storage.
5494 pub target_base_uri: std::string::String,
5495
5496 /// The default source environment values for the translation.
5497 pub source_environment: std::option::Option<crate::model::SourceEnvironment>,
5498
5499 /// The list of literal targets that will be directly returned to the response.
5500 /// Each entry consists of the constructed path, EXCLUDING the base path. Not
5501 /// providing a target_base_uri will prevent writing to persistent storage.
5502 pub target_return_literals: std::vec::Vec<std::string::String>,
5503
5504 /// The types of output to generate, e.g. sql, metadata,
5505 /// lineage_from_sql_scripts, etc. If not specified, a default set of
5506 /// targets will be generated. Some additional target types may be slower to
5507 /// generate. See the documentation for the set of available target types.
5508 pub target_types: std::vec::Vec<std::string::String>,
5509
5510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5511}
5512
5513impl TranslationDetails {
5514 pub fn new() -> Self {
5515 std::default::Default::default()
5516 }
5517
5518 /// Sets the value of [source_target_mapping][crate::model::TranslationDetails::source_target_mapping].
5519 ///
5520 /// # Example
5521 /// ```ignore,no_run
5522 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5523 /// use google_cloud_bigquery_migration_v2::model::SourceTargetMapping;
5524 /// let x = TranslationDetails::new()
5525 /// .set_source_target_mapping([
5526 /// SourceTargetMapping::default()/* use setters */,
5527 /// SourceTargetMapping::default()/* use (different) setters */,
5528 /// ]);
5529 /// ```
5530 pub fn set_source_target_mapping<T, V>(mut self, v: T) -> Self
5531 where
5532 T: std::iter::IntoIterator<Item = V>,
5533 V: std::convert::Into<crate::model::SourceTargetMapping>,
5534 {
5535 use std::iter::Iterator;
5536 self.source_target_mapping = v.into_iter().map(|i| i.into()).collect();
5537 self
5538 }
5539
5540 /// Sets the value of [target_base_uri][crate::model::TranslationDetails::target_base_uri].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5545 /// let x = TranslationDetails::new().set_target_base_uri("example");
5546 /// ```
5547 pub fn set_target_base_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5548 self.target_base_uri = v.into();
5549 self
5550 }
5551
5552 /// Sets the value of [source_environment][crate::model::TranslationDetails::source_environment].
5553 ///
5554 /// # Example
5555 /// ```ignore,no_run
5556 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5557 /// use google_cloud_bigquery_migration_v2::model::SourceEnvironment;
5558 /// let x = TranslationDetails::new().set_source_environment(SourceEnvironment::default()/* use setters */);
5559 /// ```
5560 pub fn set_source_environment<T>(mut self, v: T) -> Self
5561 where
5562 T: std::convert::Into<crate::model::SourceEnvironment>,
5563 {
5564 self.source_environment = std::option::Option::Some(v.into());
5565 self
5566 }
5567
5568 /// Sets or clears the value of [source_environment][crate::model::TranslationDetails::source_environment].
5569 ///
5570 /// # Example
5571 /// ```ignore,no_run
5572 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5573 /// use google_cloud_bigquery_migration_v2::model::SourceEnvironment;
5574 /// let x = TranslationDetails::new().set_or_clear_source_environment(Some(SourceEnvironment::default()/* use setters */));
5575 /// let x = TranslationDetails::new().set_or_clear_source_environment(None::<SourceEnvironment>);
5576 /// ```
5577 pub fn set_or_clear_source_environment<T>(mut self, v: std::option::Option<T>) -> Self
5578 where
5579 T: std::convert::Into<crate::model::SourceEnvironment>,
5580 {
5581 self.source_environment = v.map(|x| x.into());
5582 self
5583 }
5584
5585 /// Sets the value of [target_return_literals][crate::model::TranslationDetails::target_return_literals].
5586 ///
5587 /// # Example
5588 /// ```ignore,no_run
5589 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5590 /// let x = TranslationDetails::new().set_target_return_literals(["a", "b", "c"]);
5591 /// ```
5592 pub fn set_target_return_literals<T, V>(mut self, v: T) -> Self
5593 where
5594 T: std::iter::IntoIterator<Item = V>,
5595 V: std::convert::Into<std::string::String>,
5596 {
5597 use std::iter::Iterator;
5598 self.target_return_literals = v.into_iter().map(|i| i.into()).collect();
5599 self
5600 }
5601
5602 /// Sets the value of [target_types][crate::model::TranslationDetails::target_types].
5603 ///
5604 /// # Example
5605 /// ```ignore,no_run
5606 /// # use google_cloud_bigquery_migration_v2::model::TranslationDetails;
5607 /// let x = TranslationDetails::new().set_target_types(["a", "b", "c"]);
5608 /// ```
5609 pub fn set_target_types<T, V>(mut self, v: T) -> Self
5610 where
5611 T: std::iter::IntoIterator<Item = V>,
5612 V: std::convert::Into<std::string::String>,
5613 {
5614 use std::iter::Iterator;
5615 self.target_types = v.into_iter().map(|i| i.into()).collect();
5616 self
5617 }
5618}
5619
5620impl wkt::message::Message for TranslationDetails {
5621 fn typename() -> &'static str {
5622 "type.googleapis.com/google.cloud.bigquery.migration.v2.TranslationDetails"
5623 }
5624}
5625
5626/// Represents one mapping from a source SQL to a target SQL.
5627#[derive(Clone, Default, PartialEq)]
5628#[non_exhaustive]
5629pub struct SourceTargetMapping {
5630 /// The source SQL or the path to it.
5631 pub source_spec: std::option::Option<crate::model::SourceSpec>,
5632
5633 /// The target SQL or the path for it.
5634 pub target_spec: std::option::Option<crate::model::TargetSpec>,
5635
5636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5637}
5638
5639impl SourceTargetMapping {
5640 pub fn new() -> Self {
5641 std::default::Default::default()
5642 }
5643
5644 /// Sets the value of [source_spec][crate::model::SourceTargetMapping::source_spec].
5645 ///
5646 /// # Example
5647 /// ```ignore,no_run
5648 /// # use google_cloud_bigquery_migration_v2::model::SourceTargetMapping;
5649 /// use google_cloud_bigquery_migration_v2::model::SourceSpec;
5650 /// let x = SourceTargetMapping::new().set_source_spec(SourceSpec::default()/* use setters */);
5651 /// ```
5652 pub fn set_source_spec<T>(mut self, v: T) -> Self
5653 where
5654 T: std::convert::Into<crate::model::SourceSpec>,
5655 {
5656 self.source_spec = std::option::Option::Some(v.into());
5657 self
5658 }
5659
5660 /// Sets or clears the value of [source_spec][crate::model::SourceTargetMapping::source_spec].
5661 ///
5662 /// # Example
5663 /// ```ignore,no_run
5664 /// # use google_cloud_bigquery_migration_v2::model::SourceTargetMapping;
5665 /// use google_cloud_bigquery_migration_v2::model::SourceSpec;
5666 /// let x = SourceTargetMapping::new().set_or_clear_source_spec(Some(SourceSpec::default()/* use setters */));
5667 /// let x = SourceTargetMapping::new().set_or_clear_source_spec(None::<SourceSpec>);
5668 /// ```
5669 pub fn set_or_clear_source_spec<T>(mut self, v: std::option::Option<T>) -> Self
5670 where
5671 T: std::convert::Into<crate::model::SourceSpec>,
5672 {
5673 self.source_spec = v.map(|x| x.into());
5674 self
5675 }
5676
5677 /// Sets the value of [target_spec][crate::model::SourceTargetMapping::target_spec].
5678 ///
5679 /// # Example
5680 /// ```ignore,no_run
5681 /// # use google_cloud_bigquery_migration_v2::model::SourceTargetMapping;
5682 /// use google_cloud_bigquery_migration_v2::model::TargetSpec;
5683 /// let x = SourceTargetMapping::new().set_target_spec(TargetSpec::default()/* use setters */);
5684 /// ```
5685 pub fn set_target_spec<T>(mut self, v: T) -> Self
5686 where
5687 T: std::convert::Into<crate::model::TargetSpec>,
5688 {
5689 self.target_spec = std::option::Option::Some(v.into());
5690 self
5691 }
5692
5693 /// Sets or clears the value of [target_spec][crate::model::SourceTargetMapping::target_spec].
5694 ///
5695 /// # Example
5696 /// ```ignore,no_run
5697 /// # use google_cloud_bigquery_migration_v2::model::SourceTargetMapping;
5698 /// use google_cloud_bigquery_migration_v2::model::TargetSpec;
5699 /// let x = SourceTargetMapping::new().set_or_clear_target_spec(Some(TargetSpec::default()/* use setters */));
5700 /// let x = SourceTargetMapping::new().set_or_clear_target_spec(None::<TargetSpec>);
5701 /// ```
5702 pub fn set_or_clear_target_spec<T>(mut self, v: std::option::Option<T>) -> Self
5703 where
5704 T: std::convert::Into<crate::model::TargetSpec>,
5705 {
5706 self.target_spec = v.map(|x| x.into());
5707 self
5708 }
5709}
5710
5711impl wkt::message::Message for SourceTargetMapping {
5712 fn typename() -> &'static str {
5713 "type.googleapis.com/google.cloud.bigquery.migration.v2.SourceTargetMapping"
5714 }
5715}
5716
5717/// Represents one path to the location that holds source data.
5718#[derive(Clone, Default, PartialEq)]
5719#[non_exhaustive]
5720pub struct SourceSpec {
5721 /// Optional. The optional field to specify the encoding of the sql bytes.
5722 pub encoding: std::string::String,
5723
5724 /// The specific source SQL.
5725 pub source: std::option::Option<crate::model::source_spec::Source>,
5726
5727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5728}
5729
5730impl SourceSpec {
5731 pub fn new() -> Self {
5732 std::default::Default::default()
5733 }
5734
5735 /// Sets the value of [encoding][crate::model::SourceSpec::encoding].
5736 ///
5737 /// # Example
5738 /// ```ignore,no_run
5739 /// # use google_cloud_bigquery_migration_v2::model::SourceSpec;
5740 /// let x = SourceSpec::new().set_encoding("example");
5741 /// ```
5742 pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5743 self.encoding = v.into();
5744 self
5745 }
5746
5747 /// Sets the value of [source][crate::model::SourceSpec::source].
5748 ///
5749 /// Note that all the setters affecting `source` are mutually
5750 /// exclusive.
5751 ///
5752 /// # Example
5753 /// ```ignore,no_run
5754 /// # use google_cloud_bigquery_migration_v2::model::SourceSpec;
5755 /// use google_cloud_bigquery_migration_v2::model::source_spec::Source;
5756 /// let x = SourceSpec::new().set_source(Some(Source::BaseUri("example".to_string())));
5757 /// ```
5758 pub fn set_source<
5759 T: std::convert::Into<std::option::Option<crate::model::source_spec::Source>>,
5760 >(
5761 mut self,
5762 v: T,
5763 ) -> Self {
5764 self.source = v.into();
5765 self
5766 }
5767
5768 /// The value of [source][crate::model::SourceSpec::source]
5769 /// if it holds a `BaseUri`, `None` if the field is not set or
5770 /// holds a different branch.
5771 pub fn base_uri(&self) -> std::option::Option<&std::string::String> {
5772 #[allow(unreachable_patterns)]
5773 self.source.as_ref().and_then(|v| match v {
5774 crate::model::source_spec::Source::BaseUri(v) => std::option::Option::Some(v),
5775 _ => std::option::Option::None,
5776 })
5777 }
5778
5779 /// Sets the value of [source][crate::model::SourceSpec::source]
5780 /// to hold a `BaseUri`.
5781 ///
5782 /// Note that all the setters affecting `source` are
5783 /// mutually exclusive.
5784 ///
5785 /// # Example
5786 /// ```ignore,no_run
5787 /// # use google_cloud_bigquery_migration_v2::model::SourceSpec;
5788 /// let x = SourceSpec::new().set_base_uri("example");
5789 /// assert!(x.base_uri().is_some());
5790 /// assert!(x.literal().is_none());
5791 /// ```
5792 pub fn set_base_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5793 self.source =
5794 std::option::Option::Some(crate::model::source_spec::Source::BaseUri(v.into()));
5795 self
5796 }
5797
5798 /// The value of [source][crate::model::SourceSpec::source]
5799 /// if it holds a `Literal`, `None` if the field is not set or
5800 /// holds a different branch.
5801 pub fn literal(&self) -> std::option::Option<&std::boxed::Box<crate::model::Literal>> {
5802 #[allow(unreachable_patterns)]
5803 self.source.as_ref().and_then(|v| match v {
5804 crate::model::source_spec::Source::Literal(v) => std::option::Option::Some(v),
5805 _ => std::option::Option::None,
5806 })
5807 }
5808
5809 /// Sets the value of [source][crate::model::SourceSpec::source]
5810 /// to hold a `Literal`.
5811 ///
5812 /// Note that all the setters affecting `source` are
5813 /// mutually exclusive.
5814 ///
5815 /// # Example
5816 /// ```ignore,no_run
5817 /// # use google_cloud_bigquery_migration_v2::model::SourceSpec;
5818 /// use google_cloud_bigquery_migration_v2::model::Literal;
5819 /// let x = SourceSpec::new().set_literal(Literal::default()/* use setters */);
5820 /// assert!(x.literal().is_some());
5821 /// assert!(x.base_uri().is_none());
5822 /// ```
5823 pub fn set_literal<T: std::convert::Into<std::boxed::Box<crate::model::Literal>>>(
5824 mut self,
5825 v: T,
5826 ) -> Self {
5827 self.source =
5828 std::option::Option::Some(crate::model::source_spec::Source::Literal(v.into()));
5829 self
5830 }
5831}
5832
5833impl wkt::message::Message for SourceSpec {
5834 fn typename() -> &'static str {
5835 "type.googleapis.com/google.cloud.bigquery.migration.v2.SourceSpec"
5836 }
5837}
5838
5839/// Defines additional types related to [SourceSpec].
5840pub mod source_spec {
5841 #[allow(unused_imports)]
5842 use super::*;
5843
5844 /// The specific source SQL.
5845 #[derive(Clone, Debug, PartialEq)]
5846 #[non_exhaustive]
5847 pub enum Source {
5848 /// The base URI for all files to be read in as sources for translation.
5849 BaseUri(std::string::String),
5850 /// Source literal.
5851 Literal(std::boxed::Box<crate::model::Literal>),
5852 }
5853}
5854
5855/// Represents one path to the location that holds target data.
5856#[derive(Clone, Default, PartialEq)]
5857#[non_exhaustive]
5858pub struct TargetSpec {
5859 /// The relative path for the target data. Given source file
5860 /// `base_uri/input/sql`, the output would be
5861 /// `target_base_uri/sql/relative_path/input.sql`.
5862 pub relative_path: std::string::String,
5863
5864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5865}
5866
5867impl TargetSpec {
5868 pub fn new() -> Self {
5869 std::default::Default::default()
5870 }
5871
5872 /// Sets the value of [relative_path][crate::model::TargetSpec::relative_path].
5873 ///
5874 /// # Example
5875 /// ```ignore,no_run
5876 /// # use google_cloud_bigquery_migration_v2::model::TargetSpec;
5877 /// let x = TargetSpec::new().set_relative_path("example");
5878 /// ```
5879 pub fn set_relative_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5880 self.relative_path = v.into();
5881 self
5882 }
5883}
5884
5885impl wkt::message::Message for TargetSpec {
5886 fn typename() -> &'static str {
5887 "type.googleapis.com/google.cloud.bigquery.migration.v2.TargetSpec"
5888 }
5889}
5890
5891/// Literal data.
5892#[derive(Clone, Default, PartialEq)]
5893#[non_exhaustive]
5894pub struct Literal {
5895 /// Required. The identifier of the literal entry.
5896 pub relative_path: std::string::String,
5897
5898 /// The literal SQL contents.
5899 pub literal_data: std::option::Option<crate::model::literal::LiteralData>,
5900
5901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5902}
5903
5904impl Literal {
5905 pub fn new() -> Self {
5906 std::default::Default::default()
5907 }
5908
5909 /// Sets the value of [relative_path][crate::model::Literal::relative_path].
5910 ///
5911 /// # Example
5912 /// ```ignore,no_run
5913 /// # use google_cloud_bigquery_migration_v2::model::Literal;
5914 /// let x = Literal::new().set_relative_path("example");
5915 /// ```
5916 pub fn set_relative_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5917 self.relative_path = v.into();
5918 self
5919 }
5920
5921 /// Sets the value of [literal_data][crate::model::Literal::literal_data].
5922 ///
5923 /// Note that all the setters affecting `literal_data` are mutually
5924 /// exclusive.
5925 ///
5926 /// # Example
5927 /// ```ignore,no_run
5928 /// # use google_cloud_bigquery_migration_v2::model::Literal;
5929 /// use google_cloud_bigquery_migration_v2::model::literal::LiteralData;
5930 /// let x = Literal::new().set_literal_data(Some(LiteralData::LiteralString("example".to_string())));
5931 /// ```
5932 pub fn set_literal_data<
5933 T: std::convert::Into<std::option::Option<crate::model::literal::LiteralData>>,
5934 >(
5935 mut self,
5936 v: T,
5937 ) -> Self {
5938 self.literal_data = v.into();
5939 self
5940 }
5941
5942 /// The value of [literal_data][crate::model::Literal::literal_data]
5943 /// if it holds a `LiteralString`, `None` if the field is not set or
5944 /// holds a different branch.
5945 pub fn literal_string(&self) -> std::option::Option<&std::string::String> {
5946 #[allow(unreachable_patterns)]
5947 self.literal_data.as_ref().and_then(|v| match v {
5948 crate::model::literal::LiteralData::LiteralString(v) => std::option::Option::Some(v),
5949 _ => std::option::Option::None,
5950 })
5951 }
5952
5953 /// Sets the value of [literal_data][crate::model::Literal::literal_data]
5954 /// to hold a `LiteralString`.
5955 ///
5956 /// Note that all the setters affecting `literal_data` are
5957 /// mutually exclusive.
5958 ///
5959 /// # Example
5960 /// ```ignore,no_run
5961 /// # use google_cloud_bigquery_migration_v2::model::Literal;
5962 /// let x = Literal::new().set_literal_string("example");
5963 /// assert!(x.literal_string().is_some());
5964 /// assert!(x.literal_bytes().is_none());
5965 /// ```
5966 pub fn set_literal_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5967 self.literal_data =
5968 std::option::Option::Some(crate::model::literal::LiteralData::LiteralString(v.into()));
5969 self
5970 }
5971
5972 /// The value of [literal_data][crate::model::Literal::literal_data]
5973 /// if it holds a `LiteralBytes`, `None` if the field is not set or
5974 /// holds a different branch.
5975 pub fn literal_bytes(&self) -> std::option::Option<&::bytes::Bytes> {
5976 #[allow(unreachable_patterns)]
5977 self.literal_data.as_ref().and_then(|v| match v {
5978 crate::model::literal::LiteralData::LiteralBytes(v) => std::option::Option::Some(v),
5979 _ => std::option::Option::None,
5980 })
5981 }
5982
5983 /// Sets the value of [literal_data][crate::model::Literal::literal_data]
5984 /// to hold a `LiteralBytes`.
5985 ///
5986 /// Note that all the setters affecting `literal_data` are
5987 /// mutually exclusive.
5988 ///
5989 /// # Example
5990 /// ```ignore,no_run
5991 /// # use google_cloud_bigquery_migration_v2::model::Literal;
5992 /// let x = Literal::new().set_literal_bytes(bytes::Bytes::from_static(b"example"));
5993 /// assert!(x.literal_bytes().is_some());
5994 /// assert!(x.literal_string().is_none());
5995 /// ```
5996 pub fn set_literal_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5997 self.literal_data =
5998 std::option::Option::Some(crate::model::literal::LiteralData::LiteralBytes(v.into()));
5999 self
6000 }
6001}
6002
6003impl wkt::message::Message for Literal {
6004 fn typename() -> &'static str {
6005 "type.googleapis.com/google.cloud.bigquery.migration.v2.Literal"
6006 }
6007}
6008
6009/// Defines additional types related to [Literal].
6010pub mod literal {
6011 #[allow(unused_imports)]
6012 use super::*;
6013
6014 /// The literal SQL contents.
6015 #[derive(Clone, Debug, PartialEq)]
6016 #[non_exhaustive]
6017 pub enum LiteralData {
6018 /// Literal string data.
6019 LiteralString(std::string::String),
6020 /// Literal byte data.
6021 LiteralBytes(::bytes::Bytes),
6022 }
6023}
6024
6025/// Represents the default source environment values for the translation.
6026#[derive(Clone, Default, PartialEq)]
6027#[non_exhaustive]
6028pub struct SourceEnvironment {
6029 /// The default database name to fully qualify SQL objects when their database
6030 /// name is missing.
6031 pub default_database: std::string::String,
6032
6033 /// The schema search path. When SQL objects are missing schema name,
6034 /// translation engine will search through this list to find the value.
6035 pub schema_search_path: std::vec::Vec<std::string::String>,
6036
6037 /// Optional. Expects a validQ BigQuery dataset ID that exists, e.g.,
6038 /// project-123.metadata_store_123. If specified, translation will search and
6039 /// read the required schema information from a metadata store in this dataset.
6040 /// If metadata store doesn't exist, translation will parse the metadata file
6041 /// and upload the schema info to a temp table in the dataset to speed up
6042 /// future translation jobs.
6043 pub metadata_store_dataset: std::string::String,
6044
6045 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6046}
6047
6048impl SourceEnvironment {
6049 pub fn new() -> Self {
6050 std::default::Default::default()
6051 }
6052
6053 /// Sets the value of [default_database][crate::model::SourceEnvironment::default_database].
6054 ///
6055 /// # Example
6056 /// ```ignore,no_run
6057 /// # use google_cloud_bigquery_migration_v2::model::SourceEnvironment;
6058 /// let x = SourceEnvironment::new().set_default_database("example");
6059 /// ```
6060 pub fn set_default_database<T: std::convert::Into<std::string::String>>(
6061 mut self,
6062 v: T,
6063 ) -> Self {
6064 self.default_database = v.into();
6065 self
6066 }
6067
6068 /// Sets the value of [schema_search_path][crate::model::SourceEnvironment::schema_search_path].
6069 ///
6070 /// # Example
6071 /// ```ignore,no_run
6072 /// # use google_cloud_bigquery_migration_v2::model::SourceEnvironment;
6073 /// let x = SourceEnvironment::new().set_schema_search_path(["a", "b", "c"]);
6074 /// ```
6075 pub fn set_schema_search_path<T, V>(mut self, v: T) -> Self
6076 where
6077 T: std::iter::IntoIterator<Item = V>,
6078 V: std::convert::Into<std::string::String>,
6079 {
6080 use std::iter::Iterator;
6081 self.schema_search_path = v.into_iter().map(|i| i.into()).collect();
6082 self
6083 }
6084
6085 /// Sets the value of [metadata_store_dataset][crate::model::SourceEnvironment::metadata_store_dataset].
6086 ///
6087 /// # Example
6088 /// ```ignore,no_run
6089 /// # use google_cloud_bigquery_migration_v2::model::SourceEnvironment;
6090 /// let x = SourceEnvironment::new().set_metadata_store_dataset("example");
6091 /// ```
6092 pub fn set_metadata_store_dataset<T: std::convert::Into<std::string::String>>(
6093 mut self,
6094 v: T,
6095 ) -> Self {
6096 self.metadata_store_dataset = v.into();
6097 self
6098 }
6099}
6100
6101impl wkt::message::Message for SourceEnvironment {
6102 fn typename() -> &'static str {
6103 "type.googleapis.com/google.cloud.bigquery.migration.v2.SourceEnvironment"
6104 }
6105}
6106
6107/// Details about a record.
6108#[derive(Clone, Default, PartialEq)]
6109#[non_exhaustive]
6110pub struct TranslationReportRecord {
6111 /// Severity of the translation record.
6112 pub severity: crate::model::translation_report_record::Severity,
6113
6114 /// Specifies the row from the source text where the error occurred (0 based).
6115 /// Example: 2
6116 pub script_line: i32,
6117
6118 /// Specifies the column from the source texts where the error occurred. (0
6119 /// based) example: 6
6120 pub script_column: i32,
6121
6122 /// Category of the error/warning. Example: SyntaxError
6123 pub category: std::string::String,
6124
6125 /// Detailed message of the record.
6126 pub message: std::string::String,
6127
6128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6129}
6130
6131impl TranslationReportRecord {
6132 pub fn new() -> Self {
6133 std::default::Default::default()
6134 }
6135
6136 /// Sets the value of [severity][crate::model::TranslationReportRecord::severity].
6137 ///
6138 /// # Example
6139 /// ```ignore,no_run
6140 /// # use google_cloud_bigquery_migration_v2::model::TranslationReportRecord;
6141 /// use google_cloud_bigquery_migration_v2::model::translation_report_record::Severity;
6142 /// let x0 = TranslationReportRecord::new().set_severity(Severity::Info);
6143 /// let x1 = TranslationReportRecord::new().set_severity(Severity::Warning);
6144 /// let x2 = TranslationReportRecord::new().set_severity(Severity::Error);
6145 /// ```
6146 pub fn set_severity<
6147 T: std::convert::Into<crate::model::translation_report_record::Severity>,
6148 >(
6149 mut self,
6150 v: T,
6151 ) -> Self {
6152 self.severity = v.into();
6153 self
6154 }
6155
6156 /// Sets the value of [script_line][crate::model::TranslationReportRecord::script_line].
6157 ///
6158 /// # Example
6159 /// ```ignore,no_run
6160 /// # use google_cloud_bigquery_migration_v2::model::TranslationReportRecord;
6161 /// let x = TranslationReportRecord::new().set_script_line(42);
6162 /// ```
6163 pub fn set_script_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6164 self.script_line = v.into();
6165 self
6166 }
6167
6168 /// Sets the value of [script_column][crate::model::TranslationReportRecord::script_column].
6169 ///
6170 /// # Example
6171 /// ```ignore,no_run
6172 /// # use google_cloud_bigquery_migration_v2::model::TranslationReportRecord;
6173 /// let x = TranslationReportRecord::new().set_script_column(42);
6174 /// ```
6175 pub fn set_script_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6176 self.script_column = v.into();
6177 self
6178 }
6179
6180 /// Sets the value of [category][crate::model::TranslationReportRecord::category].
6181 ///
6182 /// # Example
6183 /// ```ignore,no_run
6184 /// # use google_cloud_bigquery_migration_v2::model::TranslationReportRecord;
6185 /// let x = TranslationReportRecord::new().set_category("example");
6186 /// ```
6187 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6188 self.category = v.into();
6189 self
6190 }
6191
6192 /// Sets the value of [message][crate::model::TranslationReportRecord::message].
6193 ///
6194 /// # Example
6195 /// ```ignore,no_run
6196 /// # use google_cloud_bigquery_migration_v2::model::TranslationReportRecord;
6197 /// let x = TranslationReportRecord::new().set_message("example");
6198 /// ```
6199 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6200 self.message = v.into();
6201 self
6202 }
6203}
6204
6205impl wkt::message::Message for TranslationReportRecord {
6206 fn typename() -> &'static str {
6207 "type.googleapis.com/google.cloud.bigquery.migration.v2.TranslationReportRecord"
6208 }
6209}
6210
6211/// Defines additional types related to [TranslationReportRecord].
6212pub mod translation_report_record {
6213 #[allow(unused_imports)]
6214 use super::*;
6215
6216 /// The severity type of the record.
6217 ///
6218 /// # Working with unknown values
6219 ///
6220 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6221 /// additional enum variants at any time. Adding new variants is not considered
6222 /// a breaking change. Applications should write their code in anticipation of:
6223 ///
6224 /// - New values appearing in future releases of the client library, **and**
6225 /// - New values received dynamically, without application changes.
6226 ///
6227 /// Please consult the [Working with enums] section in the user guide for some
6228 /// guidelines.
6229 ///
6230 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6231 #[derive(Clone, Debug, PartialEq)]
6232 #[non_exhaustive]
6233 pub enum Severity {
6234 /// SeverityType not specified.
6235 Unspecified,
6236 /// INFO type.
6237 Info,
6238 /// WARNING type. The translated query may still provide useful information
6239 /// if all the report records are WARNING.
6240 Warning,
6241 /// ERROR type. Translation failed.
6242 Error,
6243 /// If set, the enum was initialized with an unknown value.
6244 ///
6245 /// Applications can examine the value using [Severity::value] or
6246 /// [Severity::name].
6247 UnknownValue(severity::UnknownValue),
6248 }
6249
6250 #[doc(hidden)]
6251 pub mod severity {
6252 #[allow(unused_imports)]
6253 use super::*;
6254 #[derive(Clone, Debug, PartialEq)]
6255 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6256 }
6257
6258 impl Severity {
6259 /// Gets the enum value.
6260 ///
6261 /// Returns `None` if the enum contains an unknown value deserialized from
6262 /// the string representation of enums.
6263 pub fn value(&self) -> std::option::Option<i32> {
6264 match self {
6265 Self::Unspecified => std::option::Option::Some(0),
6266 Self::Info => std::option::Option::Some(1),
6267 Self::Warning => std::option::Option::Some(2),
6268 Self::Error => std::option::Option::Some(3),
6269 Self::UnknownValue(u) => u.0.value(),
6270 }
6271 }
6272
6273 /// Gets the enum value as a string.
6274 ///
6275 /// Returns `None` if the enum contains an unknown value deserialized from
6276 /// the integer representation of enums.
6277 pub fn name(&self) -> std::option::Option<&str> {
6278 match self {
6279 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
6280 Self::Info => std::option::Option::Some("INFO"),
6281 Self::Warning => std::option::Option::Some("WARNING"),
6282 Self::Error => std::option::Option::Some("ERROR"),
6283 Self::UnknownValue(u) => u.0.name(),
6284 }
6285 }
6286 }
6287
6288 impl std::default::Default for Severity {
6289 fn default() -> Self {
6290 use std::convert::From;
6291 Self::from(0)
6292 }
6293 }
6294
6295 impl std::fmt::Display for Severity {
6296 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6297 wkt::internal::display_enum(f, self.name(), self.value())
6298 }
6299 }
6300
6301 impl std::convert::From<i32> for Severity {
6302 fn from(value: i32) -> Self {
6303 match value {
6304 0 => Self::Unspecified,
6305 1 => Self::Info,
6306 2 => Self::Warning,
6307 3 => Self::Error,
6308 _ => Self::UnknownValue(severity::UnknownValue(
6309 wkt::internal::UnknownEnumValue::Integer(value),
6310 )),
6311 }
6312 }
6313 }
6314
6315 impl std::convert::From<&str> for Severity {
6316 fn from(value: &str) -> Self {
6317 use std::string::ToString;
6318 match value {
6319 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
6320 "INFO" => Self::Info,
6321 "WARNING" => Self::Warning,
6322 "ERROR" => Self::Error,
6323 _ => Self::UnknownValue(severity::UnknownValue(
6324 wkt::internal::UnknownEnumValue::String(value.to_string()),
6325 )),
6326 }
6327 }
6328 }
6329
6330 impl serde::ser::Serialize for Severity {
6331 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6332 where
6333 S: serde::Serializer,
6334 {
6335 match self {
6336 Self::Unspecified => serializer.serialize_i32(0),
6337 Self::Info => serializer.serialize_i32(1),
6338 Self::Warning => serializer.serialize_i32(2),
6339 Self::Error => serializer.serialize_i32(3),
6340 Self::UnknownValue(u) => u.0.serialize(serializer),
6341 }
6342 }
6343 }
6344
6345 impl<'de> serde::de::Deserialize<'de> for Severity {
6346 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6347 where
6348 D: serde::Deserializer<'de>,
6349 {
6350 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
6351 ".google.cloud.bigquery.migration.v2.TranslationReportRecord.Severity",
6352 ))
6353 }
6354 }
6355}
6356
6357/// A record in the aggregate CSV report for a migration workflow
6358#[derive(Clone, Default, PartialEq)]
6359#[non_exhaustive]
6360pub struct GcsReportLogMessage {
6361 /// Severity of the translation record.
6362 pub severity: std::string::String,
6363
6364 /// Category of the error/warning. Example: SyntaxError
6365 pub category: std::string::String,
6366
6367 /// The file path in which the error occurred
6368 pub file_path: std::string::String,
6369
6370 /// The file name in which the error occurred
6371 pub filename: std::string::String,
6372
6373 /// Specifies the row from the source text where the error occurred (0 based,
6374 /// -1 for messages without line location). Example: 2
6375 pub source_script_line: i32,
6376
6377 /// Specifies the column from the source texts where the error occurred. (0
6378 /// based, -1 for messages without column location) example: 6
6379 pub source_script_column: i32,
6380
6381 /// Detailed message of the record.
6382 pub message: std::string::String,
6383
6384 /// The script context (obfuscated) in which the error occurred
6385 pub script_context: std::string::String,
6386
6387 /// Category of the error/warning. Example: SyntaxError
6388 pub action: std::string::String,
6389
6390 /// Effect of the error/warning. Example: COMPATIBILITY
6391 pub effect: std::string::String,
6392
6393 /// Name of the affected object in the log message.
6394 pub object_name: std::string::String,
6395
6396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6397}
6398
6399impl GcsReportLogMessage {
6400 pub fn new() -> Self {
6401 std::default::Default::default()
6402 }
6403
6404 /// Sets the value of [severity][crate::model::GcsReportLogMessage::severity].
6405 ///
6406 /// # Example
6407 /// ```ignore,no_run
6408 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6409 /// let x = GcsReportLogMessage::new().set_severity("example");
6410 /// ```
6411 pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6412 self.severity = v.into();
6413 self
6414 }
6415
6416 /// Sets the value of [category][crate::model::GcsReportLogMessage::category].
6417 ///
6418 /// # Example
6419 /// ```ignore,no_run
6420 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6421 /// let x = GcsReportLogMessage::new().set_category("example");
6422 /// ```
6423 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6424 self.category = v.into();
6425 self
6426 }
6427
6428 /// Sets the value of [file_path][crate::model::GcsReportLogMessage::file_path].
6429 ///
6430 /// # Example
6431 /// ```ignore,no_run
6432 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6433 /// let x = GcsReportLogMessage::new().set_file_path("example");
6434 /// ```
6435 pub fn set_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6436 self.file_path = v.into();
6437 self
6438 }
6439
6440 /// Sets the value of [filename][crate::model::GcsReportLogMessage::filename].
6441 ///
6442 /// # Example
6443 /// ```ignore,no_run
6444 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6445 /// let x = GcsReportLogMessage::new().set_filename("example");
6446 /// ```
6447 pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6448 self.filename = v.into();
6449 self
6450 }
6451
6452 /// Sets the value of [source_script_line][crate::model::GcsReportLogMessage::source_script_line].
6453 ///
6454 /// # Example
6455 /// ```ignore,no_run
6456 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6457 /// let x = GcsReportLogMessage::new().set_source_script_line(42);
6458 /// ```
6459 pub fn set_source_script_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6460 self.source_script_line = v.into();
6461 self
6462 }
6463
6464 /// Sets the value of [source_script_column][crate::model::GcsReportLogMessage::source_script_column].
6465 ///
6466 /// # Example
6467 /// ```ignore,no_run
6468 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6469 /// let x = GcsReportLogMessage::new().set_source_script_column(42);
6470 /// ```
6471 pub fn set_source_script_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6472 self.source_script_column = v.into();
6473 self
6474 }
6475
6476 /// Sets the value of [message][crate::model::GcsReportLogMessage::message].
6477 ///
6478 /// # Example
6479 /// ```ignore,no_run
6480 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6481 /// let x = GcsReportLogMessage::new().set_message("example");
6482 /// ```
6483 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6484 self.message = v.into();
6485 self
6486 }
6487
6488 /// Sets the value of [script_context][crate::model::GcsReportLogMessage::script_context].
6489 ///
6490 /// # Example
6491 /// ```ignore,no_run
6492 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6493 /// let x = GcsReportLogMessage::new().set_script_context("example");
6494 /// ```
6495 pub fn set_script_context<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6496 self.script_context = v.into();
6497 self
6498 }
6499
6500 /// Sets the value of [action][crate::model::GcsReportLogMessage::action].
6501 ///
6502 /// # Example
6503 /// ```ignore,no_run
6504 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6505 /// let x = GcsReportLogMessage::new().set_action("example");
6506 /// ```
6507 pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6508 self.action = v.into();
6509 self
6510 }
6511
6512 /// Sets the value of [effect][crate::model::GcsReportLogMessage::effect].
6513 ///
6514 /// # Example
6515 /// ```ignore,no_run
6516 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6517 /// let x = GcsReportLogMessage::new().set_effect("example");
6518 /// ```
6519 pub fn set_effect<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6520 self.effect = v.into();
6521 self
6522 }
6523
6524 /// Sets the value of [object_name][crate::model::GcsReportLogMessage::object_name].
6525 ///
6526 /// # Example
6527 /// ```ignore,no_run
6528 /// # use google_cloud_bigquery_migration_v2::model::GcsReportLogMessage;
6529 /// let x = GcsReportLogMessage::new().set_object_name("example");
6530 /// ```
6531 pub fn set_object_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6532 self.object_name = v.into();
6533 self
6534 }
6535}
6536
6537impl wkt::message::Message for GcsReportLogMessage {
6538 fn typename() -> &'static str {
6539 "type.googleapis.com/google.cloud.bigquery.migration.v2.GcsReportLogMessage"
6540 }
6541}