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