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