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