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