// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_lro;
extern crate google_cloud_type;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate thiserror;
extern crate tokio;
extern crate tracing;
extern crate uuid;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
/// Arrow schema as specified
/// in <https://arrow.apache.org/docs/python/api/datatypes.html> and serialized to
/// bytes using IPC:
/// <https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc>
///
/// See code samples on how this message can be deserialized.
///
/// This feature is not yet available.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArrowSchema {
/// IPC serialized Arrow schema.
pub serialized_schema: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArrowSchema {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [serialized_schema][crate::model::ArrowSchema::serialized_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ArrowSchema;
/// let x = ArrowSchema::new().set_serialized_schema(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_serialized_schema<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.serialized_schema = v.into();
self
}
}
impl wkt::message::Message for ArrowSchema {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ArrowSchema"
}
}
/// Arrow RecordBatch.
///
/// This feature is not yet available.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArrowRecordBatch {
/// IPC-serialized Arrow RecordBatch.
pub serialized_record_batch: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArrowRecordBatch {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [serialized_record_batch][crate::model::ArrowRecordBatch::serialized_record_batch].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ArrowRecordBatch;
/// let x = ArrowRecordBatch::new().set_serialized_record_batch(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_serialized_record_batch<T: std::convert::Into<::bytes::Bytes>>(
mut self,
v: T,
) -> Self {
self.serialized_record_batch = v.into();
self
}
}
impl wkt::message::Message for ArrowRecordBatch {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ArrowRecordBatch"
}
}
/// Contains options specific to Arrow Serialization.
///
/// This feature is not yet available.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArrowSerializationOptions {
/// The compression codec to use for Arrow buffers in serialized record
/// batches.
pub buffer_compression: crate::model::arrow_serialization_options::CompressionCodec,
/// Optional. Set timestamp precision option. If not set, the default precision
/// is microseconds.
pub picos_timestamp_precision:
crate::model::arrow_serialization_options::PicosTimestampPrecision,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArrowSerializationOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [buffer_compression][crate::model::ArrowSerializationOptions::buffer_compression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ArrowSerializationOptions;
/// use google_cloud_bigquery_v2::model::arrow_serialization_options::CompressionCodec;
/// let x0 = ArrowSerializationOptions::new().set_buffer_compression(CompressionCodec::Lz4Frame);
/// let x1 = ArrowSerializationOptions::new().set_buffer_compression(CompressionCodec::Zstd);
/// ```
pub fn set_buffer_compression<
T: std::convert::Into<crate::model::arrow_serialization_options::CompressionCodec>,
>(
mut self,
v: T,
) -> Self {
self.buffer_compression = v.into();
self
}
/// Sets the value of [picos_timestamp_precision][crate::model::ArrowSerializationOptions::picos_timestamp_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ArrowSerializationOptions;
/// use google_cloud_bigquery_v2::model::arrow_serialization_options::PicosTimestampPrecision;
/// let x0 = ArrowSerializationOptions::new().set_picos_timestamp_precision(PicosTimestampPrecision::TimestampPrecisionMicros);
/// let x1 = ArrowSerializationOptions::new().set_picos_timestamp_precision(PicosTimestampPrecision::TimestampPrecisionNanos);
/// let x2 = ArrowSerializationOptions::new().set_picos_timestamp_precision(PicosTimestampPrecision::TimestampPrecisionPicos);
/// ```
pub fn set_picos_timestamp_precision<
T: std::convert::Into<crate::model::arrow_serialization_options::PicosTimestampPrecision>,
>(
mut self,
v: T,
) -> Self {
self.picos_timestamp_precision = v.into();
self
}
}
impl wkt::message::Message for ArrowSerializationOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ArrowSerializationOptions"
}
}
/// Defines additional types related to [ArrowSerializationOptions].
pub mod arrow_serialization_options {
#[allow(unused_imports)]
use super::*;
/// Compression codec's supported by Arrow.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CompressionCodec {
/// If unspecified no compression will be used.
CompressionUnspecified,
/// LZ4 Frame (<https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md>)
Lz4Frame,
/// Zstandard compression.
Zstd,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [CompressionCodec::value] or
/// [CompressionCodec::name].
UnknownValue(compression_codec::UnknownValue),
}
#[doc(hidden)]
pub mod compression_codec {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl CompressionCodec {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::CompressionUnspecified => std::option::Option::Some(0),
Self::Lz4Frame => std::option::Option::Some(1),
Self::Zstd => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::CompressionUnspecified => {
std::option::Option::Some("COMPRESSION_UNSPECIFIED")
}
Self::Lz4Frame => std::option::Option::Some("LZ4_FRAME"),
Self::Zstd => std::option::Option::Some("ZSTD"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for CompressionCodec {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for CompressionCodec {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for CompressionCodec {
fn from(value: i32) -> Self {
match value {
0 => Self::CompressionUnspecified,
1 => Self::Lz4Frame,
2 => Self::Zstd,
_ => Self::UnknownValue(compression_codec::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for CompressionCodec {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"COMPRESSION_UNSPECIFIED" => Self::CompressionUnspecified,
"LZ4_FRAME" => Self::Lz4Frame,
"ZSTD" => Self::Zstd,
_ => Self::UnknownValue(compression_codec::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for CompressionCodec {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::CompressionUnspecified => serializer.serialize_i32(0),
Self::Lz4Frame => serializer.serialize_i32(1),
Self::Zstd => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for CompressionCodec {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionCodec>::new(
".google.cloud.bigquery.v2.ArrowSerializationOptions.CompressionCodec",
))
}
}
/// The precision of the timestamp value in the Avro message. This precision
/// will **only** be applied to the column(s) with the `TIMESTAMP_PICOS` type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PicosTimestampPrecision {
/// Unspecified timestamp precision. The default precision is microseconds.
Unspecified,
/// Timestamp values returned in the results will be truncated to microsecond
/// level precision. The value will be encoded as Arrow TIMESTAMP type in a
/// 64 bit integer.
TimestampPrecisionMicros,
/// Timestamp values returned in the results will be truncated to nanosecond
/// level precision. The value will be encoded as Arrow TIMESTAMP type in a
/// 64 bit integer.
TimestampPrecisionNanos,
/// Timestamp values returned in the results will contain full precision
/// picosecond value. The value will be encoded as a string which conforms to
/// ISO 8601 format.
TimestampPrecisionPicos,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [PicosTimestampPrecision::value] or
/// [PicosTimestampPrecision::name].
UnknownValue(picos_timestamp_precision::UnknownValue),
}
#[doc(hidden)]
pub mod picos_timestamp_precision {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PicosTimestampPrecision {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::TimestampPrecisionMicros => std::option::Option::Some(1),
Self::TimestampPrecisionNanos => std::option::Option::Some(2),
Self::TimestampPrecisionPicos => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("PICOS_TIMESTAMP_PRECISION_UNSPECIFIED")
}
Self::TimestampPrecisionMicros => {
std::option::Option::Some("TIMESTAMP_PRECISION_MICROS")
}
Self::TimestampPrecisionNanos => {
std::option::Option::Some("TIMESTAMP_PRECISION_NANOS")
}
Self::TimestampPrecisionPicos => {
std::option::Option::Some("TIMESTAMP_PRECISION_PICOS")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PicosTimestampPrecision {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PicosTimestampPrecision {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PicosTimestampPrecision {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::TimestampPrecisionMicros,
2 => Self::TimestampPrecisionNanos,
3 => Self::TimestampPrecisionPicos,
_ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PicosTimestampPrecision {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PICOS_TIMESTAMP_PRECISION_UNSPECIFIED" => Self::Unspecified,
"TIMESTAMP_PRECISION_MICROS" => Self::TimestampPrecisionMicros,
"TIMESTAMP_PRECISION_NANOS" => Self::TimestampPrecisionNanos,
"TIMESTAMP_PRECISION_PICOS" => Self::TimestampPrecisionPicos,
_ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PicosTimestampPrecision {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::TimestampPrecisionMicros => serializer.serialize_i32(1),
Self::TimestampPrecisionNanos => serializer.serialize_i32(2),
Self::TimestampPrecisionPicos => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PicosTimestampPrecision {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<PicosTimestampPrecision>::new(
".google.cloud.bigquery.v2.ArrowSerializationOptions.PicosTimestampPrecision",
),
)
}
}
}
/// Configuration for BigQuery tables for Apache Iceberg (formerly BigLake
/// managed tables.)
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigLakeConfiguration {
/// Optional. The connection specifying the credentials to be used to read and
/// write to external storage, such as Cloud Storage. The connection_id can
/// have the form `{project}.{location}.{connection_id}` or
/// `projects/{project}/locations/{location}/connections/{connection_id}".
pub connection_id: std::string::String,
/// Optional. The fully qualified location prefix of the external folder where
/// table data is stored. The '*' wildcard character is not allowed. The URI
/// should be in the format `gs://bucket/path_to_table/`
pub storage_uri: std::string::String,
/// Optional. The file format the table data is stored in.
pub file_format: crate::model::big_lake_configuration::FileFormat,
/// Optional. The table format the metadata only snapshots are stored in.
pub table_format: crate::model::big_lake_configuration::TableFormat,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigLakeConfiguration {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [connection_id][crate::model::BigLakeConfiguration::connection_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// let x = BigLakeConfiguration::new().set_connection_id("example");
/// ```
pub fn set_connection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection_id = v.into();
self
}
/// Sets the value of [storage_uri][crate::model::BigLakeConfiguration::storage_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// let x = BigLakeConfiguration::new().set_storage_uri("example");
/// ```
pub fn set_storage_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.storage_uri = v.into();
self
}
/// Sets the value of [file_format][crate::model::BigLakeConfiguration::file_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// use google_cloud_bigquery_v2::model::big_lake_configuration::FileFormat;
/// let x0 = BigLakeConfiguration::new().set_file_format(FileFormat::Parquet);
/// ```
pub fn set_file_format<
T: std::convert::Into<crate::model::big_lake_configuration::FileFormat>,
>(
mut self,
v: T,
) -> Self {
self.file_format = v.into();
self
}
/// Sets the value of [table_format][crate::model::BigLakeConfiguration::table_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// use google_cloud_bigquery_v2::model::big_lake_configuration::TableFormat;
/// let x0 = BigLakeConfiguration::new().set_table_format(TableFormat::Iceberg);
/// ```
pub fn set_table_format<
T: std::convert::Into<crate::model::big_lake_configuration::TableFormat>,
>(
mut self,
v: T,
) -> Self {
self.table_format = v.into();
self
}
}
impl wkt::message::Message for BigLakeConfiguration {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BigLakeConfiguration"
}
}
/// Defines additional types related to [BigLakeConfiguration].
pub mod big_lake_configuration {
#[allow(unused_imports)]
use super::*;
/// Supported file formats for BigQuery tables for Apache Iceberg.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FileFormat {
/// Default Value.
Unspecified,
/// Apache Parquet format.
Parquet,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [FileFormat::value] or
/// [FileFormat::name].
UnknownValue(file_format::UnknownValue),
}
#[doc(hidden)]
pub mod file_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FileFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Parquet => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("FILE_FORMAT_UNSPECIFIED"),
Self::Parquet => std::option::Option::Some("PARQUET"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FileFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FileFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FileFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Parquet,
_ => Self::UnknownValue(file_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FileFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FILE_FORMAT_UNSPECIFIED" => Self::Unspecified,
"PARQUET" => Self::Parquet,
_ => Self::UnknownValue(file_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FileFormat {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Parquet => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FileFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FileFormat>::new(
".google.cloud.bigquery.v2.BigLakeConfiguration.FileFormat",
))
}
}
/// Supported table formats for BigQuery tables for Apache Iceberg.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TableFormat {
/// Default Value.
Unspecified,
/// Apache Iceberg format.
Iceberg,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TableFormat::value] or
/// [TableFormat::name].
UnknownValue(table_format::UnknownValue),
}
#[doc(hidden)]
pub mod table_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TableFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Iceberg => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TABLE_FORMAT_UNSPECIFIED"),
Self::Iceberg => std::option::Option::Some("ICEBERG"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TableFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TableFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TableFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Iceberg,
_ => Self::UnknownValue(table_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TableFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TABLE_FORMAT_UNSPECIFIED" => Self::Unspecified,
"ICEBERG" => Self::Iceberg,
_ => Self::UnknownValue(table_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TableFormat {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Iceberg => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TableFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TableFormat>::new(
".google.cloud.bigquery.v2.BigLakeConfiguration.TableFormat",
))
}
}
}
/// Configures table clustering.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Clustering {
/// One or more fields on which data should be clustered. Only top-level,
/// non-repeated, simple-type fields are supported. The ordering of the
/// clustering fields should be prioritized from most to least important
/// for filtering purposes.
///
/// For additional information, see
/// [Introduction to clustered
/// tables](https://cloud.google.com/bigquery/docs/clustered-tables#limitations).
pub fields: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Clustering {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [fields][crate::model::Clustering::fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Clustering;
/// let x = Clustering::new().set_fields(["a", "b", "c"]);
/// ```
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Clustering {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Clustering"
}
}
/// Options for data format adjustments.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataFormatOptions {
/// Optional. Output timestamp as usec int64. Default is false.
pub use_int64_timestamp: bool,
/// Optional. The API output format for a timestamp.
/// This offers more explicit control over the timestamp output format
/// as compared to the existing `use_int64_timestamp` option.
pub timestamp_output_format: crate::model::data_format_options::TimestampOutputFormat,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataFormatOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [use_int64_timestamp][crate::model::DataFormatOptions::use_int64_timestamp].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataFormatOptions;
/// let x = DataFormatOptions::new().set_use_int64_timestamp(true);
/// ```
pub fn set_use_int64_timestamp<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.use_int64_timestamp = v.into();
self
}
/// Sets the value of [timestamp_output_format][crate::model::DataFormatOptions::timestamp_output_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataFormatOptions;
/// use google_cloud_bigquery_v2::model::data_format_options::TimestampOutputFormat;
/// let x0 = DataFormatOptions::new().set_timestamp_output_format(TimestampOutputFormat::Float64);
/// let x1 = DataFormatOptions::new().set_timestamp_output_format(TimestampOutputFormat::Int64);
/// let x2 = DataFormatOptions::new().set_timestamp_output_format(TimestampOutputFormat::Iso8601String);
/// ```
pub fn set_timestamp_output_format<
T: std::convert::Into<crate::model::data_format_options::TimestampOutputFormat>,
>(
mut self,
v: T,
) -> Self {
self.timestamp_output_format = v.into();
self
}
}
impl wkt::message::Message for DataFormatOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DataFormatOptions"
}
}
/// Defines additional types related to [DataFormatOptions].
pub mod data_format_options {
#[allow(unused_imports)]
use super::*;
/// The API output format for a timestamp.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TimestampOutputFormat {
/// Corresponds to default API output behavior, which is FLOAT64.
Unspecified,
/// Timestamp is output as float64 seconds since Unix epoch.
Float64,
/// Timestamp is output as int64 microseconds since Unix epoch.
Int64,
/// Timestamp is output as ISO 8601 String
/// ("YYYY-MM-DDTHH:MM:SS.FFFFFFFFFFFFZ").
Iso8601String,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TimestampOutputFormat::value] or
/// [TimestampOutputFormat::name].
UnknownValue(timestamp_output_format::UnknownValue),
}
#[doc(hidden)]
pub mod timestamp_output_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TimestampOutputFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Float64 => std::option::Option::Some(1),
Self::Int64 => std::option::Option::Some(2),
Self::Iso8601String => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("TIMESTAMP_OUTPUT_FORMAT_UNSPECIFIED")
}
Self::Float64 => std::option::Option::Some("FLOAT64"),
Self::Int64 => std::option::Option::Some("INT64"),
Self::Iso8601String => std::option::Option::Some("ISO8601_STRING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TimestampOutputFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TimestampOutputFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TimestampOutputFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Float64,
2 => Self::Int64,
3 => Self::Iso8601String,
_ => Self::UnknownValue(timestamp_output_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TimestampOutputFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TIMESTAMP_OUTPUT_FORMAT_UNSPECIFIED" => Self::Unspecified,
"FLOAT64" => Self::Float64,
"INT64" => Self::Int64,
"ISO8601_STRING" => Self::Iso8601String,
_ => Self::UnknownValue(timestamp_output_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TimestampOutputFormat {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Float64 => serializer.serialize_i32(1),
Self::Int64 => serializer.serialize_i32(2),
Self::Iso8601String => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TimestampOutputFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimestampOutputFormat>::new(
".google.cloud.bigquery.v2.DataFormatOptions.TimestampOutputFormat",
))
}
}
}
/// Grants all resources of particular types in a particular dataset read access
/// to the current dataset.
///
/// Similar to how individually authorized views work, updates to any resource
/// granted through its dataset (including creation of new resources) requires
/// read permission to referenced resources, plus write permission to the
/// authorizing dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DatasetAccessEntry {
/// The dataset this entry applies to
pub dataset: std::option::Option<crate::model::DatasetReference>,
/// Which resources in the dataset this entry applies to. Currently, only
/// views are supported, but additional target types may be added in the
/// future.
pub target_types: std::vec::Vec<crate::model::dataset_access_entry::TargetType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DatasetAccessEntry {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dataset][crate::model::DatasetAccessEntry::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetAccessEntry;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = DatasetAccessEntry::new().set_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::DatasetAccessEntry::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetAccessEntry;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = DatasetAccessEntry::new().set_or_clear_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = DatasetAccessEntry::new().set_or_clear_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset = v.map(|x| x.into());
self
}
/// Sets the value of [target_types][crate::model::DatasetAccessEntry::target_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetAccessEntry;
/// use google_cloud_bigquery_v2::model::dataset_access_entry::TargetType;
/// let x = DatasetAccessEntry::new().set_target_types([
/// TargetType::Views,
/// TargetType::Routines,
/// ]);
/// ```
pub fn set_target_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::dataset_access_entry::TargetType>,
{
use std::iter::Iterator;
self.target_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DatasetAccessEntry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DatasetAccessEntry"
}
}
/// Defines additional types related to [DatasetAccessEntry].
pub mod dataset_access_entry {
#[allow(unused_imports)]
use super::*;
/// Indicates the type of resources in a dataset that the entry applies to.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TargetType {
/// Do not use. You must set a target type explicitly.
Unspecified,
/// This entry applies to views in the dataset.
Views,
/// This entry applies to routines in the dataset.
Routines,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TargetType::value] or
/// [TargetType::name].
UnknownValue(target_type::UnknownValue),
}
#[doc(hidden)]
pub mod target_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TargetType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Views => std::option::Option::Some(1),
Self::Routines => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TARGET_TYPE_UNSPECIFIED"),
Self::Views => std::option::Option::Some("VIEWS"),
Self::Routines => std::option::Option::Some("ROUTINES"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TargetType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TargetType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TargetType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Views,
2 => Self::Routines,
_ => Self::UnknownValue(target_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TargetType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TARGET_TYPE_UNSPECIFIED" => Self::Unspecified,
"VIEWS" => Self::Views,
"ROUTINES" => Self::Routines,
_ => Self::UnknownValue(target_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TargetType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Views => serializer.serialize_i32(1),
Self::Routines => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TargetType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TargetType>::new(
".google.cloud.bigquery.v2.DatasetAccessEntry.TargetType",
))
}
}
}
/// An object that defines dataset access for an entity.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Access {
/// An IAM role ID that should be granted to the user, group,
/// or domain specified in this access entry.
/// The following legacy mappings will be applied:
///
/// * `OWNER`: `roles/bigquery.dataOwner`
/// * `WRITER`: `roles/bigquery.dataEditor`
/// * `READER`: `roles/bigquery.dataViewer`
///
/// This field will accept any of the above formats, but will return only
/// the legacy format. For example, if you set this field to
/// "roles/bigquery.dataOwner", it will be returned back as "OWNER".
pub role: std::string::String,
/// [Pick one] An email address of a user to grant access to. For example:
/// fred@example.com. Maps to IAM policy member "user:EMAIL" or
/// "serviceAccount:EMAIL".
pub user_by_email: std::string::String,
/// [Pick one] An email address of a Google Group to grant access to.
/// Maps to IAM policy member "group:GROUP".
pub group_by_email: std::string::String,
/// [Pick one] A domain to grant access to. Any users signed in with the domain
/// specified will be granted the specified access. Example: "example.com".
/// Maps to IAM policy member "domain:DOMAIN".
pub domain: std::string::String,
/// [Pick one] A special group to grant access to. Possible values include:
///
/// * projectOwners: Owners of the enclosing project.
/// * projectReaders: Readers of the enclosing project.
/// * projectWriters: Writers of the enclosing project.
/// * allAuthenticatedUsers: All authenticated BigQuery users.
///
/// Maps to similarly-named IAM members.
pub special_group: std::string::String,
/// [Pick one] Some other type of member that appears in the IAM Policy but
/// isn't a user, group, domain, or special group.
pub iam_member: std::string::String,
/// [Pick one] A view from a different dataset to grant access to. Queries
/// executed against that view will have read access to views/tables/routines
/// in this dataset.
/// The role field is not required when this field is set. If that view is
/// updated by any user, access to the view needs to be granted again via an
/// update operation.
pub view: std::option::Option<crate::model::TableReference>,
/// [Pick one] A routine from a different dataset to grant access to. Queries
/// executed against that routine will have read access to
/// views/tables/routines in this dataset. Only UDF is supported for now.
/// The role field is not required when this field is set. If that routine is
/// updated by any user, access to the routine needs to be granted again via
/// an update operation.
pub routine: std::option::Option<crate::model::RoutineReference>,
/// [Pick one] A grant authorizing all resources of a particular type in a
/// particular dataset access to this dataset. Only views are supported for
/// now. The role field is not required when this field is set. If that dataset
/// is deleted and re-created, its access needs to be granted again via an
/// update operation.
pub dataset: std::option::Option<crate::model::DatasetAccessEntry>,
/// Optional. condition for the binding. If CEL expression in this field is
/// true, this access binding will be considered
pub condition: std::option::Option<google_cloud_type::model::Expr>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Access {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [role][crate::model::Access::role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_role("example");
/// ```
pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.role = v.into();
self
}
/// Sets the value of [user_by_email][crate::model::Access::user_by_email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_user_by_email("example");
/// ```
pub fn set_user_by_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_by_email = v.into();
self
}
/// Sets the value of [group_by_email][crate::model::Access::group_by_email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_group_by_email("example");
/// ```
pub fn set_group_by_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.group_by_email = v.into();
self
}
/// Sets the value of [domain][crate::model::Access::domain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_domain("example");
/// ```
pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.domain = v.into();
self
}
/// Sets the value of [special_group][crate::model::Access::special_group].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_special_group("example");
/// ```
pub fn set_special_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.special_group = v.into();
self
}
/// Sets the value of [iam_member][crate::model::Access::iam_member].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// let x = Access::new().set_iam_member("example");
/// ```
pub fn set_iam_member<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.iam_member = v.into();
self
}
/// Sets the value of [view][crate::model::Access::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = Access::new().set_view(TableReference::default()/* use setters */);
/// ```
pub fn set_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [view][crate::model::Access::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = Access::new().set_or_clear_view(Some(TableReference::default()/* use setters */));
/// let x = Access::new().set_or_clear_view(None::<TableReference>);
/// ```
pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.view = v.map(|x| x.into());
self
}
/// Sets the value of [routine][crate::model::Access::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = Access::new().set_routine(RoutineReference::default()/* use setters */);
/// ```
pub fn set_routine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.routine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [routine][crate::model::Access::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = Access::new().set_or_clear_routine(Some(RoutineReference::default()/* use setters */));
/// let x = Access::new().set_or_clear_routine(None::<RoutineReference>);
/// ```
pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.routine = v.map(|x| x.into());
self
}
/// Sets the value of [dataset][crate::model::Access::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::DatasetAccessEntry;
/// let x = Access::new().set_dataset(DatasetAccessEntry::default()/* use setters */);
/// ```
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetAccessEntry>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::Access::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_bigquery_v2::model::DatasetAccessEntry;
/// let x = Access::new().set_or_clear_dataset(Some(DatasetAccessEntry::default()/* use setters */));
/// let x = Access::new().set_or_clear_dataset(None::<DatasetAccessEntry>);
/// ```
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetAccessEntry>,
{
self.dataset = v.map(|x| x.into());
self
}
/// Sets the value of [condition][crate::model::Access::condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_type::model::Expr;
/// let x = Access::new().set_condition(Expr::default()/* use setters */);
/// ```
pub fn set_condition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_type::model::Expr>,
{
self.condition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [condition][crate::model::Access::condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Access;
/// use google_cloud_type::model::Expr;
/// let x = Access::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
/// let x = Access::new().set_or_clear_condition(None::<Expr>);
/// ```
pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_type::model::Expr>,
{
self.condition = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Access {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Access"
}
}
/// Represents a BigQuery dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Dataset {
/// Output only. The resource type.
pub kind: std::string::String,
/// Output only. A hash of the resource.
pub etag: std::string::String,
/// Output only. The fully-qualified unique name of the dataset in the format
/// projectId:datasetId. The dataset name without the project name is given in
/// the datasetId field. When creating a new dataset, leave this field blank,
/// and instead specify the datasetId field.
pub id: std::string::String,
/// Output only. A URL that can be used to access the resource again. You can
/// use this URL in Get or Update requests to the resource.
pub self_link: std::string::String,
/// Required. A reference that identifies the dataset.
pub dataset_reference: std::option::Option<crate::model::DatasetReference>,
/// Optional. A descriptive name for the dataset.
pub friendly_name: std::option::Option<wkt::StringValue>,
/// Optional. A user-friendly description of the dataset.
pub description: std::option::Option<wkt::StringValue>,
/// Optional. The default lifetime of all tables in the dataset, in
/// milliseconds. The minimum lifetime value is 3600000 milliseconds (one
/// hour). To clear an existing default expiration with a PATCH request, set to
/// 0. Once this property is set, all newly-created tables in the dataset will
/// have an expirationTime property set to the creation time plus the value in
/// this property, and changing the value will only affect new tables, not
/// existing ones. When the expirationTime for a given table is reached, that
/// table will be deleted automatically.
/// If a table's expirationTime is modified or removed before the table
/// expires, or if you provide an explicit expirationTime when creating a
/// table, that value takes precedence over the default expiration time
/// indicated by this property.
pub default_table_expiration_ms: std::option::Option<wkt::Int64Value>,
/// This default partition expiration, expressed in milliseconds.
///
/// When new time-partitioned tables are created in a dataset where this
/// property is set, the table will inherit this value, propagated as the
/// `TimePartitioning.expirationMs` property on the new table. If you set
/// `TimePartitioning.expirationMs` explicitly when creating a table,
/// the `defaultPartitionExpirationMs` of the containing dataset is ignored.
///
/// When creating a partitioned table, if `defaultPartitionExpirationMs`
/// is set, the `defaultTableExpirationMs` value is ignored and the table
/// will not be inherit a table expiration deadline.
pub default_partition_expiration_ms: std::option::Option<wkt::Int64Value>,
/// The labels associated with this dataset. You can use these
/// to organize and group your datasets.
/// You can set this property when inserting or updating a dataset.
/// See [Creating and Updating Dataset
/// Labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#creating_and_updating_dataset_labels)
/// for more information.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. An array of objects that define dataset access for one or more
/// entities. You can set this property when inserting or updating a dataset in
/// order to control who is allowed to access the data. If unspecified at
/// dataset creation time, BigQuery adds default dataset access for the
/// following entities: access.specialGroup: projectReaders; access.role:
/// READER; access.specialGroup: projectWriters; access.role: WRITER;
/// access.specialGroup: projectOwners; access.role: OWNER;
/// access.userByEmail: [dataset creator email]; access.role: OWNER;
/// If you patch a dataset, then this field is overwritten by the patched
/// dataset's access field. To add entities, you must supply the entire
/// existing access array in addition to any new entities that you want to add.
pub access: std::vec::Vec<crate::model::Access>,
/// Output only. The time when this dataset was created, in milliseconds since
/// the epoch.
pub creation_time: i64,
/// Output only. The date when this dataset was last modified, in milliseconds
/// since the epoch.
pub last_modified_time: i64,
/// The geographic location where the dataset should reside. See
/// <https://cloud.google.com/bigquery/docs/locations> for supported
/// locations.
pub location: std::string::String,
/// The default encryption key for all tables in the dataset.
/// After this property is set, the encryption key of all newly-created tables
/// in the dataset is set to this value unless the table creation request or
/// query explicitly overrides the key.
pub default_encryption_configuration:
std::option::Option<crate::model::EncryptionConfiguration>,
/// Output only. Reserved for future use.
pub satisfies_pzs: std::option::Option<wkt::BoolValue>,
/// Output only. Reserved for future use.
pub satisfies_pzi: std::option::Option<wkt::BoolValue>,
/// Output only. Same as `type` in `ListFormatDataset`.
/// The type of the dataset, one of:
///
/// * DEFAULT - only accessible by owner and authorized accounts,
/// * PUBLIC - accessible by everyone,
/// * LINKED - linked dataset,
/// * EXTERNAL - dataset with definition in external metadata catalog,
/// * BIGLAKE_ICEBERG - a Biglake dataset accessible through the Iceberg API,
/// * BIGLAKE_HIVE - a Biglake dataset accessible through the Hive API.
pub r#type: std::string::String,
/// Output only. The origin of the dataset, one of:
///
/// * (Unset) - Native BigQuery Dataset
/// * BIGLAKE - Dataset is backed by a namespace stored natively in Biglake
pub catalog_source: std::option::Option<std::string::String>,
/// Optional. The source dataset reference when the dataset is of type LINKED.
/// For all other dataset types it is not set. This field cannot be updated
/// once it is set. Any attempt to update this field using Update and Patch API
/// Operations will be ignored.
pub linked_dataset_source: std::option::Option<crate::model::LinkedDatasetSource>,
/// Output only. Metadata about the LinkedDataset. Filled out when the dataset
/// type is LINKED.
pub linked_dataset_metadata: std::option::Option<crate::model::LinkedDatasetMetadata>,
/// Optional. Reference to a read-only external dataset defined in data
/// catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL.
pub external_dataset_reference: std::option::Option<crate::model::ExternalDatasetReference>,
/// Optional. Options defining open source compatible datasets living in the
/// BigQuery catalog. Contains metadata of open source database, schema or
/// namespace represented by the current dataset.
pub external_catalog_dataset_options:
std::option::Option<crate::model::ExternalCatalogDatasetOptions>,
/// Optional. TRUE if the dataset and its table names are case-insensitive,
/// otherwise FALSE. By default, this is FALSE, which means the dataset and its
/// table names are case-sensitive. This field does not affect routine
/// references.
pub is_case_insensitive: std::option::Option<wkt::BoolValue>,
/// Optional. Defines the default collation specification of future tables
/// created in the dataset. If a table is created in this dataset without
/// table-level default collation, then the table inherits the dataset default
/// collation, which is applied to the string fields that do not have explicit
/// collation specified. A change to this field affects only tables created
/// afterwards, and does not alter the existing tables.
/// The following values are supported:
///
/// * 'und:ci': undetermined locale, case insensitive.
/// * '': empty string. Default to case-sensitive behavior.
pub default_collation: std::option::Option<wkt::StringValue>,
/// Optional. Defines the default rounding mode specification of new tables
/// created within this dataset. During table creation, if this field is
/// specified, the table within this dataset will inherit the default rounding
/// mode of the dataset. Setting the default rounding mode on a table overrides
/// this option. Existing tables in the dataset are unaffected.
/// If columns are defined during that table creation,
/// they will immediately inherit the table's default rounding mode,
/// unless otherwise specified.
pub default_rounding_mode: crate::model::table_field_schema::RoundingMode,
/// Optional. Defines the time travel window in hours. The value can be from 48
/// to 168 hours (2 to 7 days). The default value is 168 hours if this is not
/// set.
pub max_time_travel_hours: std::option::Option<wkt::Int64Value>,
/// Output only. Tags for the dataset. To provide tags as inputs, use the
/// `resourceTags` field.
#[deprecated]
pub tags: std::vec::Vec<crate::model::GcpTag>,
/// Optional. Updates storage_billing_model for the dataset.
pub storage_billing_model: crate::model::dataset::StorageBillingModel,
/// Optional. Output only. Restriction config for all tables and dataset. If
/// set, restrict certain accesses on the dataset and all its tables based on
/// the config. See [Data
/// egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress)
/// for more details.
pub restrictions: std::option::Option<crate::model::RestrictionConfig>,
/// Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached
/// to this dataset. Tag keys are globally unique. Tag key is expected to be in
/// the namespaced format, for example "123456789012/environment" where
/// 123456789012 is the ID of the parent organization or project resource for
/// this tag key. Tag value is expected to be the short name, for example
/// "Production". See [Tag
/// definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions)
/// for more details.
pub resource_tags: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Dataset {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::Dataset::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::Dataset::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [id][crate::model::Dataset::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [self_link][crate::model::Dataset::self_link].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_self_link("example");
/// ```
pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.self_link = v.into();
self
}
/// Sets the value of [dataset_reference][crate::model::Dataset::dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = Dataset::new().set_dataset_reference(DatasetReference::default()/* use setters */);
/// ```
pub fn set_dataset_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset_reference][crate::model::Dataset::dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = Dataset::new().set_or_clear_dataset_reference(Some(DatasetReference::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_dataset_reference(None::<DatasetReference>);
/// ```
pub fn set_or_clear_dataset_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset_reference = v.map(|x| x.into());
self
}
/// Sets the value of [friendly_name][crate::model::Dataset::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_friendly_name(StringValue::default()/* use setters */);
/// ```
pub fn set_friendly_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [friendly_name][crate::model::Dataset::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_or_clear_friendly_name(Some(StringValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_friendly_name(None::<StringValue>);
/// ```
pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = v.map(|x| x.into());
self
}
/// Sets the value of [description][crate::model::Dataset::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_description(StringValue::default()/* use setters */);
/// ```
pub fn set_description<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [description][crate::model::Dataset::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_or_clear_description(Some(StringValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_description(None::<StringValue>);
/// ```
pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = v.map(|x| x.into());
self
}
/// Sets the value of [default_table_expiration_ms][crate::model::Dataset::default_table_expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_default_table_expiration_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_default_table_expiration_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.default_table_expiration_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_table_expiration_ms][crate::model::Dataset::default_table_expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_or_clear_default_table_expiration_ms(Some(Int64Value::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_default_table_expiration_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_default_table_expiration_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.default_table_expiration_ms = v.map(|x| x.into());
self
}
/// Sets the value of [default_partition_expiration_ms][crate::model::Dataset::default_partition_expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_default_partition_expiration_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_default_partition_expiration_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.default_partition_expiration_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_partition_expiration_ms][crate::model::Dataset::default_partition_expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_or_clear_default_partition_expiration_ms(Some(Int64Value::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_default_partition_expiration_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_default_partition_expiration_ms<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.default_partition_expiration_ms = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::Dataset::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [access][crate::model::Dataset::access].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::Access;
/// let x = Dataset::new()
/// .set_access([
/// Access::default()/* use setters */,
/// Access::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_access<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Access>,
{
use std::iter::Iterator;
self.access = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [creation_time][crate::model::Dataset::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [last_modified_time][crate::model::Dataset::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_last_modified_time(42);
/// ```
pub fn set_last_modified_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.last_modified_time = v.into();
self
}
/// Sets the value of [location][crate::model::Dataset::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [default_encryption_configuration][crate::model::Dataset::default_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Dataset::new().set_default_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_default_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.default_encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_encryption_configuration][crate::model::Dataset::default_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Dataset::new().set_or_clear_default_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_default_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_default_encryption_configuration<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.default_encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzs][crate::model::Dataset::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_satisfies_pzs(BoolValue::default()/* use setters */);
/// ```
pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.satisfies_pzs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzs][crate::model::Dataset::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_or_clear_satisfies_pzs(Some(BoolValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_satisfies_pzs(None::<BoolValue>);
/// ```
pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.satisfies_pzs = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzi][crate::model::Dataset::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_satisfies_pzi(BoolValue::default()/* use setters */);
/// ```
pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.satisfies_pzi = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzi][crate::model::Dataset::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_or_clear_satisfies_pzi(Some(BoolValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_satisfies_pzi(None::<BoolValue>);
/// ```
pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.satisfies_pzi = v.map(|x| x.into());
self
}
/// Sets the value of [r#type][crate::model::Dataset::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [catalog_source][crate::model::Dataset::catalog_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_catalog_source("example");
/// ```
pub fn set_catalog_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.catalog_source = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [catalog_source][crate::model::Dataset::catalog_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_or_clear_catalog_source(Some("example"));
/// let x = Dataset::new().set_or_clear_catalog_source(None::<String>);
/// ```
pub fn set_or_clear_catalog_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.catalog_source = v.map(|x| x.into());
self
}
/// Sets the value of [linked_dataset_source][crate::model::Dataset::linked_dataset_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::LinkedDatasetSource;
/// let x = Dataset::new().set_linked_dataset_source(LinkedDatasetSource::default()/* use setters */);
/// ```
pub fn set_linked_dataset_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LinkedDatasetSource>,
{
self.linked_dataset_source = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [linked_dataset_source][crate::model::Dataset::linked_dataset_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::LinkedDatasetSource;
/// let x = Dataset::new().set_or_clear_linked_dataset_source(Some(LinkedDatasetSource::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_linked_dataset_source(None::<LinkedDatasetSource>);
/// ```
pub fn set_or_clear_linked_dataset_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LinkedDatasetSource>,
{
self.linked_dataset_source = v.map(|x| x.into());
self
}
/// Sets the value of [linked_dataset_metadata][crate::model::Dataset::linked_dataset_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::LinkedDatasetMetadata;
/// let x = Dataset::new().set_linked_dataset_metadata(LinkedDatasetMetadata::default()/* use setters */);
/// ```
pub fn set_linked_dataset_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LinkedDatasetMetadata>,
{
self.linked_dataset_metadata = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [linked_dataset_metadata][crate::model::Dataset::linked_dataset_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::LinkedDatasetMetadata;
/// let x = Dataset::new().set_or_clear_linked_dataset_metadata(Some(LinkedDatasetMetadata::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_linked_dataset_metadata(None::<LinkedDatasetMetadata>);
/// ```
pub fn set_or_clear_linked_dataset_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LinkedDatasetMetadata>,
{
self.linked_dataset_metadata = v.map(|x| x.into());
self
}
/// Sets the value of [external_dataset_reference][crate::model::Dataset::external_dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = Dataset::new().set_external_dataset_reference(ExternalDatasetReference::default()/* use setters */);
/// ```
pub fn set_external_dataset_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalDatasetReference>,
{
self.external_dataset_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_dataset_reference][crate::model::Dataset::external_dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = Dataset::new().set_or_clear_external_dataset_reference(Some(ExternalDatasetReference::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_external_dataset_reference(None::<ExternalDatasetReference>);
/// ```
pub fn set_or_clear_external_dataset_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExternalDatasetReference>,
{
self.external_dataset_reference = v.map(|x| x.into());
self
}
/// Sets the value of [external_catalog_dataset_options][crate::model::Dataset::external_catalog_dataset_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::ExternalCatalogDatasetOptions;
/// let x = Dataset::new().set_external_catalog_dataset_options(ExternalCatalogDatasetOptions::default()/* use setters */);
/// ```
pub fn set_external_catalog_dataset_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalCatalogDatasetOptions>,
{
self.external_catalog_dataset_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_catalog_dataset_options][crate::model::Dataset::external_catalog_dataset_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::ExternalCatalogDatasetOptions;
/// let x = Dataset::new().set_or_clear_external_catalog_dataset_options(Some(ExternalCatalogDatasetOptions::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_external_catalog_dataset_options(None::<ExternalCatalogDatasetOptions>);
/// ```
pub fn set_or_clear_external_catalog_dataset_options<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ExternalCatalogDatasetOptions>,
{
self.external_catalog_dataset_options = v.map(|x| x.into());
self
}
/// Sets the value of [is_case_insensitive][crate::model::Dataset::is_case_insensitive].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_is_case_insensitive(BoolValue::default()/* use setters */);
/// ```
pub fn set_is_case_insensitive<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.is_case_insensitive = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_case_insensitive][crate::model::Dataset::is_case_insensitive].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::BoolValue;
/// let x = Dataset::new().set_or_clear_is_case_insensitive(Some(BoolValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_is_case_insensitive(None::<BoolValue>);
/// ```
pub fn set_or_clear_is_case_insensitive<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.is_case_insensitive = v.map(|x| x.into());
self
}
/// Sets the value of [default_collation][crate::model::Dataset::default_collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_default_collation(StringValue::default()/* use setters */);
/// ```
pub fn set_default_collation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_collation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_collation][crate::model::Dataset::default_collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::StringValue;
/// let x = Dataset::new().set_or_clear_default_collation(Some(StringValue::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_default_collation(None::<StringValue>);
/// ```
pub fn set_or_clear_default_collation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_collation = v.map(|x| x.into());
self
}
/// Sets the value of [default_rounding_mode][crate::model::Dataset::default_rounding_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::table_field_schema::RoundingMode;
/// let x0 = Dataset::new().set_default_rounding_mode(RoundingMode::RoundHalfAwayFromZero);
/// let x1 = Dataset::new().set_default_rounding_mode(RoundingMode::RoundHalfEven);
/// ```
pub fn set_default_rounding_mode<
T: std::convert::Into<crate::model::table_field_schema::RoundingMode>,
>(
mut self,
v: T,
) -> Self {
self.default_rounding_mode = v.into();
self
}
/// Sets the value of [max_time_travel_hours][crate::model::Dataset::max_time_travel_hours].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_max_time_travel_hours(Int64Value::default()/* use setters */);
/// ```
pub fn set_max_time_travel_hours<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.max_time_travel_hours = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_time_travel_hours][crate::model::Dataset::max_time_travel_hours].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use wkt::Int64Value;
/// let x = Dataset::new().set_or_clear_max_time_travel_hours(Some(Int64Value::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_max_time_travel_hours(None::<Int64Value>);
/// ```
pub fn set_or_clear_max_time_travel_hours<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.max_time_travel_hours = v.map(|x| x.into());
self
}
/// Sets the value of [tags][crate::model::Dataset::tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::GcpTag;
/// let x = Dataset::new()
/// .set_tags([
/// GcpTag::default()/* use setters */,
/// GcpTag::default()/* use (different) setters */,
/// ]);
/// ```
#[deprecated]
pub fn set_tags<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GcpTag>,
{
use std::iter::Iterator;
self.tags = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [storage_billing_model][crate::model::Dataset::storage_billing_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::dataset::StorageBillingModel;
/// let x0 = Dataset::new().set_storage_billing_model(StorageBillingModel::Logical);
/// let x1 = Dataset::new().set_storage_billing_model(StorageBillingModel::Physical);
/// ```
pub fn set_storage_billing_model<
T: std::convert::Into<crate::model::dataset::StorageBillingModel>,
>(
mut self,
v: T,
) -> Self {
self.storage_billing_model = v.into();
self
}
/// Sets the value of [restrictions][crate::model::Dataset::restrictions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::RestrictionConfig;
/// let x = Dataset::new().set_restrictions(RestrictionConfig::default()/* use setters */);
/// ```
pub fn set_restrictions<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RestrictionConfig>,
{
self.restrictions = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [restrictions][crate::model::Dataset::restrictions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// use google_cloud_bigquery_v2::model::RestrictionConfig;
/// let x = Dataset::new().set_or_clear_restrictions(Some(RestrictionConfig::default()/* use setters */));
/// let x = Dataset::new().set_or_clear_restrictions(None::<RestrictionConfig>);
/// ```
pub fn set_or_clear_restrictions<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RestrictionConfig>,
{
self.restrictions = v.map(|x| x.into());
self
}
/// Sets the value of [resource_tags][crate::model::Dataset::resource_tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Dataset;
/// let x = Dataset::new().set_resource_tags([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_resource_tags<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.resource_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Dataset {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Dataset"
}
}
/// Defines additional types related to [Dataset].
pub mod dataset {
#[allow(unused_imports)]
use super::*;
/// Indicates the billing model that will be applied to the dataset.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StorageBillingModel {
/// Value not set.
Unspecified,
/// Billing for logical bytes.
Logical,
/// Billing for physical bytes.
Physical,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [StorageBillingModel::value] or
/// [StorageBillingModel::name].
UnknownValue(storage_billing_model::UnknownValue),
}
#[doc(hidden)]
pub mod storage_billing_model {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl StorageBillingModel {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Logical => std::option::Option::Some(1),
Self::Physical => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STORAGE_BILLING_MODEL_UNSPECIFIED"),
Self::Logical => std::option::Option::Some("LOGICAL"),
Self::Physical => std::option::Option::Some("PHYSICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for StorageBillingModel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for StorageBillingModel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for StorageBillingModel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Logical,
2 => Self::Physical,
_ => Self::UnknownValue(storage_billing_model::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for StorageBillingModel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STORAGE_BILLING_MODEL_UNSPECIFIED" => Self::Unspecified,
"LOGICAL" => Self::Logical,
"PHYSICAL" => Self::Physical,
_ => Self::UnknownValue(storage_billing_model::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for StorageBillingModel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Logical => serializer.serialize_i32(1),
Self::Physical => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for StorageBillingModel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageBillingModel>::new(
".google.cloud.bigquery.v2.Dataset.StorageBillingModel",
))
}
}
}
/// A global tag managed by Resource Manager.
/// <https://cloud.google.com/iam/docs/tags-access-control#definitions>
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcpTag {
/// Required. The namespaced friendly name of the tag key, e.g.
/// "12345/environment" where 12345 is org id.
pub tag_key: std::string::String,
/// Required. The friendly short name of the tag value, e.g. "production".
pub tag_value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcpTag {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tag_key][crate::model::GcpTag::tag_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GcpTag;
/// let x = GcpTag::new().set_tag_key("example");
/// ```
pub fn set_tag_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tag_key = v.into();
self
}
/// Sets the value of [tag_value][crate::model::GcpTag::tag_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GcpTag;
/// let x = GcpTag::new().set_tag_value("example");
/// ```
pub fn set_tag_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tag_value = v.into();
self
}
}
impl wkt::message::Message for GcpTag {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GcpTag"
}
}
/// A dataset source type which refers to another BigQuery dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LinkedDatasetSource {
/// The source dataset reference contains project numbers and not project ids.
pub source_dataset: std::option::Option<crate::model::DatasetReference>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LinkedDatasetSource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source_dataset][crate::model::LinkedDatasetSource::source_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LinkedDatasetSource;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = LinkedDatasetSource::new().set_source_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_source_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.source_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [source_dataset][crate::model::LinkedDatasetSource::source_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LinkedDatasetSource;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = LinkedDatasetSource::new().set_or_clear_source_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = LinkedDatasetSource::new().set_or_clear_source_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_source_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.source_dataset = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for LinkedDatasetSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.LinkedDatasetSource"
}
}
/// Metadata about the Linked Dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LinkedDatasetMetadata {
/// Output only. Specifies whether Linked Dataset is currently in a linked
/// state or not.
pub link_state: crate::model::linked_dataset_metadata::LinkState,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LinkedDatasetMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [link_state][crate::model::LinkedDatasetMetadata::link_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LinkedDatasetMetadata;
/// use google_cloud_bigquery_v2::model::linked_dataset_metadata::LinkState;
/// let x0 = LinkedDatasetMetadata::new().set_link_state(LinkState::Linked);
/// let x1 = LinkedDatasetMetadata::new().set_link_state(LinkState::Unlinked);
/// ```
pub fn set_link_state<
T: std::convert::Into<crate::model::linked_dataset_metadata::LinkState>,
>(
mut self,
v: T,
) -> Self {
self.link_state = v.into();
self
}
}
impl wkt::message::Message for LinkedDatasetMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.LinkedDatasetMetadata"
}
}
/// Defines additional types related to [LinkedDatasetMetadata].
pub mod linked_dataset_metadata {
#[allow(unused_imports)]
use super::*;
/// Specifies whether Linked Dataset is currently in a linked state or not.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LinkState {
/// The default value.
/// Default to the LINKED state.
Unspecified,
/// Normal Linked Dataset state. Data is queryable via the Linked Dataset.
Linked,
/// Data publisher or owner has unlinked this Linked Dataset. It means you
/// can no longer query or see the data in the Linked Dataset.
Unlinked,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [LinkState::value] or
/// [LinkState::name].
UnknownValue(link_state::UnknownValue),
}
#[doc(hidden)]
pub mod link_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LinkState {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Linked => std::option::Option::Some(1),
Self::Unlinked => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LINK_STATE_UNSPECIFIED"),
Self::Linked => std::option::Option::Some("LINKED"),
Self::Unlinked => std::option::Option::Some("UNLINKED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LinkState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LinkState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for LinkState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Linked,
2 => Self::Unlinked,
_ => Self::UnknownValue(link_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LinkState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LINK_STATE_UNSPECIFIED" => Self::Unspecified,
"LINKED" => Self::Linked,
"UNLINKED" => Self::Unlinked,
_ => Self::UnknownValue(link_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LinkState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Linked => serializer.serialize_i32(1),
Self::Unlinked => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LinkState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LinkState>::new(
".google.cloud.bigquery.v2.LinkedDatasetMetadata.LinkState",
))
}
}
}
/// Request format for getting information about a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDatasetRequest {
/// Required. Project ID of the requested dataset
pub project_id: std::string::String,
/// Required. Dataset ID of the requested dataset
pub dataset_id: std::string::String,
/// Optional. Specifies the view that determines which dataset information is
/// returned. By default, metadata and ACL information are returned.
pub dataset_view: crate::model::get_dataset_request::DatasetView,
/// Optional. The version of the access policy schema to fetch.
/// Valid values are 0, 1, and 3. Requests specifying an invalid value will be
/// rejected.
///
/// Requests for conditional access policy binding in datasets must specify
/// version 3. Dataset with no conditional role bindings in access policy may
/// specify any valid value or leave the field unset.
///
/// This field will be mapped to [IAM Policy version]
/// (<https://cloud.google.com/iam/docs/policies#versions>) and will be used to
/// fetch policy from IAM.
///
/// If unset or if 0 or 1 value is used for dataset with conditional bindings,
/// access entry with condition will have role string appended by
/// 'withcond' string followed by a hash value. For example :
/// {
/// "access": [
/// {
/// "role":
/// "roles/bigquery.dataViewer_with_conditionalbinding_7a34awqsda",
/// "userByEmail": "user@example.com",
/// }
/// ]
/// }
/// Please refer <https://cloud.google.com/iam/docs/troubleshooting-withcond> for
/// more details.
pub access_policy_version: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetDatasetRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetDatasetRequest;
/// let x = GetDatasetRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::GetDatasetRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetDatasetRequest;
/// let x = GetDatasetRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [dataset_view][crate::model::GetDatasetRequest::dataset_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetDatasetRequest;
/// use google_cloud_bigquery_v2::model::get_dataset_request::DatasetView;
/// let x0 = GetDatasetRequest::new().set_dataset_view(DatasetView::Metadata);
/// let x1 = GetDatasetRequest::new().set_dataset_view(DatasetView::Acl);
/// let x2 = GetDatasetRequest::new().set_dataset_view(DatasetView::Full);
/// ```
pub fn set_dataset_view<
T: std::convert::Into<crate::model::get_dataset_request::DatasetView>,
>(
mut self,
v: T,
) -> Self {
self.dataset_view = v.into();
self
}
/// Sets the value of [access_policy_version][crate::model::GetDatasetRequest::access_policy_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetDatasetRequest;
/// let x = GetDatasetRequest::new().set_access_policy_version(42);
/// ```
pub fn set_access_policy_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.access_policy_version = v.into();
self
}
}
impl wkt::message::Message for GetDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetDatasetRequest"
}
}
/// Defines additional types related to [GetDatasetRequest].
pub mod get_dataset_request {
#[allow(unused_imports)]
use super::*;
/// DatasetView specifies which dataset information is returned.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DatasetView {
/// The default value.
/// Default to the FULL view.
Unspecified,
/// View metadata information for the dataset, such as friendlyName,
/// description, labels, etc.
Metadata,
/// View ACL information for the dataset, which defines dataset access
/// for one or more entities.
Acl,
/// View both dataset metadata and ACL information.
Full,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DatasetView::value] or
/// [DatasetView::name].
UnknownValue(dataset_view::UnknownValue),
}
#[doc(hidden)]
pub mod dataset_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DatasetView {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Metadata => std::option::Option::Some(1),
Self::Acl => std::option::Option::Some(2),
Self::Full => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATASET_VIEW_UNSPECIFIED"),
Self::Metadata => std::option::Option::Some("METADATA"),
Self::Acl => std::option::Option::Some("ACL"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DatasetView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DatasetView {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DatasetView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Metadata,
2 => Self::Acl,
3 => Self::Full,
_ => Self::UnknownValue(dataset_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DatasetView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATASET_VIEW_UNSPECIFIED" => Self::Unspecified,
"METADATA" => Self::Metadata,
"ACL" => Self::Acl,
"FULL" => Self::Full,
_ => Self::UnknownValue(dataset_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DatasetView {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Metadata => serializer.serialize_i32(1),
Self::Acl => serializer.serialize_i32(2),
Self::Full => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DatasetView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatasetView>::new(
".google.cloud.bigquery.v2.GetDatasetRequest.DatasetView",
))
}
}
}
/// Request format for inserting a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsertDatasetRequest {
/// Required. Project ID of the new dataset
pub project_id: std::string::String,
/// Required. Datasets resource to use for the new dataset
pub dataset: std::option::Option<crate::model::Dataset>,
/// Optional. The version of the provided access policy schema.
/// Valid values are 0, 1, and 3. Requests specifying an invalid value will be
/// rejected.
///
/// This version refers to the schema version of the access policy and not the
/// version of access policy. This field's value can be equal or more
/// than the access policy schema provided in the request.
/// For example,
///
/// * Requests with conditional access policy binding in datasets must
/// specify
/// version 3.
/// * But dataset with no conditional role bindings in access policy
/// may specify any valid value or leave the field unset.
/// If unset or if 0 or 1 value is used for dataset with conditional
/// bindings, request will be rejected.
///
/// This field will be mapped to IAM Policy version
/// (<https://cloud.google.com/iam/docs/policies#versions>) and will be used to
/// set policy in IAM.
pub access_policy_version: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InsertDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::InsertDatasetRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertDatasetRequest;
/// let x = InsertDatasetRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset][crate::model::InsertDatasetRequest::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertDatasetRequest;
/// use google_cloud_bigquery_v2::model::Dataset;
/// let x = InsertDatasetRequest::new().set_dataset(Dataset::default()/* use setters */);
/// ```
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::InsertDatasetRequest::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertDatasetRequest;
/// use google_cloud_bigquery_v2::model::Dataset;
/// let x = InsertDatasetRequest::new().set_or_clear_dataset(Some(Dataset::default()/* use setters */));
/// let x = InsertDatasetRequest::new().set_or_clear_dataset(None::<Dataset>);
/// ```
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = v.map(|x| x.into());
self
}
/// Sets the value of [access_policy_version][crate::model::InsertDatasetRequest::access_policy_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertDatasetRequest;
/// let x = InsertDatasetRequest::new().set_access_policy_version(42);
/// ```
pub fn set_access_policy_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.access_policy_version = v.into();
self
}
}
impl wkt::message::Message for InsertDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.InsertDatasetRequest"
}
}
/// Message for updating or patching a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateOrPatchDatasetRequest {
/// Required. Project ID of the dataset being updated
pub project_id: std::string::String,
/// Required. Dataset ID of the dataset being updated
pub dataset_id: std::string::String,
/// Required. Datasets resource which will replace or patch the specified
/// dataset.
pub dataset: std::option::Option<crate::model::Dataset>,
/// Optional. Specifies the fields of dataset that update/patch operation is
/// targeting By default, both metadata and ACL fields are updated.
pub update_mode: crate::model::update_or_patch_dataset_request::UpdateMode,
/// Optional. The version of the provided access policy schema.
/// Valid values are 0, 1, and 3. Requests specifying an invalid value will be
/// rejected.
///
/// This version refers to the schema version of the access policy and not the
/// version of access policy. This field's value can be equal or more
/// than the access policy schema provided in the request.
/// For example,
///
/// * Operations updating conditional access policy binding in datasets must
/// specify
/// version 3. Some of the operations are :
/// - Adding a new access policy entry with condition.
/// - Removing an access policy entry with condition.
/// - Updating an access policy entry with condition.
/// * But dataset with no conditional role bindings in access policy
/// may specify any valid value or leave the field unset.
/// If unset or if 0 or 1 value is used for dataset with conditional
/// bindings, request will be rejected.
///
/// This field will be mapped to IAM Policy version
/// (<https://cloud.google.com/iam/docs/policies#versions>) and will be used to
/// set policy in IAM.
pub access_policy_version: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateOrPatchDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::UpdateOrPatchDatasetRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// let x = UpdateOrPatchDatasetRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::UpdateOrPatchDatasetRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// let x = UpdateOrPatchDatasetRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// use google_cloud_bigquery_v2::model::Dataset;
/// let x = UpdateOrPatchDatasetRequest::new().set_dataset(Dataset::default()/* use setters */);
/// ```
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// use google_cloud_bigquery_v2::model::Dataset;
/// let x = UpdateOrPatchDatasetRequest::new().set_or_clear_dataset(Some(Dataset::default()/* use setters */));
/// let x = UpdateOrPatchDatasetRequest::new().set_or_clear_dataset(None::<Dataset>);
/// ```
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = v.map(|x| x.into());
self
}
/// Sets the value of [update_mode][crate::model::UpdateOrPatchDatasetRequest::update_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// use google_cloud_bigquery_v2::model::update_or_patch_dataset_request::UpdateMode;
/// let x0 = UpdateOrPatchDatasetRequest::new().set_update_mode(UpdateMode::UpdateMetadata);
/// let x1 = UpdateOrPatchDatasetRequest::new().set_update_mode(UpdateMode::UpdateAcl);
/// let x2 = UpdateOrPatchDatasetRequest::new().set_update_mode(UpdateMode::UpdateFull);
/// ```
pub fn set_update_mode<
T: std::convert::Into<crate::model::update_or_patch_dataset_request::UpdateMode>,
>(
mut self,
v: T,
) -> Self {
self.update_mode = v.into();
self
}
/// Sets the value of [access_policy_version][crate::model::UpdateOrPatchDatasetRequest::access_policy_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchDatasetRequest;
/// let x = UpdateOrPatchDatasetRequest::new().set_access_policy_version(42);
/// ```
pub fn set_access_policy_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.access_policy_version = v.into();
self
}
}
impl wkt::message::Message for UpdateOrPatchDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest"
}
}
/// Defines additional types related to [UpdateOrPatchDatasetRequest].
pub mod update_or_patch_dataset_request {
#[allow(unused_imports)]
use super::*;
/// UpdateMode specifies which dataset fields is updated.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UpdateMode {
/// The default value.
/// Default to the UPDATE_FULL.
Unspecified,
/// Includes metadata information for the dataset, such as friendlyName,
/// description, labels, etc.
UpdateMetadata,
/// Includes ACL information for the dataset, which defines dataset access
/// for one or more entities.
UpdateAcl,
/// Includes both dataset metadata and ACL information.
UpdateFull,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [UpdateMode::value] or
/// [UpdateMode::name].
UnknownValue(update_mode::UnknownValue),
}
#[doc(hidden)]
pub mod update_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UpdateMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::UpdateMetadata => std::option::Option::Some(1),
Self::UpdateAcl => std::option::Option::Some(2),
Self::UpdateFull => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("UPDATE_MODE_UNSPECIFIED"),
Self::UpdateMetadata => std::option::Option::Some("UPDATE_METADATA"),
Self::UpdateAcl => std::option::Option::Some("UPDATE_ACL"),
Self::UpdateFull => std::option::Option::Some("UPDATE_FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UpdateMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UpdateMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for UpdateMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::UpdateMetadata,
2 => Self::UpdateAcl,
3 => Self::UpdateFull,
_ => Self::UnknownValue(update_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UpdateMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UPDATE_MODE_UNSPECIFIED" => Self::Unspecified,
"UPDATE_METADATA" => Self::UpdateMetadata,
"UPDATE_ACL" => Self::UpdateAcl,
"UPDATE_FULL" => Self::UpdateFull,
_ => Self::UnknownValue(update_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UpdateMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::UpdateMetadata => serializer.serialize_i32(1),
Self::UpdateAcl => serializer.serialize_i32(2),
Self::UpdateFull => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for UpdateMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UpdateMode>::new(
".google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest.UpdateMode",
))
}
}
}
/// Request format for deleting a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDatasetRequest {
/// Required. Project ID of the dataset being deleted
pub project_id: std::string::String,
/// Required. Dataset ID of dataset being deleted
pub dataset_id: std::string::String,
/// If True, delete all the tables in the dataset.
/// If False and the dataset contains tables, the request will fail.
/// Default is False
pub delete_contents: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteDatasetRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteDatasetRequest;
/// let x = DeleteDatasetRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::DeleteDatasetRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteDatasetRequest;
/// let x = DeleteDatasetRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [delete_contents][crate::model::DeleteDatasetRequest::delete_contents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteDatasetRequest;
/// let x = DeleteDatasetRequest::new().set_delete_contents(true);
/// ```
pub fn set_delete_contents<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.delete_contents = v.into();
self
}
}
impl wkt::message::Message for DeleteDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteDatasetRequest"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDatasetsRequest {
/// Required. Project ID of the datasets to be listed
pub project_id: std::string::String,
/// The maximum number of results to return in a single response page.
/// Leverage the page tokens to iterate through the entire collection.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Page token, returned by a previous call, to request the next page of
/// results
pub page_token: std::string::String,
/// Whether to list all datasets, including hidden ones
pub all: bool,
/// An expression for filtering the results of the request by label.
/// The syntax is `labels.<name>[:<value>]`.
/// Multiple filters can be AND-ed together by connecting with a space.
/// Example: `labels.department:receiving labels.active`.
/// See [Filtering datasets using
/// labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels)
/// for details.
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListDatasetsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListDatasetsRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// let x = ListDatasetsRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [max_results][crate::model::ListDatasetsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// use wkt::UInt32Value;
/// let x = ListDatasetsRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::ListDatasetsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// use wkt::UInt32Value;
/// let x = ListDatasetsRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = ListDatasetsRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// let x = ListDatasetsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [all][crate::model::ListDatasetsRequest::all].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// let x = ListDatasetsRequest::new().set_all(true);
/// ```
pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.all = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDatasetsRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListDatasetsRequest;
/// let x = ListDatasetsRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ListDatasetsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListDatasetsRequest"
}
}
/// A dataset resource with only a subset of fields, to be returned in a list of
/// datasets.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFormatDataset {
/// The resource type.
/// This property always returns the value "bigquery#dataset"
pub kind: std::string::String,
/// The fully-qualified, unique, opaque ID of the dataset.
pub id: std::string::String,
/// The dataset reference.
/// Use this property to access specific parts of the dataset's ID, such as
/// project ID or dataset ID.
pub dataset_reference: std::option::Option<crate::model::DatasetReference>,
/// The labels associated with this dataset.
/// You can use these to organize and group your datasets.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// An alternate name for the dataset. The friendly name is purely
/// decorative in nature.
pub friendly_name: std::option::Option<wkt::StringValue>,
/// The geographic location where the dataset resides.
pub location: std::string::String,
/// Output only. Same as `type` in `Dataset`.
/// The type of the dataset, one of:
///
/// * DEFAULT - only accessible by owner and authorized accounts,
/// * PUBLIC - accessible by everyone,
/// * LINKED - linked dataset,
/// * EXTERNAL - dataset with definition in external metadata catalog,
/// * BIGLAKE_ICEBERG - a Biglake dataset accessible through the Iceberg API,
/// * BIGLAKE_HIVE - a Biglake dataset accessible through the Hive API.
pub r#type: std::string::String,
/// Output only. The origin of the dataset, one of:
///
/// * (Unset) - Native BigQuery Dataset.
/// * BIGLAKE - Dataset is backed by a namespace stored natively in Biglake.
pub catalog_source: std::option::Option<std::string::String>,
/// Output only. Reference to a read-only external dataset defined in data
/// catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL.
pub external_dataset_reference: std::option::Option<crate::model::ExternalDatasetReference>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFormatDataset {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::ListFormatDataset::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [id][crate::model::ListFormatDataset::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [dataset_reference][crate::model::ListFormatDataset::dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = ListFormatDataset::new().set_dataset_reference(DatasetReference::default()/* use setters */);
/// ```
pub fn set_dataset_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset_reference][crate::model::ListFormatDataset::dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = ListFormatDataset::new().set_or_clear_dataset_reference(Some(DatasetReference::default()/* use setters */));
/// let x = ListFormatDataset::new().set_or_clear_dataset_reference(None::<DatasetReference>);
/// ```
pub fn set_or_clear_dataset_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dataset_reference = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::ListFormatDataset::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [friendly_name][crate::model::ListFormatDataset::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use wkt::StringValue;
/// let x = ListFormatDataset::new().set_friendly_name(StringValue::default()/* use setters */);
/// ```
pub fn set_friendly_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [friendly_name][crate::model::ListFormatDataset::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use wkt::StringValue;
/// let x = ListFormatDataset::new().set_or_clear_friendly_name(Some(StringValue::default()/* use setters */));
/// let x = ListFormatDataset::new().set_or_clear_friendly_name(None::<StringValue>);
/// ```
pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = v.map(|x| x.into());
self
}
/// Sets the value of [location][crate::model::ListFormatDataset::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [r#type][crate::model::ListFormatDataset::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [catalog_source][crate::model::ListFormatDataset::catalog_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_catalog_source("example");
/// ```
pub fn set_catalog_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.catalog_source = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [catalog_source][crate::model::ListFormatDataset::catalog_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = ListFormatDataset::new().set_or_clear_catalog_source(Some("example"));
/// let x = ListFormatDataset::new().set_or_clear_catalog_source(None::<String>);
/// ```
pub fn set_or_clear_catalog_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.catalog_source = v.map(|x| x.into());
self
}
/// Sets the value of [external_dataset_reference][crate::model::ListFormatDataset::external_dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = ListFormatDataset::new().set_external_dataset_reference(ExternalDatasetReference::default()/* use setters */);
/// ```
pub fn set_external_dataset_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalDatasetReference>,
{
self.external_dataset_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_dataset_reference][crate::model::ListFormatDataset::external_dataset_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatDataset;
/// use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = ListFormatDataset::new().set_or_clear_external_dataset_reference(Some(ExternalDatasetReference::default()/* use setters */));
/// let x = ListFormatDataset::new().set_or_clear_external_dataset_reference(None::<ExternalDatasetReference>);
/// ```
pub fn set_or_clear_external_dataset_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExternalDatasetReference>,
{
self.external_dataset_reference = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ListFormatDataset {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListFormatDataset"
}
}
/// Response format for a page of results when listing datasets.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DatasetList {
/// Output only. The resource type.
/// This property always returns the value "bigquery#datasetList"
pub kind: std::string::String,
/// Output only. A hash value of the results page. You can use this property to
/// determine if the page has changed since the last request.
pub etag: std::string::String,
/// A token that can be used to request the next results page. This property is
/// omitted on the final results page.
pub next_page_token: std::string::String,
/// An array of the dataset resources in the project.
/// Each resource contains basic information.
/// For full information about a particular dataset resource, use the Datasets:
/// get method. This property is omitted when there are no datasets in the
/// project.
pub datasets: std::vec::Vec<crate::model::ListFormatDataset>,
/// A list of skipped locations that were unreachable. For more information
/// about BigQuery locations, see:
/// <https://cloud.google.com/bigquery/docs/locations>. Example: "europe-west5"
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DatasetList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::DatasetList::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetList;
/// let x = DatasetList::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::DatasetList::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetList;
/// let x = DatasetList::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [next_page_token][crate::model::DatasetList::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetList;
/// let x = DatasetList::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
/// Sets the value of [datasets][crate::model::DatasetList::datasets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetList;
/// use google_cloud_bigquery_v2::model::ListFormatDataset;
/// let x = DatasetList::new()
/// .set_datasets([
/// ListFormatDataset::default()/* use setters */,
/// ListFormatDataset::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_datasets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ListFormatDataset>,
{
use std::iter::Iterator;
self.datasets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [unreachable][crate::model::DatasetList::unreachable].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetList;
/// let x = DatasetList::new().set_unreachable(["a", "b", "c"]);
/// ```
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DatasetList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DatasetList"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for DatasetList {
type PageItem = crate::model::ListFormatDataset;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.datasets
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request format for undeleting a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteDatasetRequest {
/// Required. Project ID of the dataset to be undeleted
pub project_id: std::string::String,
/// Required. Dataset ID of dataset being deleted
pub dataset_id: std::string::String,
/// Optional. The exact time when the dataset was deleted. If not specified,
/// the most recently deleted version is undeleted. Undeleting a dataset
/// using deletion time is not supported.
pub deletion_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UndeleteDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::UndeleteDatasetRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UndeleteDatasetRequest;
/// let x = UndeleteDatasetRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::UndeleteDatasetRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UndeleteDatasetRequest;
/// let x = UndeleteDatasetRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UndeleteDatasetRequest;
/// use wkt::Timestamp;
/// let x = UndeleteDatasetRequest::new().set_deletion_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_deletion_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deletion_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UndeleteDatasetRequest;
/// use wkt::Timestamp;
/// let x = UndeleteDatasetRequest::new().set_or_clear_deletion_time(Some(Timestamp::default()/* use setters */));
/// let x = UndeleteDatasetRequest::new().set_or_clear_deletion_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_deletion_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deletion_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UndeleteDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UndeleteDatasetRequest"
}
}
/// Identifier for a dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DatasetReference {
/// Required. A unique ID for this dataset, without the project name. The ID
/// must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_).
/// The maximum length is 1,024 characters.
pub dataset_id: std::string::String,
/// Optional. The ID of the project containing this dataset.
pub project_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DatasetReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dataset_id][crate::model::DatasetReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = DatasetReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [project_id][crate::model::DatasetReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = DatasetReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
}
impl wkt::message::Message for DatasetReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DatasetReference"
}
}
/// Configuration for Cloud KMS encryption settings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EncryptionConfiguration {
/// Optional. Describes the Cloud KMS encryption key that will be used to
/// protect destination BigQuery table. The BigQuery Service Account associated
/// with your project requires access to this encryption key.
pub kms_key_name: std::option::Option<wkt::StringValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EncryptionConfiguration {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// use wkt::StringValue;
/// let x = EncryptionConfiguration::new().set_kms_key_name(StringValue::default()/* use setters */);
/// ```
pub fn set_kms_key_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.kms_key_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [kms_key_name][crate::model::EncryptionConfiguration::kms_key_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// use wkt::StringValue;
/// let x = EncryptionConfiguration::new().set_or_clear_kms_key_name(Some(StringValue::default()/* use setters */));
/// let x = EncryptionConfiguration::new().set_or_clear_kms_key_name(None::<StringValue>);
/// ```
pub fn set_or_clear_kms_key_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.kms_key_name = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for EncryptionConfiguration {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.EncryptionConfiguration"
}
}
/// Error details.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ErrorProto {
/// A short error code that summarizes the error.
pub reason: std::string::String,
/// Specifies where the error occurred, if present.
pub location: std::string::String,
/// Debugging information. This property is internal to Google and should not
/// be used.
pub debug_info: std::string::String,
/// A human-readable description of the error.
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ErrorProto {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [reason][crate::model::ErrorProto::reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ErrorProto::new().set_reason("example");
/// ```
pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reason = v.into();
self
}
/// Sets the value of [location][crate::model::ErrorProto::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ErrorProto::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [debug_info][crate::model::ErrorProto::debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ErrorProto::new().set_debug_info("example");
/// ```
pub fn set_debug_info<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.debug_info = v.into();
self
}
/// Sets the value of [message][crate::model::ErrorProto::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ErrorProto::new().set_message("example");
/// ```
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for ErrorProto {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ErrorProto"
}
}
/// Options defining open source compatible datasets living in the BigQuery
/// catalog. Contains metadata of open source database, schema,
/// or namespace represented by the current dataset.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalCatalogDatasetOptions {
/// Optional. A map of key value pairs defining the parameters and properties
/// of the open source schema. Maximum size of 2MiB.
pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. The storage location URI for all tables in the dataset.
/// Equivalent to hive metastore's database locationUri. Maximum length of 1024
/// characters.
pub default_storage_location_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalCatalogDatasetOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parameters][crate::model::ExternalCatalogDatasetOptions::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogDatasetOptions;
/// let x = ExternalCatalogDatasetOptions::new().set_parameters([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [default_storage_location_uri][crate::model::ExternalCatalogDatasetOptions::default_storage_location_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogDatasetOptions;
/// let x = ExternalCatalogDatasetOptions::new().set_default_storage_location_uri("example");
/// ```
pub fn set_default_storage_location_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.default_storage_location_uri = v.into();
self
}
}
impl wkt::message::Message for ExternalCatalogDatasetOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalCatalogDatasetOptions"
}
}
/// Metadata about open source compatible table. The fields contained in
/// these options correspond to Hive metastore's table-level properties.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalCatalogTableOptions {
/// Optional. A map of the key-value pairs defining the parameters and
/// properties of the open source table. Corresponds with Hive metastore table
/// parameters. Maximum size of 4MiB.
pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. A storage descriptor containing information about the physical
/// storage of this table.
pub storage_descriptor: std::option::Option<crate::model::StorageDescriptor>,
/// Optional. A connection ID that specifies the credentials to be used to read
/// external storage, such as Azure Blob, Cloud Storage, or Amazon S3. This
/// connection is needed to read the open source table from BigQuery. The
/// connection_id format must be either
/// `<project_id>.<location_id>.<connection_id>` or
/// `projects/<project_id>/locations/<location_id>/connections/<connection_id>`.
pub connection_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalCatalogTableOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parameters][crate::model::ExternalCatalogTableOptions::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// let x = ExternalCatalogTableOptions::new().set_parameters([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [storage_descriptor][crate::model::ExternalCatalogTableOptions::storage_descriptor].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// use google_cloud_bigquery_v2::model::StorageDescriptor;
/// let x = ExternalCatalogTableOptions::new().set_storage_descriptor(StorageDescriptor::default()/* use setters */);
/// ```
pub fn set_storage_descriptor<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StorageDescriptor>,
{
self.storage_descriptor = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [storage_descriptor][crate::model::ExternalCatalogTableOptions::storage_descriptor].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// use google_cloud_bigquery_v2::model::StorageDescriptor;
/// let x = ExternalCatalogTableOptions::new().set_or_clear_storage_descriptor(Some(StorageDescriptor::default()/* use setters */));
/// let x = ExternalCatalogTableOptions::new().set_or_clear_storage_descriptor(None::<StorageDescriptor>);
/// ```
pub fn set_or_clear_storage_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StorageDescriptor>,
{
self.storage_descriptor = v.map(|x| x.into());
self
}
/// Sets the value of [connection_id][crate::model::ExternalCatalogTableOptions::connection_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// let x = ExternalCatalogTableOptions::new().set_connection_id("example");
/// ```
pub fn set_connection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection_id = v.into();
self
}
}
impl wkt::message::Message for ExternalCatalogTableOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalCatalogTableOptions"
}
}
/// Contains information about how a table's data is stored and accessed by open
/// source query engines.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StorageDescriptor {
/// Optional. The physical location of the table
/// (e.g. `gs://spark-dataproc-data/pangea-data/case_sensitive/` or
/// `gs://spark-dataproc-data/pangea-data/*`).
/// The maximum length is 2056 bytes.
pub location_uri: std::string::String,
/// Optional. Specifies the fully qualified class name of the InputFormat
/// (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat").
/// The maximum length is 128 characters.
pub input_format: std::string::String,
/// Optional. Specifies the fully qualified class name of the OutputFormat
/// (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat").
/// The maximum length is 128 characters.
pub output_format: std::string::String,
/// Optional. Serializer and deserializer information.
pub serde_info: std::option::Option<crate::model::SerDeInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StorageDescriptor {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [location_uri][crate::model::StorageDescriptor::location_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StorageDescriptor;
/// let x = StorageDescriptor::new().set_location_uri("example");
/// ```
pub fn set_location_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location_uri = v.into();
self
}
/// Sets the value of [input_format][crate::model::StorageDescriptor::input_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StorageDescriptor;
/// let x = StorageDescriptor::new().set_input_format("example");
/// ```
pub fn set_input_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.input_format = v.into();
self
}
/// Sets the value of [output_format][crate::model::StorageDescriptor::output_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StorageDescriptor;
/// let x = StorageDescriptor::new().set_output_format("example");
/// ```
pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.output_format = v.into();
self
}
/// Sets the value of [serde_info][crate::model::StorageDescriptor::serde_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StorageDescriptor;
/// use google_cloud_bigquery_v2::model::SerDeInfo;
/// let x = StorageDescriptor::new().set_serde_info(SerDeInfo::default()/* use setters */);
/// ```
pub fn set_serde_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SerDeInfo>,
{
self.serde_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [serde_info][crate::model::StorageDescriptor::serde_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StorageDescriptor;
/// use google_cloud_bigquery_v2::model::SerDeInfo;
/// let x = StorageDescriptor::new().set_or_clear_serde_info(Some(SerDeInfo::default()/* use setters */));
/// let x = StorageDescriptor::new().set_or_clear_serde_info(None::<SerDeInfo>);
/// ```
pub fn set_or_clear_serde_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SerDeInfo>,
{
self.serde_info = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for StorageDescriptor {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StorageDescriptor"
}
}
/// Serializer and deserializer information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SerDeInfo {
/// Optional. Name of the SerDe.
/// The maximum length is 256 characters.
pub name: std::string::String,
/// Required. Specifies a fully-qualified class name of the serialization
/// library that is responsible for the translation of data between table
/// representation and the underlying low-level input and output format
/// structures. The maximum length is 256 characters.
pub serialization_library: std::string::String,
/// Optional. Key-value pairs that define the initialization parameters for the
/// serialization library.
/// Maximum size 10 Kib.
pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SerDeInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::SerDeInfo::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SerDeInfo;
/// let x = SerDeInfo::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [serialization_library][crate::model::SerDeInfo::serialization_library].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SerDeInfo;
/// let x = SerDeInfo::new().set_serialization_library("example");
/// ```
pub fn set_serialization_library<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.serialization_library = v.into();
self
}
/// Sets the value of [parameters][crate::model::SerDeInfo::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SerDeInfo;
/// let x = SerDeInfo::new().set_parameters([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for SerDeInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SerDeInfo"
}
}
/// Options for external data sources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AvroOptions {
/// Optional. If sourceFormat is set to "AVRO", indicates whether to interpret
/// logical types as the corresponding BigQuery data type (for example,
/// TIMESTAMP), instead of using the raw type (for example, INTEGER).
pub use_avro_logical_types: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AvroOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [use_avro_logical_types][crate::model::AvroOptions::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::AvroOptions;
/// use wkt::BoolValue;
/// let x = AvroOptions::new().set_use_avro_logical_types(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_avro_logical_types<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_avro_logical_types][crate::model::AvroOptions::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::AvroOptions;
/// use wkt::BoolValue;
/// let x = AvroOptions::new().set_or_clear_use_avro_logical_types(Some(BoolValue::default()/* use setters */));
/// let x = AvroOptions::new().set_or_clear_use_avro_logical_types(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_avro_logical_types<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AvroOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.AvroOptions"
}
}
/// Parquet Options for load and make external tables.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ParquetOptions {
/// Optional. Indicates whether to infer Parquet ENUM logical type as STRING
/// instead of BYTES by default.
pub enum_as_string: std::option::Option<wkt::BoolValue>,
/// Optional. Indicates whether to use schema inference specifically for
/// Parquet LIST logical type.
pub enable_list_inference: std::option::Option<wkt::BoolValue>,
/// Optional. Indicates how to represent a Parquet map if present.
pub map_target_type: crate::model::MapTargetType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ParquetOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enum_as_string][crate::model::ParquetOptions::enum_as_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ParquetOptions;
/// use wkt::BoolValue;
/// let x = ParquetOptions::new().set_enum_as_string(BoolValue::default()/* use setters */);
/// ```
pub fn set_enum_as_string<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enum_as_string = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [enum_as_string][crate::model::ParquetOptions::enum_as_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ParquetOptions;
/// use wkt::BoolValue;
/// let x = ParquetOptions::new().set_or_clear_enum_as_string(Some(BoolValue::default()/* use setters */));
/// let x = ParquetOptions::new().set_or_clear_enum_as_string(None::<BoolValue>);
/// ```
pub fn set_or_clear_enum_as_string<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enum_as_string = v.map(|x| x.into());
self
}
/// Sets the value of [enable_list_inference][crate::model::ParquetOptions::enable_list_inference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ParquetOptions;
/// use wkt::BoolValue;
/// let x = ParquetOptions::new().set_enable_list_inference(BoolValue::default()/* use setters */);
/// ```
pub fn set_enable_list_inference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_list_inference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [enable_list_inference][crate::model::ParquetOptions::enable_list_inference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ParquetOptions;
/// use wkt::BoolValue;
/// let x = ParquetOptions::new().set_or_clear_enable_list_inference(Some(BoolValue::default()/* use setters */));
/// let x = ParquetOptions::new().set_or_clear_enable_list_inference(None::<BoolValue>);
/// ```
pub fn set_or_clear_enable_list_inference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_list_inference = v.map(|x| x.into());
self
}
/// Sets the value of [map_target_type][crate::model::ParquetOptions::map_target_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ParquetOptions;
/// use google_cloud_bigquery_v2::model::MapTargetType;
/// let x0 = ParquetOptions::new().set_map_target_type(MapTargetType::ArrayOfStruct);
/// ```
pub fn set_map_target_type<T: std::convert::Into<crate::model::MapTargetType>>(
mut self,
v: T,
) -> Self {
self.map_target_type = v.into();
self
}
}
impl wkt::message::Message for ParquetOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ParquetOptions"
}
}
/// Information related to a CSV data source.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CsvOptions {
/// Optional. The separator character for fields in a CSV file. The separator
/// is interpreted as a single byte. For files encoded in ISO-8859-1, any
/// single character can be used as a separator. For files encoded in UTF-8,
/// characters represented in decimal range 1-127 (U+0001-U+007F) can be used
/// without any modification. UTF-8 characters encoded with multiple bytes
/// (i.e. U+0080 and above) will have only the first byte used for separating
/// fields. The remaining bytes will be treated as a part of the field.
/// BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab
/// separator. The default value is comma (",", U+002C).
pub field_delimiter: std::string::String,
/// Optional. The number of rows at the top of a CSV file that BigQuery will
/// skip when reading the data. The default value is 0. This property is
/// useful if you have header rows in the file that should be skipped.
/// When autodetect is on, the behavior is the following:
///
/// * skipLeadingRows unspecified - Autodetect tries to detect headers in the
/// first row. If they are not detected, the row is read as data. Otherwise
/// data is read starting from the second row.
/// * skipLeadingRows is 0 - Instructs autodetect that there are no headers and
/// data should be read starting from the first row.
/// * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect
/// headers in row N. If headers are not detected, row N is just skipped.
/// Otherwise row N is used to extract column names for the detected schema.
pub skip_leading_rows: std::option::Option<wkt::Int64Value>,
/// Optional. The value that is used to quote data sections in a CSV file.
/// BigQuery converts the string to ISO-8859-1 encoding, and then uses the
/// first byte of the encoded string to split the data in its raw, binary
/// state.
/// The default value is a double-quote (").
/// If your data does not contain quoted sections,
/// set the property value to an empty string.
/// If your data contains quoted newline characters, you must also set the
/// allowQuotedNewlines property to true.
/// To include the specific quote character within a quoted value, precede it
/// with an additional matching quote character. For example, if you want to
/// escape the default character ' " ', use ' "" '.
pub quote: std::option::Option<wkt::StringValue>,
/// Optional. Indicates if BigQuery should allow quoted data sections that
/// contain newline characters in a CSV file. The default value is false.
pub allow_quoted_newlines: std::option::Option<wkt::BoolValue>,
/// Optional. Indicates if BigQuery should accept rows that are missing
/// trailing optional columns. If true, BigQuery treats missing trailing
/// columns as null values.
/// If false, records with missing trailing columns are treated as bad records,
/// and if there are too many bad records, an invalid error is returned in the
/// job result. The default value is false.
pub allow_jagged_rows: std::option::Option<wkt::BoolValue>,
/// Optional. The character encoding of the data.
/// The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE,
/// and UTF-32LE. The default value is UTF-8.
/// BigQuery decodes the data after the raw, binary data has been split using
/// the values of the quote and fieldDelimiter properties.
pub encoding: std::string::String,
/// Optional. Indicates if the embedded ASCII control characters (the first 32
/// characters in the ASCII-table, from '\x00' to '\x1F') are preserved.
pub preserve_ascii_control_characters: std::option::Option<wkt::BoolValue>,
/// Optional. Specifies a string that represents a null value in a CSV file.
/// For example, if you specify "\N", BigQuery interprets "\N" as a null value
/// when querying a CSV file.
/// The default value is the empty string. If you set this property to a custom
/// value, BigQuery throws an error if an empty string is present for all data
/// types except for STRING and BYTE. For STRING and BYTE columns, BigQuery
/// interprets the empty string as an empty value.
pub null_marker: std::option::Option<wkt::StringValue>,
/// Optional. A list of strings represented as SQL NULL value in a CSV file.
///
/// null_marker and null_markers can't be set at the same time.
/// If null_marker is set, null_markers has to be not set.
/// If null_markers is set, null_marker has to be not set.
/// If both null_marker and null_markers are set at the same time, a user
/// error would be thrown.
/// Any strings listed in null_markers, including
/// empty string would be interpreted as SQL NULL. This applies to all column
/// types.
pub null_markers: std::vec::Vec<std::string::String>,
/// Optional. Controls the strategy used to match loaded columns to the schema.
/// If not set, a sensible default is chosen based on how the schema is
/// provided. If autodetect is used, then columns are matched by name.
/// Otherwise, columns are matched by position. This is done to keep the
/// behavior backward-compatible. Acceptable values are:
/// POSITION - matches by position. This assumes that the columns are ordered
/// the same way as the schema.
/// NAME - matches by name. This reads the header row as column names and
/// reorders columns to match the field names in the schema.
pub source_column_match: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CsvOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [field_delimiter][crate::model::CsvOptions::field_delimiter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = CsvOptions::new().set_field_delimiter("example");
/// ```
pub fn set_field_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field_delimiter = v.into();
self
}
/// Sets the value of [skip_leading_rows][crate::model::CsvOptions::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::Int64Value;
/// let x = CsvOptions::new().set_skip_leading_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_skip_leading_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.skip_leading_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [skip_leading_rows][crate::model::CsvOptions::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::Int64Value;
/// let x = CsvOptions::new().set_or_clear_skip_leading_rows(Some(Int64Value::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_skip_leading_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_skip_leading_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.skip_leading_rows = v.map(|x| x.into());
self
}
/// Sets the value of [quote][crate::model::CsvOptions::quote].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::StringValue;
/// let x = CsvOptions::new().set_quote(StringValue::default()/* use setters */);
/// ```
pub fn set_quote<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.quote = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [quote][crate::model::CsvOptions::quote].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::StringValue;
/// let x = CsvOptions::new().set_or_clear_quote(Some(StringValue::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_quote(None::<StringValue>);
/// ```
pub fn set_or_clear_quote<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.quote = v.map(|x| x.into());
self
}
/// Sets the value of [allow_quoted_newlines][crate::model::CsvOptions::allow_quoted_newlines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_allow_quoted_newlines(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_quoted_newlines<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_quoted_newlines = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_quoted_newlines][crate::model::CsvOptions::allow_quoted_newlines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_or_clear_allow_quoted_newlines(Some(BoolValue::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_allow_quoted_newlines(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_quoted_newlines<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_quoted_newlines = v.map(|x| x.into());
self
}
/// Sets the value of [allow_jagged_rows][crate::model::CsvOptions::allow_jagged_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_allow_jagged_rows(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_jagged_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_jagged_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_jagged_rows][crate::model::CsvOptions::allow_jagged_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_or_clear_allow_jagged_rows(Some(BoolValue::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_allow_jagged_rows(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_jagged_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_jagged_rows = v.map(|x| x.into());
self
}
/// Sets the value of [encoding][crate::model::CsvOptions::encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = CsvOptions::new().set_encoding("example");
/// ```
pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.encoding = v.into();
self
}
/// Sets the value of [preserve_ascii_control_characters][crate::model::CsvOptions::preserve_ascii_control_characters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_preserve_ascii_control_characters(BoolValue::default()/* use setters */);
/// ```
pub fn set_preserve_ascii_control_characters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.preserve_ascii_control_characters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [preserve_ascii_control_characters][crate::model::CsvOptions::preserve_ascii_control_characters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::BoolValue;
/// let x = CsvOptions::new().set_or_clear_preserve_ascii_control_characters(Some(BoolValue::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_preserve_ascii_control_characters(None::<BoolValue>);
/// ```
pub fn set_or_clear_preserve_ascii_control_characters<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.preserve_ascii_control_characters = v.map(|x| x.into());
self
}
/// Sets the value of [null_marker][crate::model::CsvOptions::null_marker].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::StringValue;
/// let x = CsvOptions::new().set_null_marker(StringValue::default()/* use setters */);
/// ```
pub fn set_null_marker<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.null_marker = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [null_marker][crate::model::CsvOptions::null_marker].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// use wkt::StringValue;
/// let x = CsvOptions::new().set_or_clear_null_marker(Some(StringValue::default()/* use setters */));
/// let x = CsvOptions::new().set_or_clear_null_marker(None::<StringValue>);
/// ```
pub fn set_or_clear_null_marker<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.null_marker = v.map(|x| x.into());
self
}
/// Sets the value of [null_markers][crate::model::CsvOptions::null_markers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = CsvOptions::new().set_null_markers(["a", "b", "c"]);
/// ```
pub fn set_null_markers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.null_markers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [source_column_match][crate::model::CsvOptions::source_column_match].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = CsvOptions::new().set_source_column_match("example");
/// ```
pub fn set_source_column_match<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.source_column_match = v.into();
self
}
}
impl wkt::message::Message for CsvOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.CsvOptions"
}
}
/// Json Options for load and make external tables.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JsonOptions {
/// Optional. The character encoding of the data.
/// The supported values are UTF-8, UTF-16BE, UTF-16LE, UTF-32BE,
/// and UTF-32LE. The default value is UTF-8.
pub encoding: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JsonOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [encoding][crate::model::JsonOptions::encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JsonOptions;
/// let x = JsonOptions::new().set_encoding("example");
/// ```
pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.encoding = v.into();
self
}
}
impl wkt::message::Message for JsonOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JsonOptions"
}
}
/// Information related to a Bigtable protobuf column.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigtableProtoConfig {
/// Optional. The ID of the Bigtable SchemaBundle resource associated with this
/// protobuf. The ID should be referred to within the parent table, e.g.,
/// `foo` rather than
/// `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/foo`.
/// See [more details on Bigtable
/// SchemaBundles](https://docs.cloud.google.com/bigtable/docs/create-manage-protobuf-schemas).
pub schema_bundle_id: std::string::String,
/// Optional. The fully qualified proto message name of the protobuf. In the
/// format of "foo.bar.Message".
pub proto_message_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigtableProtoConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [schema_bundle_id][crate::model::BigtableProtoConfig::schema_bundle_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableProtoConfig::new().set_schema_bundle_id("example");
/// ```
pub fn set_schema_bundle_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.schema_bundle_id = v.into();
self
}
/// Sets the value of [proto_message_name][crate::model::BigtableProtoConfig::proto_message_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableProtoConfig::new().set_proto_message_name("example");
/// ```
pub fn set_proto_message_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.proto_message_name = v.into();
self
}
}
impl wkt::message::Message for BigtableProtoConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BigtableProtoConfig"
}
}
/// Information related to a Bigtable column.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigtableColumn {
/// [Required] Qualifier of the column.
/// Columns in the parent column family that has this exact qualifier are
/// exposed as `<family field name>.<column field name>` field.
/// If the qualifier is valid UTF-8 string, it can be specified in the
/// qualifier_string field. Otherwise, a base-64 encoded value must be set to
/// qualifier_encoded.
/// The column field name is the same as the column qualifier. However, if the
/// qualifier is not a valid BigQuery field identifier i.e. does not match
/// [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
pub qualifier_encoded: std::option::Option<wkt::BytesValue>,
/// Qualifier string.
pub qualifier_string: std::option::Option<wkt::StringValue>,
/// Optional. If the qualifier is not a valid BigQuery field identifier i.e.
/// does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided
/// as the column field name and is used as field name in queries.
pub field_name: std::string::String,
/// Optional. The type to convert the value in cells of this column.
/// The values are expected to be encoded using HBase Bytes.toBytes function
/// when using the BINARY encoding value.
/// Following BigQuery types are allowed (case-sensitive):
///
/// * BYTES
/// * STRING
/// * INTEGER
/// * FLOAT
/// * BOOLEAN
/// * JSON
///
/// Default type is BYTES.
/// 'type' can also be set at the column family level. However, the setting at
/// this level takes precedence if 'type' is set at both levels.
pub r#type: std::string::String,
/// Optional. The encoding of the values when the type is not STRING.
/// Acceptable encoding values are:
/// TEXT - indicates values are alphanumeric text strings.
/// BINARY - indicates values are encoded using HBase Bytes.toBytes family of
/// functions.
/// PROTO_BINARY - indicates values are encoded using serialized proto
/// messages. This can only be used in combination with JSON
/// type.
/// 'encoding' can also be set at the column family level. However, the setting
/// at this level takes precedence if 'encoding' is set at both levels.
pub encoding: std::string::String,
/// Optional. If this is set, only the latest version of value in this column
/// are exposed.
/// 'onlyReadLatest' can also be set at the column family level. However, the
/// setting at this level takes precedence if 'onlyReadLatest' is set at both
/// levels.
pub only_read_latest: std::option::Option<wkt::BoolValue>,
/// Optional. Protobuf-specific configurations, only takes effect when the
/// encoding is PROTO_BINARY.
pub proto_config: std::option::Option<crate::model::BigtableProtoConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigtableColumn {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [qualifier_encoded][crate::model::BigtableColumn::qualifier_encoded].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::BytesValue;
/// let x = BigtableColumn::new().set_qualifier_encoded(BytesValue::default()/* use setters */);
/// ```
pub fn set_qualifier_encoded<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BytesValue>,
{
self.qualifier_encoded = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [qualifier_encoded][crate::model::BigtableColumn::qualifier_encoded].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::BytesValue;
/// let x = BigtableColumn::new().set_or_clear_qualifier_encoded(Some(BytesValue::default()/* use setters */));
/// let x = BigtableColumn::new().set_or_clear_qualifier_encoded(None::<BytesValue>);
/// ```
pub fn set_or_clear_qualifier_encoded<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BytesValue>,
{
self.qualifier_encoded = v.map(|x| x.into());
self
}
/// Sets the value of [qualifier_string][crate::model::BigtableColumn::qualifier_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::StringValue;
/// let x = BigtableColumn::new().set_qualifier_string(StringValue::default()/* use setters */);
/// ```
pub fn set_qualifier_string<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.qualifier_string = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [qualifier_string][crate::model::BigtableColumn::qualifier_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::StringValue;
/// let x = BigtableColumn::new().set_or_clear_qualifier_string(Some(StringValue::default()/* use setters */));
/// let x = BigtableColumn::new().set_or_clear_qualifier_string(None::<StringValue>);
/// ```
pub fn set_or_clear_qualifier_string<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.qualifier_string = v.map(|x| x.into());
self
}
/// Sets the value of [field_name][crate::model::BigtableColumn::field_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// let x = BigtableColumn::new().set_field_name("example");
/// ```
pub fn set_field_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field_name = v.into();
self
}
/// Sets the value of [r#type][crate::model::BigtableColumn::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// let x = BigtableColumn::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [encoding][crate::model::BigtableColumn::encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// let x = BigtableColumn::new().set_encoding("example");
/// ```
pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.encoding = v.into();
self
}
/// Sets the value of [only_read_latest][crate::model::BigtableColumn::only_read_latest].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::BoolValue;
/// let x = BigtableColumn::new().set_only_read_latest(BoolValue::default()/* use setters */);
/// ```
pub fn set_only_read_latest<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.only_read_latest = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [only_read_latest][crate::model::BigtableColumn::only_read_latest].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use wkt::BoolValue;
/// let x = BigtableColumn::new().set_or_clear_only_read_latest(Some(BoolValue::default()/* use setters */));
/// let x = BigtableColumn::new().set_or_clear_only_read_latest(None::<BoolValue>);
/// ```
pub fn set_or_clear_only_read_latest<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.only_read_latest = v.map(|x| x.into());
self
}
/// Sets the value of [proto_config][crate::model::BigtableColumn::proto_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableColumn::new().set_proto_config(BigtableProtoConfig::default()/* use setters */);
/// ```
pub fn set_proto_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BigtableProtoConfig>,
{
self.proto_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [proto_config][crate::model::BigtableColumn::proto_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumn;
/// use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableColumn::new().set_or_clear_proto_config(Some(BigtableProtoConfig::default()/* use setters */));
/// let x = BigtableColumn::new().set_or_clear_proto_config(None::<BigtableProtoConfig>);
/// ```
pub fn set_or_clear_proto_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BigtableProtoConfig>,
{
self.proto_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BigtableColumn {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BigtableColumn"
}
}
/// Information related to a Bigtable column family.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigtableColumnFamily {
/// Identifier of the column family.
pub family_id: std::string::String,
/// Optional. The type to convert the value in cells of this column family.
/// The values are expected to be encoded using HBase Bytes.toBytes function
/// when using the BINARY encoding value.
/// Following BigQuery types are allowed (case-sensitive):
///
/// * BYTES
/// * STRING
/// * INTEGER
/// * FLOAT
/// * BOOLEAN
/// * JSON
///
/// Default type is BYTES.
/// This can be overridden for a specific column by listing that column in
/// 'columns' and specifying a type for it.
pub r#type: std::string::String,
/// Optional. The encoding of the values when the type is not STRING.
/// Acceptable encoding values are:
/// TEXT - indicates values are alphanumeric text strings.
/// BINARY - indicates values are encoded using HBase Bytes.toBytes family of
/// functions.
/// PROTO_BINARY - indicates values are encoded using serialized proto
/// messages. This can only be used in combination with JSON
/// type.
/// This can be overridden for a specific column by listing that column in
/// 'columns' and specifying an encoding for it.
pub encoding: std::string::String,
/// Optional. Lists of columns that should be exposed as individual fields as
/// opposed to a list of (column name, value) pairs.
/// All columns whose qualifier matches a qualifier in this list can be
/// accessed as `<family field name>.<column field name>`.
/// Other columns can be accessed as a list through
/// the `<family field name>.Column` field.
pub columns: std::vec::Vec<crate::model::BigtableColumn>,
/// Optional. If this is set only the latest version of value are exposed for
/// all columns in this column family.
/// This can be overridden for a specific column by listing that column in
/// 'columns' and specifying a different setting
/// for that column.
pub only_read_latest: std::option::Option<wkt::BoolValue>,
/// Optional. Protobuf-specific configurations, only takes effect when the
/// encoding is PROTO_BINARY.
pub proto_config: std::option::Option<crate::model::BigtableProtoConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigtableColumnFamily {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [family_id][crate::model::BigtableColumnFamily::family_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// let x = BigtableColumnFamily::new().set_family_id("example");
/// ```
pub fn set_family_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.family_id = v.into();
self
}
/// Sets the value of [r#type][crate::model::BigtableColumnFamily::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// let x = BigtableColumnFamily::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [encoding][crate::model::BigtableColumnFamily::encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// let x = BigtableColumnFamily::new().set_encoding("example");
/// ```
pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.encoding = v.into();
self
}
/// Sets the value of [columns][crate::model::BigtableColumnFamily::columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// use google_cloud_bigquery_v2::model::BigtableColumn;
/// let x = BigtableColumnFamily::new()
/// .set_columns([
/// BigtableColumn::default()/* use setters */,
/// BigtableColumn::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BigtableColumn>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [only_read_latest][crate::model::BigtableColumnFamily::only_read_latest].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// use wkt::BoolValue;
/// let x = BigtableColumnFamily::new().set_only_read_latest(BoolValue::default()/* use setters */);
/// ```
pub fn set_only_read_latest<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.only_read_latest = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [only_read_latest][crate::model::BigtableColumnFamily::only_read_latest].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// use wkt::BoolValue;
/// let x = BigtableColumnFamily::new().set_or_clear_only_read_latest(Some(BoolValue::default()/* use setters */));
/// let x = BigtableColumnFamily::new().set_or_clear_only_read_latest(None::<BoolValue>);
/// ```
pub fn set_or_clear_only_read_latest<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.only_read_latest = v.map(|x| x.into());
self
}
/// Sets the value of [proto_config][crate::model::BigtableColumnFamily::proto_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableColumnFamily::new().set_proto_config(BigtableProtoConfig::default()/* use setters */);
/// ```
pub fn set_proto_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BigtableProtoConfig>,
{
self.proto_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [proto_config][crate::model::BigtableColumnFamily::proto_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// use google_cloud_bigquery_v2::model::BigtableProtoConfig;
/// let x = BigtableColumnFamily::new().set_or_clear_proto_config(Some(BigtableProtoConfig::default()/* use setters */));
/// let x = BigtableColumnFamily::new().set_or_clear_proto_config(None::<BigtableProtoConfig>);
/// ```
pub fn set_or_clear_proto_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BigtableProtoConfig>,
{
self.proto_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BigtableColumnFamily {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BigtableColumnFamily"
}
}
/// Options specific to Google Cloud Bigtable data sources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BigtableOptions {
/// Optional. List of column families to expose in the table schema along with
/// their types.
/// This list restricts the column families that can be referenced in queries
/// and specifies their value types.
/// You can use this list to do type conversions - see the 'type' field for
/// more details.
/// If you leave this list empty, all column families are present in the table
/// schema and their values are read as BYTES.
/// During a query only the column families referenced in that query are read
/// from Bigtable.
pub column_families: std::vec::Vec<crate::model::BigtableColumnFamily>,
/// Optional. If field is true, then the column families that are not
/// specified in columnFamilies list are not exposed in the table schema.
/// Otherwise, they are read with BYTES type values.
/// The default value is false.
pub ignore_unspecified_column_families: std::option::Option<wkt::BoolValue>,
/// Optional. If field is true, then the rowkey column families will be read
/// and converted to string. Otherwise they are read with BYTES type values and
/// users need to manually cast them with CAST if necessary.
/// The default value is false.
pub read_rowkey_as_string: std::option::Option<wkt::BoolValue>,
/// Optional. If field is true, then each column family will be read as a
/// single JSON column. Otherwise they are read as a repeated cell structure
/// containing timestamp/value tuples. The default value is false.
pub output_column_families_as_json: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BigtableOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [column_families][crate::model::BigtableOptions::column_families].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use google_cloud_bigquery_v2::model::BigtableColumnFamily;
/// let x = BigtableOptions::new()
/// .set_column_families([
/// BigtableColumnFamily::default()/* use setters */,
/// BigtableColumnFamily::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_column_families<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BigtableColumnFamily>,
{
use std::iter::Iterator;
self.column_families = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [ignore_unspecified_column_families][crate::model::BigtableOptions::ignore_unspecified_column_families].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_ignore_unspecified_column_families(BoolValue::default()/* use setters */);
/// ```
pub fn set_ignore_unspecified_column_families<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unspecified_column_families = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ignore_unspecified_column_families][crate::model::BigtableOptions::ignore_unspecified_column_families].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_or_clear_ignore_unspecified_column_families(Some(BoolValue::default()/* use setters */));
/// let x = BigtableOptions::new().set_or_clear_ignore_unspecified_column_families(None::<BoolValue>);
/// ```
pub fn set_or_clear_ignore_unspecified_column_families<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unspecified_column_families = v.map(|x| x.into());
self
}
/// Sets the value of [read_rowkey_as_string][crate::model::BigtableOptions::read_rowkey_as_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_read_rowkey_as_string(BoolValue::default()/* use setters */);
/// ```
pub fn set_read_rowkey_as_string<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.read_rowkey_as_string = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_rowkey_as_string][crate::model::BigtableOptions::read_rowkey_as_string].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_or_clear_read_rowkey_as_string(Some(BoolValue::default()/* use setters */));
/// let x = BigtableOptions::new().set_or_clear_read_rowkey_as_string(None::<BoolValue>);
/// ```
pub fn set_or_clear_read_rowkey_as_string<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.read_rowkey_as_string = v.map(|x| x.into());
self
}
/// Sets the value of [output_column_families_as_json][crate::model::BigtableOptions::output_column_families_as_json].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_output_column_families_as_json(BoolValue::default()/* use setters */);
/// ```
pub fn set_output_column_families_as_json<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.output_column_families_as_json = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_column_families_as_json][crate::model::BigtableOptions::output_column_families_as_json].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BigtableOptions;
/// use wkt::BoolValue;
/// let x = BigtableOptions::new().set_or_clear_output_column_families_as_json(Some(BoolValue::default()/* use setters */));
/// let x = BigtableOptions::new().set_or_clear_output_column_families_as_json(None::<BoolValue>);
/// ```
pub fn set_or_clear_output_column_families_as_json<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.output_column_families_as_json = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BigtableOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BigtableOptions"
}
}
/// Options specific to Google Sheets data sources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GoogleSheetsOptions {
/// Optional. The number of rows at the top of a sheet that BigQuery will skip
/// when reading the data. The default value is 0. This property is useful if
/// you have header rows that should be skipped. When autodetect is on,
/// the behavior is the following:
///
/// * skipLeadingRows unspecified - Autodetect tries to detect headers in the
/// first row. If they are not detected, the row is read as data. Otherwise
/// data is read starting from the second row.
/// * skipLeadingRows is 0 - Instructs autodetect that there are no headers and
/// data should be read starting from the first row.
/// * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect
/// headers in row N. If headers are not detected, row N is just skipped.
/// Otherwise row N is used to extract column names for the detected schema.
pub skip_leading_rows: std::option::Option<wkt::Int64Value>,
/// Optional. Range of a sheet to query from. Only used when non-empty.
/// Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id
/// For example: sheet1!A1:B20
pub range: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GoogleSheetsOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [skip_leading_rows][crate::model::GoogleSheetsOptions::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GoogleSheetsOptions;
/// use wkt::Int64Value;
/// let x = GoogleSheetsOptions::new().set_skip_leading_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_skip_leading_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.skip_leading_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [skip_leading_rows][crate::model::GoogleSheetsOptions::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GoogleSheetsOptions;
/// use wkt::Int64Value;
/// let x = GoogleSheetsOptions::new().set_or_clear_skip_leading_rows(Some(Int64Value::default()/* use setters */));
/// let x = GoogleSheetsOptions::new().set_or_clear_skip_leading_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_skip_leading_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.skip_leading_rows = v.map(|x| x.into());
self
}
/// Sets the value of [range][crate::model::GoogleSheetsOptions::range].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GoogleSheetsOptions;
/// let x = GoogleSheetsOptions::new().set_range("example");
/// ```
pub fn set_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.range = v.into();
self
}
}
impl wkt::message::Message for GoogleSheetsOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GoogleSheetsOptions"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalDataConfiguration {
/// [Required] The fully-qualified URIs that point to your data in Google
/// Cloud. For Google Cloud Storage URIs:
/// Each URI can contain one '*' wildcard character and it must come after
/// the 'bucket' name.
/// Size limits related to load jobs apply to external data sources.
/// For Google Cloud Bigtable URIs:
/// Exactly one URI can be specified and it has be a fully specified and
/// valid HTTPS URL for a Google Cloud Bigtable table.
/// For Google Cloud Datastore backups, exactly one URI can be specified. Also,
/// the '*' wildcard character is not allowed.
pub source_uris: std::vec::Vec<std::string::String>,
/// Optional. Specifies how source URIs are interpreted for constructing the
/// file set to load. By default source URIs are expanded against the
/// underlying storage. Other options include specifying manifest files. Only
/// applicable to object storage systems.
pub file_set_spec_type: crate::model::FileSetSpecType,
/// Optional. The schema for the data.
/// Schema is required for CSV and JSON formats if autodetect is not on.
/// Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups,
/// Avro, ORC and Parquet formats.
pub schema: std::option::Option<crate::model::TableSchema>,
/// [Required] The data format.
/// For CSV files, specify "CSV".
/// For Google sheets, specify "GOOGLE_SHEETS".
/// For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
/// For Avro files, specify "AVRO".
/// For Google Cloud Datastore backups, specify "DATASTORE_BACKUP".
/// For Apache Iceberg tables, specify "ICEBERG".
/// For ORC files, specify "ORC".
/// For Parquet files, specify "PARQUET".
/// [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
pub source_format: std::string::String,
/// Optional. The maximum number of bad records that BigQuery can ignore when
/// reading data. If the number of bad records exceeds this value, an invalid
/// error is returned in the job result. The default value is 0, which requires
/// that all records are valid. This setting is ignored for Google Cloud
/// Bigtable, Google Cloud Datastore backups, Avro, ORC and Parquet formats.
pub max_bad_records: std::option::Option<wkt::Int32Value>,
/// Try to detect schema and format options automatically.
/// Any option specified explicitly will be honored.
pub autodetect: std::option::Option<wkt::BoolValue>,
/// Optional. Indicates if BigQuery should allow extra values that are not
/// represented in the table schema.
/// If true, the extra values are ignored.
/// If false, records with extra columns are treated as bad records, and if
/// there are too many bad records, an invalid error is returned in the job
/// result.
/// The default value is false.
/// The sourceFormat property determines what BigQuery treats as an extra
/// value:
/// CSV: Trailing columns
/// JSON: Named values that don't match any column names
/// Google Cloud Bigtable: This setting is ignored.
/// Google Cloud Datastore backups: This setting is ignored.
/// Avro: This setting is ignored.
/// ORC: This setting is ignored.
/// Parquet: This setting is ignored.
pub ignore_unknown_values: std::option::Option<wkt::BoolValue>,
/// Optional. The compression type of the data source.
/// Possible values include GZIP and NONE. The default value is NONE.
/// This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore
/// backups, Avro, ORC and Parquet
/// formats. An empty string is an invalid value.
pub compression: std::string::String,
/// Optional. Additional properties to set if sourceFormat is set to CSV.
pub csv_options: std::option::Option<crate::model::CsvOptions>,
/// Optional. Additional properties to set if sourceFormat is set to JSON.
pub json_options: std::option::Option<crate::model::JsonOptions>,
/// Optional. Additional options if sourceFormat is set to BIGTABLE.
pub bigtable_options: std::option::Option<crate::model::BigtableOptions>,
/// Optional. Additional options if sourceFormat is set to GOOGLE_SHEETS.
pub google_sheets_options: std::option::Option<crate::model::GoogleSheetsOptions>,
/// Optional. When set, configures hive partitioning support. Not all storage
/// formats support hive partitioning -- requesting hive partitioning on an
/// unsupported format will lead to an error, as will providing an invalid
/// specification.
pub hive_partitioning_options: std::option::Option<crate::model::HivePartitioningOptions>,
/// Optional. The connection specifying the credentials to be used to read
/// external storage, such as Azure Blob, Cloud Storage, or S3. The
/// connection_id can have the form
/// `{project_id}.{location_id};{connection_id}` or
/// `projects/{project_id}/locations/{location_id}/connections/{connection_id}`.
pub connection_id: std::string::String,
/// Defines the list of possible SQL data types to which the source decimal
/// values are converted. This list and the precision and the scale parameters
/// of the decimal field determine the target type. In the order of NUMERIC,
/// BIGNUMERIC, and STRING, a
/// type is picked if it is in the specified list and if it supports the
/// precision and the scale. STRING supports all precision and scale values.
/// If none of the listed types supports the precision and the scale, the type
/// supporting the widest range in the specified list is picked, and if a value
/// exceeds the supported range when reading the data, an error will be thrown.
///
/// Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"].
/// If (precision,scale) is:
///
/// * (38,9) -> NUMERIC;
/// * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits);
/// * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits);
/// * (76,38) -> BIGNUMERIC;
/// * (77,38) -> BIGNUMERIC (error if value exceeds supported range).
///
/// This field cannot contain duplicate types. The order of the types in this
/// field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as
/// ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over
/// BIGNUMERIC.
///
/// Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other
/// file formats.
pub decimal_target_types: std::vec::Vec<crate::model::DecimalTargetType>,
/// Optional. Additional properties to set if sourceFormat is set to AVRO.
pub avro_options: std::option::Option<crate::model::AvroOptions>,
/// Optional. Load option to be used together with source_format
/// newline-delimited JSON to indicate that a variant of JSON is being loaded.
/// To load newline-delimited GeoJSON, specify GEOJSON (and source_format must
/// be set to NEWLINE_DELIMITED_JSON).
pub json_extension: crate::model::JsonExtension,
/// Optional. Additional properties to set if sourceFormat is set to PARQUET.
pub parquet_options: std::option::Option<crate::model::ParquetOptions>,
/// Optional. ObjectMetadata is used to create Object Tables. Object Tables
/// contain a listing of objects (with their metadata) found at the
/// source_uris. If ObjectMetadata is set, source_format should be omitted.
///
/// Currently SIMPLE is the only supported Object Metadata type.
pub object_metadata:
std::option::Option<crate::model::external_data_configuration::ObjectMetadata>,
/// Optional. When creating an external table, the user can provide a reference
/// file with the table schema. This is enabled for the following formats:
/// AVRO, PARQUET, ORC.
pub reference_file_schema_uri: std::option::Option<wkt::StringValue>,
/// Optional. Metadata Cache Mode for the table. Set this to enable caching of
/// metadata from external data source.
pub metadata_cache_mode: crate::model::external_data_configuration::MetadataCacheMode,
/// Optional. Time zone used when parsing timestamp values that do not have
/// specific time zone information (e.g. 2024-04-20 12:34:56). The expected
/// format is a IANA timezone string (e.g. America/Los_Angeles).
pub time_zone: std::option::Option<std::string::String>,
/// Optional. Format used to parse DATE values. Supports C-style and SQL-style
/// values.
pub date_format: std::option::Option<std::string::String>,
/// Optional. Format used to parse DATETIME values. Supports C-style and
/// SQL-style values.
pub datetime_format: std::option::Option<std::string::String>,
/// Optional. Format used to parse TIME values. Supports C-style and SQL-style
/// values.
pub time_format: std::option::Option<std::string::String>,
/// Optional. Format used to parse TIMESTAMP values. Supports C-style and
/// SQL-style values.
pub timestamp_format: std::option::Option<std::string::String>,
/// Precisions (maximum number of total digits in base 10) for seconds
/// of TIMESTAMP types that are allowed to the destination table for
/// autodetection mode.
///
/// Available for the formats: CSV, PARQUET, AVRO, and Iceberg External Table.
///
/// Possible values include:
/// Not Specified, [], or [6]: timestamp(6) for all auto detected TIMESTAMP
/// columns
/// [6, 12]: timestamp(6) for all auto detected TIMESTAMP columns that have
/// less than 6 digits of subseconds.
/// timestamp(12) for all auto detected TIMESTAMP columns that have
/// more than 6 digits of subseconds.
/// [12]: timestamp(12) for all auto detected TIMESTAMP columns.
///
/// The order of the elements in this array is ignored.
/// Inputs that have higher precision than the highest target precision in this
/// array will be truncated.
pub timestamp_target_precision: std::vec::Vec<i32>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalDataConfiguration {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source_uris][crate::model::ExternalDataConfiguration::source_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_source_uris(["a", "b", "c"]);
/// ```
pub fn set_source_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.source_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [file_set_spec_type][crate::model::ExternalDataConfiguration::file_set_spec_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::FileSetSpecType;
/// let x0 = ExternalDataConfiguration::new().set_file_set_spec_type(FileSetSpecType::NewLineDelimitedManifest);
/// ```
pub fn set_file_set_spec_type<T: std::convert::Into<crate::model::FileSetSpecType>>(
mut self,
v: T,
) -> Self {
self.file_set_spec_type = v.into();
self
}
/// Sets the value of [schema][crate::model::ExternalDataConfiguration::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = ExternalDataConfiguration::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::ExternalDataConfiguration::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = ExternalDataConfiguration::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [source_format][crate::model::ExternalDataConfiguration::source_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_source_format("example");
/// ```
pub fn set_source_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source_format = v.into();
self
}
/// Sets the value of [max_bad_records][crate::model::ExternalDataConfiguration::max_bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::Int32Value;
/// let x = ExternalDataConfiguration::new().set_max_bad_records(Int32Value::default()/* use setters */);
/// ```
pub fn set_max_bad_records<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_bad_records = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_bad_records][crate::model::ExternalDataConfiguration::max_bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::Int32Value;
/// let x = ExternalDataConfiguration::new().set_or_clear_max_bad_records(Some(Int32Value::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_max_bad_records(None::<Int32Value>);
/// ```
pub fn set_or_clear_max_bad_records<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_bad_records = v.map(|x| x.into());
self
}
/// Sets the value of [autodetect][crate::model::ExternalDataConfiguration::autodetect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::BoolValue;
/// let x = ExternalDataConfiguration::new().set_autodetect(BoolValue::default()/* use setters */);
/// ```
pub fn set_autodetect<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.autodetect = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [autodetect][crate::model::ExternalDataConfiguration::autodetect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::BoolValue;
/// let x = ExternalDataConfiguration::new().set_or_clear_autodetect(Some(BoolValue::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_autodetect(None::<BoolValue>);
/// ```
pub fn set_or_clear_autodetect<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.autodetect = v.map(|x| x.into());
self
}
/// Sets the value of [ignore_unknown_values][crate::model::ExternalDataConfiguration::ignore_unknown_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::BoolValue;
/// let x = ExternalDataConfiguration::new().set_ignore_unknown_values(BoolValue::default()/* use setters */);
/// ```
pub fn set_ignore_unknown_values<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unknown_values = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ignore_unknown_values][crate::model::ExternalDataConfiguration::ignore_unknown_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::BoolValue;
/// let x = ExternalDataConfiguration::new().set_or_clear_ignore_unknown_values(Some(BoolValue::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_ignore_unknown_values(None::<BoolValue>);
/// ```
pub fn set_or_clear_ignore_unknown_values<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unknown_values = v.map(|x| x.into());
self
}
/// Sets the value of [compression][crate::model::ExternalDataConfiguration::compression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_compression("example");
/// ```
pub fn set_compression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.compression = v.into();
self
}
/// Sets the value of [csv_options][crate::model::ExternalDataConfiguration::csv_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = ExternalDataConfiguration::new().set_csv_options(CsvOptions::default()/* use setters */);
/// ```
pub fn set_csv_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CsvOptions>,
{
self.csv_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [csv_options][crate::model::ExternalDataConfiguration::csv_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::CsvOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_csv_options(Some(CsvOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_csv_options(None::<CsvOptions>);
/// ```
pub fn set_or_clear_csv_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CsvOptions>,
{
self.csv_options = v.map(|x| x.into());
self
}
/// Sets the value of [json_options][crate::model::ExternalDataConfiguration::json_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::JsonOptions;
/// let x = ExternalDataConfiguration::new().set_json_options(JsonOptions::default()/* use setters */);
/// ```
pub fn set_json_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JsonOptions>,
{
self.json_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [json_options][crate::model::ExternalDataConfiguration::json_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::JsonOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_json_options(Some(JsonOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_json_options(None::<JsonOptions>);
/// ```
pub fn set_or_clear_json_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JsonOptions>,
{
self.json_options = v.map(|x| x.into());
self
}
/// Sets the value of [bigtable_options][crate::model::ExternalDataConfiguration::bigtable_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::BigtableOptions;
/// let x = ExternalDataConfiguration::new().set_bigtable_options(BigtableOptions::default()/* use setters */);
/// ```
pub fn set_bigtable_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BigtableOptions>,
{
self.bigtable_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bigtable_options][crate::model::ExternalDataConfiguration::bigtable_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::BigtableOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_bigtable_options(Some(BigtableOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_bigtable_options(None::<BigtableOptions>);
/// ```
pub fn set_or_clear_bigtable_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BigtableOptions>,
{
self.bigtable_options = v.map(|x| x.into());
self
}
/// Sets the value of [google_sheets_options][crate::model::ExternalDataConfiguration::google_sheets_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::GoogleSheetsOptions;
/// let x = ExternalDataConfiguration::new().set_google_sheets_options(GoogleSheetsOptions::default()/* use setters */);
/// ```
pub fn set_google_sheets_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GoogleSheetsOptions>,
{
self.google_sheets_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [google_sheets_options][crate::model::ExternalDataConfiguration::google_sheets_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::GoogleSheetsOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_google_sheets_options(Some(GoogleSheetsOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_google_sheets_options(None::<GoogleSheetsOptions>);
/// ```
pub fn set_or_clear_google_sheets_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GoogleSheetsOptions>,
{
self.google_sheets_options = v.map(|x| x.into());
self
}
/// Sets the value of [hive_partitioning_options][crate::model::ExternalDataConfiguration::hive_partitioning_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = ExternalDataConfiguration::new().set_hive_partitioning_options(HivePartitioningOptions::default()/* use setters */);
/// ```
pub fn set_hive_partitioning_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::HivePartitioningOptions>,
{
self.hive_partitioning_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hive_partitioning_options][crate::model::ExternalDataConfiguration::hive_partitioning_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_hive_partitioning_options(Some(HivePartitioningOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_hive_partitioning_options(None::<HivePartitioningOptions>);
/// ```
pub fn set_or_clear_hive_partitioning_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::HivePartitioningOptions>,
{
self.hive_partitioning_options = v.map(|x| x.into());
self
}
/// Sets the value of [connection_id][crate::model::ExternalDataConfiguration::connection_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_connection_id("example");
/// ```
pub fn set_connection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection_id = v.into();
self
}
/// Sets the value of [decimal_target_types][crate::model::ExternalDataConfiguration::decimal_target_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::DecimalTargetType;
/// let x = ExternalDataConfiguration::new().set_decimal_target_types([
/// DecimalTargetType::Numeric,
/// DecimalTargetType::Bignumeric,
/// DecimalTargetType::String,
/// ]);
/// ```
pub fn set_decimal_target_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::DecimalTargetType>,
{
use std::iter::Iterator;
self.decimal_target_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [avro_options][crate::model::ExternalDataConfiguration::avro_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::AvroOptions;
/// let x = ExternalDataConfiguration::new().set_avro_options(AvroOptions::default()/* use setters */);
/// ```
pub fn set_avro_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AvroOptions>,
{
self.avro_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [avro_options][crate::model::ExternalDataConfiguration::avro_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::AvroOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_avro_options(Some(AvroOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_avro_options(None::<AvroOptions>);
/// ```
pub fn set_or_clear_avro_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AvroOptions>,
{
self.avro_options = v.map(|x| x.into());
self
}
/// Sets the value of [json_extension][crate::model::ExternalDataConfiguration::json_extension].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::JsonExtension;
/// let x0 = ExternalDataConfiguration::new().set_json_extension(JsonExtension::Geojson);
/// ```
pub fn set_json_extension<T: std::convert::Into<crate::model::JsonExtension>>(
mut self,
v: T,
) -> Self {
self.json_extension = v.into();
self
}
/// Sets the value of [parquet_options][crate::model::ExternalDataConfiguration::parquet_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::ParquetOptions;
/// let x = ExternalDataConfiguration::new().set_parquet_options(ParquetOptions::default()/* use setters */);
/// ```
pub fn set_parquet_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ParquetOptions>,
{
self.parquet_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parquet_options][crate::model::ExternalDataConfiguration::parquet_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::ParquetOptions;
/// let x = ExternalDataConfiguration::new().set_or_clear_parquet_options(Some(ParquetOptions::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_parquet_options(None::<ParquetOptions>);
/// ```
pub fn set_or_clear_parquet_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ParquetOptions>,
{
self.parquet_options = v.map(|x| x.into());
self
}
/// Sets the value of [object_metadata][crate::model::ExternalDataConfiguration::object_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::external_data_configuration::ObjectMetadata;
/// let x0 = ExternalDataConfiguration::new().set_object_metadata(ObjectMetadata::Directory);
/// let x1 = ExternalDataConfiguration::new().set_object_metadata(ObjectMetadata::Simple);
/// ```
pub fn set_object_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::external_data_configuration::ObjectMetadata>,
{
self.object_metadata = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [object_metadata][crate::model::ExternalDataConfiguration::object_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::external_data_configuration::ObjectMetadata;
/// let x0 = ExternalDataConfiguration::new().set_or_clear_object_metadata(Some(ObjectMetadata::Directory));
/// let x1 = ExternalDataConfiguration::new().set_or_clear_object_metadata(Some(ObjectMetadata::Simple));
/// let x_none = ExternalDataConfiguration::new().set_or_clear_object_metadata(None::<ObjectMetadata>);
/// ```
pub fn set_or_clear_object_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::external_data_configuration::ObjectMetadata>,
{
self.object_metadata = v.map(|x| x.into());
self
}
/// Sets the value of [reference_file_schema_uri][crate::model::ExternalDataConfiguration::reference_file_schema_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::StringValue;
/// let x = ExternalDataConfiguration::new().set_reference_file_schema_uri(StringValue::default()/* use setters */);
/// ```
pub fn set_reference_file_schema_uri<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.reference_file_schema_uri = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reference_file_schema_uri][crate::model::ExternalDataConfiguration::reference_file_schema_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use wkt::StringValue;
/// let x = ExternalDataConfiguration::new().set_or_clear_reference_file_schema_uri(Some(StringValue::default()/* use setters */));
/// let x = ExternalDataConfiguration::new().set_or_clear_reference_file_schema_uri(None::<StringValue>);
/// ```
pub fn set_or_clear_reference_file_schema_uri<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.reference_file_schema_uri = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_cache_mode][crate::model::ExternalDataConfiguration::metadata_cache_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// use google_cloud_bigquery_v2::model::external_data_configuration::MetadataCacheMode;
/// let x0 = ExternalDataConfiguration::new().set_metadata_cache_mode(MetadataCacheMode::Automatic);
/// let x1 = ExternalDataConfiguration::new().set_metadata_cache_mode(MetadataCacheMode::Manual);
/// ```
pub fn set_metadata_cache_mode<
T: std::convert::Into<crate::model::external_data_configuration::MetadataCacheMode>,
>(
mut self,
v: T,
) -> Self {
self.metadata_cache_mode = v.into();
self
}
/// Sets the value of [time_zone][crate::model::ExternalDataConfiguration::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_time_zone("example");
/// ```
pub fn set_time_zone<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_zone = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_zone][crate::model::ExternalDataConfiguration::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_or_clear_time_zone(Some("example"));
/// let x = ExternalDataConfiguration::new().set_or_clear_time_zone(None::<String>);
/// ```
pub fn set_or_clear_time_zone<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_zone = v.map(|x| x.into());
self
}
/// Sets the value of [date_format][crate::model::ExternalDataConfiguration::date_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_date_format("example");
/// ```
pub fn set_date_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.date_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [date_format][crate::model::ExternalDataConfiguration::date_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_or_clear_date_format(Some("example"));
/// let x = ExternalDataConfiguration::new().set_or_clear_date_format(None::<String>);
/// ```
pub fn set_or_clear_date_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.date_format = v.map(|x| x.into());
self
}
/// Sets the value of [datetime_format][crate::model::ExternalDataConfiguration::datetime_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_datetime_format("example");
/// ```
pub fn set_datetime_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.datetime_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [datetime_format][crate::model::ExternalDataConfiguration::datetime_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_or_clear_datetime_format(Some("example"));
/// let x = ExternalDataConfiguration::new().set_or_clear_datetime_format(None::<String>);
/// ```
pub fn set_or_clear_datetime_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.datetime_format = v.map(|x| x.into());
self
}
/// Sets the value of [time_format][crate::model::ExternalDataConfiguration::time_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_time_format("example");
/// ```
pub fn set_time_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_format][crate::model::ExternalDataConfiguration::time_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_or_clear_time_format(Some("example"));
/// let x = ExternalDataConfiguration::new().set_or_clear_time_format(None::<String>);
/// ```
pub fn set_or_clear_time_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_format = v.map(|x| x.into());
self
}
/// Sets the value of [timestamp_format][crate::model::ExternalDataConfiguration::timestamp_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_timestamp_format("example");
/// ```
pub fn set_timestamp_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.timestamp_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timestamp_format][crate::model::ExternalDataConfiguration::timestamp_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_or_clear_timestamp_format(Some("example"));
/// let x = ExternalDataConfiguration::new().set_or_clear_timestamp_format(None::<String>);
/// ```
pub fn set_or_clear_timestamp_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.timestamp_format = v.map(|x| x.into());
self
}
/// Sets the value of [timestamp_target_precision][crate::model::ExternalDataConfiguration::timestamp_target_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = ExternalDataConfiguration::new().set_timestamp_target_precision([1, 2, 3]);
/// ```
pub fn set_timestamp_target_precision<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.timestamp_target_precision = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ExternalDataConfiguration {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalDataConfiguration"
}
}
/// Defines additional types related to [ExternalDataConfiguration].
pub mod external_data_configuration {
#[allow(unused_imports)]
use super::*;
/// Supported Object Metadata Types.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ObjectMetadata {
/// Unspecified by default.
Unspecified,
/// A synonym for `SIMPLE`.
Directory,
/// Directory listing of objects.
Simple,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ObjectMetadata::value] or
/// [ObjectMetadata::name].
UnknownValue(object_metadata::UnknownValue),
}
#[doc(hidden)]
pub mod object_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ObjectMetadata {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Directory => std::option::Option::Some(1),
Self::Simple => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("OBJECT_METADATA_UNSPECIFIED"),
Self::Directory => std::option::Option::Some("DIRECTORY"),
Self::Simple => std::option::Option::Some("SIMPLE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ObjectMetadata {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ObjectMetadata {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ObjectMetadata {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Directory,
2 => Self::Simple,
_ => Self::UnknownValue(object_metadata::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ObjectMetadata {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OBJECT_METADATA_UNSPECIFIED" => Self::Unspecified,
"DIRECTORY" => Self::Directory,
"SIMPLE" => Self::Simple,
_ => Self::UnknownValue(object_metadata::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ObjectMetadata {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Directory => serializer.serialize_i32(1),
Self::Simple => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ObjectMetadata {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ObjectMetadata>::new(
".google.cloud.bigquery.v2.ExternalDataConfiguration.ObjectMetadata",
))
}
}
/// MetadataCacheMode identifies if the table should use metadata caching for
/// files from external source (eg Google Cloud Storage).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MetadataCacheMode {
/// Unspecified metadata cache mode.
Unspecified,
/// Set this mode to trigger automatic background refresh of metadata cache
/// from the external source. Queries will use the latest available cache
/// version within the table's maxStaleness interval.
Automatic,
/// Set this mode to enable triggering manual refresh of the metadata cache
/// from external source. Queries will use the latest manually triggered
/// cache version within the table's maxStaleness interval.
Manual,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MetadataCacheMode::value] or
/// [MetadataCacheMode::name].
UnknownValue(metadata_cache_mode::UnknownValue),
}
#[doc(hidden)]
pub mod metadata_cache_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MetadataCacheMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Automatic => std::option::Option::Some(1),
Self::Manual => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("METADATA_CACHE_MODE_UNSPECIFIED"),
Self::Automatic => std::option::Option::Some("AUTOMATIC"),
Self::Manual => std::option::Option::Some("MANUAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MetadataCacheMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MetadataCacheMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MetadataCacheMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Automatic,
2 => Self::Manual,
_ => Self::UnknownValue(metadata_cache_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MetadataCacheMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"METADATA_CACHE_MODE_UNSPECIFIED" => Self::Unspecified,
"AUTOMATIC" => Self::Automatic,
"MANUAL" => Self::Manual,
_ => Self::UnknownValue(metadata_cache_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MetadataCacheMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Automatic => serializer.serialize_i32(1),
Self::Manual => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MetadataCacheMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetadataCacheMode>::new(
".google.cloud.bigquery.v2.ExternalDataConfiguration.MetadataCacheMode",
))
}
}
}
/// Configures the access a dataset defined in an external metadata storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalDatasetReference {
/// Required. External source that backs this dataset.
pub external_source: std::string::String,
/// Required. The connection id that is used to access the external_source.
///
/// Format:
/// projects/{project_id}/locations/{location_id}/connections/{connection_id}
pub connection: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalDatasetReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [external_source][crate::model::ExternalDatasetReference::external_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = ExternalDatasetReference::new().set_external_source("example");
/// ```
pub fn set_external_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.external_source = v.into();
self
}
/// Sets the value of [connection][crate::model::ExternalDatasetReference::connection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalDatasetReference;
/// let x = ExternalDatasetReference::new().set_connection("example");
/// ```
pub fn set_connection<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection = v.into();
self
}
}
impl wkt::message::Message for ExternalDatasetReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalDatasetReference"
}
}
/// Provides error statistics for a GenAi function call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiFunctionErrorStats {
/// A list of unique errors at function level (up to 5, truncated to 100
/// chars).
pub errors: std::vec::Vec<std::string::String>,
/// Number of failed rows processed by the function
pub num_failed_rows: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiFunctionErrorStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [errors][crate::model::GenAiFunctionErrorStats::errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionErrorStats;
/// let x = GenAiFunctionErrorStats::new().set_errors(["a", "b", "c"]);
/// ```
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [num_failed_rows][crate::model::GenAiFunctionErrorStats::num_failed_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionErrorStats;
/// let x = GenAiFunctionErrorStats::new().set_num_failed_rows(42);
/// ```
pub fn set_num_failed_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.num_failed_rows = v.into();
self
}
}
impl wkt::message::Message for GenAiFunctionErrorStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiFunctionErrorStats"
}
}
/// Provides cost optimization statistics for a GenAi function call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiFunctionCostOptimizationStats {
/// Number of rows inferred via cost optimized workflow.
pub num_cost_optimized_rows: std::option::Option<i64>,
/// System generated message to provide insights into cost optimization state.
pub message: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiFunctionCostOptimizationStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [num_cost_optimized_rows][crate::model::GenAiFunctionCostOptimizationStats::num_cost_optimized_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionCostOptimizationStats::new().set_num_cost_optimized_rows(42);
/// ```
pub fn set_num_cost_optimized_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.num_cost_optimized_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_cost_optimized_rows][crate::model::GenAiFunctionCostOptimizationStats::num_cost_optimized_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionCostOptimizationStats::new().set_or_clear_num_cost_optimized_rows(Some(42));
/// let x = GenAiFunctionCostOptimizationStats::new().set_or_clear_num_cost_optimized_rows(None::<i32>);
/// ```
pub fn set_or_clear_num_cost_optimized_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.num_cost_optimized_rows = v.map(|x| x.into());
self
}
/// Sets the value of [message][crate::model::GenAiFunctionCostOptimizationStats::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionCostOptimizationStats::new().set_message("example");
/// ```
pub fn set_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message][crate::model::GenAiFunctionCostOptimizationStats::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionCostOptimizationStats::new().set_or_clear_message(Some("example"));
/// let x = GenAiFunctionCostOptimizationStats::new().set_or_clear_message(None::<String>);
/// ```
pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GenAiFunctionCostOptimizationStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiFunctionCostOptimizationStats"
}
}
/// Provides cache statistics for a GenAi function call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiFunctionCacheStats {
/// Number of rows served from cache.
pub num_cache_hit_rows: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiFunctionCacheStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [num_cache_hit_rows][crate::model::GenAiFunctionCacheStats::num_cache_hit_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCacheStats;
/// let x = GenAiFunctionCacheStats::new().set_num_cache_hit_rows(42);
/// ```
pub fn set_num_cache_hit_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.num_cache_hit_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_cache_hit_rows][crate::model::GenAiFunctionCacheStats::num_cache_hit_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionCacheStats;
/// let x = GenAiFunctionCacheStats::new().set_or_clear_num_cache_hit_rows(Some(42));
/// let x = GenAiFunctionCacheStats::new().set_or_clear_num_cache_hit_rows(None::<i32>);
/// ```
pub fn set_or_clear_num_cache_hit_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.num_cache_hit_rows = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GenAiFunctionCacheStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiFunctionCacheStats"
}
}
/// Provides statistics for each Ai function call within a query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiFunctionStats {
/// Name of the function.
pub function_name: std::option::Option<std::string::String>,
/// User input prompt of the function (truncated to 20 chars).
pub prompt: std::option::Option<std::string::String>,
/// Number of rows processed by this GenAi function.
/// This includes all cost_optimized, llm_inferred and failed_rows.
pub num_processed_rows: std::option::Option<i64>,
/// Error stats for the function.
pub error_stats: std::option::Option<crate::model::GenAiFunctionErrorStats>,
/// Cost optimization stats if applied on the rows processed by the function.
pub cost_optimization_stats:
std::option::Option<crate::model::GenAiFunctionCostOptimizationStats>,
/// Cache stats for the function.
pub cache_stats: std::option::Option<crate::model::GenAiFunctionCacheStats>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiFunctionStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [function_name][crate::model::GenAiFunctionStats::function_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_function_name("example");
/// ```
pub fn set_function_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.function_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [function_name][crate::model::GenAiFunctionStats::function_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_or_clear_function_name(Some("example"));
/// let x = GenAiFunctionStats::new().set_or_clear_function_name(None::<String>);
/// ```
pub fn set_or_clear_function_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.function_name = v.map(|x| x.into());
self
}
/// Sets the value of [prompt][crate::model::GenAiFunctionStats::prompt].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_prompt("example");
/// ```
pub fn set_prompt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.prompt = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [prompt][crate::model::GenAiFunctionStats::prompt].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_or_clear_prompt(Some("example"));
/// let x = GenAiFunctionStats::new().set_or_clear_prompt(None::<String>);
/// ```
pub fn set_or_clear_prompt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.prompt = v.map(|x| x.into());
self
}
/// Sets the value of [num_processed_rows][crate::model::GenAiFunctionStats::num_processed_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_num_processed_rows(42);
/// ```
pub fn set_num_processed_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.num_processed_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_processed_rows][crate::model::GenAiFunctionStats::num_processed_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiFunctionStats::new().set_or_clear_num_processed_rows(Some(42));
/// let x = GenAiFunctionStats::new().set_or_clear_num_processed_rows(None::<i32>);
/// ```
pub fn set_or_clear_num_processed_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.num_processed_rows = v.map(|x| x.into());
self
}
/// Sets the value of [error_stats][crate::model::GenAiFunctionStats::error_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionErrorStats;
/// let x = GenAiFunctionStats::new().set_error_stats(GenAiFunctionErrorStats::default()/* use setters */);
/// ```
pub fn set_error_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionErrorStats>,
{
self.error_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_stats][crate::model::GenAiFunctionStats::error_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionErrorStats;
/// let x = GenAiFunctionStats::new().set_or_clear_error_stats(Some(GenAiFunctionErrorStats::default()/* use setters */));
/// let x = GenAiFunctionStats::new().set_or_clear_error_stats(None::<GenAiFunctionErrorStats>);
/// ```
pub fn set_or_clear_error_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionErrorStats>,
{
self.error_stats = v.map(|x| x.into());
self
}
/// Sets the value of [cost_optimization_stats][crate::model::GenAiFunctionStats::cost_optimization_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionStats::new().set_cost_optimization_stats(GenAiFunctionCostOptimizationStats::default()/* use setters */);
/// ```
pub fn set_cost_optimization_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionCostOptimizationStats>,
{
self.cost_optimization_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cost_optimization_stats][crate::model::GenAiFunctionStats::cost_optimization_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionCostOptimizationStats;
/// let x = GenAiFunctionStats::new().set_or_clear_cost_optimization_stats(Some(GenAiFunctionCostOptimizationStats::default()/* use setters */));
/// let x = GenAiFunctionStats::new().set_or_clear_cost_optimization_stats(None::<GenAiFunctionCostOptimizationStats>);
/// ```
pub fn set_or_clear_cost_optimization_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionCostOptimizationStats>,
{
self.cost_optimization_stats = v.map(|x| x.into());
self
}
/// Sets the value of [cache_stats][crate::model::GenAiFunctionStats::cache_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionCacheStats;
/// let x = GenAiFunctionStats::new().set_cache_stats(GenAiFunctionCacheStats::default()/* use setters */);
/// ```
pub fn set_cache_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionCacheStats>,
{
self.cache_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cache_stats][crate::model::GenAiFunctionStats::cache_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionCacheStats;
/// let x = GenAiFunctionStats::new().set_or_clear_cache_stats(Some(GenAiFunctionCacheStats::default()/* use setters */));
/// let x = GenAiFunctionStats::new().set_or_clear_cache_stats(None::<GenAiFunctionCacheStats>);
/// ```
pub fn set_or_clear_cache_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenAiFunctionCacheStats>,
{
self.cache_stats = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GenAiFunctionStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiFunctionStats"
}
}
/// Provides error statistics for the query job across all AI function calls.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiErrorStats {
/// A list of unique errors at query level (up to 5, truncated to 100 chars)
pub errors: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiErrorStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [errors][crate::model::GenAiErrorStats::errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiErrorStats;
/// let x = GenAiErrorStats::new().set_errors(["a", "b", "c"]);
/// ```
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for GenAiErrorStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiErrorStats"
}
}
/// GenAi stats for the query job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenAiStats {
/// Job level error stats across all GenAi functions
pub error_stats: std::option::Option<crate::model::GenAiErrorStats>,
/// Function level stats for GenAI Functions. For more information, see
/// [Generative AI
/// overview](https://docs.cloud.google.com/bigquery/docs/generative-ai-overview).
pub function_stats: std::vec::Vec<crate::model::GenAiFunctionStats>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenAiStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [error_stats][crate::model::GenAiStats::error_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiStats;
/// use google_cloud_bigquery_v2::model::GenAiErrorStats;
/// let x = GenAiStats::new().set_error_stats(GenAiErrorStats::default()/* use setters */);
/// ```
pub fn set_error_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenAiErrorStats>,
{
self.error_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_stats][crate::model::GenAiStats::error_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiStats;
/// use google_cloud_bigquery_v2::model::GenAiErrorStats;
/// let x = GenAiStats::new().set_or_clear_error_stats(Some(GenAiErrorStats::default()/* use setters */));
/// let x = GenAiStats::new().set_or_clear_error_stats(None::<GenAiErrorStats>);
/// ```
pub fn set_or_clear_error_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenAiErrorStats>,
{
self.error_stats = v.map(|x| x.into());
self
}
/// Sets the value of [function_stats][crate::model::GenAiStats::function_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GenAiStats;
/// use google_cloud_bigquery_v2::model::GenAiFunctionStats;
/// let x = GenAiStats::new()
/// .set_function_stats([
/// GenAiFunctionStats::default()/* use setters */,
/// GenAiFunctionStats::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_function_stats<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GenAiFunctionStats>,
{
use std::iter::Iterator;
self.function_stats = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for GenAiStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GenAiStats"
}
}
/// Options for configuring hive partitioning detect.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HivePartitioningOptions {
/// Optional. When set, what mode of hive partitioning to use when reading
/// data. The following modes are supported:
///
/// * AUTO: automatically infer partition key name(s) and type(s).
///
/// * STRINGS: automatically infer partition key name(s). All types are
/// strings.
///
/// * CUSTOM: partition key schema is encoded in the source URI prefix.
///
///
/// Not all storage formats support hive partitioning. Requesting hive
/// partitioning on an unsupported format will lead to an error.
/// Currently supported formats are: JSON, CSV, ORC, Avro and Parquet.
pub mode: std::string::String,
/// Optional. When hive partition detection is requested, a common prefix for
/// all source uris must be required. The prefix must end immediately before
/// the partition key encoding begins. For example, consider files following
/// this data layout:
///
/// gs://bucket/path_to_table/dt=2019-06-01/country=USA/id=7/file.avro
///
/// gs://bucket/path_to_table/dt=2019-05-31/country=CA/id=3/file.avro
///
/// When hive partitioning is requested with either AUTO or STRINGS detection,
/// the common prefix can be either of gs://bucket/path_to_table or
/// gs://bucket/path_to_table/.
///
/// CUSTOM detection requires encoding the partitioning schema immediately
/// after the common prefix. For CUSTOM, any of
///
/// * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:INTEGER}
///
/// * gs://bucket/path_to_table/{dt:STRING}/{country:STRING}/{id:INTEGER}
///
/// * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:STRING}
///
///
/// would all be valid source URI prefixes.
pub source_uri_prefix: std::string::String,
/// Optional. If set to true, queries over this table require a partition
/// filter that can be used for partition elimination to be specified.
///
/// Note that this field should only be true when creating a permanent
/// external table or querying a temporary external table.
///
/// Hive-partitioned loads with require_partition_filter explicitly set to
/// true will fail.
pub require_partition_filter: std::option::Option<wkt::BoolValue>,
/// Output only. For permanent external tables, this field is populated with
/// the hive partition keys in the order they were inferred. The types of the
/// partition keys can be deduced by checking the table schema (which will
/// include the partition keys). Not every API will populate this field in the
/// output. For example, Tables.Get will populate it, but Tables.List will not
/// contain this field.
pub fields: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HivePartitioningOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [mode][crate::model::HivePartitioningOptions::mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = HivePartitioningOptions::new().set_mode("example");
/// ```
pub fn set_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mode = v.into();
self
}
/// Sets the value of [source_uri_prefix][crate::model::HivePartitioningOptions::source_uri_prefix].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = HivePartitioningOptions::new().set_source_uri_prefix("example");
/// ```
pub fn set_source_uri_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.source_uri_prefix = v.into();
self
}
/// Sets the value of [require_partition_filter][crate::model::HivePartitioningOptions::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// use wkt::BoolValue;
/// let x = HivePartitioningOptions::new().set_require_partition_filter(BoolValue::default()/* use setters */);
/// ```
pub fn set_require_partition_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [require_partition_filter][crate::model::HivePartitioningOptions::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// use wkt::BoolValue;
/// let x = HivePartitioningOptions::new().set_or_clear_require_partition_filter(Some(BoolValue::default()/* use setters */));
/// let x = HivePartitioningOptions::new().set_or_clear_require_partition_filter(None::<BoolValue>);
/// ```
pub fn set_or_clear_require_partition_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = v.map(|x| x.into());
self
}
/// Sets the value of [fields][crate::model::HivePartitioningOptions::fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = HivePartitioningOptions::new().set_fields(["a", "b", "c"]);
/// ```
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for HivePartitioningOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.HivePartitioningOptions"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Job {
/// Output only. The type of the resource.
pub kind: std::string::String,
/// Output only. A hash of this resource.
pub etag: std::string::String,
/// Output only. Opaque ID field of the job.
pub id: std::string::String,
/// Output only. A URL that can be used to access the resource again.
pub self_link: std::string::String,
/// Output only. Email address of the user who ran the job.
pub user_email: std::string::String,
/// Required. Describes the job configuration.
pub configuration: std::option::Option<crate::model::JobConfiguration>,
/// Optional. Reference describing the unique-per-user name of the job.
pub job_reference: std::option::Option<crate::model::JobReference>,
/// Output only. Information about the job, including starting time and ending
/// time of the job.
pub statistics: std::option::Option<crate::model::JobStatistics>,
/// Output only. The status of this job. Examine this value when polling an
/// asynchronous job to see if the job is complete.
pub status: std::option::Option<crate::model::JobStatus>,
/// Output only. [Full-projection-only] String representation of identity of
/// requesting party. Populated for both first- and third-party identities.
/// Only present for APIs that support third-party identities.
pub principal_subject: std::string::String,
/// Output only. The reason why a Job was created.
pub job_creation_reason: std::option::Option<crate::model::JobCreationReason>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Job {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::Job::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::Job::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [id][crate::model::Job::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [self_link][crate::model::Job::self_link].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_self_link("example");
/// ```
pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.self_link = v.into();
self
}
/// Sets the value of [user_email][crate::model::Job::user_email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_user_email("example");
/// ```
pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_email = v.into();
self
}
/// Sets the value of [configuration][crate::model::Job::configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = Job::new().set_configuration(JobConfiguration::default()/* use setters */);
/// ```
pub fn set_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfiguration>,
{
self.configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [configuration][crate::model::Job::configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = Job::new().set_or_clear_configuration(Some(JobConfiguration::default()/* use setters */));
/// let x = Job::new().set_or_clear_configuration(None::<JobConfiguration>);
/// ```
pub fn set_or_clear_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfiguration>,
{
self.configuration = v.map(|x| x.into());
self
}
/// Sets the value of [job_reference][crate::model::Job::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = Job::new().set_job_reference(JobReference::default()/* use setters */);
/// ```
pub fn set_job_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_reference][crate::model::Job::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = Job::new().set_or_clear_job_reference(Some(JobReference::default()/* use setters */));
/// let x = Job::new().set_or_clear_job_reference(None::<JobReference>);
/// ```
pub fn set_or_clear_job_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = v.map(|x| x.into());
self
}
/// Sets the value of [statistics][crate::model::Job::statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = Job::new().set_statistics(JobStatistics::default()/* use setters */);
/// ```
pub fn set_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatistics>,
{
self.statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [statistics][crate::model::Job::statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = Job::new().set_or_clear_statistics(Some(JobStatistics::default()/* use setters */));
/// let x = Job::new().set_or_clear_statistics(None::<JobStatistics>);
/// ```
pub fn set_or_clear_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatistics>,
{
self.statistics = v.map(|x| x.into());
self
}
/// Sets the value of [status][crate::model::Job::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobStatus;
/// let x = Job::new().set_status(JobStatus::default()/* use setters */);
/// ```
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatus>,
{
self.status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [status][crate::model::Job::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobStatus;
/// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
/// let x = Job::new().set_or_clear_status(None::<JobStatus>);
/// ```
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatus>,
{
self.status = v.map(|x| x.into());
self
}
/// Sets the value of [principal_subject][crate::model::Job::principal_subject].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// let x = Job::new().set_principal_subject("example");
/// ```
pub fn set_principal_subject<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.principal_subject = v.into();
self
}
/// Sets the value of [job_creation_reason][crate::model::Job::job_creation_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobCreationReason;
/// let x = Job::new().set_job_creation_reason(JobCreationReason::default()/* use setters */);
/// ```
pub fn set_job_creation_reason<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobCreationReason>,
{
self.job_creation_reason = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_creation_reason][crate::model::Job::job_creation_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Job;
/// use google_cloud_bigquery_v2::model::JobCreationReason;
/// let x = Job::new().set_or_clear_job_creation_reason(Some(JobCreationReason::default()/* use setters */));
/// let x = Job::new().set_or_clear_job_creation_reason(None::<JobCreationReason>);
/// ```
pub fn set_or_clear_job_creation_reason<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobCreationReason>,
{
self.job_creation_reason = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Job {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Job"
}
}
/// Describes format of a jobs cancellation request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CancelJobRequest {
/// Required. Project ID of the job to cancel
pub project_id: std::string::String,
/// Required. Job ID of the job to cancel
pub job_id: std::string::String,
/// The geographic location of the job. You must
/// [specify the
/// location](https://cloud.google.com/bigquery/docs/locations#specify_locations)
/// to run the job for the following scenarios:
///
/// * If the location to run a job is not in the `us` or
/// the `eu` multi-regional location
/// * If the job's location is in a single region (for example,
/// `us-central1`)
pub location: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CancelJobRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CancelJobRequest;
/// let x = CancelJobRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CancelJobRequest;
/// let x = CancelJobRequest::new().set_job_id("example");
/// ```
pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_id = v.into();
self
}
/// Sets the value of [location][crate::model::CancelJobRequest::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CancelJobRequest;
/// let x = CancelJobRequest::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
}
impl wkt::message::Message for CancelJobRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.CancelJobRequest"
}
}
/// Describes format of a jobs cancellation response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobCancelResponse {
/// The resource type of the response.
pub kind: std::string::String,
/// The final state of the job.
pub job: std::option::Option<crate::model::Job>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobCancelResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::JobCancelResponse::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobCancelResponse;
/// let x = JobCancelResponse::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [job][crate::model::JobCancelResponse::job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobCancelResponse;
/// use google_cloud_bigquery_v2::model::Job;
/// let x = JobCancelResponse::new().set_job(Job::default()/* use setters */);
/// ```
pub fn set_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Job>,
{
self.job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job][crate::model::JobCancelResponse::job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobCancelResponse;
/// use google_cloud_bigquery_v2::model::Job;
/// let x = JobCancelResponse::new().set_or_clear_job(Some(Job::default()/* use setters */));
/// let x = JobCancelResponse::new().set_or_clear_job(None::<Job>);
/// ```
pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Job>,
{
self.job = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for JobCancelResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobCancelResponse"
}
}
/// Describes format of a jobs get request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetJobRequest {
/// Required. Project ID of the requested job.
pub project_id: std::string::String,
/// Required. Job ID of the requested job.
pub job_id: std::string::String,
/// The geographic location of the job. You must specify the location to run
/// the job for the following scenarios:
///
/// * If the location to run a job is not in the `us` or
/// the `eu` multi-regional location
/// * If the job's location is in a single region (for example,
/// `us-central1`)
///
/// For more information, see how to
/// [specify
/// locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
pub location: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetJobRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetJobRequest;
/// let x = GetJobRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetJobRequest;
/// let x = GetJobRequest::new().set_job_id("example");
/// ```
pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_id = v.into();
self
}
/// Sets the value of [location][crate::model::GetJobRequest::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetJobRequest;
/// let x = GetJobRequest::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
}
impl wkt::message::Message for GetJobRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetJobRequest"
}
}
/// Describes format of a job insertion request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsertJobRequest {
/// Project ID of project that will be billed for the job.
pub project_id: std::string::String,
/// Jobs resource to insert.
pub job: std::option::Option<crate::model::Job>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InsertJobRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::InsertJobRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertJobRequest;
/// let x = InsertJobRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job][crate::model::InsertJobRequest::job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertJobRequest;
/// use google_cloud_bigquery_v2::model::Job;
/// let x = InsertJobRequest::new().set_job(Job::default()/* use setters */);
/// ```
pub fn set_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Job>,
{
self.job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job][crate::model::InsertJobRequest::job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertJobRequest;
/// use google_cloud_bigquery_v2::model::Job;
/// let x = InsertJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
/// let x = InsertJobRequest::new().set_or_clear_job(None::<Job>);
/// ```
pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Job>,
{
self.job = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for InsertJobRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.InsertJobRequest"
}
}
/// Describes the format of a jobs deletion request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteJobRequest {
/// Required. Project ID of the job for which metadata is to be deleted.
pub project_id: std::string::String,
/// Required. Job ID of the job for which metadata is to be deleted. If this is
/// a parent job which has child jobs, the metadata from all child jobs will be
/// deleted as well. Direct deletion of the metadata of child jobs is not
/// allowed.
pub job_id: std::string::String,
/// The geographic location of the job. Required.
///
/// For more information, see how to
/// [specify
/// locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
pub location: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteJobRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteJobRequest;
/// let x = DeleteJobRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteJobRequest;
/// let x = DeleteJobRequest::new().set_job_id("example");
/// ```
pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_id = v.into();
self
}
/// Sets the value of [location][crate::model::DeleteJobRequest::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteJobRequest;
/// let x = DeleteJobRequest::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
}
impl wkt::message::Message for DeleteJobRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteJobRequest"
}
}
/// Describes the format of the list jobs request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListJobsRequest {
/// Project ID of the jobs to list.
pub project_id: std::string::String,
/// Whether to display jobs owned by all users in the project. Default False.
pub all_users: bool,
/// The maximum number of results to return in a single response page.
/// Leverage the page tokens to iterate through the entire collection.
pub max_results: std::option::Option<wkt::Int32Value>,
/// Min value for job creation time, in milliseconds since the POSIX epoch.
/// If set, only jobs created after or at this timestamp are returned.
pub min_creation_time: u64,
/// Max value for job creation time, in milliseconds since the POSIX epoch.
/// If set, only jobs created before or at this timestamp are returned.
pub max_creation_time: std::option::Option<wkt::UInt64Value>,
/// Page token, returned by a previous call, to request the next page of
/// results.
pub page_token: std::string::String,
/// Restrict information returned to a set of selected fields
pub projection: crate::model::list_jobs_request::Projection,
/// Filter for job state
pub state_filter: std::vec::Vec<crate::model::list_jobs_request::StateFilter>,
/// If set, show only child jobs of the specified parent. Otherwise, show all
/// top-level jobs.
pub parent_job_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListJobsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// let x = ListJobsRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [all_users][crate::model::ListJobsRequest::all_users].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// let x = ListJobsRequest::new().set_all_users(true);
/// ```
pub fn set_all_users<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.all_users = v.into();
self
}
/// Sets the value of [max_results][crate::model::ListJobsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use wkt::Int32Value;
/// let x = ListJobsRequest::new().set_max_results(Int32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::ListJobsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use wkt::Int32Value;
/// let x = ListJobsRequest::new().set_or_clear_max_results(Some(Int32Value::default()/* use setters */));
/// let x = ListJobsRequest::new().set_or_clear_max_results(None::<Int32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [min_creation_time][crate::model::ListJobsRequest::min_creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// let x = ListJobsRequest::new().set_min_creation_time(42_u32);
/// ```
pub fn set_min_creation_time<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.min_creation_time = v.into();
self
}
/// Sets the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use wkt::UInt64Value;
/// let x = ListJobsRequest::new().set_max_creation_time(UInt64Value::default()/* use setters */);
/// ```
pub fn set_max_creation_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.max_creation_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use wkt::UInt64Value;
/// let x = ListJobsRequest::new().set_or_clear_max_creation_time(Some(UInt64Value::default()/* use setters */));
/// let x = ListJobsRequest::new().set_or_clear_max_creation_time(None::<UInt64Value>);
/// ```
pub fn set_or_clear_max_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.max_creation_time = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// let x = ListJobsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [projection][crate::model::ListJobsRequest::projection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use google_cloud_bigquery_v2::model::list_jobs_request::Projection;
/// let x0 = ListJobsRequest::new().set_projection(Projection::Full);
/// ```
pub fn set_projection<T: std::convert::Into<crate::model::list_jobs_request::Projection>>(
mut self,
v: T,
) -> Self {
self.projection = v.into();
self
}
/// Sets the value of [state_filter][crate::model::ListJobsRequest::state_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// use google_cloud_bigquery_v2::model::list_jobs_request::StateFilter;
/// let x = ListJobsRequest::new().set_state_filter([
/// StateFilter::Pending,
/// StateFilter::Running,
/// ]);
/// ```
pub fn set_state_filter<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::list_jobs_request::StateFilter>,
{
use std::iter::Iterator;
self.state_filter = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parent_job_id][crate::model::ListJobsRequest::parent_job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListJobsRequest;
/// let x = ListJobsRequest::new().set_parent_job_id("example");
/// ```
pub fn set_parent_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent_job_id = v.into();
self
}
}
impl wkt::message::Message for ListJobsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListJobsRequest"
}
}
/// Defines additional types related to [ListJobsRequest].
pub mod list_jobs_request {
#[allow(unused_imports)]
use super::*;
/// Projection is used to control what job information is returned.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Projection {
/// Does not include the job configuration
Minimal,
/// Includes all job data
Full,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Projection::value] or
/// [Projection::name].
UnknownValue(projection::UnknownValue),
}
#[doc(hidden)]
pub mod projection {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Projection {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Minimal => std::option::Option::Some(0),
Self::Full => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Minimal => std::option::Option::Some("minimal"),
Self::Full => std::option::Option::Some("full"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Projection {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Projection {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Projection {
fn from(value: i32) -> Self {
match value {
0 => Self::Minimal,
1 => Self::Full,
_ => Self::UnknownValue(projection::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Projection {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"minimal" => Self::Minimal,
"MINIMAL" => Self::Minimal,
"full" => Self::Full,
"FULL" => Self::Full,
_ => Self::UnknownValue(projection::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Projection {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Minimal => serializer.serialize_i32(0),
Self::Full => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Projection {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Projection>::new(
".google.cloud.bigquery.v2.ListJobsRequest.Projection",
))
}
}
/// StateFilter allows filtration by job execution state.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StateFilter {
/// Finished jobs
Done,
/// Pending jobs
Pending,
/// Running jobs
Running,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [StateFilter::value] or
/// [StateFilter::name].
UnknownValue(state_filter::UnknownValue),
}
#[doc(hidden)]
pub mod state_filter {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl StateFilter {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Done => std::option::Option::Some(0),
Self::Pending => std::option::Option::Some(1),
Self::Running => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Done => std::option::Option::Some("done"),
Self::Pending => std::option::Option::Some("pending"),
Self::Running => std::option::Option::Some("running"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for StateFilter {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for StateFilter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for StateFilter {
fn from(value: i32) -> Self {
match value {
0 => Self::Done,
1 => Self::Pending,
2 => Self::Running,
_ => Self::UnknownValue(state_filter::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for StateFilter {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"done" => Self::Done,
"DONE" => Self::Done,
"pending" => Self::Pending,
"PENDING" => Self::Pending,
"running" => Self::Running,
"RUNNING" => Self::Running,
_ => Self::UnknownValue(state_filter::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for StateFilter {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Done => serializer.serialize_i32(0),
Self::Pending => serializer.serialize_i32(1),
Self::Running => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for StateFilter {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<StateFilter>::new(
".google.cloud.bigquery.v2.ListJobsRequest.StateFilter",
))
}
}
}
/// ListFormatJob is a partial projection of job information returned as part
/// of a jobs.list response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFormatJob {
/// Unique opaque ID of the job.
pub id: std::string::String,
/// The resource type.
pub kind: std::string::String,
/// Unique opaque ID of the job.
pub job_reference: std::option::Option<crate::model::JobReference>,
/// Running state of the job. When the state is DONE, errorResult can be
/// checked to determine whether the job succeeded or failed.
pub state: std::string::String,
/// A result object that will be present only if the job has failed.
pub error_result: std::option::Option<crate::model::ErrorProto>,
/// Output only. Information about the job, including starting time and ending
/// time of the job.
pub statistics: std::option::Option<crate::model::JobStatistics>,
/// Required. Describes the job configuration.
pub configuration: std::option::Option<crate::model::JobConfiguration>,
/// [Full-projection-only] Describes the status of this job.
pub status: std::option::Option<crate::model::JobStatus>,
/// [Full-projection-only] Email address of the user who ran the job.
pub user_email: std::string::String,
/// [Full-projection-only] String representation of identity of requesting
/// party. Populated for both first- and third-party identities. Only present
/// for APIs that support third-party identities.
pub principal_subject: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFormatJob {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [id][crate::model::ListFormatJob::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = ListFormatJob::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [kind][crate::model::ListFormatJob::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = ListFormatJob::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [job_reference][crate::model::ListFormatJob::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = ListFormatJob::new().set_job_reference(JobReference::default()/* use setters */);
/// ```
pub fn set_job_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_reference][crate::model::ListFormatJob::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = ListFormatJob::new().set_or_clear_job_reference(Some(JobReference::default()/* use setters */));
/// let x = ListFormatJob::new().set_or_clear_job_reference(None::<JobReference>);
/// ```
pub fn set_or_clear_job_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = v.map(|x| x.into());
self
}
/// Sets the value of [state][crate::model::ListFormatJob::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = ListFormatJob::new().set_state("example");
/// ```
pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
/// Sets the value of [error_result][crate::model::ListFormatJob::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ListFormatJob::new().set_error_result(ErrorProto::default()/* use setters */);
/// ```
pub fn set_error_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_result][crate::model::ListFormatJob::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = ListFormatJob::new().set_or_clear_error_result(Some(ErrorProto::default()/* use setters */));
/// let x = ListFormatJob::new().set_or_clear_error_result(None::<ErrorProto>);
/// ```
pub fn set_or_clear_error_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = v.map(|x| x.into());
self
}
/// Sets the value of [statistics][crate::model::ListFormatJob::statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = ListFormatJob::new().set_statistics(JobStatistics::default()/* use setters */);
/// ```
pub fn set_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatistics>,
{
self.statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [statistics][crate::model::ListFormatJob::statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = ListFormatJob::new().set_or_clear_statistics(Some(JobStatistics::default()/* use setters */));
/// let x = ListFormatJob::new().set_or_clear_statistics(None::<JobStatistics>);
/// ```
pub fn set_or_clear_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatistics>,
{
self.statistics = v.map(|x| x.into());
self
}
/// Sets the value of [configuration][crate::model::ListFormatJob::configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = ListFormatJob::new().set_configuration(JobConfiguration::default()/* use setters */);
/// ```
pub fn set_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfiguration>,
{
self.configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [configuration][crate::model::ListFormatJob::configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = ListFormatJob::new().set_or_clear_configuration(Some(JobConfiguration::default()/* use setters */));
/// let x = ListFormatJob::new().set_or_clear_configuration(None::<JobConfiguration>);
/// ```
pub fn set_or_clear_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfiguration>,
{
self.configuration = v.map(|x| x.into());
self
}
/// Sets the value of [status][crate::model::ListFormatJob::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobStatus;
/// let x = ListFormatJob::new().set_status(JobStatus::default()/* use setters */);
/// ```
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatus>,
{
self.status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [status][crate::model::ListFormatJob::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// use google_cloud_bigquery_v2::model::JobStatus;
/// let x = ListFormatJob::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
/// let x = ListFormatJob::new().set_or_clear_status(None::<JobStatus>);
/// ```
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatus>,
{
self.status = v.map(|x| x.into());
self
}
/// Sets the value of [user_email][crate::model::ListFormatJob::user_email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = ListFormatJob::new().set_user_email("example");
/// ```
pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_email = v.into();
self
}
/// Sets the value of [principal_subject][crate::model::ListFormatJob::principal_subject].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = ListFormatJob::new().set_principal_subject("example");
/// ```
pub fn set_principal_subject<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.principal_subject = v.into();
self
}
}
impl wkt::message::Message for ListFormatJob {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListFormatJob"
}
}
/// JobList is the response format for a jobs.list call.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobList {
/// A hash of this page of results.
pub etag: std::string::String,
/// The resource type of the response.
pub kind: std::string::String,
/// A token to request the next page of results.
pub next_page_token: std::string::String,
/// List of jobs that were requested.
pub jobs: std::vec::Vec<crate::model::ListFormatJob>,
/// A list of skipped locations that were unreachable. For more information
/// about BigQuery locations, see:
/// <https://cloud.google.com/bigquery/docs/locations>. Example: "europe-west5"
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [etag][crate::model::JobList::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobList;
/// let x = JobList::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [kind][crate::model::JobList::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobList;
/// let x = JobList::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [next_page_token][crate::model::JobList::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobList;
/// let x = JobList::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
/// Sets the value of [jobs][crate::model::JobList::jobs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobList;
/// use google_cloud_bigquery_v2::model::ListFormatJob;
/// let x = JobList::new()
/// .set_jobs([
/// ListFormatJob::default()/* use setters */,
/// ListFormatJob::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_jobs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ListFormatJob>,
{
use std::iter::Iterator;
self.jobs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [unreachable][crate::model::JobList::unreachable].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobList;
/// let x = JobList::new().set_unreachable(["a", "b", "c"]);
/// ```
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JobList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobList"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for JobList {
type PageItem = crate::model::ListFormatJob;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.jobs
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request object of GetQueryResults.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetQueryResultsRequest {
/// Required. Project ID of the query job.
pub project_id: std::string::String,
/// Required. Job ID of the query job.
pub job_id: std::string::String,
/// Zero-based index of the starting row.
pub start_index: std::option::Option<wkt::UInt64Value>,
/// Page token, returned by a previous call, to request the next page of
/// results.
pub page_token: std::string::String,
/// Maximum number of results to read.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Optional: Specifies the maximum amount of time, in milliseconds, that the
/// client is willing to wait for the query to complete. By default, this limit
/// is 10 seconds (10,000 milliseconds). If the query is complete, the
/// jobComplete field in the response is true. If the query has not yet
/// completed, jobComplete is false.
///
/// You can request a longer timeout period in the timeoutMs field. However,
/// the call is not guaranteed to wait for the specified timeout; it typically
/// returns after around 200 seconds (200,000 milliseconds), even if the query
/// is not complete.
///
/// If jobComplete is false, you can continue to wait for the query to complete
/// by calling the getQueryResults method until the jobComplete field in the
/// getQueryResults response is true.
pub timeout_ms: std::option::Option<wkt::UInt32Value>,
/// The geographic location of the job. You must specify the location to run
/// the job for the following scenarios:
///
/// * If the location to run a job is not in the `us` or
/// the `eu` multi-regional location
/// * If the job's location is in a single region (for example,
/// `us-central1`)
///
/// For more information, see how to
/// [specify
/// locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
pub location: std::string::String,
/// Optional. Output format adjustments.
pub format_options: std::option::Option<crate::model::DataFormatOptions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetQueryResultsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetQueryResultsRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// let x = GetQueryResultsRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job_id][crate::model::GetQueryResultsRequest::job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// let x = GetQueryResultsRequest::new().set_job_id("example");
/// ```
pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_id = v.into();
self
}
/// Sets the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt64Value;
/// let x = GetQueryResultsRequest::new().set_start_index(UInt64Value::default()/* use setters */);
/// ```
pub fn set_start_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.start_index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt64Value;
/// let x = GetQueryResultsRequest::new().set_or_clear_start_index(Some(UInt64Value::default()/* use setters */));
/// let x = GetQueryResultsRequest::new().set_or_clear_start_index(None::<UInt64Value>);
/// ```
pub fn set_or_clear_start_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.start_index = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::GetQueryResultsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// let x = GetQueryResultsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt32Value;
/// let x = GetQueryResultsRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt32Value;
/// let x = GetQueryResultsRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = GetQueryResultsRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt32Value;
/// let x = GetQueryResultsRequest::new().set_timeout_ms(UInt32Value::default()/* use setters */);
/// ```
pub fn set_timeout_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.timeout_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use wkt::UInt32Value;
/// let x = GetQueryResultsRequest::new().set_or_clear_timeout_ms(Some(UInt32Value::default()/* use setters */));
/// let x = GetQueryResultsRequest::new().set_or_clear_timeout_ms(None::<UInt32Value>);
/// ```
pub fn set_or_clear_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.timeout_ms = v.map(|x| x.into());
self
}
/// Sets the value of [location][crate::model::GetQueryResultsRequest::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// let x = GetQueryResultsRequest::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use google_cloud_bigquery_v2::model::DataFormatOptions;
/// let x = GetQueryResultsRequest::new().set_format_options(DataFormatOptions::default()/* use setters */);
/// ```
pub fn set_format_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataFormatOptions>,
{
self.format_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsRequest;
/// use google_cloud_bigquery_v2::model::DataFormatOptions;
/// let x = GetQueryResultsRequest::new().set_or_clear_format_options(Some(DataFormatOptions::default()/* use setters */));
/// let x = GetQueryResultsRequest::new().set_or_clear_format_options(None::<DataFormatOptions>);
/// ```
pub fn set_or_clear_format_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataFormatOptions>,
{
self.format_options = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GetQueryResultsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetQueryResultsRequest"
}
}
/// Response object of GetQueryResults.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetQueryResultsResponse {
/// The resource type of the response.
pub kind: std::string::String,
/// A hash of this response.
pub etag: std::string::String,
/// The schema of the results. Present only when the query completes
/// successfully.
pub schema: std::option::Option<crate::model::TableSchema>,
/// Reference to the BigQuery Job that was created to run the query. This field
/// will be present even if the original request timed out, in which case
/// GetQueryResults can be used to read the results once the query has
/// completed. Since this API only returns the first page of results,
/// subsequent pages can be fetched via the same mechanism (GetQueryResults).
pub job_reference: std::option::Option<crate::model::JobReference>,
/// The total number of rows in the complete query result set, which can be
/// more than the number of rows in this single page of results. Present only
/// when the query completes successfully.
pub total_rows: std::option::Option<wkt::UInt64Value>,
/// A token used for paging results. When this token is non-empty, it
/// indicates additional results are available.
pub page_token: std::string::String,
/// An object with as many results as can be contained within the maximum
/// permitted reply size. To get any additional rows, you can call
/// GetQueryResults and specify the jobReference returned above. Present only
/// when the query completes successfully.
///
/// The REST-based representation of this data leverages a series of
/// JSON f,v objects for indicating fields and values.
pub rows: std::vec::Vec<wkt::Struct>,
/// The total number of bytes processed for this query.
pub total_bytes_processed: std::option::Option<wkt::Int64Value>,
/// Whether the query has completed or not. If rows or totalRows are present,
/// this will always be true. If this is false, totalRows will not be
/// available.
pub job_complete: std::option::Option<wkt::BoolValue>,
/// Output only. The first errors or warnings encountered during the running
/// of the job. The final message includes the number of errors that caused the
/// process to stop. Errors here do not necessarily mean that the job has
/// completed or was unsuccessful. For more information about error messages,
/// see [Error
/// messages](https://cloud.google.com/bigquery/docs/error-messages).
pub errors: std::vec::Vec<crate::model::ErrorProto>,
/// Whether the query result was fetched from the query cache.
pub cache_hit: std::option::Option<wkt::BoolValue>,
/// Output only. The number of rows affected by a DML statement. Present only
/// for DML statements INSERT, UPDATE or DELETE.
pub num_dml_affected_rows: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetQueryResultsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::GetQueryResultsResponse::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// let x = GetQueryResultsResponse::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::GetQueryResultsResponse::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// let x = GetQueryResultsResponse::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [schema][crate::model::GetQueryResultsResponse::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = GetQueryResultsResponse::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::GetQueryResultsResponse::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = GetQueryResultsResponse::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [job_reference][crate::model::GetQueryResultsResponse::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = GetQueryResultsResponse::new().set_job_reference(JobReference::default()/* use setters */);
/// ```
pub fn set_job_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_reference][crate::model::GetQueryResultsResponse::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = GetQueryResultsResponse::new().set_or_clear_job_reference(Some(JobReference::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_job_reference(None::<JobReference>);
/// ```
pub fn set_or_clear_job_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = v.map(|x| x.into());
self
}
/// Sets the value of [total_rows][crate::model::GetQueryResultsResponse::total_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::UInt64Value;
/// let x = GetQueryResultsResponse::new().set_total_rows(UInt64Value::default()/* use setters */);
/// ```
pub fn set_total_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.total_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_rows][crate::model::GetQueryResultsResponse::total_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::UInt64Value;
/// let x = GetQueryResultsResponse::new().set_or_clear_total_rows(Some(UInt64Value::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_total_rows(None::<UInt64Value>);
/// ```
pub fn set_or_clear_total_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.total_rows = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::GetQueryResultsResponse::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// let x = GetQueryResultsResponse::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [rows][crate::model::GetQueryResultsResponse::rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::Struct;
/// let x = GetQueryResultsResponse::new()
/// .set_rows([
/// Struct::default()/* use setters */,
/// Struct::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Struct>,
{
use std::iter::Iterator;
self.rows = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [total_bytes_processed][crate::model::GetQueryResultsResponse::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::Int64Value;
/// let x = GetQueryResultsResponse::new().set_total_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_processed][crate::model::GetQueryResultsResponse::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::Int64Value;
/// let x = GetQueryResultsResponse::new().set_or_clear_total_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_total_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [job_complete][crate::model::GetQueryResultsResponse::job_complete].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::BoolValue;
/// let x = GetQueryResultsResponse::new().set_job_complete(BoolValue::default()/* use setters */);
/// ```
pub fn set_job_complete<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.job_complete = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_complete][crate::model::GetQueryResultsResponse::job_complete].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::BoolValue;
/// let x = GetQueryResultsResponse::new().set_or_clear_job_complete(Some(BoolValue::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_job_complete(None::<BoolValue>);
/// ```
pub fn set_or_clear_job_complete<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.job_complete = v.map(|x| x.into());
self
}
/// Sets the value of [errors][crate::model::GetQueryResultsResponse::errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = GetQueryResultsResponse::new()
/// .set_errors([
/// ErrorProto::default()/* use setters */,
/// ErrorProto::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ErrorProto>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [cache_hit][crate::model::GetQueryResultsResponse::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::BoolValue;
/// let x = GetQueryResultsResponse::new().set_cache_hit(BoolValue::default()/* use setters */);
/// ```
pub fn set_cache_hit<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cache_hit][crate::model::GetQueryResultsResponse::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::BoolValue;
/// let x = GetQueryResultsResponse::new().set_or_clear_cache_hit(Some(BoolValue::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_cache_hit(None::<BoolValue>);
/// ```
pub fn set_or_clear_cache_hit<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = v.map(|x| x.into());
self
}
/// Sets the value of [num_dml_affected_rows][crate::model::GetQueryResultsResponse::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::Int64Value;
/// let x = GetQueryResultsResponse::new().set_num_dml_affected_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_dml_affected_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_dml_affected_rows][crate::model::GetQueryResultsResponse::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetQueryResultsResponse;
/// use wkt::Int64Value;
/// let x = GetQueryResultsResponse::new().set_or_clear_num_dml_affected_rows(Some(Int64Value::default()/* use setters */));
/// let x = GetQueryResultsResponse::new().set_or_clear_num_dml_affected_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_dml_affected_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GetQueryResultsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetQueryResultsResponse"
}
}
/// Request format for the query request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PostQueryRequest {
/// Required. Project ID of the query request.
pub project_id: std::string::String,
/// The query request body.
pub query_request: std::option::Option<crate::model::QueryRequest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PostQueryRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::PostQueryRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PostQueryRequest;
/// let x = PostQueryRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [query_request][crate::model::PostQueryRequest::query_request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PostQueryRequest;
/// use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = PostQueryRequest::new().set_query_request(QueryRequest::default()/* use setters */);
/// ```
pub fn set_query_request<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryRequest>,
{
self.query_request = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_request][crate::model::PostQueryRequest::query_request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PostQueryRequest;
/// use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = PostQueryRequest::new().set_or_clear_query_request(Some(QueryRequest::default()/* use setters */));
/// let x = PostQueryRequest::new().set_or_clear_query_request(None::<QueryRequest>);
/// ```
pub fn set_or_clear_query_request<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryRequest>,
{
self.query_request = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PostQueryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PostQueryRequest"
}
}
/// Describes the format of the jobs.query request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryRequest {
/// The resource type of the request.
pub kind: std::string::String,
/// Required. A query string to execute, using Google Standard SQL or legacy
/// SQL syntax. Example: "SELECT COUNT(f1) FROM
/// myProjectId.myDatasetId.myTableId".
pub query: std::string::String,
/// Optional. The maximum number of rows of data to return per page of
/// results. Setting this flag to a small value such as 1000 and then paging
/// through results might improve reliability when the query result set is
/// large. In addition to this limit, responses are also limited to 10 MB. By
/// default, there is no maximum row count, and only the byte limit applies.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Optional. Specifies the default datasetId and projectId to assume for any
/// unqualified table names in the query. If not set, all table names in the
/// query string must be qualified in the format 'datasetId.tableId'.
pub default_dataset: std::option::Option<crate::model::DatasetReference>,
/// Optional. Optional: Specifies the maximum amount of time, in milliseconds,
/// that the client is willing to wait for the query to complete. By default,
/// this limit is 10 seconds (10,000 milliseconds). If the query is complete,
/// the jobComplete field in the response is true. If the query has not yet
/// completed, jobComplete is false.
///
/// You can request a longer timeout period in the timeoutMs field. However,
/// the call is not guaranteed to wait for the specified timeout; it typically
/// returns after around 200 seconds (200,000 milliseconds), even if the query
/// is not complete.
///
/// If jobComplete is false, you can continue to wait for the query to complete
/// by calling the getQueryResults method until the jobComplete field in the
/// getQueryResults response is true.
pub timeout_ms: std::option::Option<wkt::UInt32Value>,
/// Optional. Job timeout in milliseconds. If this time limit is exceeded,
/// BigQuery will attempt to stop a longer job, but may not always succeed in
/// canceling it before the job completes. For example, a job that takes more
/// than 60 seconds to complete has a better chance of being stopped than a job
/// that takes 10 seconds to complete. This timeout applies to the query even
/// if a job does not need to be created.
pub job_timeout_ms: std::option::Option<i64>,
/// Optional. A target limit on the rate of slot consumption by this query. If
/// set to a value > 0, BigQuery will attempt to limit the rate of slot
/// consumption by this query to keep it below the configured limit, even if
/// the query is eligible for more slots based on fair scheduling. The unused
/// slots will be available for other jobs and queries to use.
///
/// Note: This feature is not yet generally available.
pub max_slots: std::option::Option<i32>,
/// Optional. Custom encryption configuration (e.g., Cloud KMS keys)
pub destination_encryption_configuration:
std::option::Option<crate::model::EncryptionConfiguration>,
/// Optional. If set to true, BigQuery doesn't run the job. Instead, if the
/// query is valid, BigQuery returns statistics about the job such as how many
/// bytes would be processed. If the query is invalid, an error returns. The
/// default value is false.
pub dry_run: bool,
/// Optional. Whether to look for the result in the query cache. The query
/// cache is a best-effort cache that will be flushed whenever tables in the
/// query are modified. The default value is true.
pub use_query_cache: std::option::Option<wkt::BoolValue>,
/// Specifies whether to use BigQuery's legacy SQL dialect for this query. The
/// default value is true. If set to false, the query uses BigQuery's
/// [GoogleSQL](https://docs.cloud.google.com/bigquery/docs/introduction-sql).
/// When useLegacySql is set to false, the value of flattenResults is ignored;
/// query will be run as if flattenResults is false.
pub use_legacy_sql: std::option::Option<wkt::BoolValue>,
/// GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters
/// or to NAMED to use named (@myparam) query parameters in this query.
pub parameter_mode: std::string::String,
/// Query parameters for GoogleSQL queries.
pub query_parameters: std::vec::Vec<crate::model::QueryParameter>,
/// The geographic location where the job should run.
/// For more information, see how to
/// [specify
/// locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
pub location: std::string::String,
/// Optional. Output format adjustments.
pub format_options: std::option::Option<crate::model::DataFormatOptions>,
/// Optional. Connection properties which can modify the query behavior.
pub connection_properties: std::vec::Vec<crate::model::ConnectionProperty>,
/// Optional. The labels associated with this query.
/// Labels can be used to organize and group query jobs.
/// Label keys and values can be no longer than 63 characters, can only contain
/// lowercase letters, numeric characters, underscores and dashes.
/// International characters are allowed. Label keys must start with a letter
/// and each label in the list must have a different key.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. Limits the bytes billed for this query. Queries with
/// bytes billed above this limit will fail (without incurring a charge).
/// If unspecified, the project default is used.
pub maximum_bytes_billed: std::option::Option<wkt::Int64Value>,
/// Optional. A unique user provided identifier to ensure idempotent behavior
/// for queries. Note that this is different from the job_id. It has the
/// following properties:
///
/// 1. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is
/// recommended.
///
/// 1. Read only queries can ignore this token since they are nullipotent by
/// definition.
///
/// 1. For the purposes of idempotency ensured by the request_id, a request
/// is considered duplicate of another only if they have the same request_id
/// and are actually duplicates. When determining whether a request is a
/// duplicate of another request, all parameters in the request that
/// may affect the result are considered. For example, query,
/// connection_properties, query_parameters, use_legacy_sql are parameters
/// that affect the result and are considered when determining whether a
/// request is a duplicate, but properties like timeout_ms don't
/// affect the result and are thus not considered. Dry run query
/// requests are never considered duplicate of another request.
///
/// 1. When a duplicate mutating query request is detected, it returns:
/// a. the results of the mutation if it completes successfully within
/// the timeout.
/// b. the running operation if it is still in progress at the end of the
/// timeout.
///
/// 1. Its lifetime is limited to 15 minutes. In other words, if two
/// requests are sent with the same request_id, but more than 15 minutes
/// apart, idempotency is not guaranteed.
///
pub request_id: std::string::String,
/// Optional. If true, creates a new session using a randomly generated
/// session_id. If false, runs query with an existing session_id passed in
/// ConnectionProperty, otherwise runs query in non-session mode.
///
/// The session location will be set to QueryRequest.location if it is present,
/// otherwise it's set to the default location based on existing routing logic.
pub create_session: std::option::Option<wkt::BoolValue>,
/// Optional. If not set, jobs are always required.
///
/// If set, the query request will follow the behavior described
/// JobCreationMode.
pub job_creation_mode: crate::model::query_request::JobCreationMode,
/// Optional. The reservation that jobs.query request would use. User can
/// specify a reservation to execute the job.query. The expected format is
/// `projects/{project}/locations/{location}/reservations/{reservation}`.
/// Forces the query to use on-demand billing when set to `none`.
/// This requires the project or organization to have
/// `reservation_override_mode` set to `ALLOW_ANY_OVERRIDE`.
pub reservation: std::option::Option<std::string::String>,
/// Optional. This is only supported for SELECT query. If set, the query is
/// allowed to write results incrementally to the temporary result table. This
/// may incur a performance penalty. This option cannot be used with Legacy
/// SQL. This feature is not yet available.
pub write_incremental_results: bool,
/// Optional. The query results format.
/// If the value is anything other than `STRUCT_ENCODING` or unspecified:
///
/// * The schema of the results will be provided in
/// `QueryResponse.results_schema` field.
/// * The results of the first page will be provided in
/// `QueryResponse.results` field.
/// * The `QueryResponse.rows` will not be populated.
/// * The `QueryResponse.schema` for `QueryResponse.rows` will also not be
/// populated since it is the schema of the `QueryResponse.rows`.
///
/// This feature is not yet available.
pub query_results_format: crate::model::query_request::QueryResultsFormat,
/// Results serialization options for `query_results_format` other than
/// `STRUCT_ENCODING`.
///
/// This feature is not yet available.
pub results_format_serialization_options:
std::option::Option<crate::model::query_request::ResultsFormatSerializationOptions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::QueryRequest::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [query][crate::model::QueryRequest::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_query("example");
/// ```
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
/// Sets the value of [max_results][crate::model::QueryRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::UInt32Value;
/// let x = QueryRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::QueryRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::UInt32Value;
/// let x = QueryRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [default_dataset][crate::model::QueryRequest::default_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = QueryRequest::new().set_default_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_default_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.default_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_dataset][crate::model::QueryRequest::default_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = QueryRequest::new().set_or_clear_default_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_default_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_default_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.default_dataset = v.map(|x| x.into());
self
}
/// Sets the value of [timeout_ms][crate::model::QueryRequest::timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::UInt32Value;
/// let x = QueryRequest::new().set_timeout_ms(UInt32Value::default()/* use setters */);
/// ```
pub fn set_timeout_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.timeout_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout_ms][crate::model::QueryRequest::timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::UInt32Value;
/// let x = QueryRequest::new().set_or_clear_timeout_ms(Some(UInt32Value::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_timeout_ms(None::<UInt32Value>);
/// ```
pub fn set_or_clear_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.timeout_ms = v.map(|x| x.into());
self
}
/// Sets the value of [job_timeout_ms][crate::model::QueryRequest::job_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_job_timeout_ms(42);
/// ```
pub fn set_job_timeout_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.job_timeout_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_timeout_ms][crate::model::QueryRequest::job_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_or_clear_job_timeout_ms(Some(42));
/// let x = QueryRequest::new().set_or_clear_job_timeout_ms(None::<i32>);
/// ```
pub fn set_or_clear_job_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.job_timeout_ms = v.map(|x| x.into());
self
}
/// Sets the value of [max_slots][crate::model::QueryRequest::max_slots].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_max_slots(42);
/// ```
pub fn set_max_slots<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i32>,
{
self.max_slots = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_slots][crate::model::QueryRequest::max_slots].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_or_clear_max_slots(Some(42));
/// let x = QueryRequest::new().set_or_clear_max_slots(None::<i32>);
/// ```
pub fn set_or_clear_max_slots<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i32>,
{
self.max_slots = v.map(|x| x.into());
self
}
/// Sets the value of [destination_encryption_configuration][crate::model::QueryRequest::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = QueryRequest::new().set_destination_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_destination_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_encryption_configuration][crate::model::QueryRequest::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = QueryRequest::new().set_or_clear_destination_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_destination_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_destination_encryption_configuration<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [dry_run][crate::model::QueryRequest::dry_run].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_dry_run(true);
/// ```
pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.dry_run = v.into();
self
}
/// Sets the value of [use_query_cache][crate::model::QueryRequest::use_query_cache].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_use_query_cache(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_query_cache<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_query_cache = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_query_cache][crate::model::QueryRequest::use_query_cache].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_or_clear_use_query_cache(Some(BoolValue::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_use_query_cache(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_query_cache<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_query_cache = v.map(|x| x.into());
self
}
/// Sets the value of [use_legacy_sql][crate::model::QueryRequest::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_use_legacy_sql(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_legacy_sql<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_legacy_sql][crate::model::QueryRequest::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_or_clear_use_legacy_sql(Some(BoolValue::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_use_legacy_sql(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_legacy_sql<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = v.map(|x| x.into());
self
}
/// Sets the value of [parameter_mode][crate::model::QueryRequest::parameter_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_parameter_mode("example");
/// ```
pub fn set_parameter_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parameter_mode = v.into();
self
}
/// Sets the value of [query_parameters][crate::model::QueryRequest::query_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::QueryParameter;
/// let x = QueryRequest::new()
/// .set_query_parameters([
/// QueryParameter::default()/* use setters */,
/// QueryParameter::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_query_parameters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryParameter>,
{
use std::iter::Iterator;
self.query_parameters = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [location][crate::model::QueryRequest::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [format_options][crate::model::QueryRequest::format_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::DataFormatOptions;
/// let x = QueryRequest::new().set_format_options(DataFormatOptions::default()/* use setters */);
/// ```
pub fn set_format_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataFormatOptions>,
{
self.format_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [format_options][crate::model::QueryRequest::format_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::DataFormatOptions;
/// let x = QueryRequest::new().set_or_clear_format_options(Some(DataFormatOptions::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_format_options(None::<DataFormatOptions>);
/// ```
pub fn set_or_clear_format_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataFormatOptions>,
{
self.format_options = v.map(|x| x.into());
self
}
/// Sets the value of [connection_properties][crate::model::QueryRequest::connection_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::ConnectionProperty;
/// let x = QueryRequest::new()
/// .set_connection_properties([
/// ConnectionProperty::default()/* use setters */,
/// ConnectionProperty::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_connection_properties<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConnectionProperty>,
{
use std::iter::Iterator;
self.connection_properties = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [labels][crate::model::QueryRequest::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [maximum_bytes_billed][crate::model::QueryRequest::maximum_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::Int64Value;
/// let x = QueryRequest::new().set_maximum_bytes_billed(Int64Value::default()/* use setters */);
/// ```
pub fn set_maximum_bytes_billed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.maximum_bytes_billed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [maximum_bytes_billed][crate::model::QueryRequest::maximum_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::Int64Value;
/// let x = QueryRequest::new().set_or_clear_maximum_bytes_billed(Some(Int64Value::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_maximum_bytes_billed(None::<Int64Value>);
/// ```
pub fn set_or_clear_maximum_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.maximum_bytes_billed = v.map(|x| x.into());
self
}
/// Sets the value of [request_id][crate::model::QueryRequest::request_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_request_id("example");
/// ```
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
/// Sets the value of [create_session][crate::model::QueryRequest::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_create_session(BoolValue::default()/* use setters */);
/// ```
pub fn set_create_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [create_session][crate::model::QueryRequest::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use wkt::BoolValue;
/// let x = QueryRequest::new().set_or_clear_create_session(Some(BoolValue::default()/* use setters */));
/// let x = QueryRequest::new().set_or_clear_create_session(None::<BoolValue>);
/// ```
pub fn set_or_clear_create_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = v.map(|x| x.into());
self
}
/// Sets the value of [job_creation_mode][crate::model::QueryRequest::job_creation_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::query_request::JobCreationMode;
/// let x0 = QueryRequest::new().set_job_creation_mode(JobCreationMode::JobCreationRequired);
/// let x1 = QueryRequest::new().set_job_creation_mode(JobCreationMode::JobCreationOptional);
/// ```
pub fn set_job_creation_mode<
T: std::convert::Into<crate::model::query_request::JobCreationMode>,
>(
mut self,
v: T,
) -> Self {
self.job_creation_mode = v.into();
self
}
/// Sets the value of [reservation][crate::model::QueryRequest::reservation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_reservation("example");
/// ```
pub fn set_reservation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reservation][crate::model::QueryRequest::reservation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_or_clear_reservation(Some("example"));
/// let x = QueryRequest::new().set_or_clear_reservation(None::<String>);
/// ```
pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation = v.map(|x| x.into());
self
}
/// Sets the value of [write_incremental_results][crate::model::QueryRequest::write_incremental_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// let x = QueryRequest::new().set_write_incremental_results(true);
/// ```
pub fn set_write_incremental_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.write_incremental_results = v.into();
self
}
/// Sets the value of [query_results_format][crate::model::QueryRequest::query_results_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::query_request::QueryResultsFormat;
/// let x0 = QueryRequest::new().set_query_results_format(QueryResultsFormat::StructEncoding);
/// let x1 = QueryRequest::new().set_query_results_format(QueryResultsFormat::Arrow);
/// ```
pub fn set_query_results_format<
T: std::convert::Into<crate::model::query_request::QueryResultsFormat>,
>(
mut self,
v: T,
) -> Self {
self.query_results_format = v.into();
self
}
/// Sets the value of [results_format_serialization_options][crate::model::QueryRequest::results_format_serialization_options].
///
/// Note that all the setters affecting `results_format_serialization_options` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::ArrowSerializationOptions;
/// let x = QueryRequest::new().set_results_format_serialization_options(Some(
/// google_cloud_bigquery_v2::model::query_request::ResultsFormatSerializationOptions::ArrowSerializationOptions(ArrowSerializationOptions::default().into())));
/// ```
pub fn set_results_format_serialization_options<
T: std::convert::Into<
std::option::Option<crate::model::query_request::ResultsFormatSerializationOptions>,
>,
>(
mut self,
v: T,
) -> Self {
self.results_format_serialization_options = v.into();
self
}
/// The value of [results_format_serialization_options][crate::model::QueryRequest::results_format_serialization_options]
/// if it holds a `ArrowSerializationOptions`, `None` if the field is not set or
/// holds a different branch.
pub fn arrow_serialization_options(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ArrowSerializationOptions>> {
#[allow(unreachable_patterns)]
self.results_format_serialization_options.as_ref().and_then(|v| match v {
crate::model::query_request::ResultsFormatSerializationOptions::ArrowSerializationOptions(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [results_format_serialization_options][crate::model::QueryRequest::results_format_serialization_options]
/// to hold a `ArrowSerializationOptions`.
///
/// Note that all the setters affecting `results_format_serialization_options` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryRequest;
/// use google_cloud_bigquery_v2::model::ArrowSerializationOptions;
/// let x = QueryRequest::new().set_arrow_serialization_options(ArrowSerializationOptions::default()/* use setters */);
/// assert!(x.arrow_serialization_options().is_some());
/// ```
pub fn set_arrow_serialization_options<
T: std::convert::Into<std::boxed::Box<crate::model::ArrowSerializationOptions>>,
>(
mut self,
v: T,
) -> Self {
self.results_format_serialization_options = std::option::Option::Some(
crate::model::query_request::ResultsFormatSerializationOptions::ArrowSerializationOptions(
v.into()
)
);
self
}
}
impl wkt::message::Message for QueryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryRequest"
}
}
/// Defines additional types related to [QueryRequest].
pub mod query_request {
#[allow(unused_imports)]
use super::*;
/// Job Creation Mode provides different options on job creation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum JobCreationMode {
/// If unspecified JOB_CREATION_REQUIRED is the default.
Unspecified,
/// Default. Job creation is always required.
JobCreationRequired,
/// Job creation is optional. Returning immediate results is prioritized.
/// BigQuery will automatically determine if a Job needs to be created.
/// The conditions under which BigQuery can decide to not create a Job are
/// subject to change. If Job creation is required, JOB_CREATION_REQUIRED
/// mode should be used, which is the default.
JobCreationOptional,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [JobCreationMode::value] or
/// [JobCreationMode::name].
UnknownValue(job_creation_mode::UnknownValue),
}
#[doc(hidden)]
pub mod job_creation_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl JobCreationMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::JobCreationRequired => std::option::Option::Some(1),
Self::JobCreationOptional => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("JOB_CREATION_MODE_UNSPECIFIED"),
Self::JobCreationRequired => std::option::Option::Some("JOB_CREATION_REQUIRED"),
Self::JobCreationOptional => std::option::Option::Some("JOB_CREATION_OPTIONAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for JobCreationMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for JobCreationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for JobCreationMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::JobCreationRequired,
2 => Self::JobCreationOptional,
_ => Self::UnknownValue(job_creation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for JobCreationMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"JOB_CREATION_MODE_UNSPECIFIED" => Self::Unspecified,
"JOB_CREATION_REQUIRED" => Self::JobCreationRequired,
"JOB_CREATION_OPTIONAL" => Self::JobCreationOptional,
_ => Self::UnknownValue(job_creation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for JobCreationMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::JobCreationRequired => serializer.serialize_i32(1),
Self::JobCreationOptional => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for JobCreationMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobCreationMode>::new(
".google.cloud.bigquery.v2.QueryRequest.JobCreationMode",
))
}
}
/// The format of the query results.
///
/// This feature is not yet available.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QueryResultsFormat {
/// If unspecified it will default to struct `QueryResponse.rows`
/// (`STRUCT_ENCODING`)
Unspecified,
/// Default encoding of results as struct in `QueryResponse.rows`
StructEncoding,
/// Arrow is a standard open source column-based message format.
/// See <https://arrow.apache.org/> for more details.
Arrow,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [QueryResultsFormat::value] or
/// [QueryResultsFormat::name].
UnknownValue(query_results_format::UnknownValue),
}
#[doc(hidden)]
pub mod query_results_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl QueryResultsFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::StructEncoding => std::option::Option::Some(1),
Self::Arrow => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("QUERY_RESULTS_FORMAT_UNSPECIFIED"),
Self::StructEncoding => std::option::Option::Some("STRUCT_ENCODING"),
Self::Arrow => std::option::Option::Some("ARROW"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for QueryResultsFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for QueryResultsFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for QueryResultsFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::StructEncoding,
2 => Self::Arrow,
_ => Self::UnknownValue(query_results_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for QueryResultsFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"QUERY_RESULTS_FORMAT_UNSPECIFIED" => Self::Unspecified,
"STRUCT_ENCODING" => Self::StructEncoding,
"ARROW" => Self::Arrow,
_ => Self::UnknownValue(query_results_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for QueryResultsFormat {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::StructEncoding => serializer.serialize_i32(1),
Self::Arrow => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for QueryResultsFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<QueryResultsFormat>::new(
".google.cloud.bigquery.v2.QueryRequest.QueryResultsFormat",
))
}
}
/// Results serialization options for `query_results_format` other than
/// `STRUCT_ENCODING`.
///
/// This feature is not yet available.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ResultsFormatSerializationOptions {
/// Optional. Options specific to the Apache Arrow output format.
ArrowSerializationOptions(std::boxed::Box<crate::model::ArrowSerializationOptions>),
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryResponse {
/// The resource type.
pub kind: std::string::String,
/// The schema of the results. Present only when the query completes
/// successfully.
pub schema: std::option::Option<crate::model::TableSchema>,
/// Reference to the Job that was created to run the query. This field will be
/// present even if the original request timed out, in which case
/// GetQueryResults can be used to read the results once the query has
/// completed. Since this API only returns the first page of results,
/// subsequent pages can be fetched via the same mechanism (GetQueryResults).
///
/// If job_creation_mode was set to `JOB_CREATION_OPTIONAL` and the query
/// completes without creating a job, this field will be empty.
pub job_reference: std::option::Option<crate::model::JobReference>,
/// Optional. The reason why a Job was created.
///
/// Only relevant when a job_reference is present in the response.
/// If job_reference is not present it will always be unset.
pub job_creation_reason: std::option::Option<crate::model::JobCreationReason>,
/// Auto-generated ID for the query.
pub query_id: std::string::String,
/// Output only. The geographic location of the query.
///
/// For more information about BigQuery locations, see:
/// <https://cloud.google.com/bigquery/docs/locations>
pub location: std::string::String,
/// The total number of rows in the complete query result set, which can be
/// more than the number of rows in this single page of results.
pub total_rows: std::option::Option<wkt::UInt64Value>,
/// A token used for paging results. A non-empty token indicates that
/// additional results are available. To see additional results,
/// query the
/// [`jobs.getQueryResults`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults)
/// method. For more information, see [Paging through table
/// data](https://cloud.google.com/bigquery/docs/paging-results).
pub page_token: std::string::String,
/// An object with as many results as can be contained within the maximum
/// permitted reply size. To get any additional rows, you can call
/// GetQueryResults and specify the jobReference returned above.
pub rows: std::vec::Vec<wkt::Struct>,
/// The total number of bytes processed for this query. If this query was a dry
/// run, this is the number of bytes that would be processed if the query were
/// run.
pub total_bytes_processed: std::option::Option<wkt::Int64Value>,
/// Output only. If the project is configured to use on-demand pricing,
/// then this field contains the total bytes billed for the job.
/// If the project is configured to use flat-rate pricing, then you are
/// not billed for bytes and this field is informational only.
pub total_bytes_billed: std::option::Option<i64>,
/// Output only. Number of slot ms the user is actually billed for.
pub total_slot_ms: std::option::Option<i64>,
/// Whether the query has completed or not. If rows or totalRows are present,
/// this will always be true. If this is false, totalRows will not be
/// available.
pub job_complete: std::option::Option<wkt::BoolValue>,
/// Output only. The first errors or warnings encountered during the running of
/// the job. The final message includes the number of errors that caused the
/// process to stop. Errors here do not necessarily mean that the job has
/// completed or was unsuccessful. For more information about error messages,
/// see [Error
/// messages](https://cloud.google.com/bigquery/docs/error-messages).
pub errors: std::vec::Vec<crate::model::ErrorProto>,
/// Whether the query result was fetched from the query cache.
pub cache_hit: std::option::Option<wkt::BoolValue>,
/// Output only. The number of rows affected by a DML statement. Present only
/// for DML statements INSERT, UPDATE or DELETE.
pub num_dml_affected_rows: std::option::Option<wkt::Int64Value>,
/// Output only. Information of the session if this job is part of one.
pub session_info: std::option::Option<crate::model::SessionInfo>,
/// Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE,
/// MERGE or TRUNCATE.
pub dml_stats: std::option::Option<crate::model::DmlStats>,
/// Output only. Creation time of this query, in milliseconds since the epoch.
/// This field will be present on all queries.
pub creation_time: std::option::Option<i64>,
/// Output only. Start time of this query, in milliseconds since the epoch.
/// This field will be present when the query job transitions from the PENDING
/// state to either RUNNING or DONE.
pub start_time: std::option::Option<i64>,
/// Output only. End time of this query, in milliseconds since the epoch. This
/// field will be present whenever a query job is in the DONE state.
pub end_time: std::option::Option<i64>,
/// Output only. The number of rows out of `total_rows` returned in this
/// response.
///
/// This feature is not yet available.
pub page_row_count: i64,
/// Output only. The type of query statement, if valid.
/// Possible values:
///
/// * `SELECT`:
/// [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list)
/// statement.
/// * `ASSERT`:
/// [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert)
/// statement.
/// * `INSERT`:
/// [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement)
/// statement.
/// * `UPDATE`:
/// [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#update_statement)
/// statement.
/// * `DELETE`:
/// [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
/// statement.
/// * `MERGE`:
/// [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
/// statement.
/// * `CREATE_TABLE`: [`CREATE
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
/// statement, without `AS SELECT`.
/// * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS
/// SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
/// statement.
/// * `CREATE_VIEW`: [`CREATE
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement)
/// statement.
/// * `CREATE_MODEL`: [`CREATE
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement)
/// statement.
/// * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement)
/// statement.
/// * `CREATE_FUNCTION`: [`CREATE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement)
/// statement.
/// * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement)
/// statement.
/// * `CREATE_PROCEDURE`: [`CREATE
/// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure)
/// statement.
/// * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS
/// POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement)
/// statement.
/// * `CREATE_SCHEMA`: [`CREATE
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement)
/// statement.
/// * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement)
/// statement.
/// * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH
/// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement)
/// statement.
/// * `DROP_TABLE`: [`DROP
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement)
/// statement.
/// * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement)
/// statement.
/// * `DROP_VIEW`: [`DROP
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement)
/// statement.
/// * `DROP_MODEL`: [`DROP
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model)
/// statement.
/// * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement)
/// statement.
/// * `DROP_FUNCTION` : [`DROP
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement)
/// statement.
/// * `DROP_TABLE_FUNCTION` : [`DROP TABLE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function)
/// statement.
/// * `DROP_PROCEDURE`: [`DROP
/// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement)
/// statement.
/// * `DROP_SEARCH_INDEX`: [`DROP SEARCH
/// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index)
/// statement.
/// * `DROP_SCHEMA`: [`DROP
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement)
/// statement.
/// * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement)
/// statement.
/// * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS
/// POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement)
/// statement.
/// * `ALTER_TABLE`: [`ALTER
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement)
/// statement.
/// * `ALTER_VIEW`: [`ALTER
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement)
/// statement.
/// * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement)
/// statement.
/// * `ALTER_SCHEMA`: [`ALTER
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_schema_set_options_statement)
/// statement.
/// * `SCRIPT`:
/// [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language).
/// * `TRUNCATE_TABLE`: [`TRUNCATE
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement)
/// statement.
/// * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement)
/// statement.
/// * `EXPORT_DATA`: [`EXPORT
/// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement)
/// statement.
/// * `EXPORT_MODEL`: [`EXPORT
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model)
/// statement.
/// * `LOAD_DATA`: [`LOAD
/// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement)
/// statement.
/// * `CALL`:
/// [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call)
/// statement.
pub statement_type: std::string::String,
/// The schema if `query_results_format` has been specified with value other
/// than default `STRUCT_ENCODING`.
///
/// This feature is not yet available.
pub results_schema: std::option::Option<crate::model::query_response::ResultsSchema>,
/// Row data is returned in format when `query_results_format` has been
/// specified with value other than default `STRUCT_ENCODING`.
///
/// This feature is not yet available.
pub results: std::option::Option<crate::model::query_response::Results>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::QueryResponse::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [schema][crate::model::QueryResponse::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = QueryResponse::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::QueryResponse::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = QueryResponse::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [job_reference][crate::model::QueryResponse::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = QueryResponse::new().set_job_reference(JobReference::default()/* use setters */);
/// ```
pub fn set_job_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_reference][crate::model::QueryResponse::job_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = QueryResponse::new().set_or_clear_job_reference(Some(JobReference::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_job_reference(None::<JobReference>);
/// ```
pub fn set_or_clear_job_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.job_reference = v.map(|x| x.into());
self
}
/// Sets the value of [job_creation_reason][crate::model::QueryResponse::job_creation_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::JobCreationReason;
/// let x = QueryResponse::new().set_job_creation_reason(JobCreationReason::default()/* use setters */);
/// ```
pub fn set_job_creation_reason<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobCreationReason>,
{
self.job_creation_reason = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_creation_reason][crate::model::QueryResponse::job_creation_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::JobCreationReason;
/// let x = QueryResponse::new().set_or_clear_job_creation_reason(Some(JobCreationReason::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_job_creation_reason(None::<JobCreationReason>);
/// ```
pub fn set_or_clear_job_creation_reason<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobCreationReason>,
{
self.job_creation_reason = v.map(|x| x.into());
self
}
/// Sets the value of [query_id][crate::model::QueryResponse::query_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_query_id("example");
/// ```
pub fn set_query_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query_id = v.into();
self
}
/// Sets the value of [location][crate::model::QueryResponse::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [total_rows][crate::model::QueryResponse::total_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::UInt64Value;
/// let x = QueryResponse::new().set_total_rows(UInt64Value::default()/* use setters */);
/// ```
pub fn set_total_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.total_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_rows][crate::model::QueryResponse::total_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::UInt64Value;
/// let x = QueryResponse::new().set_or_clear_total_rows(Some(UInt64Value::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_total_rows(None::<UInt64Value>);
/// ```
pub fn set_or_clear_total_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.total_rows = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::QueryResponse::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [rows][crate::model::QueryResponse::rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::Struct;
/// let x = QueryResponse::new()
/// .set_rows([
/// Struct::default()/* use setters */,
/// Struct::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Struct>,
{
use std::iter::Iterator;
self.rows = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [total_bytes_processed][crate::model::QueryResponse::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::Int64Value;
/// let x = QueryResponse::new().set_total_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_processed][crate::model::QueryResponse::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::Int64Value;
/// let x = QueryResponse::new().set_or_clear_total_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_total_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [total_bytes_billed][crate::model::QueryResponse::total_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_total_bytes_billed(42);
/// ```
pub fn set_total_bytes_billed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.total_bytes_billed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_billed][crate::model::QueryResponse::total_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_or_clear_total_bytes_billed(Some(42));
/// let x = QueryResponse::new().set_or_clear_total_bytes_billed(None::<i32>);
/// ```
pub fn set_or_clear_total_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.total_bytes_billed = v.map(|x| x.into());
self
}
/// Sets the value of [total_slot_ms][crate::model::QueryResponse::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_total_slot_ms(42);
/// ```
pub fn set_total_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.total_slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_slot_ms][crate::model::QueryResponse::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_or_clear_total_slot_ms(Some(42));
/// let x = QueryResponse::new().set_or_clear_total_slot_ms(None::<i32>);
/// ```
pub fn set_or_clear_total_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.total_slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [job_complete][crate::model::QueryResponse::job_complete].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::BoolValue;
/// let x = QueryResponse::new().set_job_complete(BoolValue::default()/* use setters */);
/// ```
pub fn set_job_complete<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.job_complete = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_complete][crate::model::QueryResponse::job_complete].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::BoolValue;
/// let x = QueryResponse::new().set_or_clear_job_complete(Some(BoolValue::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_job_complete(None::<BoolValue>);
/// ```
pub fn set_or_clear_job_complete<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.job_complete = v.map(|x| x.into());
self
}
/// Sets the value of [errors][crate::model::QueryResponse::errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = QueryResponse::new()
/// .set_errors([
/// ErrorProto::default()/* use setters */,
/// ErrorProto::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ErrorProto>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [cache_hit][crate::model::QueryResponse::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::BoolValue;
/// let x = QueryResponse::new().set_cache_hit(BoolValue::default()/* use setters */);
/// ```
pub fn set_cache_hit<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cache_hit][crate::model::QueryResponse::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::BoolValue;
/// let x = QueryResponse::new().set_or_clear_cache_hit(Some(BoolValue::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_cache_hit(None::<BoolValue>);
/// ```
pub fn set_or_clear_cache_hit<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = v.map(|x| x.into());
self
}
/// Sets the value of [num_dml_affected_rows][crate::model::QueryResponse::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::Int64Value;
/// let x = QueryResponse::new().set_num_dml_affected_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_dml_affected_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_dml_affected_rows][crate::model::QueryResponse::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use wkt::Int64Value;
/// let x = QueryResponse::new().set_or_clear_num_dml_affected_rows(Some(Int64Value::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_num_dml_affected_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_dml_affected_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = v.map(|x| x.into());
self
}
/// Sets the value of [session_info][crate::model::QueryResponse::session_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::SessionInfo;
/// let x = QueryResponse::new().set_session_info(SessionInfo::default()/* use setters */);
/// ```
pub fn set_session_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SessionInfo>,
{
self.session_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session_info][crate::model::QueryResponse::session_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::SessionInfo;
/// let x = QueryResponse::new().set_or_clear_session_info(Some(SessionInfo::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_session_info(None::<SessionInfo>);
/// ```
pub fn set_or_clear_session_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SessionInfo>,
{
self.session_info = v.map(|x| x.into());
self
}
/// Sets the value of [dml_stats][crate::model::QueryResponse::dml_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::DmlStats;
/// let x = QueryResponse::new().set_dml_stats(DmlStats::default()/* use setters */);
/// ```
pub fn set_dml_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DmlStats>,
{
self.dml_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dml_stats][crate::model::QueryResponse::dml_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::DmlStats;
/// let x = QueryResponse::new().set_or_clear_dml_stats(Some(DmlStats::default()/* use setters */));
/// let x = QueryResponse::new().set_or_clear_dml_stats(None::<DmlStats>);
/// ```
pub fn set_or_clear_dml_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DmlStats>,
{
self.dml_stats = v.map(|x| x.into());
self
}
/// Sets the value of [creation_time][crate::model::QueryResponse::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.creation_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [creation_time][crate::model::QueryResponse::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_or_clear_creation_time(Some(42));
/// let x = QueryResponse::new().set_or_clear_creation_time(None::<i32>);
/// ```
pub fn set_or_clear_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.creation_time = v.map(|x| x.into());
self
}
/// Sets the value of [start_time][crate::model::QueryResponse::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_start_time(42);
/// ```
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_time][crate::model::QueryResponse::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_or_clear_start_time(Some(42));
/// let x = QueryResponse::new().set_or_clear_start_time(None::<i32>);
/// ```
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.start_time = v.map(|x| x.into());
self
}
/// Sets the value of [end_time][crate::model::QueryResponse::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_end_time(42);
/// ```
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [end_time][crate::model::QueryResponse::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_or_clear_end_time(Some(42));
/// let x = QueryResponse::new().set_or_clear_end_time(None::<i32>);
/// ```
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.end_time = v.map(|x| x.into());
self
}
/// Sets the value of [page_row_count][crate::model::QueryResponse::page_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_page_row_count(42);
/// ```
pub fn set_page_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.page_row_count = v.into();
self
}
/// Sets the value of [statement_type][crate::model::QueryResponse::statement_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// let x = QueryResponse::new().set_statement_type("example");
/// ```
pub fn set_statement_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.statement_type = v.into();
self
}
/// Sets the value of [results_schema][crate::model::QueryResponse::results_schema].
///
/// Note that all the setters affecting `results_schema` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::ArrowSchema;
/// let x = QueryResponse::new().set_results_schema(Some(
/// google_cloud_bigquery_v2::model::query_response::ResultsSchema::ArrowSchema(ArrowSchema::default().into())));
/// ```
pub fn set_results_schema<
T: std::convert::Into<std::option::Option<crate::model::query_response::ResultsSchema>>,
>(
mut self,
v: T,
) -> Self {
self.results_schema = v.into();
self
}
/// The value of [results_schema][crate::model::QueryResponse::results_schema]
/// if it holds a `ArrowSchema`, `None` if the field is not set or
/// holds a different branch.
pub fn arrow_schema(&self) -> std::option::Option<&std::boxed::Box<crate::model::ArrowSchema>> {
#[allow(unreachable_patterns)]
self.results_schema.as_ref().and_then(|v| match v {
crate::model::query_response::ResultsSchema::ArrowSchema(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [results_schema][crate::model::QueryResponse::results_schema]
/// to hold a `ArrowSchema`.
///
/// Note that all the setters affecting `results_schema` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::ArrowSchema;
/// let x = QueryResponse::new().set_arrow_schema(ArrowSchema::default()/* use setters */);
/// assert!(x.arrow_schema().is_some());
/// ```
pub fn set_arrow_schema<T: std::convert::Into<std::boxed::Box<crate::model::ArrowSchema>>>(
mut self,
v: T,
) -> Self {
self.results_schema = std::option::Option::Some(
crate::model::query_response::ResultsSchema::ArrowSchema(v.into()),
);
self
}
/// Sets the value of [results][crate::model::QueryResponse::results].
///
/// Note that all the setters affecting `results` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::ArrowRecordBatch;
/// let x = QueryResponse::new().set_results(Some(
/// google_cloud_bigquery_v2::model::query_response::Results::ArrowRecordBatch(ArrowRecordBatch::default().into())));
/// ```
pub fn set_results<
T: std::convert::Into<std::option::Option<crate::model::query_response::Results>>,
>(
mut self,
v: T,
) -> Self {
self.results = v.into();
self
}
/// The value of [results][crate::model::QueryResponse::results]
/// if it holds a `ArrowRecordBatch`, `None` if the field is not set or
/// holds a different branch.
pub fn arrow_record_batch(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ArrowRecordBatch>> {
#[allow(unreachable_patterns)]
self.results.as_ref().and_then(|v| match v {
crate::model::query_response::Results::ArrowRecordBatch(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [results][crate::model::QueryResponse::results]
/// to hold a `ArrowRecordBatch`.
///
/// Note that all the setters affecting `results` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryResponse;
/// use google_cloud_bigquery_v2::model::ArrowRecordBatch;
/// let x = QueryResponse::new().set_arrow_record_batch(ArrowRecordBatch::default()/* use setters */);
/// assert!(x.arrow_record_batch().is_some());
/// ```
pub fn set_arrow_record_batch<
T: std::convert::Into<std::boxed::Box<crate::model::ArrowRecordBatch>>,
>(
mut self,
v: T,
) -> Self {
self.results = std::option::Option::Some(
crate::model::query_response::Results::ArrowRecordBatch(v.into()),
);
self
}
}
impl wkt::message::Message for QueryResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryResponse"
}
}
/// Defines additional types related to [QueryResponse].
pub mod query_response {
#[allow(unused_imports)]
use super::*;
/// The schema if `query_results_format` has been specified with value other
/// than default `STRUCT_ENCODING`.
///
/// This feature is not yet available.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ResultsSchema {
/// Output only. Arrow schema
ArrowSchema(std::boxed::Box<crate::model::ArrowSchema>),
}
/// Row data is returned in format when `query_results_format` has been
/// specified with value other than default `STRUCT_ENCODING`.
///
/// This feature is not yet available.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Results {
/// Output only. Serialized row data in Arrow RecordBatch format.
ArrowRecordBatch(std::boxed::Box<crate::model::ArrowRecordBatch>),
}
}
/// Properties for the destination table.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationTableProperties {
/// Optional. Friendly name for the destination table. If the table already
/// exists, it should be same as the existing friendly name.
pub friendly_name: std::option::Option<wkt::StringValue>,
/// Optional. The description for the destination table.
/// This will only be used if the destination table is newly created.
/// If the table already exists and a value different than the current
/// description is provided, the job will fail.
pub description: std::option::Option<wkt::StringValue>,
/// Optional. The labels associated with this table. You can use these to
/// organize and group your tables. This will only be used if the destination
/// table is newly created. If the table already exists and labels are
/// different than the current labels are provided, the job will fail.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DestinationTableProperties {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [friendly_name][crate::model::DestinationTableProperties::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// use wkt::StringValue;
/// let x = DestinationTableProperties::new().set_friendly_name(StringValue::default()/* use setters */);
/// ```
pub fn set_friendly_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [friendly_name][crate::model::DestinationTableProperties::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// use wkt::StringValue;
/// let x = DestinationTableProperties::new().set_or_clear_friendly_name(Some(StringValue::default()/* use setters */));
/// let x = DestinationTableProperties::new().set_or_clear_friendly_name(None::<StringValue>);
/// ```
pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = v.map(|x| x.into());
self
}
/// Sets the value of [description][crate::model::DestinationTableProperties::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// use wkt::StringValue;
/// let x = DestinationTableProperties::new().set_description(StringValue::default()/* use setters */);
/// ```
pub fn set_description<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [description][crate::model::DestinationTableProperties::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// use wkt::StringValue;
/// let x = DestinationTableProperties::new().set_or_clear_description(Some(StringValue::default()/* use setters */));
/// let x = DestinationTableProperties::new().set_or_clear_description(None::<StringValue>);
/// ```
pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::DestinationTableProperties::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// let x = DestinationTableProperties::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for DestinationTableProperties {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DestinationTableProperties"
}
}
/// A connection-level property to customize query behavior. Under JDBC, these
/// correspond directly to connection properties passed to the DriverManager.
/// Under ODBC, these correspond to properties in the connection string.
///
/// Currently supported connection properties:
///
/// * **dataset_project_id**: represents the default project for datasets that
/// are used in the query. Setting the
/// system variable `@@dataset_project_id` achieves the same behavior. For
/// more information about system variables, see:
/// <https://cloud.google.com/bigquery/docs/reference/system-variables>
///
/// * **time_zone**: represents the default timezone used to run the query.
///
/// * **session_id**: associates the query with a given session.
///
/// * **query_label**: associates the query with a given job label. If set,
/// all subsequent queries in a script or session will have this label. For the
/// format in which a you can specify a query label, see labels
/// in the JobConfiguration resource type:
/// <https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration>
///
/// * **service_account**: indicates the service account to use to run a
/// continuous query. If set, the query job uses the service account to access
/// Google Cloud resources. Service account access is bounded by the IAM
/// permissions that you have granted to the service account.
///
///
/// Additional properties are allowed, but ignored. Specifying multiple
/// connection properties with the same key returns an error.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConnectionProperty {
/// The key of the property to set.
pub key: std::string::String,
/// The value of the property to set.
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConnectionProperty {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [key][crate::model::ConnectionProperty::key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ConnectionProperty;
/// let x = ConnectionProperty::new().set_key("example");
/// ```
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
/// Sets the value of [value][crate::model::ConnectionProperty::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ConnectionProperty;
/// let x = ConnectionProperty::new().set_value("example");
/// ```
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for ConnectionProperty {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ConnectionProperty"
}
}
/// JobConfigurationQuery configures a BigQuery query job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobConfigurationQuery {
/// [Required] SQL query text to execute. The useLegacySql field can be used
/// to indicate whether the query uses legacy SQL or GoogleSQL.
pub query: std::string::String,
/// Optional. Describes the table where the query results should be stored.
/// This property must be set for large results that exceed the maximum
/// response size. For queries that produce anonymous (cached) results, this
/// field will be populated by BigQuery.
pub destination_table: std::option::Option<crate::model::TableReference>,
/// Optional. You can specify external table definitions, which operate as
/// ephemeral tables that can be queried. These definitions are configured
/// using a JSON map, where the string key represents the table identifier, and
/// the value is the corresponding external data configuration object.
pub external_table_definitions:
std::collections::HashMap<std::string::String, crate::model::ExternalDataConfiguration>,
/// Describes user-defined function resources used in the query.
pub user_defined_function_resources: std::vec::Vec<crate::model::UserDefinedFunctionResource>,
/// Optional. Specifies whether the job is allowed to create new tables.
/// The following values are supported:
///
/// * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
/// table.
/// * CREATE_NEVER: The table must already exist. If it does not,
/// a 'notFound' error is returned in the job result.
///
/// The default value is CREATE_IF_NEEDED.
/// Creation, truncation and append actions occur as one atomic update
/// upon job completion.
pub create_disposition: std::string::String,
/// Optional. Specifies the action that occurs if the destination table
/// already exists. The following values are supported:
///
/// * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
/// data, removes the constraints, and uses the schema from the query result.
/// * WRITE_TRUNCATE_DATA: If the table already exists, BigQuery overwrites the
/// data, but keeps the constraints and schema of the existing table.
/// * WRITE_APPEND: If the table already exists, BigQuery appends the data to
/// the table.
/// * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate'
/// error is returned in the job result.
///
/// The default value is WRITE_EMPTY. Each action is atomic and only occurs if
/// BigQuery is able to complete the job successfully. Creation, truncation and
/// append actions occur as one atomic update upon job completion.
pub write_disposition: std::string::String,
/// Optional. Specifies the default dataset to use for unqualified
/// table names in the query. This setting does not alter behavior of
/// unqualified dataset names. Setting the system variable
/// `@@dataset_id` achieves the same behavior. See
/// <https://cloud.google.com/bigquery/docs/reference/system-variables> for more
/// information on system variables.
pub default_dataset: std::option::Option<crate::model::DatasetReference>,
/// Optional. Specifies a priority for the query. Possible values include
/// INTERACTIVE and BATCH. The default value is INTERACTIVE.
pub priority: std::string::String,
/// Optional. If true and query uses legacy SQL dialect, allows the query
/// to produce arbitrarily large result tables at a slight cost in performance.
/// Requires destinationTable to be set.
/// For GoogleSQL queries, this flag is ignored and large results are
/// always allowed. However, you must still set destinationTable when result
/// size exceeds the allowed maximum response size.
pub allow_large_results: std::option::Option<wkt::BoolValue>,
/// Optional. Whether to look for the result in the query cache. The query
/// cache is a best-effort cache that will be flushed whenever tables in the
/// query are modified. Moreover, the query cache is only available when a
/// query does not have a destination table specified. The default value is
/// true.
pub use_query_cache: std::option::Option<wkt::BoolValue>,
/// Optional. If true and query uses legacy SQL dialect, flattens all nested
/// and repeated fields in the query results.
/// allowLargeResults must be true if this is set to false.
/// For GoogleSQL queries, this flag is ignored and results are never
/// flattened.
pub flatten_results: std::option::Option<wkt::BoolValue>,
/// Limits the bytes billed for this job. Queries that will have
/// bytes billed beyond this limit will fail (without incurring a charge).
/// If unspecified, this will be set to your project default.
pub maximum_bytes_billed: std::option::Option<wkt::Int64Value>,
/// Optional. Specifies whether to use BigQuery's legacy SQL dialect for this
/// query. The default value is true. If set to false, the query uses
/// BigQuery's
/// [GoogleSQL](https://docs.cloud.google.com/bigquery/docs/introduction-sql).
///
/// When useLegacySql is set to false, the value of flattenResults is ignored;
/// query will be run as if flattenResults is false.
pub use_legacy_sql: std::option::Option<wkt::BoolValue>,
/// GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters
/// or to NAMED to use named (@myparam) query parameters in this query.
pub parameter_mode: std::string::String,
/// Query parameters for GoogleSQL queries.
pub query_parameters: std::vec::Vec<crate::model::QueryParameter>,
/// Output only. System variables for GoogleSQL queries. A system variable is
/// output if the variable is settable and its value differs from the system
/// default.
/// "@@" prefix is not included in the name of the System variables.
pub system_variables: std::option::Option<crate::model::SystemVariables>,
/// Allows the schema of the destination table to be updated as a side effect
/// of the query job. Schema update options are supported in three cases:
/// when writeDisposition is WRITE_APPEND;
/// when writeDisposition is WRITE_TRUNCATE_DATA;
/// when writeDisposition is WRITE_TRUNCATE and the destination table is a
/// partition of a table, specified by partition decorators. For normal tables,
/// WRITE_TRUNCATE will always overwrite the schema.
/// One or more of the following values are specified:
///
/// * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema.
/// * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original
/// schema to nullable.
pub schema_update_options: std::vec::Vec<std::string::String>,
/// Time-based partitioning specification for the destination table. Only one
/// of timePartitioning and rangePartitioning should be specified.
pub time_partitioning: std::option::Option<crate::model::TimePartitioning>,
/// Range partitioning specification for the destination table.
/// Only one of timePartitioning and rangePartitioning should be specified.
pub range_partitioning: std::option::Option<crate::model::RangePartitioning>,
/// Clustering specification for the destination table.
pub clustering: std::option::Option<crate::model::Clustering>,
/// Custom encryption configuration (e.g., Cloud KMS keys)
pub destination_encryption_configuration:
std::option::Option<crate::model::EncryptionConfiguration>,
/// Options controlling the execution of scripts.
pub script_options: std::option::Option<crate::model::ScriptOptions>,
/// Connection properties which can modify the query behavior.
pub connection_properties: std::vec::Vec<crate::model::ConnectionProperty>,
/// If this property is true, the job creates a new session using a randomly
/// generated session_id. To continue using a created session with
/// subsequent queries, pass the existing session identifier as a
/// `ConnectionProperty` value. The session identifier is returned as part of
/// the `SessionInfo` message within the query statistics.
///
/// The new session's location will be set to `Job.JobReference.location` if it
/// is present, otherwise it's set to the default location based on existing
/// routing logic.
pub create_session: std::option::Option<wkt::BoolValue>,
/// Optional. Whether to run the query as continuous or a regular query.
/// Continuous query is currently in experimental stage and not ready for
/// general usage.
pub continuous: std::option::Option<wkt::BoolValue>,
/// Optional. This is only supported for a SELECT query using a temporary
/// table. If set, the query is allowed to write results incrementally to the
/// temporary result table. This may incur a performance penalty. This option
/// cannot be used with Legacy SQL. This feature is not yet available.
pub write_incremental_results: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobConfigurationQuery {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query][crate::model::JobConfigurationQuery::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_query("example");
/// ```
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
/// Sets the value of [destination_table][crate::model::JobConfigurationQuery::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationQuery::new().set_destination_table(TableReference::default()/* use setters */);
/// ```
pub fn set_destination_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_table][crate::model::JobConfigurationQuery::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationQuery::new().set_or_clear_destination_table(Some(TableReference::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_destination_table(None::<TableReference>);
/// ```
pub fn set_or_clear_destination_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = v.map(|x| x.into());
self
}
/// Sets the value of [external_table_definitions][crate::model::JobConfigurationQuery::external_table_definitions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = JobConfigurationQuery::new().set_external_table_definitions([
/// ("key0", ExternalDataConfiguration::default()/* use setters */),
/// ("key1", ExternalDataConfiguration::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_external_table_definitions<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::ExternalDataConfiguration>,
{
use std::iter::Iterator;
self.external_table_definitions =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [user_defined_function_resources][crate::model::JobConfigurationQuery::user_defined_function_resources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// let x = JobConfigurationQuery::new()
/// .set_user_defined_function_resources([
/// UserDefinedFunctionResource::default()/* use setters */,
/// UserDefinedFunctionResource::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_user_defined_function_resources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UserDefinedFunctionResource>,
{
use std::iter::Iterator;
self.user_defined_function_resources = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [create_disposition][crate::model::JobConfigurationQuery::create_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_create_disposition("example");
/// ```
pub fn set_create_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.create_disposition = v.into();
self
}
/// Sets the value of [write_disposition][crate::model::JobConfigurationQuery::write_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_write_disposition("example");
/// ```
pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.write_disposition = v.into();
self
}
/// Sets the value of [default_dataset][crate::model::JobConfigurationQuery::default_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobConfigurationQuery::new().set_default_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_default_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.default_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_dataset][crate::model::JobConfigurationQuery::default_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobConfigurationQuery::new().set_or_clear_default_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_default_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_default_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.default_dataset = v.map(|x| x.into());
self
}
/// Sets the value of [priority][crate::model::JobConfigurationQuery::priority].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_priority("example");
/// ```
pub fn set_priority<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.priority = v.into();
self
}
/// Sets the value of [allow_large_results][crate::model::JobConfigurationQuery::allow_large_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_allow_large_results(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_large_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_large_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_large_results][crate::model::JobConfigurationQuery::allow_large_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_allow_large_results(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_allow_large_results(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_large_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_large_results = v.map(|x| x.into());
self
}
/// Sets the value of [use_query_cache][crate::model::JobConfigurationQuery::use_query_cache].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_use_query_cache(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_query_cache<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_query_cache = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_query_cache][crate::model::JobConfigurationQuery::use_query_cache].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_use_query_cache(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_use_query_cache(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_query_cache<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_query_cache = v.map(|x| x.into());
self
}
/// Sets the value of [flatten_results][crate::model::JobConfigurationQuery::flatten_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_flatten_results(BoolValue::default()/* use setters */);
/// ```
pub fn set_flatten_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.flatten_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [flatten_results][crate::model::JobConfigurationQuery::flatten_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_flatten_results(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_flatten_results(None::<BoolValue>);
/// ```
pub fn set_or_clear_flatten_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.flatten_results = v.map(|x| x.into());
self
}
/// Sets the value of [maximum_bytes_billed][crate::model::JobConfigurationQuery::maximum_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::Int64Value;
/// let x = JobConfigurationQuery::new().set_maximum_bytes_billed(Int64Value::default()/* use setters */);
/// ```
pub fn set_maximum_bytes_billed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.maximum_bytes_billed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [maximum_bytes_billed][crate::model::JobConfigurationQuery::maximum_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::Int64Value;
/// let x = JobConfigurationQuery::new().set_or_clear_maximum_bytes_billed(Some(Int64Value::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_maximum_bytes_billed(None::<Int64Value>);
/// ```
pub fn set_or_clear_maximum_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.maximum_bytes_billed = v.map(|x| x.into());
self
}
/// Sets the value of [use_legacy_sql][crate::model::JobConfigurationQuery::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_use_legacy_sql(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_legacy_sql<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_legacy_sql][crate::model::JobConfigurationQuery::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_use_legacy_sql(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_use_legacy_sql(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_legacy_sql<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = v.map(|x| x.into());
self
}
/// Sets the value of [parameter_mode][crate::model::JobConfigurationQuery::parameter_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_parameter_mode("example");
/// ```
pub fn set_parameter_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parameter_mode = v.into();
self
}
/// Sets the value of [query_parameters][crate::model::JobConfigurationQuery::query_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::QueryParameter;
/// let x = JobConfigurationQuery::new()
/// .set_query_parameters([
/// QueryParameter::default()/* use setters */,
/// QueryParameter::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_query_parameters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryParameter>,
{
use std::iter::Iterator;
self.query_parameters = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [system_variables][crate::model::JobConfigurationQuery::system_variables].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::SystemVariables;
/// let x = JobConfigurationQuery::new().set_system_variables(SystemVariables::default()/* use setters */);
/// ```
pub fn set_system_variables<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SystemVariables>,
{
self.system_variables = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [system_variables][crate::model::JobConfigurationQuery::system_variables].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::SystemVariables;
/// let x = JobConfigurationQuery::new().set_or_clear_system_variables(Some(SystemVariables::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_system_variables(None::<SystemVariables>);
/// ```
pub fn set_or_clear_system_variables<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SystemVariables>,
{
self.system_variables = v.map(|x| x.into());
self
}
/// Sets the value of [schema_update_options][crate::model::JobConfigurationQuery::schema_update_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_schema_update_options(["a", "b", "c"]);
/// ```
pub fn set_schema_update_options<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.schema_update_options = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [time_partitioning][crate::model::JobConfigurationQuery::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = JobConfigurationQuery::new().set_time_partitioning(TimePartitioning::default()/* use setters */);
/// ```
pub fn set_time_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_partitioning][crate::model::JobConfigurationQuery::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = JobConfigurationQuery::new().set_or_clear_time_partitioning(Some(TimePartitioning::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_time_partitioning(None::<TimePartitioning>);
/// ```
pub fn set_or_clear_time_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [range_partitioning][crate::model::JobConfigurationQuery::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = JobConfigurationQuery::new().set_range_partitioning(RangePartitioning::default()/* use setters */);
/// ```
pub fn set_range_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range_partitioning][crate::model::JobConfigurationQuery::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = JobConfigurationQuery::new().set_or_clear_range_partitioning(Some(RangePartitioning::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_range_partitioning(None::<RangePartitioning>);
/// ```
pub fn set_or_clear_range_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [clustering][crate::model::JobConfigurationQuery::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = JobConfigurationQuery::new().set_clustering(Clustering::default()/* use setters */);
/// ```
pub fn set_clustering<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clustering][crate::model::JobConfigurationQuery::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = JobConfigurationQuery::new().set_or_clear_clustering(Some(Clustering::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_clustering(None::<Clustering>);
/// ```
pub fn set_or_clear_clustering<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = v.map(|x| x.into());
self
}
/// Sets the value of [destination_encryption_configuration][crate::model::JobConfigurationQuery::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationQuery::new().set_destination_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_destination_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_encryption_configuration][crate::model::JobConfigurationQuery::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationQuery::new().set_or_clear_destination_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_destination_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_destination_encryption_configuration<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [script_options][crate::model::JobConfigurationQuery::script_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::ScriptOptions;
/// let x = JobConfigurationQuery::new().set_script_options(ScriptOptions::default()/* use setters */);
/// ```
pub fn set_script_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ScriptOptions>,
{
self.script_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [script_options][crate::model::JobConfigurationQuery::script_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::ScriptOptions;
/// let x = JobConfigurationQuery::new().set_or_clear_script_options(Some(ScriptOptions::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_script_options(None::<ScriptOptions>);
/// ```
pub fn set_or_clear_script_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ScriptOptions>,
{
self.script_options = v.map(|x| x.into());
self
}
/// Sets the value of [connection_properties][crate::model::JobConfigurationQuery::connection_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use google_cloud_bigquery_v2::model::ConnectionProperty;
/// let x = JobConfigurationQuery::new()
/// .set_connection_properties([
/// ConnectionProperty::default()/* use setters */,
/// ConnectionProperty::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_connection_properties<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConnectionProperty>,
{
use std::iter::Iterator;
self.connection_properties = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [create_session][crate::model::JobConfigurationQuery::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_create_session(BoolValue::default()/* use setters */);
/// ```
pub fn set_create_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [create_session][crate::model::JobConfigurationQuery::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_create_session(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_create_session(None::<BoolValue>);
/// ```
pub fn set_or_clear_create_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = v.map(|x| x.into());
self
}
/// Sets the value of [continuous][crate::model::JobConfigurationQuery::continuous].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_continuous(BoolValue::default()/* use setters */);
/// ```
pub fn set_continuous<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.continuous = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [continuous][crate::model::JobConfigurationQuery::continuous].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// use wkt::BoolValue;
/// let x = JobConfigurationQuery::new().set_or_clear_continuous(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationQuery::new().set_or_clear_continuous(None::<BoolValue>);
/// ```
pub fn set_or_clear_continuous<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.continuous = v.map(|x| x.into());
self
}
/// Sets the value of [write_incremental_results][crate::model::JobConfigurationQuery::write_incremental_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfigurationQuery::new().set_write_incremental_results(true);
/// ```
pub fn set_write_incremental_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.write_incremental_results = v.into();
self
}
}
impl wkt::message::Message for JobConfigurationQuery {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfigurationQuery"
}
}
/// Options related to script execution.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ScriptOptions {
/// Timeout period for each statement in a script.
pub statement_timeout_ms: std::option::Option<wkt::Int64Value>,
/// Limit on the number of bytes billed per statement. Exceeding this budget
/// results in an error.
pub statement_byte_budget: std::option::Option<wkt::Int64Value>,
/// Determines which statement in the script represents the "key result",
/// used to populate the schema and query results of the script job.
/// Default is LAST.
pub key_result_statement: crate::model::script_options::KeyResultStatementKind,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ScriptOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [statement_timeout_ms][crate::model::ScriptOptions::statement_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptOptions;
/// use wkt::Int64Value;
/// let x = ScriptOptions::new().set_statement_timeout_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_statement_timeout_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.statement_timeout_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [statement_timeout_ms][crate::model::ScriptOptions::statement_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptOptions;
/// use wkt::Int64Value;
/// let x = ScriptOptions::new().set_or_clear_statement_timeout_ms(Some(Int64Value::default()/* use setters */));
/// let x = ScriptOptions::new().set_or_clear_statement_timeout_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_statement_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.statement_timeout_ms = v.map(|x| x.into());
self
}
/// Sets the value of [statement_byte_budget][crate::model::ScriptOptions::statement_byte_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptOptions;
/// use wkt::Int64Value;
/// let x = ScriptOptions::new().set_statement_byte_budget(Int64Value::default()/* use setters */);
/// ```
pub fn set_statement_byte_budget<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.statement_byte_budget = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [statement_byte_budget][crate::model::ScriptOptions::statement_byte_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptOptions;
/// use wkt::Int64Value;
/// let x = ScriptOptions::new().set_or_clear_statement_byte_budget(Some(Int64Value::default()/* use setters */));
/// let x = ScriptOptions::new().set_or_clear_statement_byte_budget(None::<Int64Value>);
/// ```
pub fn set_or_clear_statement_byte_budget<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.statement_byte_budget = v.map(|x| x.into());
self
}
/// Sets the value of [key_result_statement][crate::model::ScriptOptions::key_result_statement].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptOptions;
/// use google_cloud_bigquery_v2::model::script_options::KeyResultStatementKind;
/// let x0 = ScriptOptions::new().set_key_result_statement(KeyResultStatementKind::Last);
/// let x1 = ScriptOptions::new().set_key_result_statement(KeyResultStatementKind::FirstSelect);
/// ```
pub fn set_key_result_statement<
T: std::convert::Into<crate::model::script_options::KeyResultStatementKind>,
>(
mut self,
v: T,
) -> Self {
self.key_result_statement = v.into();
self
}
}
impl wkt::message::Message for ScriptOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ScriptOptions"
}
}
/// Defines additional types related to [ScriptOptions].
pub mod script_options {
#[allow(unused_imports)]
use super::*;
/// KeyResultStatementKind controls how the key result is determined.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum KeyResultStatementKind {
/// Default value.
Unspecified,
/// The last result determines the key result.
Last,
/// The first SELECT statement determines the key result.
FirstSelect,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [KeyResultStatementKind::value] or
/// [KeyResultStatementKind::name].
UnknownValue(key_result_statement_kind::UnknownValue),
}
#[doc(hidden)]
pub mod key_result_statement_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl KeyResultStatementKind {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Last => std::option::Option::Some(1),
Self::FirstSelect => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("KEY_RESULT_STATEMENT_KIND_UNSPECIFIED")
}
Self::Last => std::option::Option::Some("LAST"),
Self::FirstSelect => std::option::Option::Some("FIRST_SELECT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for KeyResultStatementKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for KeyResultStatementKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for KeyResultStatementKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Last,
2 => Self::FirstSelect,
_ => Self::UnknownValue(key_result_statement_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for KeyResultStatementKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KEY_RESULT_STATEMENT_KIND_UNSPECIFIED" => Self::Unspecified,
"LAST" => Self::Last,
"FIRST_SELECT" => Self::FirstSelect,
_ => Self::UnknownValue(key_result_statement_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for KeyResultStatementKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Last => serializer.serialize_i32(1),
Self::FirstSelect => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for KeyResultStatementKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyResultStatementKind>::new(
".google.cloud.bigquery.v2.ScriptOptions.KeyResultStatementKind",
))
}
}
}
/// JobConfigurationLoad contains the configuration properties for loading data
/// into a destination table.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobConfigurationLoad {
/// [Required] The fully-qualified URIs that point to your data in Google
/// Cloud.
/// For Google Cloud Storage URIs:
/// Each URI can contain one '*' wildcard character and it must come after
/// the 'bucket' name. Size limits related to load jobs apply to external
/// data sources.
/// For Google Cloud Bigtable URIs:
/// Exactly one URI can be specified and it has be a fully specified and
/// valid HTTPS URL for a Google Cloud Bigtable table.
/// For Google Cloud Datastore backups:
/// Exactly one URI can be specified. Also, the '*' wildcard character is not
/// allowed.
pub source_uris: std::vec::Vec<std::string::String>,
/// Optional. Specifies how source URIs are interpreted for constructing the
/// file set to load. By default, source URIs are expanded against the
/// underlying storage. You can also specify manifest files to control how the
/// file set is constructed. This option is only applicable to object storage
/// systems.
pub file_set_spec_type: crate::model::FileSetSpecType,
/// Optional. The schema for the destination table. The schema can be
/// omitted if the destination table already exists, or if you're loading data
/// from Google Cloud Datastore.
pub schema: std::option::Option<crate::model::TableSchema>,
/// [Required] The destination table to load the data into.
pub destination_table: std::option::Option<crate::model::TableReference>,
/// Optional. [Experimental] Properties with which to create the destination
/// table if it is new.
pub destination_table_properties: std::option::Option<crate::model::DestinationTableProperties>,
/// Optional. Specifies whether the job is allowed to create new tables.
/// The following values are supported:
///
/// * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
/// table.
/// * CREATE_NEVER: The table must already exist. If it does not,
/// a 'notFound' error is returned in the job result.
/// The default value is CREATE_IF_NEEDED.
/// Creation, truncation and append actions occur as one atomic update
/// upon job completion.
pub create_disposition: std::string::String,
/// Optional. Specifies the action that occurs if the destination table
/// already exists. The following values are supported:
///
/// * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
/// data, removes the constraints and uses the schema from the load job.
/// * WRITE_TRUNCATE_DATA: If the table already exists, BigQuery overwrites the
/// data, but keeps the constraints and schema of the existing table.
/// * WRITE_APPEND: If the table already exists, BigQuery appends the data to
/// the table.
/// * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate'
/// error is returned in the job result.
///
/// The default value is WRITE_APPEND.
/// Each action is atomic and only occurs if BigQuery is able to complete the
/// job successfully.
/// Creation, truncation and append actions occur as one atomic update
/// upon job completion.
pub write_disposition: std::string::String,
/// Optional. Specifies a string that represents a null value in a CSV file.
/// For example, if you specify "\N", BigQuery interprets "\N" as a null value
/// when loading a CSV file.
/// The default value is the empty string. If you set this property to a custom
/// value, BigQuery throws an error if an empty string is present for all data
/// types except for STRING and BYTE. For STRING and BYTE columns, BigQuery
/// interprets the empty string as an empty value.
pub null_marker: std::option::Option<wkt::StringValue>,
/// Optional. The separator character for fields in a CSV file. The separator
/// is interpreted as a single byte. For files encoded in ISO-8859-1, any
/// single character can be used as a separator. For files encoded in UTF-8,
/// characters represented in decimal range 1-127 (U+0001-U+007F) can be used
/// without any modification. UTF-8 characters encoded with multiple bytes
/// (i.e. U+0080 and above) will have only the first byte used for separating
/// fields. The remaining bytes will be treated as a part of the field.
/// BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab
/// separator. The default value is comma (",", U+002C).
pub field_delimiter: std::string::String,
/// Optional. The number of rows at the top of a CSV file that BigQuery will
/// skip when loading the data. The default value is 0. This property is useful
/// if you have header rows in the file that should be skipped. When autodetect
/// is on, the behavior is the following:
///
/// * skipLeadingRows unspecified - Autodetect tries to detect headers in the
/// first row. If they are not detected, the row is read as data. Otherwise
/// data is read starting from the second row.
/// * skipLeadingRows is 0 - Instructs autodetect that there are no headers and
/// data should be read starting from the first row.
/// * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect
/// headers in row N. If headers are not detected, row N is just skipped.
/// Otherwise row N is used to extract column names for the detected schema.
pub skip_leading_rows: std::option::Option<wkt::Int32Value>,
/// Optional. The character encoding of the data.
/// The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE,
/// and UTF-32LE. The default value is UTF-8. BigQuery decodes the data after
/// the raw, binary data has been split using the values of the `quote` and
/// `fieldDelimiter` properties.
///
/// If you don't specify an encoding, or if you specify a UTF-8 encoding when
/// the CSV file is not UTF-8 encoded, BigQuery attempts to convert the data to
/// UTF-8. Generally, your data loads successfully, but it may not match
/// byte-for-byte what you expect. To avoid this, specify the correct encoding
/// by using the `--encoding` flag.
///
/// If BigQuery can't convert a character other than the ASCII `0` character,
/// BigQuery converts the character to the standard Unicode replacement
/// character: �.
pub encoding: std::string::String,
/// Optional. The value that is used to quote data sections in a CSV file.
/// BigQuery converts the string to ISO-8859-1 encoding, and then uses the
/// first byte of the encoded string to split the data in its raw, binary
/// state.
/// The default value is a double-quote ('"').
/// If your data does not contain quoted sections, set the property value to an
/// empty string.
/// If your data contains quoted newline characters, you must also set the
/// allowQuotedNewlines property to true.
/// To include the specific quote character within a quoted value, precede it
/// with an additional matching quote character. For example, if you want to
/// escape the default character ' " ', use ' "" '.
/// @default "
pub quote: std::option::Option<wkt::StringValue>,
/// Optional. The maximum number of bad records that BigQuery can ignore when
/// running the job. If the number of bad records exceeds this value, an
/// invalid error is returned in the job result.
/// The default value is 0, which requires that all records are valid.
/// This is only supported for CSV and NEWLINE_DELIMITED_JSON file formats.
pub max_bad_records: std::option::Option<wkt::Int32Value>,
/// Indicates if BigQuery should allow quoted data sections that contain
/// newline characters in a CSV file. The default value is false.
pub allow_quoted_newlines: std::option::Option<wkt::BoolValue>,
/// Optional. The format of the data files.
/// For CSV files, specify "CSV". For datastore backups,
/// specify "DATASTORE_BACKUP". For newline-delimited JSON,
/// specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO".
/// For parquet, specify "PARQUET". For orc, specify "ORC".
/// The default value is CSV.
pub source_format: std::string::String,
/// Optional. Accept rows that are missing trailing optional columns.
/// The missing values are treated as nulls.
/// If false, records with missing trailing columns are treated as bad records,
/// and if there are too many bad records, an invalid error is returned in the
/// job result.
/// The default value is false.
/// Only applicable to CSV, ignored for other formats.
pub allow_jagged_rows: std::option::Option<wkt::BoolValue>,
/// Optional. Indicates if BigQuery should allow extra values that are not
/// represented in the table schema.
/// If true, the extra values are ignored.
/// If false, records with extra columns are treated as bad records, and if
/// there are too many bad records, an invalid error is returned in the job
/// result. The default value is false.
/// The sourceFormat property determines what BigQuery treats as an extra
/// value:
/// CSV: Trailing columns
/// JSON: Named values that don't match any column names in the table schema
/// Avro, Parquet, ORC: Fields in the file schema that don't exist in the
/// table schema.
pub ignore_unknown_values: std::option::Option<wkt::BoolValue>,
/// If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity
/// properties to load into BigQuery from a Cloud Datastore backup. Property
/// names are case sensitive and must be top-level properties. If no properties
/// are specified, BigQuery loads all properties. If any named property isn't
/// found in the Cloud Datastore backup, an invalid error is returned in the
/// job result.
pub projection_fields: std::vec::Vec<std::string::String>,
/// Optional. Indicates if we should automatically infer the options and
/// schema for CSV and JSON sources.
pub autodetect: std::option::Option<wkt::BoolValue>,
/// Allows the schema of the destination table to be updated as a side effect
/// of the load job if a schema is autodetected or supplied in the job
/// configuration.
/// Schema update options are supported in three cases:
/// when writeDisposition is WRITE_APPEND;
/// when writeDisposition is WRITE_TRUNCATE_DATA;
/// when writeDisposition is WRITE_TRUNCATE and the destination table is a
/// partition of a table, specified by partition decorators. For normal tables,
/// WRITE_TRUNCATE will always overwrite the schema.
/// One or more of the following values are specified:
///
/// * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema.
/// * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original
/// schema to nullable.
pub schema_update_options: std::vec::Vec<std::string::String>,
/// Time-based partitioning specification for the destination table. Only one
/// of timePartitioning and rangePartitioning should be specified.
pub time_partitioning: std::option::Option<crate::model::TimePartitioning>,
/// Range partitioning specification for the destination table.
/// Only one of timePartitioning and rangePartitioning should be specified.
pub range_partitioning: std::option::Option<crate::model::RangePartitioning>,
/// Clustering specification for the destination table.
pub clustering: std::option::Option<crate::model::Clustering>,
/// Custom encryption configuration (e.g., Cloud KMS keys)
pub destination_encryption_configuration:
std::option::Option<crate::model::EncryptionConfiguration>,
/// Optional. If sourceFormat is set to "AVRO", indicates whether to interpret
/// logical types as the corresponding BigQuery data type (for example,
/// TIMESTAMP), instead of using the raw type (for example, INTEGER).
pub use_avro_logical_types: std::option::Option<wkt::BoolValue>,
/// Optional. The user can provide a reference file with the reader schema.
/// This file is only loaded if it is part of source URIs, but is not loaded
/// otherwise. It is enabled for the following formats: AVRO, PARQUET, ORC.
pub reference_file_schema_uri: std::option::Option<wkt::StringValue>,
/// Optional. When set, configures hive partitioning support.
/// Not all storage formats support hive partitioning -- requesting hive
/// partitioning on an unsupported format will lead to an error, as will
/// providing an invalid specification.
pub hive_partitioning_options: std::option::Option<crate::model::HivePartitioningOptions>,
/// Defines the list of possible SQL data types to which the source decimal
/// values are converted. This list and the precision and the scale parameters
/// of the decimal field determine the target type. In the order of NUMERIC,
/// BIGNUMERIC, and STRING, a
/// type is picked if it is in the specified list and if it supports the
/// precision and the scale. STRING supports all precision and scale values.
/// If none of the listed types supports the precision and the scale, the type
/// supporting the widest range in the specified list is picked, and if a value
/// exceeds the supported range when reading the data, an error will be thrown.
///
/// Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"].
/// If (precision,scale) is:
///
/// * (38,9) -> NUMERIC;
/// * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits);
/// * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits);
/// * (76,38) -> BIGNUMERIC;
/// * (77,38) -> BIGNUMERIC (error if value exceeds supported range).
///
/// This field cannot contain duplicate types. The order of the types in this
/// field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as
/// ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over
/// BIGNUMERIC.
///
/// Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other
/// file formats.
pub decimal_target_types: std::vec::Vec<crate::model::DecimalTargetType>,
/// Optional. Load option to be used together with source_format
/// newline-delimited JSON to indicate that a variant of JSON is being loaded.
/// To load newline-delimited GeoJSON, specify GEOJSON (and source_format must
/// be set to NEWLINE_DELIMITED_JSON).
pub json_extension: crate::model::JsonExtension,
/// Optional. Additional properties to set if sourceFormat is set to PARQUET.
pub parquet_options: std::option::Option<crate::model::ParquetOptions>,
/// Optional. When sourceFormat is set to "CSV", this indicates whether the
/// embedded ASCII control characters (the first 32 characters in the
/// ASCII-table, from
/// '\x00' to '\x1F') are preserved.
pub preserve_ascii_control_characters: std::option::Option<wkt::BoolValue>,
/// Optional. Connection properties which can modify the load job behavior.
/// Currently, only the 'session_id' connection property is supported, and is
/// used to resolve _SESSION appearing as the dataset id.
pub connection_properties: std::vec::Vec<crate::model::ConnectionProperty>,
/// Optional. If this property is true, the job creates a new session using a
/// randomly generated session_id. To continue using a created session with
/// subsequent queries, pass the existing session identifier as a
/// `ConnectionProperty` value. The session identifier is returned as part of
/// the `SessionInfo` message within the query statistics.
///
/// The new session's location will be set to `Job.JobReference.location` if it
/// is present, otherwise it's set to the default location based on existing
/// routing logic.
pub create_session: std::option::Option<wkt::BoolValue>,
/// Optional. Character map supported for column names in CSV/Parquet loads.
/// Defaults to STRICT and can be overridden by Project Config Service. Using
/// this option with unsupporting load formats will result in an error.
pub column_name_character_map: crate::model::job_configuration_load::ColumnNameCharacterMap,
/// Optional. [Experimental] Configures the load job to copy files directly to
/// the destination BigLake managed table, bypassing file content reading and
/// rewriting.
///
/// Copying files only is supported when all the following are true:
///
/// * `source_uris` are located in the same Cloud Storage location as the
/// destination table's `storage_uri` location.
/// * `source_format` is `PARQUET`.
/// * `destination_table` is an existing BigLake managed table. The table's
/// schema does not have flexible column names. The table's columns do not
/// have type parameters other than precision and scale.
/// * No options other than the above are specified.
pub copy_files_only: std::option::Option<wkt::BoolValue>,
/// Optional. Default time zone that will apply when parsing timestamp values
/// that have no specific time zone.
pub time_zone: std::option::Option<wkt::StringValue>,
/// Optional. A list of strings represented as SQL NULL value in a CSV file.
///
/// null_marker and null_markers can't be set at the same time.
/// If null_marker is set, null_markers has to be not set.
/// If null_markers is set, null_marker has to be not set.
/// If both null_marker and null_markers are set at the same time, a user
/// error would be thrown.
/// Any strings listed in null_markers, including
/// empty string would be interpreted as SQL NULL. This applies to all column
/// types.
pub null_markers: std::vec::Vec<std::string::String>,
/// Optional. Date format used for parsing DATE values.
pub date_format: std::option::Option<std::string::String>,
/// Optional. Date format used for parsing DATETIME values.
pub datetime_format: std::option::Option<std::string::String>,
/// Optional. Date format used for parsing TIME values.
pub time_format: std::option::Option<std::string::String>,
/// Optional. Date format used for parsing TIMESTAMP values.
pub timestamp_format: std::option::Option<std::string::String>,
/// Optional. Controls the strategy used to match loaded columns to the schema.
/// If not set, a sensible default is chosen based on how the schema is
/// provided. If autodetect is used, then columns are matched by name.
/// Otherwise, columns are matched by position. This is done to keep the
/// behavior backward-compatible.
pub source_column_match: crate::model::job_configuration_load::SourceColumnMatch,
/// Precisions (maximum number of total digits in base 10) for seconds
/// of TIMESTAMP types that are allowed to the destination table for
/// autodetection mode.
///
/// Available for the formats: CSV, PARQUET, AVRO, and Iceberg External Table.
///
/// Possible values include:
/// Not Specified, [], or [6]: timestamp(6) for all auto detected TIMESTAMP
/// columns
/// [6, 12]: timestamp(6) for all auto detected TIMESTAMP columns that have
/// less than 6 digits of subseconds.
/// timestamp(12) for all auto detected TIMESTAMP columns that have
/// more than 6 digits of subseconds.
/// [12]: timestamp(12) for all auto detected TIMESTAMP columns.
///
/// The order of the elements in this array is ignored.
/// Inputs that have higher precision than the highest target precision in this
/// array will be truncated.
pub timestamp_target_precision: std::vec::Vec<i32>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobConfigurationLoad {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source_uris][crate::model::JobConfigurationLoad::source_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_source_uris(["a", "b", "c"]);
/// ```
pub fn set_source_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.source_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [file_set_spec_type][crate::model::JobConfigurationLoad::file_set_spec_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::FileSetSpecType;
/// let x0 = JobConfigurationLoad::new().set_file_set_spec_type(FileSetSpecType::NewLineDelimitedManifest);
/// ```
pub fn set_file_set_spec_type<T: std::convert::Into<crate::model::FileSetSpecType>>(
mut self,
v: T,
) -> Self {
self.file_set_spec_type = v.into();
self
}
/// Sets the value of [schema][crate::model::JobConfigurationLoad::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = JobConfigurationLoad::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::JobConfigurationLoad::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = JobConfigurationLoad::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [destination_table][crate::model::JobConfigurationLoad::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationLoad::new().set_destination_table(TableReference::default()/* use setters */);
/// ```
pub fn set_destination_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_table][crate::model::JobConfigurationLoad::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationLoad::new().set_or_clear_destination_table(Some(TableReference::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_destination_table(None::<TableReference>);
/// ```
pub fn set_or_clear_destination_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = v.map(|x| x.into());
self
}
/// Sets the value of [destination_table_properties][crate::model::JobConfigurationLoad::destination_table_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// let x = JobConfigurationLoad::new().set_destination_table_properties(DestinationTableProperties::default()/* use setters */);
/// ```
pub fn set_destination_table_properties<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DestinationTableProperties>,
{
self.destination_table_properties = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_table_properties][crate::model::JobConfigurationLoad::destination_table_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::DestinationTableProperties;
/// let x = JobConfigurationLoad::new().set_or_clear_destination_table_properties(Some(DestinationTableProperties::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_destination_table_properties(None::<DestinationTableProperties>);
/// ```
pub fn set_or_clear_destination_table_properties<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DestinationTableProperties>,
{
self.destination_table_properties = v.map(|x| x.into());
self
}
/// Sets the value of [create_disposition][crate::model::JobConfigurationLoad::create_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_create_disposition("example");
/// ```
pub fn set_create_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.create_disposition = v.into();
self
}
/// Sets the value of [write_disposition][crate::model::JobConfigurationLoad::write_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_write_disposition("example");
/// ```
pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.write_disposition = v.into();
self
}
/// Sets the value of [null_marker][crate::model::JobConfigurationLoad::null_marker].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_null_marker(StringValue::default()/* use setters */);
/// ```
pub fn set_null_marker<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.null_marker = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [null_marker][crate::model::JobConfigurationLoad::null_marker].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_or_clear_null_marker(Some(StringValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_null_marker(None::<StringValue>);
/// ```
pub fn set_or_clear_null_marker<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.null_marker = v.map(|x| x.into());
self
}
/// Sets the value of [field_delimiter][crate::model::JobConfigurationLoad::field_delimiter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_field_delimiter("example");
/// ```
pub fn set_field_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field_delimiter = v.into();
self
}
/// Sets the value of [skip_leading_rows][crate::model::JobConfigurationLoad::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::Int32Value;
/// let x = JobConfigurationLoad::new().set_skip_leading_rows(Int32Value::default()/* use setters */);
/// ```
pub fn set_skip_leading_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.skip_leading_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [skip_leading_rows][crate::model::JobConfigurationLoad::skip_leading_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::Int32Value;
/// let x = JobConfigurationLoad::new().set_or_clear_skip_leading_rows(Some(Int32Value::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_skip_leading_rows(None::<Int32Value>);
/// ```
pub fn set_or_clear_skip_leading_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.skip_leading_rows = v.map(|x| x.into());
self
}
/// Sets the value of [encoding][crate::model::JobConfigurationLoad::encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_encoding("example");
/// ```
pub fn set_encoding<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.encoding = v.into();
self
}
/// Sets the value of [quote][crate::model::JobConfigurationLoad::quote].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_quote(StringValue::default()/* use setters */);
/// ```
pub fn set_quote<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.quote = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [quote][crate::model::JobConfigurationLoad::quote].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_or_clear_quote(Some(StringValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_quote(None::<StringValue>);
/// ```
pub fn set_or_clear_quote<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.quote = v.map(|x| x.into());
self
}
/// Sets the value of [max_bad_records][crate::model::JobConfigurationLoad::max_bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::Int32Value;
/// let x = JobConfigurationLoad::new().set_max_bad_records(Int32Value::default()/* use setters */);
/// ```
pub fn set_max_bad_records<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_bad_records = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_bad_records][crate::model::JobConfigurationLoad::max_bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::Int32Value;
/// let x = JobConfigurationLoad::new().set_or_clear_max_bad_records(Some(Int32Value::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_max_bad_records(None::<Int32Value>);
/// ```
pub fn set_or_clear_max_bad_records<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.max_bad_records = v.map(|x| x.into());
self
}
/// Sets the value of [allow_quoted_newlines][crate::model::JobConfigurationLoad::allow_quoted_newlines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_allow_quoted_newlines(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_quoted_newlines<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_quoted_newlines = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_quoted_newlines][crate::model::JobConfigurationLoad::allow_quoted_newlines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_allow_quoted_newlines(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_allow_quoted_newlines(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_quoted_newlines<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_quoted_newlines = v.map(|x| x.into());
self
}
/// Sets the value of [source_format][crate::model::JobConfigurationLoad::source_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_source_format("example");
/// ```
pub fn set_source_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source_format = v.into();
self
}
/// Sets the value of [allow_jagged_rows][crate::model::JobConfigurationLoad::allow_jagged_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_allow_jagged_rows(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_jagged_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_jagged_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_jagged_rows][crate::model::JobConfigurationLoad::allow_jagged_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_allow_jagged_rows(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_allow_jagged_rows(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_jagged_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_jagged_rows = v.map(|x| x.into());
self
}
/// Sets the value of [ignore_unknown_values][crate::model::JobConfigurationLoad::ignore_unknown_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_ignore_unknown_values(BoolValue::default()/* use setters */);
/// ```
pub fn set_ignore_unknown_values<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unknown_values = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ignore_unknown_values][crate::model::JobConfigurationLoad::ignore_unknown_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_ignore_unknown_values(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_ignore_unknown_values(None::<BoolValue>);
/// ```
pub fn set_or_clear_ignore_unknown_values<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.ignore_unknown_values = v.map(|x| x.into());
self
}
/// Sets the value of [projection_fields][crate::model::JobConfigurationLoad::projection_fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_projection_fields(["a", "b", "c"]);
/// ```
pub fn set_projection_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.projection_fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [autodetect][crate::model::JobConfigurationLoad::autodetect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_autodetect(BoolValue::default()/* use setters */);
/// ```
pub fn set_autodetect<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.autodetect = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [autodetect][crate::model::JobConfigurationLoad::autodetect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_autodetect(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_autodetect(None::<BoolValue>);
/// ```
pub fn set_or_clear_autodetect<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.autodetect = v.map(|x| x.into());
self
}
/// Sets the value of [schema_update_options][crate::model::JobConfigurationLoad::schema_update_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_schema_update_options(["a", "b", "c"]);
/// ```
pub fn set_schema_update_options<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.schema_update_options = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [time_partitioning][crate::model::JobConfigurationLoad::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = JobConfigurationLoad::new().set_time_partitioning(TimePartitioning::default()/* use setters */);
/// ```
pub fn set_time_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_partitioning][crate::model::JobConfigurationLoad::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = JobConfigurationLoad::new().set_or_clear_time_partitioning(Some(TimePartitioning::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_time_partitioning(None::<TimePartitioning>);
/// ```
pub fn set_or_clear_time_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [range_partitioning][crate::model::JobConfigurationLoad::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = JobConfigurationLoad::new().set_range_partitioning(RangePartitioning::default()/* use setters */);
/// ```
pub fn set_range_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range_partitioning][crate::model::JobConfigurationLoad::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = JobConfigurationLoad::new().set_or_clear_range_partitioning(Some(RangePartitioning::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_range_partitioning(None::<RangePartitioning>);
/// ```
pub fn set_or_clear_range_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [clustering][crate::model::JobConfigurationLoad::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = JobConfigurationLoad::new().set_clustering(Clustering::default()/* use setters */);
/// ```
pub fn set_clustering<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clustering][crate::model::JobConfigurationLoad::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = JobConfigurationLoad::new().set_or_clear_clustering(Some(Clustering::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_clustering(None::<Clustering>);
/// ```
pub fn set_or_clear_clustering<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = v.map(|x| x.into());
self
}
/// Sets the value of [destination_encryption_configuration][crate::model::JobConfigurationLoad::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationLoad::new().set_destination_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_destination_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_encryption_configuration][crate::model::JobConfigurationLoad::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationLoad::new().set_or_clear_destination_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_destination_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_destination_encryption_configuration<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [use_avro_logical_types][crate::model::JobConfigurationLoad::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_use_avro_logical_types(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_avro_logical_types<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_avro_logical_types][crate::model::JobConfigurationLoad::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_use_avro_logical_types(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_use_avro_logical_types(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_avro_logical_types<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = v.map(|x| x.into());
self
}
/// Sets the value of [reference_file_schema_uri][crate::model::JobConfigurationLoad::reference_file_schema_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_reference_file_schema_uri(StringValue::default()/* use setters */);
/// ```
pub fn set_reference_file_schema_uri<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.reference_file_schema_uri = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reference_file_schema_uri][crate::model::JobConfigurationLoad::reference_file_schema_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_or_clear_reference_file_schema_uri(Some(StringValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_reference_file_schema_uri(None::<StringValue>);
/// ```
pub fn set_or_clear_reference_file_schema_uri<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.reference_file_schema_uri = v.map(|x| x.into());
self
}
/// Sets the value of [hive_partitioning_options][crate::model::JobConfigurationLoad::hive_partitioning_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = JobConfigurationLoad::new().set_hive_partitioning_options(HivePartitioningOptions::default()/* use setters */);
/// ```
pub fn set_hive_partitioning_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::HivePartitioningOptions>,
{
self.hive_partitioning_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hive_partitioning_options][crate::model::JobConfigurationLoad::hive_partitioning_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::HivePartitioningOptions;
/// let x = JobConfigurationLoad::new().set_or_clear_hive_partitioning_options(Some(HivePartitioningOptions::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_hive_partitioning_options(None::<HivePartitioningOptions>);
/// ```
pub fn set_or_clear_hive_partitioning_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::HivePartitioningOptions>,
{
self.hive_partitioning_options = v.map(|x| x.into());
self
}
/// Sets the value of [decimal_target_types][crate::model::JobConfigurationLoad::decimal_target_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::DecimalTargetType;
/// let x = JobConfigurationLoad::new().set_decimal_target_types([
/// DecimalTargetType::Numeric,
/// DecimalTargetType::Bignumeric,
/// DecimalTargetType::String,
/// ]);
/// ```
pub fn set_decimal_target_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::DecimalTargetType>,
{
use std::iter::Iterator;
self.decimal_target_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [json_extension][crate::model::JobConfigurationLoad::json_extension].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::JsonExtension;
/// let x0 = JobConfigurationLoad::new().set_json_extension(JsonExtension::Geojson);
/// ```
pub fn set_json_extension<T: std::convert::Into<crate::model::JsonExtension>>(
mut self,
v: T,
) -> Self {
self.json_extension = v.into();
self
}
/// Sets the value of [parquet_options][crate::model::JobConfigurationLoad::parquet_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::ParquetOptions;
/// let x = JobConfigurationLoad::new().set_parquet_options(ParquetOptions::default()/* use setters */);
/// ```
pub fn set_parquet_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ParquetOptions>,
{
self.parquet_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parquet_options][crate::model::JobConfigurationLoad::parquet_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::ParquetOptions;
/// let x = JobConfigurationLoad::new().set_or_clear_parquet_options(Some(ParquetOptions::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_parquet_options(None::<ParquetOptions>);
/// ```
pub fn set_or_clear_parquet_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ParquetOptions>,
{
self.parquet_options = v.map(|x| x.into());
self
}
/// Sets the value of [preserve_ascii_control_characters][crate::model::JobConfigurationLoad::preserve_ascii_control_characters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_preserve_ascii_control_characters(BoolValue::default()/* use setters */);
/// ```
pub fn set_preserve_ascii_control_characters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.preserve_ascii_control_characters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [preserve_ascii_control_characters][crate::model::JobConfigurationLoad::preserve_ascii_control_characters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_preserve_ascii_control_characters(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_preserve_ascii_control_characters(None::<BoolValue>);
/// ```
pub fn set_or_clear_preserve_ascii_control_characters<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.preserve_ascii_control_characters = v.map(|x| x.into());
self
}
/// Sets the value of [connection_properties][crate::model::JobConfigurationLoad::connection_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::ConnectionProperty;
/// let x = JobConfigurationLoad::new()
/// .set_connection_properties([
/// ConnectionProperty::default()/* use setters */,
/// ConnectionProperty::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_connection_properties<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConnectionProperty>,
{
use std::iter::Iterator;
self.connection_properties = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [create_session][crate::model::JobConfigurationLoad::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_create_session(BoolValue::default()/* use setters */);
/// ```
pub fn set_create_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [create_session][crate::model::JobConfigurationLoad::create_session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_create_session(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_create_session(None::<BoolValue>);
/// ```
pub fn set_or_clear_create_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.create_session = v.map(|x| x.into());
self
}
/// Sets the value of [column_name_character_map][crate::model::JobConfigurationLoad::column_name_character_map].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::job_configuration_load::ColumnNameCharacterMap;
/// let x0 = JobConfigurationLoad::new().set_column_name_character_map(ColumnNameCharacterMap::Strict);
/// let x1 = JobConfigurationLoad::new().set_column_name_character_map(ColumnNameCharacterMap::V1);
/// let x2 = JobConfigurationLoad::new().set_column_name_character_map(ColumnNameCharacterMap::V2);
/// ```
pub fn set_column_name_character_map<
T: std::convert::Into<crate::model::job_configuration_load::ColumnNameCharacterMap>,
>(
mut self,
v: T,
) -> Self {
self.column_name_character_map = v.into();
self
}
/// Sets the value of [copy_files_only][crate::model::JobConfigurationLoad::copy_files_only].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_copy_files_only(BoolValue::default()/* use setters */);
/// ```
pub fn set_copy_files_only<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.copy_files_only = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [copy_files_only][crate::model::JobConfigurationLoad::copy_files_only].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::BoolValue;
/// let x = JobConfigurationLoad::new().set_or_clear_copy_files_only(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_copy_files_only(None::<BoolValue>);
/// ```
pub fn set_or_clear_copy_files_only<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.copy_files_only = v.map(|x| x.into());
self
}
/// Sets the value of [time_zone][crate::model::JobConfigurationLoad::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_time_zone(StringValue::default()/* use setters */);
/// ```
pub fn set_time_zone<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.time_zone = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_zone][crate::model::JobConfigurationLoad::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use wkt::StringValue;
/// let x = JobConfigurationLoad::new().set_or_clear_time_zone(Some(StringValue::default()/* use setters */));
/// let x = JobConfigurationLoad::new().set_or_clear_time_zone(None::<StringValue>);
/// ```
pub fn set_or_clear_time_zone<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.time_zone = v.map(|x| x.into());
self
}
/// Sets the value of [null_markers][crate::model::JobConfigurationLoad::null_markers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_null_markers(["a", "b", "c"]);
/// ```
pub fn set_null_markers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.null_markers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [date_format][crate::model::JobConfigurationLoad::date_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_date_format("example");
/// ```
pub fn set_date_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.date_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [date_format][crate::model::JobConfigurationLoad::date_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_or_clear_date_format(Some("example"));
/// let x = JobConfigurationLoad::new().set_or_clear_date_format(None::<String>);
/// ```
pub fn set_or_clear_date_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.date_format = v.map(|x| x.into());
self
}
/// Sets the value of [datetime_format][crate::model::JobConfigurationLoad::datetime_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_datetime_format("example");
/// ```
pub fn set_datetime_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.datetime_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [datetime_format][crate::model::JobConfigurationLoad::datetime_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_or_clear_datetime_format(Some("example"));
/// let x = JobConfigurationLoad::new().set_or_clear_datetime_format(None::<String>);
/// ```
pub fn set_or_clear_datetime_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.datetime_format = v.map(|x| x.into());
self
}
/// Sets the value of [time_format][crate::model::JobConfigurationLoad::time_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_time_format("example");
/// ```
pub fn set_time_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_format][crate::model::JobConfigurationLoad::time_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_or_clear_time_format(Some("example"));
/// let x = JobConfigurationLoad::new().set_or_clear_time_format(None::<String>);
/// ```
pub fn set_or_clear_time_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.time_format = v.map(|x| x.into());
self
}
/// Sets the value of [timestamp_format][crate::model::JobConfigurationLoad::timestamp_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_timestamp_format("example");
/// ```
pub fn set_timestamp_format<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.timestamp_format = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timestamp_format][crate::model::JobConfigurationLoad::timestamp_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_or_clear_timestamp_format(Some("example"));
/// let x = JobConfigurationLoad::new().set_or_clear_timestamp_format(None::<String>);
/// ```
pub fn set_or_clear_timestamp_format<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.timestamp_format = v.map(|x| x.into());
self
}
/// Sets the value of [source_column_match][crate::model::JobConfigurationLoad::source_column_match].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// use google_cloud_bigquery_v2::model::job_configuration_load::SourceColumnMatch;
/// let x0 = JobConfigurationLoad::new().set_source_column_match(SourceColumnMatch::Position);
/// let x1 = JobConfigurationLoad::new().set_source_column_match(SourceColumnMatch::Name);
/// ```
pub fn set_source_column_match<
T: std::convert::Into<crate::model::job_configuration_load::SourceColumnMatch>,
>(
mut self,
v: T,
) -> Self {
self.source_column_match = v.into();
self
}
/// Sets the value of [timestamp_target_precision][crate::model::JobConfigurationLoad::timestamp_target_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfigurationLoad::new().set_timestamp_target_precision([1, 2, 3]);
/// ```
pub fn set_timestamp_target_precision<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.timestamp_target_precision = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JobConfigurationLoad {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfigurationLoad"
}
}
/// Defines additional types related to [JobConfigurationLoad].
pub mod job_configuration_load {
#[allow(unused_imports)]
use super::*;
/// Indicates the character map used for column names.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ColumnNameCharacterMap {
/// Unspecified column name character map.
Unspecified,
/// Support flexible column name and reject invalid column names.
Strict,
/// Support alphanumeric + underscore characters and names must start with a
/// letter or underscore. Invalid column names will be normalized.
V1,
/// Support flexible column name. Invalid column names will be normalized.
V2,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ColumnNameCharacterMap::value] or
/// [ColumnNameCharacterMap::name].
UnknownValue(column_name_character_map::UnknownValue),
}
#[doc(hidden)]
pub mod column_name_character_map {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ColumnNameCharacterMap {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Strict => std::option::Option::Some(1),
Self::V1 => std::option::Option::Some(2),
Self::V2 => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED")
}
Self::Strict => std::option::Option::Some("STRICT"),
Self::V1 => std::option::Option::Some("V1"),
Self::V2 => std::option::Option::Some("V2"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ColumnNameCharacterMap {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ColumnNameCharacterMap {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ColumnNameCharacterMap {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Strict,
2 => Self::V1,
3 => Self::V2,
_ => Self::UnknownValue(column_name_character_map::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ColumnNameCharacterMap {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED" => Self::Unspecified,
"STRICT" => Self::Strict,
"V1" => Self::V1,
"V2" => Self::V2,
_ => Self::UnknownValue(column_name_character_map::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ColumnNameCharacterMap {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Strict => serializer.serialize_i32(1),
Self::V1 => serializer.serialize_i32(2),
Self::V2 => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ColumnNameCharacterMap {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ColumnNameCharacterMap>::new(
".google.cloud.bigquery.v2.JobConfigurationLoad.ColumnNameCharacterMap",
))
}
}
/// Indicates the strategy used to match loaded columns to the schema.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SourceColumnMatch {
/// Uses sensible defaults based on how the schema is provided. If autodetect
/// is used, then columns are matched by name. Otherwise, columns are matched
/// by position. This is done to keep the behavior backward-compatible.
Unspecified,
/// Matches by position. This assumes that the columns are ordered the same
/// way as the schema.
Position,
/// Matches by name. This reads the header row as column names and reorders
/// columns to match the field names in the schema.
Name,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SourceColumnMatch::value] or
/// [SourceColumnMatch::name].
UnknownValue(source_column_match::UnknownValue),
}
#[doc(hidden)]
pub mod source_column_match {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SourceColumnMatch {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Position => std::option::Option::Some(1),
Self::Name => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SOURCE_COLUMN_MATCH_UNSPECIFIED"),
Self::Position => std::option::Option::Some("POSITION"),
Self::Name => std::option::Option::Some("NAME"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SourceColumnMatch {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SourceColumnMatch {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SourceColumnMatch {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Position,
2 => Self::Name,
_ => Self::UnknownValue(source_column_match::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SourceColumnMatch {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SOURCE_COLUMN_MATCH_UNSPECIFIED" => Self::Unspecified,
"POSITION" => Self::Position,
"NAME" => Self::Name,
_ => Self::UnknownValue(source_column_match::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SourceColumnMatch {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Position => serializer.serialize_i32(1),
Self::Name => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SourceColumnMatch {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceColumnMatch>::new(
".google.cloud.bigquery.v2.JobConfigurationLoad.SourceColumnMatch",
))
}
}
}
/// JobConfigurationTableCopy configures a job that copies data from one table
/// to another.
/// For more information on copying tables, see [Copy a
/// table](https://cloud.google.com/bigquery/docs/managing-tables#copy-table).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobConfigurationTableCopy {
/// [Pick one] Source table to copy.
pub source_table: std::option::Option<crate::model::TableReference>,
/// [Pick one] Source tables to copy.
pub source_tables: std::vec::Vec<crate::model::TableReference>,
/// [Required] The destination table.
pub destination_table: std::option::Option<crate::model::TableReference>,
/// Optional. Specifies whether the job is allowed to create new tables.
/// The following values are supported:
///
/// * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
/// table.
/// * CREATE_NEVER: The table must already exist. If it does not,
/// a 'notFound' error is returned in the job result.
///
/// The default value is CREATE_IF_NEEDED.
/// Creation, truncation and append actions occur as one atomic update
/// upon job completion.
pub create_disposition: std::string::String,
/// Optional. Specifies the action that occurs if the destination table
/// already exists. The following values are supported:
///
/// * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
/// table data and uses the schema and table constraints from the source table.
/// * WRITE_APPEND: If the table already exists, BigQuery appends the data to
/// the table.
/// * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate'
/// error is returned in the job result.
///
/// The default value is WRITE_EMPTY. Each action is atomic and only occurs if
/// BigQuery is able to complete the job successfully. Creation, truncation and
/// append actions occur as one atomic update upon job completion.
pub write_disposition: std::string::String,
/// Custom encryption configuration (e.g., Cloud KMS keys).
pub destination_encryption_configuration:
std::option::Option<crate::model::EncryptionConfiguration>,
/// Optional. Supported operation types in table copy job.
pub operation_type: crate::model::job_configuration_table_copy::OperationType,
/// Optional. The time when the destination table expires. Expired tables will
/// be deleted and their storage reclaimed.
pub destination_expiration_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobConfigurationTableCopy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source_table][crate::model::JobConfigurationTableCopy::source_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationTableCopy::new().set_source_table(TableReference::default()/* use setters */);
/// ```
pub fn set_source_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.source_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [source_table][crate::model::JobConfigurationTableCopy::source_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationTableCopy::new().set_or_clear_source_table(Some(TableReference::default()/* use setters */));
/// let x = JobConfigurationTableCopy::new().set_or_clear_source_table(None::<TableReference>);
/// ```
pub fn set_or_clear_source_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.source_table = v.map(|x| x.into());
self
}
/// Sets the value of [source_tables][crate::model::JobConfigurationTableCopy::source_tables].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationTableCopy::new()
/// .set_source_tables([
/// TableReference::default()/* use setters */,
/// TableReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_source_tables<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableReference>,
{
use std::iter::Iterator;
self.source_tables = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [destination_table][crate::model::JobConfigurationTableCopy::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationTableCopy::new().set_destination_table(TableReference::default()/* use setters */);
/// ```
pub fn set_destination_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_table][crate::model::JobConfigurationTableCopy::destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_table(Some(TableReference::default()/* use setters */));
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_table(None::<TableReference>);
/// ```
pub fn set_or_clear_destination_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.destination_table = v.map(|x| x.into());
self
}
/// Sets the value of [create_disposition][crate::model::JobConfigurationTableCopy::create_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// let x = JobConfigurationTableCopy::new().set_create_disposition("example");
/// ```
pub fn set_create_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.create_disposition = v.into();
self
}
/// Sets the value of [write_disposition][crate::model::JobConfigurationTableCopy::write_disposition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// let x = JobConfigurationTableCopy::new().set_write_disposition("example");
/// ```
pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.write_disposition = v.into();
self
}
/// Sets the value of [destination_encryption_configuration][crate::model::JobConfigurationTableCopy::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationTableCopy::new().set_destination_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_destination_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_encryption_configuration][crate::model::JobConfigurationTableCopy::destination_encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_destination_encryption_configuration<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.destination_encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [operation_type][crate::model::JobConfigurationTableCopy::operation_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use google_cloud_bigquery_v2::model::job_configuration_table_copy::OperationType;
/// let x0 = JobConfigurationTableCopy::new().set_operation_type(OperationType::Copy);
/// let x1 = JobConfigurationTableCopy::new().set_operation_type(OperationType::Snapshot);
/// let x2 = JobConfigurationTableCopy::new().set_operation_type(OperationType::Restore);
/// ```
pub fn set_operation_type<
T: std::convert::Into<crate::model::job_configuration_table_copy::OperationType>,
>(
mut self,
v: T,
) -> Self {
self.operation_type = v.into();
self
}
/// Sets the value of [destination_expiration_time][crate::model::JobConfigurationTableCopy::destination_expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use wkt::Timestamp;
/// let x = JobConfigurationTableCopy::new().set_destination_expiration_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_destination_expiration_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.destination_expiration_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination_expiration_time][crate::model::JobConfigurationTableCopy::destination_expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// use wkt::Timestamp;
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_expiration_time(Some(Timestamp::default()/* use setters */));
/// let x = JobConfigurationTableCopy::new().set_or_clear_destination_expiration_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_destination_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.destination_expiration_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for JobConfigurationTableCopy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfigurationTableCopy"
}
}
/// Defines additional types related to [JobConfigurationTableCopy].
pub mod job_configuration_table_copy {
#[allow(unused_imports)]
use super::*;
/// Indicates different operation types supported in table copy job.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationType {
/// Unspecified operation type.
Unspecified,
/// The source and destination table have the same table type.
Copy,
/// The source table type is TABLE and
/// the destination table type is SNAPSHOT.
Snapshot,
/// The source table type is SNAPSHOT and
/// the destination table type is TABLE.
Restore,
/// The source and destination table have the same table type,
/// but only bill for unique data.
Clone,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [OperationType::value] or
/// [OperationType::name].
UnknownValue(operation_type::UnknownValue),
}
#[doc(hidden)]
pub mod operation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl OperationType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Copy => std::option::Option::Some(1),
Self::Snapshot => std::option::Option::Some(2),
Self::Restore => std::option::Option::Some(3),
Self::Clone => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
Self::Copy => std::option::Option::Some("COPY"),
Self::Snapshot => std::option::Option::Some("SNAPSHOT"),
Self::Restore => std::option::Option::Some("RESTORE"),
Self::Clone => std::option::Option::Some("CLONE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for OperationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for OperationType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for OperationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Copy,
2 => Self::Snapshot,
3 => Self::Restore,
4 => Self::Clone,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for OperationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"COPY" => Self::Copy,
"SNAPSHOT" => Self::Snapshot,
"RESTORE" => Self::Restore,
"CLONE" => Self::Clone,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for OperationType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Copy => serializer.serialize_i32(1),
Self::Snapshot => serializer.serialize_i32(2),
Self::Restore => serializer.serialize_i32(3),
Self::Clone => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for OperationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
".google.cloud.bigquery.v2.JobConfigurationTableCopy.OperationType",
))
}
}
}
/// JobConfigurationExtract configures a job that exports data from a BigQuery
/// table into Google Cloud Storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobConfigurationExtract {
/// [Pick one] A list of fully-qualified Google Cloud Storage URIs where the
/// extracted table should be written.
pub destination_uris: std::vec::Vec<std::string::String>,
/// Optional. Whether to print out a header row in the results.
/// Default is true. Not applicable when extracting models.
pub print_header: std::option::Option<wkt::BoolValue>,
/// Optional. When extracting data in CSV format, this defines the
/// delimiter to use between fields in the exported data.
/// Default is ','. Not applicable when extracting models.
pub field_delimiter: std::string::String,
/// Optional. The exported file format. Possible values include CSV,
/// NEWLINE_DELIMITED_JSON, PARQUET, or AVRO for tables and ML_TF_SAVED_MODEL
/// or ML_XGBOOST_BOOSTER for models. The default value for tables is CSV.
/// Tables with nested or repeated fields cannot be exported as CSV. The
/// default value for models is ML_TF_SAVED_MODEL.
pub destination_format: std::string::String,
/// Optional. The compression type to use for exported files. Possible values
/// include DEFLATE, GZIP, NONE, SNAPPY, and ZSTD. The default value is NONE.
/// Not all compression formats are support for all file formats. DEFLATE is
/// only supported for Avro. ZSTD is only supported for Parquet. Not applicable
/// when extracting models.
pub compression: std::string::String,
/// Whether to use logical types when extracting to AVRO format. Not applicable
/// when extracting models.
pub use_avro_logical_types: std::option::Option<wkt::BoolValue>,
/// Optional. Model extract options only applicable when extracting models.
pub model_extract_options:
std::option::Option<crate::model::job_configuration_extract::ModelExtractOptions>,
/// Required. Source reference for the export.
pub source: std::option::Option<crate::model::job_configuration_extract::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobConfigurationExtract {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [destination_uris][crate::model::JobConfigurationExtract::destination_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfigurationExtract::new().set_destination_uris(["a", "b", "c"]);
/// ```
pub fn set_destination_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.destination_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [print_header][crate::model::JobConfigurationExtract::print_header].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use wkt::BoolValue;
/// let x = JobConfigurationExtract::new().set_print_header(BoolValue::default()/* use setters */);
/// ```
pub fn set_print_header<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.print_header = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [print_header][crate::model::JobConfigurationExtract::print_header].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use wkt::BoolValue;
/// let x = JobConfigurationExtract::new().set_or_clear_print_header(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationExtract::new().set_or_clear_print_header(None::<BoolValue>);
/// ```
pub fn set_or_clear_print_header<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.print_header = v.map(|x| x.into());
self
}
/// Sets the value of [field_delimiter][crate::model::JobConfigurationExtract::field_delimiter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfigurationExtract::new().set_field_delimiter("example");
/// ```
pub fn set_field_delimiter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field_delimiter = v.into();
self
}
/// Sets the value of [destination_format][crate::model::JobConfigurationExtract::destination_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfigurationExtract::new().set_destination_format("example");
/// ```
pub fn set_destination_format<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.destination_format = v.into();
self
}
/// Sets the value of [compression][crate::model::JobConfigurationExtract::compression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfigurationExtract::new().set_compression("example");
/// ```
pub fn set_compression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.compression = v.into();
self
}
/// Sets the value of [use_avro_logical_types][crate::model::JobConfigurationExtract::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use wkt::BoolValue;
/// let x = JobConfigurationExtract::new().set_use_avro_logical_types(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_avro_logical_types<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_avro_logical_types][crate::model::JobConfigurationExtract::use_avro_logical_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use wkt::BoolValue;
/// let x = JobConfigurationExtract::new().set_or_clear_use_avro_logical_types(Some(BoolValue::default()/* use setters */));
/// let x = JobConfigurationExtract::new().set_or_clear_use_avro_logical_types(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_avro_logical_types<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_avro_logical_types = v.map(|x| x.into());
self
}
/// Sets the value of [model_extract_options][crate::model::JobConfigurationExtract::model_extract_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use google_cloud_bigquery_v2::model::job_configuration_extract::ModelExtractOptions;
/// let x = JobConfigurationExtract::new().set_model_extract_options(ModelExtractOptions::default()/* use setters */);
/// ```
pub fn set_model_extract_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::job_configuration_extract::ModelExtractOptions>,
{
self.model_extract_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_extract_options][crate::model::JobConfigurationExtract::model_extract_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use google_cloud_bigquery_v2::model::job_configuration_extract::ModelExtractOptions;
/// let x = JobConfigurationExtract::new().set_or_clear_model_extract_options(Some(ModelExtractOptions::default()/* use setters */));
/// let x = JobConfigurationExtract::new().set_or_clear_model_extract_options(None::<ModelExtractOptions>);
/// ```
pub fn set_or_clear_model_extract_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::job_configuration_extract::ModelExtractOptions>,
{
self.model_extract_options = v.map(|x| x.into());
self
}
/// Sets the value of [source][crate::model::JobConfigurationExtract::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationExtract::new().set_source(Some(
/// google_cloud_bigquery_v2::model::job_configuration_extract::Source::SourceTable(TableReference::default().into())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::job_configuration_extract::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::JobConfigurationExtract::source]
/// if it holds a `SourceTable`, `None` if the field is not set or
/// holds a different branch.
pub fn source_table(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::TableReference>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::job_configuration_extract::Source::SourceTable(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::JobConfigurationExtract::source]
/// to hold a `SourceTable`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobConfigurationExtract::new().set_source_table(TableReference::default()/* use setters */);
/// assert!(x.source_table().is_some());
/// assert!(x.source_model().is_none());
/// ```
pub fn set_source_table<
T: std::convert::Into<std::boxed::Box<crate::model::TableReference>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::job_configuration_extract::Source::SourceTable(v.into()),
);
self
}
/// The value of [source][crate::model::JobConfigurationExtract::source]
/// if it holds a `SourceModel`, `None` if the field is not set or
/// holds a different branch.
pub fn source_model(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ModelReference>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::job_configuration_extract::Source::SourceModel(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::JobConfigurationExtract::source]
/// to hold a `SourceModel`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// use google_cloud_bigquery_v2::model::ModelReference;
/// let x = JobConfigurationExtract::new().set_source_model(ModelReference::default()/* use setters */);
/// assert!(x.source_model().is_some());
/// assert!(x.source_table().is_none());
/// ```
pub fn set_source_model<
T: std::convert::Into<std::boxed::Box<crate::model::ModelReference>>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::job_configuration_extract::Source::SourceModel(v.into()),
);
self
}
}
impl wkt::message::Message for JobConfigurationExtract {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfigurationExtract"
}
}
/// Defines additional types related to [JobConfigurationExtract].
pub mod job_configuration_extract {
#[allow(unused_imports)]
use super::*;
/// Options related to model extraction.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelExtractOptions {
/// The 1-based ID of the trial to be exported from a hyperparameter tuning
/// model. If not specified, the trial with id =
/// [Model](https://cloud.google.com/bigquery/docs/reference/rest/v2/models#resource:-model).defaultTrialId
/// is exported. This field is ignored for models not trained with
/// hyperparameter tuning.
pub trial_id: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelExtractOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [trial_id][crate::model::job_configuration_extract::ModelExtractOptions::trial_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::job_configuration_extract::ModelExtractOptions;
/// use wkt::Int64Value;
/// let x = ModelExtractOptions::new().set_trial_id(Int64Value::default()/* use setters */);
/// ```
pub fn set_trial_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.trial_id = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [trial_id][crate::model::job_configuration_extract::ModelExtractOptions::trial_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::job_configuration_extract::ModelExtractOptions;
/// use wkt::Int64Value;
/// let x = ModelExtractOptions::new().set_or_clear_trial_id(Some(Int64Value::default()/* use setters */));
/// let x = ModelExtractOptions::new().set_or_clear_trial_id(None::<Int64Value>);
/// ```
pub fn set_or_clear_trial_id<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.trial_id = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ModelExtractOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfigurationExtract.ModelExtractOptions"
}
}
/// Required. Source reference for the export.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// A reference to the table being exported.
SourceTable(std::boxed::Box<crate::model::TableReference>),
/// A reference to the model being exported.
SourceModel(std::boxed::Box<crate::model::ModelReference>),
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobConfiguration {
/// Output only. The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or
/// UNKNOWN.
pub job_type: std::string::String,
/// [Pick one] Configures a query job.
pub query: std::option::Option<crate::model::JobConfigurationQuery>,
/// [Pick one] Configures a load job.
pub load: std::option::Option<crate::model::JobConfigurationLoad>,
/// [Pick one] Copies a table.
pub copy: std::option::Option<crate::model::JobConfigurationTableCopy>,
/// [Pick one] Configures an extract job.
pub extract: std::option::Option<crate::model::JobConfigurationExtract>,
/// Optional. If set, don't actually run this job. A valid query will return
/// a mostly empty response with some processing statistics, while an invalid
/// query will return the same error it would if it wasn't a dry run. Behavior
/// of non-query jobs is undefined.
pub dry_run: std::option::Option<wkt::BoolValue>,
/// Optional. Job timeout in milliseconds relative to the job creation time. If
/// this time limit is exceeded, BigQuery attempts to stop the job, but might
/// not always succeed in canceling it before the job completes. For example, a
/// job that takes more than 60 seconds to complete has a better chance of
/// being stopped than a job that takes 10 seconds to complete.
pub job_timeout_ms: std::option::Option<wkt::Int64Value>,
/// Optional. A target limit on the rate of slot consumption by this job. If
/// set to a value > 0, BigQuery will attempt to limit the rate of slot
/// consumption by this job to keep it below the configured limit, even if the
/// job is eligible for more slots based on fair scheduling. The unused slots
/// will be available for other jobs and queries to use.
///
/// Note: This feature is not yet generally available.
pub max_slots: std::option::Option<i32>,
/// The labels associated with this job. You can use these to organize and
/// group your jobs.
/// Label keys and values can be no longer than 63 characters, can only contain
/// lowercase letters, numeric characters, underscores and dashes.
/// International characters are allowed. Label values are optional. Label
/// keys must start with a letter and each label in the list must have a
/// different key.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. The reservation that job would use. User can specify a
/// reservation to execute the job. If reservation is not set, reservation is
/// determined based on the rules defined by the reservation assignments. The
/// expected format is
/// `projects/{project}/locations/{location}/reservations/{reservation}`.
/// Forces the query to use on-demand billing when set to `none`, which
/// requires the project or organization to have
/// `reservation_override_mode` set to `ALLOW_ANY_OVERRIDE`.
pub reservation: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobConfiguration {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [job_type][crate::model::JobConfiguration::job_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_job_type("example");
/// ```
pub fn set_job_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_type = v.into();
self
}
/// Sets the value of [query][crate::model::JobConfiguration::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfiguration::new().set_query(JobConfigurationQuery::default()/* use setters */);
/// ```
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationQuery>,
{
self.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::JobConfiguration::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationQuery;
/// let x = JobConfiguration::new().set_or_clear_query(Some(JobConfigurationQuery::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_query(None::<JobConfigurationQuery>);
/// ```
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationQuery>,
{
self.query = v.map(|x| x.into());
self
}
/// Sets the value of [load][crate::model::JobConfiguration::load].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfiguration::new().set_load(JobConfigurationLoad::default()/* use setters */);
/// ```
pub fn set_load<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationLoad>,
{
self.load = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [load][crate::model::JobConfiguration::load].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationLoad;
/// let x = JobConfiguration::new().set_or_clear_load(Some(JobConfigurationLoad::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_load(None::<JobConfigurationLoad>);
/// ```
pub fn set_or_clear_load<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationLoad>,
{
self.load = v.map(|x| x.into());
self
}
/// Sets the value of [copy][crate::model::JobConfiguration::copy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// let x = JobConfiguration::new().set_copy(JobConfigurationTableCopy::default()/* use setters */);
/// ```
pub fn set_copy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationTableCopy>,
{
self.copy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [copy][crate::model::JobConfiguration::copy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationTableCopy;
/// let x = JobConfiguration::new().set_or_clear_copy(Some(JobConfigurationTableCopy::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_copy(None::<JobConfigurationTableCopy>);
/// ```
pub fn set_or_clear_copy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationTableCopy>,
{
self.copy = v.map(|x| x.into());
self
}
/// Sets the value of [extract][crate::model::JobConfiguration::extract].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfiguration::new().set_extract(JobConfigurationExtract::default()/* use setters */);
/// ```
pub fn set_extract<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationExtract>,
{
self.extract = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [extract][crate::model::JobConfiguration::extract].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use google_cloud_bigquery_v2::model::JobConfigurationExtract;
/// let x = JobConfiguration::new().set_or_clear_extract(Some(JobConfigurationExtract::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_extract(None::<JobConfigurationExtract>);
/// ```
pub fn set_or_clear_extract<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobConfigurationExtract>,
{
self.extract = v.map(|x| x.into());
self
}
/// Sets the value of [dry_run][crate::model::JobConfiguration::dry_run].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use wkt::BoolValue;
/// let x = JobConfiguration::new().set_dry_run(BoolValue::default()/* use setters */);
/// ```
pub fn set_dry_run<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.dry_run = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dry_run][crate::model::JobConfiguration::dry_run].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use wkt::BoolValue;
/// let x = JobConfiguration::new().set_or_clear_dry_run(Some(BoolValue::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_dry_run(None::<BoolValue>);
/// ```
pub fn set_or_clear_dry_run<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.dry_run = v.map(|x| x.into());
self
}
/// Sets the value of [job_timeout_ms][crate::model::JobConfiguration::job_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use wkt::Int64Value;
/// let x = JobConfiguration::new().set_job_timeout_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_job_timeout_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.job_timeout_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [job_timeout_ms][crate::model::JobConfiguration::job_timeout_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// use wkt::Int64Value;
/// let x = JobConfiguration::new().set_or_clear_job_timeout_ms(Some(Int64Value::default()/* use setters */));
/// let x = JobConfiguration::new().set_or_clear_job_timeout_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_job_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.job_timeout_ms = v.map(|x| x.into());
self
}
/// Sets the value of [max_slots][crate::model::JobConfiguration::max_slots].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_max_slots(42);
/// ```
pub fn set_max_slots<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i32>,
{
self.max_slots = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_slots][crate::model::JobConfiguration::max_slots].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_or_clear_max_slots(Some(42));
/// let x = JobConfiguration::new().set_or_clear_max_slots(None::<i32>);
/// ```
pub fn set_or_clear_max_slots<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i32>,
{
self.max_slots = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::JobConfiguration::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [reservation][crate::model::JobConfiguration::reservation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_reservation("example");
/// ```
pub fn set_reservation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reservation][crate::model::JobConfiguration::reservation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobConfiguration;
/// let x = JobConfiguration::new().set_or_clear_reservation(Some("example"));
/// let x = JobConfiguration::new().set_or_clear_reservation(None::<String>);
/// ```
pub fn set_or_clear_reservation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for JobConfiguration {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobConfiguration"
}
}
/// Reason about why a Job was created from a
/// [`jobs.query`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query)
/// method when used with `JOB_CREATION_OPTIONAL` Job creation mode.
///
/// For
/// [`jobs.insert`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert)
/// method calls it will always be `REQUESTED`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobCreationReason {
/// Output only. Specifies the high level reason why a Job was created.
pub code: crate::model::job_creation_reason::Code,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobCreationReason {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [code][crate::model::JobCreationReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobCreationReason;
/// use google_cloud_bigquery_v2::model::job_creation_reason::Code;
/// let x0 = JobCreationReason::new().set_code(Code::Requested);
/// let x1 = JobCreationReason::new().set_code(Code::LongRunning);
/// let x2 = JobCreationReason::new().set_code(Code::LargeResults);
/// ```
pub fn set_code<T: std::convert::Into<crate::model::job_creation_reason::Code>>(
mut self,
v: T,
) -> Self {
self.code = v.into();
self
}
}
impl wkt::message::Message for JobCreationReason {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobCreationReason"
}
}
/// Defines additional types related to [JobCreationReason].
pub mod job_creation_reason {
#[allow(unused_imports)]
use super::*;
/// Indicates the high level reason why a job was created.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
/// Reason is not specified.
Unspecified,
/// Job creation was requested.
Requested,
/// The query request ran beyond a system defined timeout specified by the
/// [timeoutMs field in the
/// QueryRequest](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest).
/// As a result it was considered a long running operation for which a job
/// was created.
LongRunning,
/// The results from the query cannot fit in the response.
LargeResults,
/// BigQuery has determined that the query needs to be executed as a Job.
Other,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Code::value] or
/// [Code::name].
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Requested => std::option::Option::Some(1),
Self::LongRunning => std::option::Option::Some(2),
Self::LargeResults => std::option::Option::Some(3),
Self::Other => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
Self::Requested => std::option::Option::Some("REQUESTED"),
Self::LongRunning => std::option::Option::Some("LONG_RUNNING"),
Self::LargeResults => std::option::Option::Some("LARGE_RESULTS"),
Self::Other => std::option::Option::Some("OTHER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Requested,
2 => Self::LongRunning,
3 => Self::LargeResults,
4 => Self::Other,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CODE_UNSPECIFIED" => Self::Unspecified,
"REQUESTED" => Self::Requested,
"LONG_RUNNING" => Self::LongRunning,
"LARGE_RESULTS" => Self::LargeResults,
"OTHER" => Self::Other,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Code {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Requested => serializer.serialize_i32(1),
Self::LongRunning => serializer.serialize_i32(2),
Self::LargeResults => serializer.serialize_i32(3),
Self::Other => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
".google.cloud.bigquery.v2.JobCreationReason.Code",
))
}
}
}
/// A job reference is a fully qualified identifier for referring to a job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobReference {
/// Required. The ID of the project containing this job.
pub project_id: std::string::String,
/// Required. The ID of the job. The ID must contain only letters (a-z, A-Z),
/// numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024
/// characters.
pub job_id: std::string::String,
/// Optional. The geographic location of the job. The default value is US.
///
/// For more information about BigQuery locations, see:
/// <https://cloud.google.com/bigquery/docs/locations>
pub location: std::option::Option<wkt::StringValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::JobReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobReference;
/// let x = JobReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [job_id][crate::model::JobReference::job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobReference;
/// let x = JobReference::new().set_job_id("example");
/// ```
pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.job_id = v.into();
self
}
/// Sets the value of [location][crate::model::JobReference::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobReference;
/// use wkt::StringValue;
/// let x = JobReference::new().set_location(StringValue::default()/* use setters */);
/// ```
pub fn set_location<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.location = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [location][crate::model::JobReference::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobReference;
/// use wkt::StringValue;
/// let x = JobReference::new().set_or_clear_location(Some(StringValue::default()/* use setters */));
/// let x = JobReference::new().set_or_clear_location(None::<StringValue>);
/// ```
pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.location = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for JobReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobReference"
}
}
/// An operation within a stage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExplainQueryStep {
/// Machine-readable operation type.
pub kind: std::string::String,
/// Human-readable description of the step(s).
pub substeps: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExplainQueryStep {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::ExplainQueryStep::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStep;
/// let x = ExplainQueryStep::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [substeps][crate::model::ExplainQueryStep::substeps].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStep;
/// let x = ExplainQueryStep::new().set_substeps(["a", "b", "c"]);
/// ```
pub fn set_substeps<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.substeps = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ExplainQueryStep {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExplainQueryStep"
}
}
/// A single stage of query execution.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExplainQueryStage {
/// Human-readable name for the stage.
pub name: std::string::String,
/// Unique ID for the stage within the plan.
pub id: std::option::Option<wkt::Int64Value>,
/// Stage start time represented as milliseconds since the epoch.
pub start_ms: i64,
/// Stage end time represented as milliseconds since the epoch.
pub end_ms: i64,
/// IDs for stages that are inputs to this stage.
pub input_stages: std::vec::Vec<i64>,
/// Relative amount of time the average shard spent waiting to be
/// scheduled.
pub wait_ratio_avg: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the average shard spent waiting to be scheduled.
pub wait_ms_avg: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the slowest shard spent waiting to be
/// scheduled.
pub wait_ratio_max: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the slowest shard spent waiting to be scheduled.
pub wait_ms_max: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the average shard spent reading input.
pub read_ratio_avg: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the average shard spent reading input.
pub read_ms_avg: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the slowest shard spent reading input.
pub read_ratio_max: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the slowest shard spent reading input.
pub read_ms_max: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the average shard spent on CPU-bound tasks.
pub compute_ratio_avg: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the average shard spent on CPU-bound tasks.
pub compute_ms_avg: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the slowest shard spent on CPU-bound tasks.
pub compute_ratio_max: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the slowest shard spent on CPU-bound tasks.
pub compute_ms_max: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the average shard spent on writing output.
pub write_ratio_avg: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the average shard spent on writing output.
pub write_ms_avg: std::option::Option<wkt::Int64Value>,
/// Relative amount of time the slowest shard spent on writing output.
pub write_ratio_max: std::option::Option<wkt::DoubleValue>,
/// Milliseconds the slowest shard spent on writing output.
pub write_ms_max: std::option::Option<wkt::Int64Value>,
/// Total number of bytes written to shuffle.
pub shuffle_output_bytes: std::option::Option<wkt::Int64Value>,
/// Total number of bytes written to shuffle and spilled to disk.
pub shuffle_output_bytes_spilled: std::option::Option<wkt::Int64Value>,
/// Number of records read into the stage.
pub records_read: std::option::Option<wkt::Int64Value>,
/// Number of records written by the stage.
pub records_written: std::option::Option<wkt::Int64Value>,
/// Number of parallel input segments to be processed
pub parallel_inputs: std::option::Option<wkt::Int64Value>,
/// Number of parallel input segments completed.
pub completed_parallel_inputs: std::option::Option<wkt::Int64Value>,
/// Current status for this stage.
pub status: std::string::String,
/// List of operations within the stage in dependency order (approximately
/// chronological).
pub steps: std::vec::Vec<crate::model::ExplainQueryStep>,
/// Slot-milliseconds used by the stage.
pub slot_ms: std::option::Option<wkt::Int64Value>,
/// Output only. Compute mode for this stage.
pub compute_mode: crate::model::explain_query_stage::ComputeMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExplainQueryStage {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ExplainQueryStage::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = ExplainQueryStage::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [id][crate::model::ExplainQueryStage::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_id(Int64Value::default()/* use setters */);
/// ```
pub fn set_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.id = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [id][crate::model::ExplainQueryStage::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_id(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_id(None::<Int64Value>);
/// ```
pub fn set_or_clear_id<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.id = v.map(|x| x.into());
self
}
/// Sets the value of [start_ms][crate::model::ExplainQueryStage::start_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = ExplainQueryStage::new().set_start_ms(42);
/// ```
pub fn set_start_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.start_ms = v.into();
self
}
/// Sets the value of [end_ms][crate::model::ExplainQueryStage::end_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = ExplainQueryStage::new().set_end_ms(42);
/// ```
pub fn set_end_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.end_ms = v.into();
self
}
/// Sets the value of [input_stages][crate::model::ExplainQueryStage::input_stages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = ExplainQueryStage::new().set_input_stages([1, 2, 3]);
/// ```
pub fn set_input_stages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i64>,
{
use std::iter::Iterator;
self.input_stages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [wait_ratio_avg][crate::model::ExplainQueryStage::wait_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_wait_ratio_avg(DoubleValue::default()/* use setters */);
/// ```
pub fn set_wait_ratio_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wait_ratio_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wait_ratio_avg][crate::model::ExplainQueryStage::wait_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_wait_ratio_avg(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_wait_ratio_avg(None::<DoubleValue>);
/// ```
pub fn set_or_clear_wait_ratio_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wait_ratio_avg = v.map(|x| x.into());
self
}
/// Sets the value of [wait_ms_avg][crate::model::ExplainQueryStage::wait_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_wait_ms_avg(Int64Value::default()/* use setters */);
/// ```
pub fn set_wait_ms_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.wait_ms_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wait_ms_avg][crate::model::ExplainQueryStage::wait_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_wait_ms_avg(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_wait_ms_avg(None::<Int64Value>);
/// ```
pub fn set_or_clear_wait_ms_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.wait_ms_avg = v.map(|x| x.into());
self
}
/// Sets the value of [wait_ratio_max][crate::model::ExplainQueryStage::wait_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_wait_ratio_max(DoubleValue::default()/* use setters */);
/// ```
pub fn set_wait_ratio_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wait_ratio_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wait_ratio_max][crate::model::ExplainQueryStage::wait_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_wait_ratio_max(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_wait_ratio_max(None::<DoubleValue>);
/// ```
pub fn set_or_clear_wait_ratio_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wait_ratio_max = v.map(|x| x.into());
self
}
/// Sets the value of [wait_ms_max][crate::model::ExplainQueryStage::wait_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_wait_ms_max(Int64Value::default()/* use setters */);
/// ```
pub fn set_wait_ms_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.wait_ms_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wait_ms_max][crate::model::ExplainQueryStage::wait_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_wait_ms_max(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_wait_ms_max(None::<Int64Value>);
/// ```
pub fn set_or_clear_wait_ms_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.wait_ms_max = v.map(|x| x.into());
self
}
/// Sets the value of [read_ratio_avg][crate::model::ExplainQueryStage::read_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_read_ratio_avg(DoubleValue::default()/* use setters */);
/// ```
pub fn set_read_ratio_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.read_ratio_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_ratio_avg][crate::model::ExplainQueryStage::read_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_read_ratio_avg(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_read_ratio_avg(None::<DoubleValue>);
/// ```
pub fn set_or_clear_read_ratio_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.read_ratio_avg = v.map(|x| x.into());
self
}
/// Sets the value of [read_ms_avg][crate::model::ExplainQueryStage::read_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_read_ms_avg(Int64Value::default()/* use setters */);
/// ```
pub fn set_read_ms_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.read_ms_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_ms_avg][crate::model::ExplainQueryStage::read_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_read_ms_avg(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_read_ms_avg(None::<Int64Value>);
/// ```
pub fn set_or_clear_read_ms_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.read_ms_avg = v.map(|x| x.into());
self
}
/// Sets the value of [read_ratio_max][crate::model::ExplainQueryStage::read_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_read_ratio_max(DoubleValue::default()/* use setters */);
/// ```
pub fn set_read_ratio_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.read_ratio_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_ratio_max][crate::model::ExplainQueryStage::read_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_read_ratio_max(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_read_ratio_max(None::<DoubleValue>);
/// ```
pub fn set_or_clear_read_ratio_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.read_ratio_max = v.map(|x| x.into());
self
}
/// Sets the value of [read_ms_max][crate::model::ExplainQueryStage::read_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_read_ms_max(Int64Value::default()/* use setters */);
/// ```
pub fn set_read_ms_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.read_ms_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_ms_max][crate::model::ExplainQueryStage::read_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_read_ms_max(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_read_ms_max(None::<Int64Value>);
/// ```
pub fn set_or_clear_read_ms_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.read_ms_max = v.map(|x| x.into());
self
}
/// Sets the value of [compute_ratio_avg][crate::model::ExplainQueryStage::compute_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_compute_ratio_avg(DoubleValue::default()/* use setters */);
/// ```
pub fn set_compute_ratio_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.compute_ratio_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [compute_ratio_avg][crate::model::ExplainQueryStage::compute_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_compute_ratio_avg(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_compute_ratio_avg(None::<DoubleValue>);
/// ```
pub fn set_or_clear_compute_ratio_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.compute_ratio_avg = v.map(|x| x.into());
self
}
/// Sets the value of [compute_ms_avg][crate::model::ExplainQueryStage::compute_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_compute_ms_avg(Int64Value::default()/* use setters */);
/// ```
pub fn set_compute_ms_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.compute_ms_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [compute_ms_avg][crate::model::ExplainQueryStage::compute_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_compute_ms_avg(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_compute_ms_avg(None::<Int64Value>);
/// ```
pub fn set_or_clear_compute_ms_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.compute_ms_avg = v.map(|x| x.into());
self
}
/// Sets the value of [compute_ratio_max][crate::model::ExplainQueryStage::compute_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_compute_ratio_max(DoubleValue::default()/* use setters */);
/// ```
pub fn set_compute_ratio_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.compute_ratio_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [compute_ratio_max][crate::model::ExplainQueryStage::compute_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_compute_ratio_max(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_compute_ratio_max(None::<DoubleValue>);
/// ```
pub fn set_or_clear_compute_ratio_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.compute_ratio_max = v.map(|x| x.into());
self
}
/// Sets the value of [compute_ms_max][crate::model::ExplainQueryStage::compute_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_compute_ms_max(Int64Value::default()/* use setters */);
/// ```
pub fn set_compute_ms_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.compute_ms_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [compute_ms_max][crate::model::ExplainQueryStage::compute_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_compute_ms_max(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_compute_ms_max(None::<Int64Value>);
/// ```
pub fn set_or_clear_compute_ms_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.compute_ms_max = v.map(|x| x.into());
self
}
/// Sets the value of [write_ratio_avg][crate::model::ExplainQueryStage::write_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_write_ratio_avg(DoubleValue::default()/* use setters */);
/// ```
pub fn set_write_ratio_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.write_ratio_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [write_ratio_avg][crate::model::ExplainQueryStage::write_ratio_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_write_ratio_avg(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_write_ratio_avg(None::<DoubleValue>);
/// ```
pub fn set_or_clear_write_ratio_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.write_ratio_avg = v.map(|x| x.into());
self
}
/// Sets the value of [write_ms_avg][crate::model::ExplainQueryStage::write_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_write_ms_avg(Int64Value::default()/* use setters */);
/// ```
pub fn set_write_ms_avg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.write_ms_avg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [write_ms_avg][crate::model::ExplainQueryStage::write_ms_avg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_write_ms_avg(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_write_ms_avg(None::<Int64Value>);
/// ```
pub fn set_or_clear_write_ms_avg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.write_ms_avg = v.map(|x| x.into());
self
}
/// Sets the value of [write_ratio_max][crate::model::ExplainQueryStage::write_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_write_ratio_max(DoubleValue::default()/* use setters */);
/// ```
pub fn set_write_ratio_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.write_ratio_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [write_ratio_max][crate::model::ExplainQueryStage::write_ratio_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::DoubleValue;
/// let x = ExplainQueryStage::new().set_or_clear_write_ratio_max(Some(DoubleValue::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_write_ratio_max(None::<DoubleValue>);
/// ```
pub fn set_or_clear_write_ratio_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.write_ratio_max = v.map(|x| x.into());
self
}
/// Sets the value of [write_ms_max][crate::model::ExplainQueryStage::write_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_write_ms_max(Int64Value::default()/* use setters */);
/// ```
pub fn set_write_ms_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.write_ms_max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [write_ms_max][crate::model::ExplainQueryStage::write_ms_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_write_ms_max(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_write_ms_max(None::<Int64Value>);
/// ```
pub fn set_or_clear_write_ms_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.write_ms_max = v.map(|x| x.into());
self
}
/// Sets the value of [shuffle_output_bytes][crate::model::ExplainQueryStage::shuffle_output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_shuffle_output_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_shuffle_output_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.shuffle_output_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [shuffle_output_bytes][crate::model::ExplainQueryStage::shuffle_output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_shuffle_output_bytes(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_shuffle_output_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_shuffle_output_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.shuffle_output_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [shuffle_output_bytes_spilled][crate::model::ExplainQueryStage::shuffle_output_bytes_spilled].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_shuffle_output_bytes_spilled(Int64Value::default()/* use setters */);
/// ```
pub fn set_shuffle_output_bytes_spilled<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.shuffle_output_bytes_spilled = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [shuffle_output_bytes_spilled][crate::model::ExplainQueryStage::shuffle_output_bytes_spilled].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_shuffle_output_bytes_spilled(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_shuffle_output_bytes_spilled(None::<Int64Value>);
/// ```
pub fn set_or_clear_shuffle_output_bytes_spilled<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.shuffle_output_bytes_spilled = v.map(|x| x.into());
self
}
/// Sets the value of [records_read][crate::model::ExplainQueryStage::records_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_records_read(Int64Value::default()/* use setters */);
/// ```
pub fn set_records_read<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.records_read = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [records_read][crate::model::ExplainQueryStage::records_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_records_read(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_records_read(None::<Int64Value>);
/// ```
pub fn set_or_clear_records_read<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.records_read = v.map(|x| x.into());
self
}
/// Sets the value of [records_written][crate::model::ExplainQueryStage::records_written].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_records_written(Int64Value::default()/* use setters */);
/// ```
pub fn set_records_written<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.records_written = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [records_written][crate::model::ExplainQueryStage::records_written].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_records_written(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_records_written(None::<Int64Value>);
/// ```
pub fn set_or_clear_records_written<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.records_written = v.map(|x| x.into());
self
}
/// Sets the value of [parallel_inputs][crate::model::ExplainQueryStage::parallel_inputs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_parallel_inputs(Int64Value::default()/* use setters */);
/// ```
pub fn set_parallel_inputs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.parallel_inputs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parallel_inputs][crate::model::ExplainQueryStage::parallel_inputs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_parallel_inputs(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_parallel_inputs(None::<Int64Value>);
/// ```
pub fn set_or_clear_parallel_inputs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.parallel_inputs = v.map(|x| x.into());
self
}
/// Sets the value of [completed_parallel_inputs][crate::model::ExplainQueryStage::completed_parallel_inputs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_completed_parallel_inputs(Int64Value::default()/* use setters */);
/// ```
pub fn set_completed_parallel_inputs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.completed_parallel_inputs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [completed_parallel_inputs][crate::model::ExplainQueryStage::completed_parallel_inputs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_completed_parallel_inputs(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_completed_parallel_inputs(None::<Int64Value>);
/// ```
pub fn set_or_clear_completed_parallel_inputs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.completed_parallel_inputs = v.map(|x| x.into());
self
}
/// Sets the value of [status][crate::model::ExplainQueryStage::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = ExplainQueryStage::new().set_status("example");
/// ```
pub fn set_status<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status = v.into();
self
}
/// Sets the value of [steps][crate::model::ExplainQueryStage::steps].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use google_cloud_bigquery_v2::model::ExplainQueryStep;
/// let x = ExplainQueryStage::new()
/// .set_steps([
/// ExplainQueryStep::default()/* use setters */,
/// ExplainQueryStep::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_steps<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ExplainQueryStep>,
{
use std::iter::Iterator;
self.steps = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [slot_ms][crate::model::ExplainQueryStage::slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_slot_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [slot_ms][crate::model::ExplainQueryStage::slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use wkt::Int64Value;
/// let x = ExplainQueryStage::new().set_or_clear_slot_ms(Some(Int64Value::default()/* use setters */));
/// let x = ExplainQueryStage::new().set_or_clear_slot_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [compute_mode][crate::model::ExplainQueryStage::compute_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// use google_cloud_bigquery_v2::model::explain_query_stage::ComputeMode;
/// let x0 = ExplainQueryStage::new().set_compute_mode(ComputeMode::Bigquery);
/// let x1 = ExplainQueryStage::new().set_compute_mode(ComputeMode::BiEngine);
/// ```
pub fn set_compute_mode<
T: std::convert::Into<crate::model::explain_query_stage::ComputeMode>,
>(
mut self,
v: T,
) -> Self {
self.compute_mode = v.into();
self
}
}
impl wkt::message::Message for ExplainQueryStage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExplainQueryStage"
}
}
/// Defines additional types related to [ExplainQueryStage].
pub mod explain_query_stage {
#[allow(unused_imports)]
use super::*;
/// Indicates the type of compute mode.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ComputeMode {
/// ComputeMode type not specified.
Unspecified,
/// This stage was processed using BigQuery slots.
Bigquery,
/// This stage was processed using BI Engine compute.
BiEngine,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ComputeMode::value] or
/// [ComputeMode::name].
UnknownValue(compute_mode::UnknownValue),
}
#[doc(hidden)]
pub mod compute_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ComputeMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Bigquery => std::option::Option::Some(1),
Self::BiEngine => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("COMPUTE_MODE_UNSPECIFIED"),
Self::Bigquery => std::option::Option::Some("BIGQUERY"),
Self::BiEngine => std::option::Option::Some("BI_ENGINE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ComputeMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ComputeMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ComputeMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Bigquery,
2 => Self::BiEngine,
_ => Self::UnknownValue(compute_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ComputeMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"COMPUTE_MODE_UNSPECIFIED" => Self::Unspecified,
"BIGQUERY" => Self::Bigquery,
"BI_ENGINE" => Self::BiEngine,
_ => Self::UnknownValue(compute_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ComputeMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Bigquery => serializer.serialize_i32(1),
Self::BiEngine => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ComputeMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComputeMode>::new(
".google.cloud.bigquery.v2.ExplainQueryStage.ComputeMode",
))
}
}
}
/// Summary of the state of query execution at a given time.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryTimelineSample {
/// Milliseconds elapsed since the start of query execution.
pub elapsed_ms: std::option::Option<wkt::Int64Value>,
/// Cumulative slot-ms consumed by the query.
pub total_slot_ms: std::option::Option<wkt::Int64Value>,
/// Total units of work remaining for the query. This number can be revised
/// (increased or decreased) while the query is running.
pub pending_units: std::option::Option<wkt::Int64Value>,
/// Total parallel units of work completed by this query.
pub completed_units: std::option::Option<wkt::Int64Value>,
/// Total number of active workers. This does not correspond directly to
/// slot usage. This is the largest value observed since the last sample.
pub active_units: std::option::Option<wkt::Int64Value>,
/// Total shuffle usage ratio in shuffle RAM per reservation of this query.
/// This will be provided for reservation customers only.
pub shuffle_ram_usage_ratio: std::option::Option<wkt::DoubleValue>,
/// Units of work that can be scheduled immediately. Providing additional slots
/// for these units of work will accelerate the query, if no other query in
/// the reservation needs additional slots.
pub estimated_runnable_units: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryTimelineSample {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [elapsed_ms][crate::model::QueryTimelineSample::elapsed_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_elapsed_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_elapsed_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.elapsed_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [elapsed_ms][crate::model::QueryTimelineSample::elapsed_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_elapsed_ms(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_elapsed_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_elapsed_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.elapsed_ms = v.map(|x| x.into());
self
}
/// Sets the value of [total_slot_ms][crate::model::QueryTimelineSample::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_total_slot_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_slot_ms][crate::model::QueryTimelineSample::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_total_slot_ms(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_total_slot_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [pending_units][crate::model::QueryTimelineSample::pending_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_pending_units(Int64Value::default()/* use setters */);
/// ```
pub fn set_pending_units<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.pending_units = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pending_units][crate::model::QueryTimelineSample::pending_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_pending_units(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_pending_units(None::<Int64Value>);
/// ```
pub fn set_or_clear_pending_units<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.pending_units = v.map(|x| x.into());
self
}
/// Sets the value of [completed_units][crate::model::QueryTimelineSample::completed_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_completed_units(Int64Value::default()/* use setters */);
/// ```
pub fn set_completed_units<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.completed_units = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [completed_units][crate::model::QueryTimelineSample::completed_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_completed_units(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_completed_units(None::<Int64Value>);
/// ```
pub fn set_or_clear_completed_units<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.completed_units = v.map(|x| x.into());
self
}
/// Sets the value of [active_units][crate::model::QueryTimelineSample::active_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_active_units(Int64Value::default()/* use setters */);
/// ```
pub fn set_active_units<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.active_units = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [active_units][crate::model::QueryTimelineSample::active_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_active_units(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_active_units(None::<Int64Value>);
/// ```
pub fn set_or_clear_active_units<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.active_units = v.map(|x| x.into());
self
}
/// Sets the value of [shuffle_ram_usage_ratio][crate::model::QueryTimelineSample::shuffle_ram_usage_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::DoubleValue;
/// let x = QueryTimelineSample::new().set_shuffle_ram_usage_ratio(DoubleValue::default()/* use setters */);
/// ```
pub fn set_shuffle_ram_usage_ratio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.shuffle_ram_usage_ratio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [shuffle_ram_usage_ratio][crate::model::QueryTimelineSample::shuffle_ram_usage_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::DoubleValue;
/// let x = QueryTimelineSample::new().set_or_clear_shuffle_ram_usage_ratio(Some(DoubleValue::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_shuffle_ram_usage_ratio(None::<DoubleValue>);
/// ```
pub fn set_or_clear_shuffle_ram_usage_ratio<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.shuffle_ram_usage_ratio = v.map(|x| x.into());
self
}
/// Sets the value of [estimated_runnable_units][crate::model::QueryTimelineSample::estimated_runnable_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_estimated_runnable_units(Int64Value::default()/* use setters */);
/// ```
pub fn set_estimated_runnable_units<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.estimated_runnable_units = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [estimated_runnable_units][crate::model::QueryTimelineSample::estimated_runnable_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// use wkt::Int64Value;
/// let x = QueryTimelineSample::new().set_or_clear_estimated_runnable_units(Some(Int64Value::default()/* use setters */));
/// let x = QueryTimelineSample::new().set_or_clear_estimated_runnable_units(None::<Int64Value>);
/// ```
pub fn set_or_clear_estimated_runnable_units<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.estimated_runnable_units = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for QueryTimelineSample {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryTimelineSample"
}
}
/// The external service cost is a portion of the total cost, these costs are not
/// additive with total_bytes_billed. Moreover, this field only track external
/// service costs that will show up as BigQuery costs (e.g. training BigQuery
/// ML job with google cloud CAIP or Automl Tables services), not other costs
/// which may be accrued by running the query (e.g. reading from Bigtable or
/// Cloud Storage). The external service costs with different billing sku (e.g.
/// CAIP job is charged based on VM usage) are converted to BigQuery
/// billed_bytes and slot_ms with equivalent amount of US dollars. Services may
/// not directly correlate to these metrics, but these are the equivalents for
/// billing purposes.
/// Output only.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalServiceCost {
/// External service name.
pub external_service: std::string::String,
/// External service cost in terms of bigquery bytes processed.
pub bytes_processed: std::option::Option<wkt::Int64Value>,
/// External service cost in terms of bigquery bytes billed.
pub bytes_billed: std::option::Option<wkt::Int64Value>,
/// External service cost in terms of bigquery slot milliseconds.
pub slot_ms: std::option::Option<wkt::Int64Value>,
/// Non-preemptable reserved slots used for external job.
/// For example, reserved slots for Cloua AI Platform job are the VM usages
/// converted to BigQuery slot with equivalent mount of price.
pub reserved_slot_count: i64,
/// The billing method used for the external job.
/// This field, set to `SERVICES_SKU`, is only used when billing under the
/// services SKU. Otherwise, it is unspecified for backward compatibility.
pub billing_method: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalServiceCost {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [external_service][crate::model::ExternalServiceCost::external_service].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// let x = ExternalServiceCost::new().set_external_service("example");
/// ```
pub fn set_external_service<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.external_service = v.into();
self
}
/// Sets the value of [bytes_processed][crate::model::ExternalServiceCost::bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bytes_processed][crate::model::ExternalServiceCost::bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_or_clear_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = ExternalServiceCost::new().set_or_clear_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [bytes_billed][crate::model::ExternalServiceCost::bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_bytes_billed(Int64Value::default()/* use setters */);
/// ```
pub fn set_bytes_billed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bytes_billed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bytes_billed][crate::model::ExternalServiceCost::bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_or_clear_bytes_billed(Some(Int64Value::default()/* use setters */));
/// let x = ExternalServiceCost::new().set_or_clear_bytes_billed(None::<Int64Value>);
/// ```
pub fn set_or_clear_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bytes_billed = v.map(|x| x.into());
self
}
/// Sets the value of [slot_ms][crate::model::ExternalServiceCost::slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_slot_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [slot_ms][crate::model::ExternalServiceCost::slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// use wkt::Int64Value;
/// let x = ExternalServiceCost::new().set_or_clear_slot_ms(Some(Int64Value::default()/* use setters */));
/// let x = ExternalServiceCost::new().set_or_clear_slot_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [reserved_slot_count][crate::model::ExternalServiceCost::reserved_slot_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// let x = ExternalServiceCost::new().set_reserved_slot_count(42);
/// ```
pub fn set_reserved_slot_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.reserved_slot_count = v.into();
self
}
/// Sets the value of [billing_method][crate::model::ExternalServiceCost::billing_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// let x = ExternalServiceCost::new().set_billing_method("example");
/// ```
pub fn set_billing_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.billing_method = v.into();
self
}
}
impl wkt::message::Message for ExternalServiceCost {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalServiceCost"
}
}
/// Statistics for the EXPORT DATA statement as part of Query Job. EXTRACT
/// JOB statistics are populated in JobStatistics4.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataStatistics {
/// Number of destination files generated in case of EXPORT DATA
/// statement only.
pub file_count: std::option::Option<wkt::Int64Value>,
/// [Alpha] Number of destination rows generated in case of EXPORT DATA
/// statement only.
pub row_count: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportDataStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [file_count][crate::model::ExportDataStatistics::file_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// use wkt::Int64Value;
/// let x = ExportDataStatistics::new().set_file_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_file_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.file_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [file_count][crate::model::ExportDataStatistics::file_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// use wkt::Int64Value;
/// let x = ExportDataStatistics::new().set_or_clear_file_count(Some(Int64Value::default()/* use setters */));
/// let x = ExportDataStatistics::new().set_or_clear_file_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_file_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.file_count = v.map(|x| x.into());
self
}
/// Sets the value of [row_count][crate::model::ExportDataStatistics::row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// use wkt::Int64Value;
/// let x = ExportDataStatistics::new().set_row_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_row_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.row_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [row_count][crate::model::ExportDataStatistics::row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// use wkt::Int64Value;
/// let x = ExportDataStatistics::new().set_or_clear_row_count(Some(Int64Value::default()/* use setters */));
/// let x = ExportDataStatistics::new().set_or_clear_row_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_row_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.row_count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ExportDataStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExportDataStatistics"
}
}
/// Reason why BI Engine didn't accelerate the query (or sub-query).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BiEngineReason {
/// Output only. High-level BI Engine reason for partial or disabled
/// acceleration
pub code: crate::model::bi_engine_reason::Code,
/// Output only. Free form human-readable reason for partial or disabled
/// acceleration.
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BiEngineReason {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [code][crate::model::BiEngineReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BiEngineReason;
/// use google_cloud_bigquery_v2::model::bi_engine_reason::Code;
/// let x0 = BiEngineReason::new().set_code(Code::NoReservation);
/// let x1 = BiEngineReason::new().set_code(Code::InsufficientReservation);
/// let x2 = BiEngineReason::new().set_code(Code::UnsupportedSqlText);
/// ```
pub fn set_code<T: std::convert::Into<crate::model::bi_engine_reason::Code>>(
mut self,
v: T,
) -> Self {
self.code = v.into();
self
}
/// Sets the value of [message][crate::model::BiEngineReason::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BiEngineReason;
/// let x = BiEngineReason::new().set_message("example");
/// ```
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for BiEngineReason {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BiEngineReason"
}
}
/// Defines additional types related to [BiEngineReason].
pub mod bi_engine_reason {
#[allow(unused_imports)]
use super::*;
/// Indicates the high-level reason for no/partial acceleration
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
/// BiEngineReason not specified.
Unspecified,
/// No reservation available for BI Engine acceleration.
NoReservation,
/// Not enough memory available for BI Engine acceleration.
InsufficientReservation,
/// This particular SQL text is not supported for acceleration by BI Engine.
UnsupportedSqlText,
/// Input too large for acceleration by BI Engine.
InputTooLarge,
/// Catch-all code for all other cases for partial or disabled acceleration.
OtherReason,
/// One or more tables were not eligible for BI Engine acceleration.
TableExcluded,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Code::value] or
/// [Code::name].
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NoReservation => std::option::Option::Some(1),
Self::InsufficientReservation => std::option::Option::Some(2),
Self::UnsupportedSqlText => std::option::Option::Some(4),
Self::InputTooLarge => std::option::Option::Some(5),
Self::OtherReason => std::option::Option::Some(6),
Self::TableExcluded => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
Self::InsufficientReservation => {
std::option::Option::Some("INSUFFICIENT_RESERVATION")
}
Self::UnsupportedSqlText => std::option::Option::Some("UNSUPPORTED_SQL_TEXT"),
Self::InputTooLarge => std::option::Option::Some("INPUT_TOO_LARGE"),
Self::OtherReason => std::option::Option::Some("OTHER_REASON"),
Self::TableExcluded => std::option::Option::Some("TABLE_EXCLUDED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NoReservation,
2 => Self::InsufficientReservation,
4 => Self::UnsupportedSqlText,
5 => Self::InputTooLarge,
6 => Self::OtherReason,
7 => Self::TableExcluded,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CODE_UNSPECIFIED" => Self::Unspecified,
"NO_RESERVATION" => Self::NoReservation,
"INSUFFICIENT_RESERVATION" => Self::InsufficientReservation,
"UNSUPPORTED_SQL_TEXT" => Self::UnsupportedSqlText,
"INPUT_TOO_LARGE" => Self::InputTooLarge,
"OTHER_REASON" => Self::OtherReason,
"TABLE_EXCLUDED" => Self::TableExcluded,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Code {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NoReservation => serializer.serialize_i32(1),
Self::InsufficientReservation => serializer.serialize_i32(2),
Self::UnsupportedSqlText => serializer.serialize_i32(4),
Self::InputTooLarge => serializer.serialize_i32(5),
Self::OtherReason => serializer.serialize_i32(6),
Self::TableExcluded => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
".google.cloud.bigquery.v2.BiEngineReason.Code",
))
}
}
}
/// Statistics for a BI Engine specific query.
/// Populated as part of JobStatistics2
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BiEngineStatistics {
/// Output only. Specifies which mode of BI Engine acceleration was performed
/// (if any).
pub bi_engine_mode: crate::model::bi_engine_statistics::BiEngineMode,
/// Output only. Specifies which mode of BI Engine acceleration was performed
/// (if any).
pub acceleration_mode: crate::model::bi_engine_statistics::BiEngineAccelerationMode,
/// In case of DISABLED or PARTIAL bi_engine_mode, these contain the
/// explanatory reasons as to why BI Engine could not accelerate.
/// In case the full query was accelerated, this field is not populated.
pub bi_engine_reasons: std::vec::Vec<crate::model::BiEngineReason>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BiEngineStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [bi_engine_mode][crate::model::BiEngineStatistics::bi_engine_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BiEngineStatistics;
/// use google_cloud_bigquery_v2::model::bi_engine_statistics::BiEngineMode;
/// let x0 = BiEngineStatistics::new().set_bi_engine_mode(BiEngineMode::Disabled);
/// let x1 = BiEngineStatistics::new().set_bi_engine_mode(BiEngineMode::Partial);
/// let x2 = BiEngineStatistics::new().set_bi_engine_mode(BiEngineMode::Full);
/// ```
pub fn set_bi_engine_mode<
T: std::convert::Into<crate::model::bi_engine_statistics::BiEngineMode>,
>(
mut self,
v: T,
) -> Self {
self.bi_engine_mode = v.into();
self
}
/// Sets the value of [acceleration_mode][crate::model::BiEngineStatistics::acceleration_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BiEngineStatistics;
/// use google_cloud_bigquery_v2::model::bi_engine_statistics::BiEngineAccelerationMode;
/// let x0 = BiEngineStatistics::new().set_acceleration_mode(BiEngineAccelerationMode::BiEngineDisabled);
/// let x1 = BiEngineStatistics::new().set_acceleration_mode(BiEngineAccelerationMode::PartialInput);
/// let x2 = BiEngineStatistics::new().set_acceleration_mode(BiEngineAccelerationMode::FullInput);
/// ```
pub fn set_acceleration_mode<
T: std::convert::Into<crate::model::bi_engine_statistics::BiEngineAccelerationMode>,
>(
mut self,
v: T,
) -> Self {
self.acceleration_mode = v.into();
self
}
/// Sets the value of [bi_engine_reasons][crate::model::BiEngineStatistics::bi_engine_reasons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BiEngineStatistics;
/// use google_cloud_bigquery_v2::model::BiEngineReason;
/// let x = BiEngineStatistics::new()
/// .set_bi_engine_reasons([
/// BiEngineReason::default()/* use setters */,
/// BiEngineReason::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_bi_engine_reasons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BiEngineReason>,
{
use std::iter::Iterator;
self.bi_engine_reasons = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BiEngineStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BiEngineStatistics"
}
}
/// Defines additional types related to [BiEngineStatistics].
pub mod bi_engine_statistics {
#[allow(unused_imports)]
use super::*;
/// Indicates the type of BI Engine acceleration.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum BiEngineMode {
/// BiEngineMode type not specified.
AccelerationModeUnspecified,
/// BI Engine disabled the acceleration. bi_engine_reasons
/// specifies a more detailed reason.
Disabled,
/// Part of the query was accelerated using BI Engine.
/// See bi_engine_reasons for why parts of the query were not
/// accelerated.
Partial,
/// All of the query was accelerated using BI Engine.
Full,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [BiEngineMode::value] or
/// [BiEngineMode::name].
UnknownValue(bi_engine_mode::UnknownValue),
}
#[doc(hidden)]
pub mod bi_engine_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl BiEngineMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::AccelerationModeUnspecified => std::option::Option::Some(0),
Self::Disabled => std::option::Option::Some(1),
Self::Partial => std::option::Option::Some(2),
Self::Full => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::AccelerationModeUnspecified => {
std::option::Option::Some("ACCELERATION_MODE_UNSPECIFIED")
}
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::Partial => std::option::Option::Some("PARTIAL"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for BiEngineMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for BiEngineMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for BiEngineMode {
fn from(value: i32) -> Self {
match value {
0 => Self::AccelerationModeUnspecified,
1 => Self::Disabled,
2 => Self::Partial,
3 => Self::Full,
_ => Self::UnknownValue(bi_engine_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for BiEngineMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ACCELERATION_MODE_UNSPECIFIED" => Self::AccelerationModeUnspecified,
"DISABLED" => Self::Disabled,
"PARTIAL" => Self::Partial,
"FULL" => Self::Full,
_ => Self::UnknownValue(bi_engine_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for BiEngineMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::AccelerationModeUnspecified => serializer.serialize_i32(0),
Self::Disabled => serializer.serialize_i32(1),
Self::Partial => serializer.serialize_i32(2),
Self::Full => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for BiEngineMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<BiEngineMode>::new(
".google.cloud.bigquery.v2.BiEngineStatistics.BiEngineMode",
))
}
}
/// Indicates the type of BI Engine acceleration.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum BiEngineAccelerationMode {
/// BiEngineMode type not specified.
Unspecified,
/// BI Engine acceleration was attempted but disabled. bi_engine_reasons
/// specifies a more detailed reason.
BiEngineDisabled,
/// Some inputs were accelerated using BI Engine.
/// See bi_engine_reasons for why parts of the query were not
/// accelerated.
PartialInput,
/// All of the query inputs were accelerated using BI Engine.
FullInput,
/// All of the query was accelerated using BI Engine.
FullQuery,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [BiEngineAccelerationMode::value] or
/// [BiEngineAccelerationMode::name].
UnknownValue(bi_engine_acceleration_mode::UnknownValue),
}
#[doc(hidden)]
pub mod bi_engine_acceleration_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl BiEngineAccelerationMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::BiEngineDisabled => std::option::Option::Some(1),
Self::PartialInput => std::option::Option::Some(2),
Self::FullInput => std::option::Option::Some(3),
Self::FullQuery => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("BI_ENGINE_ACCELERATION_MODE_UNSPECIFIED")
}
Self::BiEngineDisabled => std::option::Option::Some("BI_ENGINE_DISABLED"),
Self::PartialInput => std::option::Option::Some("PARTIAL_INPUT"),
Self::FullInput => std::option::Option::Some("FULL_INPUT"),
Self::FullQuery => std::option::Option::Some("FULL_QUERY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for BiEngineAccelerationMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for BiEngineAccelerationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for BiEngineAccelerationMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::BiEngineDisabled,
2 => Self::PartialInput,
3 => Self::FullInput,
4 => Self::FullQuery,
_ => Self::UnknownValue(bi_engine_acceleration_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for BiEngineAccelerationMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"BI_ENGINE_ACCELERATION_MODE_UNSPECIFIED" => Self::Unspecified,
"BI_ENGINE_DISABLED" => Self::BiEngineDisabled,
"PARTIAL_INPUT" => Self::PartialInput,
"FULL_INPUT" => Self::FullInput,
"FULL_QUERY" => Self::FullQuery,
_ => Self::UnknownValue(bi_engine_acceleration_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for BiEngineAccelerationMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::BiEngineDisabled => serializer.serialize_i32(1),
Self::PartialInput => serializer.serialize_i32(2),
Self::FullInput => serializer.serialize_i32(3),
Self::FullQuery => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for BiEngineAccelerationMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<BiEngineAccelerationMode>::new(
".google.cloud.bigquery.v2.BiEngineStatistics.BiEngineAccelerationMode",
),
)
}
}
}
/// Reason about why no search index was used in the search query (or
/// sub-query).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IndexUnusedReason {
/// Specifies the high-level reason for the scenario when no search index was
/// used.
pub code: std::option::Option<crate::model::index_unused_reason::Code>,
/// Free form human-readable reason for the scenario when no search index was
/// used.
pub message: std::option::Option<std::string::String>,
/// Specifies the base table involved in the reason that no search index was
/// used.
pub base_table: std::option::Option<crate::model::TableReference>,
/// Specifies the name of the unused search index, if available.
pub index_name: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IndexUnusedReason {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [code][crate::model::IndexUnusedReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// use google_cloud_bigquery_v2::model::index_unused_reason::Code;
/// let x0 = IndexUnusedReason::new().set_code(Code::IndexConfigNotAvailable);
/// let x1 = IndexUnusedReason::new().set_code(Code::PendingIndexCreation);
/// let x2 = IndexUnusedReason::new().set_code(Code::BaseTableTruncated);
/// ```
pub fn set_code<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::index_unused_reason::Code>,
{
self.code = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [code][crate::model::IndexUnusedReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// use google_cloud_bigquery_v2::model::index_unused_reason::Code;
/// let x0 = IndexUnusedReason::new().set_or_clear_code(Some(Code::IndexConfigNotAvailable));
/// let x1 = IndexUnusedReason::new().set_or_clear_code(Some(Code::PendingIndexCreation));
/// let x2 = IndexUnusedReason::new().set_or_clear_code(Some(Code::BaseTableTruncated));
/// let x_none = IndexUnusedReason::new().set_or_clear_code(None::<Code>);
/// ```
pub fn set_or_clear_code<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::index_unused_reason::Code>,
{
self.code = v.map(|x| x.into());
self
}
/// Sets the value of [message][crate::model::IndexUnusedReason::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = IndexUnusedReason::new().set_message("example");
/// ```
pub fn set_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message][crate::model::IndexUnusedReason::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = IndexUnusedReason::new().set_or_clear_message(Some("example"));
/// let x = IndexUnusedReason::new().set_or_clear_message(None::<String>);
/// ```
pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = v.map(|x| x.into());
self
}
/// Sets the value of [base_table][crate::model::IndexUnusedReason::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = IndexUnusedReason::new().set_base_table(TableReference::default()/* use setters */);
/// ```
pub fn set_base_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [base_table][crate::model::IndexUnusedReason::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = IndexUnusedReason::new().set_or_clear_base_table(Some(TableReference::default()/* use setters */));
/// let x = IndexUnusedReason::new().set_or_clear_base_table(None::<TableReference>);
/// ```
pub fn set_or_clear_base_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = v.map(|x| x.into());
self
}
/// Sets the value of [index_name][crate::model::IndexUnusedReason::index_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = IndexUnusedReason::new().set_index_name("example");
/// ```
pub fn set_index_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.index_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index_name][crate::model::IndexUnusedReason::index_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = IndexUnusedReason::new().set_or_clear_index_name(Some("example"));
/// let x = IndexUnusedReason::new().set_or_clear_index_name(None::<String>);
/// ```
pub fn set_or_clear_index_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.index_name = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for IndexUnusedReason {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.IndexUnusedReason"
}
}
/// Defines additional types related to [IndexUnusedReason].
pub mod index_unused_reason {
#[allow(unused_imports)]
use super::*;
/// Indicates the high-level reason for the scenario when no search index was
/// used.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
/// Code not specified.
Unspecified,
/// Indicates the search index configuration has not been created.
IndexConfigNotAvailable,
/// Indicates the search index creation has not been completed.
PendingIndexCreation,
/// Indicates the base table has been truncated (rows have been removed
/// from table with TRUNCATE TABLE statement) since the last time the search
/// index was refreshed.
BaseTableTruncated,
/// Indicates the search index configuration has been changed since the last
/// time the search index was refreshed.
IndexConfigModified,
/// Indicates the search query accesses data at a timestamp before the last
/// time the search index was refreshed.
TimeTravelQuery,
/// Indicates the usage of search index will not contribute to any pruning
/// improvement for the search function, e.g. when the search predicate is in
/// a disjunction with other non-search predicates.
NoPruningPower,
/// Indicates the search index does not cover all fields in the search
/// function.
UnindexedSearchFields,
/// Indicates the search index does not support the given search query
/// pattern.
UnsupportedSearchPattern,
/// Indicates the query has been optimized by using a materialized view.
OptimizedWithMaterializedView,
/// Indicates the query has been secured by data masking, and thus search
/// indexes are not applicable.
SecuredByDataMasking,
/// Indicates that the search index and the search function call do not
/// have the same text analyzer.
MismatchedTextAnalyzer,
/// Indicates the base table is too small (below a certain threshold).
/// The index does not provide noticeable search performance gains
/// when the base table is too small.
BaseTableTooSmall,
/// Indicates that the total size of indexed base tables in your organization
/// exceeds your region's limit and the index is not used in the query. To
/// index larger base tables, you can
/// <a
/// href="https://cloud.google.com/bigquery/docs/search-index#use_your_own_reservation">use
/// your own reservation</a> for index-management jobs.
BaseTableTooLarge,
/// Indicates that the estimated performance gain from using the search index
/// is too low for the given search query.
EstimatedPerformanceGainTooLow,
/// Indicates that the column metadata index (which the search index depends
/// on) is not used. User can refer to the [column metadata index
/// usage](https://cloud.google.com/bigquery/docs/metadata-indexing-managed-tables#view_column_metadata_index_usage)
/// for more details on why it was not used.
ColumnMetadataIndexNotUsed,
/// Indicates that search indexes can not be used for search query with
/// STANDARD edition.
NotSupportedInStandardEdition,
/// Indicates that an option in the search function that cannot make use of
/// the index has been selected.
IndexSuppressedByFunctionOption,
/// Indicates that the query was cached, and thus the search index was not
/// used.
QueryCacheHit,
/// The index cannot be used in the search query because it is stale.
StaleIndex,
/// Indicates an internal error that causes the search index to be unused.
InternalError,
/// Indicates that the reason search indexes cannot be used in the query is
/// not covered by any of the other IndexUnusedReason options.
OtherReason,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Code::value] or
/// [Code::name].
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::IndexConfigNotAvailable => std::option::Option::Some(1),
Self::PendingIndexCreation => std::option::Option::Some(2),
Self::BaseTableTruncated => std::option::Option::Some(3),
Self::IndexConfigModified => std::option::Option::Some(4),
Self::TimeTravelQuery => std::option::Option::Some(5),
Self::NoPruningPower => std::option::Option::Some(6),
Self::UnindexedSearchFields => std::option::Option::Some(7),
Self::UnsupportedSearchPattern => std::option::Option::Some(8),
Self::OptimizedWithMaterializedView => std::option::Option::Some(9),
Self::SecuredByDataMasking => std::option::Option::Some(11),
Self::MismatchedTextAnalyzer => std::option::Option::Some(12),
Self::BaseTableTooSmall => std::option::Option::Some(13),
Self::BaseTableTooLarge => std::option::Option::Some(14),
Self::EstimatedPerformanceGainTooLow => std::option::Option::Some(15),
Self::ColumnMetadataIndexNotUsed => std::option::Option::Some(21),
Self::NotSupportedInStandardEdition => std::option::Option::Some(17),
Self::IndexSuppressedByFunctionOption => std::option::Option::Some(18),
Self::QueryCacheHit => std::option::Option::Some(19),
Self::StaleIndex => std::option::Option::Some(20),
Self::InternalError => std::option::Option::Some(10),
Self::OtherReason => std::option::Option::Some(16),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
Self::IndexConfigNotAvailable => {
std::option::Option::Some("INDEX_CONFIG_NOT_AVAILABLE")
}
Self::PendingIndexCreation => std::option::Option::Some("PENDING_INDEX_CREATION"),
Self::BaseTableTruncated => std::option::Option::Some("BASE_TABLE_TRUNCATED"),
Self::IndexConfigModified => std::option::Option::Some("INDEX_CONFIG_MODIFIED"),
Self::TimeTravelQuery => std::option::Option::Some("TIME_TRAVEL_QUERY"),
Self::NoPruningPower => std::option::Option::Some("NO_PRUNING_POWER"),
Self::UnindexedSearchFields => std::option::Option::Some("UNINDEXED_SEARCH_FIELDS"),
Self::UnsupportedSearchPattern => {
std::option::Option::Some("UNSUPPORTED_SEARCH_PATTERN")
}
Self::OptimizedWithMaterializedView => {
std::option::Option::Some("OPTIMIZED_WITH_MATERIALIZED_VIEW")
}
Self::SecuredByDataMasking => std::option::Option::Some("SECURED_BY_DATA_MASKING"),
Self::MismatchedTextAnalyzer => {
std::option::Option::Some("MISMATCHED_TEXT_ANALYZER")
}
Self::BaseTableTooSmall => std::option::Option::Some("BASE_TABLE_TOO_SMALL"),
Self::BaseTableTooLarge => std::option::Option::Some("BASE_TABLE_TOO_LARGE"),
Self::EstimatedPerformanceGainTooLow => {
std::option::Option::Some("ESTIMATED_PERFORMANCE_GAIN_TOO_LOW")
}
Self::ColumnMetadataIndexNotUsed => {
std::option::Option::Some("COLUMN_METADATA_INDEX_NOT_USED")
}
Self::NotSupportedInStandardEdition => {
std::option::Option::Some("NOT_SUPPORTED_IN_STANDARD_EDITION")
}
Self::IndexSuppressedByFunctionOption => {
std::option::Option::Some("INDEX_SUPPRESSED_BY_FUNCTION_OPTION")
}
Self::QueryCacheHit => std::option::Option::Some("QUERY_CACHE_HIT"),
Self::StaleIndex => std::option::Option::Some("STALE_INDEX"),
Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
Self::OtherReason => std::option::Option::Some("OTHER_REASON"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::IndexConfigNotAvailable,
2 => Self::PendingIndexCreation,
3 => Self::BaseTableTruncated,
4 => Self::IndexConfigModified,
5 => Self::TimeTravelQuery,
6 => Self::NoPruningPower,
7 => Self::UnindexedSearchFields,
8 => Self::UnsupportedSearchPattern,
9 => Self::OptimizedWithMaterializedView,
10 => Self::InternalError,
11 => Self::SecuredByDataMasking,
12 => Self::MismatchedTextAnalyzer,
13 => Self::BaseTableTooSmall,
14 => Self::BaseTableTooLarge,
15 => Self::EstimatedPerformanceGainTooLow,
16 => Self::OtherReason,
17 => Self::NotSupportedInStandardEdition,
18 => Self::IndexSuppressedByFunctionOption,
19 => Self::QueryCacheHit,
20 => Self::StaleIndex,
21 => Self::ColumnMetadataIndexNotUsed,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CODE_UNSPECIFIED" => Self::Unspecified,
"INDEX_CONFIG_NOT_AVAILABLE" => Self::IndexConfigNotAvailable,
"PENDING_INDEX_CREATION" => Self::PendingIndexCreation,
"BASE_TABLE_TRUNCATED" => Self::BaseTableTruncated,
"INDEX_CONFIG_MODIFIED" => Self::IndexConfigModified,
"TIME_TRAVEL_QUERY" => Self::TimeTravelQuery,
"NO_PRUNING_POWER" => Self::NoPruningPower,
"UNINDEXED_SEARCH_FIELDS" => Self::UnindexedSearchFields,
"UNSUPPORTED_SEARCH_PATTERN" => Self::UnsupportedSearchPattern,
"OPTIMIZED_WITH_MATERIALIZED_VIEW" => Self::OptimizedWithMaterializedView,
"SECURED_BY_DATA_MASKING" => Self::SecuredByDataMasking,
"MISMATCHED_TEXT_ANALYZER" => Self::MismatchedTextAnalyzer,
"BASE_TABLE_TOO_SMALL" => Self::BaseTableTooSmall,
"BASE_TABLE_TOO_LARGE" => Self::BaseTableTooLarge,
"ESTIMATED_PERFORMANCE_GAIN_TOO_LOW" => Self::EstimatedPerformanceGainTooLow,
"COLUMN_METADATA_INDEX_NOT_USED" => Self::ColumnMetadataIndexNotUsed,
"NOT_SUPPORTED_IN_STANDARD_EDITION" => Self::NotSupportedInStandardEdition,
"INDEX_SUPPRESSED_BY_FUNCTION_OPTION" => Self::IndexSuppressedByFunctionOption,
"QUERY_CACHE_HIT" => Self::QueryCacheHit,
"STALE_INDEX" => Self::StaleIndex,
"INTERNAL_ERROR" => Self::InternalError,
"OTHER_REASON" => Self::OtherReason,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Code {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::IndexConfigNotAvailable => serializer.serialize_i32(1),
Self::PendingIndexCreation => serializer.serialize_i32(2),
Self::BaseTableTruncated => serializer.serialize_i32(3),
Self::IndexConfigModified => serializer.serialize_i32(4),
Self::TimeTravelQuery => serializer.serialize_i32(5),
Self::NoPruningPower => serializer.serialize_i32(6),
Self::UnindexedSearchFields => serializer.serialize_i32(7),
Self::UnsupportedSearchPattern => serializer.serialize_i32(8),
Self::OptimizedWithMaterializedView => serializer.serialize_i32(9),
Self::SecuredByDataMasking => serializer.serialize_i32(11),
Self::MismatchedTextAnalyzer => serializer.serialize_i32(12),
Self::BaseTableTooSmall => serializer.serialize_i32(13),
Self::BaseTableTooLarge => serializer.serialize_i32(14),
Self::EstimatedPerformanceGainTooLow => serializer.serialize_i32(15),
Self::ColumnMetadataIndexNotUsed => serializer.serialize_i32(21),
Self::NotSupportedInStandardEdition => serializer.serialize_i32(17),
Self::IndexSuppressedByFunctionOption => serializer.serialize_i32(18),
Self::QueryCacheHit => serializer.serialize_i32(19),
Self::StaleIndex => serializer.serialize_i32(20),
Self::InternalError => serializer.serialize_i32(10),
Self::OtherReason => serializer.serialize_i32(16),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
".google.cloud.bigquery.v2.IndexUnusedReason.Code",
))
}
}
}
/// Statistics for index pruning.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IndexPruningStats {
/// The base table reference.
pub base_table: std::option::Option<crate::model::TableReference>,
/// The index id.
pub index_id: std::option::Option<std::string::String>,
/// The number of parallel inputs before index pruning.
pub pre_index_pruning_parallel_input_count: std::option::Option<i64>,
/// The number of parallel inputs after index pruning.
pub post_index_pruning_parallel_input_count: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IndexPruningStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [base_table][crate::model::IndexPruningStats::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = IndexPruningStats::new().set_base_table(TableReference::default()/* use setters */);
/// ```
pub fn set_base_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [base_table][crate::model::IndexPruningStats::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = IndexPruningStats::new().set_or_clear_base_table(Some(TableReference::default()/* use setters */));
/// let x = IndexPruningStats::new().set_or_clear_base_table(None::<TableReference>);
/// ```
pub fn set_or_clear_base_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = v.map(|x| x.into());
self
}
/// Sets the value of [index_id][crate::model::IndexPruningStats::index_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_index_id("example");
/// ```
pub fn set_index_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.index_id = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index_id][crate::model::IndexPruningStats::index_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_or_clear_index_id(Some("example"));
/// let x = IndexPruningStats::new().set_or_clear_index_id(None::<String>);
/// ```
pub fn set_or_clear_index_id<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.index_id = v.map(|x| x.into());
self
}
/// Sets the value of [pre_index_pruning_parallel_input_count][crate::model::IndexPruningStats::pre_index_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_pre_index_pruning_parallel_input_count(42);
/// ```
pub fn set_pre_index_pruning_parallel_input_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.pre_index_pruning_parallel_input_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pre_index_pruning_parallel_input_count][crate::model::IndexPruningStats::pre_index_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_or_clear_pre_index_pruning_parallel_input_count(Some(42));
/// let x = IndexPruningStats::new().set_or_clear_pre_index_pruning_parallel_input_count(None::<i32>);
/// ```
pub fn set_or_clear_pre_index_pruning_parallel_input_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<i64>,
{
self.pre_index_pruning_parallel_input_count = v.map(|x| x.into());
self
}
/// Sets the value of [post_index_pruning_parallel_input_count][crate::model::IndexPruningStats::post_index_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_post_index_pruning_parallel_input_count(42);
/// ```
pub fn set_post_index_pruning_parallel_input_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.post_index_pruning_parallel_input_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [post_index_pruning_parallel_input_count][crate::model::IndexPruningStats::post_index_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = IndexPruningStats::new().set_or_clear_post_index_pruning_parallel_input_count(Some(42));
/// let x = IndexPruningStats::new().set_or_clear_post_index_pruning_parallel_input_count(None::<i32>);
/// ```
pub fn set_or_clear_post_index_pruning_parallel_input_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<i64>,
{
self.post_index_pruning_parallel_input_count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for IndexPruningStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.IndexPruningStats"
}
}
/// Indicates the stored columns usage in the query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StoredColumnsUsage {
/// Specifies whether the query was accelerated with stored columns.
pub is_query_accelerated: std::option::Option<bool>,
/// Specifies the base table.
pub base_table: std::option::Option<crate::model::TableReference>,
/// If stored columns were not used, explain why.
pub stored_columns_unused_reasons:
std::vec::Vec<crate::model::stored_columns_usage::StoredColumnsUnusedReason>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StoredColumnsUsage {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [is_query_accelerated][crate::model::StoredColumnsUsage::is_query_accelerated].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// let x = StoredColumnsUsage::new().set_is_query_accelerated(true);
/// ```
pub fn set_is_query_accelerated<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.is_query_accelerated = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_query_accelerated][crate::model::StoredColumnsUsage::is_query_accelerated].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// let x = StoredColumnsUsage::new().set_or_clear_is_query_accelerated(Some(false));
/// let x = StoredColumnsUsage::new().set_or_clear_is_query_accelerated(None::<bool>);
/// ```
pub fn set_or_clear_is_query_accelerated<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.is_query_accelerated = v.map(|x| x.into());
self
}
/// Sets the value of [base_table][crate::model::StoredColumnsUsage::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = StoredColumnsUsage::new().set_base_table(TableReference::default()/* use setters */);
/// ```
pub fn set_base_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [base_table][crate::model::StoredColumnsUsage::base_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = StoredColumnsUsage::new().set_or_clear_base_table(Some(TableReference::default()/* use setters */));
/// let x = StoredColumnsUsage::new().set_or_clear_base_table(None::<TableReference>);
/// ```
pub fn set_or_clear_base_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table = v.map(|x| x.into());
self
}
/// Sets the value of [stored_columns_unused_reasons][crate::model::StoredColumnsUsage::stored_columns_unused_reasons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// let x = StoredColumnsUsage::new()
/// .set_stored_columns_unused_reasons([
/// StoredColumnsUnusedReason::default()/* use setters */,
/// StoredColumnsUnusedReason::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_stored_columns_unused_reasons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::stored_columns_usage::StoredColumnsUnusedReason>,
{
use std::iter::Iterator;
self.stored_columns_unused_reasons = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StoredColumnsUsage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StoredColumnsUsage"
}
}
/// Defines additional types related to [StoredColumnsUsage].
pub mod stored_columns_usage {
#[allow(unused_imports)]
use super::*;
/// If the stored column was not used, explain why.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StoredColumnsUnusedReason {
/// Specifies the high-level reason for the unused scenario, each reason must
/// have a code associated.
pub code: std::option::Option<
crate::model::stored_columns_usage::stored_columns_unused_reason::Code,
>,
/// Specifies the detailed description for the scenario.
pub message: std::option::Option<std::string::String>,
/// Specifies which columns were not covered by the stored columns for the
/// specified code up to 20 columns. This is populated when the code is
/// STORED_COLUMNS_COVER_INSUFFICIENT and BASE_TABLE_HAS_CLS.
pub uncovered_columns: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StoredColumnsUnusedReason {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [code][crate::model::stored_columns_usage::StoredColumnsUnusedReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// use google_cloud_bigquery_v2::model::stored_columns_usage::stored_columns_unused_reason::Code;
/// let x0 = StoredColumnsUnusedReason::new().set_code(Code::StoredColumnsCoverInsufficient);
/// let x1 = StoredColumnsUnusedReason::new().set_code(Code::BaseTableHasRls);
/// let x2 = StoredColumnsUnusedReason::new().set_code(Code::BaseTableHasCls);
/// ```
pub fn set_code<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::stored_columns_usage::stored_columns_unused_reason::Code,
>,
{
self.code = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [code][crate::model::stored_columns_usage::StoredColumnsUnusedReason::code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// use google_cloud_bigquery_v2::model::stored_columns_usage::stored_columns_unused_reason::Code;
/// let x0 = StoredColumnsUnusedReason::new().set_or_clear_code(Some(Code::StoredColumnsCoverInsufficient));
/// let x1 = StoredColumnsUnusedReason::new().set_or_clear_code(Some(Code::BaseTableHasRls));
/// let x2 = StoredColumnsUnusedReason::new().set_or_clear_code(Some(Code::BaseTableHasCls));
/// let x_none = StoredColumnsUnusedReason::new().set_or_clear_code(None::<Code>);
/// ```
pub fn set_or_clear_code<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::stored_columns_usage::stored_columns_unused_reason::Code,
>,
{
self.code = v.map(|x| x.into());
self
}
/// Sets the value of [message][crate::model::stored_columns_usage::StoredColumnsUnusedReason::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// let x = StoredColumnsUnusedReason::new().set_message("example");
/// ```
pub fn set_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message][crate::model::stored_columns_usage::StoredColumnsUnusedReason::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// let x = StoredColumnsUnusedReason::new().set_or_clear_message(Some("example"));
/// let x = StoredColumnsUnusedReason::new().set_or_clear_message(None::<String>);
/// ```
pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.message = v.map(|x| x.into());
self
}
/// Sets the value of [uncovered_columns][crate::model::stored_columns_usage::StoredColumnsUnusedReason::uncovered_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::stored_columns_usage::StoredColumnsUnusedReason;
/// let x = StoredColumnsUnusedReason::new().set_uncovered_columns(["a", "b", "c"]);
/// ```
pub fn set_uncovered_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.uncovered_columns = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StoredColumnsUnusedReason {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StoredColumnsUsage.StoredColumnsUnusedReason"
}
}
/// Defines additional types related to [StoredColumnsUnusedReason].
pub mod stored_columns_unused_reason {
#[allow(unused_imports)]
use super::*;
/// Indicates the high-level reason for the scenario when stored columns
/// cannot be used in the query.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
/// Default value.
Unspecified,
/// If stored columns do not fully cover the columns.
StoredColumnsCoverInsufficient,
/// If the base table has RLS (Row Level Security).
BaseTableHasRls,
/// If the base table has CLS (Column Level Security).
BaseTableHasCls,
/// If the provided prefilter is not supported.
UnsupportedPrefilter,
/// If an internal error is preventing stored columns from being used.
InternalError,
/// Indicates that the reason stored columns cannot be used in the query is
/// not covered by any of the other StoredColumnsUnusedReason options.
OtherReason,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Code::value] or
/// [Code::name].
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::StoredColumnsCoverInsufficient => std::option::Option::Some(1),
Self::BaseTableHasRls => std::option::Option::Some(2),
Self::BaseTableHasCls => std::option::Option::Some(3),
Self::UnsupportedPrefilter => std::option::Option::Some(4),
Self::InternalError => std::option::Option::Some(5),
Self::OtherReason => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
Self::StoredColumnsCoverInsufficient => {
std::option::Option::Some("STORED_COLUMNS_COVER_INSUFFICIENT")
}
Self::BaseTableHasRls => std::option::Option::Some("BASE_TABLE_HAS_RLS"),
Self::BaseTableHasCls => std::option::Option::Some("BASE_TABLE_HAS_CLS"),
Self::UnsupportedPrefilter => {
std::option::Option::Some("UNSUPPORTED_PREFILTER")
}
Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
Self::OtherReason => std::option::Option::Some("OTHER_REASON"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::StoredColumnsCoverInsufficient,
2 => Self::BaseTableHasRls,
3 => Self::BaseTableHasCls,
4 => Self::UnsupportedPrefilter,
5 => Self::InternalError,
6 => Self::OtherReason,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CODE_UNSPECIFIED" => Self::Unspecified,
"STORED_COLUMNS_COVER_INSUFFICIENT" => Self::StoredColumnsCoverInsufficient,
"BASE_TABLE_HAS_RLS" => Self::BaseTableHasRls,
"BASE_TABLE_HAS_CLS" => Self::BaseTableHasCls,
"UNSUPPORTED_PREFILTER" => Self::UnsupportedPrefilter,
"INTERNAL_ERROR" => Self::InternalError,
"OTHER_REASON" => Self::OtherReason,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Code {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::StoredColumnsCoverInsufficient => serializer.serialize_i32(1),
Self::BaseTableHasRls => serializer.serialize_i32(2),
Self::BaseTableHasCls => serializer.serialize_i32(3),
Self::UnsupportedPrefilter => serializer.serialize_i32(4),
Self::InternalError => serializer.serialize_i32(5),
Self::OtherReason => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
".google.cloud.bigquery.v2.StoredColumnsUsage.StoredColumnsUnusedReason.Code",
))
}
}
}
}
/// Statistics for a search query.
/// Populated as part of JobStatistics2.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchStatistics {
/// Specifies the index usage mode for the query.
pub index_usage_mode: crate::model::search_statistics::IndexUsageMode,
/// When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains
/// why indexes were not used in all or part of the search query. If
/// `indexUsageMode` is `FULLY_USED`, this field is not populated.
pub index_unused_reasons: std::vec::Vec<crate::model::IndexUnusedReason>,
/// Search index pruning statistics, one for each base table that has a search
/// index. If a base table does not have a search index or the index does not
/// help with pruning on the base table, then there is no pruning statistics
/// for that table.
pub index_pruning_stats: std::vec::Vec<crate::model::IndexPruningStats>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SearchStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [index_usage_mode][crate::model::SearchStatistics::index_usage_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SearchStatistics;
/// use google_cloud_bigquery_v2::model::search_statistics::IndexUsageMode;
/// let x0 = SearchStatistics::new().set_index_usage_mode(IndexUsageMode::Unused);
/// let x1 = SearchStatistics::new().set_index_usage_mode(IndexUsageMode::PartiallyUsed);
/// let x2 = SearchStatistics::new().set_index_usage_mode(IndexUsageMode::FullyUsed);
/// ```
pub fn set_index_usage_mode<
T: std::convert::Into<crate::model::search_statistics::IndexUsageMode>,
>(
mut self,
v: T,
) -> Self {
self.index_usage_mode = v.into();
self
}
/// Sets the value of [index_unused_reasons][crate::model::SearchStatistics::index_unused_reasons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SearchStatistics;
/// use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = SearchStatistics::new()
/// .set_index_unused_reasons([
/// IndexUnusedReason::default()/* use setters */,
/// IndexUnusedReason::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_index_unused_reasons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::IndexUnusedReason>,
{
use std::iter::Iterator;
self.index_unused_reasons = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [index_pruning_stats][crate::model::SearchStatistics::index_pruning_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SearchStatistics;
/// use google_cloud_bigquery_v2::model::IndexPruningStats;
/// let x = SearchStatistics::new()
/// .set_index_pruning_stats([
/// IndexPruningStats::default()/* use setters */,
/// IndexPruningStats::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_index_pruning_stats<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::IndexPruningStats>,
{
use std::iter::Iterator;
self.index_pruning_stats = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SearchStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SearchStatistics"
}
}
/// Defines additional types related to [SearchStatistics].
pub mod search_statistics {
#[allow(unused_imports)]
use super::*;
/// Indicates the type of search index usage in the entire search query. In
/// this context, "usage" means that an index lookup is attempted to prune
/// base table data, with effectiveness depending on the selectivity of the
/// search term.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IndexUsageMode {
/// Index usage mode not specified.
Unspecified,
/// No search indexes were used in the search query. See
/// [`indexUnusedReasons`]
/// (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason)
/// for detailed reasons.
Unused,
/// Part of the search query used search indexes. See [`indexUnusedReasons`]
/// (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason)
/// for why other parts of the query did not use search indexes.
PartiallyUsed,
/// The entire search query used search indexes.
FullyUsed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [IndexUsageMode::value] or
/// [IndexUsageMode::name].
UnknownValue(index_usage_mode::UnknownValue),
}
#[doc(hidden)]
pub mod index_usage_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IndexUsageMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unused => std::option::Option::Some(1),
Self::PartiallyUsed => std::option::Option::Some(2),
Self::FullyUsed => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INDEX_USAGE_MODE_UNSPECIFIED"),
Self::Unused => std::option::Option::Some("UNUSED"),
Self::PartiallyUsed => std::option::Option::Some("PARTIALLY_USED"),
Self::FullyUsed => std::option::Option::Some("FULLY_USED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IndexUsageMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IndexUsageMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for IndexUsageMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unused,
2 => Self::PartiallyUsed,
4 => Self::FullyUsed,
_ => Self::UnknownValue(index_usage_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IndexUsageMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INDEX_USAGE_MODE_UNSPECIFIED" => Self::Unspecified,
"UNUSED" => Self::Unused,
"PARTIALLY_USED" => Self::PartiallyUsed,
"FULLY_USED" => Self::FullyUsed,
_ => Self::UnknownValue(index_usage_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IndexUsageMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unused => serializer.serialize_i32(1),
Self::PartiallyUsed => serializer.serialize_i32(2),
Self::FullyUsed => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IndexUsageMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexUsageMode>::new(
".google.cloud.bigquery.v2.SearchStatistics.IndexUsageMode",
))
}
}
}
/// Statistics for a vector search query.
/// Populated as part of JobStatistics2.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VectorSearchStatistics {
/// Specifies the index usage mode for the query.
pub index_usage_mode: crate::model::vector_search_statistics::IndexUsageMode,
/// When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains
/// why indexes were not used in all or part of the vector search query. If
/// `indexUsageMode` is `FULLY_USED`, this field is not populated.
pub index_unused_reasons: std::vec::Vec<crate::model::IndexUnusedReason>,
/// Specifies the usage of stored columns in the query when stored columns are
/// used in the query.
pub stored_columns_usages: std::vec::Vec<crate::model::StoredColumnsUsage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VectorSearchStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [index_usage_mode][crate::model::VectorSearchStatistics::index_usage_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::VectorSearchStatistics;
/// use google_cloud_bigquery_v2::model::vector_search_statistics::IndexUsageMode;
/// let x0 = VectorSearchStatistics::new().set_index_usage_mode(IndexUsageMode::Unused);
/// let x1 = VectorSearchStatistics::new().set_index_usage_mode(IndexUsageMode::PartiallyUsed);
/// let x2 = VectorSearchStatistics::new().set_index_usage_mode(IndexUsageMode::FullyUsed);
/// ```
pub fn set_index_usage_mode<
T: std::convert::Into<crate::model::vector_search_statistics::IndexUsageMode>,
>(
mut self,
v: T,
) -> Self {
self.index_usage_mode = v.into();
self
}
/// Sets the value of [index_unused_reasons][crate::model::VectorSearchStatistics::index_unused_reasons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::VectorSearchStatistics;
/// use google_cloud_bigquery_v2::model::IndexUnusedReason;
/// let x = VectorSearchStatistics::new()
/// .set_index_unused_reasons([
/// IndexUnusedReason::default()/* use setters */,
/// IndexUnusedReason::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_index_unused_reasons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::IndexUnusedReason>,
{
use std::iter::Iterator;
self.index_unused_reasons = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [stored_columns_usages][crate::model::VectorSearchStatistics::stored_columns_usages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::VectorSearchStatistics;
/// use google_cloud_bigquery_v2::model::StoredColumnsUsage;
/// let x = VectorSearchStatistics::new()
/// .set_stored_columns_usages([
/// StoredColumnsUsage::default()/* use setters */,
/// StoredColumnsUsage::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_stored_columns_usages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StoredColumnsUsage>,
{
use std::iter::Iterator;
self.stored_columns_usages = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for VectorSearchStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.VectorSearchStatistics"
}
}
/// Defines additional types related to [VectorSearchStatistics].
pub mod vector_search_statistics {
#[allow(unused_imports)]
use super::*;
/// Indicates the type of vector index usage in the entire vector search query.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IndexUsageMode {
/// Index usage mode not specified.
Unspecified,
/// No vector indexes were used in the vector search query. See
/// [`indexUnusedReasons`]
/// (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason)
/// for detailed reasons.
Unused,
/// Part of the vector search query used vector indexes. See
/// [`indexUnusedReasons`]
/// (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason)
/// for why other parts of the query did not use vector indexes.
PartiallyUsed,
/// The entire vector search query used vector indexes.
FullyUsed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [IndexUsageMode::value] or
/// [IndexUsageMode::name].
UnknownValue(index_usage_mode::UnknownValue),
}
#[doc(hidden)]
pub mod index_usage_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IndexUsageMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unused => std::option::Option::Some(1),
Self::PartiallyUsed => std::option::Option::Some(2),
Self::FullyUsed => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INDEX_USAGE_MODE_UNSPECIFIED"),
Self::Unused => std::option::Option::Some("UNUSED"),
Self::PartiallyUsed => std::option::Option::Some("PARTIALLY_USED"),
Self::FullyUsed => std::option::Option::Some("FULLY_USED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IndexUsageMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IndexUsageMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for IndexUsageMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unused,
2 => Self::PartiallyUsed,
4 => Self::FullyUsed,
_ => Self::UnknownValue(index_usage_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IndexUsageMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INDEX_USAGE_MODE_UNSPECIFIED" => Self::Unspecified,
"UNUSED" => Self::Unused,
"PARTIALLY_USED" => Self::PartiallyUsed,
"FULLY_USED" => Self::FullyUsed,
_ => Self::UnknownValue(index_usage_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IndexUsageMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unused => serializer.serialize_i32(1),
Self::PartiallyUsed => serializer.serialize_i32(2),
Self::FullyUsed => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IndexUsageMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexUsageMode>::new(
".google.cloud.bigquery.v2.VectorSearchStatistics.IndexUsageMode",
))
}
}
}
/// Query optimization information for a QUERY job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryInfo {
/// Output only. Information about query optimizations.
pub optimization_details: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [optimization_details][crate::model::QueryInfo::optimization_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryInfo;
/// use wkt::Struct;
/// let x = QueryInfo::new().set_optimization_details(Struct::default()/* use setters */);
/// ```
pub fn set_optimization_details<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.optimization_details = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [optimization_details][crate::model::QueryInfo::optimization_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryInfo;
/// use wkt::Struct;
/// let x = QueryInfo::new().set_or_clear_optimization_details(Some(Struct::default()/* use setters */));
/// let x = QueryInfo::new().set_or_clear_optimization_details(None::<Struct>);
/// ```
pub fn set_or_clear_optimization_details<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.optimization_details = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for QueryInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryInfo"
}
}
/// Statistics for a LOAD query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LoadQueryStatistics {
/// Output only. Number of source files in a LOAD query.
pub input_files: std::option::Option<wkt::Int64Value>,
/// Output only. Number of bytes of source data in a LOAD query.
pub input_file_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of rows imported in a LOAD query.
/// Note that while a LOAD query is in the running state, this value may
/// change.
pub output_rows: std::option::Option<wkt::Int64Value>,
/// Output only. Size of the loaded data in bytes. Note that while a LOAD query
/// is in the running state, this value may change.
pub output_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The number of bad records encountered while processing a LOAD
/// query. Note that if the job has failed because of more bad records
/// encountered than the maximum allowed in the load job configuration, then
/// this number can be less than the total number of bad records present in the
/// input data.
pub bad_records: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LoadQueryStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_files][crate::model::LoadQueryStatistics::input_files].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_input_files(Int64Value::default()/* use setters */);
/// ```
pub fn set_input_files<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_files = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_files][crate::model::LoadQueryStatistics::input_files].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_or_clear_input_files(Some(Int64Value::default()/* use setters */));
/// let x = LoadQueryStatistics::new().set_or_clear_input_files(None::<Int64Value>);
/// ```
pub fn set_or_clear_input_files<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_files = v.map(|x| x.into());
self
}
/// Sets the value of [input_file_bytes][crate::model::LoadQueryStatistics::input_file_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_input_file_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_input_file_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_file_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_file_bytes][crate::model::LoadQueryStatistics::input_file_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_or_clear_input_file_bytes(Some(Int64Value::default()/* use setters */));
/// let x = LoadQueryStatistics::new().set_or_clear_input_file_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_input_file_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_file_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [output_rows][crate::model::LoadQueryStatistics::output_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_output_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_output_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_rows][crate::model::LoadQueryStatistics::output_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_or_clear_output_rows(Some(Int64Value::default()/* use setters */));
/// let x = LoadQueryStatistics::new().set_or_clear_output_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_output_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_rows = v.map(|x| x.into());
self
}
/// Sets the value of [output_bytes][crate::model::LoadQueryStatistics::output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_output_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_output_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_bytes][crate::model::LoadQueryStatistics::output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_or_clear_output_bytes(Some(Int64Value::default()/* use setters */));
/// let x = LoadQueryStatistics::new().set_or_clear_output_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_output_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [bad_records][crate::model::LoadQueryStatistics::bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_bad_records(Int64Value::default()/* use setters */);
/// ```
pub fn set_bad_records<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bad_records = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bad_records][crate::model::LoadQueryStatistics::bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// use wkt::Int64Value;
/// let x = LoadQueryStatistics::new().set_or_clear_bad_records(Some(Int64Value::default()/* use setters */));
/// let x = LoadQueryStatistics::new().set_or_clear_bad_records(None::<Int64Value>);
/// ```
pub fn set_or_clear_bad_records<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bad_records = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for LoadQueryStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.LoadQueryStatistics"
}
}
/// Statistics related to Incremental Query Results. Populated as part of
/// JobStatistics2. This feature is not yet available.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IncrementalResultStats {
/// Output only. Reason why incremental query results are/were not written by
/// the query.
pub disabled_reason: crate::model::incremental_result_stats::DisabledReason,
/// Output only. Additional human-readable clarification, if available, for
/// DisabledReason.
pub disabled_reason_details: std::string::String,
/// Output only. The time at which the result table's contents were completely
/// replaced. May be absent if no results have been written or the query has
/// completed.
pub result_set_last_replace_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time at which the result table's contents were modified.
/// May be absent if no results have been written or the query has completed.
pub result_set_last_modify_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time at which the first incremental result was written. If
/// the query needed to restart internally, this only describes the final
/// attempt.
pub first_incremental_row_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time at which the last incremental result was written.
/// Does not include the final result written after query completion.
pub last_incremental_row_time: std::option::Option<wkt::Timestamp>,
/// Output only. Number of rows that were in the latest result set before query
/// completion.
pub incremental_row_count: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IncrementalResultStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [disabled_reason][crate::model::IncrementalResultStats::disabled_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use google_cloud_bigquery_v2::model::incremental_result_stats::DisabledReason;
/// let x0 = IncrementalResultStats::new().set_disabled_reason(DisabledReason::Other);
/// let x1 = IncrementalResultStats::new().set_disabled_reason(DisabledReason::UnsupportedOperator);
/// ```
pub fn set_disabled_reason<
T: std::convert::Into<crate::model::incremental_result_stats::DisabledReason>,
>(
mut self,
v: T,
) -> Self {
self.disabled_reason = v.into();
self
}
/// Sets the value of [disabled_reason_details][crate::model::IncrementalResultStats::disabled_reason_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// let x = IncrementalResultStats::new().set_disabled_reason_details("example");
/// ```
pub fn set_disabled_reason_details<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.disabled_reason_details = v.into();
self
}
/// Sets the value of [result_set_last_replace_time][crate::model::IncrementalResultStats::result_set_last_replace_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_result_set_last_replace_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_result_set_last_replace_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.result_set_last_replace_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [result_set_last_replace_time][crate::model::IncrementalResultStats::result_set_last_replace_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_or_clear_result_set_last_replace_time(Some(Timestamp::default()/* use setters */));
/// let x = IncrementalResultStats::new().set_or_clear_result_set_last_replace_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_result_set_last_replace_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.result_set_last_replace_time = v.map(|x| x.into());
self
}
/// Sets the value of [result_set_last_modify_time][crate::model::IncrementalResultStats::result_set_last_modify_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_result_set_last_modify_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_result_set_last_modify_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.result_set_last_modify_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [result_set_last_modify_time][crate::model::IncrementalResultStats::result_set_last_modify_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_or_clear_result_set_last_modify_time(Some(Timestamp::default()/* use setters */));
/// let x = IncrementalResultStats::new().set_or_clear_result_set_last_modify_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_result_set_last_modify_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.result_set_last_modify_time = v.map(|x| x.into());
self
}
/// Sets the value of [first_incremental_row_time][crate::model::IncrementalResultStats::first_incremental_row_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_first_incremental_row_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_first_incremental_row_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.first_incremental_row_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [first_incremental_row_time][crate::model::IncrementalResultStats::first_incremental_row_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_or_clear_first_incremental_row_time(Some(Timestamp::default()/* use setters */));
/// let x = IncrementalResultStats::new().set_or_clear_first_incremental_row_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_first_incremental_row_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.first_incremental_row_time = v.map(|x| x.into());
self
}
/// Sets the value of [last_incremental_row_time][crate::model::IncrementalResultStats::last_incremental_row_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_last_incremental_row_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_last_incremental_row_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_incremental_row_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [last_incremental_row_time][crate::model::IncrementalResultStats::last_incremental_row_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// use wkt::Timestamp;
/// let x = IncrementalResultStats::new().set_or_clear_last_incremental_row_time(Some(Timestamp::default()/* use setters */));
/// let x = IncrementalResultStats::new().set_or_clear_last_incremental_row_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_last_incremental_row_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_incremental_row_time = v.map(|x| x.into());
self
}
/// Sets the value of [incremental_row_count][crate::model::IncrementalResultStats::incremental_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// let x = IncrementalResultStats::new().set_incremental_row_count(42);
/// ```
pub fn set_incremental_row_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.incremental_row_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [incremental_row_count][crate::model::IncrementalResultStats::incremental_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// let x = IncrementalResultStats::new().set_or_clear_incremental_row_count(Some(42));
/// let x = IncrementalResultStats::new().set_or_clear_incremental_row_count(None::<i32>);
/// ```
pub fn set_or_clear_incremental_row_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.incremental_row_count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for IncrementalResultStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.IncrementalResultStats"
}
}
/// Defines additional types related to [IncrementalResultStats].
pub mod incremental_result_stats {
#[allow(unused_imports)]
use super::*;
/// Reason why incremental query results are/were not written by the query.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DisabledReason {
/// Disabled reason not specified.
Unspecified,
/// Incremental results are/were disabled for reasons not covered by the
/// other enum values, e.g. runtime issues.
Other,
/// Query includes an operation that is not supported.
UnsupportedOperator,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DisabledReason::value] or
/// [DisabledReason::name].
UnknownValue(disabled_reason::UnknownValue),
}
#[doc(hidden)]
pub mod disabled_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DisabledReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Other => std::option::Option::Some(1),
Self::UnsupportedOperator => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DISABLED_REASON_UNSPECIFIED"),
Self::Other => std::option::Option::Some("OTHER"),
Self::UnsupportedOperator => std::option::Option::Some("UNSUPPORTED_OPERATOR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DisabledReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DisabledReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DisabledReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Other,
2 => Self::UnsupportedOperator,
_ => Self::UnknownValue(disabled_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DisabledReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DISABLED_REASON_UNSPECIFIED" => Self::Unspecified,
"OTHER" => Self::Other,
"UNSUPPORTED_OPERATOR" => Self::UnsupportedOperator,
_ => Self::UnknownValue(disabled_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DisabledReason {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Other => serializer.serialize_i32(1),
Self::UnsupportedOperator => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DisabledReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DisabledReason>::new(
".google.cloud.bigquery.v2.IncrementalResultStats.DisabledReason",
))
}
}
}
/// Statistics for a query job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobStatistics2 {
/// Output only. Describes execution plan for the query.
pub query_plan: std::vec::Vec<crate::model::ExplainQueryStage>,
/// Output only. The original estimate of bytes processed for the job.
pub estimated_bytes_processed: std::option::Option<wkt::Int64Value>,
/// Output only. Describes a timeline of job execution.
pub timeline: std::vec::Vec<crate::model::QueryTimelineSample>,
/// Output only. Total number of partitions processed from all partitioned
/// tables referenced in the job.
pub total_partitions_processed: std::option::Option<wkt::Int64Value>,
/// Output only. Total bytes processed for the job.
pub total_bytes_processed: std::option::Option<wkt::Int64Value>,
/// Output only. For dry-run jobs, totalBytesProcessed is an estimate and this
/// field specifies the accuracy of the estimate. Possible values can be:
/// UNKNOWN: accuracy of the estimate is unknown.
/// PRECISE: estimate is precise.
/// LOWER_BOUND: estimate is lower bound of what the query would cost.
/// UPPER_BOUND: estimate is upper bound of what the query would cost.
pub total_bytes_processed_accuracy: std::string::String,
/// Output only. If the project is configured to use on-demand pricing,
/// then this field contains the total bytes billed for the job.
/// If the project is configured to use flat-rate pricing, then you are
/// not billed for bytes and this field is informational only.
pub total_bytes_billed: std::option::Option<wkt::Int64Value>,
/// Output only. Billing tier for the job. This is a BigQuery-specific concept
/// which is not related to the Google Cloud notion of "free tier". The value
/// here is a measure of the query's resource consumption relative to the
/// amount of data scanned. For on-demand queries, the limit is 100, and all
/// queries within this limit are billed at the standard on-demand rates.
/// On-demand queries that exceed this limit will fail with a
/// billingTierLimitExceeded error.
pub billing_tier: std::option::Option<wkt::Int32Value>,
/// Output only. Slot-milliseconds for the job.
pub total_slot_ms: std::option::Option<wkt::Int64Value>,
/// Output only. Total slot milliseconds for the job that ran on external
/// services and billed on the services SKU. This field is only populated for
/// jobs that have external service costs, and is the total of the usage for
/// costs whose billing method is `"SERVICES_SKU"`.
pub total_services_sku_slot_ms: std::option::Option<i64>,
/// Output only. Whether the query result was fetched from the query cache.
pub cache_hit: std::option::Option<wkt::BoolValue>,
/// Output only. Referenced tables for the job.
pub referenced_tables: std::vec::Vec<crate::model::TableReference>,
/// Output only. Referenced routines for the job.
pub referenced_routines: std::vec::Vec<crate::model::RoutineReference>,
/// Output only. Referenced property graphs for the job. Queries that reference
/// more than 50 property graphs will not have a complete list.
pub referenced_property_graphs: std::vec::Vec<crate::model::PropertyGraphReference>,
/// Output only. The schema of the results. Present only for successful dry
/// run of non-legacy SQL queries.
pub schema: std::option::Option<crate::model::TableSchema>,
/// Output only. The number of rows affected by a DML statement. Present
/// only for DML statements INSERT, UPDATE or DELETE.
pub num_dml_affected_rows: std::option::Option<wkt::Int64Value>,
/// Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE,
/// MERGE or TRUNCATE.
pub dml_stats: std::option::Option<crate::model::DmlStats>,
/// Output only. GoogleSQL only: list of undeclared query
/// parameters detected during a dry run validation.
pub undeclared_query_parameters: std::vec::Vec<crate::model::QueryParameter>,
/// Output only. The type of query statement, if valid.
/// Possible values:
///
/// * `SELECT`:
/// [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list)
/// statement.
/// * `ASSERT`:
/// [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert)
/// statement.
/// * `INSERT`:
/// [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement)
/// statement.
/// * `UPDATE`:
/// [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#update_statement)
/// statement.
/// * `DELETE`:
/// [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
/// statement.
/// * `MERGE`:
/// [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
/// statement.
/// * `CREATE_TABLE`: [`CREATE
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
/// statement, without `AS SELECT`.
/// * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS
/// SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
/// statement.
/// * `CREATE_VIEW`: [`CREATE
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement)
/// statement.
/// * `CREATE_MODEL`: [`CREATE
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement)
/// statement.
/// * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement)
/// statement.
/// * `CREATE_FUNCTION`: [`CREATE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement)
/// statement.
/// * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement)
/// statement.
/// * `CREATE_PROCEDURE`: [`CREATE
/// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure)
/// statement.
/// * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS
/// POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement)
/// statement.
/// * `CREATE_SCHEMA`: [`CREATE
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement)
/// statement.
/// * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement)
/// statement.
/// * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH
/// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement)
/// statement.
/// * `DROP_TABLE`: [`DROP
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement)
/// statement.
/// * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement)
/// statement.
/// * `DROP_VIEW`: [`DROP
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement)
/// statement.
/// * `DROP_MODEL`: [`DROP
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model)
/// statement.
/// * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement)
/// statement.
/// * `DROP_FUNCTION` : [`DROP
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement)
/// statement.
/// * `DROP_TABLE_FUNCTION` : [`DROP TABLE
/// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function)
/// statement.
/// * `DROP_PROCEDURE`: [`DROP
/// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement)
/// statement.
/// * `DROP_SEARCH_INDEX`: [`DROP SEARCH
/// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index)
/// statement.
/// * `DROP_SCHEMA`: [`DROP
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement)
/// statement.
/// * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement)
/// statement.
/// * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS
/// POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement)
/// statement.
/// * `ALTER_TABLE`: [`ALTER
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement)
/// statement.
/// * `ALTER_VIEW`: [`ALTER
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement)
/// statement.
/// * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED
/// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement)
/// statement.
/// * `ALTER_SCHEMA`: [`ALTER
/// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_schema_set_options_statement)
/// statement.
/// * `SCRIPT`:
/// [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language).
/// * `TRUNCATE_TABLE`: [`TRUNCATE
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement)
/// statement.
/// * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL
/// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement)
/// statement.
/// * `EXPORT_DATA`: [`EXPORT
/// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement)
/// statement.
/// * `EXPORT_MODEL`: [`EXPORT
/// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model)
/// statement.
/// * `LOAD_DATA`: [`LOAD
/// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement)
/// statement.
/// * `CALL`:
/// [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call)
/// statement.
pub statement_type: std::string::String,
/// Output only. The DDL operation performed, possibly
/// dependent on the pre-existence of the DDL target.
pub ddl_operation_performed: std::string::String,
/// Output only. The DDL target table. Present only for
/// CREATE/DROP TABLE/VIEW and DROP ALL ROW ACCESS POLICIES queries.
pub ddl_target_table: std::option::Option<crate::model::TableReference>,
/// Output only. The table after rename. Present only for ALTER TABLE RENAME TO
/// query.
pub ddl_destination_table: std::option::Option<crate::model::TableReference>,
/// Output only. The DDL target row access policy. Present only for
/// CREATE/DROP ROW ACCESS POLICY queries.
pub ddl_target_row_access_policy: std::option::Option<crate::model::RowAccessPolicyReference>,
/// Output only. The number of row access policies affected by a DDL statement.
/// Present only for DROP ALL ROW ACCESS POLICIES queries.
pub ddl_affected_row_access_policy_count: std::option::Option<wkt::Int64Value>,
/// Output only. [Beta] The DDL target routine. Present only for
/// CREATE/DROP FUNCTION/PROCEDURE queries.
pub ddl_target_routine: std::option::Option<crate::model::RoutineReference>,
/// Output only. The DDL target dataset. Present only for CREATE/ALTER/DROP
/// SCHEMA(dataset) queries.
pub ddl_target_dataset: std::option::Option<crate::model::DatasetReference>,
/// Output only. Statistics of a BigQuery ML training job.
pub ml_statistics: std::option::Option<crate::model::MlStatistics>,
/// Output only. Stats for EXPORT DATA statement.
pub export_data_statistics: std::option::Option<crate::model::ExportDataStatistics>,
/// Output only. Job cost breakdown as bigquery internal cost and external
/// service costs.
pub external_service_costs: std::vec::Vec<crate::model::ExternalServiceCost>,
/// Output only. BI Engine specific Statistics.
pub bi_engine_statistics: std::option::Option<crate::model::BiEngineStatistics>,
/// Output only. Statistics for a LOAD query.
pub load_query_statistics: std::option::Option<crate::model::LoadQueryStatistics>,
/// Output only. Referenced table for DCL statement.
pub dcl_target_table: std::option::Option<crate::model::TableReference>,
/// Output only. Referenced view for DCL statement.
pub dcl_target_view: std::option::Option<crate::model::TableReference>,
/// Output only. Referenced dataset for DCL statement.
pub dcl_target_dataset: std::option::Option<crate::model::DatasetReference>,
/// Output only. Search query specific statistics.
pub search_statistics: std::option::Option<crate::model::SearchStatistics>,
/// Output only. Vector Search query specific statistics.
pub vector_search_statistics: std::option::Option<crate::model::VectorSearchStatistics>,
/// Output only. Performance insights.
pub performance_insights: std::option::Option<crate::model::PerformanceInsights>,
/// Output only. Query optimization information for a QUERY job.
pub query_info: std::option::Option<crate::model::QueryInfo>,
/// Output only. Statistics of a Spark procedure job.
pub spark_statistics: std::option::Option<crate::model::SparkStatistics>,
/// Output only. Total bytes transferred for BigQuery Omni queries from the
/// remote cloud back to Google Cloud. This tracks data movement over
/// Google-managed connections (like query results). It doesn't include input
/// data read from the external data lake (for example, S3) because that data
/// stays within the remote cloud.
pub transferred_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Statistics of materialized views of a query job.
pub materialized_view_statistics: std::option::Option<crate::model::MaterializedViewStatistics>,
/// Output only. Statistics of metadata cache usage in a query for BigLake
/// tables.
pub metadata_cache_statistics: std::option::Option<crate::model::MetadataCacheStatistics>,
/// Output only. Statistics related to incremental query results, if enabled
/// for the query. This feature is not yet available.
pub incremental_result_stats: std::option::Option<crate::model::IncrementalResultStats>,
/// Output only. Statistics related to GenAI usage in the query.
pub gen_ai_stats: std::option::Option<crate::model::GenAiStats>,
/// Output only. Storage and caching statistics per cloud provider for queries
/// over object storage.
pub object_storage_stats: std::vec::Vec<crate::model::ObjectStorageStats>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobStatistics2 {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query_plan][crate::model::JobStatistics2::query_plan].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::ExplainQueryStage;
/// let x = JobStatistics2::new()
/// .set_query_plan([
/// ExplainQueryStage::default()/* use setters */,
/// ExplainQueryStage::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_query_plan<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ExplainQueryStage>,
{
use std::iter::Iterator;
self.query_plan = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [estimated_bytes_processed][crate::model::JobStatistics2::estimated_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_estimated_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_estimated_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.estimated_bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [estimated_bytes_processed][crate::model::JobStatistics2::estimated_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_estimated_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_estimated_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_estimated_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.estimated_bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [timeline][crate::model::JobStatistics2::timeline].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// let x = JobStatistics2::new()
/// .set_timeline([
/// QueryTimelineSample::default()/* use setters */,
/// QueryTimelineSample::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_timeline<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryTimelineSample>,
{
use std::iter::Iterator;
self.timeline = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [total_partitions_processed][crate::model::JobStatistics2::total_partitions_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_total_partitions_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_partitions_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_partitions_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_partitions_processed][crate::model::JobStatistics2::total_partitions_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_total_partitions_processed(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_total_partitions_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_partitions_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_partitions_processed = v.map(|x| x.into());
self
}
/// Sets the value of [total_bytes_processed][crate::model::JobStatistics2::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_total_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_processed][crate::model::JobStatistics2::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_total_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_total_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [total_bytes_processed_accuracy][crate::model::JobStatistics2::total_bytes_processed_accuracy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics2::new().set_total_bytes_processed_accuracy("example");
/// ```
pub fn set_total_bytes_processed_accuracy<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.total_bytes_processed_accuracy = v.into();
self
}
/// Sets the value of [total_bytes_billed][crate::model::JobStatistics2::total_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_total_bytes_billed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_bytes_billed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_billed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_billed][crate::model::JobStatistics2::total_bytes_billed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_total_bytes_billed(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_total_bytes_billed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_billed = v.map(|x| x.into());
self
}
/// Sets the value of [billing_tier][crate::model::JobStatistics2::billing_tier].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int32Value;
/// let x = JobStatistics2::new().set_billing_tier(Int32Value::default()/* use setters */);
/// ```
pub fn set_billing_tier<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.billing_tier = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [billing_tier][crate::model::JobStatistics2::billing_tier].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int32Value;
/// let x = JobStatistics2::new().set_or_clear_billing_tier(Some(Int32Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_billing_tier(None::<Int32Value>);
/// ```
pub fn set_or_clear_billing_tier<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.billing_tier = v.map(|x| x.into());
self
}
/// Sets the value of [total_slot_ms][crate::model::JobStatistics2::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_total_slot_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_slot_ms][crate::model::JobStatistics2::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_total_slot_ms(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_total_slot_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [total_services_sku_slot_ms][crate::model::JobStatistics2::total_services_sku_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics2::new().set_total_services_sku_slot_ms(42);
/// ```
pub fn set_total_services_sku_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.total_services_sku_slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_services_sku_slot_ms][crate::model::JobStatistics2::total_services_sku_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics2::new().set_or_clear_total_services_sku_slot_ms(Some(42));
/// let x = JobStatistics2::new().set_or_clear_total_services_sku_slot_ms(None::<i32>);
/// ```
pub fn set_or_clear_total_services_sku_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.total_services_sku_slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [cache_hit][crate::model::JobStatistics2::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::BoolValue;
/// let x = JobStatistics2::new().set_cache_hit(BoolValue::default()/* use setters */);
/// ```
pub fn set_cache_hit<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cache_hit][crate::model::JobStatistics2::cache_hit].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::BoolValue;
/// let x = JobStatistics2::new().set_or_clear_cache_hit(Some(BoolValue::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_cache_hit(None::<BoolValue>);
/// ```
pub fn set_or_clear_cache_hit<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.cache_hit = v.map(|x| x.into());
self
}
/// Sets the value of [referenced_tables][crate::model::JobStatistics2::referenced_tables].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new()
/// .set_referenced_tables([
/// TableReference::default()/* use setters */,
/// TableReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_referenced_tables<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableReference>,
{
use std::iter::Iterator;
self.referenced_tables = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [referenced_routines][crate::model::JobStatistics2::referenced_routines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = JobStatistics2::new()
/// .set_referenced_routines([
/// RoutineReference::default()/* use setters */,
/// RoutineReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_referenced_routines<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RoutineReference>,
{
use std::iter::Iterator;
self.referenced_routines = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [referenced_property_graphs][crate::model::JobStatistics2::referenced_property_graphs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::PropertyGraphReference;
/// let x = JobStatistics2::new()
/// .set_referenced_property_graphs([
/// PropertyGraphReference::default()/* use setters */,
/// PropertyGraphReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_referenced_property_graphs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PropertyGraphReference>,
{
use std::iter::Iterator;
self.referenced_property_graphs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [schema][crate::model::JobStatistics2::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = JobStatistics2::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::JobStatistics2::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = JobStatistics2::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [num_dml_affected_rows][crate::model::JobStatistics2::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_num_dml_affected_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_dml_affected_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_dml_affected_rows][crate::model::JobStatistics2::num_dml_affected_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_num_dml_affected_rows(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_num_dml_affected_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_dml_affected_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_dml_affected_rows = v.map(|x| x.into());
self
}
/// Sets the value of [dml_stats][crate::model::JobStatistics2::dml_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DmlStats;
/// let x = JobStatistics2::new().set_dml_stats(DmlStats::default()/* use setters */);
/// ```
pub fn set_dml_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DmlStats>,
{
self.dml_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dml_stats][crate::model::JobStatistics2::dml_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DmlStats;
/// let x = JobStatistics2::new().set_or_clear_dml_stats(Some(DmlStats::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_dml_stats(None::<DmlStats>);
/// ```
pub fn set_or_clear_dml_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DmlStats>,
{
self.dml_stats = v.map(|x| x.into());
self
}
/// Sets the value of [undeclared_query_parameters][crate::model::JobStatistics2::undeclared_query_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::QueryParameter;
/// let x = JobStatistics2::new()
/// .set_undeclared_query_parameters([
/// QueryParameter::default()/* use setters */,
/// QueryParameter::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_undeclared_query_parameters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryParameter>,
{
use std::iter::Iterator;
self.undeclared_query_parameters = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [statement_type][crate::model::JobStatistics2::statement_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics2::new().set_statement_type("example");
/// ```
pub fn set_statement_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.statement_type = v.into();
self
}
/// Sets the value of [ddl_operation_performed][crate::model::JobStatistics2::ddl_operation_performed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics2::new().set_ddl_operation_performed("example");
/// ```
pub fn set_ddl_operation_performed<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.ddl_operation_performed = v.into();
self
}
/// Sets the value of [ddl_target_table][crate::model::JobStatistics2::ddl_target_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_ddl_target_table(TableReference::default()/* use setters */);
/// ```
pub fn set_ddl_target_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.ddl_target_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_target_table][crate::model::JobStatistics2::ddl_target_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_or_clear_ddl_target_table(Some(TableReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_target_table(None::<TableReference>);
/// ```
pub fn set_or_clear_ddl_target_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.ddl_target_table = v.map(|x| x.into());
self
}
/// Sets the value of [ddl_destination_table][crate::model::JobStatistics2::ddl_destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_ddl_destination_table(TableReference::default()/* use setters */);
/// ```
pub fn set_ddl_destination_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.ddl_destination_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_destination_table][crate::model::JobStatistics2::ddl_destination_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_or_clear_ddl_destination_table(Some(TableReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_destination_table(None::<TableReference>);
/// ```
pub fn set_or_clear_ddl_destination_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.ddl_destination_table = v.map(|x| x.into());
self
}
/// Sets the value of [ddl_target_row_access_policy][crate::model::JobStatistics2::ddl_target_row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = JobStatistics2::new().set_ddl_target_row_access_policy(RowAccessPolicyReference::default()/* use setters */);
/// ```
pub fn set_ddl_target_row_access_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicyReference>,
{
self.ddl_target_row_access_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_target_row_access_policy][crate::model::JobStatistics2::ddl_target_row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = JobStatistics2::new().set_or_clear_ddl_target_row_access_policy(Some(RowAccessPolicyReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_target_row_access_policy(None::<RowAccessPolicyReference>);
/// ```
pub fn set_or_clear_ddl_target_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicyReference>,
{
self.ddl_target_row_access_policy = v.map(|x| x.into());
self
}
/// Sets the value of [ddl_affected_row_access_policy_count][crate::model::JobStatistics2::ddl_affected_row_access_policy_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_ddl_affected_row_access_policy_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_ddl_affected_row_access_policy_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.ddl_affected_row_access_policy_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_affected_row_access_policy_count][crate::model::JobStatistics2::ddl_affected_row_access_policy_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_ddl_affected_row_access_policy_count(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_affected_row_access_policy_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_ddl_affected_row_access_policy_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.ddl_affected_row_access_policy_count = v.map(|x| x.into());
self
}
/// Sets the value of [ddl_target_routine][crate::model::JobStatistics2::ddl_target_routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = JobStatistics2::new().set_ddl_target_routine(RoutineReference::default()/* use setters */);
/// ```
pub fn set_ddl_target_routine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.ddl_target_routine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_target_routine][crate::model::JobStatistics2::ddl_target_routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = JobStatistics2::new().set_or_clear_ddl_target_routine(Some(RoutineReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_target_routine(None::<RoutineReference>);
/// ```
pub fn set_or_clear_ddl_target_routine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.ddl_target_routine = v.map(|x| x.into());
self
}
/// Sets the value of [ddl_target_dataset][crate::model::JobStatistics2::ddl_target_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobStatistics2::new().set_ddl_target_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_ddl_target_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.ddl_target_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ddl_target_dataset][crate::model::JobStatistics2::ddl_target_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobStatistics2::new().set_or_clear_ddl_target_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ddl_target_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_ddl_target_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.ddl_target_dataset = v.map(|x| x.into());
self
}
/// Sets the value of [ml_statistics][crate::model::JobStatistics2::ml_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MlStatistics;
/// let x = JobStatistics2::new().set_ml_statistics(MlStatistics::default()/* use setters */);
/// ```
pub fn set_ml_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MlStatistics>,
{
self.ml_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ml_statistics][crate::model::JobStatistics2::ml_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MlStatistics;
/// let x = JobStatistics2::new().set_or_clear_ml_statistics(Some(MlStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_ml_statistics(None::<MlStatistics>);
/// ```
pub fn set_or_clear_ml_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MlStatistics>,
{
self.ml_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [export_data_statistics][crate::model::JobStatistics2::export_data_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// let x = JobStatistics2::new().set_export_data_statistics(ExportDataStatistics::default()/* use setters */);
/// ```
pub fn set_export_data_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExportDataStatistics>,
{
self.export_data_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [export_data_statistics][crate::model::JobStatistics2::export_data_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::ExportDataStatistics;
/// let x = JobStatistics2::new().set_or_clear_export_data_statistics(Some(ExportDataStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_export_data_statistics(None::<ExportDataStatistics>);
/// ```
pub fn set_or_clear_export_data_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExportDataStatistics>,
{
self.export_data_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [external_service_costs][crate::model::JobStatistics2::external_service_costs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::ExternalServiceCost;
/// let x = JobStatistics2::new()
/// .set_external_service_costs([
/// ExternalServiceCost::default()/* use setters */,
/// ExternalServiceCost::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_external_service_costs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ExternalServiceCost>,
{
use std::iter::Iterator;
self.external_service_costs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [bi_engine_statistics][crate::model::JobStatistics2::bi_engine_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::BiEngineStatistics;
/// let x = JobStatistics2::new().set_bi_engine_statistics(BiEngineStatistics::default()/* use setters */);
/// ```
pub fn set_bi_engine_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BiEngineStatistics>,
{
self.bi_engine_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bi_engine_statistics][crate::model::JobStatistics2::bi_engine_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::BiEngineStatistics;
/// let x = JobStatistics2::new().set_or_clear_bi_engine_statistics(Some(BiEngineStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_bi_engine_statistics(None::<BiEngineStatistics>);
/// ```
pub fn set_or_clear_bi_engine_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BiEngineStatistics>,
{
self.bi_engine_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [load_query_statistics][crate::model::JobStatistics2::load_query_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// let x = JobStatistics2::new().set_load_query_statistics(LoadQueryStatistics::default()/* use setters */);
/// ```
pub fn set_load_query_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LoadQueryStatistics>,
{
self.load_query_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [load_query_statistics][crate::model::JobStatistics2::load_query_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::LoadQueryStatistics;
/// let x = JobStatistics2::new().set_or_clear_load_query_statistics(Some(LoadQueryStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_load_query_statistics(None::<LoadQueryStatistics>);
/// ```
pub fn set_or_clear_load_query_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LoadQueryStatistics>,
{
self.load_query_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [dcl_target_table][crate::model::JobStatistics2::dcl_target_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_dcl_target_table(TableReference::default()/* use setters */);
/// ```
pub fn set_dcl_target_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.dcl_target_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dcl_target_table][crate::model::JobStatistics2::dcl_target_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_or_clear_dcl_target_table(Some(TableReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_dcl_target_table(None::<TableReference>);
/// ```
pub fn set_or_clear_dcl_target_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.dcl_target_table = v.map(|x| x.into());
self
}
/// Sets the value of [dcl_target_view][crate::model::JobStatistics2::dcl_target_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_dcl_target_view(TableReference::default()/* use setters */);
/// ```
pub fn set_dcl_target_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.dcl_target_view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dcl_target_view][crate::model::JobStatistics2::dcl_target_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = JobStatistics2::new().set_or_clear_dcl_target_view(Some(TableReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_dcl_target_view(None::<TableReference>);
/// ```
pub fn set_or_clear_dcl_target_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.dcl_target_view = v.map(|x| x.into());
self
}
/// Sets the value of [dcl_target_dataset][crate::model::JobStatistics2::dcl_target_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobStatistics2::new().set_dcl_target_dataset(DatasetReference::default()/* use setters */);
/// ```
pub fn set_dcl_target_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dcl_target_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dcl_target_dataset][crate::model::JobStatistics2::dcl_target_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::DatasetReference;
/// let x = JobStatistics2::new().set_or_clear_dcl_target_dataset(Some(DatasetReference::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_dcl_target_dataset(None::<DatasetReference>);
/// ```
pub fn set_or_clear_dcl_target_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetReference>,
{
self.dcl_target_dataset = v.map(|x| x.into());
self
}
/// Sets the value of [search_statistics][crate::model::JobStatistics2::search_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::SearchStatistics;
/// let x = JobStatistics2::new().set_search_statistics(SearchStatistics::default()/* use setters */);
/// ```
pub fn set_search_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SearchStatistics>,
{
self.search_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [search_statistics][crate::model::JobStatistics2::search_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::SearchStatistics;
/// let x = JobStatistics2::new().set_or_clear_search_statistics(Some(SearchStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_search_statistics(None::<SearchStatistics>);
/// ```
pub fn set_or_clear_search_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SearchStatistics>,
{
self.search_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [vector_search_statistics][crate::model::JobStatistics2::vector_search_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::VectorSearchStatistics;
/// let x = JobStatistics2::new().set_vector_search_statistics(VectorSearchStatistics::default()/* use setters */);
/// ```
pub fn set_vector_search_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::VectorSearchStatistics>,
{
self.vector_search_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [vector_search_statistics][crate::model::JobStatistics2::vector_search_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::VectorSearchStatistics;
/// let x = JobStatistics2::new().set_or_clear_vector_search_statistics(Some(VectorSearchStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_vector_search_statistics(None::<VectorSearchStatistics>);
/// ```
pub fn set_or_clear_vector_search_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::VectorSearchStatistics>,
{
self.vector_search_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [performance_insights][crate::model::JobStatistics2::performance_insights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::PerformanceInsights;
/// let x = JobStatistics2::new().set_performance_insights(PerformanceInsights::default()/* use setters */);
/// ```
pub fn set_performance_insights<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PerformanceInsights>,
{
self.performance_insights = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [performance_insights][crate::model::JobStatistics2::performance_insights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::PerformanceInsights;
/// let x = JobStatistics2::new().set_or_clear_performance_insights(Some(PerformanceInsights::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_performance_insights(None::<PerformanceInsights>);
/// ```
pub fn set_or_clear_performance_insights<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PerformanceInsights>,
{
self.performance_insights = v.map(|x| x.into());
self
}
/// Sets the value of [query_info][crate::model::JobStatistics2::query_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::QueryInfo;
/// let x = JobStatistics2::new().set_query_info(QueryInfo::default()/* use setters */);
/// ```
pub fn set_query_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryInfo>,
{
self.query_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_info][crate::model::JobStatistics2::query_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::QueryInfo;
/// let x = JobStatistics2::new().set_or_clear_query_info(Some(QueryInfo::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_query_info(None::<QueryInfo>);
/// ```
pub fn set_or_clear_query_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryInfo>,
{
self.query_info = v.map(|x| x.into());
self
}
/// Sets the value of [spark_statistics][crate::model::JobStatistics2::spark_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = JobStatistics2::new().set_spark_statistics(SparkStatistics::default()/* use setters */);
/// ```
pub fn set_spark_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SparkStatistics>,
{
self.spark_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [spark_statistics][crate::model::JobStatistics2::spark_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = JobStatistics2::new().set_or_clear_spark_statistics(Some(SparkStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_spark_statistics(None::<SparkStatistics>);
/// ```
pub fn set_or_clear_spark_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SparkStatistics>,
{
self.spark_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [transferred_bytes][crate::model::JobStatistics2::transferred_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_transferred_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_transferred_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.transferred_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [transferred_bytes][crate::model::JobStatistics2::transferred_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use wkt::Int64Value;
/// let x = JobStatistics2::new().set_or_clear_transferred_bytes(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_transferred_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_transferred_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.transferred_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [materialized_view_statistics][crate::model::JobStatistics2::materialized_view_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MaterializedViewStatistics;
/// let x = JobStatistics2::new().set_materialized_view_statistics(MaterializedViewStatistics::default()/* use setters */);
/// ```
pub fn set_materialized_view_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewStatistics>,
{
self.materialized_view_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [materialized_view_statistics][crate::model::JobStatistics2::materialized_view_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MaterializedViewStatistics;
/// let x = JobStatistics2::new().set_or_clear_materialized_view_statistics(Some(MaterializedViewStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_materialized_view_statistics(None::<MaterializedViewStatistics>);
/// ```
pub fn set_or_clear_materialized_view_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewStatistics>,
{
self.materialized_view_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_cache_statistics][crate::model::JobStatistics2::metadata_cache_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MetadataCacheStatistics;
/// let x = JobStatistics2::new().set_metadata_cache_statistics(MetadataCacheStatistics::default()/* use setters */);
/// ```
pub fn set_metadata_cache_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MetadataCacheStatistics>,
{
self.metadata_cache_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata_cache_statistics][crate::model::JobStatistics2::metadata_cache_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::MetadataCacheStatistics;
/// let x = JobStatistics2::new().set_or_clear_metadata_cache_statistics(Some(MetadataCacheStatistics::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_metadata_cache_statistics(None::<MetadataCacheStatistics>);
/// ```
pub fn set_or_clear_metadata_cache_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MetadataCacheStatistics>,
{
self.metadata_cache_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [incremental_result_stats][crate::model::JobStatistics2::incremental_result_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// let x = JobStatistics2::new().set_incremental_result_stats(IncrementalResultStats::default()/* use setters */);
/// ```
pub fn set_incremental_result_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::IncrementalResultStats>,
{
self.incremental_result_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [incremental_result_stats][crate::model::JobStatistics2::incremental_result_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::IncrementalResultStats;
/// let x = JobStatistics2::new().set_or_clear_incremental_result_stats(Some(IncrementalResultStats::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_incremental_result_stats(None::<IncrementalResultStats>);
/// ```
pub fn set_or_clear_incremental_result_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::IncrementalResultStats>,
{
self.incremental_result_stats = v.map(|x| x.into());
self
}
/// Sets the value of [gen_ai_stats][crate::model::JobStatistics2::gen_ai_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::GenAiStats;
/// let x = JobStatistics2::new().set_gen_ai_stats(GenAiStats::default()/* use setters */);
/// ```
pub fn set_gen_ai_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenAiStats>,
{
self.gen_ai_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [gen_ai_stats][crate::model::JobStatistics2::gen_ai_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::GenAiStats;
/// let x = JobStatistics2::new().set_or_clear_gen_ai_stats(Some(GenAiStats::default()/* use setters */));
/// let x = JobStatistics2::new().set_or_clear_gen_ai_stats(None::<GenAiStats>);
/// ```
pub fn set_or_clear_gen_ai_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenAiStats>,
{
self.gen_ai_stats = v.map(|x| x.into());
self
}
/// Sets the value of [object_storage_stats][crate::model::JobStatistics2::object_storage_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics2;
/// use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// let x = JobStatistics2::new()
/// .set_object_storage_stats([
/// ObjectStorageStats::default()/* use setters */,
/// ObjectStorageStats::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_object_storage_stats<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ObjectStorageStats>,
{
use std::iter::Iterator;
self.object_storage_stats = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JobStatistics2 {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatistics2"
}
}
/// Storage and caching statistics for object storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ObjectStorageStats {
/// The cloud provider for this block of statistics.
pub cloud_provider: std::option::Option<crate::model::object_storage_stats::CloudProvider>,
/// Total bytes read directly from the cloud provider's storage.
pub object_storage_bytes_read: std::option::Option<i64>,
/// Total bytes read from the GCP Lakehouse-internal cache, avoiding an
/// object storage read.
pub cache_bytes_read: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ObjectStorageStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [cloud_provider][crate::model::ObjectStorageStats::cloud_provider].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// use google_cloud_bigquery_v2::model::object_storage_stats::CloudProvider;
/// let x0 = ObjectStorageStats::new().set_cloud_provider(CloudProvider::Gcp);
/// let x1 = ObjectStorageStats::new().set_cloud_provider(CloudProvider::Aws);
/// let x2 = ObjectStorageStats::new().set_cloud_provider(CloudProvider::Azure);
/// ```
pub fn set_cloud_provider<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::object_storage_stats::CloudProvider>,
{
self.cloud_provider = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cloud_provider][crate::model::ObjectStorageStats::cloud_provider].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// use google_cloud_bigquery_v2::model::object_storage_stats::CloudProvider;
/// let x0 = ObjectStorageStats::new().set_or_clear_cloud_provider(Some(CloudProvider::Gcp));
/// let x1 = ObjectStorageStats::new().set_or_clear_cloud_provider(Some(CloudProvider::Aws));
/// let x2 = ObjectStorageStats::new().set_or_clear_cloud_provider(Some(CloudProvider::Azure));
/// let x_none = ObjectStorageStats::new().set_or_clear_cloud_provider(None::<CloudProvider>);
/// ```
pub fn set_or_clear_cloud_provider<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::object_storage_stats::CloudProvider>,
{
self.cloud_provider = v.map(|x| x.into());
self
}
/// Sets the value of [object_storage_bytes_read][crate::model::ObjectStorageStats::object_storage_bytes_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// let x = ObjectStorageStats::new().set_object_storage_bytes_read(42);
/// ```
pub fn set_object_storage_bytes_read<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.object_storage_bytes_read = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [object_storage_bytes_read][crate::model::ObjectStorageStats::object_storage_bytes_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// let x = ObjectStorageStats::new().set_or_clear_object_storage_bytes_read(Some(42));
/// let x = ObjectStorageStats::new().set_or_clear_object_storage_bytes_read(None::<i32>);
/// ```
pub fn set_or_clear_object_storage_bytes_read<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.object_storage_bytes_read = v.map(|x| x.into());
self
}
/// Sets the value of [cache_bytes_read][crate::model::ObjectStorageStats::cache_bytes_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// let x = ObjectStorageStats::new().set_cache_bytes_read(42);
/// ```
pub fn set_cache_bytes_read<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.cache_bytes_read = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cache_bytes_read][crate::model::ObjectStorageStats::cache_bytes_read].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ObjectStorageStats;
/// let x = ObjectStorageStats::new().set_or_clear_cache_bytes_read(Some(42));
/// let x = ObjectStorageStats::new().set_or_clear_cache_bytes_read(None::<i32>);
/// ```
pub fn set_or_clear_cache_bytes_read<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.cache_bytes_read = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ObjectStorageStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ObjectStorageStats"
}
}
/// Defines additional types related to [ObjectStorageStats].
pub mod object_storage_stats {
#[allow(unused_imports)]
use super::*;
/// The cloud provider hosting the object storage.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CloudProvider {
/// Unspecified cloud provider.
Unspecified,
/// Google Cloud Platform.
Gcp,
/// Amazon Web Services.
Aws,
/// Microsoft Azure.
Azure,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [CloudProvider::value] or
/// [CloudProvider::name].
UnknownValue(cloud_provider::UnknownValue),
}
#[doc(hidden)]
pub mod cloud_provider {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl CloudProvider {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gcp => std::option::Option::Some(1),
Self::Aws => std::option::Option::Some(2),
Self::Azure => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CLOUD_PROVIDER_UNSPECIFIED"),
Self::Gcp => std::option::Option::Some("GCP"),
Self::Aws => std::option::Option::Some("AWS"),
Self::Azure => std::option::Option::Some("AZURE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for CloudProvider {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for CloudProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for CloudProvider {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gcp,
2 => Self::Aws,
3 => Self::Azure,
_ => Self::UnknownValue(cloud_provider::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for CloudProvider {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CLOUD_PROVIDER_UNSPECIFIED" => Self::Unspecified,
"GCP" => Self::Gcp,
"AWS" => Self::Aws,
"AZURE" => Self::Azure,
_ => Self::UnknownValue(cloud_provider::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for CloudProvider {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Gcp => serializer.serialize_i32(1),
Self::Aws => serializer.serialize_i32(2),
Self::Azure => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for CloudProvider {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CloudProvider>::new(
".google.cloud.bigquery.v2.ObjectStorageStats.CloudProvider",
))
}
}
}
/// Statistics for a load job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobStatistics3 {
/// Output only. Number of source files in a load job.
pub input_files: std::option::Option<wkt::Int64Value>,
/// Output only. Number of bytes of source data in a load job.
pub input_file_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of rows imported in a load job.
/// Note that while an import job is in the running state, this
/// value may change.
pub output_rows: std::option::Option<wkt::Int64Value>,
/// Output only. Size of the loaded data in bytes. Note
/// that while a load job is in the running state, this value may change.
pub output_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The number of bad records encountered. Note that if the job
/// has failed because of more bad records encountered than the maximum
/// allowed in the load job configuration, then this number can be less than
/// the total number of bad records present in the input data.
pub bad_records: std::option::Option<wkt::Int64Value>,
/// Output only. Describes a timeline of job execution.
pub timeline: std::vec::Vec<crate::model::QueryTimelineSample>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobStatistics3 {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_files][crate::model::JobStatistics3::input_files].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_input_files(Int64Value::default()/* use setters */);
/// ```
pub fn set_input_files<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_files = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_files][crate::model::JobStatistics3::input_files].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_or_clear_input_files(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics3::new().set_or_clear_input_files(None::<Int64Value>);
/// ```
pub fn set_or_clear_input_files<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_files = v.map(|x| x.into());
self
}
/// Sets the value of [input_file_bytes][crate::model::JobStatistics3::input_file_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_input_file_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_input_file_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_file_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_file_bytes][crate::model::JobStatistics3::input_file_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_or_clear_input_file_bytes(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics3::new().set_or_clear_input_file_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_input_file_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_file_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [output_rows][crate::model::JobStatistics3::output_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_output_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_output_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_rows][crate::model::JobStatistics3::output_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_or_clear_output_rows(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics3::new().set_or_clear_output_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_output_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_rows = v.map(|x| x.into());
self
}
/// Sets the value of [output_bytes][crate::model::JobStatistics3::output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_output_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_output_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_bytes][crate::model::JobStatistics3::output_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_or_clear_output_bytes(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics3::new().set_or_clear_output_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_output_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.output_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [bad_records][crate::model::JobStatistics3::bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_bad_records(Int64Value::default()/* use setters */);
/// ```
pub fn set_bad_records<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bad_records = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [bad_records][crate::model::JobStatistics3::bad_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use wkt::Int64Value;
/// let x = JobStatistics3::new().set_or_clear_bad_records(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics3::new().set_or_clear_bad_records(None::<Int64Value>);
/// ```
pub fn set_or_clear_bad_records<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.bad_records = v.map(|x| x.into());
self
}
/// Sets the value of [timeline][crate::model::JobStatistics3::timeline].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics3;
/// use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// let x = JobStatistics3::new()
/// .set_timeline([
/// QueryTimelineSample::default()/* use setters */,
/// QueryTimelineSample::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_timeline<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryTimelineSample>,
{
use std::iter::Iterator;
self.timeline = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JobStatistics3 {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatistics3"
}
}
/// Statistics for an extract job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobStatistics4 {
/// Output only. Number of files per destination URI or URI pattern
/// specified in the extract configuration. These values will be in the same
/// order as the URIs specified in the 'destinationUris' field.
pub destination_uri_file_counts: std::vec::Vec<i64>,
/// Output only. Number of user bytes extracted into the result. This is the
/// byte count as computed by BigQuery for billing purposes
/// and doesn't have any relationship with the number of actual
/// result bytes extracted in the desired format.
pub input_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Describes a timeline of job execution.
pub timeline: std::vec::Vec<crate::model::QueryTimelineSample>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobStatistics4 {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [destination_uri_file_counts][crate::model::JobStatistics4::destination_uri_file_counts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics4;
/// let x = JobStatistics4::new().set_destination_uri_file_counts([1, 2, 3]);
/// ```
pub fn set_destination_uri_file_counts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i64>,
{
use std::iter::Iterator;
self.destination_uri_file_counts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [input_bytes][crate::model::JobStatistics4::input_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics4;
/// use wkt::Int64Value;
/// let x = JobStatistics4::new().set_input_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_input_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_bytes][crate::model::JobStatistics4::input_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics4;
/// use wkt::Int64Value;
/// let x = JobStatistics4::new().set_or_clear_input_bytes(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics4::new().set_or_clear_input_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_input_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.input_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [timeline][crate::model::JobStatistics4::timeline].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics4;
/// use google_cloud_bigquery_v2::model::QueryTimelineSample;
/// let x = JobStatistics4::new()
/// .set_timeline([
/// QueryTimelineSample::default()/* use setters */,
/// QueryTimelineSample::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_timeline<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryTimelineSample>,
{
use std::iter::Iterator;
self.timeline = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JobStatistics4 {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatistics4"
}
}
/// Statistics for a copy job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CopyJobStatistics {
/// Output only. Number of rows copied to the destination table.
pub copied_rows: std::option::Option<wkt::Int64Value>,
/// Output only. Number of logical bytes copied to the destination table.
pub copied_logical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Destination region for a cross-region copy job. Not set for
/// in-region copy jobs.
pub remote_destination_region: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CopyJobStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [copied_rows][crate::model::CopyJobStatistics::copied_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// use wkt::Int64Value;
/// let x = CopyJobStatistics::new().set_copied_rows(Int64Value::default()/* use setters */);
/// ```
pub fn set_copied_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.copied_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [copied_rows][crate::model::CopyJobStatistics::copied_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// use wkt::Int64Value;
/// let x = CopyJobStatistics::new().set_or_clear_copied_rows(Some(Int64Value::default()/* use setters */));
/// let x = CopyJobStatistics::new().set_or_clear_copied_rows(None::<Int64Value>);
/// ```
pub fn set_or_clear_copied_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.copied_rows = v.map(|x| x.into());
self
}
/// Sets the value of [copied_logical_bytes][crate::model::CopyJobStatistics::copied_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// use wkt::Int64Value;
/// let x = CopyJobStatistics::new().set_copied_logical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_copied_logical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.copied_logical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [copied_logical_bytes][crate::model::CopyJobStatistics::copied_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// use wkt::Int64Value;
/// let x = CopyJobStatistics::new().set_or_clear_copied_logical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = CopyJobStatistics::new().set_or_clear_copied_logical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_copied_logical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.copied_logical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [remote_destination_region][crate::model::CopyJobStatistics::remote_destination_region].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// let x = CopyJobStatistics::new().set_remote_destination_region("example");
/// ```
pub fn set_remote_destination_region<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.remote_destination_region = v.into();
self
}
}
impl wkt::message::Message for CopyJobStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.CopyJobStatistics"
}
}
/// Job statistics specific to a BigQuery ML training job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MlStatistics {
/// Output only. Maximum number of iterations specified as max_iterations in
/// the 'CREATE MODEL' query. The actual number of iterations may be less than
/// this number due to early stop.
pub max_iterations: i64,
/// Results for all completed iterations.
/// Empty for [hyperparameter tuning
/// jobs](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview).
pub iteration_results: std::vec::Vec<crate::model::model::training_run::IterationResult>,
/// Output only. The type of the model that is being trained.
pub model_type: crate::model::model::ModelType,
/// Output only. Training type of the job.
pub training_type: crate::model::ml_statistics::TrainingType,
/// Output only. Trials of a [hyperparameter tuning
/// job](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// sorted by trial_id.
pub hparam_trials: std::vec::Vec<crate::model::model::HparamTuningTrial>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MlStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [max_iterations][crate::model::MlStatistics::max_iterations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MlStatistics;
/// let x = MlStatistics::new().set_max_iterations(42);
/// ```
pub fn set_max_iterations<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_iterations = v.into();
self
}
/// Sets the value of [iteration_results][crate::model::MlStatistics::iteration_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MlStatistics;
/// use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// let x = MlStatistics::new()
/// .set_iteration_results([
/// IterationResult::default()/* use setters */,
/// IterationResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_iteration_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::training_run::IterationResult>,
{
use std::iter::Iterator;
self.iteration_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model_type][crate::model::MlStatistics::model_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MlStatistics;
/// use google_cloud_bigquery_v2::model::model::ModelType;
/// let x0 = MlStatistics::new().set_model_type(ModelType::LinearRegression);
/// let x1 = MlStatistics::new().set_model_type(ModelType::LogisticRegression);
/// let x2 = MlStatistics::new().set_model_type(ModelType::Kmeans);
/// ```
pub fn set_model_type<T: std::convert::Into<crate::model::model::ModelType>>(
mut self,
v: T,
) -> Self {
self.model_type = v.into();
self
}
/// Sets the value of [training_type][crate::model::MlStatistics::training_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MlStatistics;
/// use google_cloud_bigquery_v2::model::ml_statistics::TrainingType;
/// let x0 = MlStatistics::new().set_training_type(TrainingType::SingleTraining);
/// let x1 = MlStatistics::new().set_training_type(TrainingType::HparamTuning);
/// ```
pub fn set_training_type<T: std::convert::Into<crate::model::ml_statistics::TrainingType>>(
mut self,
v: T,
) -> Self {
self.training_type = v.into();
self
}
/// Sets the value of [hparam_trials][crate::model::MlStatistics::hparam_trials].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MlStatistics;
/// use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = MlStatistics::new()
/// .set_hparam_trials([
/// HparamTuningTrial::default()/* use setters */,
/// HparamTuningTrial::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_hparam_trials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::HparamTuningTrial>,
{
use std::iter::Iterator;
self.hparam_trials = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MlStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MlStatistics"
}
}
/// Defines additional types related to [MlStatistics].
pub mod ml_statistics {
#[allow(unused_imports)]
use super::*;
/// Training type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TrainingType {
/// Unspecified training type.
Unspecified,
/// Single training with fixed parameter space.
SingleTraining,
/// [Hyperparameter tuning
/// training](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview).
HparamTuning,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TrainingType::value] or
/// [TrainingType::name].
UnknownValue(training_type::UnknownValue),
}
#[doc(hidden)]
pub mod training_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TrainingType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SingleTraining => std::option::Option::Some(1),
Self::HparamTuning => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRAINING_TYPE_UNSPECIFIED"),
Self::SingleTraining => std::option::Option::Some("SINGLE_TRAINING"),
Self::HparamTuning => std::option::Option::Some("HPARAM_TUNING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TrainingType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TrainingType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TrainingType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SingleTraining,
2 => Self::HparamTuning,
_ => Self::UnknownValue(training_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TrainingType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRAINING_TYPE_UNSPECIFIED" => Self::Unspecified,
"SINGLE_TRAINING" => Self::SingleTraining,
"HPARAM_TUNING" => Self::HparamTuning,
_ => Self::UnknownValue(training_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TrainingType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::SingleTraining => serializer.serialize_i32(1),
Self::HparamTuning => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TrainingType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingType>::new(
".google.cloud.bigquery.v2.MlStatistics.TrainingType",
))
}
}
}
/// Job statistics specific to the child job of a script.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ScriptStatistics {
/// Whether this child job was a statement or expression.
pub evaluation_kind: crate::model::script_statistics::EvaluationKind,
/// Stack trace showing the line/column/procedure name of each frame on the
/// stack at the point where the current evaluation happened. The leaf frame
/// is first, the primary script is last. Never empty.
pub stack_frames: std::vec::Vec<crate::model::script_statistics::ScriptStackFrame>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ScriptStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [evaluation_kind][crate::model::ScriptStatistics::evaluation_kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptStatistics;
/// use google_cloud_bigquery_v2::model::script_statistics::EvaluationKind;
/// let x0 = ScriptStatistics::new().set_evaluation_kind(EvaluationKind::Statement);
/// let x1 = ScriptStatistics::new().set_evaluation_kind(EvaluationKind::Expression);
/// ```
pub fn set_evaluation_kind<
T: std::convert::Into<crate::model::script_statistics::EvaluationKind>,
>(
mut self,
v: T,
) -> Self {
self.evaluation_kind = v.into();
self
}
/// Sets the value of [stack_frames][crate::model::ScriptStatistics::stack_frames].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ScriptStatistics;
/// use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStatistics::new()
/// .set_stack_frames([
/// ScriptStackFrame::default()/* use setters */,
/// ScriptStackFrame::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_stack_frames<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::script_statistics::ScriptStackFrame>,
{
use std::iter::Iterator;
self.stack_frames = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ScriptStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ScriptStatistics"
}
}
/// Defines additional types related to [ScriptStatistics].
pub mod script_statistics {
#[allow(unused_imports)]
use super::*;
/// Represents the location of the statement/expression being evaluated.
/// Line and column numbers are defined as follows:
///
/// - Line and column numbers start with one. That is, line 1 column 1 denotes
/// the start of the script.
/// - When inside a stored procedure, all line/column numbers are relative
/// to the procedure body, not the script in which the procedure was defined.
/// - Start/end positions exclude leading/trailing comments and whitespace.
/// The end position always ends with a ";", when present.
/// - Multi-byte Unicode characters are treated as just one column.
/// - If the original script (or procedure definition) contains TAB characters,
/// a tab "snaps" the indentation forward to the nearest multiple of 8
/// characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8
/// will advance the next character to column 9. A TAB on column 9, 10, 11,
/// 12, 13, 14, 15, or 16 will advance the next character to column 17.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ScriptStackFrame {
/// Output only. One-based start line.
pub start_line: i32,
/// Output only. One-based start column.
pub start_column: i32,
/// Output only. One-based end line.
pub end_line: i32,
/// Output only. One-based end column.
pub end_column: i32,
/// Output only. Name of the active procedure, empty if in a top-level
/// script.
pub procedure_id: std::string::String,
/// Output only. Text of the current statement/expression.
pub text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ScriptStackFrame {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [start_line][crate::model::script_statistics::ScriptStackFrame::start_line].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_start_line(42);
/// ```
pub fn set_start_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.start_line = v.into();
self
}
/// Sets the value of [start_column][crate::model::script_statistics::ScriptStackFrame::start_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_start_column(42);
/// ```
pub fn set_start_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.start_column = v.into();
self
}
/// Sets the value of [end_line][crate::model::script_statistics::ScriptStackFrame::end_line].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_end_line(42);
/// ```
pub fn set_end_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.end_line = v.into();
self
}
/// Sets the value of [end_column][crate::model::script_statistics::ScriptStackFrame::end_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_end_column(42);
/// ```
pub fn set_end_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.end_column = v.into();
self
}
/// Sets the value of [procedure_id][crate::model::script_statistics::ScriptStackFrame::procedure_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_procedure_id("example");
/// ```
pub fn set_procedure_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.procedure_id = v.into();
self
}
/// Sets the value of [text][crate::model::script_statistics::ScriptStackFrame::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::script_statistics::ScriptStackFrame;
/// let x = ScriptStackFrame::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
}
impl wkt::message::Message for ScriptStackFrame {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ScriptStatistics.ScriptStackFrame"
}
}
/// Describes how the job is evaluated.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EvaluationKind {
/// Default value.
Unspecified,
/// The statement appears directly in the script.
Statement,
/// The statement evaluates an expression that appears in the script.
Expression,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [EvaluationKind::value] or
/// [EvaluationKind::name].
UnknownValue(evaluation_kind::UnknownValue),
}
#[doc(hidden)]
pub mod evaluation_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EvaluationKind {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Statement => std::option::Option::Some(1),
Self::Expression => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("EVALUATION_KIND_UNSPECIFIED"),
Self::Statement => std::option::Option::Some("STATEMENT"),
Self::Expression => std::option::Option::Some("EXPRESSION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EvaluationKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EvaluationKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EvaluationKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Statement,
2 => Self::Expression,
_ => Self::UnknownValue(evaluation_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EvaluationKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"EVALUATION_KIND_UNSPECIFIED" => Self::Unspecified,
"STATEMENT" => Self::Statement,
"EXPRESSION" => Self::Expression,
_ => Self::UnknownValue(evaluation_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EvaluationKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Statement => serializer.serialize_i32(1),
Self::Expression => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EvaluationKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EvaluationKind>::new(
".google.cloud.bigquery.v2.ScriptStatistics.EvaluationKind",
))
}
}
}
/// Statistics for row-level security.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RowLevelSecurityStatistics {
/// Whether any accessed data was protected by row access policies.
pub row_level_security_applied: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RowLevelSecurityStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [row_level_security_applied][crate::model::RowLevelSecurityStatistics::row_level_security_applied].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowLevelSecurityStatistics;
/// let x = RowLevelSecurityStatistics::new().set_row_level_security_applied(true);
/// ```
pub fn set_row_level_security_applied<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.row_level_security_applied = v.into();
self
}
}
impl wkt::message::Message for RowLevelSecurityStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RowLevelSecurityStatistics"
}
}
/// Statistics for data-masking.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataMaskingStatistics {
/// Whether any accessed data was protected by the data masking.
pub data_masking_applied: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataMaskingStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [data_masking_applied][crate::model::DataMaskingStatistics::data_masking_applied].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataMaskingStatistics;
/// let x = DataMaskingStatistics::new().set_data_masking_applied(true);
/// ```
pub fn set_data_masking_applied<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.data_masking_applied = v.into();
self
}
}
impl wkt::message::Message for DataMaskingStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DataMaskingStatistics"
}
}
/// Statistics for a single job execution.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobStatistics {
/// Output only. Creation time of this job, in milliseconds since the epoch.
/// This field will be present on all jobs.
pub creation_time: i64,
/// Output only. Start time of this job, in milliseconds since the epoch.
/// This field will be present when the job transitions from the PENDING state
/// to either RUNNING or DONE.
pub start_time: i64,
/// Output only. End time of this job, in milliseconds since the epoch. This
/// field will be present whenever a job is in the DONE state.
pub end_time: i64,
/// Output only. Total bytes processed for the job.
pub total_bytes_processed: std::option::Option<wkt::Int64Value>,
/// Output only. [TrustedTester] Job progress (0.0 -> 1.0) for LOAD and
/// EXTRACT jobs.
pub completion_ratio: std::option::Option<wkt::DoubleValue>,
/// Output only. Quotas which delayed this job's start time.
pub quota_deferments: std::vec::Vec<std::string::String>,
/// Output only. Statistics for a query job.
pub query: std::option::Option<crate::model::JobStatistics2>,
/// Output only. Statistics for a load job.
pub load: std::option::Option<crate::model::JobStatistics3>,
/// Output only. Statistics for an extract job.
pub extract: std::option::Option<crate::model::JobStatistics4>,
/// Output only. Statistics for a copy job.
pub copy: std::option::Option<crate::model::CopyJobStatistics>,
/// Output only. Slot-milliseconds for the job.
pub total_slot_ms: std::option::Option<wkt::Int64Value>,
/// Output only. Name of the primary reservation assigned to this job. Note
/// that this could be different than reservations reported in the reservation
/// usage field if parent reservations were used to execute this job.
pub reservation_id: std::string::String,
/// Output only. Number of child jobs executed.
pub num_child_jobs: i64,
/// Output only. If this is a child job, specifies the job ID of the parent.
pub parent_job_id: std::string::String,
/// Output only. If this a child job of a script, specifies information about
/// the context of this job within the script.
pub script_statistics: std::option::Option<crate::model::ScriptStatistics>,
/// Output only. Statistics for row-level security. Present only for query and
/// extract jobs.
pub row_level_security_statistics:
std::option::Option<crate::model::RowLevelSecurityStatistics>,
/// Output only. Statistics for data-masking. Present only for query and
/// extract jobs.
pub data_masking_statistics: std::option::Option<crate::model::DataMaskingStatistics>,
/// Output only. [Alpha] Information of the multi-statement transaction if this
/// job is part of one.
///
/// This property is only expected on a child job or a job that is in a
/// session. A script parent job is not part of the transaction started in the
/// script.
pub transaction_info: std::option::Option<crate::model::job_statistics::TransactionInfo>,
/// Output only. Information of the session if this job is part of one.
pub session_info: std::option::Option<crate::model::SessionInfo>,
/// Output only. The duration in milliseconds of the execution of the final
/// attempt of this job, as BigQuery may internally re-attempt to execute the
/// job.
pub final_execution_duration_ms: i64,
/// Output only. Name of edition corresponding to the reservation for this job
/// at the time of this update.
pub edition: crate::model::ReservationEdition,
/// Output only. The reservation group path of the reservation assigned to this
/// job. This field has a limit of 10 nested reservation groups. This is to
/// maintain consistency between reservatins info schema and jobs info schema.
/// The first reservation group is the root reservation group and the last is
/// the leaf or lowest level reservation group.
pub reservation_group_path: std::vec::Vec<std::string::String>,
/// Output only. Regions where the global query accesses data.
pub global_query_remote_regions: std::vec::Vec<std::string::String>,
/// Output only. The global query that created this job.
pub parent_global_query_job: std::option::Option<crate::model::JobReference>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [creation_time][crate::model::JobStatistics::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [start_time][crate::model::JobStatistics::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_start_time(42);
/// ```
pub fn set_start_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.start_time = v.into();
self
}
/// Sets the value of [end_time][crate::model::JobStatistics::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_end_time(42);
/// ```
pub fn set_end_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.end_time = v.into();
self
}
/// Sets the value of [total_bytes_processed][crate::model::JobStatistics::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::Int64Value;
/// let x = JobStatistics::new().set_total_bytes_processed(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_bytes_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_bytes_processed][crate::model::JobStatistics::total_bytes_processed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::Int64Value;
/// let x = JobStatistics::new().set_or_clear_total_bytes_processed(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_total_bytes_processed(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_bytes_processed = v.map(|x| x.into());
self
}
/// Sets the value of [completion_ratio][crate::model::JobStatistics::completion_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::DoubleValue;
/// let x = JobStatistics::new().set_completion_ratio(DoubleValue::default()/* use setters */);
/// ```
pub fn set_completion_ratio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.completion_ratio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [completion_ratio][crate::model::JobStatistics::completion_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::DoubleValue;
/// let x = JobStatistics::new().set_or_clear_completion_ratio(Some(DoubleValue::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_completion_ratio(None::<DoubleValue>);
/// ```
pub fn set_or_clear_completion_ratio<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.completion_ratio = v.map(|x| x.into());
self
}
/// Sets the value of [quota_deferments][crate::model::JobStatistics::quota_deferments].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_quota_deferments(["a", "b", "c"]);
/// ```
pub fn set_quota_deferments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.quota_deferments = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [query][crate::model::JobStatistics::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics::new().set_query(JobStatistics2::default()/* use setters */);
/// ```
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatistics2>,
{
self.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::JobStatistics::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics2;
/// let x = JobStatistics::new().set_or_clear_query(Some(JobStatistics2::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_query(None::<JobStatistics2>);
/// ```
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatistics2>,
{
self.query = v.map(|x| x.into());
self
}
/// Sets the value of [load][crate::model::JobStatistics::load].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics3;
/// let x = JobStatistics::new().set_load(JobStatistics3::default()/* use setters */);
/// ```
pub fn set_load<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatistics3>,
{
self.load = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [load][crate::model::JobStatistics::load].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics3;
/// let x = JobStatistics::new().set_or_clear_load(Some(JobStatistics3::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_load(None::<JobStatistics3>);
/// ```
pub fn set_or_clear_load<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatistics3>,
{
self.load = v.map(|x| x.into());
self
}
/// Sets the value of [extract][crate::model::JobStatistics::extract].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics4;
/// let x = JobStatistics::new().set_extract(JobStatistics4::default()/* use setters */);
/// ```
pub fn set_extract<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobStatistics4>,
{
self.extract = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [extract][crate::model::JobStatistics::extract].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobStatistics4;
/// let x = JobStatistics::new().set_or_clear_extract(Some(JobStatistics4::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_extract(None::<JobStatistics4>);
/// ```
pub fn set_or_clear_extract<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobStatistics4>,
{
self.extract = v.map(|x| x.into());
self
}
/// Sets the value of [copy][crate::model::JobStatistics::copy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// let x = JobStatistics::new().set_copy(CopyJobStatistics::default()/* use setters */);
/// ```
pub fn set_copy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CopyJobStatistics>,
{
self.copy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [copy][crate::model::JobStatistics::copy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::CopyJobStatistics;
/// let x = JobStatistics::new().set_or_clear_copy(Some(CopyJobStatistics::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_copy(None::<CopyJobStatistics>);
/// ```
pub fn set_or_clear_copy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CopyJobStatistics>,
{
self.copy = v.map(|x| x.into());
self
}
/// Sets the value of [total_slot_ms][crate::model::JobStatistics::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::Int64Value;
/// let x = JobStatistics::new().set_total_slot_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_total_slot_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_slot_ms][crate::model::JobStatistics::total_slot_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use wkt::Int64Value;
/// let x = JobStatistics::new().set_or_clear_total_slot_ms(Some(Int64Value::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_total_slot_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_total_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.total_slot_ms = v.map(|x| x.into());
self
}
/// Sets the value of [reservation_id][crate::model::JobStatistics::reservation_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_reservation_id("example");
/// ```
pub fn set_reservation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reservation_id = v.into();
self
}
/// Sets the value of [num_child_jobs][crate::model::JobStatistics::num_child_jobs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_num_child_jobs(42);
/// ```
pub fn set_num_child_jobs<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.num_child_jobs = v.into();
self
}
/// Sets the value of [parent_job_id][crate::model::JobStatistics::parent_job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_parent_job_id("example");
/// ```
pub fn set_parent_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent_job_id = v.into();
self
}
/// Sets the value of [script_statistics][crate::model::JobStatistics::script_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::ScriptStatistics;
/// let x = JobStatistics::new().set_script_statistics(ScriptStatistics::default()/* use setters */);
/// ```
pub fn set_script_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ScriptStatistics>,
{
self.script_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [script_statistics][crate::model::JobStatistics::script_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::ScriptStatistics;
/// let x = JobStatistics::new().set_or_clear_script_statistics(Some(ScriptStatistics::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_script_statistics(None::<ScriptStatistics>);
/// ```
pub fn set_or_clear_script_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ScriptStatistics>,
{
self.script_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [row_level_security_statistics][crate::model::JobStatistics::row_level_security_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::RowLevelSecurityStatistics;
/// let x = JobStatistics::new().set_row_level_security_statistics(RowLevelSecurityStatistics::default()/* use setters */);
/// ```
pub fn set_row_level_security_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RowLevelSecurityStatistics>,
{
self.row_level_security_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [row_level_security_statistics][crate::model::JobStatistics::row_level_security_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::RowLevelSecurityStatistics;
/// let x = JobStatistics::new().set_or_clear_row_level_security_statistics(Some(RowLevelSecurityStatistics::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_row_level_security_statistics(None::<RowLevelSecurityStatistics>);
/// ```
pub fn set_or_clear_row_level_security_statistics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::RowLevelSecurityStatistics>,
{
self.row_level_security_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [data_masking_statistics][crate::model::JobStatistics::data_masking_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::DataMaskingStatistics;
/// let x = JobStatistics::new().set_data_masking_statistics(DataMaskingStatistics::default()/* use setters */);
/// ```
pub fn set_data_masking_statistics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataMaskingStatistics>,
{
self.data_masking_statistics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_masking_statistics][crate::model::JobStatistics::data_masking_statistics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::DataMaskingStatistics;
/// let x = JobStatistics::new().set_or_clear_data_masking_statistics(Some(DataMaskingStatistics::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_data_masking_statistics(None::<DataMaskingStatistics>);
/// ```
pub fn set_or_clear_data_masking_statistics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataMaskingStatistics>,
{
self.data_masking_statistics = v.map(|x| x.into());
self
}
/// Sets the value of [transaction_info][crate::model::JobStatistics::transaction_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::job_statistics::TransactionInfo;
/// let x = JobStatistics::new().set_transaction_info(TransactionInfo::default()/* use setters */);
/// ```
pub fn set_transaction_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::job_statistics::TransactionInfo>,
{
self.transaction_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [transaction_info][crate::model::JobStatistics::transaction_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::job_statistics::TransactionInfo;
/// let x = JobStatistics::new().set_or_clear_transaction_info(Some(TransactionInfo::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_transaction_info(None::<TransactionInfo>);
/// ```
pub fn set_or_clear_transaction_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::job_statistics::TransactionInfo>,
{
self.transaction_info = v.map(|x| x.into());
self
}
/// Sets the value of [session_info][crate::model::JobStatistics::session_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::SessionInfo;
/// let x = JobStatistics::new().set_session_info(SessionInfo::default()/* use setters */);
/// ```
pub fn set_session_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SessionInfo>,
{
self.session_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session_info][crate::model::JobStatistics::session_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::SessionInfo;
/// let x = JobStatistics::new().set_or_clear_session_info(Some(SessionInfo::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_session_info(None::<SessionInfo>);
/// ```
pub fn set_or_clear_session_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SessionInfo>,
{
self.session_info = v.map(|x| x.into());
self
}
/// Sets the value of [final_execution_duration_ms][crate::model::JobStatistics::final_execution_duration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_final_execution_duration_ms(42);
/// ```
pub fn set_final_execution_duration_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.final_execution_duration_ms = v.into();
self
}
/// Sets the value of [edition][crate::model::JobStatistics::edition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::ReservationEdition;
/// let x0 = JobStatistics::new().set_edition(ReservationEdition::Standard);
/// let x1 = JobStatistics::new().set_edition(ReservationEdition::Enterprise);
/// let x2 = JobStatistics::new().set_edition(ReservationEdition::EnterprisePlus);
/// ```
pub fn set_edition<T: std::convert::Into<crate::model::ReservationEdition>>(
mut self,
v: T,
) -> Self {
self.edition = v.into();
self
}
/// Sets the value of [reservation_group_path][crate::model::JobStatistics::reservation_group_path].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_reservation_group_path(["a", "b", "c"]);
/// ```
pub fn set_reservation_group_path<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.reservation_group_path = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [global_query_remote_regions][crate::model::JobStatistics::global_query_remote_regions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// let x = JobStatistics::new().set_global_query_remote_regions(["a", "b", "c"]);
/// ```
pub fn set_global_query_remote_regions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.global_query_remote_regions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parent_global_query_job][crate::model::JobStatistics::parent_global_query_job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = JobStatistics::new().set_parent_global_query_job(JobReference::default()/* use setters */);
/// ```
pub fn set_parent_global_query_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.parent_global_query_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parent_global_query_job][crate::model::JobStatistics::parent_global_query_job].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatistics;
/// use google_cloud_bigquery_v2::model::JobReference;
/// let x = JobStatistics::new().set_or_clear_parent_global_query_job(Some(JobReference::default()/* use setters */));
/// let x = JobStatistics::new().set_or_clear_parent_global_query_job(None::<JobReference>);
/// ```
pub fn set_or_clear_parent_global_query_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JobReference>,
{
self.parent_global_query_job = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for JobStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatistics"
}
}
/// Defines additional types related to [JobStatistics].
pub mod job_statistics {
#[allow(unused_imports)]
use super::*;
/// [Alpha] Information of a multi-statement transaction.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransactionInfo {
/// Output only. [Alpha] Id of the transaction.
pub transaction_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TransactionInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [transaction_id][crate::model::job_statistics::TransactionInfo::transaction_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::job_statistics::TransactionInfo;
/// let x = TransactionInfo::new().set_transaction_id("example");
/// ```
pub fn set_transaction_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.transaction_id = v.into();
self
}
}
impl wkt::message::Message for TransactionInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatistics.TransactionInfo"
}
}
}
/// Detailed statistics for DML statements
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DmlStats {
/// Output only. Number of inserted Rows. Populated by DML INSERT and MERGE
/// statements
pub inserted_row_count: std::option::Option<wkt::Int64Value>,
/// Output only. Number of deleted Rows. populated by DML DELETE, MERGE and
/// TRUNCATE statements.
pub deleted_row_count: std::option::Option<wkt::Int64Value>,
/// Output only. Number of updated Rows. Populated by DML UPDATE and MERGE
/// statements.
pub updated_row_count: std::option::Option<wkt::Int64Value>,
/// Output only. DML mode used.
pub dml_mode: crate::model::dml_stats::DmlMode,
/// Output only. Reason for disabling fine-grained DML if applicable.
pub fine_grained_dml_unused_reason: crate::model::dml_stats::FineGrainedDmlUnusedReason,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DmlStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [inserted_row_count][crate::model::DmlStats::inserted_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_inserted_row_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_inserted_row_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.inserted_row_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [inserted_row_count][crate::model::DmlStats::inserted_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_or_clear_inserted_row_count(Some(Int64Value::default()/* use setters */));
/// let x = DmlStats::new().set_or_clear_inserted_row_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_inserted_row_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.inserted_row_count = v.map(|x| x.into());
self
}
/// Sets the value of [deleted_row_count][crate::model::DmlStats::deleted_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_deleted_row_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_deleted_row_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.deleted_row_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deleted_row_count][crate::model::DmlStats::deleted_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_or_clear_deleted_row_count(Some(Int64Value::default()/* use setters */));
/// let x = DmlStats::new().set_or_clear_deleted_row_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_deleted_row_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.deleted_row_count = v.map(|x| x.into());
self
}
/// Sets the value of [updated_row_count][crate::model::DmlStats::updated_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_updated_row_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_updated_row_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.updated_row_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [updated_row_count][crate::model::DmlStats::updated_row_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use wkt::Int64Value;
/// let x = DmlStats::new().set_or_clear_updated_row_count(Some(Int64Value::default()/* use setters */));
/// let x = DmlStats::new().set_or_clear_updated_row_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_updated_row_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.updated_row_count = v.map(|x| x.into());
self
}
/// Sets the value of [dml_mode][crate::model::DmlStats::dml_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use google_cloud_bigquery_v2::model::dml_stats::DmlMode;
/// let x0 = DmlStats::new().set_dml_mode(DmlMode::CoarseGrainedDml);
/// let x1 = DmlStats::new().set_dml_mode(DmlMode::FineGrainedDml);
/// ```
pub fn set_dml_mode<T: std::convert::Into<crate::model::dml_stats::DmlMode>>(
mut self,
v: T,
) -> Self {
self.dml_mode = v.into();
self
}
/// Sets the value of [fine_grained_dml_unused_reason][crate::model::DmlStats::fine_grained_dml_unused_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DmlStats;
/// use google_cloud_bigquery_v2::model::dml_stats::FineGrainedDmlUnusedReason;
/// let x0 = DmlStats::new().set_fine_grained_dml_unused_reason(FineGrainedDmlUnusedReason::MaxPartitionSizeExceeded);
/// let x1 = DmlStats::new().set_fine_grained_dml_unused_reason(FineGrainedDmlUnusedReason::TableNotEnrolled);
/// let x2 = DmlStats::new().set_fine_grained_dml_unused_reason(FineGrainedDmlUnusedReason::DmlInMultiStatementTransaction);
/// ```
pub fn set_fine_grained_dml_unused_reason<
T: std::convert::Into<crate::model::dml_stats::FineGrainedDmlUnusedReason>,
>(
mut self,
v: T,
) -> Self {
self.fine_grained_dml_unused_reason = v.into();
self
}
}
impl wkt::message::Message for DmlStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DmlStats"
}
}
/// Defines additional types related to [DmlStats].
pub mod dml_stats {
#[allow(unused_imports)]
use super::*;
/// Enum to specify the DML mode used.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DmlMode {
/// Default value. This value is unused.
Unspecified,
/// Coarse-grained DML was used.
CoarseGrainedDml,
/// Fine-grained DML was used.
FineGrainedDml,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DmlMode::value] or
/// [DmlMode::name].
UnknownValue(dml_mode::UnknownValue),
}
#[doc(hidden)]
pub mod dml_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DmlMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::CoarseGrainedDml => std::option::Option::Some(1),
Self::FineGrainedDml => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DML_MODE_UNSPECIFIED"),
Self::CoarseGrainedDml => std::option::Option::Some("COARSE_GRAINED_DML"),
Self::FineGrainedDml => std::option::Option::Some("FINE_GRAINED_DML"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DmlMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DmlMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DmlMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::CoarseGrainedDml,
2 => Self::FineGrainedDml,
_ => Self::UnknownValue(dml_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DmlMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DML_MODE_UNSPECIFIED" => Self::Unspecified,
"COARSE_GRAINED_DML" => Self::CoarseGrainedDml,
"FINE_GRAINED_DML" => Self::FineGrainedDml,
_ => Self::UnknownValue(dml_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DmlMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::CoarseGrainedDml => serializer.serialize_i32(1),
Self::FineGrainedDml => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DmlMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DmlMode>::new(
".google.cloud.bigquery.v2.DmlStats.DmlMode",
))
}
}
/// Reason for disabling fine-grained DML. Additional values may be added in
/// the future.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FineGrainedDmlUnusedReason {
/// Default value. This value is unused.
Unspecified,
/// Max partition size threshold exceeded. [Fine-grained DML Limitations]
/// (<https://docs.cloud.google.com/bigquery/docs/data-manipulation-language#fine-grained-dml-limitations>)
MaxPartitionSizeExceeded,
/// The table is not enrolled for fine-grained DML.
TableNotEnrolled,
/// The DML statement is part of a multi-statement transaction.
DmlInMultiStatementTransaction,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [FineGrainedDmlUnusedReason::value] or
/// [FineGrainedDmlUnusedReason::name].
UnknownValue(fine_grained_dml_unused_reason::UnknownValue),
}
#[doc(hidden)]
pub mod fine_grained_dml_unused_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FineGrainedDmlUnusedReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::MaxPartitionSizeExceeded => std::option::Option::Some(1),
Self::TableNotEnrolled => std::option::Option::Some(2),
Self::DmlInMultiStatementTransaction => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("FINE_GRAINED_DML_UNUSED_REASON_UNSPECIFIED")
}
Self::MaxPartitionSizeExceeded => {
std::option::Option::Some("MAX_PARTITION_SIZE_EXCEEDED")
}
Self::TableNotEnrolled => std::option::Option::Some("TABLE_NOT_ENROLLED"),
Self::DmlInMultiStatementTransaction => {
std::option::Option::Some("DML_IN_MULTI_STATEMENT_TRANSACTION")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FineGrainedDmlUnusedReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FineGrainedDmlUnusedReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FineGrainedDmlUnusedReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::MaxPartitionSizeExceeded,
2 => Self::TableNotEnrolled,
3 => Self::DmlInMultiStatementTransaction,
_ => Self::UnknownValue(fine_grained_dml_unused_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FineGrainedDmlUnusedReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FINE_GRAINED_DML_UNUSED_REASON_UNSPECIFIED" => Self::Unspecified,
"MAX_PARTITION_SIZE_EXCEEDED" => Self::MaxPartitionSizeExceeded,
"TABLE_NOT_ENROLLED" => Self::TableNotEnrolled,
"DML_IN_MULTI_STATEMENT_TRANSACTION" => Self::DmlInMultiStatementTransaction,
_ => Self::UnknownValue(fine_grained_dml_unused_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FineGrainedDmlUnusedReason {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::MaxPartitionSizeExceeded => serializer.serialize_i32(1),
Self::TableNotEnrolled => serializer.serialize_i32(2),
Self::DmlInMultiStatementTransaction => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FineGrainedDmlUnusedReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<FineGrainedDmlUnusedReason>::new(
".google.cloud.bigquery.v2.DmlStats.FineGrainedDmlUnusedReason",
),
)
}
}
}
/// Performance insights for the job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PerformanceInsights {
/// Output only. Average execution ms of previous runs. Indicates the job ran
/// slow compared to previous executions. To find previous executions, use
/// INFORMATION_SCHEMA tables and filter jobs with same query hash.
pub avg_previous_execution_ms: i64,
/// Output only. Standalone query stage performance insights, for exploring
/// potential improvements.
pub stage_performance_standalone_insights:
std::vec::Vec<crate::model::StagePerformanceStandaloneInsight>,
/// Output only. Query stage performance insights compared to previous runs,
/// for diagnosing performance regression.
pub stage_performance_change_insights:
std::vec::Vec<crate::model::StagePerformanceChangeInsight>,
/// Output only. Performance insights for table-level attributes that changed
/// compared to previous runs.
pub table_change_insights: std::vec::Vec<crate::model::TableChangeInsight>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PerformanceInsights {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [avg_previous_execution_ms][crate::model::PerformanceInsights::avg_previous_execution_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PerformanceInsights;
/// let x = PerformanceInsights::new().set_avg_previous_execution_ms(42);
/// ```
pub fn set_avg_previous_execution_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.avg_previous_execution_ms = v.into();
self
}
/// Sets the value of [stage_performance_standalone_insights][crate::model::PerformanceInsights::stage_performance_standalone_insights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PerformanceInsights;
/// use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = PerformanceInsights::new()
/// .set_stage_performance_standalone_insights([
/// StagePerformanceStandaloneInsight::default()/* use setters */,
/// StagePerformanceStandaloneInsight::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_stage_performance_standalone_insights<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StagePerformanceStandaloneInsight>,
{
use std::iter::Iterator;
self.stage_performance_standalone_insights = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [stage_performance_change_insights][crate::model::PerformanceInsights::stage_performance_change_insights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PerformanceInsights;
/// use google_cloud_bigquery_v2::model::StagePerformanceChangeInsight;
/// let x = PerformanceInsights::new()
/// .set_stage_performance_change_insights([
/// StagePerformanceChangeInsight::default()/* use setters */,
/// StagePerformanceChangeInsight::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_stage_performance_change_insights<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StagePerformanceChangeInsight>,
{
use std::iter::Iterator;
self.stage_performance_change_insights = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [table_change_insights][crate::model::PerformanceInsights::table_change_insights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PerformanceInsights;
/// use google_cloud_bigquery_v2::model::TableChangeInsight;
/// let x = PerformanceInsights::new()
/// .set_table_change_insights([
/// TableChangeInsight::default()/* use setters */,
/// TableChangeInsight::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_table_change_insights<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableChangeInsight>,
{
use std::iter::Iterator;
self.table_change_insights = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PerformanceInsights {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PerformanceInsights"
}
}
/// Performance insights compared to the previous executions for a specific
/// stage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StagePerformanceChangeInsight {
/// Output only. The stage id that the insight mapped to.
pub stage_id: i64,
/// Output only. Input data change insight of the query stage.
pub input_data_change: std::option::Option<crate::model::InputDataChange>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StagePerformanceChangeInsight {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [stage_id][crate::model::StagePerformanceChangeInsight::stage_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceChangeInsight;
/// let x = StagePerformanceChangeInsight::new().set_stage_id(42);
/// ```
pub fn set_stage_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.stage_id = v.into();
self
}
/// Sets the value of [input_data_change][crate::model::StagePerformanceChangeInsight::input_data_change].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceChangeInsight;
/// use google_cloud_bigquery_v2::model::InputDataChange;
/// let x = StagePerformanceChangeInsight::new().set_input_data_change(InputDataChange::default()/* use setters */);
/// ```
pub fn set_input_data_change<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InputDataChange>,
{
self.input_data_change = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_data_change][crate::model::StagePerformanceChangeInsight::input_data_change].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceChangeInsight;
/// use google_cloud_bigquery_v2::model::InputDataChange;
/// let x = StagePerformanceChangeInsight::new().set_or_clear_input_data_change(Some(InputDataChange::default()/* use setters */));
/// let x = StagePerformanceChangeInsight::new().set_or_clear_input_data_change(None::<InputDataChange>);
/// ```
pub fn set_or_clear_input_data_change<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InputDataChange>,
{
self.input_data_change = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for StagePerformanceChangeInsight {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StagePerformanceChangeInsight"
}
}
/// Details about the input data change insight.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputDataChange {
/// Output only. Records read difference percentage compared to a previous run.
pub records_read_diff_percentage: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InputDataChange {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [records_read_diff_percentage][crate::model::InputDataChange::records_read_diff_percentage].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InputDataChange;
/// let x = InputDataChange::new().set_records_read_diff_percentage(42.0);
/// ```
pub fn set_records_read_diff_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.records_read_diff_percentage = v.into();
self
}
}
impl wkt::message::Message for InputDataChange {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.InputDataChange"
}
}
/// Standalone performance insights for a specific stage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StagePerformanceStandaloneInsight {
/// Output only. The stage id that the insight mapped to.
pub stage_id: i64,
/// Output only. True if the stage has a slot contention issue.
pub slot_contention: std::option::Option<bool>,
/// Output only. True if the stage has insufficient shuffle quota.
pub insufficient_shuffle_quota: std::option::Option<bool>,
/// Output only. If present, the stage had the following reasons for being
/// disqualified from BI Engine execution.
pub bi_engine_reasons: std::vec::Vec<crate::model::BiEngineReason>,
/// Output only. High cardinality joins in the stage.
pub high_cardinality_joins: std::vec::Vec<crate::model::HighCardinalityJoin>,
/// Output only. Partition skew in the stage.
pub partition_skew: std::option::Option<crate::model::PartitionSkew>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StagePerformanceStandaloneInsight {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [stage_id][crate::model::StagePerformanceStandaloneInsight::stage_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = StagePerformanceStandaloneInsight::new().set_stage_id(42);
/// ```
pub fn set_stage_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.stage_id = v.into();
self
}
/// Sets the value of [slot_contention][crate::model::StagePerformanceStandaloneInsight::slot_contention].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = StagePerformanceStandaloneInsight::new().set_slot_contention(true);
/// ```
pub fn set_slot_contention<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.slot_contention = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [slot_contention][crate::model::StagePerformanceStandaloneInsight::slot_contention].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_slot_contention(Some(false));
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_slot_contention(None::<bool>);
/// ```
pub fn set_or_clear_slot_contention<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.slot_contention = v.map(|x| x.into());
self
}
/// Sets the value of [insufficient_shuffle_quota][crate::model::StagePerformanceStandaloneInsight::insufficient_shuffle_quota].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = StagePerformanceStandaloneInsight::new().set_insufficient_shuffle_quota(true);
/// ```
pub fn set_insufficient_shuffle_quota<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.insufficient_shuffle_quota = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [insufficient_shuffle_quota][crate::model::StagePerformanceStandaloneInsight::insufficient_shuffle_quota].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_insufficient_shuffle_quota(Some(false));
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_insufficient_shuffle_quota(None::<bool>);
/// ```
pub fn set_or_clear_insufficient_shuffle_quota<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.insufficient_shuffle_quota = v.map(|x| x.into());
self
}
/// Sets the value of [bi_engine_reasons][crate::model::StagePerformanceStandaloneInsight::bi_engine_reasons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// use google_cloud_bigquery_v2::model::BiEngineReason;
/// let x = StagePerformanceStandaloneInsight::new()
/// .set_bi_engine_reasons([
/// BiEngineReason::default()/* use setters */,
/// BiEngineReason::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_bi_engine_reasons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BiEngineReason>,
{
use std::iter::Iterator;
self.bi_engine_reasons = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [high_cardinality_joins][crate::model::StagePerformanceStandaloneInsight::high_cardinality_joins].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// use google_cloud_bigquery_v2::model::HighCardinalityJoin;
/// let x = StagePerformanceStandaloneInsight::new()
/// .set_high_cardinality_joins([
/// HighCardinalityJoin::default()/* use setters */,
/// HighCardinalityJoin::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_high_cardinality_joins<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::HighCardinalityJoin>,
{
use std::iter::Iterator;
self.high_cardinality_joins = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [partition_skew][crate::model::StagePerformanceStandaloneInsight::partition_skew].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// use google_cloud_bigquery_v2::model::PartitionSkew;
/// let x = StagePerformanceStandaloneInsight::new().set_partition_skew(PartitionSkew::default()/* use setters */);
/// ```
pub fn set_partition_skew<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PartitionSkew>,
{
self.partition_skew = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [partition_skew][crate::model::StagePerformanceStandaloneInsight::partition_skew].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StagePerformanceStandaloneInsight;
/// use google_cloud_bigquery_v2::model::PartitionSkew;
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_partition_skew(Some(PartitionSkew::default()/* use setters */));
/// let x = StagePerformanceStandaloneInsight::new().set_or_clear_partition_skew(None::<PartitionSkew>);
/// ```
pub fn set_or_clear_partition_skew<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PartitionSkew>,
{
self.partition_skew = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for StagePerformanceStandaloneInsight {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StagePerformanceStandaloneInsight"
}
}
/// High cardinality join detailed information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HighCardinalityJoin {
/// Output only. Count of left input rows.
pub left_rows: i64,
/// Output only. Count of right input rows.
pub right_rows: i64,
/// Output only. Count of the output rows.
pub output_rows: i64,
/// Output only. The index of the join operator in the ExplainQueryStep lists.
pub step_index: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HighCardinalityJoin {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [left_rows][crate::model::HighCardinalityJoin::left_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HighCardinalityJoin;
/// let x = HighCardinalityJoin::new().set_left_rows(42);
/// ```
pub fn set_left_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.left_rows = v.into();
self
}
/// Sets the value of [right_rows][crate::model::HighCardinalityJoin::right_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HighCardinalityJoin;
/// let x = HighCardinalityJoin::new().set_right_rows(42);
/// ```
pub fn set_right_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.right_rows = v.into();
self
}
/// Sets the value of [output_rows][crate::model::HighCardinalityJoin::output_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HighCardinalityJoin;
/// let x = HighCardinalityJoin::new().set_output_rows(42);
/// ```
pub fn set_output_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.output_rows = v.into();
self
}
/// Sets the value of [step_index][crate::model::HighCardinalityJoin::step_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::HighCardinalityJoin;
/// let x = HighCardinalityJoin::new().set_step_index(42);
/// ```
pub fn set_step_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.step_index = v.into();
self
}
}
impl wkt::message::Message for HighCardinalityJoin {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.HighCardinalityJoin"
}
}
/// Partition skew detailed information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionSkew {
/// Output only. Source stages which produce skewed data.
pub skew_sources: std::vec::Vec<crate::model::partition_skew::SkewSource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionSkew {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [skew_sources][crate::model::PartitionSkew::skew_sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PartitionSkew;
/// use google_cloud_bigquery_v2::model::partition_skew::SkewSource;
/// let x = PartitionSkew::new()
/// .set_skew_sources([
/// SkewSource::default()/* use setters */,
/// SkewSource::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_skew_sources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::partition_skew::SkewSource>,
{
use std::iter::Iterator;
self.skew_sources = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PartitionSkew {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PartitionSkew"
}
}
/// Defines additional types related to [PartitionSkew].
pub mod partition_skew {
#[allow(unused_imports)]
use super::*;
/// Details about source stages which produce skewed data.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SkewSource {
/// Output only. Stage id of the skew source stage.
pub stage_id: i64,
/// Output only. Median partition output size (in bytes) for this stage.
pub output_bytes_median: i64,
/// Output only. 95-th percentile of partition output size (in bytes) for
/// this stage.
pub output_bytes_p95: i64,
/// Output only. Max partition output size (in bytes) for this stage.
pub output_bytes_max: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SkewSource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [stage_id][crate::model::partition_skew::SkewSource::stage_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::partition_skew::SkewSource;
/// let x = SkewSource::new().set_stage_id(42);
/// ```
pub fn set_stage_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.stage_id = v.into();
self
}
/// Sets the value of [output_bytes_median][crate::model::partition_skew::SkewSource::output_bytes_median].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::partition_skew::SkewSource;
/// let x = SkewSource::new().set_output_bytes_median(42);
/// ```
pub fn set_output_bytes_median<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.output_bytes_median = v.into();
self
}
/// Sets the value of [output_bytes_p95][crate::model::partition_skew::SkewSource::output_bytes_p95].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::partition_skew::SkewSource;
/// let x = SkewSource::new().set_output_bytes_p95(42);
/// ```
pub fn set_output_bytes_p95<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.output_bytes_p95 = v.into();
self
}
/// Sets the value of [output_bytes_max][crate::model::partition_skew::SkewSource::output_bytes_max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::partition_skew::SkewSource;
/// let x = SkewSource::new().set_output_bytes_max(42);
/// ```
pub fn set_output_bytes_max<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.output_bytes_max = v.into();
self
}
}
impl wkt::message::Message for SkewSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PartitionSkew.SkewSource"
}
}
}
/// Table-level performance insights compared to previous runs. These insights
/// don't apply to specific query stages, rather they apply to the whole table.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableChangeInsight {
/// Output only. The table that was queried.
pub table_reference: std::option::Option<crate::model::TableReference>,
/// Output only. If present, indicates that the table's metadata column index
/// staleness has increased significantly compared to previous jobs with the
/// same query hash.
pub metadata_cache_staleness_insight:
std::option::Option<crate::model::MetadataCacheStalenessInsight>,
/// Output only. True if the table's column metadata index was not used in the
/// current job, but was used in a previous job with the same query hash.
pub metadata_cache_not_used_but_used_previously: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableChangeInsight {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [table_reference][crate::model::TableChangeInsight::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableChangeInsight::new().set_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_reference][crate::model::TableChangeInsight::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableChangeInsight::new().set_or_clear_table_reference(Some(TableReference::default()/* use setters */));
/// let x = TableChangeInsight::new().set_or_clear_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_cache_staleness_insight][crate::model::TableChangeInsight::metadata_cache_staleness_insight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// use google_cloud_bigquery_v2::model::MetadataCacheStalenessInsight;
/// let x = TableChangeInsight::new().set_metadata_cache_staleness_insight(MetadataCacheStalenessInsight::default()/* use setters */);
/// ```
pub fn set_metadata_cache_staleness_insight<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MetadataCacheStalenessInsight>,
{
self.metadata_cache_staleness_insight = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata_cache_staleness_insight][crate::model::TableChangeInsight::metadata_cache_staleness_insight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// use google_cloud_bigquery_v2::model::MetadataCacheStalenessInsight;
/// let x = TableChangeInsight::new().set_or_clear_metadata_cache_staleness_insight(Some(MetadataCacheStalenessInsight::default()/* use setters */));
/// let x = TableChangeInsight::new().set_or_clear_metadata_cache_staleness_insight(None::<MetadataCacheStalenessInsight>);
/// ```
pub fn set_or_clear_metadata_cache_staleness_insight<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::MetadataCacheStalenessInsight>,
{
self.metadata_cache_staleness_insight = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_cache_not_used_but_used_previously][crate::model::TableChangeInsight::metadata_cache_not_used_but_used_previously].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// let x = TableChangeInsight::new().set_metadata_cache_not_used_but_used_previously(true);
/// ```
pub fn set_metadata_cache_not_used_but_used_previously<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.metadata_cache_not_used_but_used_previously = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata_cache_not_used_but_used_previously][crate::model::TableChangeInsight::metadata_cache_not_used_but_used_previously].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableChangeInsight;
/// let x = TableChangeInsight::new().set_or_clear_metadata_cache_not_used_but_used_previously(Some(false));
/// let x = TableChangeInsight::new().set_or_clear_metadata_cache_not_used_but_used_previously(None::<bool>);
/// ```
pub fn set_or_clear_metadata_cache_not_used_but_used_previously<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<bool>,
{
self.metadata_cache_not_used_but_used_previously = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableChangeInsight {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableChangeInsight"
}
}
/// Column Metadata Index staleness detailed infnormation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MetadataCacheStalenessInsight {
/// Output only. Average column metadata index staleness of previous runs with
/// the same query hash.
pub avg_previous_staleness_ms: std::option::Option<wkt::Duration>,
/// Output only. The percent increase in staleness between the current job and
/// the average staleness of previous jobs with the same query hash.
pub staleness_percentage_increase: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MetadataCacheStalenessInsight {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [avg_previous_staleness_ms][crate::model::MetadataCacheStalenessInsight::avg_previous_staleness_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MetadataCacheStalenessInsight;
/// use wkt::Duration;
/// let x = MetadataCacheStalenessInsight::new().set_avg_previous_staleness_ms(Duration::default()/* use setters */);
/// ```
pub fn set_avg_previous_staleness_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.avg_previous_staleness_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [avg_previous_staleness_ms][crate::model::MetadataCacheStalenessInsight::avg_previous_staleness_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MetadataCacheStalenessInsight;
/// use wkt::Duration;
/// let x = MetadataCacheStalenessInsight::new().set_or_clear_avg_previous_staleness_ms(Some(Duration::default()/* use setters */));
/// let x = MetadataCacheStalenessInsight::new().set_or_clear_avg_previous_staleness_ms(None::<Duration>);
/// ```
pub fn set_or_clear_avg_previous_staleness_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.avg_previous_staleness_ms = v.map(|x| x.into());
self
}
/// Sets the value of [staleness_percentage_increase][crate::model::MetadataCacheStalenessInsight::staleness_percentage_increase].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MetadataCacheStalenessInsight;
/// let x = MetadataCacheStalenessInsight::new().set_staleness_percentage_increase(42.0);
/// ```
pub fn set_staleness_percentage_increase<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.staleness_percentage_increase = v.into();
self
}
}
impl wkt::message::Message for MetadataCacheStalenessInsight {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MetadataCacheStalenessInsight"
}
}
/// Statistics for a BigSpark query.
/// Populated as part of JobStatistics2
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SparkStatistics {
/// Output only. Spark job ID if a Spark job is created successfully.
pub spark_job_id: std::option::Option<std::string::String>,
/// Output only. Location where the Spark job is executed.
/// A location is selected by BigQueury for jobs configured to run in a
/// multi-region.
pub spark_job_location: std::option::Option<std::string::String>,
/// Output only. Endpoints returned from Dataproc.
/// Key list:
///
/// - history_server_endpoint: A link to Spark job UI.
pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
/// Output only. Logging info is used to generate a link to Cloud Logging.
pub logging_info: std::option::Option<crate::model::spark_statistics::LoggingInfo>,
/// Output only. The Cloud KMS encryption key that is used to protect the
/// resources created by the Spark job. If the Spark procedure uses the invoker
/// security mode, the Cloud KMS encryption key is either inferred from the
/// provided system variable,
/// `@@spark_proc_properties.kms_key_name`, or the default key of the BigQuery
/// job's project (if the CMEK organization policy is enforced). Otherwise, the
/// Cloud KMS key is either inferred from the Spark connection associated with
/// the procedure (if it is provided), or from the default key of the Spark
/// connection's project if the CMEK organization policy is enforced.
///
/// Example:
///
/// * `projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]`
pub kms_key_name: std::option::Option<std::string::String>,
/// Output only. The Google Cloud Storage bucket that is used as the default
/// file system by the Spark application. This field is only filled when the
/// Spark procedure uses the invoker security mode. The `gcsStagingBucket`
/// bucket is inferred from the `@@spark_proc_properties.staging_bucket` system
/// variable (if it is provided). Otherwise, BigQuery creates a default staging
/// bucket for the job and returns the bucket name in this field.
///
/// Example:
///
/// * `gs://[bucket_name]`
pub gcs_staging_bucket: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SparkStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [spark_job_id][crate::model::SparkStatistics::spark_job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_spark_job_id("example");
/// ```
pub fn set_spark_job_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.spark_job_id = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [spark_job_id][crate::model::SparkStatistics::spark_job_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_or_clear_spark_job_id(Some("example"));
/// let x = SparkStatistics::new().set_or_clear_spark_job_id(None::<String>);
/// ```
pub fn set_or_clear_spark_job_id<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.spark_job_id = v.map(|x| x.into());
self
}
/// Sets the value of [spark_job_location][crate::model::SparkStatistics::spark_job_location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_spark_job_location("example");
/// ```
pub fn set_spark_job_location<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.spark_job_location = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [spark_job_location][crate::model::SparkStatistics::spark_job_location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_or_clear_spark_job_location(Some("example"));
/// let x = SparkStatistics::new().set_or_clear_spark_job_location(None::<String>);
/// ```
pub fn set_or_clear_spark_job_location<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.spark_job_location = v.map(|x| x.into());
self
}
/// Sets the value of [endpoints][crate::model::SparkStatistics::endpoints].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_endpoints([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [logging_info][crate::model::SparkStatistics::logging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// use google_cloud_bigquery_v2::model::spark_statistics::LoggingInfo;
/// let x = SparkStatistics::new().set_logging_info(LoggingInfo::default()/* use setters */);
/// ```
pub fn set_logging_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::spark_statistics::LoggingInfo>,
{
self.logging_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [logging_info][crate::model::SparkStatistics::logging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// use google_cloud_bigquery_v2::model::spark_statistics::LoggingInfo;
/// let x = SparkStatistics::new().set_or_clear_logging_info(Some(LoggingInfo::default()/* use setters */));
/// let x = SparkStatistics::new().set_or_clear_logging_info(None::<LoggingInfo>);
/// ```
pub fn set_or_clear_logging_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::spark_statistics::LoggingInfo>,
{
self.logging_info = v.map(|x| x.into());
self
}
/// Sets the value of [kms_key_name][crate::model::SparkStatistics::kms_key_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_kms_key_name("example");
/// ```
pub fn set_kms_key_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.kms_key_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [kms_key_name][crate::model::SparkStatistics::kms_key_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_or_clear_kms_key_name(Some("example"));
/// let x = SparkStatistics::new().set_or_clear_kms_key_name(None::<String>);
/// ```
pub fn set_or_clear_kms_key_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.kms_key_name = v.map(|x| x.into());
self
}
/// Sets the value of [gcs_staging_bucket][crate::model::SparkStatistics::gcs_staging_bucket].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_gcs_staging_bucket("example");
/// ```
pub fn set_gcs_staging_bucket<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.gcs_staging_bucket = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [gcs_staging_bucket][crate::model::SparkStatistics::gcs_staging_bucket].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkStatistics;
/// let x = SparkStatistics::new().set_or_clear_gcs_staging_bucket(Some("example"));
/// let x = SparkStatistics::new().set_or_clear_gcs_staging_bucket(None::<String>);
/// ```
pub fn set_or_clear_gcs_staging_bucket<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.gcs_staging_bucket = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SparkStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SparkStatistics"
}
}
/// Defines additional types related to [SparkStatistics].
pub mod spark_statistics {
#[allow(unused_imports)]
use super::*;
/// Spark job logs can be filtered by these fields in Cloud Logging.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LoggingInfo {
/// Output only. Resource type used for logging.
pub resource_type: std::string::String,
/// Output only. Project ID where the Spark logs were written.
pub project_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LoggingInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [resource_type][crate::model::spark_statistics::LoggingInfo::resource_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::spark_statistics::LoggingInfo;
/// let x = LoggingInfo::new().set_resource_type("example");
/// ```
pub fn set_resource_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.resource_type = v.into();
self
}
/// Sets the value of [project_id][crate::model::spark_statistics::LoggingInfo::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::spark_statistics::LoggingInfo;
/// let x = LoggingInfo::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
}
impl wkt::message::Message for LoggingInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SparkStatistics.LoggingInfo"
}
}
}
/// Statistics of materialized views considered in a query job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaterializedViewStatistics {
/// Materialized views considered for the query job. Only certain materialized
/// views are used. For a detailed list, see the child message.
///
/// If many materialized views are considered, then the list might be
/// incomplete.
pub materialized_view: std::vec::Vec<crate::model::MaterializedView>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaterializedViewStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [materialized_view][crate::model::MaterializedViewStatistics::materialized_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewStatistics;
/// use google_cloud_bigquery_v2::model::MaterializedView;
/// let x = MaterializedViewStatistics::new()
/// .set_materialized_view([
/// MaterializedView::default()/* use setters */,
/// MaterializedView::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_materialized_view<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MaterializedView>,
{
use std::iter::Iterator;
self.materialized_view = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MaterializedViewStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MaterializedViewStatistics"
}
}
/// A materialized view considered for a query job.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaterializedView {
/// The candidate materialized view.
pub table_reference: std::option::Option<crate::model::TableReference>,
/// Whether the materialized view is chosen for the query.
///
/// A materialized view can be chosen to rewrite multiple parts of the same
/// query. If a materialized view is chosen to rewrite any part of the query,
/// then this field is true, even if the materialized view was not chosen to
/// rewrite others parts.
pub chosen: std::option::Option<bool>,
/// If present, specifies a best-effort estimation of the bytes saved by using
/// the materialized view rather than its base tables.
pub estimated_bytes_saved: std::option::Option<i64>,
/// If present, specifies the reason why the materialized view was not chosen
/// for the query.
pub rejected_reason: std::option::Option<crate::model::materialized_view::RejectedReason>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaterializedView {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [table_reference][crate::model::MaterializedView::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = MaterializedView::new().set_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_reference][crate::model::MaterializedView::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = MaterializedView::new().set_or_clear_table_reference(Some(TableReference::default()/* use setters */));
/// let x = MaterializedView::new().set_or_clear_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [chosen][crate::model::MaterializedView::chosen].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// let x = MaterializedView::new().set_chosen(true);
/// ```
pub fn set_chosen<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.chosen = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [chosen][crate::model::MaterializedView::chosen].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// let x = MaterializedView::new().set_or_clear_chosen(Some(false));
/// let x = MaterializedView::new().set_or_clear_chosen(None::<bool>);
/// ```
pub fn set_or_clear_chosen<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.chosen = v.map(|x| x.into());
self
}
/// Sets the value of [estimated_bytes_saved][crate::model::MaterializedView::estimated_bytes_saved].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// let x = MaterializedView::new().set_estimated_bytes_saved(42);
/// ```
pub fn set_estimated_bytes_saved<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.estimated_bytes_saved = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [estimated_bytes_saved][crate::model::MaterializedView::estimated_bytes_saved].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// let x = MaterializedView::new().set_or_clear_estimated_bytes_saved(Some(42));
/// let x = MaterializedView::new().set_or_clear_estimated_bytes_saved(None::<i32>);
/// ```
pub fn set_or_clear_estimated_bytes_saved<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.estimated_bytes_saved = v.map(|x| x.into());
self
}
/// Sets the value of [rejected_reason][crate::model::MaterializedView::rejected_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// use google_cloud_bigquery_v2::model::materialized_view::RejectedReason;
/// let x0 = MaterializedView::new().set_rejected_reason(RejectedReason::NoData);
/// let x1 = MaterializedView::new().set_rejected_reason(RejectedReason::Cost);
/// let x2 = MaterializedView::new().set_rejected_reason(RejectedReason::BaseTableTruncated);
/// ```
pub fn set_rejected_reason<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::materialized_view::RejectedReason>,
{
self.rejected_reason = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rejected_reason][crate::model::MaterializedView::rejected_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedView;
/// use google_cloud_bigquery_v2::model::materialized_view::RejectedReason;
/// let x0 = MaterializedView::new().set_or_clear_rejected_reason(Some(RejectedReason::NoData));
/// let x1 = MaterializedView::new().set_or_clear_rejected_reason(Some(RejectedReason::Cost));
/// let x2 = MaterializedView::new().set_or_clear_rejected_reason(Some(RejectedReason::BaseTableTruncated));
/// let x_none = MaterializedView::new().set_or_clear_rejected_reason(None::<RejectedReason>);
/// ```
pub fn set_or_clear_rejected_reason<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::materialized_view::RejectedReason>,
{
self.rejected_reason = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for MaterializedView {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MaterializedView"
}
}
/// Defines additional types related to [MaterializedView].
pub mod materialized_view {
#[allow(unused_imports)]
use super::*;
/// Reason why a materialized view was not chosen for a query. For more
/// information, see [Understand why materialized views were
/// rejected](https://cloud.google.com/bigquery/docs/materialized-views-use#understand-rejected).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RejectedReason {
/// Default unspecified value.
Unspecified,
/// View has no cached data because it has not refreshed yet.
NoData,
/// The estimated cost of the view is more expensive than another view or the
/// base table.
///
/// Note: The estimate cost might not match the billed cost.
Cost,
/// View has no cached data because a base table is truncated.
BaseTableTruncated,
/// View is invalidated because of a data change in one or more base tables.
/// It could be any recent change if the
/// [`maxStaleness`](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.max_staleness)
/// option is not set for the view, or otherwise any change outside of the
/// staleness window.
BaseTableDataChange,
/// View is invalidated because a base table's partition expiration has
/// changed.
BaseTablePartitionExpirationChange,
/// View is invalidated because a base table's partition has expired.
BaseTableExpiredPartition,
/// View is invalidated because a base table has an incompatible metadata
/// change.
BaseTableIncompatibleMetadataChange,
/// View is invalidated because it was refreshed with a time zone other than
/// that of the current job.
TimeZone,
/// View is outside the time travel window.
OutOfTimeTravelWindow,
/// View is inaccessible to the user because of a fine-grained security
/// policy on one of its base tables.
BaseTableFineGrainedSecurityPolicy,
/// One of the view's base tables is too stale. For example, the cached
/// metadata of a BigLake external table needs to be updated.
BaseTableTooStale,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RejectedReason::value] or
/// [RejectedReason::name].
UnknownValue(rejected_reason::UnknownValue),
}
#[doc(hidden)]
pub mod rejected_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RejectedReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NoData => std::option::Option::Some(1),
Self::Cost => std::option::Option::Some(2),
Self::BaseTableTruncated => std::option::Option::Some(3),
Self::BaseTableDataChange => std::option::Option::Some(4),
Self::BaseTablePartitionExpirationChange => std::option::Option::Some(5),
Self::BaseTableExpiredPartition => std::option::Option::Some(6),
Self::BaseTableIncompatibleMetadataChange => std::option::Option::Some(7),
Self::TimeZone => std::option::Option::Some(8),
Self::OutOfTimeTravelWindow => std::option::Option::Some(9),
Self::BaseTableFineGrainedSecurityPolicy => std::option::Option::Some(10),
Self::BaseTableTooStale => std::option::Option::Some(11),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("REJECTED_REASON_UNSPECIFIED"),
Self::NoData => std::option::Option::Some("NO_DATA"),
Self::Cost => std::option::Option::Some("COST"),
Self::BaseTableTruncated => std::option::Option::Some("BASE_TABLE_TRUNCATED"),
Self::BaseTableDataChange => std::option::Option::Some("BASE_TABLE_DATA_CHANGE"),
Self::BaseTablePartitionExpirationChange => {
std::option::Option::Some("BASE_TABLE_PARTITION_EXPIRATION_CHANGE")
}
Self::BaseTableExpiredPartition => {
std::option::Option::Some("BASE_TABLE_EXPIRED_PARTITION")
}
Self::BaseTableIncompatibleMetadataChange => {
std::option::Option::Some("BASE_TABLE_INCOMPATIBLE_METADATA_CHANGE")
}
Self::TimeZone => std::option::Option::Some("TIME_ZONE"),
Self::OutOfTimeTravelWindow => {
std::option::Option::Some("OUT_OF_TIME_TRAVEL_WINDOW")
}
Self::BaseTableFineGrainedSecurityPolicy => {
std::option::Option::Some("BASE_TABLE_FINE_GRAINED_SECURITY_POLICY")
}
Self::BaseTableTooStale => std::option::Option::Some("BASE_TABLE_TOO_STALE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RejectedReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RejectedReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RejectedReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NoData,
2 => Self::Cost,
3 => Self::BaseTableTruncated,
4 => Self::BaseTableDataChange,
5 => Self::BaseTablePartitionExpirationChange,
6 => Self::BaseTableExpiredPartition,
7 => Self::BaseTableIncompatibleMetadataChange,
8 => Self::TimeZone,
9 => Self::OutOfTimeTravelWindow,
10 => Self::BaseTableFineGrainedSecurityPolicy,
11 => Self::BaseTableTooStale,
_ => Self::UnknownValue(rejected_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RejectedReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"REJECTED_REASON_UNSPECIFIED" => Self::Unspecified,
"NO_DATA" => Self::NoData,
"COST" => Self::Cost,
"BASE_TABLE_TRUNCATED" => Self::BaseTableTruncated,
"BASE_TABLE_DATA_CHANGE" => Self::BaseTableDataChange,
"BASE_TABLE_PARTITION_EXPIRATION_CHANGE" => {
Self::BaseTablePartitionExpirationChange
}
"BASE_TABLE_EXPIRED_PARTITION" => Self::BaseTableExpiredPartition,
"BASE_TABLE_INCOMPATIBLE_METADATA_CHANGE" => {
Self::BaseTableIncompatibleMetadataChange
}
"TIME_ZONE" => Self::TimeZone,
"OUT_OF_TIME_TRAVEL_WINDOW" => Self::OutOfTimeTravelWindow,
"BASE_TABLE_FINE_GRAINED_SECURITY_POLICY" => {
Self::BaseTableFineGrainedSecurityPolicy
}
"BASE_TABLE_TOO_STALE" => Self::BaseTableTooStale,
_ => Self::UnknownValue(rejected_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RejectedReason {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NoData => serializer.serialize_i32(1),
Self::Cost => serializer.serialize_i32(2),
Self::BaseTableTruncated => serializer.serialize_i32(3),
Self::BaseTableDataChange => serializer.serialize_i32(4),
Self::BaseTablePartitionExpirationChange => serializer.serialize_i32(5),
Self::BaseTableExpiredPartition => serializer.serialize_i32(6),
Self::BaseTableIncompatibleMetadataChange => serializer.serialize_i32(7),
Self::TimeZone => serializer.serialize_i32(8),
Self::OutOfTimeTravelWindow => serializer.serialize_i32(9),
Self::BaseTableFineGrainedSecurityPolicy => serializer.serialize_i32(10),
Self::BaseTableTooStale => serializer.serialize_i32(11),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RejectedReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RejectedReason>::new(
".google.cloud.bigquery.v2.MaterializedView.RejectedReason",
))
}
}
}
/// The column metadata index pruning statistics.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PruningStats {
/// The number of partitions matched.
pub post_cmeta_pruning_partition_count: std::option::Option<i64>,
/// The number of parallel inputs scanned.
pub pre_cmeta_pruning_parallel_input_count: std::option::Option<i64>,
/// The number of parallel inputs matched.
pub post_cmeta_pruning_parallel_input_count: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PruningStats {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [post_cmeta_pruning_partition_count][crate::model::PruningStats::post_cmeta_pruning_partition_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_post_cmeta_pruning_partition_count(42);
/// ```
pub fn set_post_cmeta_pruning_partition_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.post_cmeta_pruning_partition_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [post_cmeta_pruning_partition_count][crate::model::PruningStats::post_cmeta_pruning_partition_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_or_clear_post_cmeta_pruning_partition_count(Some(42));
/// let x = PruningStats::new().set_or_clear_post_cmeta_pruning_partition_count(None::<i32>);
/// ```
pub fn set_or_clear_post_cmeta_pruning_partition_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<i64>,
{
self.post_cmeta_pruning_partition_count = v.map(|x| x.into());
self
}
/// Sets the value of [pre_cmeta_pruning_parallel_input_count][crate::model::PruningStats::pre_cmeta_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_pre_cmeta_pruning_parallel_input_count(42);
/// ```
pub fn set_pre_cmeta_pruning_parallel_input_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.pre_cmeta_pruning_parallel_input_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pre_cmeta_pruning_parallel_input_count][crate::model::PruningStats::pre_cmeta_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_or_clear_pre_cmeta_pruning_parallel_input_count(Some(42));
/// let x = PruningStats::new().set_or_clear_pre_cmeta_pruning_parallel_input_count(None::<i32>);
/// ```
pub fn set_or_clear_pre_cmeta_pruning_parallel_input_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<i64>,
{
self.pre_cmeta_pruning_parallel_input_count = v.map(|x| x.into());
self
}
/// Sets the value of [post_cmeta_pruning_parallel_input_count][crate::model::PruningStats::post_cmeta_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_post_cmeta_pruning_parallel_input_count(42);
/// ```
pub fn set_post_cmeta_pruning_parallel_input_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.post_cmeta_pruning_parallel_input_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [post_cmeta_pruning_parallel_input_count][crate::model::PruningStats::post_cmeta_pruning_parallel_input_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PruningStats;
/// let x = PruningStats::new().set_or_clear_post_cmeta_pruning_parallel_input_count(Some(42));
/// let x = PruningStats::new().set_or_clear_post_cmeta_pruning_parallel_input_count(None::<i32>);
/// ```
pub fn set_or_clear_post_cmeta_pruning_parallel_input_count<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<i64>,
{
self.post_cmeta_pruning_parallel_input_count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PruningStats {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PruningStats"
}
}
/// Table level detail on the usage of metadata caching. Only set for Metadata
/// caching eligible tables referenced in the query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableMetadataCacheUsage {
/// Metadata caching eligible table referenced in the query.
pub table_reference: std::option::Option<crate::model::TableReference>,
/// Reason for not using metadata caching for the table.
pub unused_reason: std::option::Option<crate::model::table_metadata_cache_usage::UnusedReason>,
/// Free form human-readable reason metadata caching was unused for
/// the job.
pub explanation: std::option::Option<std::string::String>,
/// Duration since last refresh as of this job for managed tables (indicates
/// metadata cache staleness as seen by this job).
pub staleness: std::option::Option<wkt::Duration>,
/// [Table
/// type](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.type).
pub table_type: std::string::String,
/// The column metadata index pruning statistics.
pub pruning_stats: std::option::Option<crate::model::PruningStats>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableMetadataCacheUsage {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [table_reference][crate::model::TableMetadataCacheUsage::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableMetadataCacheUsage::new().set_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_reference][crate::model::TableMetadataCacheUsage::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableMetadataCacheUsage::new().set_or_clear_table_reference(Some(TableReference::default()/* use setters */));
/// let x = TableMetadataCacheUsage::new().set_or_clear_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [unused_reason][crate::model::TableMetadataCacheUsage::unused_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::table_metadata_cache_usage::UnusedReason;
/// let x0 = TableMetadataCacheUsage::new().set_unused_reason(UnusedReason::ExceededMaxStaleness);
/// let x1 = TableMetadataCacheUsage::new().set_unused_reason(UnusedReason::MetadataCachingNotEnabled);
/// let x2 = TableMetadataCacheUsage::new().set_unused_reason(UnusedReason::OtherReason);
/// ```
pub fn set_unused_reason<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::table_metadata_cache_usage::UnusedReason>,
{
self.unused_reason = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [unused_reason][crate::model::TableMetadataCacheUsage::unused_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::table_metadata_cache_usage::UnusedReason;
/// let x0 = TableMetadataCacheUsage::new().set_or_clear_unused_reason(Some(UnusedReason::ExceededMaxStaleness));
/// let x1 = TableMetadataCacheUsage::new().set_or_clear_unused_reason(Some(UnusedReason::MetadataCachingNotEnabled));
/// let x2 = TableMetadataCacheUsage::new().set_or_clear_unused_reason(Some(UnusedReason::OtherReason));
/// let x_none = TableMetadataCacheUsage::new().set_or_clear_unused_reason(None::<UnusedReason>);
/// ```
pub fn set_or_clear_unused_reason<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::table_metadata_cache_usage::UnusedReason>,
{
self.unused_reason = v.map(|x| x.into());
self
}
/// Sets the value of [explanation][crate::model::TableMetadataCacheUsage::explanation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// let x = TableMetadataCacheUsage::new().set_explanation("example");
/// ```
pub fn set_explanation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.explanation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [explanation][crate::model::TableMetadataCacheUsage::explanation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// let x = TableMetadataCacheUsage::new().set_or_clear_explanation(Some("example"));
/// let x = TableMetadataCacheUsage::new().set_or_clear_explanation(None::<String>);
/// ```
pub fn set_or_clear_explanation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.explanation = v.map(|x| x.into());
self
}
/// Sets the value of [staleness][crate::model::TableMetadataCacheUsage::staleness].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use wkt::Duration;
/// let x = TableMetadataCacheUsage::new().set_staleness(Duration::default()/* use setters */);
/// ```
pub fn set_staleness<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.staleness = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [staleness][crate::model::TableMetadataCacheUsage::staleness].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use wkt::Duration;
/// let x = TableMetadataCacheUsage::new().set_or_clear_staleness(Some(Duration::default()/* use setters */));
/// let x = TableMetadataCacheUsage::new().set_or_clear_staleness(None::<Duration>);
/// ```
pub fn set_or_clear_staleness<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.staleness = v.map(|x| x.into());
self
}
/// Sets the value of [table_type][crate::model::TableMetadataCacheUsage::table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// let x = TableMetadataCacheUsage::new().set_table_type("example");
/// ```
pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_type = v.into();
self
}
/// Sets the value of [pruning_stats][crate::model::TableMetadataCacheUsage::pruning_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::PruningStats;
/// let x = TableMetadataCacheUsage::new().set_pruning_stats(PruningStats::default()/* use setters */);
/// ```
pub fn set_pruning_stats<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PruningStats>,
{
self.pruning_stats = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pruning_stats][crate::model::TableMetadataCacheUsage::pruning_stats].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// use google_cloud_bigquery_v2::model::PruningStats;
/// let x = TableMetadataCacheUsage::new().set_or_clear_pruning_stats(Some(PruningStats::default()/* use setters */));
/// let x = TableMetadataCacheUsage::new().set_or_clear_pruning_stats(None::<PruningStats>);
/// ```
pub fn set_or_clear_pruning_stats<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PruningStats>,
{
self.pruning_stats = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableMetadataCacheUsage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableMetadataCacheUsage"
}
}
/// Defines additional types related to [TableMetadataCacheUsage].
pub mod table_metadata_cache_usage {
#[allow(unused_imports)]
use super::*;
/// Reasons for not using metadata caching.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UnusedReason {
/// Unused reasons not specified.
Unspecified,
/// Metadata cache was outside the table's maxStaleness.
ExceededMaxStaleness,
/// Metadata caching feature is not enabled. [Update BigLake tables]
/// (/bigquery/docs/create-cloud-storage-table-biglake#update-biglake-tables)
/// to enable the metadata caching.
MetadataCachingNotEnabled,
/// Other unknown reason.
OtherReason,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [UnusedReason::value] or
/// [UnusedReason::name].
UnknownValue(unused_reason::UnknownValue),
}
#[doc(hidden)]
pub mod unused_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UnusedReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ExceededMaxStaleness => std::option::Option::Some(1),
Self::MetadataCachingNotEnabled => std::option::Option::Some(3),
Self::OtherReason => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("UNUSED_REASON_UNSPECIFIED"),
Self::ExceededMaxStaleness => std::option::Option::Some("EXCEEDED_MAX_STALENESS"),
Self::MetadataCachingNotEnabled => {
std::option::Option::Some("METADATA_CACHING_NOT_ENABLED")
}
Self::OtherReason => std::option::Option::Some("OTHER_REASON"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UnusedReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UnusedReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for UnusedReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ExceededMaxStaleness,
2 => Self::OtherReason,
3 => Self::MetadataCachingNotEnabled,
_ => Self::UnknownValue(unused_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UnusedReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UNUSED_REASON_UNSPECIFIED" => Self::Unspecified,
"EXCEEDED_MAX_STALENESS" => Self::ExceededMaxStaleness,
"METADATA_CACHING_NOT_ENABLED" => Self::MetadataCachingNotEnabled,
"OTHER_REASON" => Self::OtherReason,
_ => Self::UnknownValue(unused_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UnusedReason {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ExceededMaxStaleness => serializer.serialize_i32(1),
Self::MetadataCachingNotEnabled => serializer.serialize_i32(3),
Self::OtherReason => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for UnusedReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UnusedReason>::new(
".google.cloud.bigquery.v2.TableMetadataCacheUsage.UnusedReason",
))
}
}
}
/// Statistics for metadata caching in queried tables.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MetadataCacheStatistics {
/// Set for the Metadata caching eligible tables referenced in the query.
pub table_metadata_cache_usage: std::vec::Vec<crate::model::TableMetadataCacheUsage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MetadataCacheStatistics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [table_metadata_cache_usage][crate::model::MetadataCacheStatistics::table_metadata_cache_usage].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MetadataCacheStatistics;
/// use google_cloud_bigquery_v2::model::TableMetadataCacheUsage;
/// let x = MetadataCacheStatistics::new()
/// .set_table_metadata_cache_usage([
/// TableMetadataCacheUsage::default()/* use setters */,
/// TableMetadataCacheUsage::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_table_metadata_cache_usage<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableMetadataCacheUsage>,
{
use std::iter::Iterator;
self.table_metadata_cache_usage = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MetadataCacheStatistics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MetadataCacheStatistics"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JobStatus {
/// Output only. Final error result of the job. If present, indicates that the
/// job has completed and was unsuccessful.
pub error_result: std::option::Option<crate::model::ErrorProto>,
/// Output only. The first errors encountered during the running of the job.
/// The final message includes the number of errors that caused the process to
/// stop. Errors here do not necessarily mean that the job has not completed or
/// was unsuccessful.
pub errors: std::vec::Vec<crate::model::ErrorProto>,
/// Output only. Running state of the job. Valid states include 'PENDING',
/// 'RUNNING', and 'DONE'.
pub state: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JobStatus {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [error_result][crate::model::JobStatus::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = JobStatus::new().set_error_result(ErrorProto::default()/* use setters */);
/// ```
pub fn set_error_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_result][crate::model::JobStatus::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = JobStatus::new().set_or_clear_error_result(Some(ErrorProto::default()/* use setters */));
/// let x = JobStatus::new().set_or_clear_error_result(None::<ErrorProto>);
/// ```
pub fn set_or_clear_error_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = v.map(|x| x.into());
self
}
/// Sets the value of [errors][crate::model::JobStatus::errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = JobStatus::new()
/// .set_errors([
/// ErrorProto::default()/* use setters */,
/// ErrorProto::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ErrorProto>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [state][crate::model::JobStatus::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JobStatus;
/// let x = JobStatus::new().set_state("example");
/// ```
pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for JobStatus {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JobStatus"
}
}
/// BigQuery-specific metadata about a location. This will be set on
/// google.cloud.location.Location.metadata in Cloud Location API
/// responses.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocationMetadata {
/// The legacy BigQuery location ID, e.g. “EU” for the “europe” location.
/// This is for any API consumers that need the legacy “US” and “EU” locations.
pub legacy_location_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [legacy_location_id][crate::model::LocationMetadata::legacy_location_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::LocationMetadata;
/// let x = LocationMetadata::new().set_legacy_location_id("example");
/// ```
pub fn set_legacy_location_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.legacy_location_id = v.into();
self
}
}
impl wkt::message::Message for LocationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.LocationMetadata"
}
}
/// Remote Model Info
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoteModelInfo {
/// Output only. Fully qualified name of the user-provided connection object of
/// the remote model. Format:
/// ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
pub connection: std::string::String,
/// Output only. Max number of rows in each batch sent to the remote service.
/// If unset, the number of rows in each batch is set dynamically.
pub max_batching_rows: i64,
/// Output only. The model version for LLM.
pub remote_model_version: std::string::String,
/// Output only. The name of the speech recognizer to use for speech
/// recognition. The expected format is
/// `projects/{project}/locations/{location}/recognizers/{recognizer}`.
/// Customers can specify this field at model creation. If not specified, a
/// default recognizer `projects/{model
/// project}/locations/global/recognizers/_` will be used. See more details at
/// [recognizers](https://cloud.google.com/speech-to-text/v2/docs/reference/rest/v2/projects.locations.recognizers)
pub speech_recognizer: std::string::String,
/// Remote services are services outside of BigQuery used by remote models for
/// predictions. A remote service is backed by either an arbitrary endpoint or
/// a selected remote service type, but not both.
pub remote_service: std::option::Option<crate::model::remote_model_info::RemoteService>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoteModelInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [connection][crate::model::RemoteModelInfo::connection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = RemoteModelInfo::new().set_connection("example");
/// ```
pub fn set_connection<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection = v.into();
self
}
/// Sets the value of [max_batching_rows][crate::model::RemoteModelInfo::max_batching_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = RemoteModelInfo::new().set_max_batching_rows(42);
/// ```
pub fn set_max_batching_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_batching_rows = v.into();
self
}
/// Sets the value of [remote_model_version][crate::model::RemoteModelInfo::remote_model_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = RemoteModelInfo::new().set_remote_model_version("example");
/// ```
pub fn set_remote_model_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.remote_model_version = v.into();
self
}
/// Sets the value of [speech_recognizer][crate::model::RemoteModelInfo::speech_recognizer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = RemoteModelInfo::new().set_speech_recognizer("example");
/// ```
pub fn set_speech_recognizer<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.speech_recognizer = v.into();
self
}
/// Sets the value of [remote_service][crate::model::RemoteModelInfo::remote_service].
///
/// Note that all the setters affecting `remote_service` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// use google_cloud_bigquery_v2::model::remote_model_info::RemoteService;
/// let x = RemoteModelInfo::new().set_remote_service(Some(RemoteService::Endpoint("example".to_string())));
/// ```
pub fn set_remote_service<
T: std::convert::Into<std::option::Option<crate::model::remote_model_info::RemoteService>>,
>(
mut self,
v: T,
) -> Self {
self.remote_service = v.into();
self
}
/// The value of [remote_service][crate::model::RemoteModelInfo::remote_service]
/// if it holds a `Endpoint`, `None` if the field is not set or
/// holds a different branch.
pub fn endpoint(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.remote_service.as_ref().and_then(|v| match v {
crate::model::remote_model_info::RemoteService::Endpoint(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [remote_service][crate::model::RemoteModelInfo::remote_service]
/// to hold a `Endpoint`.
///
/// Note that all the setters affecting `remote_service` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = RemoteModelInfo::new().set_endpoint("example");
/// assert!(x.endpoint().is_some());
/// assert!(x.remote_service_type().is_none());
/// ```
pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.remote_service = std::option::Option::Some(
crate::model::remote_model_info::RemoteService::Endpoint(v.into()),
);
self
}
/// The value of [remote_service][crate::model::RemoteModelInfo::remote_service]
/// if it holds a `RemoteServiceType`, `None` if the field is not set or
/// holds a different branch.
pub fn remote_service_type(
&self,
) -> std::option::Option<&crate::model::remote_model_info::RemoteServiceType> {
#[allow(unreachable_patterns)]
self.remote_service.as_ref().and_then(|v| match v {
crate::model::remote_model_info::RemoteService::RemoteServiceType(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [remote_service][crate::model::RemoteModelInfo::remote_service]
/// to hold a `RemoteServiceType`.
///
/// Note that all the setters affecting `remote_service` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// use google_cloud_bigquery_v2::model::remote_model_info::RemoteServiceType;
/// let x0 = RemoteModelInfo::new().set_remote_service_type(RemoteServiceType::CloudAiTranslateV3);
/// let x1 = RemoteModelInfo::new().set_remote_service_type(RemoteServiceType::CloudAiVisionV1);
/// let x2 = RemoteModelInfo::new().set_remote_service_type(RemoteServiceType::CloudAiNaturalLanguageV1);
/// assert!(x0.remote_service_type().is_some());
/// assert!(x0.endpoint().is_none());
/// assert!(x1.remote_service_type().is_some());
/// assert!(x1.endpoint().is_none());
/// assert!(x2.remote_service_type().is_some());
/// assert!(x2.endpoint().is_none());
/// ```
pub fn set_remote_service_type<
T: std::convert::Into<crate::model::remote_model_info::RemoteServiceType>,
>(
mut self,
v: T,
) -> Self {
self.remote_service = std::option::Option::Some(
crate::model::remote_model_info::RemoteService::RemoteServiceType(v.into()),
);
self
}
}
impl wkt::message::Message for RemoteModelInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RemoteModelInfo"
}
}
/// Defines additional types related to [RemoteModelInfo].
pub mod remote_model_info {
#[allow(unused_imports)]
use super::*;
/// Supported service type for remote model.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RemoteServiceType {
/// Unspecified remote service type.
Unspecified,
/// V3 Cloud AI Translation API. See more details at [Cloud Translation API]
/// (<https://cloud.google.com/translate/docs/reference/rest>).
CloudAiTranslateV3,
/// V1 Cloud AI Vision API See more details at [Cloud Vision API]
/// (<https://cloud.google.com/vision/docs/reference/rest>).
CloudAiVisionV1,
/// V1 Cloud AI Natural Language API. See more details at [REST Resource:
/// documents](https://cloud.google.com/natural-language/docs/reference/rest/v1/documents).
CloudAiNaturalLanguageV1,
/// V2 Speech-to-Text API. See more details at [Google Cloud Speech-to-Text
/// V2 API](https://cloud.google.com/speech-to-text/v2/docs)
CloudAiSpeechToTextV2,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RemoteServiceType::value] or
/// [RemoteServiceType::name].
UnknownValue(remote_service_type::UnknownValue),
}
#[doc(hidden)]
pub mod remote_service_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RemoteServiceType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::CloudAiTranslateV3 => std::option::Option::Some(1),
Self::CloudAiVisionV1 => std::option::Option::Some(2),
Self::CloudAiNaturalLanguageV1 => std::option::Option::Some(3),
Self::CloudAiSpeechToTextV2 => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("REMOTE_SERVICE_TYPE_UNSPECIFIED"),
Self::CloudAiTranslateV3 => std::option::Option::Some("CLOUD_AI_TRANSLATE_V3"),
Self::CloudAiVisionV1 => std::option::Option::Some("CLOUD_AI_VISION_V1"),
Self::CloudAiNaturalLanguageV1 => {
std::option::Option::Some("CLOUD_AI_NATURAL_LANGUAGE_V1")
}
Self::CloudAiSpeechToTextV2 => {
std::option::Option::Some("CLOUD_AI_SPEECH_TO_TEXT_V2")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RemoteServiceType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RemoteServiceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RemoteServiceType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::CloudAiTranslateV3,
2 => Self::CloudAiVisionV1,
3 => Self::CloudAiNaturalLanguageV1,
7 => Self::CloudAiSpeechToTextV2,
_ => Self::UnknownValue(remote_service_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RemoteServiceType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"REMOTE_SERVICE_TYPE_UNSPECIFIED" => Self::Unspecified,
"CLOUD_AI_TRANSLATE_V3" => Self::CloudAiTranslateV3,
"CLOUD_AI_VISION_V1" => Self::CloudAiVisionV1,
"CLOUD_AI_NATURAL_LANGUAGE_V1" => Self::CloudAiNaturalLanguageV1,
"CLOUD_AI_SPEECH_TO_TEXT_V2" => Self::CloudAiSpeechToTextV2,
_ => Self::UnknownValue(remote_service_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RemoteServiceType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::CloudAiTranslateV3 => serializer.serialize_i32(1),
Self::CloudAiVisionV1 => serializer.serialize_i32(2),
Self::CloudAiNaturalLanguageV1 => serializer.serialize_i32(3),
Self::CloudAiSpeechToTextV2 => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RemoteServiceType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemoteServiceType>::new(
".google.cloud.bigquery.v2.RemoteModelInfo.RemoteServiceType",
))
}
}
/// Remote services are services outside of BigQuery used by remote models for
/// predictions. A remote service is backed by either an arbitrary endpoint or
/// a selected remote service type, but not both.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RemoteService {
/// Output only. The endpoint for remote model.
Endpoint(std::string::String),
/// Output only. The remote service type for remote model.
RemoteServiceType(crate::model::remote_model_info::RemoteServiceType),
}
}
/// Information about a single transform column.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransformColumn {
/// Output only. Name of the column.
pub name: std::string::String,
/// Output only. Data type of the column after the transform.
pub r#type: std::option::Option<crate::model::StandardSqlDataType>,
/// Output only. The SQL expression used in the column transform.
pub transform_sql: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TransformColumn {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::TransformColumn::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TransformColumn;
/// let x = TransformColumn::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [r#type][crate::model::TransformColumn::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TransformColumn;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = TransformColumn::new().set_type(StandardSqlDataType::default()/* use setters */);
/// ```
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.r#type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [r#type][crate::model::TransformColumn::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TransformColumn;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = TransformColumn::new().set_or_clear_type(Some(StandardSqlDataType::default()/* use setters */));
/// let x = TransformColumn::new().set_or_clear_type(None::<StandardSqlDataType>);
/// ```
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.r#type = v.map(|x| x.into());
self
}
/// Sets the value of [transform_sql][crate::model::TransformColumn::transform_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TransformColumn;
/// let x = TransformColumn::new().set_transform_sql("example");
/// ```
pub fn set_transform_sql<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.transform_sql = v.into();
self
}
}
impl wkt::message::Message for TransformColumn {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TransformColumn"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Model {
/// Output only. A hash of this resource.
pub etag: std::string::String,
/// Required. Unique identifier for this model.
pub model_reference: std::option::Option<crate::model::ModelReference>,
/// Output only. The time when this model was created, in millisecs since the
/// epoch.
pub creation_time: i64,
/// Output only. The time when this model was last modified, in millisecs since
/// the epoch.
pub last_modified_time: i64,
/// Optional. A user-friendly description of this model.
pub description: std::string::String,
/// Optional. A descriptive name for this model.
pub friendly_name: std::string::String,
/// The labels associated with this model. You can use these to organize
/// and group your models. Label keys and values can be no longer
/// than 63 characters, can only contain lowercase letters, numeric
/// characters, underscores and dashes. International characters are allowed.
/// Label values are optional. Label keys must start with a letter and each
/// label in the list must have a different key.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. The time when this model expires, in milliseconds since the
/// epoch. If not present, the model will persist indefinitely. Expired models
/// will be deleted and their storage reclaimed. The defaultTableExpirationMs
/// property of the encapsulating dataset can be used to set a default
/// expirationTime on newly created models.
pub expiration_time: i64,
/// Output only. The geographic location where the model resides. This value
/// is inherited from the dataset.
pub location: std::string::String,
/// Custom encryption configuration (e.g., Cloud KMS keys). This shows the
/// encryption configuration of the model data while stored in BigQuery
/// storage. This field can be used with PatchModel to update encryption key
/// for an already encrypted model.
pub encryption_configuration: std::option::Option<crate::model::EncryptionConfiguration>,
/// Output only. Type of the model resource.
pub model_type: crate::model::model::ModelType,
/// Information for all training runs in increasing order of start_time.
pub training_runs: std::vec::Vec<crate::model::model::TrainingRun>,
/// Output only. Input feature columns for the model inference. If the model is
/// trained with TRANSFORM clause, these are the input of the TRANSFORM clause.
pub feature_columns: std::vec::Vec<crate::model::StandardSqlField>,
/// Output only. Label columns that were used to train this model.
/// The output of the model will have a "predicted_" prefix to these columns.
pub label_columns: std::vec::Vec<crate::model::StandardSqlField>,
/// Output only. This field will be populated if a TRANSFORM clause was used to
/// train a model. TRANSFORM clause (if used) takes feature_columns as input
/// and outputs transform_columns. transform_columns then are used to train the
/// model.
pub transform_columns: std::vec::Vec<crate::model::TransformColumn>,
/// Output only. All hyperparameter search spaces in this model.
pub hparam_search_spaces: std::option::Option<crate::model::model::HparamSearchSpaces>,
/// Output only. The default trial_id to use in TVFs when the trial_id is not
/// passed in. For single-objective [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// models, this is the best trial ID. For multi-objective [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// models, this is the smallest trial ID among all Pareto optimal trials.
pub default_trial_id: i64,
/// Output only. Trials of a [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// model sorted by trial_id.
pub hparam_trials: std::vec::Vec<crate::model::model::HparamTuningTrial>,
/// Output only. For single-objective [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// models, it only contains the best trial. For multi-objective
/// [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// models, it contains all Pareto optimal trials sorted by trial_id.
pub optimal_trial_ids: std::vec::Vec<i64>,
/// Output only. Remote model info
pub remote_model_info: std::option::Option<crate::model::RemoteModelInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Model {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [etag][crate::model::Model::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [model_reference][crate::model::Model::model_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::ModelReference;
/// let x = Model::new().set_model_reference(ModelReference::default()/* use setters */);
/// ```
pub fn set_model_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ModelReference>,
{
self.model_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_reference][crate::model::Model::model_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::ModelReference;
/// let x = Model::new().set_or_clear_model_reference(Some(ModelReference::default()/* use setters */));
/// let x = Model::new().set_or_clear_model_reference(None::<ModelReference>);
/// ```
pub fn set_or_clear_model_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ModelReference>,
{
self.model_reference = v.map(|x| x.into());
self
}
/// Sets the value of [creation_time][crate::model::Model::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [last_modified_time][crate::model::Model::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_last_modified_time(42);
/// ```
pub fn set_last_modified_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.last_modified_time = v.into();
self
}
/// Sets the value of [description][crate::model::Model::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [friendly_name][crate::model::Model::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_friendly_name("example");
/// ```
pub fn set_friendly_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.friendly_name = v.into();
self
}
/// Sets the value of [labels][crate::model::Model::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [expiration_time][crate::model::Model::expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_expiration_time(42);
/// ```
pub fn set_expiration_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.expiration_time = v.into();
self
}
/// Sets the value of [location][crate::model::Model::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [encryption_configuration][crate::model::Model::encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Model::new().set_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [encryption_configuration][crate::model::Model::encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Model::new().set_or_clear_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = Model::new().set_or_clear_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_encryption_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [model_type][crate::model::Model::model_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::model::ModelType;
/// let x0 = Model::new().set_model_type(ModelType::LinearRegression);
/// let x1 = Model::new().set_model_type(ModelType::LogisticRegression);
/// let x2 = Model::new().set_model_type(ModelType::Kmeans);
/// ```
pub fn set_model_type<T: std::convert::Into<crate::model::model::ModelType>>(
mut self,
v: T,
) -> Self {
self.model_type = v.into();
self
}
/// Sets the value of [training_runs][crate::model::Model::training_runs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::model::TrainingRun;
/// let x = Model::new()
/// .set_training_runs([
/// TrainingRun::default()/* use setters */,
/// TrainingRun::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_training_runs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::TrainingRun>,
{
use std::iter::Iterator;
self.training_runs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [feature_columns][crate::model::Model::feature_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::StandardSqlField;
/// let x = Model::new()
/// .set_feature_columns([
/// StandardSqlField::default()/* use setters */,
/// StandardSqlField::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_feature_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StandardSqlField>,
{
use std::iter::Iterator;
self.feature_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [label_columns][crate::model::Model::label_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::StandardSqlField;
/// let x = Model::new()
/// .set_label_columns([
/// StandardSqlField::default()/* use setters */,
/// StandardSqlField::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_label_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StandardSqlField>,
{
use std::iter::Iterator;
self.label_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [transform_columns][crate::model::Model::transform_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::TransformColumn;
/// let x = Model::new()
/// .set_transform_columns([
/// TransformColumn::default()/* use setters */,
/// TransformColumn::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_transform_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TransformColumn>,
{
use std::iter::Iterator;
self.transform_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [hparam_search_spaces][crate::model::Model::hparam_search_spaces].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// let x = Model::new().set_hparam_search_spaces(HparamSearchSpaces::default()/* use setters */);
/// ```
pub fn set_hparam_search_spaces<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::HparamSearchSpaces>,
{
self.hparam_search_spaces = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hparam_search_spaces][crate::model::Model::hparam_search_spaces].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// let x = Model::new().set_or_clear_hparam_search_spaces(Some(HparamSearchSpaces::default()/* use setters */));
/// let x = Model::new().set_or_clear_hparam_search_spaces(None::<HparamSearchSpaces>);
/// ```
pub fn set_or_clear_hparam_search_spaces<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::HparamSearchSpaces>,
{
self.hparam_search_spaces = v.map(|x| x.into());
self
}
/// Sets the value of [default_trial_id][crate::model::Model::default_trial_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_default_trial_id(42);
/// ```
pub fn set_default_trial_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.default_trial_id = v.into();
self
}
/// Sets the value of [hparam_trials][crate::model::Model::hparam_trials].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = Model::new()
/// .set_hparam_trials([
/// HparamTuningTrial::default()/* use setters */,
/// HparamTuningTrial::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_hparam_trials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::HparamTuningTrial>,
{
use std::iter::Iterator;
self.hparam_trials = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [optimal_trial_ids][crate::model::Model::optimal_trial_ids].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// let x = Model::new().set_optimal_trial_ids([1, 2, 3]);
/// ```
pub fn set_optimal_trial_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i64>,
{
use std::iter::Iterator;
self.optimal_trial_ids = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [remote_model_info][crate::model::Model::remote_model_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = Model::new().set_remote_model_info(RemoteModelInfo::default()/* use setters */);
/// ```
pub fn set_remote_model_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RemoteModelInfo>,
{
self.remote_model_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [remote_model_info][crate::model::Model::remote_model_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Model;
/// use google_cloud_bigquery_v2::model::RemoteModelInfo;
/// let x = Model::new().set_or_clear_remote_model_info(Some(RemoteModelInfo::default()/* use setters */));
/// let x = Model::new().set_or_clear_remote_model_info(None::<RemoteModelInfo>);
/// ```
pub fn set_or_clear_remote_model_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RemoteModelInfo>,
{
self.remote_model_info = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Model {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model"
}
}
/// Defines additional types related to [Model].
pub mod model {
#[allow(unused_imports)]
use super::*;
/// Enums for seasonal period.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SeasonalPeriod {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SeasonalPeriod {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SeasonalPeriod {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.SeasonalPeriod"
}
}
/// Defines additional types related to [SeasonalPeriod].
pub mod seasonal_period {
#[allow(unused_imports)]
use super::*;
/// Seasonal period type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SeasonalPeriodType {
/// Unspecified seasonal period.
Unspecified,
/// No seasonality
NoSeasonality,
/// Daily period, 24 hours.
Daily,
/// Weekly period, 7 days.
Weekly,
/// Monthly period, 30 days or irregular.
Monthly,
/// Quarterly period, 90 days or irregular.
Quarterly,
/// Yearly period, 365 days or irregular.
Yearly,
/// Hourly period, 1 hour.
Hourly,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SeasonalPeriodType::value] or
/// [SeasonalPeriodType::name].
UnknownValue(seasonal_period_type::UnknownValue),
}
#[doc(hidden)]
pub mod seasonal_period_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SeasonalPeriodType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NoSeasonality => std::option::Option::Some(1),
Self::Daily => std::option::Option::Some(2),
Self::Weekly => std::option::Option::Some(3),
Self::Monthly => std::option::Option::Some(4),
Self::Quarterly => std::option::Option::Some(5),
Self::Yearly => std::option::Option::Some(6),
Self::Hourly => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("SEASONAL_PERIOD_TYPE_UNSPECIFIED")
}
Self::NoSeasonality => std::option::Option::Some("NO_SEASONALITY"),
Self::Daily => std::option::Option::Some("DAILY"),
Self::Weekly => std::option::Option::Some("WEEKLY"),
Self::Monthly => std::option::Option::Some("MONTHLY"),
Self::Quarterly => std::option::Option::Some("QUARTERLY"),
Self::Yearly => std::option::Option::Some("YEARLY"),
Self::Hourly => std::option::Option::Some("HOURLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SeasonalPeriodType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SeasonalPeriodType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SeasonalPeriodType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NoSeasonality,
2 => Self::Daily,
3 => Self::Weekly,
4 => Self::Monthly,
5 => Self::Quarterly,
6 => Self::Yearly,
7 => Self::Hourly,
_ => Self::UnknownValue(seasonal_period_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SeasonalPeriodType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEASONAL_PERIOD_TYPE_UNSPECIFIED" => Self::Unspecified,
"NO_SEASONALITY" => Self::NoSeasonality,
"DAILY" => Self::Daily,
"WEEKLY" => Self::Weekly,
"MONTHLY" => Self::Monthly,
"QUARTERLY" => Self::Quarterly,
"YEARLY" => Self::Yearly,
"HOURLY" => Self::Hourly,
_ => Self::UnknownValue(seasonal_period_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SeasonalPeriodType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NoSeasonality => serializer.serialize_i32(1),
Self::Daily => serializer.serialize_i32(2),
Self::Weekly => serializer.serialize_i32(3),
Self::Monthly => serializer.serialize_i32(4),
Self::Quarterly => serializer.serialize_i32(5),
Self::Yearly => serializer.serialize_i32(6),
Self::Hourly => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SeasonalPeriodType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SeasonalPeriodType>::new(
".google.cloud.bigquery.v2.Model.SeasonalPeriod.SeasonalPeriodType",
))
}
}
}
/// Enums for kmeans model type.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KmeansEnums {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl KmeansEnums {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for KmeansEnums {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.KmeansEnums"
}
}
/// Defines additional types related to [KmeansEnums].
pub mod kmeans_enums {
#[allow(unused_imports)]
use super::*;
/// Indicates the method used to initialize the centroids for KMeans
/// clustering algorithm.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum KmeansInitializationMethod {
/// Unspecified initialization method.
Unspecified,
/// Initializes the centroids randomly.
Random,
/// Initializes the centroids using data specified in
/// kmeans_initialization_column.
Custom,
/// Initializes with kmeans++.
KmeansPlusPlus,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [KmeansInitializationMethod::value] or
/// [KmeansInitializationMethod::name].
UnknownValue(kmeans_initialization_method::UnknownValue),
}
#[doc(hidden)]
pub mod kmeans_initialization_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl KmeansInitializationMethod {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Random => std::option::Option::Some(1),
Self::Custom => std::option::Option::Some(2),
Self::KmeansPlusPlus => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("KMEANS_INITIALIZATION_METHOD_UNSPECIFIED")
}
Self::Random => std::option::Option::Some("RANDOM"),
Self::Custom => std::option::Option::Some("CUSTOM"),
Self::KmeansPlusPlus => std::option::Option::Some("KMEANS_PLUS_PLUS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for KmeansInitializationMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for KmeansInitializationMethod {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for KmeansInitializationMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Random,
2 => Self::Custom,
3 => Self::KmeansPlusPlus,
_ => Self::UnknownValue(kmeans_initialization_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for KmeansInitializationMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KMEANS_INITIALIZATION_METHOD_UNSPECIFIED" => Self::Unspecified,
"RANDOM" => Self::Random,
"CUSTOM" => Self::Custom,
"KMEANS_PLUS_PLUS" => Self::KmeansPlusPlus,
_ => Self::UnknownValue(kmeans_initialization_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for KmeansInitializationMethod {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Random => serializer.serialize_i32(1),
Self::Custom => serializer.serialize_i32(2),
Self::KmeansPlusPlus => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for KmeansInitializationMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<KmeansInitializationMethod>::new(
".google.cloud.bigquery.v2.Model.KmeansEnums.KmeansInitializationMethod",
),
)
}
}
}
/// Enums for XGBoost model type.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostedTreeOptionEnums {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BoostedTreeOptionEnums {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for BoostedTreeOptionEnums {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.BoostedTreeOptionEnums"
}
}
/// Defines additional types related to [BoostedTreeOptionEnums].
pub mod boosted_tree_option_enums {
#[allow(unused_imports)]
use super::*;
/// Booster types supported. Refer to booster parameter in XGBoost.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum BoosterType {
/// Unspecified booster type.
Unspecified,
/// Gbtree booster.
Gbtree,
/// Dart booster.
Dart,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [BoosterType::value] or
/// [BoosterType::name].
UnknownValue(booster_type::UnknownValue),
}
#[doc(hidden)]
pub mod booster_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl BoosterType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gbtree => std::option::Option::Some(1),
Self::Dart => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("BOOSTER_TYPE_UNSPECIFIED"),
Self::Gbtree => std::option::Option::Some("GBTREE"),
Self::Dart => std::option::Option::Some("DART"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for BoosterType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for BoosterType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for BoosterType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gbtree,
2 => Self::Dart,
_ => Self::UnknownValue(booster_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for BoosterType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"BOOSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
"GBTREE" => Self::Gbtree,
"DART" => Self::Dart,
_ => Self::UnknownValue(booster_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for BoosterType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Gbtree => serializer.serialize_i32(1),
Self::Dart => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for BoosterType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<BoosterType>::new(
".google.cloud.bigquery.v2.Model.BoostedTreeOptionEnums.BoosterType",
))
}
}
/// Type of normalization algorithm for boosted tree models using dart
/// booster. Refer to normalize_type in XGBoost.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DartNormalizeType {
/// Unspecified dart normalize type.
Unspecified,
/// New trees have the same weight of each of dropped trees.
Tree,
/// New trees have the same weight of sum of dropped trees.
Forest,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DartNormalizeType::value] or
/// [DartNormalizeType::name].
UnknownValue(dart_normalize_type::UnknownValue),
}
#[doc(hidden)]
pub mod dart_normalize_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DartNormalizeType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Tree => std::option::Option::Some(1),
Self::Forest => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("DART_NORMALIZE_TYPE_UNSPECIFIED")
}
Self::Tree => std::option::Option::Some("TREE"),
Self::Forest => std::option::Option::Some("FOREST"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DartNormalizeType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DartNormalizeType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DartNormalizeType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Tree,
2 => Self::Forest,
_ => Self::UnknownValue(dart_normalize_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DartNormalizeType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DART_NORMALIZE_TYPE_UNSPECIFIED" => Self::Unspecified,
"TREE" => Self::Tree,
"FOREST" => Self::Forest,
_ => Self::UnknownValue(dart_normalize_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DartNormalizeType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Tree => serializer.serialize_i32(1),
Self::Forest => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DartNormalizeType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DartNormalizeType>::new(
".google.cloud.bigquery.v2.Model.BoostedTreeOptionEnums.DartNormalizeType",
))
}
}
/// Tree construction algorithm used in boosted tree models.
/// Refer to tree_method in XGBoost.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TreeMethod {
/// Unspecified tree method.
Unspecified,
/// Use heuristic to choose the fastest method.
Auto,
/// Exact greedy algorithm.
Exact,
/// Approximate greedy algorithm using quantile sketch and gradient
/// histogram.
Approx,
/// Fast histogram optimized approximate greedy algorithm.
Hist,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TreeMethod::value] or
/// [TreeMethod::name].
UnknownValue(tree_method::UnknownValue),
}
#[doc(hidden)]
pub mod tree_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TreeMethod {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Auto => std::option::Option::Some(1),
Self::Exact => std::option::Option::Some(2),
Self::Approx => std::option::Option::Some(3),
Self::Hist => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TREE_METHOD_UNSPECIFIED"),
Self::Auto => std::option::Option::Some("AUTO"),
Self::Exact => std::option::Option::Some("EXACT"),
Self::Approx => std::option::Option::Some("APPROX"),
Self::Hist => std::option::Option::Some("HIST"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TreeMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TreeMethod {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TreeMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Auto,
2 => Self::Exact,
3 => Self::Approx,
4 => Self::Hist,
_ => Self::UnknownValue(tree_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TreeMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TREE_METHOD_UNSPECIFIED" => Self::Unspecified,
"AUTO" => Self::Auto,
"EXACT" => Self::Exact,
"APPROX" => Self::Approx,
"HIST" => Self::Hist,
_ => Self::UnknownValue(tree_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TreeMethod {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Auto => serializer.serialize_i32(1),
Self::Exact => serializer.serialize_i32(2),
Self::Approx => serializer.serialize_i32(3),
Self::Hist => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TreeMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TreeMethod>::new(
".google.cloud.bigquery.v2.Model.BoostedTreeOptionEnums.TreeMethod",
))
}
}
}
/// Enums for hyperparameter tuning.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HparamTuningEnums {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HparamTuningEnums {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for HparamTuningEnums {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.HparamTuningEnums"
}
}
/// Defines additional types related to [HparamTuningEnums].
pub mod hparam_tuning_enums {
#[allow(unused_imports)]
use super::*;
/// Available evaluation metrics used as hyperparameter tuning objectives.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HparamTuningObjective {
/// Unspecified evaluation metric.
Unspecified,
/// Mean absolute error.
/// mean_absolute_error = AVG(ABS(label - predicted))
MeanAbsoluteError,
/// Mean squared error.
/// mean_squared_error = AVG(POW(label - predicted, 2))
MeanSquaredError,
/// Mean squared log error.
/// mean_squared_log_error = AVG(POW(LN(1 + label) - LN(1 + predicted), 2))
MeanSquaredLogError,
/// Mean absolute error.
/// median_absolute_error = APPROX_QUANTILES(absolute_error, 2)[OFFSET(1)]
MedianAbsoluteError,
/// R^2 score. This corresponds to r2_score in ML.EVALUATE.
/// r_squared = 1 - SUM(squared_error)/(COUNT(label)*VAR_POP(label))
RSquared,
/// Explained variance.
/// explained_variance = 1 - VAR_POP(label_error)/VAR_POP(label)
ExplainedVariance,
/// Precision is the fraction of actual positive predictions that had
/// positive actual labels. For multiclass this is a macro-averaged metric
/// treating each class as a binary classifier.
Precision,
/// Recall is the fraction of actual positive labels that were given a
/// positive prediction. For multiclass this is a macro-averaged metric.
Recall,
/// Accuracy is the fraction of predictions given the correct label. For
/// multiclass this is a globally micro-averaged metric.
Accuracy,
/// The F1 score is an average of recall and precision. For multiclass this
/// is a macro-averaged metric.
F1Score,
/// Logarithmic Loss. For multiclass this is a macro-averaged metric.
LogLoss,
/// Area Under an ROC Curve. For multiclass this is a macro-averaged
/// metric.
RocAuc,
/// Davies-Bouldin Index.
DaviesBouldinIndex,
/// Mean Average Precision.
MeanAveragePrecision,
/// Normalized Discounted Cumulative Gain.
NormalizedDiscountedCumulativeGain,
/// Average Rank.
AverageRank,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [HparamTuningObjective::value] or
/// [HparamTuningObjective::name].
UnknownValue(hparam_tuning_objective::UnknownValue),
}
#[doc(hidden)]
pub mod hparam_tuning_objective {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HparamTuningObjective {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::MeanAbsoluteError => std::option::Option::Some(1),
Self::MeanSquaredError => std::option::Option::Some(2),
Self::MeanSquaredLogError => std::option::Option::Some(3),
Self::MedianAbsoluteError => std::option::Option::Some(4),
Self::RSquared => std::option::Option::Some(5),
Self::ExplainedVariance => std::option::Option::Some(6),
Self::Precision => std::option::Option::Some(7),
Self::Recall => std::option::Option::Some(8),
Self::Accuracy => std::option::Option::Some(9),
Self::F1Score => std::option::Option::Some(10),
Self::LogLoss => std::option::Option::Some(11),
Self::RocAuc => std::option::Option::Some(12),
Self::DaviesBouldinIndex => std::option::Option::Some(13),
Self::MeanAveragePrecision => std::option::Option::Some(14),
Self::NormalizedDiscountedCumulativeGain => std::option::Option::Some(15),
Self::AverageRank => std::option::Option::Some(16),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("HPARAM_TUNING_OBJECTIVE_UNSPECIFIED")
}
Self::MeanAbsoluteError => std::option::Option::Some("MEAN_ABSOLUTE_ERROR"),
Self::MeanSquaredError => std::option::Option::Some("MEAN_SQUARED_ERROR"),
Self::MeanSquaredLogError => {
std::option::Option::Some("MEAN_SQUARED_LOG_ERROR")
}
Self::MedianAbsoluteError => std::option::Option::Some("MEDIAN_ABSOLUTE_ERROR"),
Self::RSquared => std::option::Option::Some("R_SQUARED"),
Self::ExplainedVariance => std::option::Option::Some("EXPLAINED_VARIANCE"),
Self::Precision => std::option::Option::Some("PRECISION"),
Self::Recall => std::option::Option::Some("RECALL"),
Self::Accuracy => std::option::Option::Some("ACCURACY"),
Self::F1Score => std::option::Option::Some("F1_SCORE"),
Self::LogLoss => std::option::Option::Some("LOG_LOSS"),
Self::RocAuc => std::option::Option::Some("ROC_AUC"),
Self::DaviesBouldinIndex => std::option::Option::Some("DAVIES_BOULDIN_INDEX"),
Self::MeanAveragePrecision => {
std::option::Option::Some("MEAN_AVERAGE_PRECISION")
}
Self::NormalizedDiscountedCumulativeGain => {
std::option::Option::Some("NORMALIZED_DISCOUNTED_CUMULATIVE_GAIN")
}
Self::AverageRank => std::option::Option::Some("AVERAGE_RANK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HparamTuningObjective {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HparamTuningObjective {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for HparamTuningObjective {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::MeanAbsoluteError,
2 => Self::MeanSquaredError,
3 => Self::MeanSquaredLogError,
4 => Self::MedianAbsoluteError,
5 => Self::RSquared,
6 => Self::ExplainedVariance,
7 => Self::Precision,
8 => Self::Recall,
9 => Self::Accuracy,
10 => Self::F1Score,
11 => Self::LogLoss,
12 => Self::RocAuc,
13 => Self::DaviesBouldinIndex,
14 => Self::MeanAveragePrecision,
15 => Self::NormalizedDiscountedCumulativeGain,
16 => Self::AverageRank,
_ => Self::UnknownValue(hparam_tuning_objective::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HparamTuningObjective {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HPARAM_TUNING_OBJECTIVE_UNSPECIFIED" => Self::Unspecified,
"MEAN_ABSOLUTE_ERROR" => Self::MeanAbsoluteError,
"MEAN_SQUARED_ERROR" => Self::MeanSquaredError,
"MEAN_SQUARED_LOG_ERROR" => Self::MeanSquaredLogError,
"MEDIAN_ABSOLUTE_ERROR" => Self::MedianAbsoluteError,
"R_SQUARED" => Self::RSquared,
"EXPLAINED_VARIANCE" => Self::ExplainedVariance,
"PRECISION" => Self::Precision,
"RECALL" => Self::Recall,
"ACCURACY" => Self::Accuracy,
"F1_SCORE" => Self::F1Score,
"LOG_LOSS" => Self::LogLoss,
"ROC_AUC" => Self::RocAuc,
"DAVIES_BOULDIN_INDEX" => Self::DaviesBouldinIndex,
"MEAN_AVERAGE_PRECISION" => Self::MeanAveragePrecision,
"NORMALIZED_DISCOUNTED_CUMULATIVE_GAIN" => {
Self::NormalizedDiscountedCumulativeGain
}
"AVERAGE_RANK" => Self::AverageRank,
_ => Self::UnknownValue(hparam_tuning_objective::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HparamTuningObjective {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::MeanAbsoluteError => serializer.serialize_i32(1),
Self::MeanSquaredError => serializer.serialize_i32(2),
Self::MeanSquaredLogError => serializer.serialize_i32(3),
Self::MedianAbsoluteError => serializer.serialize_i32(4),
Self::RSquared => serializer.serialize_i32(5),
Self::ExplainedVariance => serializer.serialize_i32(6),
Self::Precision => serializer.serialize_i32(7),
Self::Recall => serializer.serialize_i32(8),
Self::Accuracy => serializer.serialize_i32(9),
Self::F1Score => serializer.serialize_i32(10),
Self::LogLoss => serializer.serialize_i32(11),
Self::RocAuc => serializer.serialize_i32(12),
Self::DaviesBouldinIndex => serializer.serialize_i32(13),
Self::MeanAveragePrecision => serializer.serialize_i32(14),
Self::NormalizedDiscountedCumulativeGain => serializer.serialize_i32(15),
Self::AverageRank => serializer.serialize_i32(16),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HparamTuningObjective {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<HparamTuningObjective>::new(
".google.cloud.bigquery.v2.Model.HparamTuningEnums.HparamTuningObjective",
),
)
}
}
}
/// Evaluation metrics for regression and explicit feedback type matrix
/// factorization models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RegressionMetrics {
/// Mean absolute error.
pub mean_absolute_error: std::option::Option<wkt::DoubleValue>,
/// Mean squared error.
pub mean_squared_error: std::option::Option<wkt::DoubleValue>,
/// Mean squared log error.
pub mean_squared_log_error: std::option::Option<wkt::DoubleValue>,
/// Median absolute error.
pub median_absolute_error: std::option::Option<wkt::DoubleValue>,
/// R^2 score. This corresponds to r2_score in ML.EVALUATE.
pub r_squared: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RegressionMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [mean_absolute_error][crate::model::model::RegressionMetrics::mean_absolute_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_mean_absolute_error(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_absolute_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_absolute_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_absolute_error][crate::model::model::RegressionMetrics::mean_absolute_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_or_clear_mean_absolute_error(Some(DoubleValue::default()/* use setters */));
/// let x = RegressionMetrics::new().set_or_clear_mean_absolute_error(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_absolute_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_absolute_error = v.map(|x| x.into());
self
}
/// Sets the value of [mean_squared_error][crate::model::model::RegressionMetrics::mean_squared_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_mean_squared_error(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_squared_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_squared_error][crate::model::model::RegressionMetrics::mean_squared_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_or_clear_mean_squared_error(Some(DoubleValue::default()/* use setters */));
/// let x = RegressionMetrics::new().set_or_clear_mean_squared_error(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_squared_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_error = v.map(|x| x.into());
self
}
/// Sets the value of [mean_squared_log_error][crate::model::model::RegressionMetrics::mean_squared_log_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_mean_squared_log_error(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_squared_log_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_log_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_squared_log_error][crate::model::model::RegressionMetrics::mean_squared_log_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_or_clear_mean_squared_log_error(Some(DoubleValue::default()/* use setters */));
/// let x = RegressionMetrics::new().set_or_clear_mean_squared_log_error(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_squared_log_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_log_error = v.map(|x| x.into());
self
}
/// Sets the value of [median_absolute_error][crate::model::model::RegressionMetrics::median_absolute_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_median_absolute_error(DoubleValue::default()/* use setters */);
/// ```
pub fn set_median_absolute_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.median_absolute_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [median_absolute_error][crate::model::model::RegressionMetrics::median_absolute_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_or_clear_median_absolute_error(Some(DoubleValue::default()/* use setters */));
/// let x = RegressionMetrics::new().set_or_clear_median_absolute_error(None::<DoubleValue>);
/// ```
pub fn set_or_clear_median_absolute_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.median_absolute_error = v.map(|x| x.into());
self
}
/// Sets the value of [r_squared][crate::model::model::RegressionMetrics::r_squared].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_r_squared(DoubleValue::default()/* use setters */);
/// ```
pub fn set_r_squared<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.r_squared = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [r_squared][crate::model::model::RegressionMetrics::r_squared].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// use wkt::DoubleValue;
/// let x = RegressionMetrics::new().set_or_clear_r_squared(Some(DoubleValue::default()/* use setters */));
/// let x = RegressionMetrics::new().set_or_clear_r_squared(None::<DoubleValue>);
/// ```
pub fn set_or_clear_r_squared<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.r_squared = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RegressionMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.RegressionMetrics"
}
}
/// Aggregate metrics for classification/classifier models. For multi-class
/// models, the metrics are either macro-averaged or micro-averaged. When
/// macro-averaged, the metrics are calculated for each label and then an
/// unweighted average is taken of those values. When micro-averaged, the
/// metric is calculated globally by counting the total number of correctly
/// predicted rows.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AggregateClassificationMetrics {
/// Precision is the fraction of actual positive predictions that had
/// positive actual labels. For multiclass this is a macro-averaged
/// metric treating each class as a binary classifier.
pub precision: std::option::Option<wkt::DoubleValue>,
/// Recall is the fraction of actual positive labels that were given a
/// positive prediction. For multiclass this is a macro-averaged metric.
pub recall: std::option::Option<wkt::DoubleValue>,
/// Accuracy is the fraction of predictions given the correct label. For
/// multiclass this is a micro-averaged metric.
pub accuracy: std::option::Option<wkt::DoubleValue>,
/// Threshold at which the metrics are computed. For binary
/// classification models this is the positive class threshold.
/// For multi-class classification models this is the confidence
/// threshold.
pub threshold: std::option::Option<wkt::DoubleValue>,
/// The F1 score is an average of recall and precision. For multiclass
/// this is a macro-averaged metric.
pub f1_score: std::option::Option<wkt::DoubleValue>,
/// Logarithmic Loss. For multiclass this is a macro-averaged metric.
pub log_loss: std::option::Option<wkt::DoubleValue>,
/// Area Under a ROC Curve. For multiclass this is a macro-averaged
/// metric.
pub roc_auc: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AggregateClassificationMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [precision][crate::model::model::AggregateClassificationMetrics::precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_precision(DoubleValue::default()/* use setters */);
/// ```
pub fn set_precision<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.precision = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [precision][crate::model::model::AggregateClassificationMetrics::precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_precision(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_precision(None::<DoubleValue>);
/// ```
pub fn set_or_clear_precision<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.precision = v.map(|x| x.into());
self
}
/// Sets the value of [recall][crate::model::model::AggregateClassificationMetrics::recall].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_recall(DoubleValue::default()/* use setters */);
/// ```
pub fn set_recall<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.recall = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [recall][crate::model::model::AggregateClassificationMetrics::recall].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_recall(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_recall(None::<DoubleValue>);
/// ```
pub fn set_or_clear_recall<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.recall = v.map(|x| x.into());
self
}
/// Sets the value of [accuracy][crate::model::model::AggregateClassificationMetrics::accuracy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_accuracy(DoubleValue::default()/* use setters */);
/// ```
pub fn set_accuracy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.accuracy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [accuracy][crate::model::model::AggregateClassificationMetrics::accuracy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_accuracy(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_accuracy(None::<DoubleValue>);
/// ```
pub fn set_or_clear_accuracy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.accuracy = v.map(|x| x.into());
self
}
/// Sets the value of [threshold][crate::model::model::AggregateClassificationMetrics::threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_threshold(DoubleValue::default()/* use setters */);
/// ```
pub fn set_threshold<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.threshold = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [threshold][crate::model::model::AggregateClassificationMetrics::threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_threshold(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_threshold(None::<DoubleValue>);
/// ```
pub fn set_or_clear_threshold<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.threshold = v.map(|x| x.into());
self
}
/// Sets the value of [f1_score][crate::model::model::AggregateClassificationMetrics::f1_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_f1_score(DoubleValue::default()/* use setters */);
/// ```
pub fn set_f1_score<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.f1_score = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [f1_score][crate::model::model::AggregateClassificationMetrics::f1_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_f1_score(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_f1_score(None::<DoubleValue>);
/// ```
pub fn set_or_clear_f1_score<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.f1_score = v.map(|x| x.into());
self
}
/// Sets the value of [log_loss][crate::model::model::AggregateClassificationMetrics::log_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_log_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_log_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.log_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [log_loss][crate::model::model::AggregateClassificationMetrics::log_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_log_loss(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_log_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_log_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.log_loss = v.map(|x| x.into());
self
}
/// Sets the value of [roc_auc][crate::model::model::AggregateClassificationMetrics::roc_auc].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_roc_auc(DoubleValue::default()/* use setters */);
/// ```
pub fn set_roc_auc<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.roc_auc = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [roc_auc][crate::model::model::AggregateClassificationMetrics::roc_auc].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// use wkt::DoubleValue;
/// let x = AggregateClassificationMetrics::new().set_or_clear_roc_auc(Some(DoubleValue::default()/* use setters */));
/// let x = AggregateClassificationMetrics::new().set_or_clear_roc_auc(None::<DoubleValue>);
/// ```
pub fn set_or_clear_roc_auc<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.roc_auc = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AggregateClassificationMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.AggregateClassificationMetrics"
}
}
/// Evaluation metrics for binary classification/classifier models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BinaryClassificationMetrics {
/// Aggregate classification metrics.
pub aggregate_classification_metrics:
std::option::Option<crate::model::model::AggregateClassificationMetrics>,
/// Binary confusion matrix at multiple thresholds.
pub binary_confusion_matrix_list: std::vec::Vec<
crate::model::model::binary_classification_metrics::BinaryConfusionMatrix,
>,
/// Label representing the positive class.
pub positive_label: std::string::String,
/// Label representing the negative class.
pub negative_label: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BinaryClassificationMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [aggregate_classification_metrics][crate::model::model::BinaryClassificationMetrics::aggregate_classification_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// let x = BinaryClassificationMetrics::new().set_aggregate_classification_metrics(AggregateClassificationMetrics::default()/* use setters */);
/// ```
pub fn set_aggregate_classification_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::AggregateClassificationMetrics>,
{
self.aggregate_classification_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [aggregate_classification_metrics][crate::model::model::BinaryClassificationMetrics::aggregate_classification_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// let x = BinaryClassificationMetrics::new().set_or_clear_aggregate_classification_metrics(Some(AggregateClassificationMetrics::default()/* use setters */));
/// let x = BinaryClassificationMetrics::new().set_or_clear_aggregate_classification_metrics(None::<AggregateClassificationMetrics>);
/// ```
pub fn set_or_clear_aggregate_classification_metrics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::AggregateClassificationMetrics>,
{
self.aggregate_classification_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [binary_confusion_matrix_list][crate::model::model::BinaryClassificationMetrics::binary_confusion_matrix_list].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// let x = BinaryClassificationMetrics::new()
/// .set_binary_confusion_matrix_list([
/// BinaryConfusionMatrix::default()/* use setters */,
/// BinaryConfusionMatrix::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_binary_confusion_matrix_list<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::binary_classification_metrics::BinaryConfusionMatrix,
>,
{
use std::iter::Iterator;
self.binary_confusion_matrix_list = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [positive_label][crate::model::model::BinaryClassificationMetrics::positive_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// let x = BinaryClassificationMetrics::new().set_positive_label("example");
/// ```
pub fn set_positive_label<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.positive_label = v.into();
self
}
/// Sets the value of [negative_label][crate::model::model::BinaryClassificationMetrics::negative_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// let x = BinaryClassificationMetrics::new().set_negative_label("example");
/// ```
pub fn set_negative_label<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.negative_label = v.into();
self
}
}
impl wkt::message::Message for BinaryClassificationMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.BinaryClassificationMetrics"
}
}
/// Defines additional types related to [BinaryClassificationMetrics].
pub mod binary_classification_metrics {
#[allow(unused_imports)]
use super::*;
/// Confusion matrix for binary classification models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BinaryConfusionMatrix {
/// Threshold value used when computing each of the following metric.
pub positive_class_threshold: std::option::Option<wkt::DoubleValue>,
/// Number of true samples predicted as true.
pub true_positives: std::option::Option<wkt::Int64Value>,
/// Number of false samples predicted as true.
pub false_positives: std::option::Option<wkt::Int64Value>,
/// Number of true samples predicted as false.
pub true_negatives: std::option::Option<wkt::Int64Value>,
/// Number of false samples predicted as false.
pub false_negatives: std::option::Option<wkt::Int64Value>,
/// The fraction of actual positive predictions that had positive actual
/// labels.
pub precision: std::option::Option<wkt::DoubleValue>,
/// The fraction of actual positive labels that were given a positive
/// prediction.
pub recall: std::option::Option<wkt::DoubleValue>,
/// The equally weighted average of recall and precision.
pub f1_score: std::option::Option<wkt::DoubleValue>,
/// The fraction of predictions given the correct label.
pub accuracy: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BinaryConfusionMatrix {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [positive_class_threshold][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::positive_class_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_positive_class_threshold(DoubleValue::default()/* use setters */);
/// ```
pub fn set_positive_class_threshold<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.positive_class_threshold = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [positive_class_threshold][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::positive_class_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_or_clear_positive_class_threshold(Some(DoubleValue::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_positive_class_threshold(None::<DoubleValue>);
/// ```
pub fn set_or_clear_positive_class_threshold<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.positive_class_threshold = v.map(|x| x.into());
self
}
/// Sets the value of [true_positives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::true_positives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_true_positives(Int64Value::default()/* use setters */);
/// ```
pub fn set_true_positives<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.true_positives = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [true_positives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::true_positives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_or_clear_true_positives(Some(Int64Value::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_true_positives(None::<Int64Value>);
/// ```
pub fn set_or_clear_true_positives<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.true_positives = v.map(|x| x.into());
self
}
/// Sets the value of [false_positives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::false_positives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_false_positives(Int64Value::default()/* use setters */);
/// ```
pub fn set_false_positives<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.false_positives = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [false_positives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::false_positives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_or_clear_false_positives(Some(Int64Value::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_false_positives(None::<Int64Value>);
/// ```
pub fn set_or_clear_false_positives<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.false_positives = v.map(|x| x.into());
self
}
/// Sets the value of [true_negatives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::true_negatives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_true_negatives(Int64Value::default()/* use setters */);
/// ```
pub fn set_true_negatives<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.true_negatives = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [true_negatives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::true_negatives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_or_clear_true_negatives(Some(Int64Value::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_true_negatives(None::<Int64Value>);
/// ```
pub fn set_or_clear_true_negatives<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.true_negatives = v.map(|x| x.into());
self
}
/// Sets the value of [false_negatives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::false_negatives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_false_negatives(Int64Value::default()/* use setters */);
/// ```
pub fn set_false_negatives<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.false_negatives = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [false_negatives][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::false_negatives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::Int64Value;
/// let x = BinaryConfusionMatrix::new().set_or_clear_false_negatives(Some(Int64Value::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_false_negatives(None::<Int64Value>);
/// ```
pub fn set_or_clear_false_negatives<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.false_negatives = v.map(|x| x.into());
self
}
/// Sets the value of [precision][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_precision(DoubleValue::default()/* use setters */);
/// ```
pub fn set_precision<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.precision = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [precision][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_or_clear_precision(Some(DoubleValue::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_precision(None::<DoubleValue>);
/// ```
pub fn set_or_clear_precision<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.precision = v.map(|x| x.into());
self
}
/// Sets the value of [recall][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::recall].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_recall(DoubleValue::default()/* use setters */);
/// ```
pub fn set_recall<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.recall = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [recall][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::recall].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_or_clear_recall(Some(DoubleValue::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_recall(None::<DoubleValue>);
/// ```
pub fn set_or_clear_recall<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.recall = v.map(|x| x.into());
self
}
/// Sets the value of [f1_score][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::f1_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_f1_score(DoubleValue::default()/* use setters */);
/// ```
pub fn set_f1_score<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.f1_score = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [f1_score][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::f1_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_or_clear_f1_score(Some(DoubleValue::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_f1_score(None::<DoubleValue>);
/// ```
pub fn set_or_clear_f1_score<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.f1_score = v.map(|x| x.into());
self
}
/// Sets the value of [accuracy][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::accuracy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_accuracy(DoubleValue::default()/* use setters */);
/// ```
pub fn set_accuracy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.accuracy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [accuracy][crate::model::model::binary_classification_metrics::BinaryConfusionMatrix::accuracy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::binary_classification_metrics::BinaryConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = BinaryConfusionMatrix::new().set_or_clear_accuracy(Some(DoubleValue::default()/* use setters */));
/// let x = BinaryConfusionMatrix::new().set_or_clear_accuracy(None::<DoubleValue>);
/// ```
pub fn set_or_clear_accuracy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.accuracy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BinaryConfusionMatrix {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.BinaryClassificationMetrics.BinaryConfusionMatrix"
}
}
}
/// Evaluation metrics for multi-class classification/classifier models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultiClassClassificationMetrics {
/// Aggregate classification metrics.
pub aggregate_classification_metrics:
std::option::Option<crate::model::model::AggregateClassificationMetrics>,
/// Confusion matrix at different thresholds.
pub confusion_matrix_list:
std::vec::Vec<crate::model::model::multi_class_classification_metrics::ConfusionMatrix>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultiClassClassificationMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [aggregate_classification_metrics][crate::model::model::MultiClassClassificationMetrics::aggregate_classification_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::MultiClassClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// let x = MultiClassClassificationMetrics::new().set_aggregate_classification_metrics(AggregateClassificationMetrics::default()/* use setters */);
/// ```
pub fn set_aggregate_classification_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::AggregateClassificationMetrics>,
{
self.aggregate_classification_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [aggregate_classification_metrics][crate::model::model::MultiClassClassificationMetrics::aggregate_classification_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::MultiClassClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::AggregateClassificationMetrics;
/// let x = MultiClassClassificationMetrics::new().set_or_clear_aggregate_classification_metrics(Some(AggregateClassificationMetrics::default()/* use setters */));
/// let x = MultiClassClassificationMetrics::new().set_or_clear_aggregate_classification_metrics(None::<AggregateClassificationMetrics>);
/// ```
pub fn set_or_clear_aggregate_classification_metrics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::AggregateClassificationMetrics>,
{
self.aggregate_classification_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [confusion_matrix_list][crate::model::model::MultiClassClassificationMetrics::confusion_matrix_list].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::MultiClassClassificationMetrics;
/// use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::ConfusionMatrix;
/// let x = MultiClassClassificationMetrics::new()
/// .set_confusion_matrix_list([
/// ConfusionMatrix::default()/* use setters */,
/// ConfusionMatrix::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_confusion_matrix_list<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::multi_class_classification_metrics::ConfusionMatrix,
>,
{
use std::iter::Iterator;
self.confusion_matrix_list = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MultiClassClassificationMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.MultiClassClassificationMetrics"
}
}
/// Defines additional types related to [MultiClassClassificationMetrics].
pub mod multi_class_classification_metrics {
#[allow(unused_imports)]
use super::*;
/// Confusion matrix for multi-class classification models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConfusionMatrix {
/// Confidence threshold used when computing the entries of the
/// confusion matrix.
pub confidence_threshold: std::option::Option<wkt::DoubleValue>,
/// One row per actual label.
pub rows: std::vec::Vec<
crate::model::model::multi_class_classification_metrics::confusion_matrix::Row,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ConfusionMatrix {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [confidence_threshold][crate::model::model::multi_class_classification_metrics::ConfusionMatrix::confidence_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::ConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = ConfusionMatrix::new().set_confidence_threshold(DoubleValue::default()/* use setters */);
/// ```
pub fn set_confidence_threshold<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.confidence_threshold = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [confidence_threshold][crate::model::model::multi_class_classification_metrics::ConfusionMatrix::confidence_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::ConfusionMatrix;
/// use wkt::DoubleValue;
/// let x = ConfusionMatrix::new().set_or_clear_confidence_threshold(Some(DoubleValue::default()/* use setters */));
/// let x = ConfusionMatrix::new().set_or_clear_confidence_threshold(None::<DoubleValue>);
/// ```
pub fn set_or_clear_confidence_threshold<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.confidence_threshold = v.map(|x| x.into());
self
}
/// Sets the value of [rows][crate::model::model::multi_class_classification_metrics::ConfusionMatrix::rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::ConfusionMatrix;
/// use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Row;
/// let x = ConfusionMatrix::new()
/// .set_rows([
/// Row::default()/* use setters */,
/// Row::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::multi_class_classification_metrics::confusion_matrix::Row>
{
use std::iter::Iterator;
self.rows = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ConfusionMatrix {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.MultiClassClassificationMetrics.ConfusionMatrix"
}
}
/// Defines additional types related to [ConfusionMatrix].
pub mod confusion_matrix {
#[allow(unused_imports)]
use super::*;
/// A single entry in the confusion matrix.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Entry {
/// The predicted label. For confidence_threshold > 0, we will
/// also add an entry indicating the number of items under the
/// confidence threshold.
pub predicted_label: std::string::String,
/// Number of items being predicted as this label.
pub item_count: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Entry {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [predicted_label][crate::model::model::multi_class_classification_metrics::confusion_matrix::Entry::predicted_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Entry;
/// let x = Entry::new().set_predicted_label("example");
/// ```
pub fn set_predicted_label<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.predicted_label = v.into();
self
}
/// Sets the value of [item_count][crate::model::model::multi_class_classification_metrics::confusion_matrix::Entry::item_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Entry;
/// use wkt::Int64Value;
/// let x = Entry::new().set_item_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_item_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.item_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [item_count][crate::model::model::multi_class_classification_metrics::confusion_matrix::Entry::item_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Entry;
/// use wkt::Int64Value;
/// let x = Entry::new().set_or_clear_item_count(Some(Int64Value::default()/* use setters */));
/// let x = Entry::new().set_or_clear_item_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_item_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.item_count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Entry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.MultiClassClassificationMetrics.ConfusionMatrix.Entry"
}
}
/// A single row in the confusion matrix.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Row {
/// The original label of this row.
pub actual_label: std::string::String,
/// Info describing predicted label distribution.
pub entries: std::vec::Vec<crate::model::model::multi_class_classification_metrics::confusion_matrix::Entry>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Row {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [actual_label][crate::model::model::multi_class_classification_metrics::confusion_matrix::Row::actual_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Row;
/// let x = Row::new().set_actual_label("example");
/// ```
pub fn set_actual_label<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.actual_label = v.into();
self
}
/// Sets the value of [entries][crate::model::model::multi_class_classification_metrics::confusion_matrix::Row::entries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Row;
/// use google_cloud_bigquery_v2::model::model::multi_class_classification_metrics::confusion_matrix::Entry;
/// let x = Row::new()
/// .set_entries([
/// Entry::default()/* use setters */,
/// Entry::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::multi_class_classification_metrics::confusion_matrix::Entry>
{
use std::iter::Iterator;
self.entries = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Row {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.MultiClassClassificationMetrics.ConfusionMatrix.Row"
}
}
}
}
/// Evaluation metrics for clustering models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClusteringMetrics {
/// Davies-Bouldin index.
pub davies_bouldin_index: std::option::Option<wkt::DoubleValue>,
/// Mean of squared distances between each sample to its cluster centroid.
pub mean_squared_distance: std::option::Option<wkt::DoubleValue>,
/// Information for all clusters.
pub clusters: std::vec::Vec<crate::model::model::clustering_metrics::Cluster>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ClusteringMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [davies_bouldin_index][crate::model::model::ClusteringMetrics::davies_bouldin_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// use wkt::DoubleValue;
/// let x = ClusteringMetrics::new().set_davies_bouldin_index(DoubleValue::default()/* use setters */);
/// ```
pub fn set_davies_bouldin_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.davies_bouldin_index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [davies_bouldin_index][crate::model::model::ClusteringMetrics::davies_bouldin_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// use wkt::DoubleValue;
/// let x = ClusteringMetrics::new().set_or_clear_davies_bouldin_index(Some(DoubleValue::default()/* use setters */));
/// let x = ClusteringMetrics::new().set_or_clear_davies_bouldin_index(None::<DoubleValue>);
/// ```
pub fn set_or_clear_davies_bouldin_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.davies_bouldin_index = v.map(|x| x.into());
self
}
/// Sets the value of [mean_squared_distance][crate::model::model::ClusteringMetrics::mean_squared_distance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// use wkt::DoubleValue;
/// let x = ClusteringMetrics::new().set_mean_squared_distance(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_squared_distance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_distance = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_squared_distance][crate::model::model::ClusteringMetrics::mean_squared_distance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// use wkt::DoubleValue;
/// let x = ClusteringMetrics::new().set_or_clear_mean_squared_distance(Some(DoubleValue::default()/* use setters */));
/// let x = ClusteringMetrics::new().set_or_clear_mean_squared_distance(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_squared_distance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_distance = v.map(|x| x.into());
self
}
/// Sets the value of [clusters][crate::model::model::ClusteringMetrics::clusters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// use google_cloud_bigquery_v2::model::model::clustering_metrics::Cluster;
/// let x = ClusteringMetrics::new()
/// .set_clusters([
/// Cluster::default()/* use setters */,
/// Cluster::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_clusters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::clustering_metrics::Cluster>,
{
use std::iter::Iterator;
self.clusters = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ClusteringMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ClusteringMetrics"
}
}
/// Defines additional types related to [ClusteringMetrics].
pub mod clustering_metrics {
#[allow(unused_imports)]
use super::*;
/// Message containing the information about one cluster.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Cluster {
/// Centroid id.
pub centroid_id: i64,
/// Values of highly variant features for this cluster.
pub feature_values:
std::vec::Vec<crate::model::model::clustering_metrics::cluster::FeatureValue>,
/// Count of training data rows that were assigned to this cluster.
pub count: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Cluster {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [centroid_id][crate::model::model::clustering_metrics::Cluster::centroid_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::Cluster;
/// let x = Cluster::new().set_centroid_id(42);
/// ```
pub fn set_centroid_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.centroid_id = v.into();
self
}
/// Sets the value of [feature_values][crate::model::model::clustering_metrics::Cluster::feature_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::Cluster;
/// use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::FeatureValue;
/// let x = Cluster::new()
/// .set_feature_values([
/// FeatureValue::default()/* use setters */,
/// FeatureValue::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_feature_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::clustering_metrics::cluster::FeatureValue,
>,
{
use std::iter::Iterator;
self.feature_values = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [count][crate::model::model::clustering_metrics::Cluster::count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::Cluster;
/// use wkt::Int64Value;
/// let x = Cluster::new().set_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [count][crate::model::model::clustering_metrics::Cluster::count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::Cluster;
/// use wkt::Int64Value;
/// let x = Cluster::new().set_or_clear_count(Some(Int64Value::default()/* use setters */));
/// let x = Cluster::new().set_or_clear_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Cluster {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ClusteringMetrics.Cluster"
}
}
/// Defines additional types related to [Cluster].
pub mod cluster {
#[allow(unused_imports)]
use super::*;
/// Representative value of a single feature within the cluster.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FeatureValue {
/// The feature column name.
pub feature_column: std::string::String,
/// Value.
pub value: std::option::Option<
crate::model::model::clustering_metrics::cluster::feature_value::Value,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FeatureValue {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [feature_column][crate::model::model::clustering_metrics::cluster::FeatureValue::feature_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::FeatureValue;
/// let x = FeatureValue::new().set_feature_column("example");
/// ```
pub fn set_feature_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.feature_column = v.into();
self
}
/// Sets the value of [value][crate::model::model::clustering_metrics::cluster::FeatureValue::value].
///
/// Note that all the setters affecting `value` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::FeatureValue;
/// use wkt::DoubleValue;
/// let x = FeatureValue::new().set_value(Some(
/// google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::Value::NumericalValue(DoubleValue::default().into())));
/// ```
pub fn set_value<T: std::convert::Into<std::option::Option<crate::model::model::clustering_metrics::cluster::feature_value::Value>>>(mut self, v: T) -> Self
{
self.value = v.into();
self
}
/// The value of [value][crate::model::model::clustering_metrics::cluster::FeatureValue::value]
/// if it holds a `NumericalValue`, `None` if the field is not set or
/// holds a different branch.
pub fn numerical_value(
&self,
) -> std::option::Option<&std::boxed::Box<wkt::DoubleValue>> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::model::clustering_metrics::cluster::feature_value::Value::NumericalValue(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [value][crate::model::model::clustering_metrics::cluster::FeatureValue::value]
/// to hold a `NumericalValue`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::FeatureValue;
/// use wkt::DoubleValue;
/// let x = FeatureValue::new().set_numerical_value(DoubleValue::default()/* use setters */);
/// assert!(x.numerical_value().is_some());
/// assert!(x.categorical_value().is_none());
/// ```
pub fn set_numerical_value<
T: std::convert::Into<std::boxed::Box<wkt::DoubleValue>>,
>(
mut self,
v: T,
) -> Self {
self.value = std::option::Option::Some(
crate::model::model::clustering_metrics::cluster::feature_value::Value::NumericalValue(
v.into()
)
);
self
}
/// The value of [value][crate::model::model::clustering_metrics::cluster::FeatureValue::value]
/// if it holds a `CategoricalValue`, `None` if the field is not set or
/// holds a different branch.
pub fn categorical_value(&self) -> std::option::Option<&std::boxed::Box<crate::model::model::clustering_metrics::cluster::feature_value::CategoricalValue>>{
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::model::clustering_metrics::cluster::feature_value::Value::CategoricalValue(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [value][crate::model::model::clustering_metrics::cluster::FeatureValue::value]
/// to hold a `CategoricalValue`.
///
/// Note that all the setters affecting `value` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::FeatureValue;
/// use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::CategoricalValue;
/// let x = FeatureValue::new().set_categorical_value(CategoricalValue::default()/* use setters */);
/// assert!(x.categorical_value().is_some());
/// assert!(x.numerical_value().is_none());
/// ```
pub fn set_categorical_value<T: std::convert::Into<std::boxed::Box<crate::model::model::clustering_metrics::cluster::feature_value::CategoricalValue>>>(mut self, v: T) -> Self{
self.value = std::option::Option::Some(
crate::model::model::clustering_metrics::cluster::feature_value::Value::CategoricalValue(
v.into()
)
);
self
}
}
impl wkt::message::Message for FeatureValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ClusteringMetrics.Cluster.FeatureValue"
}
}
/// Defines additional types related to [FeatureValue].
pub mod feature_value {
#[allow(unused_imports)]
use super::*;
/// Representative value of a categorical feature.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CategoricalValue {
/// Counts of all categories for the categorical feature. If there are
/// more than ten categories, we return top ten (by count) and return
/// one more CategoryCount with category "_OTHER_" and count as
/// aggregate counts of remaining categories.
pub category_counts: std::vec::Vec<crate::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CategoricalValue {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [category_counts][crate::model::model::clustering_metrics::cluster::feature_value::CategoricalValue::category_counts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::CategoricalValue;
/// use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount;
/// let x = CategoricalValue::new()
/// .set_category_counts([
/// CategoryCount::default()/* use setters */,
/// CategoryCount::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_category_counts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount>
{
use std::iter::Iterator;
self.category_counts = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for CategoricalValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ClusteringMetrics.Cluster.FeatureValue.CategoricalValue"
}
}
/// Defines additional types related to [CategoricalValue].
pub mod categorical_value {
#[allow(unused_imports)]
use super::*;
/// Represents the count of a single category within the cluster.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CategoryCount {
/// The name of category.
pub category: std::string::String,
/// The count of training samples matching the category within the
/// cluster.
pub count: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields:
serde_json::Map<std::string::String, serde_json::Value>,
}
impl CategoryCount {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [category][crate::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount::category].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount;
/// let x = CategoryCount::new().set_category("example");
/// ```
pub fn set_category<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.category = v.into();
self
}
/// Sets the value of [count][crate::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount::count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount;
/// use wkt::Int64Value;
/// let x = CategoryCount::new().set_count(Int64Value::default()/* use setters */);
/// ```
pub fn set_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [count][crate::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount::count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::clustering_metrics::cluster::feature_value::categorical_value::CategoryCount;
/// use wkt::Int64Value;
/// let x = CategoryCount::new().set_or_clear_count(Some(Int64Value::default()/* use setters */));
/// let x = CategoryCount::new().set_or_clear_count(None::<Int64Value>);
/// ```
pub fn set_or_clear_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.count = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CategoryCount {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ClusteringMetrics.Cluster.FeatureValue.CategoricalValue.CategoryCount"
}
}
}
/// Value.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Value {
/// The numerical feature value. This is the centroid value for this
/// feature.
NumericalValue(std::boxed::Box<wkt::DoubleValue>),
/// The categorical feature value.
CategoricalValue(std::boxed::Box<crate::model::model::clustering_metrics::cluster::feature_value::CategoricalValue>),
}
}
}
}
/// Evaluation metrics used by weighted-ALS models specified by
/// feedback_type=implicit.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RankingMetrics {
/// Calculates a precision per user for all the items by ranking them and
/// then averages all the precisions across all the users.
pub mean_average_precision: std::option::Option<wkt::DoubleValue>,
/// Similar to the mean squared error computed in regression and explicit
/// recommendation models except instead of computing the rating directly,
/// the output from evaluate is computed against a preference which is 1 or 0
/// depending on if the rating exists or not.
pub mean_squared_error: std::option::Option<wkt::DoubleValue>,
/// A metric to determine the goodness of a ranking calculated from the
/// predicted confidence by comparing it to an ideal rank measured by the
/// original ratings.
pub normalized_discounted_cumulative_gain: std::option::Option<wkt::DoubleValue>,
/// Determines the goodness of a ranking by computing the percentile rank
/// from the predicted confidence and dividing it by the original rank.
pub average_rank: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RankingMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [mean_average_precision][crate::model::model::RankingMetrics::mean_average_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_mean_average_precision(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_average_precision<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_average_precision = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_average_precision][crate::model::model::RankingMetrics::mean_average_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_or_clear_mean_average_precision(Some(DoubleValue::default()/* use setters */));
/// let x = RankingMetrics::new().set_or_clear_mean_average_precision(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_average_precision<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_average_precision = v.map(|x| x.into());
self
}
/// Sets the value of [mean_squared_error][crate::model::model::RankingMetrics::mean_squared_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_mean_squared_error(DoubleValue::default()/* use setters */);
/// ```
pub fn set_mean_squared_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [mean_squared_error][crate::model::model::RankingMetrics::mean_squared_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_or_clear_mean_squared_error(Some(DoubleValue::default()/* use setters */));
/// let x = RankingMetrics::new().set_or_clear_mean_squared_error(None::<DoubleValue>);
/// ```
pub fn set_or_clear_mean_squared_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.mean_squared_error = v.map(|x| x.into());
self
}
/// Sets the value of [normalized_discounted_cumulative_gain][crate::model::model::RankingMetrics::normalized_discounted_cumulative_gain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_normalized_discounted_cumulative_gain(DoubleValue::default()/* use setters */);
/// ```
pub fn set_normalized_discounted_cumulative_gain<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.normalized_discounted_cumulative_gain = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [normalized_discounted_cumulative_gain][crate::model::model::RankingMetrics::normalized_discounted_cumulative_gain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_or_clear_normalized_discounted_cumulative_gain(Some(DoubleValue::default()/* use setters */));
/// let x = RankingMetrics::new().set_or_clear_normalized_discounted_cumulative_gain(None::<DoubleValue>);
/// ```
pub fn set_or_clear_normalized_discounted_cumulative_gain<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.normalized_discounted_cumulative_gain = v.map(|x| x.into());
self
}
/// Sets the value of [average_rank][crate::model::model::RankingMetrics::average_rank].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_average_rank(DoubleValue::default()/* use setters */);
/// ```
pub fn set_average_rank<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.average_rank = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [average_rank][crate::model::model::RankingMetrics::average_rank].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// use wkt::DoubleValue;
/// let x = RankingMetrics::new().set_or_clear_average_rank(Some(DoubleValue::default()/* use setters */));
/// let x = RankingMetrics::new().set_or_clear_average_rank(None::<DoubleValue>);
/// ```
pub fn set_or_clear_average_rank<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.average_rank = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RankingMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.RankingMetrics"
}
}
/// Model evaluation metrics for ARIMA forecasting models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaForecastingMetrics {
/// Repeated as there can be many metric sets (one for each model) in
/// auto-arima and the large-scale case.
pub arima_single_model_forecasting_metrics: std::vec::Vec<
crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaForecastingMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [arima_single_model_forecasting_metrics][crate::model::model::ArimaForecastingMetrics::arima_single_model_forecasting_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// let x = ArimaForecastingMetrics::new()
/// .set_arima_single_model_forecasting_metrics([
/// ArimaSingleModelForecastingMetrics::default()/* use setters */,
/// ArimaSingleModelForecastingMetrics::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_arima_single_model_forecasting_metrics<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics>
{
use std::iter::Iterator;
self.arima_single_model_forecasting_metrics = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ArimaForecastingMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ArimaForecastingMetrics"
}
}
/// Defines additional types related to [ArimaForecastingMetrics].
pub mod arima_forecasting_metrics {
#[allow(unused_imports)]
use super::*;
/// Model evaluation metrics for a single ARIMA forecasting model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaSingleModelForecastingMetrics {
/// Non-seasonal order.
pub non_seasonal_order: std::option::Option<crate::model::model::ArimaOrder>,
/// Arima fitting metrics.
pub arima_fitting_metrics:
std::option::Option<crate::model::model::ArimaFittingMetrics>,
/// Is arima model fitted with drift or not. It is always false when d
/// is not 1.
pub has_drift: std::option::Option<wkt::BoolValue>,
/// The time_series_id value for this time series. It will be one of
/// the unique values from the time_series_id_column specified during
/// ARIMA model training. Only present when time_series_id_column
/// training option was used.
pub time_series_id: std::string::String,
/// The tuple of time_series_ids identifying this time series. It will
/// be one of the unique tuples of values present in the
/// time_series_id_columns specified during ARIMA model training. Only
/// present when time_series_id_columns training option was used and
/// the order of values here are same as the order of
/// time_series_id_columns.
pub time_series_ids: std::vec::Vec<std::string::String>,
/// Seasonal periods. Repeated because multiple periods are supported
/// for one time series.
pub seasonal_periods:
std::vec::Vec<crate::model::model::seasonal_period::SeasonalPeriodType>,
/// If true, holiday_effect is a part of time series decomposition result.
pub has_holiday_effect: std::option::Option<wkt::BoolValue>,
/// If true, spikes_and_dips is a part of time series decomposition result.
pub has_spikes_and_dips: std::option::Option<wkt::BoolValue>,
/// If true, step_changes is a part of time series decomposition result.
pub has_step_changes: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaSingleModelForecastingMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [non_seasonal_order][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = ArimaSingleModelForecastingMetrics::new().set_non_seasonal_order(ArimaOrder::default()/* use setters */);
/// ```
pub fn set_non_seasonal_order<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [non_seasonal_order][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_non_seasonal_order(Some(ArimaOrder::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_non_seasonal_order(None::<ArimaOrder>);
/// ```
pub fn set_or_clear_non_seasonal_order<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = v.map(|x| x.into());
self
}
/// Sets the value of [arima_fitting_metrics][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::arima_fitting_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// let x = ArimaSingleModelForecastingMetrics::new().set_arima_fitting_metrics(ArimaFittingMetrics::default()/* use setters */);
/// ```
pub fn set_arima_fitting_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ArimaFittingMetrics>,
{
self.arima_fitting_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [arima_fitting_metrics][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::arima_fitting_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_arima_fitting_metrics(Some(ArimaFittingMetrics::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_arima_fitting_metrics(None::<ArimaFittingMetrics>);
/// ```
pub fn set_or_clear_arima_fitting_metrics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::ArimaFittingMetrics>,
{
self.arima_fitting_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [has_drift][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_has_drift(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_drift<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_drift = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_drift][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_drift(Some(BoolValue::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_drift(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_drift<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_drift = v.map(|x| x.into());
self
}
/// Sets the value of [time_series_id][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::time_series_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// let x = ArimaSingleModelForecastingMetrics::new().set_time_series_id("example");
/// ```
pub fn set_time_series_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.time_series_id = v.into();
self
}
/// Sets the value of [time_series_ids][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::time_series_ids].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// let x = ArimaSingleModelForecastingMetrics::new().set_time_series_ids(["a", "b", "c"]);
/// ```
pub fn set_time_series_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.time_series_ids = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [seasonal_periods][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::seasonal_periods].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use google_cloud_bigquery_v2::model::model::seasonal_period::SeasonalPeriodType;
/// let x = ArimaSingleModelForecastingMetrics::new().set_seasonal_periods([
/// SeasonalPeriodType::NoSeasonality,
/// SeasonalPeriodType::Daily,
/// SeasonalPeriodType::Weekly,
/// ]);
/// ```
pub fn set_seasonal_periods<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::seasonal_period::SeasonalPeriodType>,
{
use std::iter::Iterator;
self.seasonal_periods = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [has_holiday_effect][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_holiday_effect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_has_holiday_effect(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_holiday_effect<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_holiday_effect = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_holiday_effect][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_holiday_effect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_holiday_effect(Some(BoolValue::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_holiday_effect(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_holiday_effect<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_holiday_effect = v.map(|x| x.into());
self
}
/// Sets the value of [has_spikes_and_dips][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_has_spikes_and_dips(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_spikes_and_dips<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_spikes_and_dips = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_spikes_and_dips][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_spikes_and_dips(Some(BoolValue::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_spikes_and_dips(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_spikes_and_dips<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_spikes_and_dips = v.map(|x| x.into());
self
}
/// Sets the value of [has_step_changes][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_has_step_changes(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_step_changes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_step_changes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_step_changes][crate::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics::has_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::arima_forecasting_metrics::ArimaSingleModelForecastingMetrics;
/// use wkt::BoolValue;
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_step_changes(Some(BoolValue::default()/* use setters */));
/// let x = ArimaSingleModelForecastingMetrics::new().set_or_clear_has_step_changes(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_step_changes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_step_changes = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ArimaSingleModelForecastingMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ArimaForecastingMetrics.ArimaSingleModelForecastingMetrics"
}
}
}
/// Model evaluation metrics for dimensionality reduction models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DimensionalityReductionMetrics {
/// Total percentage of variance explained by the selected principal
/// components.
pub total_explained_variance_ratio: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DimensionalityReductionMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [total_explained_variance_ratio][crate::model::model::DimensionalityReductionMetrics::total_explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DimensionalityReductionMetrics;
/// use wkt::DoubleValue;
/// let x = DimensionalityReductionMetrics::new().set_total_explained_variance_ratio(DoubleValue::default()/* use setters */);
/// ```
pub fn set_total_explained_variance_ratio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.total_explained_variance_ratio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_explained_variance_ratio][crate::model::model::DimensionalityReductionMetrics::total_explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DimensionalityReductionMetrics;
/// use wkt::DoubleValue;
/// let x = DimensionalityReductionMetrics::new().set_or_clear_total_explained_variance_ratio(Some(DoubleValue::default()/* use setters */));
/// let x = DimensionalityReductionMetrics::new().set_or_clear_total_explained_variance_ratio(None::<DoubleValue>);
/// ```
pub fn set_or_clear_total_explained_variance_ratio<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.total_explained_variance_ratio = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DimensionalityReductionMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.DimensionalityReductionMetrics"
}
}
/// Evaluation metrics of a model. These are either computed on all training
/// data or just the eval data based on whether eval data was used during
/// training. These are not present for imported models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluationMetrics {
/// Metrics.
pub metrics: std::option::Option<crate::model::model::evaluation_metrics::Metrics>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EvaluationMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics].
///
/// Note that all the setters affecting `metrics` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// let x = EvaluationMetrics::new().set_metrics(Some(
/// google_cloud_bigquery_v2::model::model::evaluation_metrics::Metrics::RegressionMetrics(RegressionMetrics::default().into())));
/// ```
pub fn set_metrics<
T: std::convert::Into<
std::option::Option<crate::model::model::evaluation_metrics::Metrics>,
>,
>(
mut self,
v: T,
) -> Self {
self.metrics = v.into();
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `RegressionMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn regression_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::model::RegressionMetrics>> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::RegressionMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `RegressionMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::RegressionMetrics;
/// let x = EvaluationMetrics::new().set_regression_metrics(RegressionMetrics::default()/* use setters */);
/// assert!(x.regression_metrics().is_some());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_regression_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::model::RegressionMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::RegressionMetrics(v.into()),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `BinaryClassificationMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn binary_classification_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::model::BinaryClassificationMetrics>>
{
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::BinaryClassificationMetrics(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `BinaryClassificationMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::BinaryClassificationMetrics;
/// let x = EvaluationMetrics::new().set_binary_classification_metrics(BinaryClassificationMetrics::default()/* use setters */);
/// assert!(x.binary_classification_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_binary_classification_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::model::BinaryClassificationMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::BinaryClassificationMetrics(
v.into(),
),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `MultiClassClassificationMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn multi_class_classification_metrics(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::MultiClassClassificationMetrics>,
> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::MultiClassClassificationMetrics(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `MultiClassClassificationMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::MultiClassClassificationMetrics;
/// let x = EvaluationMetrics::new().set_multi_class_classification_metrics(MultiClassClassificationMetrics::default()/* use setters */);
/// assert!(x.multi_class_classification_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_multi_class_classification_metrics<
T: std::convert::Into<
std::boxed::Box<crate::model::model::MultiClassClassificationMetrics>,
>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::MultiClassClassificationMetrics(
v.into(),
),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `ClusteringMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn clustering_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::model::ClusteringMetrics>> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::ClusteringMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `ClusteringMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::ClusteringMetrics;
/// let x = EvaluationMetrics::new().set_clustering_metrics(ClusteringMetrics::default()/* use setters */);
/// assert!(x.clustering_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_clustering_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::model::ClusteringMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::ClusteringMetrics(v.into()),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `RankingMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn ranking_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::model::RankingMetrics>> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::RankingMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `RankingMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::RankingMetrics;
/// let x = EvaluationMetrics::new().set_ranking_metrics(RankingMetrics::default()/* use setters */);
/// assert!(x.ranking_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_ranking_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::model::RankingMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::RankingMetrics(v.into()),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `ArimaForecastingMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn arima_forecasting_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::model::ArimaForecastingMetrics>>
{
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::ArimaForecastingMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `ArimaForecastingMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::ArimaForecastingMetrics;
/// let x = EvaluationMetrics::new().set_arima_forecasting_metrics(ArimaForecastingMetrics::default()/* use setters */);
/// assert!(x.arima_forecasting_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.dimensionality_reduction_metrics().is_none());
/// ```
pub fn set_arima_forecasting_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::model::ArimaForecastingMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::ArimaForecastingMetrics(v.into()),
);
self
}
/// The value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// if it holds a `DimensionalityReductionMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn dimensionality_reduction_metrics(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::DimensionalityReductionMetrics>,
> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::model::evaluation_metrics::Metrics::DimensionalityReductionMetrics(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::model::EvaluationMetrics::metrics]
/// to hold a `DimensionalityReductionMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// use google_cloud_bigquery_v2::model::model::DimensionalityReductionMetrics;
/// let x = EvaluationMetrics::new().set_dimensionality_reduction_metrics(DimensionalityReductionMetrics::default()/* use setters */);
/// assert!(x.dimensionality_reduction_metrics().is_some());
/// assert!(x.regression_metrics().is_none());
/// assert!(x.binary_classification_metrics().is_none());
/// assert!(x.multi_class_classification_metrics().is_none());
/// assert!(x.clustering_metrics().is_none());
/// assert!(x.ranking_metrics().is_none());
/// assert!(x.arima_forecasting_metrics().is_none());
/// ```
pub fn set_dimensionality_reduction_metrics<
T: std::convert::Into<
std::boxed::Box<crate::model::model::DimensionalityReductionMetrics>,
>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::model::evaluation_metrics::Metrics::DimensionalityReductionMetrics(
v.into(),
),
);
self
}
}
impl wkt::message::Message for EvaluationMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.EvaluationMetrics"
}
}
/// Defines additional types related to [EvaluationMetrics].
pub mod evaluation_metrics {
#[allow(unused_imports)]
use super::*;
/// Metrics.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Metrics {
/// Populated for regression models and explicit feedback type matrix
/// factorization models.
RegressionMetrics(std::boxed::Box<crate::model::model::RegressionMetrics>),
/// Populated for binary classification/classifier models.
BinaryClassificationMetrics(
std::boxed::Box<crate::model::model::BinaryClassificationMetrics>,
),
/// Populated for multi-class classification/classifier models.
MultiClassClassificationMetrics(
std::boxed::Box<crate::model::model::MultiClassClassificationMetrics>,
),
/// Populated for clustering models.
ClusteringMetrics(std::boxed::Box<crate::model::model::ClusteringMetrics>),
/// Populated for implicit feedback type matrix factorization models.
RankingMetrics(std::boxed::Box<crate::model::model::RankingMetrics>),
/// Populated for ARIMA models.
ArimaForecastingMetrics(std::boxed::Box<crate::model::model::ArimaForecastingMetrics>),
/// Evaluation metrics when the model is a dimensionality reduction model,
/// which currently includes PCA.
DimensionalityReductionMetrics(
std::boxed::Box<crate::model::model::DimensionalityReductionMetrics>,
),
}
}
/// Data split result. This contains references to the training and evaluation
/// data tables that were used to train the model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataSplitResult {
/// Table reference of the training data after split.
pub training_table: std::option::Option<crate::model::TableReference>,
/// Table reference of the evaluation data after split.
pub evaluation_table: std::option::Option<crate::model::TableReference>,
/// Table reference of the test data after split.
pub test_table: std::option::Option<crate::model::TableReference>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataSplitResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [training_table][crate::model::model::DataSplitResult::training_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_training_table(TableReference::default()/* use setters */);
/// ```
pub fn set_training_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.training_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [training_table][crate::model::model::DataSplitResult::training_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_or_clear_training_table(Some(TableReference::default()/* use setters */));
/// let x = DataSplitResult::new().set_or_clear_training_table(None::<TableReference>);
/// ```
pub fn set_or_clear_training_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.training_table = v.map(|x| x.into());
self
}
/// Sets the value of [evaluation_table][crate::model::model::DataSplitResult::evaluation_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_evaluation_table(TableReference::default()/* use setters */);
/// ```
pub fn set_evaluation_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.evaluation_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluation_table][crate::model::model::DataSplitResult::evaluation_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_or_clear_evaluation_table(Some(TableReference::default()/* use setters */));
/// let x = DataSplitResult::new().set_or_clear_evaluation_table(None::<TableReference>);
/// ```
pub fn set_or_clear_evaluation_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.evaluation_table = v.map(|x| x.into());
self
}
/// Sets the value of [test_table][crate::model::model::DataSplitResult::test_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_test_table(TableReference::default()/* use setters */);
/// ```
pub fn set_test_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.test_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [test_table][crate::model::model::DataSplitResult::test_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = DataSplitResult::new().set_or_clear_test_table(Some(TableReference::default()/* use setters */));
/// let x = DataSplitResult::new().set_or_clear_test_table(None::<TableReference>);
/// ```
pub fn set_or_clear_test_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.test_table = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DataSplitResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.DataSplitResult"
}
}
/// Arima order, can be used for both non-seasonal and seasonal parts.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaOrder {
/// Order of the autoregressive part.
pub p: std::option::Option<wkt::Int64Value>,
/// Order of the differencing part.
pub d: std::option::Option<wkt::Int64Value>,
/// Order of the moving-average part.
pub q: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaOrder {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [p][crate::model::model::ArimaOrder::p].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_p(Int64Value::default()/* use setters */);
/// ```
pub fn set_p<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.p = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [p][crate::model::model::ArimaOrder::p].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_or_clear_p(Some(Int64Value::default()/* use setters */));
/// let x = ArimaOrder::new().set_or_clear_p(None::<Int64Value>);
/// ```
pub fn set_or_clear_p<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.p = v.map(|x| x.into());
self
}
/// Sets the value of [d][crate::model::model::ArimaOrder::d].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_d(Int64Value::default()/* use setters */);
/// ```
pub fn set_d<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.d = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [d][crate::model::model::ArimaOrder::d].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_or_clear_d(Some(Int64Value::default()/* use setters */));
/// let x = ArimaOrder::new().set_or_clear_d(None::<Int64Value>);
/// ```
pub fn set_or_clear_d<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.d = v.map(|x| x.into());
self
}
/// Sets the value of [q][crate::model::model::ArimaOrder::q].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_q(Int64Value::default()/* use setters */);
/// ```
pub fn set_q<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.q = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [q][crate::model::model::ArimaOrder::q].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// use wkt::Int64Value;
/// let x = ArimaOrder::new().set_or_clear_q(Some(Int64Value::default()/* use setters */));
/// let x = ArimaOrder::new().set_or_clear_q(None::<Int64Value>);
/// ```
pub fn set_or_clear_q<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.q = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ArimaOrder {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ArimaOrder"
}
}
/// ARIMA model fitting metrics.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaFittingMetrics {
/// Log-likelihood.
pub log_likelihood: std::option::Option<wkt::DoubleValue>,
/// AIC.
pub aic: std::option::Option<wkt::DoubleValue>,
/// Variance.
pub variance: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaFittingMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [log_likelihood][crate::model::model::ArimaFittingMetrics::log_likelihood].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_log_likelihood(DoubleValue::default()/* use setters */);
/// ```
pub fn set_log_likelihood<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.log_likelihood = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [log_likelihood][crate::model::model::ArimaFittingMetrics::log_likelihood].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_or_clear_log_likelihood(Some(DoubleValue::default()/* use setters */));
/// let x = ArimaFittingMetrics::new().set_or_clear_log_likelihood(None::<DoubleValue>);
/// ```
pub fn set_or_clear_log_likelihood<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.log_likelihood = v.map(|x| x.into());
self
}
/// Sets the value of [aic][crate::model::model::ArimaFittingMetrics::aic].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_aic(DoubleValue::default()/* use setters */);
/// ```
pub fn set_aic<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.aic = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [aic][crate::model::model::ArimaFittingMetrics::aic].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_or_clear_aic(Some(DoubleValue::default()/* use setters */));
/// let x = ArimaFittingMetrics::new().set_or_clear_aic(None::<DoubleValue>);
/// ```
pub fn set_or_clear_aic<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.aic = v.map(|x| x.into());
self
}
/// Sets the value of [variance][crate::model::model::ArimaFittingMetrics::variance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_variance(DoubleValue::default()/* use setters */);
/// ```
pub fn set_variance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.variance = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [variance][crate::model::model::ArimaFittingMetrics::variance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// use wkt::DoubleValue;
/// let x = ArimaFittingMetrics::new().set_or_clear_variance(Some(DoubleValue::default()/* use setters */));
/// let x = ArimaFittingMetrics::new().set_or_clear_variance(None::<DoubleValue>);
/// ```
pub fn set_or_clear_variance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.variance = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ArimaFittingMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ArimaFittingMetrics"
}
}
/// Global explanations containing the top most important features
/// after training.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GlobalExplanation {
/// A list of the top global explanations. Sorted by absolute value of
/// attribution in descending order.
pub explanations: std::vec::Vec<crate::model::model::global_explanation::Explanation>,
/// Class label for this set of global explanations. Will be empty/null for
/// binary logistic and linear regression models. Sorted alphabetically in
/// descending order.
pub class_label: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GlobalExplanation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [explanations][crate::model::model::GlobalExplanation::explanations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::GlobalExplanation;
/// use google_cloud_bigquery_v2::model::model::global_explanation::Explanation;
/// let x = GlobalExplanation::new()
/// .set_explanations([
/// Explanation::default()/* use setters */,
/// Explanation::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_explanations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::global_explanation::Explanation>,
{
use std::iter::Iterator;
self.explanations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [class_label][crate::model::model::GlobalExplanation::class_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::GlobalExplanation;
/// let x = GlobalExplanation::new().set_class_label("example");
/// ```
pub fn set_class_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.class_label = v.into();
self
}
}
impl wkt::message::Message for GlobalExplanation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.GlobalExplanation"
}
}
/// Defines additional types related to [GlobalExplanation].
pub mod global_explanation {
#[allow(unused_imports)]
use super::*;
/// Explanation for a single feature.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Explanation {
/// The full feature name. For non-numerical features, will be formatted
/// like `<column_name>.<encoded_feature_name>`. Overall size of feature
/// name will always be truncated to first 120 characters.
pub feature_name: std::string::String,
/// Attribution of feature.
pub attribution: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Explanation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [feature_name][crate::model::model::global_explanation::Explanation::feature_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::global_explanation::Explanation;
/// let x = Explanation::new().set_feature_name("example");
/// ```
pub fn set_feature_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.feature_name = v.into();
self
}
/// Sets the value of [attribution][crate::model::model::global_explanation::Explanation::attribution].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::global_explanation::Explanation;
/// use wkt::DoubleValue;
/// let x = Explanation::new().set_attribution(DoubleValue::default()/* use setters */);
/// ```
pub fn set_attribution<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.attribution = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [attribution][crate::model::model::global_explanation::Explanation::attribution].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::global_explanation::Explanation;
/// use wkt::DoubleValue;
/// let x = Explanation::new().set_or_clear_attribution(Some(DoubleValue::default()/* use setters */));
/// let x = Explanation::new().set_or_clear_attribution(None::<DoubleValue>);
/// ```
pub fn set_or_clear_attribution<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.attribution = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Explanation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.GlobalExplanation.Explanation"
}
}
}
/// Encoding methods for categorical features.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CategoryEncodingMethod {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CategoryEncodingMethod {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for CategoryEncodingMethod {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.CategoryEncodingMethod"
}
}
/// Defines additional types related to [CategoryEncodingMethod].
pub mod category_encoding_method {
#[allow(unused_imports)]
use super::*;
/// Supported encoding methods for categorical features.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EncodingMethod {
/// Unspecified encoding method.
Unspecified,
/// Applies one-hot encoding.
OneHotEncoding,
/// Applies label encoding.
LabelEncoding,
/// Applies dummy encoding.
DummyEncoding,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [EncodingMethod::value] or
/// [EncodingMethod::name].
UnknownValue(encoding_method::UnknownValue),
}
#[doc(hidden)]
pub mod encoding_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EncodingMethod {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::OneHotEncoding => std::option::Option::Some(1),
Self::LabelEncoding => std::option::Option::Some(2),
Self::DummyEncoding => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ENCODING_METHOD_UNSPECIFIED"),
Self::OneHotEncoding => std::option::Option::Some("ONE_HOT_ENCODING"),
Self::LabelEncoding => std::option::Option::Some("LABEL_ENCODING"),
Self::DummyEncoding => std::option::Option::Some("DUMMY_ENCODING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EncodingMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EncodingMethod {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EncodingMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::OneHotEncoding,
2 => Self::LabelEncoding,
3 => Self::DummyEncoding,
_ => Self::UnknownValue(encoding_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EncodingMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENCODING_METHOD_UNSPECIFIED" => Self::Unspecified,
"ONE_HOT_ENCODING" => Self::OneHotEncoding,
"LABEL_ENCODING" => Self::LabelEncoding,
"DUMMY_ENCODING" => Self::DummyEncoding,
_ => Self::UnknownValue(encoding_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EncodingMethod {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::OneHotEncoding => serializer.serialize_i32(1),
Self::LabelEncoding => serializer.serialize_i32(2),
Self::DummyEncoding => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EncodingMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncodingMethod>::new(
".google.cloud.bigquery.v2.Model.CategoryEncodingMethod.EncodingMethod",
))
}
}
}
/// PCA solver options.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PcaSolverOptionEnums {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PcaSolverOptionEnums {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for PcaSolverOptionEnums {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.PcaSolverOptionEnums"
}
}
/// Defines additional types related to [PcaSolverOptionEnums].
pub mod pca_solver_option_enums {
#[allow(unused_imports)]
use super::*;
/// Enums for supported PCA solvers.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PcaSolver {
/// Default value.
Unspecified,
/// Full eigen-decoposition.
Full,
/// Randomized SVD.
Randomized,
/// Auto.
Auto,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [PcaSolver::value] or
/// [PcaSolver::name].
UnknownValue(pca_solver::UnknownValue),
}
#[doc(hidden)]
pub mod pca_solver {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PcaSolver {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Full => std::option::Option::Some(1),
Self::Randomized => std::option::Option::Some(2),
Self::Auto => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
Self::Full => std::option::Option::Some("FULL"),
Self::Randomized => std::option::Option::Some("RANDOMIZED"),
Self::Auto => std::option::Option::Some("AUTO"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PcaSolver {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PcaSolver {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PcaSolver {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Full,
2 => Self::Randomized,
3 => Self::Auto,
_ => Self::UnknownValue(pca_solver::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PcaSolver {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UNSPECIFIED" => Self::Unspecified,
"FULL" => Self::Full,
"RANDOMIZED" => Self::Randomized,
"AUTO" => Self::Auto,
_ => Self::UnknownValue(pca_solver::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PcaSolver {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Full => serializer.serialize_i32(1),
Self::Randomized => serializer.serialize_i32(2),
Self::Auto => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PcaSolver {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PcaSolver>::new(
".google.cloud.bigquery.v2.Model.PcaSolverOptionEnums.PcaSolver",
))
}
}
}
/// Model registry options.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelRegistryOptionEnums {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelRegistryOptionEnums {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for ModelRegistryOptionEnums {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.ModelRegistryOptionEnums"
}
}
/// Defines additional types related to [ModelRegistryOptionEnums].
pub mod model_registry_option_enums {
#[allow(unused_imports)]
use super::*;
/// Enums for supported model registries.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModelRegistry {
/// Default value.
Unspecified,
/// Vertex AI.
VertexAi,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ModelRegistry::value] or
/// [ModelRegistry::name].
UnknownValue(model_registry::UnknownValue),
}
#[doc(hidden)]
pub mod model_registry {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ModelRegistry {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::VertexAi => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODEL_REGISTRY_UNSPECIFIED"),
Self::VertexAi => std::option::Option::Some("VERTEX_AI"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ModelRegistry {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ModelRegistry {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ModelRegistry {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::VertexAi,
_ => Self::UnknownValue(model_registry::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ModelRegistry {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODEL_REGISTRY_UNSPECIFIED" => Self::Unspecified,
"VERTEX_AI" => Self::VertexAi,
_ => Self::UnknownValue(model_registry::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ModelRegistry {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::VertexAi => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ModelRegistry {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelRegistry>::new(
".google.cloud.bigquery.v2.Model.ModelRegistryOptionEnums.ModelRegistry",
))
}
}
}
/// Information about a single training query run for the model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainingRun {
/// Output only. Options that were used for this training run, includes
/// user specified and default options that were used.
pub training_options:
std::option::Option<crate::model::model::training_run::TrainingOptions>,
/// Output only. The start time of this training run.
pub start_time: std::option::Option<wkt::Timestamp>,
/// Output only. Output of each iteration run, results.size() <=
/// max_iterations.
pub results: std::vec::Vec<crate::model::model::training_run::IterationResult>,
/// Output only. The evaluation metrics over training/eval data that were
/// computed at the end of training.
pub evaluation_metrics: std::option::Option<crate::model::model::EvaluationMetrics>,
/// Output only. Data split result of the training run. Only set when the
/// input data is actually split.
pub data_split_result: std::option::Option<crate::model::model::DataSplitResult>,
/// Output only. Global explanation contains the explanation of top features
/// on the model level. Applies to both regression and classification models.
pub model_level_global_explanation:
std::option::Option<crate::model::model::GlobalExplanation>,
/// Output only. Global explanation contains the explanation of top features
/// on the class level. Applies to classification models only.
pub class_level_global_explanations: std::vec::Vec<crate::model::model::GlobalExplanation>,
/// The model id in the [Vertex AI Model
/// Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction)
/// for this training run.
pub vertex_ai_model_id: std::string::String,
/// Output only. The model version in the [Vertex AI Model
/// Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction)
/// for this training run.
pub vertex_ai_model_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TrainingRun {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [training_options][crate::model::model::TrainingRun::training_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingRun::new().set_training_options(TrainingOptions::default()/* use setters */);
/// ```
pub fn set_training_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::training_run::TrainingOptions>,
{
self.training_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [training_options][crate::model::model::TrainingRun::training_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingRun::new().set_or_clear_training_options(Some(TrainingOptions::default()/* use setters */));
/// let x = TrainingRun::new().set_or_clear_training_options(None::<TrainingOptions>);
/// ```
pub fn set_or_clear_training_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::training_run::TrainingOptions>,
{
self.training_options = v.map(|x| x.into());
self
}
/// Sets the value of [start_time][crate::model::model::TrainingRun::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use wkt::Timestamp;
/// let x = TrainingRun::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_time][crate::model::model::TrainingRun::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use wkt::Timestamp;
/// let x = TrainingRun::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = TrainingRun::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
/// Sets the value of [results][crate::model::model::TrainingRun::results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// let x = TrainingRun::new()
/// .set_results([
/// IterationResult::default()/* use setters */,
/// IterationResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::training_run::IterationResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [evaluation_metrics][crate::model::model::TrainingRun::evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = TrainingRun::new().set_evaluation_metrics(EvaluationMetrics::default()/* use setters */);
/// ```
pub fn set_evaluation_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.evaluation_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluation_metrics][crate::model::model::TrainingRun::evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = TrainingRun::new().set_or_clear_evaluation_metrics(Some(EvaluationMetrics::default()/* use setters */));
/// let x = TrainingRun::new().set_or_clear_evaluation_metrics(None::<EvaluationMetrics>);
/// ```
pub fn set_or_clear_evaluation_metrics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.evaluation_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [data_split_result][crate::model::model::TrainingRun::data_split_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// let x = TrainingRun::new().set_data_split_result(DataSplitResult::default()/* use setters */);
/// ```
pub fn set_data_split_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DataSplitResult>,
{
self.data_split_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_split_result][crate::model::model::TrainingRun::data_split_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::DataSplitResult;
/// let x = TrainingRun::new().set_or_clear_data_split_result(Some(DataSplitResult::default()/* use setters */));
/// let x = TrainingRun::new().set_or_clear_data_split_result(None::<DataSplitResult>);
/// ```
pub fn set_or_clear_data_split_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DataSplitResult>,
{
self.data_split_result = v.map(|x| x.into());
self
}
/// Sets the value of [model_level_global_explanation][crate::model::model::TrainingRun::model_level_global_explanation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::GlobalExplanation;
/// let x = TrainingRun::new().set_model_level_global_explanation(GlobalExplanation::default()/* use setters */);
/// ```
pub fn set_model_level_global_explanation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::GlobalExplanation>,
{
self.model_level_global_explanation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_level_global_explanation][crate::model::model::TrainingRun::model_level_global_explanation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::GlobalExplanation;
/// let x = TrainingRun::new().set_or_clear_model_level_global_explanation(Some(GlobalExplanation::default()/* use setters */));
/// let x = TrainingRun::new().set_or_clear_model_level_global_explanation(None::<GlobalExplanation>);
/// ```
pub fn set_or_clear_model_level_global_explanation<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::GlobalExplanation>,
{
self.model_level_global_explanation = v.map(|x| x.into());
self
}
/// Sets the value of [class_level_global_explanations][crate::model::model::TrainingRun::class_level_global_explanations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// use google_cloud_bigquery_v2::model::model::GlobalExplanation;
/// let x = TrainingRun::new()
/// .set_class_level_global_explanations([
/// GlobalExplanation::default()/* use setters */,
/// GlobalExplanation::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_class_level_global_explanations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::GlobalExplanation>,
{
use std::iter::Iterator;
self.class_level_global_explanations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [vertex_ai_model_id][crate::model::model::TrainingRun::vertex_ai_model_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// let x = TrainingRun::new().set_vertex_ai_model_id("example");
/// ```
pub fn set_vertex_ai_model_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.vertex_ai_model_id = v.into();
self
}
/// Sets the value of [vertex_ai_model_version][crate::model::model::TrainingRun::vertex_ai_model_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::TrainingRun;
/// let x = TrainingRun::new().set_vertex_ai_model_version("example");
/// ```
pub fn set_vertex_ai_model_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.vertex_ai_model_version = v.into();
self
}
}
impl wkt::message::Message for TrainingRun {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun"
}
}
/// Defines additional types related to [TrainingRun].
pub mod training_run {
#[allow(unused_imports)]
use super::*;
/// Options used in model training.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainingOptions {
/// The maximum number of iterations in training. Used only for iterative
/// training algorithms.
pub max_iterations: i64,
/// Type of loss function used during training run.
pub loss_type: crate::model::model::LossType,
/// Learning rate in training. Used only for iterative training algorithms.
pub learn_rate: f64,
/// L1 regularization coefficient.
pub l1_regularization: std::option::Option<wkt::DoubleValue>,
/// L2 regularization coefficient.
pub l2_regularization: std::option::Option<wkt::DoubleValue>,
/// When early_stop is true, stops training when accuracy improvement is
/// less than 'min_relative_progress'. Used only for iterative training
/// algorithms.
pub min_relative_progress: std::option::Option<wkt::DoubleValue>,
/// Whether to train a model from the last checkpoint.
pub warm_start: std::option::Option<wkt::BoolValue>,
/// Whether to stop early when the loss doesn't improve significantly
/// any more (compared to min_relative_progress). Used only for iterative
/// training algorithms.
pub early_stop: std::option::Option<wkt::BoolValue>,
/// Name of input label columns in training data.
pub input_label_columns: std::vec::Vec<std::string::String>,
/// The data split type for training and evaluation, e.g. RANDOM.
pub data_split_method: crate::model::model::DataSplitMethod,
/// The fraction of evaluation data over the whole input data. The rest
/// of data will be used as training data. The format should be double.
/// Accurate to two decimal places.
/// Default value is 0.2.
pub data_split_eval_fraction: f64,
/// The column to split data with. This column won't be used as a
/// feature.
///
/// 1. When data_split_method is CUSTOM, the corresponding column should
/// be boolean. The rows with true value tag are eval data, and the false
/// are training data.
/// 1. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION
/// rows (from smallest to largest) in the corresponding column are used
/// as training data, and the rest are eval data. It respects the order
/// in Orderable data types:
/// <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data_type_properties>
pub data_split_column: std::string::String,
/// The strategy to determine learn rate for the current iteration.
pub learn_rate_strategy: crate::model::model::LearnRateStrategy,
/// Specifies the initial learning rate for the line search learn rate
/// strategy.
pub initial_learn_rate: f64,
/// Weights associated with each label class, for rebalancing the
/// training data. Only applicable for classification models.
pub label_class_weights: std::collections::HashMap<std::string::String, f64>,
/// User column specified for matrix factorization models.
pub user_column: std::string::String,
/// Item column specified for matrix factorization models.
pub item_column: std::string::String,
/// Distance type for clustering models.
pub distance_type: crate::model::model::DistanceType,
/// Number of clusters for clustering models.
pub num_clusters: i64,
/// Google Cloud Storage URI from which the model was imported. Only
/// applicable for imported models.
pub model_uri: std::string::String,
/// Optimization strategy for training linear regression models.
pub optimization_strategy: crate::model::model::OptimizationStrategy,
/// Hidden units for dnn models.
pub hidden_units: std::vec::Vec<i64>,
/// Batch size for dnn models.
pub batch_size: i64,
/// Dropout probability for dnn models.
pub dropout: std::option::Option<wkt::DoubleValue>,
/// Maximum depth of a tree for boosted tree models.
pub max_tree_depth: i64,
/// Subsample fraction of the training data to grow tree to prevent
/// overfitting for boosted tree models.
pub subsample: f64,
/// Minimum split loss for boosted tree models.
pub min_split_loss: std::option::Option<wkt::DoubleValue>,
/// Booster type for boosted tree models.
pub booster_type: crate::model::model::boosted_tree_option_enums::BoosterType,
/// Number of parallel trees constructed during each iteration for boosted
/// tree models.
pub num_parallel_tree: std::option::Option<wkt::Int64Value>,
/// Type of normalization algorithm for boosted tree models using
/// dart booster.
pub dart_normalize_type:
crate::model::model::boosted_tree_option_enums::DartNormalizeType,
/// Tree construction algorithm for boosted tree models.
pub tree_method: crate::model::model::boosted_tree_option_enums::TreeMethod,
/// Minimum sum of instance weight needed in a child for boosted tree
/// models.
pub min_tree_child_weight: std::option::Option<wkt::Int64Value>,
/// Subsample ratio of columns when constructing each tree for boosted tree
/// models.
pub colsample_bytree: std::option::Option<wkt::DoubleValue>,
/// Subsample ratio of columns for each level for boosted tree models.
pub colsample_bylevel: std::option::Option<wkt::DoubleValue>,
/// Subsample ratio of columns for each node(split) for boosted tree
/// models.
pub colsample_bynode: std::option::Option<wkt::DoubleValue>,
/// Num factors specified for matrix factorization models.
pub num_factors: i64,
/// Feedback type that specifies which algorithm to run for matrix
/// factorization.
pub feedback_type: crate::model::model::FeedbackType,
/// Hyperparameter for matrix factoration when implicit feedback type is
/// specified.
pub wals_alpha: std::option::Option<wkt::DoubleValue>,
/// The method used to initialize the centroids for kmeans algorithm.
pub kmeans_initialization_method:
crate::model::model::kmeans_enums::KmeansInitializationMethod,
/// The column used to provide the initial centroids for kmeans algorithm
/// when kmeans_initialization_method is CUSTOM.
pub kmeans_initialization_column: std::string::String,
/// Column to be designated as time series timestamp for ARIMA model.
pub time_series_timestamp_column: std::string::String,
/// Column to be designated as time series data for ARIMA model.
pub time_series_data_column: std::string::String,
/// Whether to enable auto ARIMA or not.
pub auto_arima: std::option::Option<wkt::BoolValue>,
/// A specification of the non-seasonal part of the ARIMA model: the three
/// components (p, d, q) are the AR order, the degree of differencing, and
/// the MA order.
pub non_seasonal_order: std::option::Option<crate::model::model::ArimaOrder>,
/// The data frequency of a time series.
pub data_frequency: crate::model::model::DataFrequency,
/// Whether or not p-value test should be computed for this model. Only
/// available for linear and logistic regression models.
pub calculate_p_values: std::option::Option<wkt::BoolValue>,
/// Include drift when fitting an ARIMA model.
pub include_drift: std::option::Option<wkt::BoolValue>,
/// The geographical region based on which the holidays are considered in
/// time series modeling. If a valid value is specified, then holiday
/// effects modeling is enabled.
pub holiday_region: crate::model::model::HolidayRegion,
/// A list of geographical regions that are used for time series modeling.
pub holiday_regions: std::vec::Vec<crate::model::model::HolidayRegion>,
/// The time series id column that was used during ARIMA model training.
pub time_series_id_column: std::string::String,
/// The time series id columns that were used during ARIMA model training.
pub time_series_id_columns: std::vec::Vec<std::string::String>,
/// The forecast limit lower bound that was used during ARIMA model
/// training with limits. To see more details of the algorithm:
/// <https://otexts.com/fpp2/limits.html>
pub forecast_limit_lower_bound: f64,
/// The forecast limit upper bound that was used during ARIMA model
/// training with limits.
pub forecast_limit_upper_bound: f64,
/// The number of periods ahead that need to be forecasted.
pub horizon: i64,
/// The max value of the sum of non-seasonal p and q.
pub auto_arima_max_order: i64,
/// The min value of the sum of non-seasonal p and q.
pub auto_arima_min_order: i64,
/// Number of trials to run this hyperparameter tuning job.
pub num_trials: i64,
/// Maximum number of trials to run in parallel.
pub max_parallel_trials: i64,
/// The target evaluation metrics to optimize the hyperparameters for.
pub hparam_tuning_objectives:
std::vec::Vec<crate::model::model::hparam_tuning_enums::HparamTuningObjective>,
/// If true, perform decompose time series and save the results.
pub decompose_time_series: std::option::Option<wkt::BoolValue>,
/// If true, clean spikes and dips in the input time series.
pub clean_spikes_and_dips: std::option::Option<wkt::BoolValue>,
/// If true, detect step changes and make data adjustment in the input time
/// series.
pub adjust_step_changes: std::option::Option<wkt::BoolValue>,
/// If true, enable global explanation during training.
pub enable_global_explain: std::option::Option<wkt::BoolValue>,
/// Number of paths for the sampled Shapley explain method.
pub sampled_shapley_num_paths: i64,
/// Number of integral steps for the integrated gradients explain method.
pub integrated_gradients_num_steps: i64,
/// Categorical feature encoding method.
pub category_encoding_method:
crate::model::model::category_encoding_method::EncodingMethod,
/// Based on the selected TF version, the corresponding docker image is
/// used to train external models.
pub tf_version: std::string::String,
/// Enums for color space, used for processing images in Object Table.
/// See more details at
/// <https://www.tensorflow.org/io/tutorials/colorspace>.
pub color_space: crate::model::model::ColorSpace,
/// Name of the instance weight column for training data.
/// This column isn't be used as a feature.
pub instance_weight_column: std::string::String,
/// Smoothing window size for the trend component. When a positive value is
/// specified, a center moving average smoothing is applied on the history
/// trend. When the smoothing window is out of the boundary at the
/// beginning or the end of the trend, the first element or the last
/// element is padded to fill the smoothing window before the average is
/// applied.
pub trend_smoothing_window_size: i64,
/// The fraction of the interpolated length of the time series that's used
/// to model the time series trend component. All of the time points of the
/// time series are used to model the non-trend component. This training
/// option accelerates modeling training without sacrificing much
/// forecasting accuracy. You can use this option with
/// `minTimeSeriesLength` but not with `maxTimeSeriesLength`.
pub time_series_length_fraction: f64,
/// The minimum number of time points in a time series that are used in
/// modeling the trend component of the time series. If you use this option
/// you must also set the `timeSeriesLengthFraction` option. This training
/// option ensures that enough time points are available when you use
/// `timeSeriesLengthFraction` in trend modeling. This is particularly
/// important when forecasting multiple time series in a single query using
/// `timeSeriesIdColumn`. If the total number of time points is less than
/// the `minTimeSeriesLength` value, then the query uses all available time
/// points.
pub min_time_series_length: i64,
/// The maximum number of time points in a time series that can be used in
/// modeling the trend component of the time series. Don't use this option
/// with the `timeSeriesLengthFraction` or `minTimeSeriesLength` options.
pub max_time_series_length: i64,
/// User-selected XGBoost versions for training of XGBoost models.
pub xgboost_version: std::string::String,
/// Whether to use approximate feature contribution method in XGBoost model
/// explanation for global explain.
pub approx_global_feature_contrib: std::option::Option<wkt::BoolValue>,
/// Whether the model should include intercept during model training.
pub fit_intercept: std::option::Option<wkt::BoolValue>,
/// Number of principal components to keep in the PCA model. Must be <= the
/// number of features.
pub num_principal_components: i64,
/// The minimum ratio of cumulative explained variance that needs to be
/// given by the PCA model.
pub pca_explained_variance_ratio: f64,
/// If true, scale the feature values by dividing the feature standard
/// deviation. Currently only apply to PCA.
pub scale_features: std::option::Option<wkt::BoolValue>,
/// The solver for PCA.
pub pca_solver: crate::model::model::pca_solver_option_enums::PcaSolver,
/// Whether to calculate class weights automatically based on the
/// popularity of each label.
pub auto_class_weights: std::option::Option<wkt::BoolValue>,
/// Activation function of the neural nets.
pub activation_fn: std::string::String,
/// Optimizer used for training the neural nets.
pub optimizer: std::string::String,
/// Budget in hours for AutoML training.
pub budget_hours: f64,
/// Whether to standardize numerical features. Default to true.
pub standardize_features: std::option::Option<wkt::BoolValue>,
/// L1 regularization coefficient to activations.
pub l1_reg_activation: f64,
/// The model registry.
pub model_registry: crate::model::model::model_registry_option_enums::ModelRegistry,
/// The version aliases to apply in Vertex AI model registry. Always
/// overwrite if the version aliases exists in a existing model.
pub vertex_ai_model_version_aliases: std::vec::Vec<std::string::String>,
/// Optional. Names of the columns to slice on. Applies to contribution
/// analysis models.
pub dimension_id_columns: std::vec::Vec<std::string::String>,
/// The contribution metric. Applies to contribution analysis models.
/// Allowed formats supported are for summable and summable ratio
/// contribution metrics. These include expressions such as `SUM(x)` or
/// `SUM(x)/SUM(y)`, where x and y are column names from the base table.
pub contribution_metric: std::option::Option<std::string::String>,
/// Name of the column used to determine the rows corresponding to control
/// and test. Applies to contribution analysis models.
pub is_test_column: std::option::Option<std::string::String>,
/// The apriori support minimum. Applies to contribution analysis models.
pub min_apriori_support: std::option::Option<f64>,
/// The idle TTL of the endpoint before the resources get destroyed. The
/// default value is 6.5 hours.
pub endpoint_idle_ttl: std::option::Option<wkt::Duration>,
/// The type of the machine used to deploy and serve the model.
pub machine_type: std::option::Option<std::string::String>,
/// The minimum number of machine replicas that will be always deployed on
/// an endpoint. This value must be greater than or equal to 1. The default
/// value is 1.
pub min_replica_count: std::option::Option<i64>,
/// The maximum number of machine replicas that will be deployed on an
/// endpoint. The default value is equal to min_replica_count.
pub max_replica_count: std::option::Option<i64>,
/// Specifies the reservation affinity type used to configure a Vertex AI
/// resource. The default value is `NO_RESERVATION`.
pub reservation_affinity_type: std::option::Option<
crate::model::model::training_run::training_options::ReservationAffinityType,
>,
/// Corresponds to the label key of a reservation resource used by Vertex
/// AI. To target a SPECIFIC_RESERVATION by name, use
/// `compute.googleapis.com/reservation-name` as the key and specify the
/// name of your reservation as its value.
pub reservation_affinity_key: std::option::Option<std::string::String>,
/// Corresponds to the label values of a reservation resource used by
/// Vertex AI. This must be the full resource name of the reservation or
/// reservation block.
pub reservation_affinity_values: std::vec::Vec<std::string::String>,
/// The id that uniquely identifies an external model.
pub external_model_id: std::option::Option<
crate::model::model::training_run::training_options::ExternalModelId,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TrainingOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [max_iterations][crate::model::model::training_run::TrainingOptions::max_iterations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_max_iterations(42);
/// ```
pub fn set_max_iterations<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_iterations = v.into();
self
}
/// Sets the value of [loss_type][crate::model::model::training_run::TrainingOptions::loss_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::LossType;
/// let x0 = TrainingOptions::new().set_loss_type(LossType::MeanSquaredLoss);
/// let x1 = TrainingOptions::new().set_loss_type(LossType::MeanLogLoss);
/// ```
pub fn set_loss_type<T: std::convert::Into<crate::model::model::LossType>>(
mut self,
v: T,
) -> Self {
self.loss_type = v.into();
self
}
/// Sets the value of [learn_rate][crate::model::model::training_run::TrainingOptions::learn_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_learn_rate(42.0);
/// ```
pub fn set_learn_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.learn_rate = v.into();
self
}
/// Sets the value of [l1_regularization][crate::model::model::training_run::TrainingOptions::l1_regularization].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_l1_regularization(DoubleValue::default()/* use setters */);
/// ```
pub fn set_l1_regularization<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.l1_regularization = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [l1_regularization][crate::model::model::training_run::TrainingOptions::l1_regularization].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_l1_regularization(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_l1_regularization(None::<DoubleValue>);
/// ```
pub fn set_or_clear_l1_regularization<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.l1_regularization = v.map(|x| x.into());
self
}
/// Sets the value of [l2_regularization][crate::model::model::training_run::TrainingOptions::l2_regularization].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_l2_regularization(DoubleValue::default()/* use setters */);
/// ```
pub fn set_l2_regularization<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.l2_regularization = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [l2_regularization][crate::model::model::training_run::TrainingOptions::l2_regularization].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_l2_regularization(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_l2_regularization(None::<DoubleValue>);
/// ```
pub fn set_or_clear_l2_regularization<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.l2_regularization = v.map(|x| x.into());
self
}
/// Sets the value of [min_relative_progress][crate::model::model::training_run::TrainingOptions::min_relative_progress].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_min_relative_progress(DoubleValue::default()/* use setters */);
/// ```
pub fn set_min_relative_progress<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min_relative_progress = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_relative_progress][crate::model::model::training_run::TrainingOptions::min_relative_progress].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_min_relative_progress(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_min_relative_progress(None::<DoubleValue>);
/// ```
pub fn set_or_clear_min_relative_progress<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min_relative_progress = v.map(|x| x.into());
self
}
/// Sets the value of [warm_start][crate::model::model::training_run::TrainingOptions::warm_start].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_warm_start(BoolValue::default()/* use setters */);
/// ```
pub fn set_warm_start<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.warm_start = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [warm_start][crate::model::model::training_run::TrainingOptions::warm_start].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_warm_start(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_warm_start(None::<BoolValue>);
/// ```
pub fn set_or_clear_warm_start<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.warm_start = v.map(|x| x.into());
self
}
/// Sets the value of [early_stop][crate::model::model::training_run::TrainingOptions::early_stop].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_early_stop(BoolValue::default()/* use setters */);
/// ```
pub fn set_early_stop<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.early_stop = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [early_stop][crate::model::model::training_run::TrainingOptions::early_stop].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_early_stop(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_early_stop(None::<BoolValue>);
/// ```
pub fn set_or_clear_early_stop<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.early_stop = v.map(|x| x.into());
self
}
/// Sets the value of [input_label_columns][crate::model::model::training_run::TrainingOptions::input_label_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_input_label_columns(["a", "b", "c"]);
/// ```
pub fn set_input_label_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.input_label_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [data_split_method][crate::model::model::training_run::TrainingOptions::data_split_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::DataSplitMethod;
/// let x0 = TrainingOptions::new().set_data_split_method(DataSplitMethod::Random);
/// let x1 = TrainingOptions::new().set_data_split_method(DataSplitMethod::Custom);
/// let x2 = TrainingOptions::new().set_data_split_method(DataSplitMethod::Sequential);
/// ```
pub fn set_data_split_method<
T: std::convert::Into<crate::model::model::DataSplitMethod>,
>(
mut self,
v: T,
) -> Self {
self.data_split_method = v.into();
self
}
/// Sets the value of [data_split_eval_fraction][crate::model::model::training_run::TrainingOptions::data_split_eval_fraction].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_data_split_eval_fraction(42.0);
/// ```
pub fn set_data_split_eval_fraction<T: std::convert::Into<f64>>(
mut self,
v: T,
) -> Self {
self.data_split_eval_fraction = v.into();
self
}
/// Sets the value of [data_split_column][crate::model::model::training_run::TrainingOptions::data_split_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_data_split_column("example");
/// ```
pub fn set_data_split_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.data_split_column = v.into();
self
}
/// Sets the value of [learn_rate_strategy][crate::model::model::training_run::TrainingOptions::learn_rate_strategy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::LearnRateStrategy;
/// let x0 = TrainingOptions::new().set_learn_rate_strategy(LearnRateStrategy::LineSearch);
/// let x1 = TrainingOptions::new().set_learn_rate_strategy(LearnRateStrategy::Constant);
/// ```
pub fn set_learn_rate_strategy<
T: std::convert::Into<crate::model::model::LearnRateStrategy>,
>(
mut self,
v: T,
) -> Self {
self.learn_rate_strategy = v.into();
self
}
/// Sets the value of [initial_learn_rate][crate::model::model::training_run::TrainingOptions::initial_learn_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_initial_learn_rate(42.0);
/// ```
pub fn set_initial_learn_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.initial_learn_rate = v.into();
self
}
/// Sets the value of [label_class_weights][crate::model::model::training_run::TrainingOptions::label_class_weights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_label_class_weights([
/// ("key0", 123.5),
/// ("key1", 456.5),
/// ]);
/// ```
pub fn set_label_class_weights<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<f64>,
{
use std::iter::Iterator;
self.label_class_weights =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [user_column][crate::model::model::training_run::TrainingOptions::user_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_user_column("example");
/// ```
pub fn set_user_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.user_column = v.into();
self
}
/// Sets the value of [item_column][crate::model::model::training_run::TrainingOptions::item_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_item_column("example");
/// ```
pub fn set_item_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.item_column = v.into();
self
}
/// Sets the value of [distance_type][crate::model::model::training_run::TrainingOptions::distance_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::DistanceType;
/// let x0 = TrainingOptions::new().set_distance_type(DistanceType::Euclidean);
/// let x1 = TrainingOptions::new().set_distance_type(DistanceType::Cosine);
/// ```
pub fn set_distance_type<T: std::convert::Into<crate::model::model::DistanceType>>(
mut self,
v: T,
) -> Self {
self.distance_type = v.into();
self
}
/// Sets the value of [num_clusters][crate::model::model::training_run::TrainingOptions::num_clusters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_num_clusters(42);
/// ```
pub fn set_num_clusters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.num_clusters = v.into();
self
}
/// Sets the value of [model_uri][crate::model::model::training_run::TrainingOptions::model_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_model_uri("example");
/// ```
pub fn set_model_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.model_uri = v.into();
self
}
/// Sets the value of [optimization_strategy][crate::model::model::training_run::TrainingOptions::optimization_strategy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::OptimizationStrategy;
/// let x0 = TrainingOptions::new().set_optimization_strategy(OptimizationStrategy::BatchGradientDescent);
/// let x1 = TrainingOptions::new().set_optimization_strategy(OptimizationStrategy::NormalEquation);
/// ```
pub fn set_optimization_strategy<
T: std::convert::Into<crate::model::model::OptimizationStrategy>,
>(
mut self,
v: T,
) -> Self {
self.optimization_strategy = v.into();
self
}
/// Sets the value of [hidden_units][crate::model::model::training_run::TrainingOptions::hidden_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_hidden_units([1, 2, 3]);
/// ```
pub fn set_hidden_units<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i64>,
{
use std::iter::Iterator;
self.hidden_units = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [batch_size][crate::model::model::training_run::TrainingOptions::batch_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_batch_size(42);
/// ```
pub fn set_batch_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.batch_size = v.into();
self
}
/// Sets the value of [dropout][crate::model::model::training_run::TrainingOptions::dropout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_dropout(DoubleValue::default()/* use setters */);
/// ```
pub fn set_dropout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.dropout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dropout][crate::model::model::training_run::TrainingOptions::dropout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_dropout(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_dropout(None::<DoubleValue>);
/// ```
pub fn set_or_clear_dropout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.dropout = v.map(|x| x.into());
self
}
/// Sets the value of [max_tree_depth][crate::model::model::training_run::TrainingOptions::max_tree_depth].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_max_tree_depth(42);
/// ```
pub fn set_max_tree_depth<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_tree_depth = v.into();
self
}
/// Sets the value of [subsample][crate::model::model::training_run::TrainingOptions::subsample].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_subsample(42.0);
/// ```
pub fn set_subsample<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.subsample = v.into();
self
}
/// Sets the value of [min_split_loss][crate::model::model::training_run::TrainingOptions::min_split_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_min_split_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_min_split_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min_split_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_split_loss][crate::model::model::training_run::TrainingOptions::min_split_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_min_split_loss(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_min_split_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_min_split_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min_split_loss = v.map(|x| x.into());
self
}
/// Sets the value of [booster_type][crate::model::model::training_run::TrainingOptions::booster_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::boosted_tree_option_enums::BoosterType;
/// let x0 = TrainingOptions::new().set_booster_type(BoosterType::Gbtree);
/// let x1 = TrainingOptions::new().set_booster_type(BoosterType::Dart);
/// ```
pub fn set_booster_type<
T: std::convert::Into<crate::model::model::boosted_tree_option_enums::BoosterType>,
>(
mut self,
v: T,
) -> Self {
self.booster_type = v.into();
self
}
/// Sets the value of [num_parallel_tree][crate::model::model::training_run::TrainingOptions::num_parallel_tree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Int64Value;
/// let x = TrainingOptions::new().set_num_parallel_tree(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_parallel_tree<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_parallel_tree = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_parallel_tree][crate::model::model::training_run::TrainingOptions::num_parallel_tree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Int64Value;
/// let x = TrainingOptions::new().set_or_clear_num_parallel_tree(Some(Int64Value::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_num_parallel_tree(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_parallel_tree<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_parallel_tree = v.map(|x| x.into());
self
}
/// Sets the value of [dart_normalize_type][crate::model::model::training_run::TrainingOptions::dart_normalize_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::boosted_tree_option_enums::DartNormalizeType;
/// let x0 = TrainingOptions::new().set_dart_normalize_type(DartNormalizeType::Tree);
/// let x1 = TrainingOptions::new().set_dart_normalize_type(DartNormalizeType::Forest);
/// ```
pub fn set_dart_normalize_type<
T: std::convert::Into<
crate::model::model::boosted_tree_option_enums::DartNormalizeType,
>,
>(
mut self,
v: T,
) -> Self {
self.dart_normalize_type = v.into();
self
}
/// Sets the value of [tree_method][crate::model::model::training_run::TrainingOptions::tree_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::boosted_tree_option_enums::TreeMethod;
/// let x0 = TrainingOptions::new().set_tree_method(TreeMethod::Auto);
/// let x1 = TrainingOptions::new().set_tree_method(TreeMethod::Exact);
/// let x2 = TrainingOptions::new().set_tree_method(TreeMethod::Approx);
/// ```
pub fn set_tree_method<
T: std::convert::Into<crate::model::model::boosted_tree_option_enums::TreeMethod>,
>(
mut self,
v: T,
) -> Self {
self.tree_method = v.into();
self
}
/// Sets the value of [min_tree_child_weight][crate::model::model::training_run::TrainingOptions::min_tree_child_weight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Int64Value;
/// let x = TrainingOptions::new().set_min_tree_child_weight(Int64Value::default()/* use setters */);
/// ```
pub fn set_min_tree_child_weight<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.min_tree_child_weight = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_tree_child_weight][crate::model::model::training_run::TrainingOptions::min_tree_child_weight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Int64Value;
/// let x = TrainingOptions::new().set_or_clear_min_tree_child_weight(Some(Int64Value::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_min_tree_child_weight(None::<Int64Value>);
/// ```
pub fn set_or_clear_min_tree_child_weight<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.min_tree_child_weight = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bytree][crate::model::model::training_run::TrainingOptions::colsample_bytree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_colsample_bytree(DoubleValue::default()/* use setters */);
/// ```
pub fn set_colsample_bytree<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bytree = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bytree][crate::model::model::training_run::TrainingOptions::colsample_bytree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_colsample_bytree(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_colsample_bytree(None::<DoubleValue>);
/// ```
pub fn set_or_clear_colsample_bytree<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bytree = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bylevel][crate::model::model::training_run::TrainingOptions::colsample_bylevel].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_colsample_bylevel(DoubleValue::default()/* use setters */);
/// ```
pub fn set_colsample_bylevel<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bylevel = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bylevel][crate::model::model::training_run::TrainingOptions::colsample_bylevel].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_colsample_bylevel(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_colsample_bylevel(None::<DoubleValue>);
/// ```
pub fn set_or_clear_colsample_bylevel<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bylevel = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bynode][crate::model::model::training_run::TrainingOptions::colsample_bynode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_colsample_bynode(DoubleValue::default()/* use setters */);
/// ```
pub fn set_colsample_bynode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bynode = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bynode][crate::model::model::training_run::TrainingOptions::colsample_bynode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_colsample_bynode(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_colsample_bynode(None::<DoubleValue>);
/// ```
pub fn set_or_clear_colsample_bynode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.colsample_bynode = v.map(|x| x.into());
self
}
/// Sets the value of [num_factors][crate::model::model::training_run::TrainingOptions::num_factors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_num_factors(42);
/// ```
pub fn set_num_factors<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.num_factors = v.into();
self
}
/// Sets the value of [feedback_type][crate::model::model::training_run::TrainingOptions::feedback_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::FeedbackType;
/// let x0 = TrainingOptions::new().set_feedback_type(FeedbackType::Implicit);
/// let x1 = TrainingOptions::new().set_feedback_type(FeedbackType::Explicit);
/// ```
pub fn set_feedback_type<T: std::convert::Into<crate::model::model::FeedbackType>>(
mut self,
v: T,
) -> Self {
self.feedback_type = v.into();
self
}
/// Sets the value of [wals_alpha][crate::model::model::training_run::TrainingOptions::wals_alpha].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_wals_alpha(DoubleValue::default()/* use setters */);
/// ```
pub fn set_wals_alpha<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wals_alpha = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wals_alpha][crate::model::model::training_run::TrainingOptions::wals_alpha].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::DoubleValue;
/// let x = TrainingOptions::new().set_or_clear_wals_alpha(Some(DoubleValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_wals_alpha(None::<DoubleValue>);
/// ```
pub fn set_or_clear_wals_alpha<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.wals_alpha = v.map(|x| x.into());
self
}
/// Sets the value of [kmeans_initialization_method][crate::model::model::training_run::TrainingOptions::kmeans_initialization_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::kmeans_enums::KmeansInitializationMethod;
/// let x0 = TrainingOptions::new().set_kmeans_initialization_method(KmeansInitializationMethod::Random);
/// let x1 = TrainingOptions::new().set_kmeans_initialization_method(KmeansInitializationMethod::Custom);
/// let x2 = TrainingOptions::new().set_kmeans_initialization_method(KmeansInitializationMethod::KmeansPlusPlus);
/// ```
pub fn set_kmeans_initialization_method<
T: std::convert::Into<crate::model::model::kmeans_enums::KmeansInitializationMethod>,
>(
mut self,
v: T,
) -> Self {
self.kmeans_initialization_method = v.into();
self
}
/// Sets the value of [kmeans_initialization_column][crate::model::model::training_run::TrainingOptions::kmeans_initialization_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_kmeans_initialization_column("example");
/// ```
pub fn set_kmeans_initialization_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.kmeans_initialization_column = v.into();
self
}
/// Sets the value of [time_series_timestamp_column][crate::model::model::training_run::TrainingOptions::time_series_timestamp_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_time_series_timestamp_column("example");
/// ```
pub fn set_time_series_timestamp_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.time_series_timestamp_column = v.into();
self
}
/// Sets the value of [time_series_data_column][crate::model::model::training_run::TrainingOptions::time_series_data_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_time_series_data_column("example");
/// ```
pub fn set_time_series_data_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.time_series_data_column = v.into();
self
}
/// Sets the value of [auto_arima][crate::model::model::training_run::TrainingOptions::auto_arima].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_auto_arima(BoolValue::default()/* use setters */);
/// ```
pub fn set_auto_arima<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.auto_arima = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [auto_arima][crate::model::model::training_run::TrainingOptions::auto_arima].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_auto_arima(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_auto_arima(None::<BoolValue>);
/// ```
pub fn set_or_clear_auto_arima<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.auto_arima = v.map(|x| x.into());
self
}
/// Sets the value of [non_seasonal_order][crate::model::model::training_run::TrainingOptions::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = TrainingOptions::new().set_non_seasonal_order(ArimaOrder::default()/* use setters */);
/// ```
pub fn set_non_seasonal_order<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [non_seasonal_order][crate::model::model::training_run::TrainingOptions::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = TrainingOptions::new().set_or_clear_non_seasonal_order(Some(ArimaOrder::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_non_seasonal_order(None::<ArimaOrder>);
/// ```
pub fn set_or_clear_non_seasonal_order<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = v.map(|x| x.into());
self
}
/// Sets the value of [data_frequency][crate::model::model::training_run::TrainingOptions::data_frequency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::DataFrequency;
/// let x0 = TrainingOptions::new().set_data_frequency(DataFrequency::AutoFrequency);
/// let x1 = TrainingOptions::new().set_data_frequency(DataFrequency::Yearly);
/// let x2 = TrainingOptions::new().set_data_frequency(DataFrequency::Quarterly);
/// ```
pub fn set_data_frequency<T: std::convert::Into<crate::model::model::DataFrequency>>(
mut self,
v: T,
) -> Self {
self.data_frequency = v.into();
self
}
/// Sets the value of [calculate_p_values][crate::model::model::training_run::TrainingOptions::calculate_p_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_calculate_p_values(BoolValue::default()/* use setters */);
/// ```
pub fn set_calculate_p_values<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.calculate_p_values = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [calculate_p_values][crate::model::model::training_run::TrainingOptions::calculate_p_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_calculate_p_values(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_calculate_p_values(None::<BoolValue>);
/// ```
pub fn set_or_clear_calculate_p_values<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.calculate_p_values = v.map(|x| x.into());
self
}
/// Sets the value of [include_drift][crate::model::model::training_run::TrainingOptions::include_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_include_drift(BoolValue::default()/* use setters */);
/// ```
pub fn set_include_drift<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.include_drift = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [include_drift][crate::model::model::training_run::TrainingOptions::include_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_include_drift(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_include_drift(None::<BoolValue>);
/// ```
pub fn set_or_clear_include_drift<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.include_drift = v.map(|x| x.into());
self
}
/// Sets the value of [holiday_region][crate::model::model::training_run::TrainingOptions::holiday_region].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::HolidayRegion;
/// let x0 = TrainingOptions::new().set_holiday_region(HolidayRegion::Global);
/// let x1 = TrainingOptions::new().set_holiday_region(HolidayRegion::Na);
/// let x2 = TrainingOptions::new().set_holiday_region(HolidayRegion::Japac);
/// ```
pub fn set_holiday_region<T: std::convert::Into<crate::model::model::HolidayRegion>>(
mut self,
v: T,
) -> Self {
self.holiday_region = v.into();
self
}
/// Sets the value of [holiday_regions][crate::model::model::training_run::TrainingOptions::holiday_regions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::HolidayRegion;
/// let x = TrainingOptions::new().set_holiday_regions([
/// HolidayRegion::Global,
/// HolidayRegion::Na,
/// HolidayRegion::Japac,
/// ]);
/// ```
pub fn set_holiday_regions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::HolidayRegion>,
{
use std::iter::Iterator;
self.holiday_regions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [time_series_id_column][crate::model::model::training_run::TrainingOptions::time_series_id_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_time_series_id_column("example");
/// ```
pub fn set_time_series_id_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.time_series_id_column = v.into();
self
}
/// Sets the value of [time_series_id_columns][crate::model::model::training_run::TrainingOptions::time_series_id_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_time_series_id_columns(["a", "b", "c"]);
/// ```
pub fn set_time_series_id_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.time_series_id_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [forecast_limit_lower_bound][crate::model::model::training_run::TrainingOptions::forecast_limit_lower_bound].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_forecast_limit_lower_bound(42.0);
/// ```
pub fn set_forecast_limit_lower_bound<T: std::convert::Into<f64>>(
mut self,
v: T,
) -> Self {
self.forecast_limit_lower_bound = v.into();
self
}
/// Sets the value of [forecast_limit_upper_bound][crate::model::model::training_run::TrainingOptions::forecast_limit_upper_bound].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_forecast_limit_upper_bound(42.0);
/// ```
pub fn set_forecast_limit_upper_bound<T: std::convert::Into<f64>>(
mut self,
v: T,
) -> Self {
self.forecast_limit_upper_bound = v.into();
self
}
/// Sets the value of [horizon][crate::model::model::training_run::TrainingOptions::horizon].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_horizon(42);
/// ```
pub fn set_horizon<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.horizon = v.into();
self
}
/// Sets the value of [auto_arima_max_order][crate::model::model::training_run::TrainingOptions::auto_arima_max_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_auto_arima_max_order(42);
/// ```
pub fn set_auto_arima_max_order<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.auto_arima_max_order = v.into();
self
}
/// Sets the value of [auto_arima_min_order][crate::model::model::training_run::TrainingOptions::auto_arima_min_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_auto_arima_min_order(42);
/// ```
pub fn set_auto_arima_min_order<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.auto_arima_min_order = v.into();
self
}
/// Sets the value of [num_trials][crate::model::model::training_run::TrainingOptions::num_trials].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_num_trials(42);
/// ```
pub fn set_num_trials<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.num_trials = v.into();
self
}
/// Sets the value of [max_parallel_trials][crate::model::model::training_run::TrainingOptions::max_parallel_trials].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_max_parallel_trials(42);
/// ```
pub fn set_max_parallel_trials<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_parallel_trials = v.into();
self
}
/// Sets the value of [hparam_tuning_objectives][crate::model::model::training_run::TrainingOptions::hparam_tuning_objectives].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::hparam_tuning_enums::HparamTuningObjective;
/// let x = TrainingOptions::new().set_hparam_tuning_objectives([
/// HparamTuningObjective::MeanAbsoluteError,
/// HparamTuningObjective::MeanSquaredError,
/// HparamTuningObjective::MeanSquaredLogError,
/// ]);
/// ```
pub fn set_hparam_tuning_objectives<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::hparam_tuning_enums::HparamTuningObjective,
>,
{
use std::iter::Iterator;
self.hparam_tuning_objectives = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [decompose_time_series][crate::model::model::training_run::TrainingOptions::decompose_time_series].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_decompose_time_series(BoolValue::default()/* use setters */);
/// ```
pub fn set_decompose_time_series<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.decompose_time_series = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [decompose_time_series][crate::model::model::training_run::TrainingOptions::decompose_time_series].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_decompose_time_series(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_decompose_time_series(None::<BoolValue>);
/// ```
pub fn set_or_clear_decompose_time_series<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.decompose_time_series = v.map(|x| x.into());
self
}
/// Sets the value of [clean_spikes_and_dips][crate::model::model::training_run::TrainingOptions::clean_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_clean_spikes_and_dips(BoolValue::default()/* use setters */);
/// ```
pub fn set_clean_spikes_and_dips<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.clean_spikes_and_dips = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clean_spikes_and_dips][crate::model::model::training_run::TrainingOptions::clean_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_clean_spikes_and_dips(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_clean_spikes_and_dips(None::<BoolValue>);
/// ```
pub fn set_or_clear_clean_spikes_and_dips<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.clean_spikes_and_dips = v.map(|x| x.into());
self
}
/// Sets the value of [adjust_step_changes][crate::model::model::training_run::TrainingOptions::adjust_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_adjust_step_changes(BoolValue::default()/* use setters */);
/// ```
pub fn set_adjust_step_changes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.adjust_step_changes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [adjust_step_changes][crate::model::model::training_run::TrainingOptions::adjust_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_adjust_step_changes(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_adjust_step_changes(None::<BoolValue>);
/// ```
pub fn set_or_clear_adjust_step_changes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.adjust_step_changes = v.map(|x| x.into());
self
}
/// Sets the value of [enable_global_explain][crate::model::model::training_run::TrainingOptions::enable_global_explain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_enable_global_explain(BoolValue::default()/* use setters */);
/// ```
pub fn set_enable_global_explain<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_global_explain = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [enable_global_explain][crate::model::model::training_run::TrainingOptions::enable_global_explain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_enable_global_explain(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_enable_global_explain(None::<BoolValue>);
/// ```
pub fn set_or_clear_enable_global_explain<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_global_explain = v.map(|x| x.into());
self
}
/// Sets the value of [sampled_shapley_num_paths][crate::model::model::training_run::TrainingOptions::sampled_shapley_num_paths].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_sampled_shapley_num_paths(42);
/// ```
pub fn set_sampled_shapley_num_paths<T: std::convert::Into<i64>>(
mut self,
v: T,
) -> Self {
self.sampled_shapley_num_paths = v.into();
self
}
/// Sets the value of [integrated_gradients_num_steps][crate::model::model::training_run::TrainingOptions::integrated_gradients_num_steps].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_integrated_gradients_num_steps(42);
/// ```
pub fn set_integrated_gradients_num_steps<T: std::convert::Into<i64>>(
mut self,
v: T,
) -> Self {
self.integrated_gradients_num_steps = v.into();
self
}
/// Sets the value of [category_encoding_method][crate::model::model::training_run::TrainingOptions::category_encoding_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::category_encoding_method::EncodingMethod;
/// let x0 = TrainingOptions::new().set_category_encoding_method(EncodingMethod::OneHotEncoding);
/// let x1 = TrainingOptions::new().set_category_encoding_method(EncodingMethod::LabelEncoding);
/// let x2 = TrainingOptions::new().set_category_encoding_method(EncodingMethod::DummyEncoding);
/// ```
pub fn set_category_encoding_method<
T: std::convert::Into<crate::model::model::category_encoding_method::EncodingMethod>,
>(
mut self,
v: T,
) -> Self {
self.category_encoding_method = v.into();
self
}
/// Sets the value of [tf_version][crate::model::model::training_run::TrainingOptions::tf_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_tf_version("example");
/// ```
pub fn set_tf_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.tf_version = v.into();
self
}
/// Sets the value of [color_space][crate::model::model::training_run::TrainingOptions::color_space].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::ColorSpace;
/// let x0 = TrainingOptions::new().set_color_space(ColorSpace::Rgb);
/// let x1 = TrainingOptions::new().set_color_space(ColorSpace::Hsv);
/// let x2 = TrainingOptions::new().set_color_space(ColorSpace::Yiq);
/// ```
pub fn set_color_space<T: std::convert::Into<crate::model::model::ColorSpace>>(
mut self,
v: T,
) -> Self {
self.color_space = v.into();
self
}
/// Sets the value of [instance_weight_column][crate::model::model::training_run::TrainingOptions::instance_weight_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_instance_weight_column("example");
/// ```
pub fn set_instance_weight_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.instance_weight_column = v.into();
self
}
/// Sets the value of [trend_smoothing_window_size][crate::model::model::training_run::TrainingOptions::trend_smoothing_window_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_trend_smoothing_window_size(42);
/// ```
pub fn set_trend_smoothing_window_size<T: std::convert::Into<i64>>(
mut self,
v: T,
) -> Self {
self.trend_smoothing_window_size = v.into();
self
}
/// Sets the value of [time_series_length_fraction][crate::model::model::training_run::TrainingOptions::time_series_length_fraction].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_time_series_length_fraction(42.0);
/// ```
pub fn set_time_series_length_fraction<T: std::convert::Into<f64>>(
mut self,
v: T,
) -> Self {
self.time_series_length_fraction = v.into();
self
}
/// Sets the value of [min_time_series_length][crate::model::model::training_run::TrainingOptions::min_time_series_length].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_min_time_series_length(42);
/// ```
pub fn set_min_time_series_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.min_time_series_length = v.into();
self
}
/// Sets the value of [max_time_series_length][crate::model::model::training_run::TrainingOptions::max_time_series_length].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_max_time_series_length(42);
/// ```
pub fn set_max_time_series_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_time_series_length = v.into();
self
}
/// Sets the value of [xgboost_version][crate::model::model::training_run::TrainingOptions::xgboost_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_xgboost_version("example");
/// ```
pub fn set_xgboost_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.xgboost_version = v.into();
self
}
/// Sets the value of [approx_global_feature_contrib][crate::model::model::training_run::TrainingOptions::approx_global_feature_contrib].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_approx_global_feature_contrib(BoolValue::default()/* use setters */);
/// ```
pub fn set_approx_global_feature_contrib<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.approx_global_feature_contrib = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [approx_global_feature_contrib][crate::model::model::training_run::TrainingOptions::approx_global_feature_contrib].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_approx_global_feature_contrib(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_approx_global_feature_contrib(None::<BoolValue>);
/// ```
pub fn set_or_clear_approx_global_feature_contrib<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.approx_global_feature_contrib = v.map(|x| x.into());
self
}
/// Sets the value of [fit_intercept][crate::model::model::training_run::TrainingOptions::fit_intercept].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_fit_intercept(BoolValue::default()/* use setters */);
/// ```
pub fn set_fit_intercept<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.fit_intercept = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [fit_intercept][crate::model::model::training_run::TrainingOptions::fit_intercept].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_fit_intercept(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_fit_intercept(None::<BoolValue>);
/// ```
pub fn set_or_clear_fit_intercept<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.fit_intercept = v.map(|x| x.into());
self
}
/// Sets the value of [num_principal_components][crate::model::model::training_run::TrainingOptions::num_principal_components].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_num_principal_components(42);
/// ```
pub fn set_num_principal_components<T: std::convert::Into<i64>>(
mut self,
v: T,
) -> Self {
self.num_principal_components = v.into();
self
}
/// Sets the value of [pca_explained_variance_ratio][crate::model::model::training_run::TrainingOptions::pca_explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_pca_explained_variance_ratio(42.0);
/// ```
pub fn set_pca_explained_variance_ratio<T: std::convert::Into<f64>>(
mut self,
v: T,
) -> Self {
self.pca_explained_variance_ratio = v.into();
self
}
/// Sets the value of [scale_features][crate::model::model::training_run::TrainingOptions::scale_features].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_scale_features(BoolValue::default()/* use setters */);
/// ```
pub fn set_scale_features<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.scale_features = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [scale_features][crate::model::model::training_run::TrainingOptions::scale_features].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_scale_features(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_scale_features(None::<BoolValue>);
/// ```
pub fn set_or_clear_scale_features<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.scale_features = v.map(|x| x.into());
self
}
/// Sets the value of [pca_solver][crate::model::model::training_run::TrainingOptions::pca_solver].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::pca_solver_option_enums::PcaSolver;
/// let x0 = TrainingOptions::new().set_pca_solver(PcaSolver::Full);
/// let x1 = TrainingOptions::new().set_pca_solver(PcaSolver::Randomized);
/// let x2 = TrainingOptions::new().set_pca_solver(PcaSolver::Auto);
/// ```
pub fn set_pca_solver<
T: std::convert::Into<crate::model::model::pca_solver_option_enums::PcaSolver>,
>(
mut self,
v: T,
) -> Self {
self.pca_solver = v.into();
self
}
/// Sets the value of [auto_class_weights][crate::model::model::training_run::TrainingOptions::auto_class_weights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_auto_class_weights(BoolValue::default()/* use setters */);
/// ```
pub fn set_auto_class_weights<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.auto_class_weights = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [auto_class_weights][crate::model::model::training_run::TrainingOptions::auto_class_weights].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_auto_class_weights(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_auto_class_weights(None::<BoolValue>);
/// ```
pub fn set_or_clear_auto_class_weights<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.auto_class_weights = v.map(|x| x.into());
self
}
/// Sets the value of [activation_fn][crate::model::model::training_run::TrainingOptions::activation_fn].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_activation_fn("example");
/// ```
pub fn set_activation_fn<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.activation_fn = v.into();
self
}
/// Sets the value of [optimizer][crate::model::model::training_run::TrainingOptions::optimizer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_optimizer("example");
/// ```
pub fn set_optimizer<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.optimizer = v.into();
self
}
/// Sets the value of [budget_hours][crate::model::model::training_run::TrainingOptions::budget_hours].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_budget_hours(42.0);
/// ```
pub fn set_budget_hours<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.budget_hours = v.into();
self
}
/// Sets the value of [standardize_features][crate::model::model::training_run::TrainingOptions::standardize_features].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_standardize_features(BoolValue::default()/* use setters */);
/// ```
pub fn set_standardize_features<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.standardize_features = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [standardize_features][crate::model::model::training_run::TrainingOptions::standardize_features].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::BoolValue;
/// let x = TrainingOptions::new().set_or_clear_standardize_features(Some(BoolValue::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_standardize_features(None::<BoolValue>);
/// ```
pub fn set_or_clear_standardize_features<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.standardize_features = v.map(|x| x.into());
self
}
/// Sets the value of [l1_reg_activation][crate::model::model::training_run::TrainingOptions::l1_reg_activation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_l1_reg_activation(42.0);
/// ```
pub fn set_l1_reg_activation<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.l1_reg_activation = v.into();
self
}
/// Sets the value of [model_registry][crate::model::model::training_run::TrainingOptions::model_registry].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::model_registry_option_enums::ModelRegistry;
/// let x0 = TrainingOptions::new().set_model_registry(ModelRegistry::VertexAi);
/// ```
pub fn set_model_registry<
T: std::convert::Into<crate::model::model::model_registry_option_enums::ModelRegistry>,
>(
mut self,
v: T,
) -> Self {
self.model_registry = v.into();
self
}
/// Sets the value of [vertex_ai_model_version_aliases][crate::model::model::training_run::TrainingOptions::vertex_ai_model_version_aliases].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_vertex_ai_model_version_aliases(["a", "b", "c"]);
/// ```
pub fn set_vertex_ai_model_version_aliases<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.vertex_ai_model_version_aliases = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [dimension_id_columns][crate::model::model::training_run::TrainingOptions::dimension_id_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_dimension_id_columns(["a", "b", "c"]);
/// ```
pub fn set_dimension_id_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.dimension_id_columns = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [contribution_metric][crate::model::model::training_run::TrainingOptions::contribution_metric].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_contribution_metric("example");
/// ```
pub fn set_contribution_metric<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.contribution_metric = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [contribution_metric][crate::model::model::training_run::TrainingOptions::contribution_metric].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_contribution_metric(Some("example"));
/// let x = TrainingOptions::new().set_or_clear_contribution_metric(None::<String>);
/// ```
pub fn set_or_clear_contribution_metric<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.contribution_metric = v.map(|x| x.into());
self
}
/// Sets the value of [is_test_column][crate::model::model::training_run::TrainingOptions::is_test_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_is_test_column("example");
/// ```
pub fn set_is_test_column<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.is_test_column = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_test_column][crate::model::model::training_run::TrainingOptions::is_test_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_is_test_column(Some("example"));
/// let x = TrainingOptions::new().set_or_clear_is_test_column(None::<String>);
/// ```
pub fn set_or_clear_is_test_column<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.is_test_column = v.map(|x| x.into());
self
}
/// Sets the value of [min_apriori_support][crate::model::model::training_run::TrainingOptions::min_apriori_support].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_min_apriori_support(42.0);
/// ```
pub fn set_min_apriori_support<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.min_apriori_support = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_apriori_support][crate::model::model::training_run::TrainingOptions::min_apriori_support].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_min_apriori_support(Some(42.0));
/// let x = TrainingOptions::new().set_or_clear_min_apriori_support(None::<f32>);
/// ```
pub fn set_or_clear_min_apriori_support<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.min_apriori_support = v.map(|x| x.into());
self
}
/// Sets the value of [endpoint_idle_ttl][crate::model::model::training_run::TrainingOptions::endpoint_idle_ttl].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Duration;
/// let x = TrainingOptions::new().set_endpoint_idle_ttl(Duration::default()/* use setters */);
/// ```
pub fn set_endpoint_idle_ttl<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.endpoint_idle_ttl = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpoint_idle_ttl][crate::model::model::training_run::TrainingOptions::endpoint_idle_ttl].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use wkt::Duration;
/// let x = TrainingOptions::new().set_or_clear_endpoint_idle_ttl(Some(Duration::default()/* use setters */));
/// let x = TrainingOptions::new().set_or_clear_endpoint_idle_ttl(None::<Duration>);
/// ```
pub fn set_or_clear_endpoint_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.endpoint_idle_ttl = v.map(|x| x.into());
self
}
/// Sets the value of [machine_type][crate::model::model::training_run::TrainingOptions::machine_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_machine_type("example");
/// ```
pub fn set_machine_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.machine_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [machine_type][crate::model::model::training_run::TrainingOptions::machine_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_machine_type(Some("example"));
/// let x = TrainingOptions::new().set_or_clear_machine_type(None::<String>);
/// ```
pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.machine_type = v.map(|x| x.into());
self
}
/// Sets the value of [min_replica_count][crate::model::model::training_run::TrainingOptions::min_replica_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_min_replica_count(42);
/// ```
pub fn set_min_replica_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.min_replica_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_replica_count][crate::model::model::training_run::TrainingOptions::min_replica_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_min_replica_count(Some(42));
/// let x = TrainingOptions::new().set_or_clear_min_replica_count(None::<i32>);
/// ```
pub fn set_or_clear_min_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.min_replica_count = v.map(|x| x.into());
self
}
/// Sets the value of [max_replica_count][crate::model::model::training_run::TrainingOptions::max_replica_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_max_replica_count(42);
/// ```
pub fn set_max_replica_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.max_replica_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_replica_count][crate::model::model::training_run::TrainingOptions::max_replica_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_max_replica_count(Some(42));
/// let x = TrainingOptions::new().set_or_clear_max_replica_count(None::<i32>);
/// ```
pub fn set_or_clear_max_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.max_replica_count = v.map(|x| x.into());
self
}
/// Sets the value of [reservation_affinity_type][crate::model::model::training_run::TrainingOptions::reservation_affinity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::training_run::training_options::ReservationAffinityType;
/// let x0 = TrainingOptions::new().set_reservation_affinity_type(ReservationAffinityType::NoReservation);
/// let x1 = TrainingOptions::new().set_reservation_affinity_type(ReservationAffinityType::AnyReservation);
/// let x2 = TrainingOptions::new().set_reservation_affinity_type(ReservationAffinityType::SpecificReservation);
/// ```
pub fn set_reservation_affinity_type<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::model::training_run::training_options::ReservationAffinityType>
{
self.reservation_affinity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reservation_affinity_type][crate::model::model::training_run::TrainingOptions::reservation_affinity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::training_run::training_options::ReservationAffinityType;
/// let x0 = TrainingOptions::new().set_or_clear_reservation_affinity_type(Some(ReservationAffinityType::NoReservation));
/// let x1 = TrainingOptions::new().set_or_clear_reservation_affinity_type(Some(ReservationAffinityType::AnyReservation));
/// let x2 = TrainingOptions::new().set_or_clear_reservation_affinity_type(Some(ReservationAffinityType::SpecificReservation));
/// let x_none = TrainingOptions::new().set_or_clear_reservation_affinity_type(None::<ReservationAffinityType>);
/// ```
pub fn set_or_clear_reservation_affinity_type<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::model::training_run::training_options::ReservationAffinityType>
{
self.reservation_affinity_type = v.map(|x| x.into());
self
}
/// Sets the value of [reservation_affinity_key][crate::model::model::training_run::TrainingOptions::reservation_affinity_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_reservation_affinity_key("example");
/// ```
pub fn set_reservation_affinity_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation_affinity_key = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reservation_affinity_key][crate::model::model::training_run::TrainingOptions::reservation_affinity_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_or_clear_reservation_affinity_key(Some("example"));
/// let x = TrainingOptions::new().set_or_clear_reservation_affinity_key(None::<String>);
/// ```
pub fn set_or_clear_reservation_affinity_key<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.reservation_affinity_key = v.map(|x| x.into());
self
}
/// Sets the value of [reservation_affinity_values][crate::model::model::training_run::TrainingOptions::reservation_affinity_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_reservation_affinity_values(["a", "b", "c"]);
/// ```
pub fn set_reservation_affinity_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.reservation_affinity_values = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [external_model_id][crate::model::model::training_run::TrainingOptions::external_model_id].
///
/// Note that all the setters affecting `external_model_id` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// use google_cloud_bigquery_v2::model::model::training_run::training_options::ExternalModelId;
/// let x = TrainingOptions::new().set_external_model_id(Some(ExternalModelId::HuggingFaceModelId("example".to_string())));
/// ```
pub fn set_external_model_id<
T: std::convert::Into<
std::option::Option<
crate::model::model::training_run::training_options::ExternalModelId,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.external_model_id = v.into();
self
}
/// The value of [external_model_id][crate::model::model::training_run::TrainingOptions::external_model_id]
/// if it holds a `HuggingFaceModelId`, `None` if the field is not set or
/// holds a different branch.
pub fn hugging_face_model_id(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.external_model_id.as_ref().and_then(|v| match v {
crate::model::model::training_run::training_options::ExternalModelId::HuggingFaceModelId(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [external_model_id][crate::model::model::training_run::TrainingOptions::external_model_id]
/// to hold a `HuggingFaceModelId`.
///
/// Note that all the setters affecting `external_model_id` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_hugging_face_model_id("example");
/// assert!(x.hugging_face_model_id().is_some());
/// assert!(x.model_garden_model_name().is_none());
/// ```
pub fn set_hugging_face_model_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.external_model_id = std::option::Option::Some(
crate::model::model::training_run::training_options::ExternalModelId::HuggingFaceModelId(
v.into()
)
);
self
}
/// The value of [external_model_id][crate::model::model::training_run::TrainingOptions::external_model_id]
/// if it holds a `ModelGardenModelName`, `None` if the field is not set or
/// holds a different branch.
pub fn model_garden_model_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.external_model_id.as_ref().and_then(|v| match v {
crate::model::model::training_run::training_options::ExternalModelId::ModelGardenModelName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [external_model_id][crate::model::model::training_run::TrainingOptions::external_model_id]
/// to hold a `ModelGardenModelName`.
///
/// Note that all the setters affecting `external_model_id` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = TrainingOptions::new().set_model_garden_model_name("example");
/// assert!(x.model_garden_model_name().is_some());
/// assert!(x.hugging_face_model_id().is_none());
/// ```
pub fn set_model_garden_model_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.external_model_id = std::option::Option::Some(
crate::model::model::training_run::training_options::ExternalModelId::ModelGardenModelName(
v.into()
)
);
self
}
}
impl wkt::message::Message for TrainingOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.TrainingOptions"
}
}
/// Defines additional types related to [TrainingOptions].
pub mod training_options {
#[allow(unused_imports)]
use super::*;
/// Supported reservation affinity types to configure a Vertex AI
/// resource.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReservationAffinityType {
/// Default value.
Unspecified,
/// No reservation.
NoReservation,
/// Any reservation.
AnyReservation,
/// Specific reservation.
SpecificReservation,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ReservationAffinityType::value] or
/// [ReservationAffinityType::name].
UnknownValue(reservation_affinity_type::UnknownValue),
}
#[doc(hidden)]
pub mod reservation_affinity_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ReservationAffinityType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NoReservation => std::option::Option::Some(1),
Self::AnyReservation => std::option::Option::Some(2),
Self::SpecificReservation => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("RESERVATION_AFFINITY_TYPE_UNSPECIFIED")
}
Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
Self::SpecificReservation => {
std::option::Option::Some("SPECIFIC_RESERVATION")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ReservationAffinityType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ReservationAffinityType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ReservationAffinityType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NoReservation,
2 => Self::AnyReservation,
3 => Self::SpecificReservation,
_ => Self::UnknownValue(reservation_affinity_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ReservationAffinityType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESERVATION_AFFINITY_TYPE_UNSPECIFIED" => Self::Unspecified,
"NO_RESERVATION" => Self::NoReservation,
"ANY_RESERVATION" => Self::AnyReservation,
"SPECIFIC_RESERVATION" => Self::SpecificReservation,
_ => Self::UnknownValue(reservation_affinity_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ReservationAffinityType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NoReservation => serializer.serialize_i32(1),
Self::AnyReservation => serializer.serialize_i32(2),
Self::SpecificReservation => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ReservationAffinityType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReservationAffinityType>::new(
".google.cloud.bigquery.v2.Model.TrainingRun.TrainingOptions.ReservationAffinityType"))
}
}
/// The id that uniquely identifies an external model.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ExternalModelId {
/// The id of a Hugging Face model. For example, `google/gemma-2-2b-it`.
HuggingFaceModelId(std::string::String),
/// The name of a Vertex model garden publisher model. Format is
/// `publishers/{publisher}/models/{model}@{optional_version_id}`.
ModelGardenModelName(std::string::String),
}
}
/// Information about a single iteration of the training run.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IterationResult {
/// Index of the iteration, 0 based.
pub index: std::option::Option<wkt::Int32Value>,
/// Time taken to run the iteration in milliseconds.
pub duration_ms: std::option::Option<wkt::Int64Value>,
/// Loss computed on the training data at the end of iteration.
pub training_loss: std::option::Option<wkt::DoubleValue>,
/// Loss computed on the eval data at the end of iteration.
pub eval_loss: std::option::Option<wkt::DoubleValue>,
/// Learn rate used for this iteration.
pub learn_rate: f64,
/// Information about top clusters for clustering models.
pub cluster_infos:
std::vec::Vec<crate::model::model::training_run::iteration_result::ClusterInfo>,
/// Arima result.
pub arima_result: std::option::Option<
crate::model::model::training_run::iteration_result::ArimaResult,
>,
/// The information of the principal components.
pub principal_component_infos: std::vec::Vec<
crate::model::model::training_run::iteration_result::PrincipalComponentInfo,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IterationResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [index][crate::model::model::training_run::IterationResult::index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::Int32Value;
/// let x = IterationResult::new().set_index(Int32Value::default()/* use setters */);
/// ```
pub fn set_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index][crate::model::model::training_run::IterationResult::index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::Int32Value;
/// let x = IterationResult::new().set_or_clear_index(Some(Int32Value::default()/* use setters */));
/// let x = IterationResult::new().set_or_clear_index(None::<Int32Value>);
/// ```
pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.index = v.map(|x| x.into());
self
}
/// Sets the value of [duration_ms][crate::model::model::training_run::IterationResult::duration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::Int64Value;
/// let x = IterationResult::new().set_duration_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_duration_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.duration_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [duration_ms][crate::model::model::training_run::IterationResult::duration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::Int64Value;
/// let x = IterationResult::new().set_or_clear_duration_ms(Some(Int64Value::default()/* use setters */));
/// let x = IterationResult::new().set_or_clear_duration_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_duration_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.duration_ms = v.map(|x| x.into());
self
}
/// Sets the value of [training_loss][crate::model::model::training_run::IterationResult::training_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::DoubleValue;
/// let x = IterationResult::new().set_training_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_training_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.training_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [training_loss][crate::model::model::training_run::IterationResult::training_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::DoubleValue;
/// let x = IterationResult::new().set_or_clear_training_loss(Some(DoubleValue::default()/* use setters */));
/// let x = IterationResult::new().set_or_clear_training_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_training_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.training_loss = v.map(|x| x.into());
self
}
/// Sets the value of [eval_loss][crate::model::model::training_run::IterationResult::eval_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::DoubleValue;
/// let x = IterationResult::new().set_eval_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_eval_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.eval_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [eval_loss][crate::model::model::training_run::IterationResult::eval_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use wkt::DoubleValue;
/// let x = IterationResult::new().set_or_clear_eval_loss(Some(DoubleValue::default()/* use setters */));
/// let x = IterationResult::new().set_or_clear_eval_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_eval_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.eval_loss = v.map(|x| x.into());
self
}
/// Sets the value of [learn_rate][crate::model::model::training_run::IterationResult::learn_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// let x = IterationResult::new().set_learn_rate(42.0);
/// ```
pub fn set_learn_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.learn_rate = v.into();
self
}
/// Sets the value of [cluster_infos][crate::model::model::training_run::IterationResult::cluster_infos].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// let x = IterationResult::new()
/// .set_cluster_infos([
/// ClusterInfo::default()/* use setters */,
/// ClusterInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_cluster_infos<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::training_run::iteration_result::ClusterInfo,
>,
{
use std::iter::Iterator;
self.cluster_infos = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [arima_result][crate::model::model::training_run::IterationResult::arima_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ArimaResult;
/// let x = IterationResult::new().set_arima_result(ArimaResult::default()/* use setters */);
/// ```
pub fn set_arima_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::model::training_run::iteration_result::ArimaResult,
>,
{
self.arima_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [arima_result][crate::model::model::training_run::IterationResult::arima_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ArimaResult;
/// let x = IterationResult::new().set_or_clear_arima_result(Some(ArimaResult::default()/* use setters */));
/// let x = IterationResult::new().set_or_clear_arima_result(None::<ArimaResult>);
/// ```
pub fn set_or_clear_arima_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::model::training_run::iteration_result::ArimaResult,
>,
{
self.arima_result = v.map(|x| x.into());
self
}
/// Sets the value of [principal_component_infos][crate::model::model::training_run::IterationResult::principal_component_infos].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::IterationResult;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// let x = IterationResult::new()
/// .set_principal_component_infos([
/// PrincipalComponentInfo::default()/* use setters */,
/// PrincipalComponentInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_principal_component_infos<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::training_run::iteration_result::PrincipalComponentInfo,
>,
{
use std::iter::Iterator;
self.principal_component_infos = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IterationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult"
}
}
/// Defines additional types related to [IterationResult].
pub mod iteration_result {
#[allow(unused_imports)]
use super::*;
/// Information about a single cluster for clustering model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClusterInfo {
/// Centroid id.
pub centroid_id: i64,
/// Cluster radius, the average distance from centroid
/// to each point assigned to the cluster.
pub cluster_radius: std::option::Option<wkt::DoubleValue>,
/// Cluster size, the total number of points assigned to the cluster.
pub cluster_size: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ClusterInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [centroid_id][crate::model::model::training_run::iteration_result::ClusterInfo::centroid_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// let x = ClusterInfo::new().set_centroid_id(42);
/// ```
pub fn set_centroid_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.centroid_id = v.into();
self
}
/// Sets the value of [cluster_radius][crate::model::model::training_run::iteration_result::ClusterInfo::cluster_radius].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// use wkt::DoubleValue;
/// let x = ClusterInfo::new().set_cluster_radius(DoubleValue::default()/* use setters */);
/// ```
pub fn set_cluster_radius<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.cluster_radius = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cluster_radius][crate::model::model::training_run::iteration_result::ClusterInfo::cluster_radius].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// use wkt::DoubleValue;
/// let x = ClusterInfo::new().set_or_clear_cluster_radius(Some(DoubleValue::default()/* use setters */));
/// let x = ClusterInfo::new().set_or_clear_cluster_radius(None::<DoubleValue>);
/// ```
pub fn set_or_clear_cluster_radius<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.cluster_radius = v.map(|x| x.into());
self
}
/// Sets the value of [cluster_size][crate::model::model::training_run::iteration_result::ClusterInfo::cluster_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// use wkt::Int64Value;
/// let x = ClusterInfo::new().set_cluster_size(Int64Value::default()/* use setters */);
/// ```
pub fn set_cluster_size<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.cluster_size = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cluster_size][crate::model::model::training_run::iteration_result::ClusterInfo::cluster_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ClusterInfo;
/// use wkt::Int64Value;
/// let x = ClusterInfo::new().set_or_clear_cluster_size(Some(Int64Value::default()/* use setters */));
/// let x = ClusterInfo::new().set_or_clear_cluster_size(None::<Int64Value>);
/// ```
pub fn set_or_clear_cluster_size<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.cluster_size = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ClusterInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult.ClusterInfo"
}
}
/// (Auto-)arima fitting result. Wrap everything in ArimaResult for easier
/// refactoring if we want to use model-specific iteration results.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaResult {
/// This message is repeated because there are multiple arima models
/// fitted in auto-arima. For non-auto-arima model, its size is one.
pub arima_model_info: std::vec::Vec<crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo>,
/// Seasonal periods. Repeated because multiple periods are supported for
/// one time series.
pub seasonal_periods: std::vec::Vec<crate::model::model::seasonal_period::SeasonalPeriodType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [arima_model_info][crate::model::model::training_run::iteration_result::ArimaResult::arima_model_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ArimaResult;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// let x = ArimaResult::new()
/// .set_arima_model_info([
/// ArimaModelInfo::default()/* use setters */,
/// ArimaModelInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_arima_model_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo>
{
use std::iter::Iterator;
self.arima_model_info = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [seasonal_periods][crate::model::model::training_run::iteration_result::ArimaResult::seasonal_periods].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::ArimaResult;
/// use google_cloud_bigquery_v2::model::model::seasonal_period::SeasonalPeriodType;
/// let x = ArimaResult::new().set_seasonal_periods([
/// SeasonalPeriodType::NoSeasonality,
/// SeasonalPeriodType::Daily,
/// SeasonalPeriodType::Weekly,
/// ]);
/// ```
pub fn set_seasonal_periods<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::seasonal_period::SeasonalPeriodType>,
{
use std::iter::Iterator;
self.seasonal_periods = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ArimaResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult.ArimaResult"
}
}
/// Defines additional types related to [ArimaResult].
pub mod arima_result {
#[allow(unused_imports)]
use super::*;
/// Arima coefficients.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaCoefficients {
/// Auto-regressive coefficients, an array of double.
pub auto_regressive_coefficients: std::vec::Vec<f64>,
/// Moving-average coefficients, an array of double.
pub moving_average_coefficients: std::vec::Vec<f64>,
/// Intercept coefficient, just a double not an array.
pub intercept_coefficient: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields:
serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaCoefficients {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [auto_regressive_coefficients][crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients::auto_regressive_coefficients].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// let x = ArimaCoefficients::new().set_auto_regressive_coefficients([1.0, 2.0, 3.0]);
/// ```
pub fn set_auto_regressive_coefficients<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<f64>,
{
use std::iter::Iterator;
self.auto_regressive_coefficients =
v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [moving_average_coefficients][crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients::moving_average_coefficients].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// let x = ArimaCoefficients::new().set_moving_average_coefficients([1.0, 2.0, 3.0]);
/// ```
pub fn set_moving_average_coefficients<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<f64>,
{
use std::iter::Iterator;
self.moving_average_coefficients =
v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [intercept_coefficient][crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients::intercept_coefficient].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// use wkt::DoubleValue;
/// let x = ArimaCoefficients::new().set_intercept_coefficient(DoubleValue::default()/* use setters */);
/// ```
pub fn set_intercept_coefficient<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.intercept_coefficient = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [intercept_coefficient][crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients::intercept_coefficient].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// use wkt::DoubleValue;
/// let x = ArimaCoefficients::new().set_or_clear_intercept_coefficient(Some(DoubleValue::default()/* use setters */));
/// let x = ArimaCoefficients::new().set_or_clear_intercept_coefficient(None::<DoubleValue>);
/// ```
pub fn set_or_clear_intercept_coefficient<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.intercept_coefficient = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ArimaCoefficients {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult.ArimaResult.ArimaCoefficients"
}
}
/// Arima model information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArimaModelInfo {
/// Non-seasonal order.
pub non_seasonal_order: std::option::Option<crate::model::model::ArimaOrder>,
/// Arima coefficients.
pub arima_coefficients: std::option::Option<crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients>,
/// Arima fitting metrics.
pub arima_fitting_metrics: std::option::Option<crate::model::model::ArimaFittingMetrics>,
/// Whether Arima model fitted with drift or not. It is always false
/// when d is not 1.
pub has_drift: std::option::Option<wkt::BoolValue>,
/// The time_series_id value for this time series. It will be one of
/// the unique values from the time_series_id_column specified during
/// ARIMA model training. Only present when time_series_id_column
/// training option was used.
pub time_series_id: std::string::String,
/// The tuple of time_series_ids identifying this time series. It will
/// be one of the unique tuples of values present in the
/// time_series_id_columns specified during ARIMA model training. Only
/// present when time_series_id_columns training option was used and
/// the order of values here are same as the order of
/// time_series_id_columns.
pub time_series_ids: std::vec::Vec<std::string::String>,
/// Seasonal periods. Repeated because multiple periods are supported
/// for one time series.
pub seasonal_periods: std::vec::Vec<crate::model::model::seasonal_period::SeasonalPeriodType>,
/// If true, holiday_effect is a part of time series decomposition
/// result.
pub has_holiday_effect: std::option::Option<wkt::BoolValue>,
/// If true, spikes_and_dips is a part of time series decomposition
/// result.
pub has_spikes_and_dips: std::option::Option<wkt::BoolValue>,
/// If true, step_changes is a part of time series decomposition
/// result.
pub has_step_changes: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ArimaModelInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [non_seasonal_order][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = ArimaModelInfo::new().set_non_seasonal_order(ArimaOrder::default()/* use setters */);
/// ```
pub fn set_non_seasonal_order<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [non_seasonal_order][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::non_seasonal_order].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::ArimaOrder;
/// let x = ArimaModelInfo::new().set_or_clear_non_seasonal_order(Some(ArimaOrder::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_non_seasonal_order(None::<ArimaOrder>);
/// ```
pub fn set_or_clear_non_seasonal_order<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::ArimaOrder>,
{
self.non_seasonal_order = v.map(|x| x.into());
self
}
/// Sets the value of [arima_coefficients][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::arima_coefficients].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// let x = ArimaModelInfo::new().set_arima_coefficients(ArimaCoefficients::default()/* use setters */);
/// ```
pub fn set_arima_coefficients<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients>
{
self.arima_coefficients = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [arima_coefficients][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::arima_coefficients].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaCoefficients;
/// let x = ArimaModelInfo::new().set_or_clear_arima_coefficients(Some(ArimaCoefficients::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_arima_coefficients(None::<ArimaCoefficients>);
/// ```
pub fn set_or_clear_arima_coefficients<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::model::training_run::iteration_result::arima_result::ArimaCoefficients>
{
self.arima_coefficients = v.map(|x| x.into());
self
}
/// Sets the value of [arima_fitting_metrics][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::arima_fitting_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// let x = ArimaModelInfo::new().set_arima_fitting_metrics(ArimaFittingMetrics::default()/* use setters */);
/// ```
pub fn set_arima_fitting_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::ArimaFittingMetrics>,
{
self.arima_fitting_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [arima_fitting_metrics][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::arima_fitting_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::ArimaFittingMetrics;
/// let x = ArimaModelInfo::new().set_or_clear_arima_fitting_metrics(Some(ArimaFittingMetrics::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_arima_fitting_metrics(None::<ArimaFittingMetrics>);
/// ```
pub fn set_or_clear_arima_fitting_metrics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::ArimaFittingMetrics>,
{
self.arima_fitting_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [has_drift][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_has_drift(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_drift<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_drift = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_drift][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_drift].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_or_clear_has_drift(Some(BoolValue::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_has_drift(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_drift<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_drift = v.map(|x| x.into());
self
}
/// Sets the value of [time_series_id][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::time_series_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// let x = ArimaModelInfo::new().set_time_series_id("example");
/// ```
pub fn set_time_series_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.time_series_id = v.into();
self
}
/// Sets the value of [time_series_ids][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::time_series_ids].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// let x = ArimaModelInfo::new().set_time_series_ids(["a", "b", "c"]);
/// ```
pub fn set_time_series_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.time_series_ids = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [seasonal_periods][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::seasonal_periods].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use google_cloud_bigquery_v2::model::model::seasonal_period::SeasonalPeriodType;
/// let x = ArimaModelInfo::new().set_seasonal_periods([
/// SeasonalPeriodType::NoSeasonality,
/// SeasonalPeriodType::Daily,
/// SeasonalPeriodType::Weekly,
/// ]);
/// ```
pub fn set_seasonal_periods<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::model::seasonal_period::SeasonalPeriodType,
>,
{
use std::iter::Iterator;
self.seasonal_periods = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [has_holiday_effect][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_holiday_effect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_has_holiday_effect(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_holiday_effect<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_holiday_effect = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_holiday_effect][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_holiday_effect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_or_clear_has_holiday_effect(Some(BoolValue::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_has_holiday_effect(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_holiday_effect<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_holiday_effect = v.map(|x| x.into());
self
}
/// Sets the value of [has_spikes_and_dips][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_has_spikes_and_dips(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_spikes_and_dips<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_spikes_and_dips = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_spikes_and_dips][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_spikes_and_dips].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_or_clear_has_spikes_and_dips(Some(BoolValue::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_has_spikes_and_dips(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_spikes_and_dips<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_spikes_and_dips = v.map(|x| x.into());
self
}
/// Sets the value of [has_step_changes][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_has_step_changes(BoolValue::default()/* use setters */);
/// ```
pub fn set_has_step_changes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_step_changes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [has_step_changes][crate::model::model::training_run::iteration_result::arima_result::ArimaModelInfo::has_step_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::arima_result::ArimaModelInfo;
/// use wkt::BoolValue;
/// let x = ArimaModelInfo::new().set_or_clear_has_step_changes(Some(BoolValue::default()/* use setters */));
/// let x = ArimaModelInfo::new().set_or_clear_has_step_changes(None::<BoolValue>);
/// ```
pub fn set_or_clear_has_step_changes<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.has_step_changes = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ArimaModelInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult.ArimaResult.ArimaModelInfo"
}
}
}
/// Principal component infos, used only for eigen decomposition based
/// models, e.g., PCA. Ordered by explained_variance in the descending
/// order.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrincipalComponentInfo {
/// Id of the principal component.
pub principal_component_id: std::option::Option<wkt::Int64Value>,
/// Explained variance by this principal component, which is simply the
/// eigenvalue.
pub explained_variance: std::option::Option<wkt::DoubleValue>,
/// Explained_variance over the total explained variance.
pub explained_variance_ratio: std::option::Option<wkt::DoubleValue>,
/// The explained_variance is pre-ordered in the descending order to
/// compute the cumulative explained variance ratio.
pub cumulative_explained_variance_ratio: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PrincipalComponentInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [principal_component_id][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::principal_component_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::Int64Value;
/// let x = PrincipalComponentInfo::new().set_principal_component_id(Int64Value::default()/* use setters */);
/// ```
pub fn set_principal_component_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.principal_component_id = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [principal_component_id][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::principal_component_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::Int64Value;
/// let x = PrincipalComponentInfo::new().set_or_clear_principal_component_id(Some(Int64Value::default()/* use setters */));
/// let x = PrincipalComponentInfo::new().set_or_clear_principal_component_id(None::<Int64Value>);
/// ```
pub fn set_or_clear_principal_component_id<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.principal_component_id = v.map(|x| x.into());
self
}
/// Sets the value of [explained_variance][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::explained_variance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_explained_variance(DoubleValue::default()/* use setters */);
/// ```
pub fn set_explained_variance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.explained_variance = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [explained_variance][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::explained_variance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_or_clear_explained_variance(Some(DoubleValue::default()/* use setters */));
/// let x = PrincipalComponentInfo::new().set_or_clear_explained_variance(None::<DoubleValue>);
/// ```
pub fn set_or_clear_explained_variance<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.explained_variance = v.map(|x| x.into());
self
}
/// Sets the value of [explained_variance_ratio][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_explained_variance_ratio(DoubleValue::default()/* use setters */);
/// ```
pub fn set_explained_variance_ratio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.explained_variance_ratio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [explained_variance_ratio][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_or_clear_explained_variance_ratio(Some(DoubleValue::default()/* use setters */));
/// let x = PrincipalComponentInfo::new().set_or_clear_explained_variance_ratio(None::<DoubleValue>);
/// ```
pub fn set_or_clear_explained_variance_ratio<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.explained_variance_ratio = v.map(|x| x.into());
self
}
/// Sets the value of [cumulative_explained_variance_ratio][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::cumulative_explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_cumulative_explained_variance_ratio(DoubleValue::default()/* use setters */);
/// ```
pub fn set_cumulative_explained_variance_ratio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.cumulative_explained_variance_ratio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cumulative_explained_variance_ratio][crate::model::model::training_run::iteration_result::PrincipalComponentInfo::cumulative_explained_variance_ratio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::training_run::iteration_result::PrincipalComponentInfo;
/// use wkt::DoubleValue;
/// let x = PrincipalComponentInfo::new().set_or_clear_cumulative_explained_variance_ratio(Some(DoubleValue::default()/* use setters */));
/// let x = PrincipalComponentInfo::new().set_or_clear_cumulative_explained_variance_ratio(None::<DoubleValue>);
/// ```
pub fn set_or_clear_cumulative_explained_variance_ratio<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.cumulative_explained_variance_ratio = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PrincipalComponentInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.TrainingRun.IterationResult.PrincipalComponentInfo"
}
}
}
}
/// Search space for a double hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DoubleHparamSearchSpace {
/// Search space.
pub search_space:
std::option::Option<crate::model::model::double_hparam_search_space::SearchSpace>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DoubleHparamSearchSpace {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [search_space][crate::model::model::DoubleHparamSearchSpace::search_space].
///
/// Note that all the setters affecting `search_space` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// let x = DoubleHparamSearchSpace::new().set_search_space(Some(
/// google_cloud_bigquery_v2::model::model::double_hparam_search_space::SearchSpace::Range(DoubleRange::default().into())));
/// ```
pub fn set_search_space<
T: std::convert::Into<
std::option::Option<
crate::model::model::double_hparam_search_space::SearchSpace,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = v.into();
self
}
/// The value of [search_space][crate::model::model::DoubleHparamSearchSpace::search_space]
/// if it holds a `Range`, `None` if the field is not set or
/// holds a different branch.
pub fn range(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::double_hparam_search_space::DoubleRange>,
> {
#[allow(unreachable_patterns)]
self.search_space.as_ref().and_then(|v| match v {
crate::model::model::double_hparam_search_space::SearchSpace::Range(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [search_space][crate::model::model::DoubleHparamSearchSpace::search_space]
/// to hold a `Range`.
///
/// Note that all the setters affecting `search_space` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// let x = DoubleHparamSearchSpace::new().set_range(DoubleRange::default()/* use setters */);
/// assert!(x.range().is_some());
/// assert!(x.candidates().is_none());
/// ```
pub fn set_range<
T: std::convert::Into<
std::boxed::Box<crate::model::model::double_hparam_search_space::DoubleRange>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = std::option::Option::Some(
crate::model::model::double_hparam_search_space::SearchSpace::Range(v.into()),
);
self
}
/// The value of [search_space][crate::model::model::DoubleHparamSearchSpace::search_space]
/// if it holds a `Candidates`, `None` if the field is not set or
/// holds a different branch.
pub fn candidates(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::double_hparam_search_space::DoubleCandidates>,
> {
#[allow(unreachable_patterns)]
self.search_space.as_ref().and_then(|v| match v {
crate::model::model::double_hparam_search_space::SearchSpace::Candidates(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [search_space][crate::model::model::DoubleHparamSearchSpace::search_space]
/// to hold a `Candidates`.
///
/// Note that all the setters affecting `search_space` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleCandidates;
/// let x = DoubleHparamSearchSpace::new().set_candidates(DoubleCandidates::default()/* use setters */);
/// assert!(x.candidates().is_some());
/// assert!(x.range().is_none());
/// ```
pub fn set_candidates<
T: std::convert::Into<
std::boxed::Box<
crate::model::model::double_hparam_search_space::DoubleCandidates,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = std::option::Option::Some(
crate::model::model::double_hparam_search_space::SearchSpace::Candidates(v.into()),
);
self
}
}
impl wkt::message::Message for DoubleHparamSearchSpace {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.DoubleHparamSearchSpace"
}
}
/// Defines additional types related to [DoubleHparamSearchSpace].
pub mod double_hparam_search_space {
#[allow(unused_imports)]
use super::*;
/// Range of a double hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DoubleRange {
/// Min value of the double parameter.
pub min: std::option::Option<wkt::DoubleValue>,
/// Max value of the double parameter.
pub max: std::option::Option<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DoubleRange {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [min][crate::model::model::double_hparam_search_space::DoubleRange::min].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// use wkt::DoubleValue;
/// let x = DoubleRange::new().set_min(DoubleValue::default()/* use setters */);
/// ```
pub fn set_min<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min][crate::model::model::double_hparam_search_space::DoubleRange::min].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// use wkt::DoubleValue;
/// let x = DoubleRange::new().set_or_clear_min(Some(DoubleValue::default()/* use setters */));
/// let x = DoubleRange::new().set_or_clear_min(None::<DoubleValue>);
/// ```
pub fn set_or_clear_min<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.min = v.map(|x| x.into());
self
}
/// Sets the value of [max][crate::model::model::double_hparam_search_space::DoubleRange::max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// use wkt::DoubleValue;
/// let x = DoubleRange::new().set_max(DoubleValue::default()/* use setters */);
/// ```
pub fn set_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max][crate::model::model::double_hparam_search_space::DoubleRange::max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleRange;
/// use wkt::DoubleValue;
/// let x = DoubleRange::new().set_or_clear_max(Some(DoubleValue::default()/* use setters */));
/// let x = DoubleRange::new().set_or_clear_max(None::<DoubleValue>);
/// ```
pub fn set_or_clear_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.max = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DoubleRange {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.DoubleHparamSearchSpace.DoubleRange"
}
}
/// Discrete candidates of a double hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DoubleCandidates {
/// Candidates for the double parameter in increasing order.
pub candidates: std::vec::Vec<wkt::DoubleValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DoubleCandidates {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [candidates][crate::model::model::double_hparam_search_space::DoubleCandidates::candidates].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::double_hparam_search_space::DoubleCandidates;
/// use wkt::DoubleValue;
/// let x = DoubleCandidates::new()
/// .set_candidates([
/// DoubleValue::default()/* use setters */,
/// DoubleValue::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_candidates<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::DoubleValue>,
{
use std::iter::Iterator;
self.candidates = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DoubleCandidates {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.DoubleHparamSearchSpace.DoubleCandidates"
}
}
/// Search space.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SearchSpace {
/// Range of the double hyperparameter.
Range(std::boxed::Box<crate::model::model::double_hparam_search_space::DoubleRange>),
/// Candidates of the double hyperparameter.
Candidates(
std::boxed::Box<crate::model::model::double_hparam_search_space::DoubleCandidates>,
),
}
}
/// Search space for an int hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntHparamSearchSpace {
/// Search space.
pub search_space:
std::option::Option<crate::model::model::int_hparam_search_space::SearchSpace>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IntHparamSearchSpace {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [search_space][crate::model::model::IntHparamSearchSpace::search_space].
///
/// Note that all the setters affecting `search_space` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// let x = IntHparamSearchSpace::new().set_search_space(Some(
/// google_cloud_bigquery_v2::model::model::int_hparam_search_space::SearchSpace::Range(IntRange::default().into())));
/// ```
pub fn set_search_space<
T: std::convert::Into<
std::option::Option<crate::model::model::int_hparam_search_space::SearchSpace>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = v.into();
self
}
/// The value of [search_space][crate::model::model::IntHparamSearchSpace::search_space]
/// if it holds a `Range`, `None` if the field is not set or
/// holds a different branch.
pub fn range(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::int_hparam_search_space::IntRange>,
> {
#[allow(unreachable_patterns)]
self.search_space.as_ref().and_then(|v| match v {
crate::model::model::int_hparam_search_space::SearchSpace::Range(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [search_space][crate::model::model::IntHparamSearchSpace::search_space]
/// to hold a `Range`.
///
/// Note that all the setters affecting `search_space` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// let x = IntHparamSearchSpace::new().set_range(IntRange::default()/* use setters */);
/// assert!(x.range().is_some());
/// assert!(x.candidates().is_none());
/// ```
pub fn set_range<
T: std::convert::Into<
std::boxed::Box<crate::model::model::int_hparam_search_space::IntRange>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = std::option::Option::Some(
crate::model::model::int_hparam_search_space::SearchSpace::Range(v.into()),
);
self
}
/// The value of [search_space][crate::model::model::IntHparamSearchSpace::search_space]
/// if it holds a `Candidates`, `None` if the field is not set or
/// holds a different branch.
pub fn candidates(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::model::int_hparam_search_space::IntCandidates>,
> {
#[allow(unreachable_patterns)]
self.search_space.as_ref().and_then(|v| match v {
crate::model::model::int_hparam_search_space::SearchSpace::Candidates(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [search_space][crate::model::model::IntHparamSearchSpace::search_space]
/// to hold a `Candidates`.
///
/// Note that all the setters affecting `search_space` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntCandidates;
/// let x = IntHparamSearchSpace::new().set_candidates(IntCandidates::default()/* use setters */);
/// assert!(x.candidates().is_some());
/// assert!(x.range().is_none());
/// ```
pub fn set_candidates<
T: std::convert::Into<
std::boxed::Box<crate::model::model::int_hparam_search_space::IntCandidates>,
>,
>(
mut self,
v: T,
) -> Self {
self.search_space = std::option::Option::Some(
crate::model::model::int_hparam_search_space::SearchSpace::Candidates(v.into()),
);
self
}
}
impl wkt::message::Message for IntHparamSearchSpace {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.IntHparamSearchSpace"
}
}
/// Defines additional types related to [IntHparamSearchSpace].
pub mod int_hparam_search_space {
#[allow(unused_imports)]
use super::*;
/// Range of an int hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntRange {
/// Min value of the int parameter.
pub min: std::option::Option<wkt::Int64Value>,
/// Max value of the int parameter.
pub max: std::option::Option<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IntRange {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [min][crate::model::model::int_hparam_search_space::IntRange::min].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// use wkt::Int64Value;
/// let x = IntRange::new().set_min(Int64Value::default()/* use setters */);
/// ```
pub fn set_min<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.min = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min][crate::model::model::int_hparam_search_space::IntRange::min].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// use wkt::Int64Value;
/// let x = IntRange::new().set_or_clear_min(Some(Int64Value::default()/* use setters */));
/// let x = IntRange::new().set_or_clear_min(None::<Int64Value>);
/// ```
pub fn set_or_clear_min<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.min = v.map(|x| x.into());
self
}
/// Sets the value of [max][crate::model::model::int_hparam_search_space::IntRange::max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// use wkt::Int64Value;
/// let x = IntRange::new().set_max(Int64Value::default()/* use setters */);
/// ```
pub fn set_max<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.max = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max][crate::model::model::int_hparam_search_space::IntRange::max].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntRange;
/// use wkt::Int64Value;
/// let x = IntRange::new().set_or_clear_max(Some(Int64Value::default()/* use setters */));
/// let x = IntRange::new().set_or_clear_max(None::<Int64Value>);
/// ```
pub fn set_or_clear_max<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.max = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for IntRange {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.IntHparamSearchSpace.IntRange"
}
}
/// Discrete candidates of an int hyperparameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntCandidates {
/// Candidates for the int parameter in increasing order.
pub candidates: std::vec::Vec<wkt::Int64Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IntCandidates {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [candidates][crate::model::model::int_hparam_search_space::IntCandidates::candidates].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_hparam_search_space::IntCandidates;
/// use wkt::Int64Value;
/// let x = IntCandidates::new()
/// .set_candidates([
/// Int64Value::default()/* use setters */,
/// Int64Value::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_candidates<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Int64Value>,
{
use std::iter::Iterator;
self.candidates = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IntCandidates {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.IntHparamSearchSpace.IntCandidates"
}
}
/// Search space.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SearchSpace {
/// Range of the int hyperparameter.
Range(std::boxed::Box<crate::model::model::int_hparam_search_space::IntRange>),
/// Candidates of the int hyperparameter.
Candidates(
std::boxed::Box<crate::model::model::int_hparam_search_space::IntCandidates>,
),
}
}
/// Search space for string and enum.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StringHparamSearchSpace {
/// Canididates for the string or enum parameter in lower case.
pub candidates: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StringHparamSearchSpace {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [candidates][crate::model::model::StringHparamSearchSpace::candidates].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = StringHparamSearchSpace::new().set_candidates(["a", "b", "c"]);
/// ```
pub fn set_candidates<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.candidates = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StringHparamSearchSpace {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.StringHparamSearchSpace"
}
}
/// Search space for int array.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntArrayHparamSearchSpace {
/// Candidates for the int array parameter.
pub candidates: std::vec::Vec<crate::model::model::int_array_hparam_search_space::IntArray>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IntArrayHparamSearchSpace {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [candidates][crate::model::model::IntArrayHparamSearchSpace::candidates].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::IntArrayHparamSearchSpace;
/// use google_cloud_bigquery_v2::model::model::int_array_hparam_search_space::IntArray;
/// let x = IntArrayHparamSearchSpace::new()
/// .set_candidates([
/// IntArray::default()/* use setters */,
/// IntArray::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_candidates<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::model::int_array_hparam_search_space::IntArray>,
{
use std::iter::Iterator;
self.candidates = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IntArrayHparamSearchSpace {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.IntArrayHparamSearchSpace"
}
}
/// Defines additional types related to [IntArrayHparamSearchSpace].
pub mod int_array_hparam_search_space {
#[allow(unused_imports)]
use super::*;
/// An array of int.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntArray {
/// Elements in the int array.
pub elements: std::vec::Vec<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IntArray {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [elements][crate::model::model::int_array_hparam_search_space::IntArray::elements].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::int_array_hparam_search_space::IntArray;
/// let x = IntArray::new().set_elements([1, 2, 3]);
/// ```
pub fn set_elements<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i64>,
{
use std::iter::Iterator;
self.elements = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IntArray {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.IntArrayHparamSearchSpace.IntArray"
}
}
}
/// Hyperparameter search spaces.
/// These should be a subset of training_options.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HparamSearchSpaces {
/// Learning rate of training jobs.
pub learn_rate: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// L1 regularization coefficient.
pub l1_reg: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// L2 regularization coefficient.
pub l2_reg: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Number of clusters for k-means.
pub num_clusters: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Number of latent factors to train on.
pub num_factors: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Hidden units for neural network models.
pub hidden_units: std::option::Option<crate::model::model::IntArrayHparamSearchSpace>,
/// Mini batch sample size.
pub batch_size: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Dropout probability for dnn model training and boosted tree models
/// using dart booster.
pub dropout: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Maximum depth of a tree for boosted tree models.
pub max_tree_depth: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Subsample the training data to grow tree to prevent overfitting for
/// boosted tree models.
pub subsample: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Minimum split loss for boosted tree models.
pub min_split_loss: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Hyperparameter for matrix factoration when implicit feedback type is
/// specified.
pub wals_alpha: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Booster type for boosted tree models.
pub booster_type: std::option::Option<crate::model::model::StringHparamSearchSpace>,
/// Number of parallel trees for boosted tree models.
pub num_parallel_tree: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Dart normalization type for boosted tree models.
pub dart_normalize_type: std::option::Option<crate::model::model::StringHparamSearchSpace>,
/// Tree construction algorithm for boosted tree models.
pub tree_method: std::option::Option<crate::model::model::StringHparamSearchSpace>,
/// Minimum sum of instance weight needed in a child for boosted tree models.
pub min_tree_child_weight: std::option::Option<crate::model::model::IntHparamSearchSpace>,
/// Subsample ratio of columns when constructing each tree for boosted tree
/// models.
pub colsample_bytree: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Subsample ratio of columns for each level for boosted tree models.
pub colsample_bylevel: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Subsample ratio of columns for each node(split) for boosted tree models.
pub colsample_bynode: std::option::Option<crate::model::model::DoubleHparamSearchSpace>,
/// Activation functions of neural network models.
pub activation_fn: std::option::Option<crate::model::model::StringHparamSearchSpace>,
/// Optimizer of TF models.
pub optimizer: std::option::Option<crate::model::model::StringHparamSearchSpace>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HparamSearchSpaces {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [learn_rate][crate::model::model::HparamSearchSpaces::learn_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_learn_rate(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_learn_rate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.learn_rate = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [learn_rate][crate::model::model::HparamSearchSpaces::learn_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_learn_rate(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_learn_rate(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_learn_rate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.learn_rate = v.map(|x| x.into());
self
}
/// Sets the value of [l1_reg][crate::model::model::HparamSearchSpaces::l1_reg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_l1_reg(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_l1_reg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.l1_reg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [l1_reg][crate::model::model::HparamSearchSpaces::l1_reg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_l1_reg(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_l1_reg(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_l1_reg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.l1_reg = v.map(|x| x.into());
self
}
/// Sets the value of [l2_reg][crate::model::model::HparamSearchSpaces::l2_reg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_l2_reg(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_l2_reg<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.l2_reg = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [l2_reg][crate::model::model::HparamSearchSpaces::l2_reg].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_l2_reg(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_l2_reg(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_l2_reg<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.l2_reg = v.map(|x| x.into());
self
}
/// Sets the value of [num_clusters][crate::model::model::HparamSearchSpaces::num_clusters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_num_clusters(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_num_clusters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_clusters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_clusters][crate::model::model::HparamSearchSpaces::num_clusters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_num_clusters(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_num_clusters(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_num_clusters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_clusters = v.map(|x| x.into());
self
}
/// Sets the value of [num_factors][crate::model::model::HparamSearchSpaces::num_factors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_num_factors(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_num_factors<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_factors = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_factors][crate::model::model::HparamSearchSpaces::num_factors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_num_factors(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_num_factors(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_num_factors<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_factors = v.map(|x| x.into());
self
}
/// Sets the value of [hidden_units][crate::model::model::HparamSearchSpaces::hidden_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntArrayHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_hidden_units(IntArrayHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_hidden_units<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntArrayHparamSearchSpace>,
{
self.hidden_units = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hidden_units][crate::model::model::HparamSearchSpaces::hidden_units].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntArrayHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_hidden_units(Some(IntArrayHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_hidden_units(None::<IntArrayHparamSearchSpace>);
/// ```
pub fn set_or_clear_hidden_units<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntArrayHparamSearchSpace>,
{
self.hidden_units = v.map(|x| x.into());
self
}
/// Sets the value of [batch_size][crate::model::model::HparamSearchSpaces::batch_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_batch_size(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_batch_size<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.batch_size = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [batch_size][crate::model::model::HparamSearchSpaces::batch_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_batch_size(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_batch_size(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_batch_size<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.batch_size = v.map(|x| x.into());
self
}
/// Sets the value of [dropout][crate::model::model::HparamSearchSpaces::dropout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_dropout(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_dropout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.dropout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dropout][crate::model::model::HparamSearchSpaces::dropout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_dropout(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_dropout(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_dropout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.dropout = v.map(|x| x.into());
self
}
/// Sets the value of [max_tree_depth][crate::model::model::HparamSearchSpaces::max_tree_depth].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_max_tree_depth(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_max_tree_depth<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.max_tree_depth = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_tree_depth][crate::model::model::HparamSearchSpaces::max_tree_depth].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_max_tree_depth(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_max_tree_depth(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_max_tree_depth<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.max_tree_depth = v.map(|x| x.into());
self
}
/// Sets the value of [subsample][crate::model::model::HparamSearchSpaces::subsample].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_subsample(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_subsample<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.subsample = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [subsample][crate::model::model::HparamSearchSpaces::subsample].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_subsample(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_subsample(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_subsample<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.subsample = v.map(|x| x.into());
self
}
/// Sets the value of [min_split_loss][crate::model::model::HparamSearchSpaces::min_split_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_min_split_loss(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_min_split_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.min_split_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_split_loss][crate::model::model::HparamSearchSpaces::min_split_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_min_split_loss(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_min_split_loss(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_min_split_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.min_split_loss = v.map(|x| x.into());
self
}
/// Sets the value of [wals_alpha][crate::model::model::HparamSearchSpaces::wals_alpha].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_wals_alpha(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_wals_alpha<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.wals_alpha = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [wals_alpha][crate::model::model::HparamSearchSpaces::wals_alpha].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_wals_alpha(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_wals_alpha(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_wals_alpha<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.wals_alpha = v.map(|x| x.into());
self
}
/// Sets the value of [booster_type][crate::model::model::HparamSearchSpaces::booster_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_booster_type(StringHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_booster_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.booster_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [booster_type][crate::model::model::HparamSearchSpaces::booster_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_booster_type(Some(StringHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_booster_type(None::<StringHparamSearchSpace>);
/// ```
pub fn set_or_clear_booster_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.booster_type = v.map(|x| x.into());
self
}
/// Sets the value of [num_parallel_tree][crate::model::model::HparamSearchSpaces::num_parallel_tree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_num_parallel_tree(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_num_parallel_tree<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_parallel_tree = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_parallel_tree][crate::model::model::HparamSearchSpaces::num_parallel_tree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_num_parallel_tree(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_num_parallel_tree(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_num_parallel_tree<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.num_parallel_tree = v.map(|x| x.into());
self
}
/// Sets the value of [dart_normalize_type][crate::model::model::HparamSearchSpaces::dart_normalize_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_dart_normalize_type(StringHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_dart_normalize_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.dart_normalize_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dart_normalize_type][crate::model::model::HparamSearchSpaces::dart_normalize_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_dart_normalize_type(Some(StringHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_dart_normalize_type(None::<StringHparamSearchSpace>);
/// ```
pub fn set_or_clear_dart_normalize_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.dart_normalize_type = v.map(|x| x.into());
self
}
/// Sets the value of [tree_method][crate::model::model::HparamSearchSpaces::tree_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_tree_method(StringHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_tree_method<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.tree_method = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tree_method][crate::model::model::HparamSearchSpaces::tree_method].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_tree_method(Some(StringHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_tree_method(None::<StringHparamSearchSpace>);
/// ```
pub fn set_or_clear_tree_method<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.tree_method = v.map(|x| x.into());
self
}
/// Sets the value of [min_tree_child_weight][crate::model::model::HparamSearchSpaces::min_tree_child_weight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_min_tree_child_weight(IntHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_min_tree_child_weight<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.min_tree_child_weight = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [min_tree_child_weight][crate::model::model::HparamSearchSpaces::min_tree_child_weight].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::IntHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_min_tree_child_weight(Some(IntHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_min_tree_child_weight(None::<IntHparamSearchSpace>);
/// ```
pub fn set_or_clear_min_tree_child_weight<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::IntHparamSearchSpace>,
{
self.min_tree_child_weight = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bytree][crate::model::model::HparamSearchSpaces::colsample_bytree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_colsample_bytree(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_colsample_bytree<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bytree = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bytree][crate::model::model::HparamSearchSpaces::colsample_bytree].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bytree(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bytree(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_colsample_bytree<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bytree = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bylevel][crate::model::model::HparamSearchSpaces::colsample_bylevel].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_colsample_bylevel(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_colsample_bylevel<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bylevel = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bylevel][crate::model::model::HparamSearchSpaces::colsample_bylevel].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bylevel(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bylevel(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_colsample_bylevel<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bylevel = v.map(|x| x.into());
self
}
/// Sets the value of [colsample_bynode][crate::model::model::HparamSearchSpaces::colsample_bynode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_colsample_bynode(DoubleHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_colsample_bynode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bynode = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [colsample_bynode][crate::model::model::HparamSearchSpaces::colsample_bynode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::DoubleHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bynode(Some(DoubleHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_colsample_bynode(None::<DoubleHparamSearchSpace>);
/// ```
pub fn set_or_clear_colsample_bynode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::DoubleHparamSearchSpace>,
{
self.colsample_bynode = v.map(|x| x.into());
self
}
/// Sets the value of [activation_fn][crate::model::model::HparamSearchSpaces::activation_fn].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_activation_fn(StringHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_activation_fn<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.activation_fn = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [activation_fn][crate::model::model::HparamSearchSpaces::activation_fn].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_activation_fn(Some(StringHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_activation_fn(None::<StringHparamSearchSpace>);
/// ```
pub fn set_or_clear_activation_fn<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.activation_fn = v.map(|x| x.into());
self
}
/// Sets the value of [optimizer][crate::model::model::HparamSearchSpaces::optimizer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_optimizer(StringHparamSearchSpace::default()/* use setters */);
/// ```
pub fn set_optimizer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.optimizer = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [optimizer][crate::model::model::HparamSearchSpaces::optimizer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamSearchSpaces;
/// use google_cloud_bigquery_v2::model::model::StringHparamSearchSpace;
/// let x = HparamSearchSpaces::new().set_or_clear_optimizer(Some(StringHparamSearchSpace::default()/* use setters */));
/// let x = HparamSearchSpaces::new().set_or_clear_optimizer(None::<StringHparamSearchSpace>);
/// ```
pub fn set_or_clear_optimizer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::StringHparamSearchSpace>,
{
self.optimizer = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for HparamSearchSpaces {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.HparamSearchSpaces"
}
}
/// Training info of a trial in [hyperparameter
/// tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview)
/// models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HparamTuningTrial {
/// 1-based index of the trial.
pub trial_id: i64,
/// Starting time of the trial.
pub start_time_ms: i64,
/// Ending time of the trial.
pub end_time_ms: i64,
/// The hyperprameters selected for this trial.
pub hparams: std::option::Option<crate::model::model::training_run::TrainingOptions>,
/// Evaluation metrics of this trial calculated on the test data.
/// Empty in Job API.
pub evaluation_metrics: std::option::Option<crate::model::model::EvaluationMetrics>,
/// The status of the trial.
pub status: crate::model::model::hparam_tuning_trial::TrialStatus,
/// Error message for FAILED and INFEASIBLE trial.
pub error_message: std::string::String,
/// Loss computed on the training data at the end of trial.
pub training_loss: std::option::Option<wkt::DoubleValue>,
/// Loss computed on the eval data at the end of trial.
pub eval_loss: std::option::Option<wkt::DoubleValue>,
/// Hyperparameter tuning evaluation metrics of this trial calculated on the
/// eval data. Unlike evaluation_metrics, only the fields corresponding to
/// the hparam_tuning_objectives are set.
pub hparam_tuning_evaluation_metrics:
std::option::Option<crate::model::model::EvaluationMetrics>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HparamTuningTrial {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [trial_id][crate::model::model::HparamTuningTrial::trial_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = HparamTuningTrial::new().set_trial_id(42);
/// ```
pub fn set_trial_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.trial_id = v.into();
self
}
/// Sets the value of [start_time_ms][crate::model::model::HparamTuningTrial::start_time_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = HparamTuningTrial::new().set_start_time_ms(42);
/// ```
pub fn set_start_time_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.start_time_ms = v.into();
self
}
/// Sets the value of [end_time_ms][crate::model::model::HparamTuningTrial::end_time_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = HparamTuningTrial::new().set_end_time_ms(42);
/// ```
pub fn set_end_time_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.end_time_ms = v.into();
self
}
/// Sets the value of [hparams][crate::model::model::HparamTuningTrial::hparams].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = HparamTuningTrial::new().set_hparams(TrainingOptions::default()/* use setters */);
/// ```
pub fn set_hparams<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::training_run::TrainingOptions>,
{
self.hparams = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hparams][crate::model::model::HparamTuningTrial::hparams].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::training_run::TrainingOptions;
/// let x = HparamTuningTrial::new().set_or_clear_hparams(Some(TrainingOptions::default()/* use setters */));
/// let x = HparamTuningTrial::new().set_or_clear_hparams(None::<TrainingOptions>);
/// ```
pub fn set_or_clear_hparams<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::training_run::TrainingOptions>,
{
self.hparams = v.map(|x| x.into());
self
}
/// Sets the value of [evaluation_metrics][crate::model::model::HparamTuningTrial::evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = HparamTuningTrial::new().set_evaluation_metrics(EvaluationMetrics::default()/* use setters */);
/// ```
pub fn set_evaluation_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.evaluation_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluation_metrics][crate::model::model::HparamTuningTrial::evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = HparamTuningTrial::new().set_or_clear_evaluation_metrics(Some(EvaluationMetrics::default()/* use setters */));
/// let x = HparamTuningTrial::new().set_or_clear_evaluation_metrics(None::<EvaluationMetrics>);
/// ```
pub fn set_or_clear_evaluation_metrics<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.evaluation_metrics = v.map(|x| x.into());
self
}
/// Sets the value of [status][crate::model::model::HparamTuningTrial::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::hparam_tuning_trial::TrialStatus;
/// let x0 = HparamTuningTrial::new().set_status(TrialStatus::NotStarted);
/// let x1 = HparamTuningTrial::new().set_status(TrialStatus::Running);
/// let x2 = HparamTuningTrial::new().set_status(TrialStatus::Succeeded);
/// ```
pub fn set_status<
T: std::convert::Into<crate::model::model::hparam_tuning_trial::TrialStatus>,
>(
mut self,
v: T,
) -> Self {
self.status = v.into();
self
}
/// Sets the value of [error_message][crate::model::model::HparamTuningTrial::error_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// let x = HparamTuningTrial::new().set_error_message("example");
/// ```
pub fn set_error_message<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.error_message = v.into();
self
}
/// Sets the value of [training_loss][crate::model::model::HparamTuningTrial::training_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use wkt::DoubleValue;
/// let x = HparamTuningTrial::new().set_training_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_training_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.training_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [training_loss][crate::model::model::HparamTuningTrial::training_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use wkt::DoubleValue;
/// let x = HparamTuningTrial::new().set_or_clear_training_loss(Some(DoubleValue::default()/* use setters */));
/// let x = HparamTuningTrial::new().set_or_clear_training_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_training_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.training_loss = v.map(|x| x.into());
self
}
/// Sets the value of [eval_loss][crate::model::model::HparamTuningTrial::eval_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use wkt::DoubleValue;
/// let x = HparamTuningTrial::new().set_eval_loss(DoubleValue::default()/* use setters */);
/// ```
pub fn set_eval_loss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.eval_loss = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [eval_loss][crate::model::model::HparamTuningTrial::eval_loss].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use wkt::DoubleValue;
/// let x = HparamTuningTrial::new().set_or_clear_eval_loss(Some(DoubleValue::default()/* use setters */));
/// let x = HparamTuningTrial::new().set_or_clear_eval_loss(None::<DoubleValue>);
/// ```
pub fn set_or_clear_eval_loss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::DoubleValue>,
{
self.eval_loss = v.map(|x| x.into());
self
}
/// Sets the value of [hparam_tuning_evaluation_metrics][crate::model::model::HparamTuningTrial::hparam_tuning_evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = HparamTuningTrial::new().set_hparam_tuning_evaluation_metrics(EvaluationMetrics::default()/* use setters */);
/// ```
pub fn set_hparam_tuning_evaluation_metrics<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.hparam_tuning_evaluation_metrics = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hparam_tuning_evaluation_metrics][crate::model::model::HparamTuningTrial::hparam_tuning_evaluation_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::model::HparamTuningTrial;
/// use google_cloud_bigquery_v2::model::model::EvaluationMetrics;
/// let x = HparamTuningTrial::new().set_or_clear_hparam_tuning_evaluation_metrics(Some(EvaluationMetrics::default()/* use setters */));
/// let x = HparamTuningTrial::new().set_or_clear_hparam_tuning_evaluation_metrics(None::<EvaluationMetrics>);
/// ```
pub fn set_or_clear_hparam_tuning_evaluation_metrics<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::model::EvaluationMetrics>,
{
self.hparam_tuning_evaluation_metrics = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for HparamTuningTrial {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Model.HparamTuningTrial"
}
}
/// Defines additional types related to [HparamTuningTrial].
pub mod hparam_tuning_trial {
#[allow(unused_imports)]
use super::*;
/// Current status of the trial.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TrialStatus {
/// Default value.
Unspecified,
/// Scheduled but not started.
NotStarted,
/// Running state.
Running,
/// The trial succeeded.
Succeeded,
/// The trial failed.
Failed,
/// The trial is infeasible due to the invalid params.
Infeasible,
/// Trial stopped early because it's not promising.
StoppedEarly,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TrialStatus::value] or
/// [TrialStatus::name].
UnknownValue(trial_status::UnknownValue),
}
#[doc(hidden)]
pub mod trial_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TrialStatus {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NotStarted => std::option::Option::Some(1),
Self::Running => std::option::Option::Some(2),
Self::Succeeded => std::option::Option::Some(3),
Self::Failed => std::option::Option::Some(4),
Self::Infeasible => std::option::Option::Some(5),
Self::StoppedEarly => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRIAL_STATUS_UNSPECIFIED"),
Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Infeasible => std::option::Option::Some("INFEASIBLE"),
Self::StoppedEarly => std::option::Option::Some("STOPPED_EARLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TrialStatus {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TrialStatus {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TrialStatus {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NotStarted,
2 => Self::Running,
3 => Self::Succeeded,
4 => Self::Failed,
5 => Self::Infeasible,
6 => Self::StoppedEarly,
_ => Self::UnknownValue(trial_status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TrialStatus {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRIAL_STATUS_UNSPECIFIED" => Self::Unspecified,
"NOT_STARTED" => Self::NotStarted,
"RUNNING" => Self::Running,
"SUCCEEDED" => Self::Succeeded,
"FAILED" => Self::Failed,
"INFEASIBLE" => Self::Infeasible,
"STOPPED_EARLY" => Self::StoppedEarly,
_ => Self::UnknownValue(trial_status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TrialStatus {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NotStarted => serializer.serialize_i32(1),
Self::Running => serializer.serialize_i32(2),
Self::Succeeded => serializer.serialize_i32(3),
Self::Failed => serializer.serialize_i32(4),
Self::Infeasible => serializer.serialize_i32(5),
Self::StoppedEarly => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TrialStatus {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrialStatus>::new(
".google.cloud.bigquery.v2.Model.HparamTuningTrial.TrialStatus",
))
}
}
}
/// Indicates the type of the Model.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModelType {
/// Default value.
Unspecified,
/// Linear regression model.
LinearRegression,
/// Logistic regression based classification model.
LogisticRegression,
/// K-means clustering model.
Kmeans,
/// Matrix factorization model.
MatrixFactorization,
/// DNN classifier model.
DnnClassifier,
/// An imported TensorFlow model.
Tensorflow,
/// DNN regressor model.
DnnRegressor,
/// An imported XGBoost model.
Xgboost,
/// Boosted tree regressor model.
BoostedTreeRegressor,
/// Boosted tree classifier model.
BoostedTreeClassifier,
/// ARIMA model.
Arima,
/// AutoML Tables regression model.
AutomlRegressor,
/// AutoML Tables classification model.
AutomlClassifier,
/// Prinpical Component Analysis model.
Pca,
/// Wide-and-deep classifier model.
DnnLinearCombinedClassifier,
/// Wide-and-deep regressor model.
DnnLinearCombinedRegressor,
/// Autoencoder model.
Autoencoder,
/// New name for the ARIMA model.
ArimaPlus,
/// ARIMA with external regressors.
ArimaPlusXreg,
/// Random forest regressor model.
RandomForestRegressor,
/// Random forest classifier model.
RandomForestClassifier,
/// An imported TensorFlow Lite model.
TensorflowLite,
/// An imported ONNX model.
Onnx,
/// Model to capture the columns and logic in the TRANSFORM clause along with
/// statistics useful for ML analytic functions.
TransformOnly,
/// The contribution analysis model.
ContributionAnalysis,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ModelType::value] or
/// [ModelType::name].
UnknownValue(model_type::UnknownValue),
}
#[doc(hidden)]
pub mod model_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ModelType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::LinearRegression => std::option::Option::Some(1),
Self::LogisticRegression => std::option::Option::Some(2),
Self::Kmeans => std::option::Option::Some(3),
Self::MatrixFactorization => std::option::Option::Some(4),
Self::DnnClassifier => std::option::Option::Some(5),
Self::Tensorflow => std::option::Option::Some(6),
Self::DnnRegressor => std::option::Option::Some(7),
Self::Xgboost => std::option::Option::Some(8),
Self::BoostedTreeRegressor => std::option::Option::Some(9),
Self::BoostedTreeClassifier => std::option::Option::Some(10),
Self::Arima => std::option::Option::Some(11),
Self::AutomlRegressor => std::option::Option::Some(12),
Self::AutomlClassifier => std::option::Option::Some(13),
Self::Pca => std::option::Option::Some(14),
Self::DnnLinearCombinedClassifier => std::option::Option::Some(16),
Self::DnnLinearCombinedRegressor => std::option::Option::Some(17),
Self::Autoencoder => std::option::Option::Some(18),
Self::ArimaPlus => std::option::Option::Some(19),
Self::ArimaPlusXreg => std::option::Option::Some(23),
Self::RandomForestRegressor => std::option::Option::Some(24),
Self::RandomForestClassifier => std::option::Option::Some(25),
Self::TensorflowLite => std::option::Option::Some(26),
Self::Onnx => std::option::Option::Some(28),
Self::TransformOnly => std::option::Option::Some(29),
Self::ContributionAnalysis => std::option::Option::Some(37),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
Self::LinearRegression => std::option::Option::Some("LINEAR_REGRESSION"),
Self::LogisticRegression => std::option::Option::Some("LOGISTIC_REGRESSION"),
Self::Kmeans => std::option::Option::Some("KMEANS"),
Self::MatrixFactorization => std::option::Option::Some("MATRIX_FACTORIZATION"),
Self::DnnClassifier => std::option::Option::Some("DNN_CLASSIFIER"),
Self::Tensorflow => std::option::Option::Some("TENSORFLOW"),
Self::DnnRegressor => std::option::Option::Some("DNN_REGRESSOR"),
Self::Xgboost => std::option::Option::Some("XGBOOST"),
Self::BoostedTreeRegressor => std::option::Option::Some("BOOSTED_TREE_REGRESSOR"),
Self::BoostedTreeClassifier => std::option::Option::Some("BOOSTED_TREE_CLASSIFIER"),
Self::Arima => std::option::Option::Some("ARIMA"),
Self::AutomlRegressor => std::option::Option::Some("AUTOML_REGRESSOR"),
Self::AutomlClassifier => std::option::Option::Some("AUTOML_CLASSIFIER"),
Self::Pca => std::option::Option::Some("PCA"),
Self::DnnLinearCombinedClassifier => {
std::option::Option::Some("DNN_LINEAR_COMBINED_CLASSIFIER")
}
Self::DnnLinearCombinedRegressor => {
std::option::Option::Some("DNN_LINEAR_COMBINED_REGRESSOR")
}
Self::Autoencoder => std::option::Option::Some("AUTOENCODER"),
Self::ArimaPlus => std::option::Option::Some("ARIMA_PLUS"),
Self::ArimaPlusXreg => std::option::Option::Some("ARIMA_PLUS_XREG"),
Self::RandomForestRegressor => std::option::Option::Some("RANDOM_FOREST_REGRESSOR"),
Self::RandomForestClassifier => {
std::option::Option::Some("RANDOM_FOREST_CLASSIFIER")
}
Self::TensorflowLite => std::option::Option::Some("TENSORFLOW_LITE"),
Self::Onnx => std::option::Option::Some("ONNX"),
Self::TransformOnly => std::option::Option::Some("TRANSFORM_ONLY"),
Self::ContributionAnalysis => std::option::Option::Some("CONTRIBUTION_ANALYSIS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ModelType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ModelType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ModelType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::LinearRegression,
2 => Self::LogisticRegression,
3 => Self::Kmeans,
4 => Self::MatrixFactorization,
5 => Self::DnnClassifier,
6 => Self::Tensorflow,
7 => Self::DnnRegressor,
8 => Self::Xgboost,
9 => Self::BoostedTreeRegressor,
10 => Self::BoostedTreeClassifier,
11 => Self::Arima,
12 => Self::AutomlRegressor,
13 => Self::AutomlClassifier,
14 => Self::Pca,
16 => Self::DnnLinearCombinedClassifier,
17 => Self::DnnLinearCombinedRegressor,
18 => Self::Autoencoder,
19 => Self::ArimaPlus,
23 => Self::ArimaPlusXreg,
24 => Self::RandomForestRegressor,
25 => Self::RandomForestClassifier,
26 => Self::TensorflowLite,
28 => Self::Onnx,
29 => Self::TransformOnly,
37 => Self::ContributionAnalysis,
_ => Self::UnknownValue(model_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ModelType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
"LINEAR_REGRESSION" => Self::LinearRegression,
"LOGISTIC_REGRESSION" => Self::LogisticRegression,
"KMEANS" => Self::Kmeans,
"MATRIX_FACTORIZATION" => Self::MatrixFactorization,
"DNN_CLASSIFIER" => Self::DnnClassifier,
"TENSORFLOW" => Self::Tensorflow,
"DNN_REGRESSOR" => Self::DnnRegressor,
"XGBOOST" => Self::Xgboost,
"BOOSTED_TREE_REGRESSOR" => Self::BoostedTreeRegressor,
"BOOSTED_TREE_CLASSIFIER" => Self::BoostedTreeClassifier,
"ARIMA" => Self::Arima,
"AUTOML_REGRESSOR" => Self::AutomlRegressor,
"AUTOML_CLASSIFIER" => Self::AutomlClassifier,
"PCA" => Self::Pca,
"DNN_LINEAR_COMBINED_CLASSIFIER" => Self::DnnLinearCombinedClassifier,
"DNN_LINEAR_COMBINED_REGRESSOR" => Self::DnnLinearCombinedRegressor,
"AUTOENCODER" => Self::Autoencoder,
"ARIMA_PLUS" => Self::ArimaPlus,
"ARIMA_PLUS_XREG" => Self::ArimaPlusXreg,
"RANDOM_FOREST_REGRESSOR" => Self::RandomForestRegressor,
"RANDOM_FOREST_CLASSIFIER" => Self::RandomForestClassifier,
"TENSORFLOW_LITE" => Self::TensorflowLite,
"ONNX" => Self::Onnx,
"TRANSFORM_ONLY" => Self::TransformOnly,
"CONTRIBUTION_ANALYSIS" => Self::ContributionAnalysis,
_ => Self::UnknownValue(model_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ModelType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::LinearRegression => serializer.serialize_i32(1),
Self::LogisticRegression => serializer.serialize_i32(2),
Self::Kmeans => serializer.serialize_i32(3),
Self::MatrixFactorization => serializer.serialize_i32(4),
Self::DnnClassifier => serializer.serialize_i32(5),
Self::Tensorflow => serializer.serialize_i32(6),
Self::DnnRegressor => serializer.serialize_i32(7),
Self::Xgboost => serializer.serialize_i32(8),
Self::BoostedTreeRegressor => serializer.serialize_i32(9),
Self::BoostedTreeClassifier => serializer.serialize_i32(10),
Self::Arima => serializer.serialize_i32(11),
Self::AutomlRegressor => serializer.serialize_i32(12),
Self::AutomlClassifier => serializer.serialize_i32(13),
Self::Pca => serializer.serialize_i32(14),
Self::DnnLinearCombinedClassifier => serializer.serialize_i32(16),
Self::DnnLinearCombinedRegressor => serializer.serialize_i32(17),
Self::Autoencoder => serializer.serialize_i32(18),
Self::ArimaPlus => serializer.serialize_i32(19),
Self::ArimaPlusXreg => serializer.serialize_i32(23),
Self::RandomForestRegressor => serializer.serialize_i32(24),
Self::RandomForestClassifier => serializer.serialize_i32(25),
Self::TensorflowLite => serializer.serialize_i32(26),
Self::Onnx => serializer.serialize_i32(28),
Self::TransformOnly => serializer.serialize_i32(29),
Self::ContributionAnalysis => serializer.serialize_i32(37),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ModelType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
".google.cloud.bigquery.v2.Model.ModelType",
))
}
}
/// Loss metric to evaluate model training performance.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LossType {
/// Default value.
Unspecified,
/// Mean squared loss, used for linear regression.
MeanSquaredLoss,
/// Mean log loss, used for logistic regression.
MeanLogLoss,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [LossType::value] or
/// [LossType::name].
UnknownValue(loss_type::UnknownValue),
}
#[doc(hidden)]
pub mod loss_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LossType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::MeanSquaredLoss => std::option::Option::Some(1),
Self::MeanLogLoss => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LOSS_TYPE_UNSPECIFIED"),
Self::MeanSquaredLoss => std::option::Option::Some("MEAN_SQUARED_LOSS"),
Self::MeanLogLoss => std::option::Option::Some("MEAN_LOG_LOSS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LossType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LossType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for LossType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::MeanSquaredLoss,
2 => Self::MeanLogLoss,
_ => Self::UnknownValue(loss_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LossType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LOSS_TYPE_UNSPECIFIED" => Self::Unspecified,
"MEAN_SQUARED_LOSS" => Self::MeanSquaredLoss,
"MEAN_LOG_LOSS" => Self::MeanLogLoss,
_ => Self::UnknownValue(loss_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LossType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::MeanSquaredLoss => serializer.serialize_i32(1),
Self::MeanLogLoss => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LossType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LossType>::new(
".google.cloud.bigquery.v2.Model.LossType",
))
}
}
/// Distance metric used to compute the distance between two points.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DistanceType {
/// Default value.
Unspecified,
/// Eculidean distance.
Euclidean,
/// Cosine distance.
Cosine,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DistanceType::value] or
/// [DistanceType::name].
UnknownValue(distance_type::UnknownValue),
}
#[doc(hidden)]
pub mod distance_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DistanceType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Euclidean => std::option::Option::Some(1),
Self::Cosine => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DISTANCE_TYPE_UNSPECIFIED"),
Self::Euclidean => std::option::Option::Some("EUCLIDEAN"),
Self::Cosine => std::option::Option::Some("COSINE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DistanceType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DistanceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DistanceType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Euclidean,
2 => Self::Cosine,
_ => Self::UnknownValue(distance_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DistanceType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DISTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
"EUCLIDEAN" => Self::Euclidean,
"COSINE" => Self::Cosine,
_ => Self::UnknownValue(distance_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DistanceType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Euclidean => serializer.serialize_i32(1),
Self::Cosine => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DistanceType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DistanceType>::new(
".google.cloud.bigquery.v2.Model.DistanceType",
))
}
}
/// Indicates the method to split input data into multiple tables.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataSplitMethod {
/// Default value.
Unspecified,
/// Splits data randomly.
Random,
/// Splits data with the user provided tags.
Custom,
/// Splits data sequentially.
Sequential,
/// Data split will be skipped.
NoSplit,
/// Splits data automatically: Uses NO_SPLIT if the data size is small.
/// Otherwise uses RANDOM.
AutoSplit,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DataSplitMethod::value] or
/// [DataSplitMethod::name].
UnknownValue(data_split_method::UnknownValue),
}
#[doc(hidden)]
pub mod data_split_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DataSplitMethod {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Random => std::option::Option::Some(1),
Self::Custom => std::option::Option::Some(2),
Self::Sequential => std::option::Option::Some(3),
Self::NoSplit => std::option::Option::Some(4),
Self::AutoSplit => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATA_SPLIT_METHOD_UNSPECIFIED"),
Self::Random => std::option::Option::Some("RANDOM"),
Self::Custom => std::option::Option::Some("CUSTOM"),
Self::Sequential => std::option::Option::Some("SEQUENTIAL"),
Self::NoSplit => std::option::Option::Some("NO_SPLIT"),
Self::AutoSplit => std::option::Option::Some("AUTO_SPLIT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DataSplitMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DataSplitMethod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DataSplitMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Random,
2 => Self::Custom,
3 => Self::Sequential,
4 => Self::NoSplit,
5 => Self::AutoSplit,
_ => Self::UnknownValue(data_split_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DataSplitMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATA_SPLIT_METHOD_UNSPECIFIED" => Self::Unspecified,
"RANDOM" => Self::Random,
"CUSTOM" => Self::Custom,
"SEQUENTIAL" => Self::Sequential,
"NO_SPLIT" => Self::NoSplit,
"AUTO_SPLIT" => Self::AutoSplit,
_ => Self::UnknownValue(data_split_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DataSplitMethod {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Random => serializer.serialize_i32(1),
Self::Custom => serializer.serialize_i32(2),
Self::Sequential => serializer.serialize_i32(3),
Self::NoSplit => serializer.serialize_i32(4),
Self::AutoSplit => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DataSplitMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataSplitMethod>::new(
".google.cloud.bigquery.v2.Model.DataSplitMethod",
))
}
}
/// Type of supported data frequency for time series forecasting models.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataFrequency {
/// Default value.
Unspecified,
/// Automatically inferred from timestamps.
AutoFrequency,
/// Yearly data.
Yearly,
/// Quarterly data.
Quarterly,
/// Monthly data.
Monthly,
/// Weekly data.
Weekly,
/// Daily data.
Daily,
/// Hourly data.
Hourly,
/// Per-minute data.
PerMinute,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DataFrequency::value] or
/// [DataFrequency::name].
UnknownValue(data_frequency::UnknownValue),
}
#[doc(hidden)]
pub mod data_frequency {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DataFrequency {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AutoFrequency => std::option::Option::Some(1),
Self::Yearly => std::option::Option::Some(2),
Self::Quarterly => std::option::Option::Some(3),
Self::Monthly => std::option::Option::Some(4),
Self::Weekly => std::option::Option::Some(5),
Self::Daily => std::option::Option::Some(6),
Self::Hourly => std::option::Option::Some(7),
Self::PerMinute => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATA_FREQUENCY_UNSPECIFIED"),
Self::AutoFrequency => std::option::Option::Some("AUTO_FREQUENCY"),
Self::Yearly => std::option::Option::Some("YEARLY"),
Self::Quarterly => std::option::Option::Some("QUARTERLY"),
Self::Monthly => std::option::Option::Some("MONTHLY"),
Self::Weekly => std::option::Option::Some("WEEKLY"),
Self::Daily => std::option::Option::Some("DAILY"),
Self::Hourly => std::option::Option::Some("HOURLY"),
Self::PerMinute => std::option::Option::Some("PER_MINUTE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DataFrequency {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DataFrequency {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DataFrequency {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AutoFrequency,
2 => Self::Yearly,
3 => Self::Quarterly,
4 => Self::Monthly,
5 => Self::Weekly,
6 => Self::Daily,
7 => Self::Hourly,
8 => Self::PerMinute,
_ => Self::UnknownValue(data_frequency::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DataFrequency {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATA_FREQUENCY_UNSPECIFIED" => Self::Unspecified,
"AUTO_FREQUENCY" => Self::AutoFrequency,
"YEARLY" => Self::Yearly,
"QUARTERLY" => Self::Quarterly,
"MONTHLY" => Self::Monthly,
"WEEKLY" => Self::Weekly,
"DAILY" => Self::Daily,
"HOURLY" => Self::Hourly,
"PER_MINUTE" => Self::PerMinute,
_ => Self::UnknownValue(data_frequency::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DataFrequency {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::AutoFrequency => serializer.serialize_i32(1),
Self::Yearly => serializer.serialize_i32(2),
Self::Quarterly => serializer.serialize_i32(3),
Self::Monthly => serializer.serialize_i32(4),
Self::Weekly => serializer.serialize_i32(5),
Self::Daily => serializer.serialize_i32(6),
Self::Hourly => serializer.serialize_i32(7),
Self::PerMinute => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DataFrequency {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataFrequency>::new(
".google.cloud.bigquery.v2.Model.DataFrequency",
))
}
}
/// Type of supported holiday regions for time series forecasting models.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HolidayRegion {
/// Holiday region unspecified.
Unspecified,
/// Global.
Global,
/// North America.
Na,
/// Japan and Asia Pacific: Korea, Greater China, India, Australia, and New
/// Zealand.
Japac,
/// Europe, the Middle East and Africa.
Emea,
/// Latin America and the Caribbean.
Lac,
/// United Arab Emirates
Ae,
/// Argentina
Ar,
/// Austria
At,
/// Australia
Au,
/// Belgium
Be,
/// Brazil
Br,
/// Canada
Ca,
/// Switzerland
Ch,
/// Chile
Cl,
/// China
Cn,
/// Colombia
Co,
/// Czechoslovakia
Cs,
/// Czech Republic
Cz,
/// Germany
De,
/// Denmark
Dk,
/// Algeria
Dz,
/// Ecuador
Ec,
/// Estonia
Ee,
/// Egypt
Eg,
/// Spain
Es,
/// Finland
Fi,
/// France
Fr,
/// Great Britain (United Kingdom)
Gb,
/// Greece
Gr,
/// Hong Kong
Hk,
/// Hungary
Hu,
/// Indonesia
Id,
/// Ireland
Ie,
/// Israel
Il,
/// India
In,
/// Iran
Ir,
/// Italy
It,
/// Japan
Jp,
/// Korea (South)
Kr,
/// Latvia
Lv,
/// Morocco
Ma,
/// Mexico
Mx,
/// Malaysia
My,
/// Nigeria
Ng,
/// Netherlands
Nl,
/// Norway
No,
/// New Zealand
Nz,
/// Peru
Pe,
/// Philippines
Ph,
/// Pakistan
Pk,
/// Poland
Pl,
/// Portugal
Pt,
/// Romania
Ro,
/// Serbia
Rs,
/// Russian Federation
Ru,
/// Saudi Arabia
Sa,
/// Sweden
Se,
/// Singapore
Sg,
/// Slovenia
Si,
/// Slovakia
Sk,
/// Thailand
Th,
/// Turkey
Tr,
/// Taiwan
Tw,
/// Ukraine
Ua,
/// United States
Us,
/// Venezuela
Ve,
/// Vietnam
Vn,
/// South Africa
Za,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [HolidayRegion::value] or
/// [HolidayRegion::name].
UnknownValue(holiday_region::UnknownValue),
}
#[doc(hidden)]
pub mod holiday_region {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HolidayRegion {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Global => std::option::Option::Some(1),
Self::Na => std::option::Option::Some(2),
Self::Japac => std::option::Option::Some(3),
Self::Emea => std::option::Option::Some(4),
Self::Lac => std::option::Option::Some(5),
Self::Ae => std::option::Option::Some(6),
Self::Ar => std::option::Option::Some(7),
Self::At => std::option::Option::Some(8),
Self::Au => std::option::Option::Some(9),
Self::Be => std::option::Option::Some(10),
Self::Br => std::option::Option::Some(11),
Self::Ca => std::option::Option::Some(12),
Self::Ch => std::option::Option::Some(13),
Self::Cl => std::option::Option::Some(14),
Self::Cn => std::option::Option::Some(15),
Self::Co => std::option::Option::Some(16),
Self::Cs => std::option::Option::Some(17),
Self::Cz => std::option::Option::Some(18),
Self::De => std::option::Option::Some(19),
Self::Dk => std::option::Option::Some(20),
Self::Dz => std::option::Option::Some(21),
Self::Ec => std::option::Option::Some(22),
Self::Ee => std::option::Option::Some(23),
Self::Eg => std::option::Option::Some(24),
Self::Es => std::option::Option::Some(25),
Self::Fi => std::option::Option::Some(26),
Self::Fr => std::option::Option::Some(27),
Self::Gb => std::option::Option::Some(28),
Self::Gr => std::option::Option::Some(29),
Self::Hk => std::option::Option::Some(30),
Self::Hu => std::option::Option::Some(31),
Self::Id => std::option::Option::Some(32),
Self::Ie => std::option::Option::Some(33),
Self::Il => std::option::Option::Some(34),
Self::In => std::option::Option::Some(35),
Self::Ir => std::option::Option::Some(36),
Self::It => std::option::Option::Some(37),
Self::Jp => std::option::Option::Some(38),
Self::Kr => std::option::Option::Some(39),
Self::Lv => std::option::Option::Some(40),
Self::Ma => std::option::Option::Some(41),
Self::Mx => std::option::Option::Some(42),
Self::My => std::option::Option::Some(43),
Self::Ng => std::option::Option::Some(44),
Self::Nl => std::option::Option::Some(45),
Self::No => std::option::Option::Some(46),
Self::Nz => std::option::Option::Some(47),
Self::Pe => std::option::Option::Some(48),
Self::Ph => std::option::Option::Some(49),
Self::Pk => std::option::Option::Some(50),
Self::Pl => std::option::Option::Some(51),
Self::Pt => std::option::Option::Some(52),
Self::Ro => std::option::Option::Some(53),
Self::Rs => std::option::Option::Some(54),
Self::Ru => std::option::Option::Some(55),
Self::Sa => std::option::Option::Some(56),
Self::Se => std::option::Option::Some(57),
Self::Sg => std::option::Option::Some(58),
Self::Si => std::option::Option::Some(59),
Self::Sk => std::option::Option::Some(60),
Self::Th => std::option::Option::Some(61),
Self::Tr => std::option::Option::Some(62),
Self::Tw => std::option::Option::Some(63),
Self::Ua => std::option::Option::Some(64),
Self::Us => std::option::Option::Some(65),
Self::Ve => std::option::Option::Some(66),
Self::Vn => std::option::Option::Some(67),
Self::Za => std::option::Option::Some(68),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("HOLIDAY_REGION_UNSPECIFIED"),
Self::Global => std::option::Option::Some("GLOBAL"),
Self::Na => std::option::Option::Some("NA"),
Self::Japac => std::option::Option::Some("JAPAC"),
Self::Emea => std::option::Option::Some("EMEA"),
Self::Lac => std::option::Option::Some("LAC"),
Self::Ae => std::option::Option::Some("AE"),
Self::Ar => std::option::Option::Some("AR"),
Self::At => std::option::Option::Some("AT"),
Self::Au => std::option::Option::Some("AU"),
Self::Be => std::option::Option::Some("BE"),
Self::Br => std::option::Option::Some("BR"),
Self::Ca => std::option::Option::Some("CA"),
Self::Ch => std::option::Option::Some("CH"),
Self::Cl => std::option::Option::Some("CL"),
Self::Cn => std::option::Option::Some("CN"),
Self::Co => std::option::Option::Some("CO"),
Self::Cs => std::option::Option::Some("CS"),
Self::Cz => std::option::Option::Some("CZ"),
Self::De => std::option::Option::Some("DE"),
Self::Dk => std::option::Option::Some("DK"),
Self::Dz => std::option::Option::Some("DZ"),
Self::Ec => std::option::Option::Some("EC"),
Self::Ee => std::option::Option::Some("EE"),
Self::Eg => std::option::Option::Some("EG"),
Self::Es => std::option::Option::Some("ES"),
Self::Fi => std::option::Option::Some("FI"),
Self::Fr => std::option::Option::Some("FR"),
Self::Gb => std::option::Option::Some("GB"),
Self::Gr => std::option::Option::Some("GR"),
Self::Hk => std::option::Option::Some("HK"),
Self::Hu => std::option::Option::Some("HU"),
Self::Id => std::option::Option::Some("ID"),
Self::Ie => std::option::Option::Some("IE"),
Self::Il => std::option::Option::Some("IL"),
Self::In => std::option::Option::Some("IN"),
Self::Ir => std::option::Option::Some("IR"),
Self::It => std::option::Option::Some("IT"),
Self::Jp => std::option::Option::Some("JP"),
Self::Kr => std::option::Option::Some("KR"),
Self::Lv => std::option::Option::Some("LV"),
Self::Ma => std::option::Option::Some("MA"),
Self::Mx => std::option::Option::Some("MX"),
Self::My => std::option::Option::Some("MY"),
Self::Ng => std::option::Option::Some("NG"),
Self::Nl => std::option::Option::Some("NL"),
Self::No => std::option::Option::Some("NO"),
Self::Nz => std::option::Option::Some("NZ"),
Self::Pe => std::option::Option::Some("PE"),
Self::Ph => std::option::Option::Some("PH"),
Self::Pk => std::option::Option::Some("PK"),
Self::Pl => std::option::Option::Some("PL"),
Self::Pt => std::option::Option::Some("PT"),
Self::Ro => std::option::Option::Some("RO"),
Self::Rs => std::option::Option::Some("RS"),
Self::Ru => std::option::Option::Some("RU"),
Self::Sa => std::option::Option::Some("SA"),
Self::Se => std::option::Option::Some("SE"),
Self::Sg => std::option::Option::Some("SG"),
Self::Si => std::option::Option::Some("SI"),
Self::Sk => std::option::Option::Some("SK"),
Self::Th => std::option::Option::Some("TH"),
Self::Tr => std::option::Option::Some("TR"),
Self::Tw => std::option::Option::Some("TW"),
Self::Ua => std::option::Option::Some("UA"),
Self::Us => std::option::Option::Some("US"),
Self::Ve => std::option::Option::Some("VE"),
Self::Vn => std::option::Option::Some("VN"),
Self::Za => std::option::Option::Some("ZA"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HolidayRegion {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HolidayRegion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for HolidayRegion {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Global,
2 => Self::Na,
3 => Self::Japac,
4 => Self::Emea,
5 => Self::Lac,
6 => Self::Ae,
7 => Self::Ar,
8 => Self::At,
9 => Self::Au,
10 => Self::Be,
11 => Self::Br,
12 => Self::Ca,
13 => Self::Ch,
14 => Self::Cl,
15 => Self::Cn,
16 => Self::Co,
17 => Self::Cs,
18 => Self::Cz,
19 => Self::De,
20 => Self::Dk,
21 => Self::Dz,
22 => Self::Ec,
23 => Self::Ee,
24 => Self::Eg,
25 => Self::Es,
26 => Self::Fi,
27 => Self::Fr,
28 => Self::Gb,
29 => Self::Gr,
30 => Self::Hk,
31 => Self::Hu,
32 => Self::Id,
33 => Self::Ie,
34 => Self::Il,
35 => Self::In,
36 => Self::Ir,
37 => Self::It,
38 => Self::Jp,
39 => Self::Kr,
40 => Self::Lv,
41 => Self::Ma,
42 => Self::Mx,
43 => Self::My,
44 => Self::Ng,
45 => Self::Nl,
46 => Self::No,
47 => Self::Nz,
48 => Self::Pe,
49 => Self::Ph,
50 => Self::Pk,
51 => Self::Pl,
52 => Self::Pt,
53 => Self::Ro,
54 => Self::Rs,
55 => Self::Ru,
56 => Self::Sa,
57 => Self::Se,
58 => Self::Sg,
59 => Self::Si,
60 => Self::Sk,
61 => Self::Th,
62 => Self::Tr,
63 => Self::Tw,
64 => Self::Ua,
65 => Self::Us,
66 => Self::Ve,
67 => Self::Vn,
68 => Self::Za,
_ => Self::UnknownValue(holiday_region::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HolidayRegion {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HOLIDAY_REGION_UNSPECIFIED" => Self::Unspecified,
"GLOBAL" => Self::Global,
"NA" => Self::Na,
"JAPAC" => Self::Japac,
"EMEA" => Self::Emea,
"LAC" => Self::Lac,
"AE" => Self::Ae,
"AR" => Self::Ar,
"AT" => Self::At,
"AU" => Self::Au,
"BE" => Self::Be,
"BR" => Self::Br,
"CA" => Self::Ca,
"CH" => Self::Ch,
"CL" => Self::Cl,
"CN" => Self::Cn,
"CO" => Self::Co,
"CS" => Self::Cs,
"CZ" => Self::Cz,
"DE" => Self::De,
"DK" => Self::Dk,
"DZ" => Self::Dz,
"EC" => Self::Ec,
"EE" => Self::Ee,
"EG" => Self::Eg,
"ES" => Self::Es,
"FI" => Self::Fi,
"FR" => Self::Fr,
"GB" => Self::Gb,
"GR" => Self::Gr,
"HK" => Self::Hk,
"HU" => Self::Hu,
"ID" => Self::Id,
"IE" => Self::Ie,
"IL" => Self::Il,
"IN" => Self::In,
"IR" => Self::Ir,
"IT" => Self::It,
"JP" => Self::Jp,
"KR" => Self::Kr,
"LV" => Self::Lv,
"MA" => Self::Ma,
"MX" => Self::Mx,
"MY" => Self::My,
"NG" => Self::Ng,
"NL" => Self::Nl,
"NO" => Self::No,
"NZ" => Self::Nz,
"PE" => Self::Pe,
"PH" => Self::Ph,
"PK" => Self::Pk,
"PL" => Self::Pl,
"PT" => Self::Pt,
"RO" => Self::Ro,
"RS" => Self::Rs,
"RU" => Self::Ru,
"SA" => Self::Sa,
"SE" => Self::Se,
"SG" => Self::Sg,
"SI" => Self::Si,
"SK" => Self::Sk,
"TH" => Self::Th,
"TR" => Self::Tr,
"TW" => Self::Tw,
"UA" => Self::Ua,
"US" => Self::Us,
"VE" => Self::Ve,
"VN" => Self::Vn,
"ZA" => Self::Za,
_ => Self::UnknownValue(holiday_region::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HolidayRegion {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Global => serializer.serialize_i32(1),
Self::Na => serializer.serialize_i32(2),
Self::Japac => serializer.serialize_i32(3),
Self::Emea => serializer.serialize_i32(4),
Self::Lac => serializer.serialize_i32(5),
Self::Ae => serializer.serialize_i32(6),
Self::Ar => serializer.serialize_i32(7),
Self::At => serializer.serialize_i32(8),
Self::Au => serializer.serialize_i32(9),
Self::Be => serializer.serialize_i32(10),
Self::Br => serializer.serialize_i32(11),
Self::Ca => serializer.serialize_i32(12),
Self::Ch => serializer.serialize_i32(13),
Self::Cl => serializer.serialize_i32(14),
Self::Cn => serializer.serialize_i32(15),
Self::Co => serializer.serialize_i32(16),
Self::Cs => serializer.serialize_i32(17),
Self::Cz => serializer.serialize_i32(18),
Self::De => serializer.serialize_i32(19),
Self::Dk => serializer.serialize_i32(20),
Self::Dz => serializer.serialize_i32(21),
Self::Ec => serializer.serialize_i32(22),
Self::Ee => serializer.serialize_i32(23),
Self::Eg => serializer.serialize_i32(24),
Self::Es => serializer.serialize_i32(25),
Self::Fi => serializer.serialize_i32(26),
Self::Fr => serializer.serialize_i32(27),
Self::Gb => serializer.serialize_i32(28),
Self::Gr => serializer.serialize_i32(29),
Self::Hk => serializer.serialize_i32(30),
Self::Hu => serializer.serialize_i32(31),
Self::Id => serializer.serialize_i32(32),
Self::Ie => serializer.serialize_i32(33),
Self::Il => serializer.serialize_i32(34),
Self::In => serializer.serialize_i32(35),
Self::Ir => serializer.serialize_i32(36),
Self::It => serializer.serialize_i32(37),
Self::Jp => serializer.serialize_i32(38),
Self::Kr => serializer.serialize_i32(39),
Self::Lv => serializer.serialize_i32(40),
Self::Ma => serializer.serialize_i32(41),
Self::Mx => serializer.serialize_i32(42),
Self::My => serializer.serialize_i32(43),
Self::Ng => serializer.serialize_i32(44),
Self::Nl => serializer.serialize_i32(45),
Self::No => serializer.serialize_i32(46),
Self::Nz => serializer.serialize_i32(47),
Self::Pe => serializer.serialize_i32(48),
Self::Ph => serializer.serialize_i32(49),
Self::Pk => serializer.serialize_i32(50),
Self::Pl => serializer.serialize_i32(51),
Self::Pt => serializer.serialize_i32(52),
Self::Ro => serializer.serialize_i32(53),
Self::Rs => serializer.serialize_i32(54),
Self::Ru => serializer.serialize_i32(55),
Self::Sa => serializer.serialize_i32(56),
Self::Se => serializer.serialize_i32(57),
Self::Sg => serializer.serialize_i32(58),
Self::Si => serializer.serialize_i32(59),
Self::Sk => serializer.serialize_i32(60),
Self::Th => serializer.serialize_i32(61),
Self::Tr => serializer.serialize_i32(62),
Self::Tw => serializer.serialize_i32(63),
Self::Ua => serializer.serialize_i32(64),
Self::Us => serializer.serialize_i32(65),
Self::Ve => serializer.serialize_i32(66),
Self::Vn => serializer.serialize_i32(67),
Self::Za => serializer.serialize_i32(68),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HolidayRegion {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HolidayRegion>::new(
".google.cloud.bigquery.v2.Model.HolidayRegion",
))
}
}
/// Enums for color space, used for processing images in Object Table.
/// See more details at
/// <https://www.tensorflow.org/io/tutorials/colorspace>.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ColorSpace {
/// Unspecified color space
Unspecified,
/// RGB
Rgb,
/// HSV
Hsv,
/// YIQ
Yiq,
/// YUV
Yuv,
/// GRAYSCALE
Grayscale,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ColorSpace::value] or
/// [ColorSpace::name].
UnknownValue(color_space::UnknownValue),
}
#[doc(hidden)]
pub mod color_space {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ColorSpace {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Rgb => std::option::Option::Some(1),
Self::Hsv => std::option::Option::Some(2),
Self::Yiq => std::option::Option::Some(3),
Self::Yuv => std::option::Option::Some(4),
Self::Grayscale => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("COLOR_SPACE_UNSPECIFIED"),
Self::Rgb => std::option::Option::Some("RGB"),
Self::Hsv => std::option::Option::Some("HSV"),
Self::Yiq => std::option::Option::Some("YIQ"),
Self::Yuv => std::option::Option::Some("YUV"),
Self::Grayscale => std::option::Option::Some("GRAYSCALE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ColorSpace {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ColorSpace {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ColorSpace {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Rgb,
2 => Self::Hsv,
3 => Self::Yiq,
4 => Self::Yuv,
5 => Self::Grayscale,
_ => Self::UnknownValue(color_space::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ColorSpace {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"COLOR_SPACE_UNSPECIFIED" => Self::Unspecified,
"RGB" => Self::Rgb,
"HSV" => Self::Hsv,
"YIQ" => Self::Yiq,
"YUV" => Self::Yuv,
"GRAYSCALE" => Self::Grayscale,
_ => Self::UnknownValue(color_space::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ColorSpace {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Rgb => serializer.serialize_i32(1),
Self::Hsv => serializer.serialize_i32(2),
Self::Yiq => serializer.serialize_i32(3),
Self::Yuv => serializer.serialize_i32(4),
Self::Grayscale => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ColorSpace {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ColorSpace>::new(
".google.cloud.bigquery.v2.Model.ColorSpace",
))
}
}
/// Indicates the learning rate optimization strategy to use.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LearnRateStrategy {
/// Default value.
Unspecified,
/// Use line search to determine learning rate.
LineSearch,
/// Use a constant learning rate.
Constant,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [LearnRateStrategy::value] or
/// [LearnRateStrategy::name].
UnknownValue(learn_rate_strategy::UnknownValue),
}
#[doc(hidden)]
pub mod learn_rate_strategy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LearnRateStrategy {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::LineSearch => std::option::Option::Some(1),
Self::Constant => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LEARN_RATE_STRATEGY_UNSPECIFIED"),
Self::LineSearch => std::option::Option::Some("LINE_SEARCH"),
Self::Constant => std::option::Option::Some("CONSTANT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LearnRateStrategy {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LearnRateStrategy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for LearnRateStrategy {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::LineSearch,
2 => Self::Constant,
_ => Self::UnknownValue(learn_rate_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LearnRateStrategy {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LEARN_RATE_STRATEGY_UNSPECIFIED" => Self::Unspecified,
"LINE_SEARCH" => Self::LineSearch,
"CONSTANT" => Self::Constant,
_ => Self::UnknownValue(learn_rate_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LearnRateStrategy {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::LineSearch => serializer.serialize_i32(1),
Self::Constant => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LearnRateStrategy {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LearnRateStrategy>::new(
".google.cloud.bigquery.v2.Model.LearnRateStrategy",
))
}
}
/// Indicates the optimization strategy used for training.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OptimizationStrategy {
/// Default value.
Unspecified,
/// Uses an iterative batch gradient descent algorithm.
BatchGradientDescent,
/// Uses a normal equation to solve linear regression problem.
NormalEquation,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [OptimizationStrategy::value] or
/// [OptimizationStrategy::name].
UnknownValue(optimization_strategy::UnknownValue),
}
#[doc(hidden)]
pub mod optimization_strategy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl OptimizationStrategy {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::BatchGradientDescent => std::option::Option::Some(1),
Self::NormalEquation => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("OPTIMIZATION_STRATEGY_UNSPECIFIED"),
Self::BatchGradientDescent => std::option::Option::Some("BATCH_GRADIENT_DESCENT"),
Self::NormalEquation => std::option::Option::Some("NORMAL_EQUATION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for OptimizationStrategy {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for OptimizationStrategy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for OptimizationStrategy {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::BatchGradientDescent,
2 => Self::NormalEquation,
_ => Self::UnknownValue(optimization_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for OptimizationStrategy {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OPTIMIZATION_STRATEGY_UNSPECIFIED" => Self::Unspecified,
"BATCH_GRADIENT_DESCENT" => Self::BatchGradientDescent,
"NORMAL_EQUATION" => Self::NormalEquation,
_ => Self::UnknownValue(optimization_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for OptimizationStrategy {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::BatchGradientDescent => serializer.serialize_i32(1),
Self::NormalEquation => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for OptimizationStrategy {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptimizationStrategy>::new(
".google.cloud.bigquery.v2.Model.OptimizationStrategy",
))
}
}
/// Indicates the training algorithm to use for matrix factorization models.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FeedbackType {
/// Default value.
Unspecified,
/// Use weighted-als for implicit feedback problems.
Implicit,
/// Use nonweighted-als for explicit feedback problems.
Explicit,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [FeedbackType::value] or
/// [FeedbackType::name].
UnknownValue(feedback_type::UnknownValue),
}
#[doc(hidden)]
pub mod feedback_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FeedbackType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Implicit => std::option::Option::Some(1),
Self::Explicit => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("FEEDBACK_TYPE_UNSPECIFIED"),
Self::Implicit => std::option::Option::Some("IMPLICIT"),
Self::Explicit => std::option::Option::Some("EXPLICIT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FeedbackType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FeedbackType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FeedbackType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Implicit,
2 => Self::Explicit,
_ => Self::UnknownValue(feedback_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FeedbackType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FEEDBACK_TYPE_UNSPECIFIED" => Self::Unspecified,
"IMPLICIT" => Self::Implicit,
"EXPLICIT" => Self::Explicit,
_ => Self::UnknownValue(feedback_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FeedbackType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Implicit => serializer.serialize_i32(1),
Self::Explicit => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FeedbackType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FeedbackType>::new(
".google.cloud.bigquery.v2.Model.FeedbackType",
))
}
}
}
/// Request format for getting information about a BigQuery ML model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetModelRequest {
/// Required. Project ID of the requested model.
pub project_id: std::string::String,
/// Required. Dataset ID of the requested model.
pub dataset_id: std::string::String,
/// Required. Model ID of the requested model.
pub model_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetModelRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetModelRequest;
/// let x = GetModelRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::GetModelRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetModelRequest;
/// let x = GetModelRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [model_id][crate::model::GetModelRequest::model_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetModelRequest;
/// let x = GetModelRequest::new().set_model_id("example");
/// ```
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model_id = v.into();
self
}
}
impl wkt::message::Message for GetModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetModelRequest"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PatchModelRequest {
/// Required. Project ID of the model to patch.
pub project_id: std::string::String,
/// Required. Dataset ID of the model to patch.
pub dataset_id: std::string::String,
/// Required. Model ID of the model to patch.
pub model_id: std::string::String,
/// Required. Patched model.
/// Follows RFC5789 patch semantics. Missing fields are not updated.
/// To clear a field, explicitly set to default value.
pub model: std::option::Option<crate::model::Model>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PatchModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::PatchModelRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PatchModelRequest;
/// let x = PatchModelRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::PatchModelRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PatchModelRequest;
/// let x = PatchModelRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [model_id][crate::model::PatchModelRequest::model_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PatchModelRequest;
/// let x = PatchModelRequest::new().set_model_id("example");
/// ```
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model_id = v.into();
self
}
/// Sets the value of [model][crate::model::PatchModelRequest::model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PatchModelRequest;
/// use google_cloud_bigquery_v2::model::Model;
/// let x = PatchModelRequest::new().set_model(Model::default()/* use setters */);
/// ```
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model][crate::model::PatchModelRequest::model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PatchModelRequest;
/// use google_cloud_bigquery_v2::model::Model;
/// let x = PatchModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
/// let x = PatchModelRequest::new().set_or_clear_model(None::<Model>);
/// ```
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.model = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PatchModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PatchModelRequest"
}
}
/// Request format for deleting BigQuery ML models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteModelRequest {
/// Required. Project ID of the model to delete.
pub project_id: std::string::String,
/// Required. Dataset ID of the model to delete.
pub dataset_id: std::string::String,
/// Required. Model ID of the model to delete.
pub model_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteModelRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteModelRequest;
/// let x = DeleteModelRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::DeleteModelRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteModelRequest;
/// let x = DeleteModelRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [model_id][crate::model::DeleteModelRequest::model_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteModelRequest;
/// let x = DeleteModelRequest::new().set_model_id("example");
/// ```
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model_id = v.into();
self
}
}
impl wkt::message::Message for DeleteModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteModelRequest"
}
}
/// Request format for listing BigQuery ML models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListModelsRequest {
/// Required. Project ID of the models to list.
pub project_id: std::string::String,
/// Required. Dataset ID of the models to list.
pub dataset_id: std::string::String,
/// The maximum number of results to return in a single response page.
/// Leverage the page tokens to iterate through the entire collection.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Page token, returned by a previous call to request the next page of
/// results
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListModelsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListModelsRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsRequest;
/// let x = ListModelsRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::ListModelsRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsRequest;
/// let x = ListModelsRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [max_results][crate::model::ListModelsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsRequest;
/// use wkt::UInt32Value;
/// let x = ListModelsRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::ListModelsRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsRequest;
/// use wkt::UInt32Value;
/// let x = ListModelsRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = ListModelsRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsRequest;
/// let x = ListModelsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListModelsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListModelsRequest"
}
}
/// Response format for a single page when listing BigQuery ML models.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListModelsResponse {
/// Models in the requested dataset. Only the following fields are populated:
/// model_reference, model_type, creation_time, last_modified_time and
/// labels.
pub models: std::vec::Vec<crate::model::Model>,
/// A token to request the next page of results.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListModelsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [models][crate::model::ListModelsResponse::models].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsResponse;
/// use google_cloud_bigquery_v2::model::Model;
/// let x = ListModelsResponse::new()
/// .set_models([
/// Model::default()/* use setters */,
/// Model::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_models<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Model>,
{
use std::iter::Iterator;
self.models = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListModelsResponse;
/// let x = ListModelsResponse::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListModelsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListModelsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
type PageItem = crate::model::Model;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.models
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Id path of a model.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelReference {
/// Required. The ID of the project containing this model.
pub project_id: std::string::String,
/// Required. The ID of the dataset containing this model.
pub dataset_id: std::string::String,
/// Required. The ID of the model. The ID must contain only
/// letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
/// length is 1,024 characters.
pub model_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ModelReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ModelReference;
/// let x = ModelReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::ModelReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ModelReference;
/// let x = ModelReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [model_id][crate::model::ModelReference::model_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ModelReference;
/// let x = ModelReference::new().set_model_id("example");
/// ```
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model_id = v.into();
self
}
}
impl wkt::message::Message for ModelReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ModelReference"
}
}
/// The partitioning information, which includes managed table, external table
/// and metastore partitioned table partition information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitioningDefinition {
/// Optional. Details about each partitioning column. This field is output only
/// for all partitioning types other than metastore partitioned tables.
/// BigQuery native tables only support 1 partitioning column. Other table
/// types may support 0, 1 or more partitioning columns.
/// For metastore partitioned tables, the order must match the definition order
/// in the Hive Metastore, where it must match the physical layout of the
/// table. For example,
///
/// CREATE TABLE a_table(id BIGINT, name STRING)
/// PARTITIONED BY (city STRING, state STRING).
///
/// In this case the values must be ['city', 'state'] in that order.
pub partitioned_column: std::vec::Vec<crate::model::PartitionedColumn>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitioningDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [partitioned_column][crate::model::PartitioningDefinition::partitioned_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PartitioningDefinition;
/// use google_cloud_bigquery_v2::model::PartitionedColumn;
/// let x = PartitioningDefinition::new()
/// .set_partitioned_column([
/// PartitionedColumn::default()/* use setters */,
/// PartitionedColumn::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_partitioned_column<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PartitionedColumn>,
{
use std::iter::Iterator;
self.partitioned_column = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PartitioningDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PartitioningDefinition"
}
}
/// The partitioning column information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PartitionedColumn {
/// Required. The name of the partition column.
pub field: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PartitionedColumn {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [field][crate::model::PartitionedColumn::field].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PartitionedColumn;
/// let x = PartitionedColumn::new().set_field("example");
/// ```
pub fn set_field<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.field = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [field][crate::model::PartitionedColumn::field].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PartitionedColumn;
/// let x = PartitionedColumn::new().set_or_clear_field(Some("example"));
/// let x = PartitionedColumn::new().set_or_clear_field(None::<String>);
/// ```
pub fn set_or_clear_field<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.field = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PartitionedColumn {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PartitionedColumn"
}
}
/// Represents privacy policy associated with "aggregation threshold" method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AggregationThresholdPolicy {
/// Optional. The threshold for the "aggregation threshold" policy.
pub threshold: std::option::Option<i64>,
/// Optional. The privacy unit column(s) associated with this policy.
/// For now, only one column per data source object (table, view) is allowed as
/// a privacy unit column.
/// Representing as a repeated field in metadata for extensibility to
/// multiple columns in future.
/// Duplicates and Repeated struct fields are not allowed.
/// For nested fields, use dot notation ("outer.inner")
pub privacy_unit_columns: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AggregationThresholdPolicy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [threshold][crate::model::AggregationThresholdPolicy::threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::AggregationThresholdPolicy;
/// let x = AggregationThresholdPolicy::new().set_threshold(42);
/// ```
pub fn set_threshold<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.threshold = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [threshold][crate::model::AggregationThresholdPolicy::threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::AggregationThresholdPolicy;
/// let x = AggregationThresholdPolicy::new().set_or_clear_threshold(Some(42));
/// let x = AggregationThresholdPolicy::new().set_or_clear_threshold(None::<i32>);
/// ```
pub fn set_or_clear_threshold<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.threshold = v.map(|x| x.into());
self
}
/// Sets the value of [privacy_unit_columns][crate::model::AggregationThresholdPolicy::privacy_unit_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::AggregationThresholdPolicy;
/// let x = AggregationThresholdPolicy::new().set_privacy_unit_columns(["a", "b", "c"]);
/// ```
pub fn set_privacy_unit_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.privacy_unit_columns = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AggregationThresholdPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.AggregationThresholdPolicy"
}
}
/// Represents privacy policy associated with "differential privacy" method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DifferentialPrivacyPolicy {
/// Optional. The maximum epsilon value that a query can consume. If the
/// subscriber specifies epsilon as a parameter in a SELECT query, it must be
/// less than or equal to this value. The epsilon parameter controls the amount
/// of noise that is added to the groups — a higher epsilon means less noise.
pub max_epsilon_per_query: std::option::Option<f64>,
/// Optional. The delta value that is used per query. Delta represents the
/// probability that any row will fail to be epsilon differentially private.
/// Indicates the risk associated with exposing aggregate rows in the result of
/// a query.
pub delta_per_query: std::option::Option<f64>,
/// Optional. The maximum groups contributed value that is used per query.
/// Represents the maximum number of groups to which each protected entity can
/// contribute. Changing this value does not improve or worsen privacy. The
/// best value for accuracy and utility depends on the query and data.
pub max_groups_contributed: std::option::Option<i64>,
/// Optional. The privacy unit column associated with this policy. Differential
/// privacy policies can only have one privacy unit column per data source
/// object (table, view).
pub privacy_unit_column: std::option::Option<std::string::String>,
/// Optional. The total epsilon budget for all queries against the
/// privacy-protected view. Each subscriber query against this view charges the
/// amount of epsilon they request in their query. If there is sufficient
/// budget, then the subscriber query attempts to complete. It might still fail
/// due to other reasons, in which case the charge is refunded. If there is
/// insufficient budget the query is rejected. There might be multiple charge
/// attempts if a single query references multiple views. In this case there
/// must be sufficient budget for all charges or the query is rejected and
/// charges are refunded in best effort. The budget does not have a refresh
/// policy and can only be updated via ALTER VIEW or circumvented by creating a
/// new view that can be queried with a fresh budget.
pub epsilon_budget: std::option::Option<f64>,
/// Optional. The total delta budget for all queries against the
/// privacy-protected view. Each subscriber query against this view charges the
/// amount of delta that is pre-defined by the contributor through the privacy
/// policy delta_per_query field. If there is sufficient budget, then the
/// subscriber query attempts to complete. It might still fail due to other
/// reasons, in which case the charge is refunded. If there is insufficient
/// budget the query is rejected. There might be multiple charge attempts if a
/// single query references multiple views. In this case there must be
/// sufficient budget for all charges or the query is rejected and charges are
/// refunded in best effort. The budget does not have a refresh policy and can
/// only be updated via ALTER VIEW or circumvented by creating a new view that
/// can be queried with a fresh budget.
pub delta_budget: std::option::Option<f64>,
/// Output only. The epsilon budget remaining. If budget is exhausted, no more
/// queries are allowed. Note that the budget for queries that are in progress
/// is deducted before the query executes. If the query fails or is cancelled
/// then the budget is refunded. In this case the amount of budget remaining
/// can increase.
pub epsilon_budget_remaining: std::option::Option<f64>,
/// Output only. The delta budget remaining. If budget is exhausted, no more
/// queries are allowed. Note that the budget for queries that are in progress
/// is deducted before the query executes. If the query fails or is cancelled
/// then the budget is refunded. In this case the amount of budget remaining
/// can increase.
pub delta_budget_remaining: std::option::Option<f64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DifferentialPrivacyPolicy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [max_epsilon_per_query][crate::model::DifferentialPrivacyPolicy::max_epsilon_per_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_max_epsilon_per_query(42.0);
/// ```
pub fn set_max_epsilon_per_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.max_epsilon_per_query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_epsilon_per_query][crate::model::DifferentialPrivacyPolicy::max_epsilon_per_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_max_epsilon_per_query(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_max_epsilon_per_query(None::<f32>);
/// ```
pub fn set_or_clear_max_epsilon_per_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.max_epsilon_per_query = v.map(|x| x.into());
self
}
/// Sets the value of [delta_per_query][crate::model::DifferentialPrivacyPolicy::delta_per_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_delta_per_query(42.0);
/// ```
pub fn set_delta_per_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_per_query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [delta_per_query][crate::model::DifferentialPrivacyPolicy::delta_per_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_per_query(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_per_query(None::<f32>);
/// ```
pub fn set_or_clear_delta_per_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_per_query = v.map(|x| x.into());
self
}
/// Sets the value of [max_groups_contributed][crate::model::DifferentialPrivacyPolicy::max_groups_contributed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_max_groups_contributed(42);
/// ```
pub fn set_max_groups_contributed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.max_groups_contributed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_groups_contributed][crate::model::DifferentialPrivacyPolicy::max_groups_contributed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_max_groups_contributed(Some(42));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_max_groups_contributed(None::<i32>);
/// ```
pub fn set_or_clear_max_groups_contributed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.max_groups_contributed = v.map(|x| x.into());
self
}
/// Sets the value of [privacy_unit_column][crate::model::DifferentialPrivacyPolicy::privacy_unit_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_privacy_unit_column("example");
/// ```
pub fn set_privacy_unit_column<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.privacy_unit_column = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [privacy_unit_column][crate::model::DifferentialPrivacyPolicy::privacy_unit_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_privacy_unit_column(Some("example"));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_privacy_unit_column(None::<String>);
/// ```
pub fn set_or_clear_privacy_unit_column<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.privacy_unit_column = v.map(|x| x.into());
self
}
/// Sets the value of [epsilon_budget][crate::model::DifferentialPrivacyPolicy::epsilon_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_epsilon_budget(42.0);
/// ```
pub fn set_epsilon_budget<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.epsilon_budget = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [epsilon_budget][crate::model::DifferentialPrivacyPolicy::epsilon_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_epsilon_budget(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_epsilon_budget(None::<f32>);
/// ```
pub fn set_or_clear_epsilon_budget<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.epsilon_budget = v.map(|x| x.into());
self
}
/// Sets the value of [delta_budget][crate::model::DifferentialPrivacyPolicy::delta_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_delta_budget(42.0);
/// ```
pub fn set_delta_budget<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_budget = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [delta_budget][crate::model::DifferentialPrivacyPolicy::delta_budget].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_budget(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_budget(None::<f32>);
/// ```
pub fn set_or_clear_delta_budget<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_budget = v.map(|x| x.into());
self
}
/// Sets the value of [epsilon_budget_remaining][crate::model::DifferentialPrivacyPolicy::epsilon_budget_remaining].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_epsilon_budget_remaining(42.0);
/// ```
pub fn set_epsilon_budget_remaining<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.epsilon_budget_remaining = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [epsilon_budget_remaining][crate::model::DifferentialPrivacyPolicy::epsilon_budget_remaining].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_epsilon_budget_remaining(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_epsilon_budget_remaining(None::<f32>);
/// ```
pub fn set_or_clear_epsilon_budget_remaining<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.epsilon_budget_remaining = v.map(|x| x.into());
self
}
/// Sets the value of [delta_budget_remaining][crate::model::DifferentialPrivacyPolicy::delta_budget_remaining].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_delta_budget_remaining(42.0);
/// ```
pub fn set_delta_budget_remaining<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_budget_remaining = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [delta_budget_remaining][crate::model::DifferentialPrivacyPolicy::delta_budget_remaining].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_budget_remaining(Some(42.0));
/// let x = DifferentialPrivacyPolicy::new().set_or_clear_delta_budget_remaining(None::<f32>);
/// ```
pub fn set_or_clear_delta_budget_remaining<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.delta_budget_remaining = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DifferentialPrivacyPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DifferentialPrivacyPolicy"
}
}
/// Represents privacy policy associated with "join restrictions". Join
/// restriction gives data providers the ability to enforce joins on the
/// 'join_allowed_columns' when data is queried from a privacy protected view.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct JoinRestrictionPolicy {
/// Optional. Specifies if a join is required or not on queries for the view.
/// Default is JOIN_CONDITION_UNSPECIFIED.
pub join_condition: std::option::Option<crate::model::join_restriction_policy::JoinCondition>,
/// Optional. The only columns that joins are allowed on.
/// This field is must be specified for join_conditions JOIN_ANY and JOIN_ALL
/// and it cannot be set for JOIN_BLOCKED.
pub join_allowed_columns: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl JoinRestrictionPolicy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [join_condition][crate::model::JoinRestrictionPolicy::join_condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JoinRestrictionPolicy;
/// use google_cloud_bigquery_v2::model::join_restriction_policy::JoinCondition;
/// let x0 = JoinRestrictionPolicy::new().set_join_condition(JoinCondition::JoinAny);
/// let x1 = JoinRestrictionPolicy::new().set_join_condition(JoinCondition::JoinAll);
/// let x2 = JoinRestrictionPolicy::new().set_join_condition(JoinCondition::JoinNotRequired);
/// ```
pub fn set_join_condition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::join_restriction_policy::JoinCondition>,
{
self.join_condition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [join_condition][crate::model::JoinRestrictionPolicy::join_condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JoinRestrictionPolicy;
/// use google_cloud_bigquery_v2::model::join_restriction_policy::JoinCondition;
/// let x0 = JoinRestrictionPolicy::new().set_or_clear_join_condition(Some(JoinCondition::JoinAny));
/// let x1 = JoinRestrictionPolicy::new().set_or_clear_join_condition(Some(JoinCondition::JoinAll));
/// let x2 = JoinRestrictionPolicy::new().set_or_clear_join_condition(Some(JoinCondition::JoinNotRequired));
/// let x_none = JoinRestrictionPolicy::new().set_or_clear_join_condition(None::<JoinCondition>);
/// ```
pub fn set_or_clear_join_condition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::join_restriction_policy::JoinCondition>,
{
self.join_condition = v.map(|x| x.into());
self
}
/// Sets the value of [join_allowed_columns][crate::model::JoinRestrictionPolicy::join_allowed_columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::JoinRestrictionPolicy;
/// let x = JoinRestrictionPolicy::new().set_join_allowed_columns(["a", "b", "c"]);
/// ```
pub fn set_join_allowed_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.join_allowed_columns = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for JoinRestrictionPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.JoinRestrictionPolicy"
}
}
/// Defines additional types related to [JoinRestrictionPolicy].
pub mod join_restriction_policy {
#[allow(unused_imports)]
use super::*;
/// Enum for Join Restrictions policy.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum JoinCondition {
/// A join is neither required nor restricted on any column. Default value.
Unspecified,
/// A join is required on at least one of the specified columns.
JoinAny,
/// A join is required on all specified columns.
JoinAll,
/// A join is not required, but if present it is only permitted on
/// 'join_allowed_columns'
JoinNotRequired,
/// Joins are blocked for all queries.
JoinBlocked,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [JoinCondition::value] or
/// [JoinCondition::name].
UnknownValue(join_condition::UnknownValue),
}
#[doc(hidden)]
pub mod join_condition {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl JoinCondition {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::JoinAny => std::option::Option::Some(1),
Self::JoinAll => std::option::Option::Some(2),
Self::JoinNotRequired => std::option::Option::Some(3),
Self::JoinBlocked => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("JOIN_CONDITION_UNSPECIFIED"),
Self::JoinAny => std::option::Option::Some("JOIN_ANY"),
Self::JoinAll => std::option::Option::Some("JOIN_ALL"),
Self::JoinNotRequired => std::option::Option::Some("JOIN_NOT_REQUIRED"),
Self::JoinBlocked => std::option::Option::Some("JOIN_BLOCKED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for JoinCondition {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for JoinCondition {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for JoinCondition {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::JoinAny,
2 => Self::JoinAll,
3 => Self::JoinNotRequired,
4 => Self::JoinBlocked,
_ => Self::UnknownValue(join_condition::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for JoinCondition {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"JOIN_CONDITION_UNSPECIFIED" => Self::Unspecified,
"JOIN_ANY" => Self::JoinAny,
"JOIN_ALL" => Self::JoinAll,
"JOIN_NOT_REQUIRED" => Self::JoinNotRequired,
"JOIN_BLOCKED" => Self::JoinBlocked,
_ => Self::UnknownValue(join_condition::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for JoinCondition {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::JoinAny => serializer.serialize_i32(1),
Self::JoinAll => serializer.serialize_i32(2),
Self::JoinNotRequired => serializer.serialize_i32(3),
Self::JoinBlocked => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for JoinCondition {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<JoinCondition>::new(
".google.cloud.bigquery.v2.JoinRestrictionPolicy.JoinCondition",
))
}
}
}
/// Represents privacy policy that contains the privacy requirements specified by
/// the data owner. Currently, this is only supported on views.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrivacyPolicy {
/// Optional. Join restriction policy is outside of the one of policies, since
/// this policy can be set along with other policies. This policy gives data
/// providers the ability to enforce joins on the 'join_allowed_columns' when
/// data is queried from a privacy protected view.
pub join_restriction_policy: std::option::Option<crate::model::JoinRestrictionPolicy>,
/// Privacy policy associated with this requirement specification. Only one of
/// the privacy methods is allowed per data source object.
pub privacy_policy: std::option::Option<crate::model::privacy_policy::PrivacyPolicy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PrivacyPolicy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [join_restriction_policy][crate::model::PrivacyPolicy::join_restriction_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// use google_cloud_bigquery_v2::model::JoinRestrictionPolicy;
/// let x = PrivacyPolicy::new().set_join_restriction_policy(JoinRestrictionPolicy::default()/* use setters */);
/// ```
pub fn set_join_restriction_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::JoinRestrictionPolicy>,
{
self.join_restriction_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [join_restriction_policy][crate::model::PrivacyPolicy::join_restriction_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// use google_cloud_bigquery_v2::model::JoinRestrictionPolicy;
/// let x = PrivacyPolicy::new().set_or_clear_join_restriction_policy(Some(JoinRestrictionPolicy::default()/* use setters */));
/// let x = PrivacyPolicy::new().set_or_clear_join_restriction_policy(None::<JoinRestrictionPolicy>);
/// ```
pub fn set_or_clear_join_restriction_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::JoinRestrictionPolicy>,
{
self.join_restriction_policy = v.map(|x| x.into());
self
}
/// Sets the value of [privacy_policy][crate::model::PrivacyPolicy::privacy_policy].
///
/// Note that all the setters affecting `privacy_policy` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// use google_cloud_bigquery_v2::model::AggregationThresholdPolicy;
/// let x = PrivacyPolicy::new().set_privacy_policy(Some(
/// google_cloud_bigquery_v2::model::privacy_policy::PrivacyPolicy::AggregationThresholdPolicy(AggregationThresholdPolicy::default().into())));
/// ```
pub fn set_privacy_policy<
T: std::convert::Into<std::option::Option<crate::model::privacy_policy::PrivacyPolicy>>,
>(
mut self,
v: T,
) -> Self {
self.privacy_policy = v.into();
self
}
/// The value of [privacy_policy][crate::model::PrivacyPolicy::privacy_policy]
/// if it holds a `AggregationThresholdPolicy`, `None` if the field is not set or
/// holds a different branch.
pub fn aggregation_threshold_policy(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AggregationThresholdPolicy>> {
#[allow(unreachable_patterns)]
self.privacy_policy.as_ref().and_then(|v| match v {
crate::model::privacy_policy::PrivacyPolicy::AggregationThresholdPolicy(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [privacy_policy][crate::model::PrivacyPolicy::privacy_policy]
/// to hold a `AggregationThresholdPolicy`.
///
/// Note that all the setters affecting `privacy_policy` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// use google_cloud_bigquery_v2::model::AggregationThresholdPolicy;
/// let x = PrivacyPolicy::new().set_aggregation_threshold_policy(AggregationThresholdPolicy::default()/* use setters */);
/// assert!(x.aggregation_threshold_policy().is_some());
/// assert!(x.differential_privacy_policy().is_none());
/// ```
pub fn set_aggregation_threshold_policy<
T: std::convert::Into<std::boxed::Box<crate::model::AggregationThresholdPolicy>>,
>(
mut self,
v: T,
) -> Self {
self.privacy_policy = std::option::Option::Some(
crate::model::privacy_policy::PrivacyPolicy::AggregationThresholdPolicy(v.into()),
);
self
}
/// The value of [privacy_policy][crate::model::PrivacyPolicy::privacy_policy]
/// if it holds a `DifferentialPrivacyPolicy`, `None` if the field is not set or
/// holds a different branch.
pub fn differential_privacy_policy(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DifferentialPrivacyPolicy>> {
#[allow(unreachable_patterns)]
self.privacy_policy.as_ref().and_then(|v| match v {
crate::model::privacy_policy::PrivacyPolicy::DifferentialPrivacyPolicy(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [privacy_policy][crate::model::PrivacyPolicy::privacy_policy]
/// to hold a `DifferentialPrivacyPolicy`.
///
/// Note that all the setters affecting `privacy_policy` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// use google_cloud_bigquery_v2::model::DifferentialPrivacyPolicy;
/// let x = PrivacyPolicy::new().set_differential_privacy_policy(DifferentialPrivacyPolicy::default()/* use setters */);
/// assert!(x.differential_privacy_policy().is_some());
/// assert!(x.aggregation_threshold_policy().is_none());
/// ```
pub fn set_differential_privacy_policy<
T: std::convert::Into<std::boxed::Box<crate::model::DifferentialPrivacyPolicy>>,
>(
mut self,
v: T,
) -> Self {
self.privacy_policy = std::option::Option::Some(
crate::model::privacy_policy::PrivacyPolicy::DifferentialPrivacyPolicy(v.into()),
);
self
}
}
impl wkt::message::Message for PrivacyPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PrivacyPolicy"
}
}
/// Defines additional types related to [PrivacyPolicy].
pub mod privacy_policy {
#[allow(unused_imports)]
use super::*;
/// Privacy policy associated with this requirement specification. Only one of
/// the privacy methods is allowed per data source object.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PrivacyPolicy {
/// Optional. Policy used for aggregation thresholds.
AggregationThresholdPolicy(std::boxed::Box<crate::model::AggregationThresholdPolicy>),
/// Optional. Policy used for differential privacy.
DifferentialPrivacyPolicy(std::boxed::Box<crate::model::DifferentialPrivacyPolicy>),
}
}
/// Request object of GetServiceAccount
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceAccountRequest {
/// Required. ID of the project.
pub project_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetServiceAccountRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetServiceAccountRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetServiceAccountRequest;
/// let x = GetServiceAccountRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
}
impl wkt::message::Message for GetServiceAccountRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetServiceAccountRequest"
}
}
/// Response object of GetServiceAccount
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceAccountResponse {
/// The resource type of the response.
pub kind: std::string::String,
/// The service account email address.
pub email: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetServiceAccountResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::GetServiceAccountResponse::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetServiceAccountResponse;
/// let x = GetServiceAccountResponse::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [email][crate::model::GetServiceAccountResponse::email].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetServiceAccountResponse;
/// let x = GetServiceAccountResponse::new().set_email("example");
/// ```
pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.email = v.into();
self
}
}
impl wkt::message::Message for GetServiceAccountResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetServiceAccountResponse"
}
}
/// Id path of a property graph.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PropertyGraphReference {
/// Required. The ID of the project containing this property graph.
pub project_id: std::string::String,
/// Required. The ID of the dataset containing this property graph.
pub dataset_id: std::string::String,
/// Required. The ID of the property graph. The ID must contain only
/// letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
/// length is 256 characters.
pub property_graph_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PropertyGraphReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::PropertyGraphReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PropertyGraphReference;
/// let x = PropertyGraphReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::PropertyGraphReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PropertyGraphReference;
/// let x = PropertyGraphReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [property_graph_id][crate::model::PropertyGraphReference::property_graph_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PropertyGraphReference;
/// let x = PropertyGraphReference::new().set_property_graph_id("example");
/// ```
pub fn set_property_graph_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.property_graph_id = v.into();
self
}
}
impl wkt::message::Message for PropertyGraphReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PropertyGraphReference"
}
}
/// The type of a struct parameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryParameterStructType {
/// Optional. The name of this field.
pub name: std::string::String,
/// Required. The type of this field.
pub r#type: std::option::Option<std::boxed::Box<crate::model::QueryParameterType>>,
/// Optional. Human-oriented description of the field.
pub description: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryParameterStructType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::QueryParameterStructType::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterStructType;
/// let x = QueryParameterStructType::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [r#type][crate::model::QueryParameterStructType::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterStructType;
/// use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterStructType::new().set_type(QueryParameterType::default()/* use setters */);
/// ```
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.r#type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [r#type][crate::model::QueryParameterStructType::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterStructType;
/// use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterStructType::new().set_or_clear_type(Some(QueryParameterType::default()/* use setters */));
/// let x = QueryParameterStructType::new().set_or_clear_type(None::<QueryParameterType>);
/// ```
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.r#type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
/// Sets the value of [description][crate::model::QueryParameterStructType::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterStructType;
/// let x = QueryParameterStructType::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
}
impl wkt::message::Message for QueryParameterStructType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryParameterStructType"
}
}
/// The type of a query parameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryParameterType {
/// Required. The top level type of this field.
pub r#type: std::string::String,
/// Optional. Precision (maximum number of total digits in base 10) for seconds
/// of TIMESTAMP type.
///
/// Possible values include:
///
/// * 6 (Default, for TIMESTAMP type with microsecond precision)
/// * 12 (For TIMESTAMP type with picosecond precision)
pub timestamp_precision: std::option::Option<i64>,
/// Optional. The type of the array's elements, if this is an array.
pub array_type: std::option::Option<std::boxed::Box<crate::model::QueryParameterType>>,
/// Optional. The types of the fields of this struct, in order, if this is a
/// struct.
pub struct_types: std::vec::Vec<crate::model::QueryParameterStructType>,
/// Optional. The element type of the range, if this is a range.
pub range_element_type: std::option::Option<std::boxed::Box<crate::model::QueryParameterType>>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryParameterType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::QueryParameterType::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [timestamp_precision][crate::model::QueryParameterType::timestamp_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_timestamp_precision(42);
/// ```
pub fn set_timestamp_precision<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.timestamp_precision = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timestamp_precision][crate::model::QueryParameterType::timestamp_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_or_clear_timestamp_precision(Some(42));
/// let x = QueryParameterType::new().set_or_clear_timestamp_precision(None::<i32>);
/// ```
pub fn set_or_clear_timestamp_precision<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.timestamp_precision = v.map(|x| x.into());
self
}
/// Sets the value of [array_type][crate::model::QueryParameterType::array_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_array_type(QueryParameterType::default()/* use setters */);
/// ```
pub fn set_array_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.array_type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [array_type][crate::model::QueryParameterType::array_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_or_clear_array_type(Some(QueryParameterType::default()/* use setters */));
/// let x = QueryParameterType::new().set_or_clear_array_type(None::<QueryParameterType>);
/// ```
pub fn set_or_clear_array_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.array_type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
/// Sets the value of [struct_types][crate::model::QueryParameterType::struct_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// use google_cloud_bigquery_v2::model::QueryParameterStructType;
/// let x = QueryParameterType::new()
/// .set_struct_types([
/// QueryParameterStructType::default()/* use setters */,
/// QueryParameterStructType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_struct_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryParameterStructType>,
{
use std::iter::Iterator;
self.struct_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [range_element_type][crate::model::QueryParameterType::range_element_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_range_element_type(QueryParameterType::default()/* use setters */);
/// ```
pub fn set_range_element_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.range_element_type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [range_element_type][crate::model::QueryParameterType::range_element_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameterType::new().set_or_clear_range_element_type(Some(QueryParameterType::default()/* use setters */));
/// let x = QueryParameterType::new().set_or_clear_range_element_type(None::<QueryParameterType>);
/// ```
pub fn set_or_clear_range_element_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.range_element_type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
}
impl wkt::message::Message for QueryParameterType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryParameterType"
}
}
/// Represents the value of a range.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RangeValue {
/// Optional. The start value of the range. A missing value represents an
/// unbounded start.
pub start: std::option::Option<std::boxed::Box<crate::model::QueryParameterValue>>,
/// Optional. The end value of the range. A missing value represents an
/// unbounded end.
pub end: std::option::Option<std::boxed::Box<crate::model::QueryParameterValue>>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RangeValue {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [start][crate::model::RangeValue::start].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangeValue;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = RangeValue::new().set_start(QueryParameterValue::default()/* use setters */);
/// ```
pub fn set_start<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.start = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [start][crate::model::RangeValue::start].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangeValue;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = RangeValue::new().set_or_clear_start(Some(QueryParameterValue::default()/* use setters */));
/// let x = RangeValue::new().set_or_clear_start(None::<QueryParameterValue>);
/// ```
pub fn set_or_clear_start<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.start = v.map(|x| std::boxed::Box::new(x.into()));
self
}
/// Sets the value of [end][crate::model::RangeValue::end].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangeValue;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = RangeValue::new().set_end(QueryParameterValue::default()/* use setters */);
/// ```
pub fn set_end<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.end = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [end][crate::model::RangeValue::end].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangeValue;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = RangeValue::new().set_or_clear_end(Some(QueryParameterValue::default()/* use setters */));
/// let x = RangeValue::new().set_or_clear_end(None::<QueryParameterValue>);
/// ```
pub fn set_or_clear_end<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.end = v.map(|x| std::boxed::Box::new(x.into()));
self
}
}
impl wkt::message::Message for RangeValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RangeValue"
}
}
/// The value of a query parameter.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryParameterValue {
/// Optional. The value of this value, if a simple scalar type.
pub value: std::option::Option<wkt::StringValue>,
/// Optional. The array values, if this is an array type.
pub array_values: std::vec::Vec<crate::model::QueryParameterValue>,
/// The struct field values.
pub struct_values:
std::collections::HashMap<std::string::String, crate::model::QueryParameterValue>,
/// Optional. The range value, if this is a range type.
pub range_value: std::option::Option<std::boxed::Box<crate::model::RangeValue>>,
/// This field should not be used.
pub alt_struct_values: std::vec::Vec<wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryParameterValue {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [value][crate::model::QueryParameterValue::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// use wkt::StringValue;
/// let x = QueryParameterValue::new().set_value(StringValue::default()/* use setters */);
/// ```
pub fn set_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.value = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [value][crate::model::QueryParameterValue::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// use wkt::StringValue;
/// let x = QueryParameterValue::new().set_or_clear_value(Some(StringValue::default()/* use setters */));
/// let x = QueryParameterValue::new().set_or_clear_value(None::<StringValue>);
/// ```
pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.value = v.map(|x| x.into());
self
}
/// Sets the value of [array_values][crate::model::QueryParameterValue::array_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = QueryParameterValue::new()
/// .set_array_values([
/// QueryParameterValue::default()/* use setters */,
/// QueryParameterValue::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_array_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::QueryParameterValue>,
{
use std::iter::Iterator;
self.array_values = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [struct_values][crate::model::QueryParameterValue::struct_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = QueryParameterValue::new().set_struct_values([
/// ("key0", QueryParameterValue::default()/* use setters */),
/// ("key1", QueryParameterValue::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_struct_values<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::QueryParameterValue>,
{
use std::iter::Iterator;
self.struct_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [range_value][crate::model::QueryParameterValue::range_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// use google_cloud_bigquery_v2::model::RangeValue;
/// let x = QueryParameterValue::new().set_range_value(RangeValue::default()/* use setters */);
/// ```
pub fn set_range_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangeValue>,
{
self.range_value = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [range_value][crate::model::QueryParameterValue::range_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// use google_cloud_bigquery_v2::model::RangeValue;
/// let x = QueryParameterValue::new().set_or_clear_range_value(Some(RangeValue::default()/* use setters */));
/// let x = QueryParameterValue::new().set_or_clear_range_value(None::<RangeValue>);
/// ```
pub fn set_or_clear_range_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangeValue>,
{
self.range_value = v.map(|x| std::boxed::Box::new(x.into()));
self
}
/// Sets the value of [alt_struct_values][crate::model::QueryParameterValue::alt_struct_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameterValue;
/// use wkt::Value;
/// let x = QueryParameterValue::new()
/// .set_alt_struct_values([
/// Value::default()/* use setters */,
/// Value::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_alt_struct_values<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.alt_struct_values = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for QueryParameterValue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryParameterValue"
}
}
/// A parameter given to a query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryParameter {
/// Optional. If unset, this is a positional parameter. Otherwise, should be
/// unique within a query.
pub name: std::string::String,
/// Required. The type of this parameter.
pub parameter_type: std::option::Option<crate::model::QueryParameterType>,
/// Required. The value of this parameter.
pub parameter_value: std::option::Option<crate::model::QueryParameterValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QueryParameter {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::QueryParameter::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameter;
/// let x = QueryParameter::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [parameter_type][crate::model::QueryParameter::parameter_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameter;
/// use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameter::new().set_parameter_type(QueryParameterType::default()/* use setters */);
/// ```
pub fn set_parameter_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.parameter_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameter_type][crate::model::QueryParameter::parameter_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameter;
/// use google_cloud_bigquery_v2::model::QueryParameterType;
/// let x = QueryParameter::new().set_or_clear_parameter_type(Some(QueryParameterType::default()/* use setters */));
/// let x = QueryParameter::new().set_or_clear_parameter_type(None::<QueryParameterType>);
/// ```
pub fn set_or_clear_parameter_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterType>,
{
self.parameter_type = v.map(|x| x.into());
self
}
/// Sets the value of [parameter_value][crate::model::QueryParameter::parameter_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameter;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = QueryParameter::new().set_parameter_value(QueryParameterValue::default()/* use setters */);
/// ```
pub fn set_parameter_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.parameter_value = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameter_value][crate::model::QueryParameter::parameter_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::QueryParameter;
/// use google_cloud_bigquery_v2::model::QueryParameterValue;
/// let x = QueryParameter::new().set_or_clear_parameter_value(Some(QueryParameterValue::default()/* use setters */));
/// let x = QueryParameter::new().set_or_clear_parameter_value(None::<QueryParameterValue>);
/// ```
pub fn set_or_clear_parameter_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameterValue>,
{
self.parameter_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for QueryParameter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.QueryParameter"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RangePartitioning {
/// Required. The name of the column to partition the table on. It must be a
/// top-level, INT64 column whose mode is NULLABLE or REQUIRED.
pub field: std::string::String,
/// Defines the ranges for range partitioning.
pub range: std::option::Option<crate::model::range_partitioning::Range>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RangePartitioning {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [field][crate::model::RangePartitioning::field].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = RangePartitioning::new().set_field("example");
/// ```
pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field = v.into();
self
}
/// Sets the value of [range][crate::model::RangePartitioning::range].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangePartitioning;
/// use google_cloud_bigquery_v2::model::range_partitioning::Range;
/// let x = RangePartitioning::new().set_range(Range::default()/* use setters */);
/// ```
pub fn set_range<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::range_partitioning::Range>,
{
self.range = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range][crate::model::RangePartitioning::range].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RangePartitioning;
/// use google_cloud_bigquery_v2::model::range_partitioning::Range;
/// let x = RangePartitioning::new().set_or_clear_range(Some(Range::default()/* use setters */));
/// let x = RangePartitioning::new().set_or_clear_range(None::<Range>);
/// ```
pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::range_partitioning::Range>,
{
self.range = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RangePartitioning {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RangePartitioning"
}
}
/// Defines additional types related to [RangePartitioning].
pub mod range_partitioning {
#[allow(unused_imports)]
use super::*;
/// Defines the ranges for range partitioning.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Range {
/// Required. The start of range partitioning, inclusive. This field is an
/// INT64 value represented as a string.
pub start: std::string::String,
/// Required. The end of range partitioning, exclusive. This field is an
/// INT64 value represented as a string.
pub end: std::string::String,
/// Required. The width of each interval. This field is an INT64 value
/// represented as a string.
pub interval: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Range {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [start][crate::model::range_partitioning::Range::start].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::range_partitioning::Range;
/// let x = Range::new().set_start("example");
/// ```
pub fn set_start<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.start = v.into();
self
}
/// Sets the value of [end][crate::model::range_partitioning::Range::end].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::range_partitioning::Range;
/// let x = Range::new().set_end("example");
/// ```
pub fn set_end<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.end = v.into();
self
}
/// Sets the value of [interval][crate::model::range_partitioning::Range::interval].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::range_partitioning::Range;
/// let x = Range::new().set_interval("example");
/// ```
pub fn set_interval<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.interval = v.into();
self
}
}
impl wkt::message::Message for Range {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RangePartitioning.Range"
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestrictionConfig {
/// Output only. Specifies the type of dataset/table restriction.
pub r#type: crate::model::restriction_config::RestrictionType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RestrictionConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::RestrictionConfig::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RestrictionConfig;
/// use google_cloud_bigquery_v2::model::restriction_config::RestrictionType;
/// let x0 = RestrictionConfig::new().set_type(RestrictionType::RestrictedDataEgress);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::restriction_config::RestrictionType>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
}
impl wkt::message::Message for RestrictionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RestrictionConfig"
}
}
/// Defines additional types related to [RestrictionConfig].
pub mod restriction_config {
#[allow(unused_imports)]
use super::*;
/// RestrictionType specifies the type of dataset/table restriction.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RestrictionType {
/// Should never be used.
Unspecified,
/// Restrict data egress. See [Data
/// egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress)
/// for more details.
RestrictedDataEgress,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RestrictionType::value] or
/// [RestrictionType::name].
UnknownValue(restriction_type::UnknownValue),
}
#[doc(hidden)]
pub mod restriction_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RestrictionType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RestrictedDataEgress => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RESTRICTION_TYPE_UNSPECIFIED"),
Self::RestrictedDataEgress => std::option::Option::Some("RESTRICTED_DATA_EGRESS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RestrictionType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RestrictionType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RestrictionType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::RestrictedDataEgress,
_ => Self::UnknownValue(restriction_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RestrictionType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESTRICTION_TYPE_UNSPECIFIED" => Self::Unspecified,
"RESTRICTED_DATA_EGRESS" => Self::RestrictedDataEgress,
_ => Self::UnknownValue(restriction_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RestrictionType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RestrictedDataEgress => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RestrictionType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RestrictionType>::new(
".google.cloud.bigquery.v2.RestrictionConfig.RestrictionType",
))
}
}
}
/// A user-defined function or a stored procedure.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Routine {
/// Output only. A hash of this resource.
pub etag: std::string::String,
/// Required. Reference describing the ID of this routine.
pub routine_reference: std::option::Option<crate::model::RoutineReference>,
/// Required. The type of routine.
pub routine_type: crate::model::routine::RoutineType,
/// Output only. The time when this routine was created, in milliseconds since
/// the epoch.
pub creation_time: i64,
/// Output only. The time when this routine was last modified, in milliseconds
/// since the epoch.
pub last_modified_time: i64,
/// Optional. Defaults to "SQL" if remote_function_options field is absent, not
/// set otherwise.
pub language: crate::model::routine::Language,
/// Optional.
pub arguments: std::vec::Vec<crate::model::routine::Argument>,
/// Optional if language = "SQL"; required otherwise.
/// Cannot be set if routine_type = "TABLE_VALUED_FUNCTION".
///
/// If absent, the return type is inferred from definition_body at query time
/// in each query that references this routine. If present, then the evaluated
/// result will be cast to the specified returned type at query time.
///
/// For example, for the functions created with the following statements:
///
/// * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
///
/// * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
///
/// * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
///
///
/// The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and
/// is absent for `Increment` (inferred as FLOAT64 at query time).
///
/// Suppose the function `Add` is replaced by
/// `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
///
/// Then the inferred return type of `Increment` is automatically changed to
/// INT64 at query time, while the return type of `Decrement` remains FLOAT64.
pub return_type: std::option::Option<crate::model::StandardSqlDataType>,
/// Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION".
///
/// If absent, the return table type is inferred from definition_body at query
/// time in each query that references this routine. If present, then the
/// columns in the evaluated table result will be cast to match the column
/// types specified in return table type, at query time.
pub return_table_type: std::option::Option<crate::model::StandardSqlTableType>,
/// Optional. If language = "JAVASCRIPT", this field stores the path of the
/// imported JAVASCRIPT libraries.
pub imported_libraries: std::vec::Vec<std::string::String>,
/// Required. The body of the routine.
///
/// For functions, this is the expression in the AS clause.
///
/// If `language = "SQL"`, it is the substring inside (but excluding) the
/// parentheses. For example, for the function created with the following
/// statement:
///
/// `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))`
///
/// The definition_body is `concat(x, "\n", y)` (\n is not replaced with
/// linebreak).
///
/// If `language="JAVASCRIPT"`, it is the evaluated string in the AS clause.
/// For example, for the function created with the following statement:
///
/// `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'`
///
/// The definition_body is
///
/// `return "\n";\n`
///
/// Note that both \n are replaced with linebreaks.
///
/// If `definition_body` references another routine, then that routine must
/// be fully qualified with its project ID.
pub definition_body: std::string::String,
/// Optional. The description of the routine, if defined.
pub description: std::string::String,
/// Optional. The determinism level of the JavaScript UDF, if defined.
pub determinism_level: crate::model::routine::DeterminismLevel,
/// Optional. The security mode of the routine, if defined. If not defined, the
/// security mode is automatically determined from the routine's configuration.
pub security_mode: crate::model::routine::SecurityMode,
/// Optional. Use this option to catch many common errors. Error checking is
/// not exhaustive, and successfully creating a procedure doesn't guarantee
/// that the procedure will successfully execute at runtime. If `strictMode` is
/// set to `TRUE`, the procedure body is further checked for errors such as
/// non-existent tables or columns. The `CREATE PROCEDURE` statement fails if
/// the body fails any of these checks.
///
/// If `strictMode` is set to `FALSE`, the procedure body is checked only for
/// syntax. For procedures that invoke themselves recursively, specify
/// `strictMode=FALSE` to avoid non-existent procedure errors during
/// validation.
///
/// Default value is `TRUE`.
pub strict_mode: std::option::Option<wkt::BoolValue>,
/// Optional. Remote function specific options.
pub remote_function_options: std::option::Option<crate::model::routine::RemoteFunctionOptions>,
/// Optional. Spark specific options.
pub spark_options: std::option::Option<crate::model::SparkOptions>,
/// Optional. If set to `DATA_MASKING`, the function is validated and made
/// available as a masking function. For more information, see [Create custom
/// masking
/// routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
pub data_governance_type: crate::model::routine::DataGovernanceType,
/// Optional. Options for the Python UDF.
/// [Preview](https://cloud.google.com/products/#product-launch-stages)
pub python_options: std::option::Option<crate::model::PythonOptions>,
/// Optional. Options for the runtime of the external system executing the
/// routine. This field is only applicable for Python UDFs.
/// [Preview](https://cloud.google.com/products/#product-launch-stages)
pub external_runtime_options: std::option::Option<crate::model::ExternalRuntimeOptions>,
/// Output only. The build status of the routine. This field is only applicable
/// to Python UDFs.
/// [Preview](https://cloud.google.com/products/#product-launch-stages)
pub build_status: std::option::Option<crate::model::RoutineBuildStatus>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Routine {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [etag][crate::model::Routine::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [routine_reference][crate::model::Routine::routine_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = Routine::new().set_routine_reference(RoutineReference::default()/* use setters */);
/// ```
pub fn set_routine_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.routine_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [routine_reference][crate::model::Routine::routine_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = Routine::new().set_or_clear_routine_reference(Some(RoutineReference::default()/* use setters */));
/// let x = Routine::new().set_or_clear_routine_reference(None::<RoutineReference>);
/// ```
pub fn set_or_clear_routine_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutineReference>,
{
self.routine_reference = v.map(|x| x.into());
self
}
/// Sets the value of [routine_type][crate::model::Routine::routine_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::RoutineType;
/// let x0 = Routine::new().set_routine_type(RoutineType::ScalarFunction);
/// let x1 = Routine::new().set_routine_type(RoutineType::Procedure);
/// let x2 = Routine::new().set_routine_type(RoutineType::TableValuedFunction);
/// ```
pub fn set_routine_type<T: std::convert::Into<crate::model::routine::RoutineType>>(
mut self,
v: T,
) -> Self {
self.routine_type = v.into();
self
}
/// Sets the value of [creation_time][crate::model::Routine::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [last_modified_time][crate::model::Routine::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_last_modified_time(42);
/// ```
pub fn set_last_modified_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.last_modified_time = v.into();
self
}
/// Sets the value of [language][crate::model::Routine::language].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::Language;
/// let x0 = Routine::new().set_language(Language::Sql);
/// let x1 = Routine::new().set_language(Language::Javascript);
/// let x2 = Routine::new().set_language(Language::Python);
/// ```
pub fn set_language<T: std::convert::Into<crate::model::routine::Language>>(
mut self,
v: T,
) -> Self {
self.language = v.into();
self
}
/// Sets the value of [arguments][crate::model::Routine::arguments].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::Argument;
/// let x = Routine::new()
/// .set_arguments([
/// Argument::default()/* use setters */,
/// Argument::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_arguments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::routine::Argument>,
{
use std::iter::Iterator;
self.arguments = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [return_type][crate::model::Routine::return_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = Routine::new().set_return_type(StandardSqlDataType::default()/* use setters */);
/// ```
pub fn set_return_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.return_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [return_type][crate::model::Routine::return_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = Routine::new().set_or_clear_return_type(Some(StandardSqlDataType::default()/* use setters */));
/// let x = Routine::new().set_or_clear_return_type(None::<StandardSqlDataType>);
/// ```
pub fn set_or_clear_return_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.return_type = v.map(|x| x.into());
self
}
/// Sets the value of [return_table_type][crate::model::Routine::return_table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::StandardSqlTableType;
/// let x = Routine::new().set_return_table_type(StandardSqlTableType::default()/* use setters */);
/// ```
pub fn set_return_table_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlTableType>,
{
self.return_table_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [return_table_type][crate::model::Routine::return_table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::StandardSqlTableType;
/// let x = Routine::new().set_or_clear_return_table_type(Some(StandardSqlTableType::default()/* use setters */));
/// let x = Routine::new().set_or_clear_return_table_type(None::<StandardSqlTableType>);
/// ```
pub fn set_or_clear_return_table_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlTableType>,
{
self.return_table_type = v.map(|x| x.into());
self
}
/// Sets the value of [imported_libraries][crate::model::Routine::imported_libraries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_imported_libraries(["a", "b", "c"]);
/// ```
pub fn set_imported_libraries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.imported_libraries = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [definition_body][crate::model::Routine::definition_body].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_definition_body("example");
/// ```
pub fn set_definition_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.definition_body = v.into();
self
}
/// Sets the value of [description][crate::model::Routine::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// let x = Routine::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [determinism_level][crate::model::Routine::determinism_level].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::DeterminismLevel;
/// let x0 = Routine::new().set_determinism_level(DeterminismLevel::Deterministic);
/// let x1 = Routine::new().set_determinism_level(DeterminismLevel::NotDeterministic);
/// ```
pub fn set_determinism_level<T: std::convert::Into<crate::model::routine::DeterminismLevel>>(
mut self,
v: T,
) -> Self {
self.determinism_level = v.into();
self
}
/// Sets the value of [security_mode][crate::model::Routine::security_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::SecurityMode;
/// let x0 = Routine::new().set_security_mode(SecurityMode::Definer);
/// let x1 = Routine::new().set_security_mode(SecurityMode::Invoker);
/// ```
pub fn set_security_mode<T: std::convert::Into<crate::model::routine::SecurityMode>>(
mut self,
v: T,
) -> Self {
self.security_mode = v.into();
self
}
/// Sets the value of [strict_mode][crate::model::Routine::strict_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use wkt::BoolValue;
/// let x = Routine::new().set_strict_mode(BoolValue::default()/* use setters */);
/// ```
pub fn set_strict_mode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.strict_mode = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [strict_mode][crate::model::Routine::strict_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use wkt::BoolValue;
/// let x = Routine::new().set_or_clear_strict_mode(Some(BoolValue::default()/* use setters */));
/// let x = Routine::new().set_or_clear_strict_mode(None::<BoolValue>);
/// ```
pub fn set_or_clear_strict_mode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.strict_mode = v.map(|x| x.into());
self
}
/// Sets the value of [remote_function_options][crate::model::Routine::remote_function_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = Routine::new().set_remote_function_options(RemoteFunctionOptions::default()/* use setters */);
/// ```
pub fn set_remote_function_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::routine::RemoteFunctionOptions>,
{
self.remote_function_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [remote_function_options][crate::model::Routine::remote_function_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = Routine::new().set_or_clear_remote_function_options(Some(RemoteFunctionOptions::default()/* use setters */));
/// let x = Routine::new().set_or_clear_remote_function_options(None::<RemoteFunctionOptions>);
/// ```
pub fn set_or_clear_remote_function_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::routine::RemoteFunctionOptions>,
{
self.remote_function_options = v.map(|x| x.into());
self
}
/// Sets the value of [spark_options][crate::model::Routine::spark_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = Routine::new().set_spark_options(SparkOptions::default()/* use setters */);
/// ```
pub fn set_spark_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SparkOptions>,
{
self.spark_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [spark_options][crate::model::Routine::spark_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = Routine::new().set_or_clear_spark_options(Some(SparkOptions::default()/* use setters */));
/// let x = Routine::new().set_or_clear_spark_options(None::<SparkOptions>);
/// ```
pub fn set_or_clear_spark_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SparkOptions>,
{
self.spark_options = v.map(|x| x.into());
self
}
/// Sets the value of [data_governance_type][crate::model::Routine::data_governance_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::routine::DataGovernanceType;
/// let x0 = Routine::new().set_data_governance_type(DataGovernanceType::DataMasking);
/// ```
pub fn set_data_governance_type<
T: std::convert::Into<crate::model::routine::DataGovernanceType>,
>(
mut self,
v: T,
) -> Self {
self.data_governance_type = v.into();
self
}
/// Sets the value of [python_options][crate::model::Routine::python_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::PythonOptions;
/// let x = Routine::new().set_python_options(PythonOptions::default()/* use setters */);
/// ```
pub fn set_python_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PythonOptions>,
{
self.python_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [python_options][crate::model::Routine::python_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::PythonOptions;
/// let x = Routine::new().set_or_clear_python_options(Some(PythonOptions::default()/* use setters */));
/// let x = Routine::new().set_or_clear_python_options(None::<PythonOptions>);
/// ```
pub fn set_or_clear_python_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PythonOptions>,
{
self.python_options = v.map(|x| x.into());
self
}
/// Sets the value of [external_runtime_options][crate::model::Routine::external_runtime_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = Routine::new().set_external_runtime_options(ExternalRuntimeOptions::default()/* use setters */);
/// ```
pub fn set_external_runtime_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalRuntimeOptions>,
{
self.external_runtime_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_runtime_options][crate::model::Routine::external_runtime_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = Routine::new().set_or_clear_external_runtime_options(Some(ExternalRuntimeOptions::default()/* use setters */));
/// let x = Routine::new().set_or_clear_external_runtime_options(None::<ExternalRuntimeOptions>);
/// ```
pub fn set_or_clear_external_runtime_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExternalRuntimeOptions>,
{
self.external_runtime_options = v.map(|x| x.into());
self
}
/// Sets the value of [build_status][crate::model::Routine::build_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// let x = Routine::new().set_build_status(RoutineBuildStatus::default()/* use setters */);
/// ```
pub fn set_build_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RoutineBuildStatus>,
{
self.build_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [build_status][crate::model::Routine::build_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Routine;
/// use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// let x = Routine::new().set_or_clear_build_status(Some(RoutineBuildStatus::default()/* use setters */));
/// let x = Routine::new().set_or_clear_build_status(None::<RoutineBuildStatus>);
/// ```
pub fn set_or_clear_build_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RoutineBuildStatus>,
{
self.build_status = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Routine {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Routine"
}
}
/// Defines additional types related to [Routine].
pub mod routine {
#[allow(unused_imports)]
use super::*;
/// Input/output argument of a function or a stored procedure.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Argument {
/// Optional. The name of this argument. Can be absent for function return
/// argument.
pub name: std::string::String,
/// Optional. Defaults to FIXED_TYPE.
pub argument_kind: crate::model::routine::argument::ArgumentKind,
/// Optional. Specifies whether the argument is input or output.
/// Can be set for procedures only.
pub mode: crate::model::routine::argument::Mode,
/// Set if argument_kind == FIXED_TYPE.
pub data_type: std::option::Option<crate::model::StandardSqlDataType>,
/// Optional. Set if argument_kind == FIXED_TABLE.
pub table_type: std::option::Option<crate::model::StandardSqlTableType>,
/// Optional. Whether the argument is an aggregate function parameter.
/// Must be Unset for routine types other than AGGREGATE_FUNCTION.
/// For AGGREGATE_FUNCTION, if set to false, it is equivalent to adding "NOT
/// AGGREGATE" clause in DDL; Otherwise, it is equivalent to omitting "NOT
/// AGGREGATE" clause in DDL.
pub is_aggregate: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Argument {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::routine::Argument::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// let x = Argument::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [argument_kind][crate::model::routine::Argument::argument_kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::routine::argument::ArgumentKind;
/// let x0 = Argument::new().set_argument_kind(ArgumentKind::FixedType);
/// let x1 = Argument::new().set_argument_kind(ArgumentKind::AnyType);
/// let x2 = Argument::new().set_argument_kind(ArgumentKind::FixedTable);
/// ```
pub fn set_argument_kind<
T: std::convert::Into<crate::model::routine::argument::ArgumentKind>,
>(
mut self,
v: T,
) -> Self {
self.argument_kind = v.into();
self
}
/// Sets the value of [mode][crate::model::routine::Argument::mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::routine::argument::Mode;
/// let x0 = Argument::new().set_mode(Mode::In);
/// let x1 = Argument::new().set_mode(Mode::Out);
/// let x2 = Argument::new().set_mode(Mode::Inout);
/// ```
pub fn set_mode<T: std::convert::Into<crate::model::routine::argument::Mode>>(
mut self,
v: T,
) -> Self {
self.mode = v.into();
self
}
/// Sets the value of [data_type][crate::model::routine::Argument::data_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = Argument::new().set_data_type(StandardSqlDataType::default()/* use setters */);
/// ```
pub fn set_data_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.data_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_type][crate::model::routine::Argument::data_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = Argument::new().set_or_clear_data_type(Some(StandardSqlDataType::default()/* use setters */));
/// let x = Argument::new().set_or_clear_data_type(None::<StandardSqlDataType>);
/// ```
pub fn set_or_clear_data_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.data_type = v.map(|x| x.into());
self
}
/// Sets the value of [table_type][crate::model::routine::Argument::table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::StandardSqlTableType;
/// let x = Argument::new().set_table_type(StandardSqlTableType::default()/* use setters */);
/// ```
pub fn set_table_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlTableType>,
{
self.table_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_type][crate::model::routine::Argument::table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use google_cloud_bigquery_v2::model::StandardSqlTableType;
/// let x = Argument::new().set_or_clear_table_type(Some(StandardSqlTableType::default()/* use setters */));
/// let x = Argument::new().set_or_clear_table_type(None::<StandardSqlTableType>);
/// ```
pub fn set_or_clear_table_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlTableType>,
{
self.table_type = v.map(|x| x.into());
self
}
/// Sets the value of [is_aggregate][crate::model::routine::Argument::is_aggregate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use wkt::BoolValue;
/// let x = Argument::new().set_is_aggregate(BoolValue::default()/* use setters */);
/// ```
pub fn set_is_aggregate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.is_aggregate = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_aggregate][crate::model::routine::Argument::is_aggregate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::Argument;
/// use wkt::BoolValue;
/// let x = Argument::new().set_or_clear_is_aggregate(Some(BoolValue::default()/* use setters */));
/// let x = Argument::new().set_or_clear_is_aggregate(None::<BoolValue>);
/// ```
pub fn set_or_clear_is_aggregate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.is_aggregate = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Argument {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Routine.Argument"
}
}
/// Defines additional types related to [Argument].
pub mod argument {
#[allow(unused_imports)]
use super::*;
/// Represents the kind of a given argument.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ArgumentKind {
/// Default value.
Unspecified,
/// The argument is a variable with fully specified type, which can be a
/// struct or an array, but not a table.
FixedType,
/// The argument is any type, including struct or array, but not a table.
AnyType,
/// The argument is a table with fully specified column names and types.
FixedTable,
/// The argument is any table type.
AnyTable,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ArgumentKind::value] or
/// [ArgumentKind::name].
UnknownValue(argument_kind::UnknownValue),
}
#[doc(hidden)]
pub mod argument_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ArgumentKind {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::FixedType => std::option::Option::Some(1),
Self::AnyType => std::option::Option::Some(2),
Self::FixedTable => std::option::Option::Some(3),
Self::AnyTable => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ARGUMENT_KIND_UNSPECIFIED"),
Self::FixedType => std::option::Option::Some("FIXED_TYPE"),
Self::AnyType => std::option::Option::Some("ANY_TYPE"),
Self::FixedTable => std::option::Option::Some("FIXED_TABLE"),
Self::AnyTable => std::option::Option::Some("ANY_TABLE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ArgumentKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ArgumentKind {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ArgumentKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::FixedType,
2 => Self::AnyType,
3 => Self::FixedTable,
4 => Self::AnyTable,
_ => Self::UnknownValue(argument_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ArgumentKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ARGUMENT_KIND_UNSPECIFIED" => Self::Unspecified,
"FIXED_TYPE" => Self::FixedType,
"ANY_TYPE" => Self::AnyType,
"FIXED_TABLE" => Self::FixedTable,
"ANY_TABLE" => Self::AnyTable,
_ => Self::UnknownValue(argument_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ArgumentKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::FixedType => serializer.serialize_i32(1),
Self::AnyType => serializer.serialize_i32(2),
Self::FixedTable => serializer.serialize_i32(3),
Self::AnyTable => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ArgumentKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ArgumentKind>::new(
".google.cloud.bigquery.v2.Routine.Argument.ArgumentKind",
))
}
}
/// The input/output mode of the argument.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Mode {
/// Default value.
Unspecified,
/// The argument is input-only.
In,
/// The argument is output-only.
Out,
/// The argument is both an input and an output.
Inout,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Mode::value] or
/// [Mode::name].
UnknownValue(mode::UnknownValue),
}
#[doc(hidden)]
pub mod mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Mode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::In => std::option::Option::Some(1),
Self::Out => std::option::Option::Some(2),
Self::Inout => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
Self::In => std::option::Option::Some("IN"),
Self::Out => std::option::Option::Some("OUT"),
Self::Inout => std::option::Option::Some("INOUT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Mode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Mode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Mode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::In,
2 => Self::Out,
3 => Self::Inout,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Mode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODE_UNSPECIFIED" => Self::Unspecified,
"IN" => Self::In,
"OUT" => Self::Out,
"INOUT" => Self::Inout,
_ => Self::UnknownValue(mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Mode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::In => serializer.serialize_i32(1),
Self::Out => serializer.serialize_i32(2),
Self::Inout => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Mode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
".google.cloud.bigquery.v2.Routine.Argument.Mode",
))
}
}
}
/// Options for a remote user-defined function.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoteFunctionOptions {
/// Endpoint of the user-provided remote service, e.g.
/// ```<https://us-east1-my_gcf_project.cloudfunctions.net/remote_add>```
pub endpoint: std::string::String,
/// Fully qualified name of the user-provided connection object which holds
/// the authentication information to send requests to the remote service.
/// Format:
/// ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
pub connection: std::string::String,
/// User-defined context as a set of key/value pairs, which will be sent as
/// function invocation context together with batched arguments in the
/// requests to the remote service. The total number of bytes of keys and
/// values must be less than 8KB.
pub user_defined_context:
std::collections::HashMap<std::string::String, std::string::String>,
/// Max number of rows in each batch sent to the remote service.
/// If absent or if 0, BigQuery dynamically decides the number of rows in a
/// batch.
pub max_batching_rows: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RemoteFunctionOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [endpoint][crate::model::routine::RemoteFunctionOptions::endpoint].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = RemoteFunctionOptions::new().set_endpoint("example");
/// ```
pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.endpoint = v.into();
self
}
/// Sets the value of [connection][crate::model::routine::RemoteFunctionOptions::connection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = RemoteFunctionOptions::new().set_connection("example");
/// ```
pub fn set_connection<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection = v.into();
self
}
/// Sets the value of [user_defined_context][crate::model::routine::RemoteFunctionOptions::user_defined_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = RemoteFunctionOptions::new().set_user_defined_context([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_user_defined_context<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.user_defined_context = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [max_batching_rows][crate::model::routine::RemoteFunctionOptions::max_batching_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::routine::RemoteFunctionOptions;
/// let x = RemoteFunctionOptions::new().set_max_batching_rows(42);
/// ```
pub fn set_max_batching_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_batching_rows = v.into();
self
}
}
impl wkt::message::Message for RemoteFunctionOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Routine.RemoteFunctionOptions"
}
}
/// The fine-grained type of the routine.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RoutineType {
/// Default value.
Unspecified,
/// Non-built-in persistent scalar function.
ScalarFunction,
/// Stored procedure.
Procedure,
/// Non-built-in persistent TVF.
TableValuedFunction,
/// Non-built-in persistent aggregate function.
AggregateFunction,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RoutineType::value] or
/// [RoutineType::name].
UnknownValue(routine_type::UnknownValue),
}
#[doc(hidden)]
pub mod routine_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RoutineType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ScalarFunction => std::option::Option::Some(1),
Self::Procedure => std::option::Option::Some(2),
Self::TableValuedFunction => std::option::Option::Some(3),
Self::AggregateFunction => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ROUTINE_TYPE_UNSPECIFIED"),
Self::ScalarFunction => std::option::Option::Some("SCALAR_FUNCTION"),
Self::Procedure => std::option::Option::Some("PROCEDURE"),
Self::TableValuedFunction => std::option::Option::Some("TABLE_VALUED_FUNCTION"),
Self::AggregateFunction => std::option::Option::Some("AGGREGATE_FUNCTION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RoutineType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RoutineType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RoutineType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ScalarFunction,
2 => Self::Procedure,
3 => Self::TableValuedFunction,
4 => Self::AggregateFunction,
_ => Self::UnknownValue(routine_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RoutineType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ROUTINE_TYPE_UNSPECIFIED" => Self::Unspecified,
"SCALAR_FUNCTION" => Self::ScalarFunction,
"PROCEDURE" => Self::Procedure,
"TABLE_VALUED_FUNCTION" => Self::TableValuedFunction,
"AGGREGATE_FUNCTION" => Self::AggregateFunction,
_ => Self::UnknownValue(routine_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RoutineType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ScalarFunction => serializer.serialize_i32(1),
Self::Procedure => serializer.serialize_i32(2),
Self::TableValuedFunction => serializer.serialize_i32(3),
Self::AggregateFunction => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RoutineType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoutineType>::new(
".google.cloud.bigquery.v2.Routine.RoutineType",
))
}
}
/// The language of the routine.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Language {
/// Default value.
Unspecified,
/// SQL language.
Sql,
/// JavaScript language.
Javascript,
/// Python language.
Python,
/// Java language.
Java,
/// Scala language.
Scala,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Language::value] or
/// [Language::name].
UnknownValue(language::UnknownValue),
}
#[doc(hidden)]
pub mod language {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Language {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Sql => std::option::Option::Some(1),
Self::Javascript => std::option::Option::Some(2),
Self::Python => std::option::Option::Some(3),
Self::Java => std::option::Option::Some(4),
Self::Scala => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LANGUAGE_UNSPECIFIED"),
Self::Sql => std::option::Option::Some("SQL"),
Self::Javascript => std::option::Option::Some("JAVASCRIPT"),
Self::Python => std::option::Option::Some("PYTHON"),
Self::Java => std::option::Option::Some("JAVA"),
Self::Scala => std::option::Option::Some("SCALA"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Language {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Language {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Language {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Sql,
2 => Self::Javascript,
3 => Self::Python,
4 => Self::Java,
5 => Self::Scala,
_ => Self::UnknownValue(language::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Language {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LANGUAGE_UNSPECIFIED" => Self::Unspecified,
"SQL" => Self::Sql,
"JAVASCRIPT" => Self::Javascript,
"PYTHON" => Self::Python,
"JAVA" => Self::Java,
"SCALA" => Self::Scala,
_ => Self::UnknownValue(language::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Language {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Sql => serializer.serialize_i32(1),
Self::Javascript => serializer.serialize_i32(2),
Self::Python => serializer.serialize_i32(3),
Self::Java => serializer.serialize_i32(4),
Self::Scala => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Language {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Language>::new(
".google.cloud.bigquery.v2.Routine.Language",
))
}
}
/// JavaScript UDF determinism levels.
///
/// If all JavaScript UDFs are DETERMINISTIC, the query result is
/// potentially cacheable (see below). If any JavaScript UDF is
/// NOT_DETERMINISTIC, the query result is not cacheable.
///
/// Even if a JavaScript UDF is deterministic, many other factors can prevent
/// usage of cached query results. Example factors include but not limited to:
/// DDL/DML, non-deterministic SQL function calls, update of referenced
/// tables/views/UDFs or imported JavaScript libraries.
///
/// SQL UDFs cannot have determinism specified. Their determinism is
/// automatically determined.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DeterminismLevel {
/// The determinism of the UDF is unspecified.
Unspecified,
/// The UDF is deterministic, meaning that 2 function calls with the same
/// inputs always produce the same result, even across 2 query runs.
Deterministic,
/// The UDF is not deterministic.
NotDeterministic,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DeterminismLevel::value] or
/// [DeterminismLevel::name].
UnknownValue(determinism_level::UnknownValue),
}
#[doc(hidden)]
pub mod determinism_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DeterminismLevel {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Deterministic => std::option::Option::Some(1),
Self::NotDeterministic => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DETERMINISM_LEVEL_UNSPECIFIED"),
Self::Deterministic => std::option::Option::Some("DETERMINISTIC"),
Self::NotDeterministic => std::option::Option::Some("NOT_DETERMINISTIC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DeterminismLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DeterminismLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DeterminismLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Deterministic,
2 => Self::NotDeterministic,
_ => Self::UnknownValue(determinism_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DeterminismLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DETERMINISM_LEVEL_UNSPECIFIED" => Self::Unspecified,
"DETERMINISTIC" => Self::Deterministic,
"NOT_DETERMINISTIC" => Self::NotDeterministic,
_ => Self::UnknownValue(determinism_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DeterminismLevel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Deterministic => serializer.serialize_i32(1),
Self::NotDeterministic => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DeterminismLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeterminismLevel>::new(
".google.cloud.bigquery.v2.Routine.DeterminismLevel",
))
}
}
/// Security mode.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SecurityMode {
/// The security mode of the routine is unspecified.
Unspecified,
/// The routine is to be executed with the privileges of the user who
/// defines it.
Definer,
/// The routine is to be executed with the privileges of the user who
/// invokes it.
Invoker,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SecurityMode::value] or
/// [SecurityMode::name].
UnknownValue(security_mode::UnknownValue),
}
#[doc(hidden)]
pub mod security_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SecurityMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Definer => std::option::Option::Some(1),
Self::Invoker => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SECURITY_MODE_UNSPECIFIED"),
Self::Definer => std::option::Option::Some("DEFINER"),
Self::Invoker => std::option::Option::Some("INVOKER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SecurityMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SecurityMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SecurityMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Definer,
2 => Self::Invoker,
_ => Self::UnknownValue(security_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SecurityMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SECURITY_MODE_UNSPECIFIED" => Self::Unspecified,
"DEFINER" => Self::Definer,
"INVOKER" => Self::Invoker,
_ => Self::UnknownValue(security_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SecurityMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Definer => serializer.serialize_i32(1),
Self::Invoker => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SecurityMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityMode>::new(
".google.cloud.bigquery.v2.Routine.SecurityMode",
))
}
}
/// Data governance type values. Only supports `DATA_MASKING`.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataGovernanceType {
/// The data governance type is unspecified.
Unspecified,
/// The data governance type is data masking.
DataMasking,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DataGovernanceType::value] or
/// [DataGovernanceType::name].
UnknownValue(data_governance_type::UnknownValue),
}
#[doc(hidden)]
pub mod data_governance_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DataGovernanceType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DataMasking => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATA_GOVERNANCE_TYPE_UNSPECIFIED"),
Self::DataMasking => std::option::Option::Some("DATA_MASKING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DataGovernanceType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DataGovernanceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DataGovernanceType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DataMasking,
_ => Self::UnknownValue(data_governance_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DataGovernanceType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATA_GOVERNANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
"DATA_MASKING" => Self::DataMasking,
_ => Self::UnknownValue(data_governance_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DataGovernanceType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::DataMasking => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DataGovernanceType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataGovernanceType>::new(
".google.cloud.bigquery.v2.Routine.DataGovernanceType",
))
}
}
}
/// Options for a user-defined Python function.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PythonOptions {
/// Required. The name of the function defined in Python code as the entry
/// point when the Python UDF is invoked.
pub entry_point: std::string::String,
/// Optional. A list of Python package names along with versions to be
/// installed. Example: ["pandas>=2.1", "google-cloud-translate==3.11"]. For
/// more information, see [Use third-party
/// packages](https://cloud.google.com/bigquery/docs/user-defined-functions-python#third-party-packages).
pub packages: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PythonOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entry_point][crate::model::PythonOptions::entry_point].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PythonOptions;
/// let x = PythonOptions::new().set_entry_point("example");
/// ```
pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entry_point = v.into();
self
}
/// Sets the value of [packages][crate::model::PythonOptions::packages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PythonOptions;
/// let x = PythonOptions::new().set_packages(["a", "b", "c"]);
/// ```
pub fn set_packages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.packages = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PythonOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PythonOptions"
}
}
/// Options for the runtime of the external system.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalRuntimeOptions {
/// Optional. Amount of memory provisioned for a Python UDF container instance.
/// Format: {number}{unit} where unit is one of "M", "G", "Mi" and "Gi" (e.g.
/// 1G, 512Mi). If not specified, the default value is 512Mi. For more
/// information, see [Configure container limits for Python
/// UDFs](https://cloud.google.com/bigquery/docs/user-defined-functions-python#configure-container-limits)
pub container_memory: std::string::String,
/// Optional. Amount of CPU provisioned for a Python UDF container instance.
/// For more information, see [Configure container limits for Python
/// UDFs](https://cloud.google.com/bigquery/docs/user-defined-functions-python#configure-container-limits)
pub container_cpu: f64,
/// Optional. Fully qualified name of the connection whose service account will
/// be used to execute the code in the container. Format:
/// ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
pub runtime_connection: std::string::String,
/// Optional. Maximum number of rows in each batch sent to the external
/// runtime. If absent or if 0, BigQuery dynamically decides the number of rows
/// in a batch.
pub max_batching_rows: i64,
/// Optional. Language runtime version. Example: `python-3.11`.
pub runtime_version: std::string::String,
/// Optional. Maximum number of requests that a Python UDF instance can handle
/// concurrently. If absent or if `0`, the default concurrency value is used.
/// For more information, see [Configure container limits for Python
/// UDFs](https://cloud.google.com/bigquery/docs/user-defined-functions-python#configure-container-limits).
pub container_request_concurrency: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalRuntimeOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [container_memory][crate::model::ExternalRuntimeOptions::container_memory].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_container_memory("example");
/// ```
pub fn set_container_memory<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.container_memory = v.into();
self
}
/// Sets the value of [container_cpu][crate::model::ExternalRuntimeOptions::container_cpu].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_container_cpu(42.0);
/// ```
pub fn set_container_cpu<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.container_cpu = v.into();
self
}
/// Sets the value of [runtime_connection][crate::model::ExternalRuntimeOptions::runtime_connection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_runtime_connection("example");
/// ```
pub fn set_runtime_connection<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.runtime_connection = v.into();
self
}
/// Sets the value of [max_batching_rows][crate::model::ExternalRuntimeOptions::max_batching_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_max_batching_rows(42);
/// ```
pub fn set_max_batching_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_batching_rows = v.into();
self
}
/// Sets the value of [runtime_version][crate::model::ExternalRuntimeOptions::runtime_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_runtime_version("example");
/// ```
pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.runtime_version = v.into();
self
}
/// Sets the value of [container_request_concurrency][crate::model::ExternalRuntimeOptions::container_request_concurrency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ExternalRuntimeOptions;
/// let x = ExternalRuntimeOptions::new().set_container_request_concurrency(42);
/// ```
pub fn set_container_request_concurrency<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.container_request_concurrency = v.into();
self
}
}
impl wkt::message::Message for ExternalRuntimeOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ExternalRuntimeOptions"
}
}
/// Options for a user-defined Spark routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SparkOptions {
/// Fully qualified name of the user-provided Spark connection object. Format:
/// ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
pub connection: std::string::String,
/// Runtime version. If not specified, the default runtime version is used.
pub runtime_version: std::string::String,
/// Custom container image for the runtime environment.
pub container_image: std::string::String,
/// Configuration properties as a set of key/value pairs, which will be passed
/// on to the Spark application. For more information, see
/// [Apache Spark](https://spark.apache.org/docs/latest/index.html) and the
/// [procedure option
/// list](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#procedure_option_list).
pub properties: std::collections::HashMap<std::string::String, std::string::String>,
/// The main file/jar URI of the Spark application. Exactly one of the
/// definition_body field and the main_file_uri field must be set for Python.
/// Exactly one of main_class and main_file_uri field
/// should be set for Java/Scala language type.
pub main_file_uri: std::string::String,
/// Python files to be placed on the PYTHONPATH for PySpark application.
/// Supported file types: `.py`, `.egg`, and `.zip`. For more information
/// about Apache Spark, see
/// [Apache Spark](https://spark.apache.org/docs/latest/index.html).
pub py_file_uris: std::vec::Vec<std::string::String>,
/// JARs to include on the driver and executor CLASSPATH.
/// For more information about Apache Spark, see
/// [Apache Spark](https://spark.apache.org/docs/latest/index.html).
pub jar_uris: std::vec::Vec<std::string::String>,
/// Files to be placed in the working directory of each executor.
/// For more information about Apache Spark, see
/// [Apache Spark](https://spark.apache.org/docs/latest/index.html).
pub file_uris: std::vec::Vec<std::string::String>,
/// Archive files to be extracted into the working directory of each executor.
/// For more information about Apache Spark, see
/// [Apache Spark](https://spark.apache.org/docs/latest/index.html).
pub archive_uris: std::vec::Vec<std::string::String>,
/// The fully qualified name of a class in jar_uris, for example,
/// com.example.wordcount. Exactly one of main_class and main_jar_uri field
/// should be set for Java/Scala language type.
pub main_class: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SparkOptions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [connection][crate::model::SparkOptions::connection].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_connection("example");
/// ```
pub fn set_connection<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection = v.into();
self
}
/// Sets the value of [runtime_version][crate::model::SparkOptions::runtime_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_runtime_version("example");
/// ```
pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.runtime_version = v.into();
self
}
/// Sets the value of [container_image][crate::model::SparkOptions::container_image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_container_image("example");
/// ```
pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.container_image = v.into();
self
}
/// Sets the value of [properties][crate::model::SparkOptions::properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_properties([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_properties<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [main_file_uri][crate::model::SparkOptions::main_file_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_main_file_uri("example");
/// ```
pub fn set_main_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.main_file_uri = v.into();
self
}
/// Sets the value of [py_file_uris][crate::model::SparkOptions::py_file_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_py_file_uris(["a", "b", "c"]);
/// ```
pub fn set_py_file_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.py_file_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [jar_uris][crate::model::SparkOptions::jar_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_jar_uris(["a", "b", "c"]);
/// ```
pub fn set_jar_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.jar_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [file_uris][crate::model::SparkOptions::file_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_file_uris(["a", "b", "c"]);
/// ```
pub fn set_file_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.file_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [archive_uris][crate::model::SparkOptions::archive_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_archive_uris(["a", "b", "c"]);
/// ```
pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.archive_uris = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [main_class][crate::model::SparkOptions::main_class].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SparkOptions;
/// let x = SparkOptions::new().set_main_class("example");
/// ```
pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.main_class = v.into();
self
}
}
impl wkt::message::Message for SparkOptions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SparkOptions"
}
}
/// The status of a routine build.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RoutineBuildStatus {
/// Output only. The current build state of the routine.
pub build_state: crate::model::routine_build_status::BuildState,
/// Output only. A result object that will be present only if the build has
/// failed.
pub error_result: std::option::Option<crate::model::ErrorProto>,
/// Output only. The time when the build state was updated last.
pub build_state_update_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time taken for the image build. Populated only after the
/// build succeeds or fails.
pub build_duration: std::option::Option<wkt::Duration>,
/// Output only. The size of the image in bytes. Populated only after the build
/// succeeds.
pub image_size_bytes: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RoutineBuildStatus {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [build_state][crate::model::RoutineBuildStatus::build_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use google_cloud_bigquery_v2::model::routine_build_status::BuildState;
/// let x0 = RoutineBuildStatus::new().set_build_state(BuildState::InProgress);
/// let x1 = RoutineBuildStatus::new().set_build_state(BuildState::Succeeded);
/// let x2 = RoutineBuildStatus::new().set_build_state(BuildState::Failed);
/// ```
pub fn set_build_state<
T: std::convert::Into<crate::model::routine_build_status::BuildState>,
>(
mut self,
v: T,
) -> Self {
self.build_state = v.into();
self
}
/// Sets the value of [error_result][crate::model::RoutineBuildStatus::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = RoutineBuildStatus::new().set_error_result(ErrorProto::default()/* use setters */);
/// ```
pub fn set_error_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_result][crate::model::RoutineBuildStatus::error_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = RoutineBuildStatus::new().set_or_clear_error_result(Some(ErrorProto::default()/* use setters */));
/// let x = RoutineBuildStatus::new().set_or_clear_error_result(None::<ErrorProto>);
/// ```
pub fn set_or_clear_error_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.error_result = v.map(|x| x.into());
self
}
/// Sets the value of [build_state_update_time][crate::model::RoutineBuildStatus::build_state_update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use wkt::Timestamp;
/// let x = RoutineBuildStatus::new().set_build_state_update_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_build_state_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_state_update_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [build_state_update_time][crate::model::RoutineBuildStatus::build_state_update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use wkt::Timestamp;
/// let x = RoutineBuildStatus::new().set_or_clear_build_state_update_time(Some(Timestamp::default()/* use setters */));
/// let x = RoutineBuildStatus::new().set_or_clear_build_state_update_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_build_state_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_state_update_time = v.map(|x| x.into());
self
}
/// Sets the value of [build_duration][crate::model::RoutineBuildStatus::build_duration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use wkt::Duration;
/// let x = RoutineBuildStatus::new().set_build_duration(Duration::default()/* use setters */);
/// ```
pub fn set_build_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.build_duration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [build_duration][crate::model::RoutineBuildStatus::build_duration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// use wkt::Duration;
/// let x = RoutineBuildStatus::new().set_or_clear_build_duration(Some(Duration::default()/* use setters */));
/// let x = RoutineBuildStatus::new().set_or_clear_build_duration(None::<Duration>);
/// ```
pub fn set_or_clear_build_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.build_duration = v.map(|x| x.into());
self
}
/// Sets the value of [image_size_bytes][crate::model::RoutineBuildStatus::image_size_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineBuildStatus;
/// let x = RoutineBuildStatus::new().set_image_size_bytes(42);
/// ```
pub fn set_image_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.image_size_bytes = v.into();
self
}
}
impl wkt::message::Message for RoutineBuildStatus {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RoutineBuildStatus"
}
}
/// Defines additional types related to [RoutineBuildStatus].
pub mod routine_build_status {
#[allow(unused_imports)]
use super::*;
/// The build state of a routine.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum BuildState {
/// Default value.
Unspecified,
/// The build is in progress.
InProgress,
/// The build has succeeded.
Succeeded,
/// The build has failed.
Failed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [BuildState::value] or
/// [BuildState::name].
UnknownValue(build_state::UnknownValue),
}
#[doc(hidden)]
pub mod build_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl BuildState {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::InProgress => std::option::Option::Some(1),
Self::Succeeded => std::option::Option::Some(2),
Self::Failed => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("BUILD_STATE_UNSPECIFIED"),
Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for BuildState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for BuildState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for BuildState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::InProgress,
2 => Self::Succeeded,
3 => Self::Failed,
_ => Self::UnknownValue(build_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for BuildState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"BUILD_STATE_UNSPECIFIED" => Self::Unspecified,
"IN_PROGRESS" => Self::InProgress,
"SUCCEEDED" => Self::Succeeded,
"FAILED" => Self::Failed,
_ => Self::UnknownValue(build_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for BuildState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::InProgress => serializer.serialize_i32(1),
Self::Succeeded => serializer.serialize_i32(2),
Self::Failed => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for BuildState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<BuildState>::new(
".google.cloud.bigquery.v2.RoutineBuildStatus.BuildState",
))
}
}
}
/// Describes the format for getting information about a routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRoutineRequest {
/// Required. Project ID of the requested routine
pub project_id: std::string::String,
/// Required. Dataset ID of the requested routine
pub dataset_id: std::string::String,
/// Required. Routine ID of the requested routine
pub routine_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetRoutineRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetRoutineRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRoutineRequest;
/// let x = GetRoutineRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::GetRoutineRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRoutineRequest;
/// let x = GetRoutineRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [routine_id][crate::model::GetRoutineRequest::routine_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRoutineRequest;
/// let x = GetRoutineRequest::new().set_routine_id("example");
/// ```
pub fn set_routine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.routine_id = v.into();
self
}
}
impl wkt::message::Message for GetRoutineRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetRoutineRequest"
}
}
/// Describes the format for inserting a routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsertRoutineRequest {
/// Required. Project ID of the new routine
pub project_id: std::string::String,
/// Required. Dataset ID of the new routine
pub dataset_id: std::string::String,
/// Required. A routine resource to insert
pub routine: std::option::Option<crate::model::Routine>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InsertRoutineRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::InsertRoutineRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertRoutineRequest;
/// let x = InsertRoutineRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::InsertRoutineRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertRoutineRequest;
/// let x = InsertRoutineRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [routine][crate::model::InsertRoutineRequest::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertRoutineRequest;
/// use google_cloud_bigquery_v2::model::Routine;
/// let x = InsertRoutineRequest::new().set_routine(Routine::default()/* use setters */);
/// ```
pub fn set_routine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Routine>,
{
self.routine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [routine][crate::model::InsertRoutineRequest::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertRoutineRequest;
/// use google_cloud_bigquery_v2::model::Routine;
/// let x = InsertRoutineRequest::new().set_or_clear_routine(Some(Routine::default()/* use setters */));
/// let x = InsertRoutineRequest::new().set_or_clear_routine(None::<Routine>);
/// ```
pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Routine>,
{
self.routine = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for InsertRoutineRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.InsertRoutineRequest"
}
}
/// Describes the format for updating a routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRoutineRequest {
/// Required. Project ID of the routine to update
pub project_id: std::string::String,
/// Required. Dataset ID of the routine to update
pub dataset_id: std::string::String,
/// Required. Routine ID of the routine to update
pub routine_id: std::string::String,
/// Required. A routine resource which will replace the specified routine
pub routine: std::option::Option<crate::model::Routine>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateRoutineRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::UpdateRoutineRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRoutineRequest;
/// let x = UpdateRoutineRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::UpdateRoutineRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRoutineRequest;
/// let x = UpdateRoutineRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [routine_id][crate::model::UpdateRoutineRequest::routine_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRoutineRequest;
/// let x = UpdateRoutineRequest::new().set_routine_id("example");
/// ```
pub fn set_routine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.routine_id = v.into();
self
}
/// Sets the value of [routine][crate::model::UpdateRoutineRequest::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRoutineRequest;
/// use google_cloud_bigquery_v2::model::Routine;
/// let x = UpdateRoutineRequest::new().set_routine(Routine::default()/* use setters */);
/// ```
pub fn set_routine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Routine>,
{
self.routine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [routine][crate::model::UpdateRoutineRequest::routine].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRoutineRequest;
/// use google_cloud_bigquery_v2::model::Routine;
/// let x = UpdateRoutineRequest::new().set_or_clear_routine(Some(Routine::default()/* use setters */));
/// let x = UpdateRoutineRequest::new().set_or_clear_routine(None::<Routine>);
/// ```
pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Routine>,
{
self.routine = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateRoutineRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UpdateRoutineRequest"
}
}
/// Describes the format for deleting a routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRoutineRequest {
/// Required. Project ID of the routine to delete
pub project_id: std::string::String,
/// Required. Dataset ID of the routine to delete
pub dataset_id: std::string::String,
/// Required. Routine ID of the routine to delete
pub routine_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteRoutineRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteRoutineRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRoutineRequest;
/// let x = DeleteRoutineRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::DeleteRoutineRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRoutineRequest;
/// let x = DeleteRoutineRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [routine_id][crate::model::DeleteRoutineRequest::routine_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRoutineRequest;
/// let x = DeleteRoutineRequest::new().set_routine_id("example");
/// ```
pub fn set_routine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.routine_id = v.into();
self
}
}
impl wkt::message::Message for DeleteRoutineRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteRoutineRequest"
}
}
/// Describes the format for listing routines.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRoutinesRequest {
/// Required. Project ID of the routines to list
pub project_id: std::string::String,
/// Required. Dataset ID of the routines to list
pub dataset_id: std::string::String,
/// The maximum number of results to return in a single response page.
/// Leverage the page tokens to iterate through the entire collection.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Page token, returned by a previous call, to request the next page of
/// results
pub page_token: std::string::String,
/// If set, then only the Routines matching this filter are returned.
/// The supported format is `routineType:{RoutineType}`, where `{RoutineType}`
/// is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`.
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRoutinesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListRoutinesRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// let x = ListRoutinesRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::ListRoutinesRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// let x = ListRoutinesRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [max_results][crate::model::ListRoutinesRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// use wkt::UInt32Value;
/// let x = ListRoutinesRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::ListRoutinesRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// use wkt::UInt32Value;
/// let x = ListRoutinesRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = ListRoutinesRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::ListRoutinesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// let x = ListRoutinesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListRoutinesRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesRequest;
/// let x = ListRoutinesRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
impl wkt::message::Message for ListRoutinesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListRoutinesRequest"
}
}
/// Describes the format of a single result page when listing routines.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRoutinesResponse {
/// Routines in the requested dataset. Unless read_mask is set in the request,
/// only the following fields are populated:
/// etag, project_id, dataset_id, routine_id, routine_type, creation_time,
/// last_modified_time, language, and remote_function_options.
pub routines: std::vec::Vec<crate::model::Routine>,
/// A token to request the next page of results.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRoutinesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [routines][crate::model::ListRoutinesResponse::routines].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesResponse;
/// use google_cloud_bigquery_v2::model::Routine;
/// let x = ListRoutinesResponse::new()
/// .set_routines([
/// Routine::default()/* use setters */,
/// Routine::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_routines<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Routine>,
{
use std::iter::Iterator;
self.routines = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListRoutinesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRoutinesResponse;
/// let x = ListRoutinesResponse::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListRoutinesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListRoutinesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListRoutinesResponse {
type PageItem = crate::model::Routine;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.routines
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Id path of a routine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RoutineReference {
/// Required. The ID of the project containing this routine.
pub project_id: std::string::String,
/// Required. The ID of the dataset containing this routine.
pub dataset_id: std::string::String,
/// Required. The ID of the routine. The ID must contain only
/// letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
/// length is 256 characters.
pub routine_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RoutineReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::RoutineReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = RoutineReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::RoutineReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = RoutineReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [routine_id][crate::model::RoutineReference::routine_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RoutineReference;
/// let x = RoutineReference::new().set_routine_id("example");
/// ```
pub fn set_routine_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.routine_id = v.into();
self
}
}
impl wkt::message::Message for RoutineReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RoutineReference"
}
}
/// Request message for the ListRowAccessPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRowAccessPoliciesRequest {
/// Required. Project ID of the row access policies to list.
pub project_id: std::string::String,
/// Required. Dataset ID of row access policies to list.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to list row access policies.
pub table_id: std::string::String,
/// Page token, returned by a previous call, to request the next page of
/// results.
pub page_token: std::string::String,
/// The maximum number of results to return in a single response page. Leverage
/// the page tokens to iterate through the entire collection.
pub page_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRowAccessPoliciesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListRowAccessPoliciesRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesRequest;
/// let x = ListRowAccessPoliciesRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::ListRowAccessPoliciesRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesRequest;
/// let x = ListRowAccessPoliciesRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::ListRowAccessPoliciesRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesRequest;
/// let x = ListRowAccessPoliciesRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListRowAccessPoliciesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesRequest;
/// let x = ListRowAccessPoliciesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListRowAccessPoliciesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesRequest;
/// let x = ListRowAccessPoliciesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
}
impl wkt::message::Message for ListRowAccessPoliciesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListRowAccessPoliciesRequest"
}
}
/// Response message for the ListRowAccessPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRowAccessPoliciesResponse {
/// Row access policies on the requested table.
pub row_access_policies: std::vec::Vec<crate::model::RowAccessPolicy>,
/// A token to request the next page of results.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRowAccessPoliciesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [row_access_policies][crate::model::ListRowAccessPoliciesResponse::row_access_policies].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesResponse;
/// use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = ListRowAccessPoliciesResponse::new()
/// .set_row_access_policies([
/// RowAccessPolicy::default()/* use setters */,
/// RowAccessPolicy::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_row_access_policies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RowAccessPolicy>,
{
use std::iter::Iterator;
self.row_access_policies = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListRowAccessPoliciesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListRowAccessPoliciesResponse;
/// let x = ListRowAccessPoliciesResponse::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListRowAccessPoliciesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListRowAccessPoliciesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListRowAccessPoliciesResponse {
type PageItem = crate::model::RowAccessPolicy;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.row_access_policies
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request message for the GetRowAccessPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRowAccessPolicyRequest {
/// Required. Project ID of the table to get the row access policy.
pub project_id: std::string::String,
/// Required. Dataset ID of the table to get the row access policy.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to get the row access policy.
pub table_id: std::string::String,
/// Required. Policy ID of the row access policy.
pub policy_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetRowAccessPolicyRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetRowAccessPolicyRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRowAccessPolicyRequest;
/// let x = GetRowAccessPolicyRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::GetRowAccessPolicyRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRowAccessPolicyRequest;
/// let x = GetRowAccessPolicyRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::GetRowAccessPolicyRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRowAccessPolicyRequest;
/// let x = GetRowAccessPolicyRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [policy_id][crate::model::GetRowAccessPolicyRequest::policy_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetRowAccessPolicyRequest;
/// let x = GetRowAccessPolicyRequest::new().set_policy_id("example");
/// ```
pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.policy_id = v.into();
self
}
}
impl wkt::message::Message for GetRowAccessPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetRowAccessPolicyRequest"
}
}
/// Request message for the CreateRowAccessPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRowAccessPolicyRequest {
/// Required. Project ID of the table to get the row access policy.
pub project_id: std::string::String,
/// Required. Dataset ID of the table to get the row access policy.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to get the row access policy.
pub table_id: std::string::String,
/// Required. The row access policy to create.
pub row_access_policy: std::option::Option<crate::model::RowAccessPolicy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateRowAccessPolicyRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::CreateRowAccessPolicyRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CreateRowAccessPolicyRequest;
/// let x = CreateRowAccessPolicyRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::CreateRowAccessPolicyRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CreateRowAccessPolicyRequest;
/// let x = CreateRowAccessPolicyRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::CreateRowAccessPolicyRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CreateRowAccessPolicyRequest;
/// let x = CreateRowAccessPolicyRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CreateRowAccessPolicyRequest;
/// use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = CreateRowAccessPolicyRequest::new().set_row_access_policy(RowAccessPolicy::default()/* use setters */);
/// ```
pub fn set_row_access_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicy>,
{
self.row_access_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CreateRowAccessPolicyRequest;
/// use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = CreateRowAccessPolicyRequest::new().set_or_clear_row_access_policy(Some(RowAccessPolicy::default()/* use setters */));
/// let x = CreateRowAccessPolicyRequest::new().set_or_clear_row_access_policy(None::<RowAccessPolicy>);
/// ```
pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicy>,
{
self.row_access_policy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateRowAccessPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.CreateRowAccessPolicyRequest"
}
}
/// Request message for the UpdateRowAccessPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRowAccessPolicyRequest {
/// Required. Project ID of the table to get the row access policy.
pub project_id: std::string::String,
/// Required. Dataset ID of the table to get the row access policy.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to get the row access policy.
pub table_id: std::string::String,
/// Required. Policy ID of the row access policy.
pub policy_id: std::string::String,
/// Required. The row access policy to update.
pub row_access_policy: std::option::Option<crate::model::RowAccessPolicy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateRowAccessPolicyRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::UpdateRowAccessPolicyRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// let x = UpdateRowAccessPolicyRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::UpdateRowAccessPolicyRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// let x = UpdateRowAccessPolicyRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::UpdateRowAccessPolicyRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// let x = UpdateRowAccessPolicyRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [policy_id][crate::model::UpdateRowAccessPolicyRequest::policy_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// let x = UpdateRowAccessPolicyRequest::new().set_policy_id("example");
/// ```
pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.policy_id = v.into();
self
}
/// Sets the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = UpdateRowAccessPolicyRequest::new().set_row_access_policy(RowAccessPolicy::default()/* use setters */);
/// ```
pub fn set_row_access_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicy>,
{
self.row_access_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateRowAccessPolicyRequest;
/// use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = UpdateRowAccessPolicyRequest::new().set_or_clear_row_access_policy(Some(RowAccessPolicy::default()/* use setters */));
/// let x = UpdateRowAccessPolicyRequest::new().set_or_clear_row_access_policy(None::<RowAccessPolicy>);
/// ```
pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicy>,
{
self.row_access_policy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateRowAccessPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UpdateRowAccessPolicyRequest"
}
}
/// Request message for the DeleteRowAccessPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRowAccessPolicyRequest {
/// Required. Project ID of the table to delete the row access policy.
pub project_id: std::string::String,
/// Required. Dataset ID of the table to delete the row access policy.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to delete the row access policy.
pub table_id: std::string::String,
/// Required. Policy ID of the row access policy.
pub policy_id: std::string::String,
/// If set to true, it deletes the row access policy even if it's the last row
/// access policy on the table and the deletion will widen the access rather
/// narrowing it.
pub force: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteRowAccessPolicyRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteRowAccessPolicyRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::DeleteRowAccessPolicyRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::DeleteRowAccessPolicyRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [policy_id][crate::model::DeleteRowAccessPolicyRequest::policy_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_policy_id("example");
/// ```
pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.policy_id = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_force(true);
/// ```
pub fn set_force<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.force = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteRowAccessPolicyRequest;
/// let x = DeleteRowAccessPolicyRequest::new().set_or_clear_force(Some(false));
/// let x = DeleteRowAccessPolicyRequest::new().set_or_clear_force(None::<bool>);
/// ```
pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.force = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DeleteRowAccessPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteRowAccessPolicyRequest"
}
}
/// Request message for the BatchDeleteRowAccessPoliciesRequest method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchDeleteRowAccessPoliciesRequest {
/// Required. Project ID of the table to delete the row access policies.
pub project_id: std::string::String,
/// Required. Dataset ID of the table to delete the row access policies.
pub dataset_id: std::string::String,
/// Required. Table ID of the table to delete the row access policies.
pub table_id: std::string::String,
/// Required. Policy IDs of the row access policies.
pub policy_ids: std::vec::Vec<std::string::String>,
/// If set to true, it deletes the row access policy even if it's the last row
/// access policy on the table and the deletion will widen the access rather
/// narrowing it.
pub force: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchDeleteRowAccessPoliciesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::BatchDeleteRowAccessPoliciesRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::BatchDeleteRowAccessPoliciesRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::BatchDeleteRowAccessPoliciesRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [policy_ids][crate::model::BatchDeleteRowAccessPoliciesRequest::policy_ids].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_policy_ids(["a", "b", "c"]);
/// ```
pub fn set_policy_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.policy_ids = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_force(true);
/// ```
pub fn set_force<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.force = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::BatchDeleteRowAccessPoliciesRequest;
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_or_clear_force(Some(false));
/// let x = BatchDeleteRowAccessPoliciesRequest::new().set_or_clear_force(None::<bool>);
/// ```
pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.force = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BatchDeleteRowAccessPoliciesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.BatchDeleteRowAccessPoliciesRequest"
}
}
/// Represents access on a subset of rows on the specified table, defined by its
/// filter predicate. Access to the subset of rows is controlled by its IAM
/// policy.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RowAccessPolicy {
/// Output only. A hash of this resource.
pub etag: std::string::String,
/// Required. Reference describing the ID of this row access policy.
pub row_access_policy_reference: std::option::Option<crate::model::RowAccessPolicyReference>,
/// Required. A SQL boolean expression that represents the rows defined by this
/// row access policy, similar to the boolean expression in a WHERE clause of a
/// SELECT query on a table.
/// References to other tables, routines, and temporary functions are not
/// supported.
///
/// Examples: region="EU"
/// date_field = CAST('2019-9-27' as DATE)
/// nullable_field is not NULL
/// numeric_field BETWEEN 1.0 AND 5.0
pub filter_predicate: std::string::String,
/// Output only. The time when this row access policy was created, in
/// milliseconds since the epoch.
pub creation_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time when this row access policy was last modified, in
/// milliseconds since the epoch.
pub last_modified_time: std::option::Option<wkt::Timestamp>,
/// Optional. Input only. The optional list of iam_member users or groups that
/// specifies the initial members that the row-level access policy should be
/// created with.
///
/// grantees types:
///
/// - "user:alice@example.com": An email address that represents a specific
/// Google account.
/// - "serviceAccount:my-other-app@appspot.gserviceaccount.com": An email
/// address that represents a service account.
/// - "group:admins@example.com": An email address that represents a Google
/// group.
/// - "domain:example.com":The Google Workspace domain (primary) that
/// represents all the users of that domain.
/// - "allAuthenticatedUsers": A special identifier that represents all service
/// accounts and all users on the internet who have authenticated with a Google
/// Account. This identifier includes accounts that aren't connected to a
/// Google Workspace or Cloud Identity domain, such as personal Gmail accounts.
/// Users who aren't authenticated, such as anonymous visitors, aren't
/// included.
/// - "allUsers":A special identifier that represents anyone who is on
/// the internet, including authenticated and unauthenticated users. Because
/// BigQuery requires authentication before a user can access the service,
/// allUsers includes only authenticated users.
pub grantees: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RowAccessPolicy {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [etag][crate::model::RowAccessPolicy::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = RowAccessPolicy::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [row_access_policy_reference][crate::model::RowAccessPolicy::row_access_policy_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicy::new().set_row_access_policy_reference(RowAccessPolicyReference::default()/* use setters */);
/// ```
pub fn set_row_access_policy_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicyReference>,
{
self.row_access_policy_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [row_access_policy_reference][crate::model::RowAccessPolicy::row_access_policy_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicy::new().set_or_clear_row_access_policy_reference(Some(RowAccessPolicyReference::default()/* use setters */));
/// let x = RowAccessPolicy::new().set_or_clear_row_access_policy_reference(None::<RowAccessPolicyReference>);
/// ```
pub fn set_or_clear_row_access_policy_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RowAccessPolicyReference>,
{
self.row_access_policy_reference = v.map(|x| x.into());
self
}
/// Sets the value of [filter_predicate][crate::model::RowAccessPolicy::filter_predicate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = RowAccessPolicy::new().set_filter_predicate("example");
/// ```
pub fn set_filter_predicate<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.filter_predicate = v.into();
self
}
/// Sets the value of [creation_time][crate::model::RowAccessPolicy::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use wkt::Timestamp;
/// let x = RowAccessPolicy::new().set_creation_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_creation_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.creation_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [creation_time][crate::model::RowAccessPolicy::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use wkt::Timestamp;
/// let x = RowAccessPolicy::new().set_or_clear_creation_time(Some(Timestamp::default()/* use setters */));
/// let x = RowAccessPolicy::new().set_or_clear_creation_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.creation_time = v.map(|x| x.into());
self
}
/// Sets the value of [last_modified_time][crate::model::RowAccessPolicy::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use wkt::Timestamp;
/// let x = RowAccessPolicy::new().set_last_modified_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_last_modified_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_modified_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [last_modified_time][crate::model::RowAccessPolicy::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// use wkt::Timestamp;
/// let x = RowAccessPolicy::new().set_or_clear_last_modified_time(Some(Timestamp::default()/* use setters */));
/// let x = RowAccessPolicy::new().set_or_clear_last_modified_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_last_modified_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_modified_time = v.map(|x| x.into());
self
}
/// Sets the value of [grantees][crate::model::RowAccessPolicy::grantees].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicy;
/// let x = RowAccessPolicy::new().set_grantees(["a", "b", "c"]);
/// ```
pub fn set_grantees<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.grantees = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RowAccessPolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RowAccessPolicy"
}
}
/// Id path of a row access policy.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RowAccessPolicyReference {
/// Required. The ID of the project containing this row access policy.
pub project_id: std::string::String,
/// Required. The ID of the dataset containing this row access policy.
pub dataset_id: std::string::String,
/// Required. The ID of the table containing this row access policy.
pub table_id: std::string::String,
/// Required. The ID of the row access policy. The ID must contain only
/// letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
/// length is 256 characters.
pub policy_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RowAccessPolicyReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::RowAccessPolicyReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicyReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::RowAccessPolicyReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicyReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::RowAccessPolicyReference::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicyReference::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [policy_id][crate::model::RowAccessPolicyReference::policy_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::RowAccessPolicyReference;
/// let x = RowAccessPolicyReference::new().set_policy_id("example");
/// ```
pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.policy_id = v.into();
self
}
}
impl wkt::message::Message for RowAccessPolicyReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.RowAccessPolicyReference"
}
}
/// [Preview] Information related to sessions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SessionInfo {
/// Output only. The id of the session.
pub session_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SessionInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session_id][crate::model::SessionInfo::session_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SessionInfo;
/// let x = SessionInfo::new().set_session_id("example");
/// ```
pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session_id = v.into();
self
}
}
impl wkt::message::Message for SessionInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SessionInfo"
}
}
/// The data type of a variable such as a function argument.
/// Examples include:
///
/// * INT64: `{"typeKind": "INT64"}`
///
/// * ARRAY\<STRING\>:
///
/// {
/// "typeKind": "ARRAY",
/// "arrayElementType": {"typeKind": "STRING"}
/// }
///
/// * STRUCT<x STRING, y ARRAY\<DATE\>>:
///
/// {
/// "typeKind": "STRUCT",
/// "structType":
/// {
/// "fields":
/// [
/// {
/// "name": "x",
/// "type": {"typeKind": "STRING"}
/// },
/// {
/// "name": "y",
/// "type":
/// {
/// "typeKind": "ARRAY",
/// "arrayElementType": {"typeKind": "DATE"}
/// }
/// }
/// ]
/// }
/// }
///
/// * RANGE\<DATE\>:
///
/// {
/// "typeKind": "RANGE",
/// "rangeElementType": {"typeKind": "DATE"}
/// }
///
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StandardSqlDataType {
/// Required. The top level type of this field.
/// Can be any GoogleSQL data type (e.g., "INT64", "DATE", "ARRAY").
pub type_kind: crate::model::standard_sql_data_type::TypeKind,
/// For complex types, the sub type information.
pub sub_type: std::option::Option<crate::model::standard_sql_data_type::SubType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StandardSqlDataType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [type_kind][crate::model::StandardSqlDataType::type_kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// use google_cloud_bigquery_v2::model::standard_sql_data_type::TypeKind;
/// let x0 = StandardSqlDataType::new().set_type_kind(TypeKind::Int64);
/// let x1 = StandardSqlDataType::new().set_type_kind(TypeKind::Bool);
/// let x2 = StandardSqlDataType::new().set_type_kind(TypeKind::Float64);
/// ```
pub fn set_type_kind<T: std::convert::Into<crate::model::standard_sql_data_type::TypeKind>>(
mut self,
v: T,
) -> Self {
self.type_kind = v.into();
self
}
/// Sets the value of [sub_type][crate::model::StandardSqlDataType::sub_type].
///
/// Note that all the setters affecting `sub_type` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = StandardSqlDataType::new().set_sub_type(Some(
/// google_cloud_bigquery_v2::model::standard_sql_data_type::SubType::ArrayElementType(StandardSqlDataType::default().into())));
/// ```
pub fn set_sub_type<
T: std::convert::Into<std::option::Option<crate::model::standard_sql_data_type::SubType>>,
>(
mut self,
v: T,
) -> Self {
self.sub_type = v.into();
self
}
/// The value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// if it holds a `ArrayElementType`, `None` if the field is not set or
/// holds a different branch.
pub fn array_element_type(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StandardSqlDataType>> {
#[allow(unreachable_patterns)]
self.sub_type.as_ref().and_then(|v| match v {
crate::model::standard_sql_data_type::SubType::ArrayElementType(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// to hold a `ArrayElementType`.
///
/// Note that all the setters affecting `sub_type` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = StandardSqlDataType::new().set_array_element_type(StandardSqlDataType::default()/* use setters */);
/// assert!(x.array_element_type().is_some());
/// assert!(x.struct_type().is_none());
/// assert!(x.range_element_type().is_none());
/// ```
pub fn set_array_element_type<
T: std::convert::Into<std::boxed::Box<crate::model::StandardSqlDataType>>,
>(
mut self,
v: T,
) -> Self {
self.sub_type = std::option::Option::Some(
crate::model::standard_sql_data_type::SubType::ArrayElementType(v.into()),
);
self
}
/// The value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// if it holds a `StructType`, `None` if the field is not set or
/// holds a different branch.
pub fn struct_type(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StandardSqlStructType>> {
#[allow(unreachable_patterns)]
self.sub_type.as_ref().and_then(|v| match v {
crate::model::standard_sql_data_type::SubType::StructType(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// to hold a `StructType`.
///
/// Note that all the setters affecting `sub_type` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// use google_cloud_bigquery_v2::model::StandardSqlStructType;
/// let x = StandardSqlDataType::new().set_struct_type(StandardSqlStructType::default()/* use setters */);
/// assert!(x.struct_type().is_some());
/// assert!(x.array_element_type().is_none());
/// assert!(x.range_element_type().is_none());
/// ```
pub fn set_struct_type<
T: std::convert::Into<std::boxed::Box<crate::model::StandardSqlStructType>>,
>(
mut self,
v: T,
) -> Self {
self.sub_type = std::option::Option::Some(
crate::model::standard_sql_data_type::SubType::StructType(v.into()),
);
self
}
/// The value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// if it holds a `RangeElementType`, `None` if the field is not set or
/// holds a different branch.
pub fn range_element_type(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StandardSqlDataType>> {
#[allow(unreachable_patterns)]
self.sub_type.as_ref().and_then(|v| match v {
crate::model::standard_sql_data_type::SubType::RangeElementType(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [sub_type][crate::model::StandardSqlDataType::sub_type]
/// to hold a `RangeElementType`.
///
/// Note that all the setters affecting `sub_type` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = StandardSqlDataType::new().set_range_element_type(StandardSqlDataType::default()/* use setters */);
/// assert!(x.range_element_type().is_some());
/// assert!(x.array_element_type().is_none());
/// assert!(x.struct_type().is_none());
/// ```
pub fn set_range_element_type<
T: std::convert::Into<std::boxed::Box<crate::model::StandardSqlDataType>>,
>(
mut self,
v: T,
) -> Self {
self.sub_type = std::option::Option::Some(
crate::model::standard_sql_data_type::SubType::RangeElementType(v.into()),
);
self
}
}
impl wkt::message::Message for StandardSqlDataType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StandardSqlDataType"
}
}
/// Defines additional types related to [StandardSqlDataType].
pub mod standard_sql_data_type {
#[allow(unused_imports)]
use super::*;
/// The kind of the datatype.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TypeKind {
/// Invalid type.
Unspecified,
/// Encoded as a string in decimal format.
Int64,
/// Encoded as a boolean "false" or "true".
Bool,
/// Encoded as a number, or string "NaN", "Infinity" or "-Infinity".
Float64,
/// Encoded as a string value.
String,
/// Encoded as a base64 string per RFC 4648, section 4.
Bytes,
/// Encoded as an RFC 3339 timestamp with mandatory "Z" time zone string:
/// 1985-04-12T23:20:50.52Z
Timestamp,
/// Encoded as RFC 3339 full-date format string: 1985-04-12
Date,
/// Encoded as RFC 3339 partial-time format string: 23:20:50.52
Time,
/// Encoded as RFC 3339 full-date "T" partial-time: 1985-04-12T23:20:50.52
Datetime,
/// Encoded as fully qualified 3 part: 0-5 15 2:30:45.6
Interval,
/// Encoded as WKT
Geography,
/// Encoded as a decimal string.
Numeric,
/// Encoded as a decimal string.
Bignumeric,
/// Encoded as a string.
Json,
/// Encoded as a list with types matching Type.array_type.
Array,
/// Encoded as a list with fields of type Type.struct_type[i]. List is used
/// because a JSON object cannot have duplicate field names.
Struct,
/// Encoded as a pair with types matching range_element_type. Pairs must
/// begin with "[", end with ")", and be separated by ", ".
Range,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TypeKind::value] or
/// [TypeKind::name].
UnknownValue(type_kind::UnknownValue),
}
#[doc(hidden)]
pub mod type_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TypeKind {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Int64 => std::option::Option::Some(2),
Self::Bool => std::option::Option::Some(5),
Self::Float64 => std::option::Option::Some(7),
Self::String => std::option::Option::Some(8),
Self::Bytes => std::option::Option::Some(9),
Self::Timestamp => std::option::Option::Some(19),
Self::Date => std::option::Option::Some(10),
Self::Time => std::option::Option::Some(20),
Self::Datetime => std::option::Option::Some(21),
Self::Interval => std::option::Option::Some(26),
Self::Geography => std::option::Option::Some(22),
Self::Numeric => std::option::Option::Some(23),
Self::Bignumeric => std::option::Option::Some(24),
Self::Json => std::option::Option::Some(25),
Self::Array => std::option::Option::Some(16),
Self::Struct => std::option::Option::Some(17),
Self::Range => std::option::Option::Some(29),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_KIND_UNSPECIFIED"),
Self::Int64 => std::option::Option::Some("INT64"),
Self::Bool => std::option::Option::Some("BOOL"),
Self::Float64 => std::option::Option::Some("FLOAT64"),
Self::String => std::option::Option::Some("STRING"),
Self::Bytes => std::option::Option::Some("BYTES"),
Self::Timestamp => std::option::Option::Some("TIMESTAMP"),
Self::Date => std::option::Option::Some("DATE"),
Self::Time => std::option::Option::Some("TIME"),
Self::Datetime => std::option::Option::Some("DATETIME"),
Self::Interval => std::option::Option::Some("INTERVAL"),
Self::Geography => std::option::Option::Some("GEOGRAPHY"),
Self::Numeric => std::option::Option::Some("NUMERIC"),
Self::Bignumeric => std::option::Option::Some("BIGNUMERIC"),
Self::Json => std::option::Option::Some("JSON"),
Self::Array => std::option::Option::Some("ARRAY"),
Self::Struct => std::option::Option::Some("STRUCT"),
Self::Range => std::option::Option::Some("RANGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TypeKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TypeKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TypeKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::Int64,
5 => Self::Bool,
7 => Self::Float64,
8 => Self::String,
9 => Self::Bytes,
10 => Self::Date,
16 => Self::Array,
17 => Self::Struct,
19 => Self::Timestamp,
20 => Self::Time,
21 => Self::Datetime,
22 => Self::Geography,
23 => Self::Numeric,
24 => Self::Bignumeric,
25 => Self::Json,
26 => Self::Interval,
29 => Self::Range,
_ => Self::UnknownValue(type_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TypeKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_KIND_UNSPECIFIED" => Self::Unspecified,
"INT64" => Self::Int64,
"BOOL" => Self::Bool,
"FLOAT64" => Self::Float64,
"STRING" => Self::String,
"BYTES" => Self::Bytes,
"TIMESTAMP" => Self::Timestamp,
"DATE" => Self::Date,
"TIME" => Self::Time,
"DATETIME" => Self::Datetime,
"INTERVAL" => Self::Interval,
"GEOGRAPHY" => Self::Geography,
"NUMERIC" => Self::Numeric,
"BIGNUMERIC" => Self::Bignumeric,
"JSON" => Self::Json,
"ARRAY" => Self::Array,
"STRUCT" => Self::Struct,
"RANGE" => Self::Range,
_ => Self::UnknownValue(type_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TypeKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Int64 => serializer.serialize_i32(2),
Self::Bool => serializer.serialize_i32(5),
Self::Float64 => serializer.serialize_i32(7),
Self::String => serializer.serialize_i32(8),
Self::Bytes => serializer.serialize_i32(9),
Self::Timestamp => serializer.serialize_i32(19),
Self::Date => serializer.serialize_i32(10),
Self::Time => serializer.serialize_i32(20),
Self::Datetime => serializer.serialize_i32(21),
Self::Interval => serializer.serialize_i32(26),
Self::Geography => serializer.serialize_i32(22),
Self::Numeric => serializer.serialize_i32(23),
Self::Bignumeric => serializer.serialize_i32(24),
Self::Json => serializer.serialize_i32(25),
Self::Array => serializer.serialize_i32(16),
Self::Struct => serializer.serialize_i32(17),
Self::Range => serializer.serialize_i32(29),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TypeKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TypeKind>::new(
".google.cloud.bigquery.v2.StandardSqlDataType.TypeKind",
))
}
}
/// For complex types, the sub type information.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SubType {
/// The type of the array's elements, if type_kind = "ARRAY".
ArrayElementType(std::boxed::Box<crate::model::StandardSqlDataType>),
/// The fields of this struct, in order, if type_kind = "STRUCT".
StructType(std::boxed::Box<crate::model::StandardSqlStructType>),
/// The type of the range's elements, if type_kind = "RANGE".
RangeElementType(std::boxed::Box<crate::model::StandardSqlDataType>),
}
}
/// A field or a column.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StandardSqlField {
/// Optional. The name of this field. Can be absent for struct fields.
pub name: std::string::String,
/// Optional. The type of this parameter. Absent if not explicitly
/// specified (e.g., CREATE FUNCTION statement can omit the return type;
/// in this case the output parameter does not have this "type" field).
pub r#type: std::option::Option<std::boxed::Box<crate::model::StandardSqlDataType>>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StandardSqlField {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::StandardSqlField::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlField;
/// let x = StandardSqlField::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [r#type][crate::model::StandardSqlField::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlField;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = StandardSqlField::new().set_type(StandardSqlDataType::default()/* use setters */);
/// ```
pub fn set_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.r#type = std::option::Option::Some(std::boxed::Box::new(v.into()));
self
}
/// Sets or clears the value of [r#type][crate::model::StandardSqlField::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlField;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = StandardSqlField::new().set_or_clear_type(Some(StandardSqlDataType::default()/* use setters */));
/// let x = StandardSqlField::new().set_or_clear_type(None::<StandardSqlDataType>);
/// ```
pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StandardSqlDataType>,
{
self.r#type = v.map(|x| std::boxed::Box::new(x.into()));
self
}
}
impl wkt::message::Message for StandardSqlField {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StandardSqlField"
}
}
/// The representation of a SQL STRUCT type.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StandardSqlStructType {
/// Fields within the struct.
pub fields: std::vec::Vec<crate::model::StandardSqlField>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StandardSqlStructType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [fields][crate::model::StandardSqlStructType::fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlStructType;
/// use google_cloud_bigquery_v2::model::StandardSqlField;
/// let x = StandardSqlStructType::new()
/// .set_fields([
/// StandardSqlField::default()/* use setters */,
/// StandardSqlField::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StandardSqlField>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StandardSqlStructType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StandardSqlStructType"
}
}
/// A table type
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StandardSqlTableType {
/// The columns in this table type
pub columns: std::vec::Vec<crate::model::StandardSqlField>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StandardSqlTableType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [columns][crate::model::StandardSqlTableType::columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::StandardSqlTableType;
/// use google_cloud_bigquery_v2::model::StandardSqlField;
/// let x = StandardSqlTableType::new()
/// .set_columns([
/// StandardSqlField::default()/* use setters */,
/// StandardSqlField::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StandardSqlField>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for StandardSqlTableType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.StandardSqlTableType"
}
}
/// System variables given to a query.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SystemVariables {
/// Output only. Data type for each system variable.
pub types: std::collections::HashMap<std::string::String, crate::model::StandardSqlDataType>,
/// Output only. Value for each system variable.
pub values: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SystemVariables {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [types][crate::model::SystemVariables::types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SystemVariables;
/// use google_cloud_bigquery_v2::model::StandardSqlDataType;
/// let x = SystemVariables::new().set_types([
/// ("key0", StandardSqlDataType::default()/* use setters */),
/// ("key1", StandardSqlDataType::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_types<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::StandardSqlDataType>,
{
use std::iter::Iterator;
self.types = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [values][crate::model::SystemVariables::values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SystemVariables;
/// use wkt::Struct;
/// let x = SystemVariables::new().set_values(Struct::default()/* use setters */);
/// ```
pub fn set_values<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.values = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [values][crate::model::SystemVariables::values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SystemVariables;
/// use wkt::Struct;
/// let x = SystemVariables::new().set_or_clear_values(Some(Struct::default()/* use setters */));
/// let x = SystemVariables::new().set_or_clear_values(None::<Struct>);
/// ```
pub fn set_or_clear_values<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.values = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SystemVariables {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SystemVariables"
}
}
/// Replication info of a table created using `AS REPLICA` DDL like:
/// `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableReplicationInfo {
/// Required. Source table reference that is replicated.
pub source_table: std::option::Option<crate::model::TableReference>,
/// Optional. Specifies the interval at which the source table is polled for
/// updates.
/// It's Optional. If not specified, default replication interval would be
/// applied.
pub replication_interval_ms: i64,
/// Optional. Output only. If source is a materialized view, this field
/// signifies the last refresh time of the source.
pub replicated_source_last_refresh_time: i64,
/// Optional. Output only. Replication status of configured replication.
pub replication_status: crate::model::table_replication_info::ReplicationStatus,
/// Optional. Output only. Replication error that will permanently stopped
/// table replication.
pub replication_error: std::option::Option<crate::model::ErrorProto>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableReplicationInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source_table][crate::model::TableReplicationInfo::source_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableReplicationInfo::new().set_source_table(TableReference::default()/* use setters */);
/// ```
pub fn set_source_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.source_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [source_table][crate::model::TableReplicationInfo::source_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableReplicationInfo::new().set_or_clear_source_table(Some(TableReference::default()/* use setters */));
/// let x = TableReplicationInfo::new().set_or_clear_source_table(None::<TableReference>);
/// ```
pub fn set_or_clear_source_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.source_table = v.map(|x| x.into());
self
}
/// Sets the value of [replication_interval_ms][crate::model::TableReplicationInfo::replication_interval_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// let x = TableReplicationInfo::new().set_replication_interval_ms(42);
/// ```
pub fn set_replication_interval_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.replication_interval_ms = v.into();
self
}
/// Sets the value of [replicated_source_last_refresh_time][crate::model::TableReplicationInfo::replicated_source_last_refresh_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// let x = TableReplicationInfo::new().set_replicated_source_last_refresh_time(42);
/// ```
pub fn set_replicated_source_last_refresh_time<T: std::convert::Into<i64>>(
mut self,
v: T,
) -> Self {
self.replicated_source_last_refresh_time = v.into();
self
}
/// Sets the value of [replication_status][crate::model::TableReplicationInfo::replication_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// use google_cloud_bigquery_v2::model::table_replication_info::ReplicationStatus;
/// let x0 = TableReplicationInfo::new().set_replication_status(ReplicationStatus::Active);
/// let x1 = TableReplicationInfo::new().set_replication_status(ReplicationStatus::SourceDeleted);
/// let x2 = TableReplicationInfo::new().set_replication_status(ReplicationStatus::PermissionDenied);
/// ```
pub fn set_replication_status<
T: std::convert::Into<crate::model::table_replication_info::ReplicationStatus>,
>(
mut self,
v: T,
) -> Self {
self.replication_status = v.into();
self
}
/// Sets the value of [replication_error][crate::model::TableReplicationInfo::replication_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = TableReplicationInfo::new().set_replication_error(ErrorProto::default()/* use setters */);
/// ```
pub fn set_replication_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.replication_error = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [replication_error][crate::model::TableReplicationInfo::replication_error].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = TableReplicationInfo::new().set_or_clear_replication_error(Some(ErrorProto::default()/* use setters */));
/// let x = TableReplicationInfo::new().set_or_clear_replication_error(None::<ErrorProto>);
/// ```
pub fn set_or_clear_replication_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.replication_error = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableReplicationInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableReplicationInfo"
}
}
/// Defines additional types related to [TableReplicationInfo].
pub mod table_replication_info {
#[allow(unused_imports)]
use super::*;
/// Replication status of the table created using `AS REPLICA` like:
/// `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReplicationStatus {
/// Default value.
Unspecified,
/// Replication is Active with no errors.
Active,
/// Source object is deleted.
SourceDeleted,
/// Source revoked replication permissions.
PermissionDenied,
/// Source configuration doesn't allow replication.
UnsupportedConfiguration,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ReplicationStatus::value] or
/// [ReplicationStatus::name].
UnknownValue(replication_status::UnknownValue),
}
#[doc(hidden)]
pub mod replication_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ReplicationStatus {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Active => std::option::Option::Some(1),
Self::SourceDeleted => std::option::Option::Some(2),
Self::PermissionDenied => std::option::Option::Some(3),
Self::UnsupportedConfiguration => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("REPLICATION_STATUS_UNSPECIFIED"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::SourceDeleted => std::option::Option::Some("SOURCE_DELETED"),
Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
Self::UnsupportedConfiguration => {
std::option::Option::Some("UNSUPPORTED_CONFIGURATION")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ReplicationStatus {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ReplicationStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ReplicationStatus {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Active,
2 => Self::SourceDeleted,
3 => Self::PermissionDenied,
4 => Self::UnsupportedConfiguration,
_ => Self::UnknownValue(replication_status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ReplicationStatus {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"REPLICATION_STATUS_UNSPECIFIED" => Self::Unspecified,
"ACTIVE" => Self::Active,
"SOURCE_DELETED" => Self::SourceDeleted,
"PERMISSION_DENIED" => Self::PermissionDenied,
"UNSUPPORTED_CONFIGURATION" => Self::UnsupportedConfiguration,
_ => Self::UnknownValue(replication_status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ReplicationStatus {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Active => serializer.serialize_i32(1),
Self::SourceDeleted => serializer.serialize_i32(2),
Self::PermissionDenied => serializer.serialize_i32(3),
Self::UnsupportedConfiguration => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ReplicationStatus {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReplicationStatus>::new(
".google.cloud.bigquery.v2.TableReplicationInfo.ReplicationStatus",
))
}
}
}
/// Describes the definition of a logical view.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ViewDefinition {
/// Required. A query that BigQuery executes when the view is referenced.
pub query: std::string::String,
/// Describes user-defined function resources used in the query.
pub user_defined_function_resources: std::vec::Vec<crate::model::UserDefinedFunctionResource>,
/// Specifies whether to use BigQuery's legacy SQL for this view.
/// The default value is true. If set to false, the view uses
/// BigQuery's
/// [GoogleSQL](https://docs.cloud.google.com/bigquery/docs/introduction-sql).
///
/// Queries and views that reference this view must use the same flag value.
/// A wrapper is used here because the default value is True.
pub use_legacy_sql: std::option::Option<wkt::BoolValue>,
/// True if the column names are explicitly specified. For example by using the
/// 'CREATE VIEW v(c1, c2) AS ...' syntax.
/// Can only be set for GoogleSQL views.
pub use_explicit_column_names: bool,
/// Optional. Specifies the privacy policy for the view.
pub privacy_policy: std::option::Option<crate::model::PrivacyPolicy>,
/// Optional. Foreign view representations.
pub foreign_definitions: std::vec::Vec<crate::model::ForeignViewDefinition>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ViewDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query][crate::model::ViewDefinition::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// let x = ViewDefinition::new().set_query("example");
/// ```
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
/// Sets the value of [user_defined_function_resources][crate::model::ViewDefinition::user_defined_function_resources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// let x = ViewDefinition::new()
/// .set_user_defined_function_resources([
/// UserDefinedFunctionResource::default()/* use setters */,
/// UserDefinedFunctionResource::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_user_defined_function_resources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UserDefinedFunctionResource>,
{
use std::iter::Iterator;
self.user_defined_function_resources = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [use_legacy_sql][crate::model::ViewDefinition::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use wkt::BoolValue;
/// let x = ViewDefinition::new().set_use_legacy_sql(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_legacy_sql<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_legacy_sql][crate::model::ViewDefinition::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use wkt::BoolValue;
/// let x = ViewDefinition::new().set_or_clear_use_legacy_sql(Some(BoolValue::default()/* use setters */));
/// let x = ViewDefinition::new().set_or_clear_use_legacy_sql(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_legacy_sql<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = v.map(|x| x.into());
self
}
/// Sets the value of [use_explicit_column_names][crate::model::ViewDefinition::use_explicit_column_names].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// let x = ViewDefinition::new().set_use_explicit_column_names(true);
/// ```
pub fn set_use_explicit_column_names<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.use_explicit_column_names = v.into();
self
}
/// Sets the value of [privacy_policy][crate::model::ViewDefinition::privacy_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// let x = ViewDefinition::new().set_privacy_policy(PrivacyPolicy::default()/* use setters */);
/// ```
pub fn set_privacy_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PrivacyPolicy>,
{
self.privacy_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [privacy_policy][crate::model::ViewDefinition::privacy_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// let x = ViewDefinition::new().set_or_clear_privacy_policy(Some(PrivacyPolicy::default()/* use setters */));
/// let x = ViewDefinition::new().set_or_clear_privacy_policy(None::<PrivacyPolicy>);
/// ```
pub fn set_or_clear_privacy_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PrivacyPolicy>,
{
self.privacy_policy = v.map(|x| x.into());
self
}
/// Sets the value of [foreign_definitions][crate::model::ViewDefinition::foreign_definitions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ViewDefinition;
/// use google_cloud_bigquery_v2::model::ForeignViewDefinition;
/// let x = ViewDefinition::new()
/// .set_foreign_definitions([
/// ForeignViewDefinition::default()/* use setters */,
/// ForeignViewDefinition::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_foreign_definitions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ForeignViewDefinition>,
{
use std::iter::Iterator;
self.foreign_definitions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ViewDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ViewDefinition"
}
}
/// A view can be represented in multiple ways. Each representation has its own
/// dialect. This message stores the metadata required for these representations.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ForeignViewDefinition {
/// Required. The query that defines the view.
pub query: std::string::String,
/// Optional. Represents the dialect of the query.
pub dialect: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ForeignViewDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query][crate::model::ForeignViewDefinition::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignViewDefinition;
/// let x = ForeignViewDefinition::new().set_query("example");
/// ```
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
/// Sets the value of [dialect][crate::model::ForeignViewDefinition::dialect].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignViewDefinition;
/// let x = ForeignViewDefinition::new().set_dialect("example");
/// ```
pub fn set_dialect<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dialect = v.into();
self
}
}
impl wkt::message::Message for ForeignViewDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ForeignViewDefinition"
}
}
/// Definition and configuration of a materialized view.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaterializedViewDefinition {
/// Required. A query whose results are persisted.
pub query: std::string::String,
/// Output only. The time when this materialized view was last refreshed, in
/// milliseconds since the epoch.
pub last_refresh_time: i64,
/// Optional. Enable automatic refresh of the materialized view when the base
/// table is updated. The default value is "true".
pub enable_refresh: std::option::Option<wkt::BoolValue>,
/// Optional. The maximum frequency at which this materialized view will be
/// refreshed. The default value is "1800000" (30 minutes).
pub refresh_interval_ms: std::option::Option<wkt::UInt64Value>,
/// Optional. This option declares the intention to construct a materialized
/// view that isn't refreshed incrementally. Non-incremental materialized views
/// support an expanded range of SQL queries. The
/// `allow_non_incremental_definition` option can't be changed after the
/// materialized view is created.
pub allow_non_incremental_definition: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaterializedViewDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query][crate::model::MaterializedViewDefinition::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// let x = MaterializedViewDefinition::new().set_query("example");
/// ```
pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query = v.into();
self
}
/// Sets the value of [last_refresh_time][crate::model::MaterializedViewDefinition::last_refresh_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// let x = MaterializedViewDefinition::new().set_last_refresh_time(42);
/// ```
pub fn set_last_refresh_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.last_refresh_time = v.into();
self
}
/// Sets the value of [enable_refresh][crate::model::MaterializedViewDefinition::enable_refresh].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::BoolValue;
/// let x = MaterializedViewDefinition::new().set_enable_refresh(BoolValue::default()/* use setters */);
/// ```
pub fn set_enable_refresh<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_refresh = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [enable_refresh][crate::model::MaterializedViewDefinition::enable_refresh].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::BoolValue;
/// let x = MaterializedViewDefinition::new().set_or_clear_enable_refresh(Some(BoolValue::default()/* use setters */));
/// let x = MaterializedViewDefinition::new().set_or_clear_enable_refresh(None::<BoolValue>);
/// ```
pub fn set_or_clear_enable_refresh<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.enable_refresh = v.map(|x| x.into());
self
}
/// Sets the value of [refresh_interval_ms][crate::model::MaterializedViewDefinition::refresh_interval_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::UInt64Value;
/// let x = MaterializedViewDefinition::new().set_refresh_interval_ms(UInt64Value::default()/* use setters */);
/// ```
pub fn set_refresh_interval_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.refresh_interval_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [refresh_interval_ms][crate::model::MaterializedViewDefinition::refresh_interval_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::UInt64Value;
/// let x = MaterializedViewDefinition::new().set_or_clear_refresh_interval_ms(Some(UInt64Value::default()/* use setters */));
/// let x = MaterializedViewDefinition::new().set_or_clear_refresh_interval_ms(None::<UInt64Value>);
/// ```
pub fn set_or_clear_refresh_interval_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.refresh_interval_ms = v.map(|x| x.into());
self
}
/// Sets the value of [allow_non_incremental_definition][crate::model::MaterializedViewDefinition::allow_non_incremental_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::BoolValue;
/// let x = MaterializedViewDefinition::new().set_allow_non_incremental_definition(BoolValue::default()/* use setters */);
/// ```
pub fn set_allow_non_incremental_definition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_non_incremental_definition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allow_non_incremental_definition][crate::model::MaterializedViewDefinition::allow_non_incremental_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// use wkt::BoolValue;
/// let x = MaterializedViewDefinition::new().set_or_clear_allow_non_incremental_definition(Some(BoolValue::default()/* use setters */));
/// let x = MaterializedViewDefinition::new().set_or_clear_allow_non_incremental_definition(None::<BoolValue>);
/// ```
pub fn set_or_clear_allow_non_incremental_definition<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.allow_non_incremental_definition = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for MaterializedViewDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MaterializedViewDefinition"
}
}
/// Status of a materialized view.
/// The last refresh timestamp status is omitted here, but is present in the
/// MaterializedViewDefinition message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaterializedViewStatus {
/// Output only. Refresh watermark of materialized view. The base tables' data
/// were collected into the materialized view cache until this time.
pub refresh_watermark: std::option::Option<wkt::Timestamp>,
/// Output only. Error result of the last automatic refresh. If present,
/// indicates that the last automatic refresh was unsuccessful.
pub last_refresh_status: std::option::Option<crate::model::ErrorProto>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaterializedViewStatus {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [refresh_watermark][crate::model::MaterializedViewStatus::refresh_watermark].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// use wkt::Timestamp;
/// let x = MaterializedViewStatus::new().set_refresh_watermark(Timestamp::default()/* use setters */);
/// ```
pub fn set_refresh_watermark<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.refresh_watermark = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [refresh_watermark][crate::model::MaterializedViewStatus::refresh_watermark].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// use wkt::Timestamp;
/// let x = MaterializedViewStatus::new().set_or_clear_refresh_watermark(Some(Timestamp::default()/* use setters */));
/// let x = MaterializedViewStatus::new().set_or_clear_refresh_watermark(None::<Timestamp>);
/// ```
pub fn set_or_clear_refresh_watermark<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.refresh_watermark = v.map(|x| x.into());
self
}
/// Sets the value of [last_refresh_status][crate::model::MaterializedViewStatus::last_refresh_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = MaterializedViewStatus::new().set_last_refresh_status(ErrorProto::default()/* use setters */);
/// ```
pub fn set_last_refresh_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.last_refresh_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [last_refresh_status][crate::model::MaterializedViewStatus::last_refresh_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// use google_cloud_bigquery_v2::model::ErrorProto;
/// let x = MaterializedViewStatus::new().set_or_clear_last_refresh_status(Some(ErrorProto::default()/* use setters */));
/// let x = MaterializedViewStatus::new().set_or_clear_last_refresh_status(None::<ErrorProto>);
/// ```
pub fn set_or_clear_last_refresh_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ErrorProto>,
{
self.last_refresh_status = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for MaterializedViewStatus {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.MaterializedViewStatus"
}
}
/// Information about base table and snapshot time of the snapshot.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SnapshotDefinition {
/// Required. Reference describing the ID of the table that was snapshot.
pub base_table_reference: std::option::Option<crate::model::TableReference>,
/// Required. The time at which the base table was snapshot. This value is
/// reported in the JSON response using RFC3339 format.
pub snapshot_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SnapshotDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [base_table_reference][crate::model::SnapshotDefinition::base_table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = SnapshotDefinition::new().set_base_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_base_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [base_table_reference][crate::model::SnapshotDefinition::base_table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = SnapshotDefinition::new().set_or_clear_base_table_reference(Some(TableReference::default()/* use setters */));
/// let x = SnapshotDefinition::new().set_or_clear_base_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_base_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [snapshot_time][crate::model::SnapshotDefinition::snapshot_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// use wkt::Timestamp;
/// let x = SnapshotDefinition::new().set_snapshot_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_snapshot_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.snapshot_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [snapshot_time][crate::model::SnapshotDefinition::snapshot_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// use wkt::Timestamp;
/// let x = SnapshotDefinition::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
/// let x = SnapshotDefinition::new().set_or_clear_snapshot_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.snapshot_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SnapshotDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.SnapshotDefinition"
}
}
/// Information about base table and clone time of a table clone.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloneDefinition {
/// Required. Reference describing the ID of the table that was cloned.
pub base_table_reference: std::option::Option<crate::model::TableReference>,
/// Required. The time at which the base table was cloned. This value is
/// reported in the JSON response using RFC3339 format.
pub clone_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CloneDefinition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [base_table_reference][crate::model::CloneDefinition::base_table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CloneDefinition;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = CloneDefinition::new().set_base_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_base_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [base_table_reference][crate::model::CloneDefinition::base_table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CloneDefinition;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = CloneDefinition::new().set_or_clear_base_table_reference(Some(TableReference::default()/* use setters */));
/// let x = CloneDefinition::new().set_or_clear_base_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_base_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.base_table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [clone_time][crate::model::CloneDefinition::clone_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CloneDefinition;
/// use wkt::Timestamp;
/// let x = CloneDefinition::new().set_clone_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_clone_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.clone_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clone_time][crate::model::CloneDefinition::clone_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::CloneDefinition;
/// use wkt::Timestamp;
/// let x = CloneDefinition::new().set_or_clear_clone_time(Some(Timestamp::default()/* use setters */));
/// let x = CloneDefinition::new().set_or_clear_clone_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_clone_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.clone_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CloneDefinition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.CloneDefinition"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Streamingbuffer {
/// Output only. A lower-bound estimate of the number of bytes currently in
/// the streaming buffer.
pub estimated_bytes: u64,
/// Output only. A lower-bound estimate of the number of rows currently in the
/// streaming buffer.
pub estimated_rows: u64,
/// Output only. Contains the timestamp of the oldest entry in the streaming
/// buffer, in milliseconds since the epoch, if the streaming buffer is
/// available.
pub oldest_entry_time: u64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Streamingbuffer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [estimated_bytes][crate::model::Streamingbuffer::estimated_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Streamingbuffer;
/// let x = Streamingbuffer::new().set_estimated_bytes(42_u32);
/// ```
pub fn set_estimated_bytes<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.estimated_bytes = v.into();
self
}
/// Sets the value of [estimated_rows][crate::model::Streamingbuffer::estimated_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Streamingbuffer;
/// let x = Streamingbuffer::new().set_estimated_rows(42_u32);
/// ```
pub fn set_estimated_rows<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.estimated_rows = v.into();
self
}
/// Sets the value of [oldest_entry_time][crate::model::Streamingbuffer::oldest_entry_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Streamingbuffer;
/// let x = Streamingbuffer::new().set_oldest_entry_time(42_u32);
/// ```
pub fn set_oldest_entry_time<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.oldest_entry_time = v.into();
self
}
}
impl wkt::message::Message for Streamingbuffer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Streamingbuffer"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Table {
/// The type of resource ID.
pub kind: std::string::String,
/// Output only. A hash of this resource.
pub etag: std::string::String,
/// Output only. An opaque ID uniquely identifying the table.
pub id: std::string::String,
/// Output only. A URL that can be used to access this resource again.
pub self_link: std::string::String,
/// Required. Reference describing the ID of this table.
pub table_reference: std::option::Option<crate::model::TableReference>,
/// Optional. A descriptive name for this table.
pub friendly_name: std::option::Option<wkt::StringValue>,
/// Optional. A user-friendly description of this table.
pub description: std::option::Option<wkt::StringValue>,
/// The labels associated with this table. You can use these to organize and
/// group your tables. Label keys and values can be no longer than 63
/// characters, can only contain lowercase letters, numeric characters,
/// underscores and dashes. International characters are allowed. Label values
/// are optional. Label keys must start with a letter and each label in the
/// list must have a different key.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. Describes the schema of this table.
pub schema: std::option::Option<crate::model::TableSchema>,
/// If specified, configures time-based partitioning for this table.
pub time_partitioning: std::option::Option<crate::model::TimePartitioning>,
/// If specified, configures range partitioning for this table.
pub range_partitioning: std::option::Option<crate::model::RangePartitioning>,
/// Clustering specification for the table. Must be specified with time-based
/// partitioning, data in the table will be first partitioned and subsequently
/// clustered.
pub clustering: std::option::Option<crate::model::Clustering>,
/// Optional. If set to true, queries over this table require
/// a partition filter that can be used for partition elimination to be
/// specified.
pub require_partition_filter: std::option::Option<wkt::BoolValue>,
/// Optional. The partition information for all table formats, including
/// managed partitioned tables, hive partitioned tables, iceberg partitioned,
/// and metastore partitioned tables. This field is only populated for
/// metastore partitioned tables. For other table formats, this is an output
/// only field.
pub partition_definition: std::option::Option<crate::model::PartitioningDefinition>,
/// Output only. The size of this table in logical bytes, excluding any data in
/// the streaming buffer.
pub num_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The physical size of this table in bytes. This includes
/// storage used for time travel.
pub num_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The number of logical bytes in the table that are considered
/// "long-term storage".
pub num_long_term_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The number of rows of data in this table, excluding any data
/// in the streaming buffer.
pub num_rows: std::option::Option<wkt::UInt64Value>,
/// Output only. The time when this table was created, in milliseconds since
/// the epoch.
pub creation_time: i64,
/// Optional. The time when this table expires, in milliseconds since the
/// epoch. If not present, the table will persist indefinitely. Expired tables
/// will be deleted and their storage reclaimed. The defaultTableExpirationMs
/// property of the encapsulating dataset can be used to set a default
/// expirationTime on newly created tables.
pub expiration_time: std::option::Option<wkt::Int64Value>,
/// Output only. The time when this table was last modified, in milliseconds
/// since the epoch.
pub last_modified_time: u64,
/// Output only. Describes the table type. The following values are supported:
///
/// * `TABLE`: A normal BigQuery table.
/// * `VIEW`: A virtual table defined by a SQL query.
/// * `EXTERNAL`: A table that references data stored in an external storage
/// system, such as Google Cloud Storage.
/// * `MATERIALIZED_VIEW`: A precomputed view defined by a SQL query.
/// * `SNAPSHOT`: An immutable BigQuery table that preserves the contents of a
/// base table at a particular time. See additional information on
/// [table
/// snapshots](https://cloud.google.com/bigquery/docs/table-snapshots-intro).
///
/// The default value is `TABLE`.
pub r#type: std::string::String,
/// Optional. The view definition.
pub view: std::option::Option<crate::model::ViewDefinition>,
/// Optional. The materialized view definition.
pub materialized_view: std::option::Option<crate::model::MaterializedViewDefinition>,
/// Output only. The materialized view status.
pub materialized_view_status: std::option::Option<crate::model::MaterializedViewStatus>,
/// Optional. Describes the data format, location, and other properties of
/// a table stored outside of BigQuery. By defining these properties, the data
/// source can then be queried as if it were a standard BigQuery table.
pub external_data_configuration: std::option::Option<crate::model::ExternalDataConfiguration>,
/// Optional. Specifies the configuration of a BigQuery table for Apache
/// Iceberg.
pub biglake_configuration: std::option::Option<crate::model::BigLakeConfiguration>,
/// Optional. If set, overrides the default managed table type configured in
/// the dataset.
pub managed_table_type: crate::model::ManagedTableType,
/// Output only. The geographic location where the table resides. This value
/// is inherited from the dataset.
pub location: std::string::String,
/// Output only. Contains information regarding this table's streaming buffer,
/// if one is present. This field will be absent if the table is not being
/// streamed to or if there is no data in the streaming buffer.
pub streaming_buffer: std::option::Option<crate::model::Streamingbuffer>,
/// Custom encryption configuration (e.g., Cloud KMS keys).
pub encryption_configuration: std::option::Option<crate::model::EncryptionConfiguration>,
/// Output only. Contains information about the snapshot. This value is set via
/// snapshot creation.
pub snapshot_definition: std::option::Option<crate::model::SnapshotDefinition>,
/// Optional. Defines the default collation specification of new STRING fields
/// in the table. During table creation or update, if a STRING field is added
/// to this table without explicit collation specified, then the table inherits
/// the table default collation. A change to this field affects only fields
/// added afterwards, and does not alter the existing fields.
/// The following values are supported:
///
/// * 'und:ci': undetermined locale, case insensitive.
/// * '': empty string. Default to case-sensitive behavior.
pub default_collation: std::option::Option<wkt::StringValue>,
/// Optional. Defines the default rounding mode specification of new decimal
/// fields (NUMERIC OR BIGNUMERIC) in the table. During table creation or
/// update, if a decimal field is added to this table without an explicit
/// rounding mode specified, then the field inherits the table default
/// rounding mode. Changing this field doesn't affect existing fields.
pub default_rounding_mode: crate::model::table_field_schema::RoundingMode,
/// Output only. Contains information about the clone. This value is set via
/// the clone operation.
pub clone_definition: std::option::Option<crate::model::CloneDefinition>,
/// Output only. Number of physical bytes used by time travel storage (deleted
/// or changed data). This data is not kept in real time, and might be delayed
/// by a few seconds to a few minutes.
pub num_time_travel_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Total number of logical bytes in the table or materialized
/// view.
pub num_total_logical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of logical bytes that are less than 90 days old.
pub num_active_logical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of logical bytes that are more than 90 days old.
pub num_long_term_logical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of physical bytes used by current live data storage.
/// This data is not kept in real time, and might be delayed by a few seconds
/// to a few minutes.
pub num_current_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The physical size of this table in bytes. This also includes
/// storage used for time travel. This data is not kept in real time, and might
/// be delayed by a few seconds to a few minutes.
pub num_total_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of physical bytes less than 90 days old. This data is
/// not kept in real time, and might be delayed by a few seconds to a few
/// minutes.
pub num_active_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. Number of physical bytes more than 90 days old.
/// This data is not kept in real time, and might be delayed by a few seconds
/// to a few minutes.
pub num_long_term_physical_bytes: std::option::Option<wkt::Int64Value>,
/// Output only. The number of partitions present in the table or materialized
/// view. This data is not kept in real time, and might be delayed by a few
/// seconds to a few minutes.
pub num_partitions: std::option::Option<wkt::Int64Value>,
/// Optional. The maximum staleness of data that could be returned when the
/// table (or stale MV) is queried. Staleness encoded as a string encoding
/// of sql IntervalValue type.
pub max_staleness: std::string::String,
/// Optional. Output only. Restriction config for table. If set, restrict
/// certain accesses on the table based on the config. See [Data
/// egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress)
/// for more details.
pub restrictions: std::option::Option<crate::model::RestrictionConfig>,
/// Optional. Tables Primary Key and Foreign Key information
pub table_constraints: std::option::Option<crate::model::TableConstraints>,
/// Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached
/// to this table. Tag keys are globally unique. Tag key is expected to be in
/// the namespaced format, for example "123456789012/environment" where
/// 123456789012 is the ID of the parent organization or project resource for
/// this tag key. Tag value is expected to be the short name, for example
/// "Production". See [Tag
/// definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions)
/// for more details.
pub resource_tags: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. Table replication info for table created `AS REPLICA` DDL like:
/// `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`
pub table_replication_info: std::option::Option<crate::model::TableReplicationInfo>,
/// Optional. Output only. Table references of all replicas currently active on
/// the table.
pub replicas: std::vec::Vec<crate::model::TableReference>,
/// Optional. Options defining open source compatible table.
pub external_catalog_table_options:
std::option::Option<crate::model::ExternalCatalogTableOptions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Table {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::Table::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::Table::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [id][crate::model::Table::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [self_link][crate::model::Table::self_link].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_self_link("example");
/// ```
pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.self_link = v.into();
self
}
/// Sets the value of [table_reference][crate::model::Table::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = Table::new().set_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_reference][crate::model::Table::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = Table::new().set_or_clear_table_reference(Some(TableReference::default()/* use setters */));
/// let x = Table::new().set_or_clear_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [friendly_name][crate::model::Table::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_friendly_name(StringValue::default()/* use setters */);
/// ```
pub fn set_friendly_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [friendly_name][crate::model::Table::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_or_clear_friendly_name(Some(StringValue::default()/* use setters */));
/// let x = Table::new().set_or_clear_friendly_name(None::<StringValue>);
/// ```
pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = v.map(|x| x.into());
self
}
/// Sets the value of [description][crate::model::Table::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_description(StringValue::default()/* use setters */);
/// ```
pub fn set_description<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [description][crate::model::Table::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_or_clear_description(Some(StringValue::default()/* use setters */));
/// let x = Table::new().set_or_clear_description(None::<StringValue>);
/// ```
pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::Table::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [schema][crate::model::Table::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = Table::new().set_schema(TableSchema::default()/* use setters */);
/// ```
pub fn set_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schema][crate::model::Table::schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableSchema;
/// let x = Table::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
/// let x = Table::new().set_or_clear_schema(None::<TableSchema>);
/// ```
pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableSchema>,
{
self.schema = v.map(|x| x.into());
self
}
/// Sets the value of [time_partitioning][crate::model::Table::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = Table::new().set_time_partitioning(TimePartitioning::default()/* use setters */);
/// ```
pub fn set_time_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_partitioning][crate::model::Table::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = Table::new().set_or_clear_time_partitioning(Some(TimePartitioning::default()/* use setters */));
/// let x = Table::new().set_or_clear_time_partitioning(None::<TimePartitioning>);
/// ```
pub fn set_or_clear_time_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [range_partitioning][crate::model::Table::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = Table::new().set_range_partitioning(RangePartitioning::default()/* use setters */);
/// ```
pub fn set_range_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range_partitioning][crate::model::Table::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = Table::new().set_or_clear_range_partitioning(Some(RangePartitioning::default()/* use setters */));
/// let x = Table::new().set_or_clear_range_partitioning(None::<RangePartitioning>);
/// ```
pub fn set_or_clear_range_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [clustering][crate::model::Table::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = Table::new().set_clustering(Clustering::default()/* use setters */);
/// ```
pub fn set_clustering<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clustering][crate::model::Table::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = Table::new().set_or_clear_clustering(Some(Clustering::default()/* use setters */));
/// let x = Table::new().set_or_clear_clustering(None::<Clustering>);
/// ```
pub fn set_or_clear_clustering<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = v.map(|x| x.into());
self
}
/// Sets the value of [require_partition_filter][crate::model::Table::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::BoolValue;
/// let x = Table::new().set_require_partition_filter(BoolValue::default()/* use setters */);
/// ```
pub fn set_require_partition_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [require_partition_filter][crate::model::Table::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::BoolValue;
/// let x = Table::new().set_or_clear_require_partition_filter(Some(BoolValue::default()/* use setters */));
/// let x = Table::new().set_or_clear_require_partition_filter(None::<BoolValue>);
/// ```
pub fn set_or_clear_require_partition_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = v.map(|x| x.into());
self
}
/// Sets the value of [partition_definition][crate::model::Table::partition_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::PartitioningDefinition;
/// let x = Table::new().set_partition_definition(PartitioningDefinition::default()/* use setters */);
/// ```
pub fn set_partition_definition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PartitioningDefinition>,
{
self.partition_definition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [partition_definition][crate::model::Table::partition_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::PartitioningDefinition;
/// let x = Table::new().set_or_clear_partition_definition(Some(PartitioningDefinition::default()/* use setters */));
/// let x = Table::new().set_or_clear_partition_definition(None::<PartitioningDefinition>);
/// ```
pub fn set_or_clear_partition_definition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PartitioningDefinition>,
{
self.partition_definition = v.map(|x| x.into());
self
}
/// Sets the value of [num_bytes][crate::model::Table::num_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_bytes][crate::model::Table::num_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_physical_bytes][crate::model::Table::num_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_physical_bytes][crate::model::Table::num_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_physical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_long_term_bytes][crate::model::Table::num_long_term_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_long_term_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_long_term_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_long_term_bytes][crate::model::Table::num_long_term_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_long_term_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_long_term_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_long_term_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_rows][crate::model::Table::num_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::UInt64Value;
/// let x = Table::new().set_num_rows(UInt64Value::default()/* use setters */);
/// ```
pub fn set_num_rows<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.num_rows = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_rows][crate::model::Table::num_rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::UInt64Value;
/// let x = Table::new().set_or_clear_num_rows(Some(UInt64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_rows(None::<UInt64Value>);
/// ```
pub fn set_or_clear_num_rows<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt64Value>,
{
self.num_rows = v.map(|x| x.into());
self
}
/// Sets the value of [creation_time][crate::model::Table::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [expiration_time][crate::model::Table::expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_expiration_time(Int64Value::default()/* use setters */);
/// ```
pub fn set_expiration_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.expiration_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [expiration_time][crate::model::Table::expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_expiration_time(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_expiration_time(None::<Int64Value>);
/// ```
pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.expiration_time = v.map(|x| x.into());
self
}
/// Sets the value of [last_modified_time][crate::model::Table::last_modified_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_last_modified_time(42_u32);
/// ```
pub fn set_last_modified_time<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
self.last_modified_time = v.into();
self
}
/// Sets the value of [r#type][crate::model::Table::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [view][crate::model::Table::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ViewDefinition;
/// let x = Table::new().set_view(ViewDefinition::default()/* use setters */);
/// ```
pub fn set_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ViewDefinition>,
{
self.view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [view][crate::model::Table::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ViewDefinition;
/// let x = Table::new().set_or_clear_view(Some(ViewDefinition::default()/* use setters */));
/// let x = Table::new().set_or_clear_view(None::<ViewDefinition>);
/// ```
pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ViewDefinition>,
{
self.view = v.map(|x| x.into());
self
}
/// Sets the value of [materialized_view][crate::model::Table::materialized_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// let x = Table::new().set_materialized_view(MaterializedViewDefinition::default()/* use setters */);
/// ```
pub fn set_materialized_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewDefinition>,
{
self.materialized_view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [materialized_view][crate::model::Table::materialized_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::MaterializedViewDefinition;
/// let x = Table::new().set_or_clear_materialized_view(Some(MaterializedViewDefinition::default()/* use setters */));
/// let x = Table::new().set_or_clear_materialized_view(None::<MaterializedViewDefinition>);
/// ```
pub fn set_or_clear_materialized_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewDefinition>,
{
self.materialized_view = v.map(|x| x.into());
self
}
/// Sets the value of [materialized_view_status][crate::model::Table::materialized_view_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// let x = Table::new().set_materialized_view_status(MaterializedViewStatus::default()/* use setters */);
/// ```
pub fn set_materialized_view_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewStatus>,
{
self.materialized_view_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [materialized_view_status][crate::model::Table::materialized_view_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::MaterializedViewStatus;
/// let x = Table::new().set_or_clear_materialized_view_status(Some(MaterializedViewStatus::default()/* use setters */));
/// let x = Table::new().set_or_clear_materialized_view_status(None::<MaterializedViewStatus>);
/// ```
pub fn set_or_clear_materialized_view_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MaterializedViewStatus>,
{
self.materialized_view_status = v.map(|x| x.into());
self
}
/// Sets the value of [external_data_configuration][crate::model::Table::external_data_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = Table::new().set_external_data_configuration(ExternalDataConfiguration::default()/* use setters */);
/// ```
pub fn set_external_data_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalDataConfiguration>,
{
self.external_data_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_data_configuration][crate::model::Table::external_data_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ExternalDataConfiguration;
/// let x = Table::new().set_or_clear_external_data_configuration(Some(ExternalDataConfiguration::default()/* use setters */));
/// let x = Table::new().set_or_clear_external_data_configuration(None::<ExternalDataConfiguration>);
/// ```
pub fn set_or_clear_external_data_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExternalDataConfiguration>,
{
self.external_data_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [biglake_configuration][crate::model::Table::biglake_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// let x = Table::new().set_biglake_configuration(BigLakeConfiguration::default()/* use setters */);
/// ```
pub fn set_biglake_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BigLakeConfiguration>,
{
self.biglake_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [biglake_configuration][crate::model::Table::biglake_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::BigLakeConfiguration;
/// let x = Table::new().set_or_clear_biglake_configuration(Some(BigLakeConfiguration::default()/* use setters */));
/// let x = Table::new().set_or_clear_biglake_configuration(None::<BigLakeConfiguration>);
/// ```
pub fn set_or_clear_biglake_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BigLakeConfiguration>,
{
self.biglake_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [managed_table_type][crate::model::Table::managed_table_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ManagedTableType;
/// let x0 = Table::new().set_managed_table_type(ManagedTableType::Native);
/// let x1 = Table::new().set_managed_table_type(ManagedTableType::Biglake);
/// ```
pub fn set_managed_table_type<T: std::convert::Into<crate::model::ManagedTableType>>(
mut self,
v: T,
) -> Self {
self.managed_table_type = v.into();
self
}
/// Sets the value of [location][crate::model::Table::location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_location("example");
/// ```
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
/// Sets the value of [streaming_buffer][crate::model::Table::streaming_buffer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::Streamingbuffer;
/// let x = Table::new().set_streaming_buffer(Streamingbuffer::default()/* use setters */);
/// ```
pub fn set_streaming_buffer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Streamingbuffer>,
{
self.streaming_buffer = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [streaming_buffer][crate::model::Table::streaming_buffer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::Streamingbuffer;
/// let x = Table::new().set_or_clear_streaming_buffer(Some(Streamingbuffer::default()/* use setters */));
/// let x = Table::new().set_or_clear_streaming_buffer(None::<Streamingbuffer>);
/// ```
pub fn set_or_clear_streaming_buffer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Streamingbuffer>,
{
self.streaming_buffer = v.map(|x| x.into());
self
}
/// Sets the value of [encryption_configuration][crate::model::Table::encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Table::new().set_encryption_configuration(EncryptionConfiguration::default()/* use setters */);
/// ```
pub fn set_encryption_configuration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.encryption_configuration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [encryption_configuration][crate::model::Table::encryption_configuration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::EncryptionConfiguration;
/// let x = Table::new().set_or_clear_encryption_configuration(Some(EncryptionConfiguration::default()/* use setters */));
/// let x = Table::new().set_or_clear_encryption_configuration(None::<EncryptionConfiguration>);
/// ```
pub fn set_or_clear_encryption_configuration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EncryptionConfiguration>,
{
self.encryption_configuration = v.map(|x| x.into());
self
}
/// Sets the value of [snapshot_definition][crate::model::Table::snapshot_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// let x = Table::new().set_snapshot_definition(SnapshotDefinition::default()/* use setters */);
/// ```
pub fn set_snapshot_definition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SnapshotDefinition>,
{
self.snapshot_definition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [snapshot_definition][crate::model::Table::snapshot_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::SnapshotDefinition;
/// let x = Table::new().set_or_clear_snapshot_definition(Some(SnapshotDefinition::default()/* use setters */));
/// let x = Table::new().set_or_clear_snapshot_definition(None::<SnapshotDefinition>);
/// ```
pub fn set_or_clear_snapshot_definition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SnapshotDefinition>,
{
self.snapshot_definition = v.map(|x| x.into());
self
}
/// Sets the value of [default_collation][crate::model::Table::default_collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_default_collation(StringValue::default()/* use setters */);
/// ```
pub fn set_default_collation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_collation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_collation][crate::model::Table::default_collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::StringValue;
/// let x = Table::new().set_or_clear_default_collation(Some(StringValue::default()/* use setters */));
/// let x = Table::new().set_or_clear_default_collation(None::<StringValue>);
/// ```
pub fn set_or_clear_default_collation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_collation = v.map(|x| x.into());
self
}
/// Sets the value of [default_rounding_mode][crate::model::Table::default_rounding_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::table_field_schema::RoundingMode;
/// let x0 = Table::new().set_default_rounding_mode(RoundingMode::RoundHalfAwayFromZero);
/// let x1 = Table::new().set_default_rounding_mode(RoundingMode::RoundHalfEven);
/// ```
pub fn set_default_rounding_mode<
T: std::convert::Into<crate::model::table_field_schema::RoundingMode>,
>(
mut self,
v: T,
) -> Self {
self.default_rounding_mode = v.into();
self
}
/// Sets the value of [clone_definition][crate::model::Table::clone_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::CloneDefinition;
/// let x = Table::new().set_clone_definition(CloneDefinition::default()/* use setters */);
/// ```
pub fn set_clone_definition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CloneDefinition>,
{
self.clone_definition = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clone_definition][crate::model::Table::clone_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::CloneDefinition;
/// let x = Table::new().set_or_clear_clone_definition(Some(CloneDefinition::default()/* use setters */));
/// let x = Table::new().set_or_clear_clone_definition(None::<CloneDefinition>);
/// ```
pub fn set_or_clear_clone_definition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CloneDefinition>,
{
self.clone_definition = v.map(|x| x.into());
self
}
/// Sets the value of [num_time_travel_physical_bytes][crate::model::Table::num_time_travel_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_time_travel_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_time_travel_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_time_travel_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_time_travel_physical_bytes][crate::model::Table::num_time_travel_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_time_travel_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_time_travel_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_time_travel_physical_bytes<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_time_travel_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_total_logical_bytes][crate::model::Table::num_total_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_total_logical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_total_logical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_total_logical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_total_logical_bytes][crate::model::Table::num_total_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_total_logical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_total_logical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_total_logical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_total_logical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_active_logical_bytes][crate::model::Table::num_active_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_active_logical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_active_logical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_active_logical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_active_logical_bytes][crate::model::Table::num_active_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_active_logical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_active_logical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_active_logical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_active_logical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_long_term_logical_bytes][crate::model::Table::num_long_term_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_long_term_logical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_long_term_logical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_logical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_long_term_logical_bytes][crate::model::Table::num_long_term_logical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_long_term_logical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_long_term_logical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_long_term_logical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_logical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_current_physical_bytes][crate::model::Table::num_current_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_current_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_current_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_current_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_current_physical_bytes][crate::model::Table::num_current_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_current_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_current_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_current_physical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_current_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_total_physical_bytes][crate::model::Table::num_total_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_total_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_total_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_total_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_total_physical_bytes][crate::model::Table::num_total_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_total_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_total_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_total_physical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_total_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_active_physical_bytes][crate::model::Table::num_active_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_active_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_active_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_active_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_active_physical_bytes][crate::model::Table::num_active_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_active_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_active_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_active_physical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_active_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_long_term_physical_bytes][crate::model::Table::num_long_term_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_long_term_physical_bytes(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_long_term_physical_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_physical_bytes = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_long_term_physical_bytes][crate::model::Table::num_long_term_physical_bytes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_long_term_physical_bytes(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_long_term_physical_bytes(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_long_term_physical_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_long_term_physical_bytes = v.map(|x| x.into());
self
}
/// Sets the value of [num_partitions][crate::model::Table::num_partitions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_num_partitions(Int64Value::default()/* use setters */);
/// ```
pub fn set_num_partitions<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_partitions = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [num_partitions][crate::model::Table::num_partitions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use wkt::Int64Value;
/// let x = Table::new().set_or_clear_num_partitions(Some(Int64Value::default()/* use setters */));
/// let x = Table::new().set_or_clear_num_partitions(None::<Int64Value>);
/// ```
pub fn set_or_clear_num_partitions<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.num_partitions = v.map(|x| x.into());
self
}
/// Sets the value of [max_staleness][crate::model::Table::max_staleness].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_max_staleness("example");
/// ```
pub fn set_max_staleness<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.max_staleness = v.into();
self
}
/// Sets the value of [restrictions][crate::model::Table::restrictions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::RestrictionConfig;
/// let x = Table::new().set_restrictions(RestrictionConfig::default()/* use setters */);
/// ```
pub fn set_restrictions<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RestrictionConfig>,
{
self.restrictions = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [restrictions][crate::model::Table::restrictions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::RestrictionConfig;
/// let x = Table::new().set_or_clear_restrictions(Some(RestrictionConfig::default()/* use setters */));
/// let x = Table::new().set_or_clear_restrictions(None::<RestrictionConfig>);
/// ```
pub fn set_or_clear_restrictions<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RestrictionConfig>,
{
self.restrictions = v.map(|x| x.into());
self
}
/// Sets the value of [table_constraints][crate::model::Table::table_constraints].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableConstraints;
/// let x = Table::new().set_table_constraints(TableConstraints::default()/* use setters */);
/// ```
pub fn set_table_constraints<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableConstraints>,
{
self.table_constraints = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_constraints][crate::model::Table::table_constraints].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableConstraints;
/// let x = Table::new().set_or_clear_table_constraints(Some(TableConstraints::default()/* use setters */));
/// let x = Table::new().set_or_clear_table_constraints(None::<TableConstraints>);
/// ```
pub fn set_or_clear_table_constraints<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableConstraints>,
{
self.table_constraints = v.map(|x| x.into());
self
}
/// Sets the value of [resource_tags][crate::model::Table::resource_tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// let x = Table::new().set_resource_tags([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_resource_tags<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.resource_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [table_replication_info][crate::model::Table::table_replication_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// let x = Table::new().set_table_replication_info(TableReplicationInfo::default()/* use setters */);
/// ```
pub fn set_table_replication_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReplicationInfo>,
{
self.table_replication_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_replication_info][crate::model::Table::table_replication_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableReplicationInfo;
/// let x = Table::new().set_or_clear_table_replication_info(Some(TableReplicationInfo::default()/* use setters */));
/// let x = Table::new().set_or_clear_table_replication_info(None::<TableReplicationInfo>);
/// ```
pub fn set_or_clear_table_replication_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReplicationInfo>,
{
self.table_replication_info = v.map(|x| x.into());
self
}
/// Sets the value of [replicas][crate::model::Table::replicas].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = Table::new()
/// .set_replicas([
/// TableReference::default()/* use setters */,
/// TableReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_replicas<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableReference>,
{
use std::iter::Iterator;
self.replicas = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [external_catalog_table_options][crate::model::Table::external_catalog_table_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// let x = Table::new().set_external_catalog_table_options(ExternalCatalogTableOptions::default()/* use setters */);
/// ```
pub fn set_external_catalog_table_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExternalCatalogTableOptions>,
{
self.external_catalog_table_options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [external_catalog_table_options][crate::model::Table::external_catalog_table_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::Table;
/// use google_cloud_bigquery_v2::model::ExternalCatalogTableOptions;
/// let x = Table::new().set_or_clear_external_catalog_table_options(Some(ExternalCatalogTableOptions::default()/* use setters */));
/// let x = Table::new().set_or_clear_external_catalog_table_options(None::<ExternalCatalogTableOptions>);
/// ```
pub fn set_or_clear_external_catalog_table_options<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ExternalCatalogTableOptions>,
{
self.external_catalog_table_options = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Table {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.Table"
}
}
/// Request format for getting table metadata.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTableRequest {
/// Required. Project ID of the requested table
pub project_id: std::string::String,
/// Required. Dataset ID of the requested table
pub dataset_id: std::string::String,
/// Required. Table ID of the requested table
pub table_id: std::string::String,
/// List of table schema fields to return (comma-separated).
/// If unspecified, all fields are returned.
/// A fieldMask cannot be used here because the fields will automatically be
/// converted from camelCase to snake_case and the conversion will fail if
/// there are underscores. Since these are fields in BigQuery table schemas,
/// underscores are allowed.
pub selected_fields: std::string::String,
/// Optional. Specifies the view that determines which table information is
/// returned. By default, basic table information and storage statistics
/// (STORAGE_STATS) are returned.
pub view: crate::model::get_table_request::TableMetadataView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetTableRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::GetTableRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetTableRequest;
/// let x = GetTableRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::GetTableRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetTableRequest;
/// let x = GetTableRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::GetTableRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetTableRequest;
/// let x = GetTableRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [selected_fields][crate::model::GetTableRequest::selected_fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetTableRequest;
/// let x = GetTableRequest::new().set_selected_fields("example");
/// ```
pub fn set_selected_fields<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.selected_fields = v.into();
self
}
/// Sets the value of [view][crate::model::GetTableRequest::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::GetTableRequest;
/// use google_cloud_bigquery_v2::model::get_table_request::TableMetadataView;
/// let x0 = GetTableRequest::new().set_view(TableMetadataView::Basic);
/// let x1 = GetTableRequest::new().set_view(TableMetadataView::StorageStats);
/// let x2 = GetTableRequest::new().set_view(TableMetadataView::Full);
/// ```
pub fn set_view<T: std::convert::Into<crate::model::get_table_request::TableMetadataView>>(
mut self,
v: T,
) -> Self {
self.view = v.into();
self
}
}
impl wkt::message::Message for GetTableRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.GetTableRequest"
}
}
/// Defines additional types related to [GetTableRequest].
pub mod get_table_request {
#[allow(unused_imports)]
use super::*;
/// TableMetadataView specifies which table information is returned.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TableMetadataView {
/// The default value.
/// Default to the STORAGE_STATS view.
Unspecified,
/// Includes basic table information including schema and
/// partitioning specification. This view does not include storage statistics
/// such as numRows or numBytes. This view is significantly more efficient
/// and should be used to support high query rates.
Basic,
/// Includes all information in the BASIC view as well as storage statistics
/// (numBytes, numLongTermBytes, numRows and lastModifiedTime).
StorageStats,
/// Includes all table information, including storage statistics.
/// It returns same information as STORAGE_STATS view, but may contain
/// additional information in the future.
Full,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TableMetadataView::value] or
/// [TableMetadataView::name].
UnknownValue(table_metadata_view::UnknownValue),
}
#[doc(hidden)]
pub mod table_metadata_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TableMetadataView {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Basic => std::option::Option::Some(1),
Self::StorageStats => std::option::Option::Some(2),
Self::Full => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TABLE_METADATA_VIEW_UNSPECIFIED"),
Self::Basic => std::option::Option::Some("BASIC"),
Self::StorageStats => std::option::Option::Some("STORAGE_STATS"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TableMetadataView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TableMetadataView {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TableMetadataView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Basic,
2 => Self::StorageStats,
3 => Self::Full,
_ => Self::UnknownValue(table_metadata_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TableMetadataView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TABLE_METADATA_VIEW_UNSPECIFIED" => Self::Unspecified,
"BASIC" => Self::Basic,
"STORAGE_STATS" => Self::StorageStats,
"FULL" => Self::Full,
_ => Self::UnknownValue(table_metadata_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TableMetadataView {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Basic => serializer.serialize_i32(1),
Self::StorageStats => serializer.serialize_i32(2),
Self::Full => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TableMetadataView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TableMetadataView>::new(
".google.cloud.bigquery.v2.GetTableRequest.TableMetadataView",
))
}
}
}
/// Request format for inserting table metadata.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsertTableRequest {
/// Required. Project ID of the new table
pub project_id: std::string::String,
/// Required. Dataset ID of the new table
pub dataset_id: std::string::String,
/// Required. A tables resource to insert
pub table: std::option::Option<crate::model::Table>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InsertTableRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::InsertTableRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertTableRequest;
/// let x = InsertTableRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::InsertTableRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertTableRequest;
/// let x = InsertTableRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table][crate::model::InsertTableRequest::table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertTableRequest;
/// use google_cloud_bigquery_v2::model::Table;
/// let x = InsertTableRequest::new().set_table(Table::default()/* use setters */);
/// ```
pub fn set_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Table>,
{
self.table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table][crate::model::InsertTableRequest::table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::InsertTableRequest;
/// use google_cloud_bigquery_v2::model::Table;
/// let x = InsertTableRequest::new().set_or_clear_table(Some(Table::default()/* use setters */));
/// let x = InsertTableRequest::new().set_or_clear_table(None::<Table>);
/// ```
pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Table>,
{
self.table = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for InsertTableRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.InsertTableRequest"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateOrPatchTableRequest {
/// Required. Project ID of the table to update
pub project_id: std::string::String,
/// Required. Dataset ID of the table to update
pub dataset_id: std::string::String,
/// Required. Table ID of the table to update
pub table_id: std::string::String,
/// Required. A tables resource which will replace or patch the specified table
pub table: std::option::Option<crate::model::Table>,
/// Optional. When true will autodetect schema, else will keep original schema.
pub autodetect_schema: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateOrPatchTableRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::UpdateOrPatchTableRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// let x = UpdateOrPatchTableRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::UpdateOrPatchTableRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// let x = UpdateOrPatchTableRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::UpdateOrPatchTableRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// let x = UpdateOrPatchTableRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
/// Sets the value of [table][crate::model::UpdateOrPatchTableRequest::table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// use google_cloud_bigquery_v2::model::Table;
/// let x = UpdateOrPatchTableRequest::new().set_table(Table::default()/* use setters */);
/// ```
pub fn set_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Table>,
{
self.table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table][crate::model::UpdateOrPatchTableRequest::table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// use google_cloud_bigquery_v2::model::Table;
/// let x = UpdateOrPatchTableRequest::new().set_or_clear_table(Some(Table::default()/* use setters */));
/// let x = UpdateOrPatchTableRequest::new().set_or_clear_table(None::<Table>);
/// ```
pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Table>,
{
self.table = v.map(|x| x.into());
self
}
/// Sets the value of [autodetect_schema][crate::model::UpdateOrPatchTableRequest::autodetect_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UpdateOrPatchTableRequest;
/// let x = UpdateOrPatchTableRequest::new().set_autodetect_schema(true);
/// ```
pub fn set_autodetect_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.autodetect_schema = v.into();
self
}
}
impl wkt::message::Message for UpdateOrPatchTableRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UpdateOrPatchTableRequest"
}
}
/// Request format for deleting a table.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTableRequest {
/// Required. Project ID of the table to delete
pub project_id: std::string::String,
/// Required. Dataset ID of the table to delete
pub dataset_id: std::string::String,
/// Required. Table ID of the table to delete
pub table_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteTableRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::DeleteTableRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteTableRequest;
/// let x = DeleteTableRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::DeleteTableRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteTableRequest;
/// let x = DeleteTableRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::DeleteTableRequest::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DeleteTableRequest;
/// let x = DeleteTableRequest::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
}
impl wkt::message::Message for DeleteTableRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DeleteTableRequest"
}
}
/// Request format for enumerating tables.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTablesRequest {
/// Required. Project ID of the tables to list
pub project_id: std::string::String,
/// Required. Dataset ID of the tables to list
pub dataset_id: std::string::String,
/// The maximum number of results to return in a single response page.
/// Leverage the page tokens to iterate through the entire collection.
pub max_results: std::option::Option<wkt::UInt32Value>,
/// Page token, returned by a previous call, to request the next page of
/// results
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListTablesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::ListTablesRequest::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListTablesRequest;
/// let x = ListTablesRequest::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::ListTablesRequest::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListTablesRequest;
/// let x = ListTablesRequest::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [max_results][crate::model::ListTablesRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListTablesRequest;
/// use wkt::UInt32Value;
/// let x = ListTablesRequest::new().set_max_results(UInt32Value::default()/* use setters */);
/// ```
pub fn set_max_results<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_results][crate::model::ListTablesRequest::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListTablesRequest;
/// use wkt::UInt32Value;
/// let x = ListTablesRequest::new().set_or_clear_max_results(Some(UInt32Value::default()/* use setters */));
/// let x = ListTablesRequest::new().set_or_clear_max_results(None::<UInt32Value>);
/// ```
pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.max_results = v.map(|x| x.into());
self
}
/// Sets the value of [page_token][crate::model::ListTablesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListTablesRequest;
/// let x = ListTablesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListTablesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListTablesRequest"
}
}
/// Information about a logical view.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFormatView {
/// True if view is defined in legacy SQL dialect,
/// false if in GoogleSQL.
pub use_legacy_sql: std::option::Option<wkt::BoolValue>,
/// Specifies the privacy policy for the view.
pub privacy_policy: std::option::Option<crate::model::PrivacyPolicy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFormatView {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [use_legacy_sql][crate::model::ListFormatView::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatView;
/// use wkt::BoolValue;
/// let x = ListFormatView::new().set_use_legacy_sql(BoolValue::default()/* use setters */);
/// ```
pub fn set_use_legacy_sql<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [use_legacy_sql][crate::model::ListFormatView::use_legacy_sql].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatView;
/// use wkt::BoolValue;
/// let x = ListFormatView::new().set_or_clear_use_legacy_sql(Some(BoolValue::default()/* use setters */));
/// let x = ListFormatView::new().set_or_clear_use_legacy_sql(None::<BoolValue>);
/// ```
pub fn set_or_clear_use_legacy_sql<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.use_legacy_sql = v.map(|x| x.into());
self
}
/// Sets the value of [privacy_policy][crate::model::ListFormatView::privacy_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatView;
/// use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// let x = ListFormatView::new().set_privacy_policy(PrivacyPolicy::default()/* use setters */);
/// ```
pub fn set_privacy_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PrivacyPolicy>,
{
self.privacy_policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [privacy_policy][crate::model::ListFormatView::privacy_policy].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatView;
/// use google_cloud_bigquery_v2::model::PrivacyPolicy;
/// let x = ListFormatView::new().set_or_clear_privacy_policy(Some(PrivacyPolicy::default()/* use setters */));
/// let x = ListFormatView::new().set_or_clear_privacy_policy(None::<PrivacyPolicy>);
/// ```
pub fn set_or_clear_privacy_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PrivacyPolicy>,
{
self.privacy_policy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ListFormatView {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListFormatView"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFormatTable {
/// The resource type.
pub kind: std::string::String,
/// An opaque ID of the table.
pub id: std::string::String,
/// A reference uniquely identifying table.
pub table_reference: std::option::Option<crate::model::TableReference>,
/// The user-friendly name for this table.
pub friendly_name: std::option::Option<wkt::StringValue>,
/// The type of table.
pub r#type: std::string::String,
/// The time-based partitioning for this table.
pub time_partitioning: std::option::Option<crate::model::TimePartitioning>,
/// The range partitioning for this table.
pub range_partitioning: std::option::Option<crate::model::RangePartitioning>,
/// Clustering specification for this table, if configured.
pub clustering: std::option::Option<crate::model::Clustering>,
/// The labels associated with this table. You can use these to organize
/// and group your tables.
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
/// Additional details for a view.
pub view: std::option::Option<crate::model::ListFormatView>,
/// Output only. The time when this table was created, in milliseconds since
/// the epoch.
pub creation_time: i64,
/// The time when this table expires, in milliseconds since the
/// epoch. If not present, the table will persist indefinitely. Expired tables
/// will be deleted and their storage reclaimed.
pub expiration_time: i64,
/// Optional. If set to true, queries including this table must specify a
/// partition filter. This filter is used for partition elimination.
pub require_partition_filter: std::option::Option<wkt::BoolValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFormatTable {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::ListFormatTable::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [id][crate::model::ListFormatTable::id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_id("example");
/// ```
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
/// Sets the value of [table_reference][crate::model::ListFormatTable::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = ListFormatTable::new().set_table_reference(TableReference::default()/* use setters */);
/// ```
pub fn set_table_reference<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [table_reference][crate::model::ListFormatTable::table_reference].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = ListFormatTable::new().set_or_clear_table_reference(Some(TableReference::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_table_reference(None::<TableReference>);
/// ```
pub fn set_or_clear_table_reference<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.table_reference = v.map(|x| x.into());
self
}
/// Sets the value of [friendly_name][crate::model::ListFormatTable::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use wkt::StringValue;
/// let x = ListFormatTable::new().set_friendly_name(StringValue::default()/* use setters */);
/// ```
pub fn set_friendly_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [friendly_name][crate::model::ListFormatTable::friendly_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use wkt::StringValue;
/// let x = ListFormatTable::new().set_or_clear_friendly_name(Some(StringValue::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_friendly_name(None::<StringValue>);
/// ```
pub fn set_or_clear_friendly_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.friendly_name = v.map(|x| x.into());
self
}
/// Sets the value of [r#type][crate::model::ListFormatTable::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [time_partitioning][crate::model::ListFormatTable::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = ListFormatTable::new().set_time_partitioning(TimePartitioning::default()/* use setters */);
/// ```
pub fn set_time_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time_partitioning][crate::model::ListFormatTable::time_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = ListFormatTable::new().set_or_clear_time_partitioning(Some(TimePartitioning::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_time_partitioning(None::<TimePartitioning>);
/// ```
pub fn set_or_clear_time_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TimePartitioning>,
{
self.time_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [range_partitioning][crate::model::ListFormatTable::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = ListFormatTable::new().set_range_partitioning(RangePartitioning::default()/* use setters */);
/// ```
pub fn set_range_partitioning<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range_partitioning][crate::model::ListFormatTable::range_partitioning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::RangePartitioning;
/// let x = ListFormatTable::new().set_or_clear_range_partitioning(Some(RangePartitioning::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_range_partitioning(None::<RangePartitioning>);
/// ```
pub fn set_or_clear_range_partitioning<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangePartitioning>,
{
self.range_partitioning = v.map(|x| x.into());
self
}
/// Sets the value of [clustering][crate::model::ListFormatTable::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = ListFormatTable::new().set_clustering(Clustering::default()/* use setters */);
/// ```
pub fn set_clustering<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [clustering][crate::model::ListFormatTable::clustering].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::Clustering;
/// let x = ListFormatTable::new().set_or_clear_clustering(Some(Clustering::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_clustering(None::<Clustering>);
/// ```
pub fn set_or_clear_clustering<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Clustering>,
{
self.clustering = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::ListFormatTable::labels].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_labels([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [view][crate::model::ListFormatTable::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::ListFormatView;
/// let x = ListFormatTable::new().set_view(ListFormatView::default()/* use setters */);
/// ```
pub fn set_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ListFormatView>,
{
self.view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [view][crate::model::ListFormatTable::view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use google_cloud_bigquery_v2::model::ListFormatView;
/// let x = ListFormatTable::new().set_or_clear_view(Some(ListFormatView::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_view(None::<ListFormatView>);
/// ```
pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ListFormatView>,
{
self.view = v.map(|x| x.into());
self
}
/// Sets the value of [creation_time][crate::model::ListFormatTable::creation_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_creation_time(42);
/// ```
pub fn set_creation_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.creation_time = v.into();
self
}
/// Sets the value of [expiration_time][crate::model::ListFormatTable::expiration_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = ListFormatTable::new().set_expiration_time(42);
/// ```
pub fn set_expiration_time<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.expiration_time = v.into();
self
}
/// Sets the value of [require_partition_filter][crate::model::ListFormatTable::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use wkt::BoolValue;
/// let x = ListFormatTable::new().set_require_partition_filter(BoolValue::default()/* use setters */);
/// ```
pub fn set_require_partition_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [require_partition_filter][crate::model::ListFormatTable::require_partition_filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ListFormatTable;
/// use wkt::BoolValue;
/// let x = ListFormatTable::new().set_or_clear_require_partition_filter(Some(BoolValue::default()/* use setters */));
/// let x = ListFormatTable::new().set_or_clear_require_partition_filter(None::<BoolValue>);
/// ```
pub fn set_or_clear_require_partition_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::BoolValue>,
{
self.require_partition_filter = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ListFormatTable {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ListFormatTable"
}
}
/// Partial projection of the metadata for a given table in a list response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableList {
/// The type of list.
pub kind: std::string::String,
/// A hash of this page of results.
pub etag: std::string::String,
/// A token to request the next page of results.
pub next_page_token: std::string::String,
/// Tables in the requested dataset.
pub tables: std::vec::Vec<crate::model::ListFormatTable>,
/// The total number of tables in the dataset.
pub total_items: std::option::Option<wkt::Int32Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [kind][crate::model::TableList::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// let x = TableList::new().set_kind("example");
/// ```
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [etag][crate::model::TableList::etag].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// let x = TableList::new().set_etag("example");
/// ```
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [next_page_token][crate::model::TableList::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// let x = TableList::new().set_next_page_token("example");
/// ```
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
/// Sets the value of [tables][crate::model::TableList::tables].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// use google_cloud_bigquery_v2::model::ListFormatTable;
/// let x = TableList::new()
/// .set_tables([
/// ListFormatTable::default()/* use setters */,
/// ListFormatTable::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_tables<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ListFormatTable>,
{
use std::iter::Iterator;
self.tables = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [total_items][crate::model::TableList::total_items].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// use wkt::Int32Value;
/// let x = TableList::new().set_total_items(Int32Value::default()/* use setters */);
/// ```
pub fn set_total_items<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.total_items = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [total_items][crate::model::TableList::total_items].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableList;
/// use wkt::Int32Value;
/// let x = TableList::new().set_or_clear_total_items(Some(Int32Value::default()/* use setters */));
/// let x = TableList::new().set_or_clear_total_items(None::<Int32Value>);
/// ```
pub fn set_or_clear_total_items<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int32Value>,
{
self.total_items = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableList"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for TableList {
type PageItem = crate::model::ListFormatTable;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.tables
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Represents the primary key constraint on a table's columns.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrimaryKey {
/// Required. The columns that are composed of the primary key constraint.
pub columns: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PrimaryKey {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [columns][crate::model::PrimaryKey::columns].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::PrimaryKey;
/// let x = PrimaryKey::new().set_columns(["a", "b", "c"]);
/// ```
pub fn set_columns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.columns = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PrimaryKey {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.PrimaryKey"
}
}
/// The pair of the foreign key column and primary key column.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ColumnReference {
/// Required. The column that composes the foreign key.
pub referencing_column: std::string::String,
/// Required. The column in the primary key that are referenced by the
/// referencing_column.
pub referenced_column: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ColumnReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [referencing_column][crate::model::ColumnReference::referencing_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ColumnReference;
/// let x = ColumnReference::new().set_referencing_column("example");
/// ```
pub fn set_referencing_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.referencing_column = v.into();
self
}
/// Sets the value of [referenced_column][crate::model::ColumnReference::referenced_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ColumnReference;
/// let x = ColumnReference::new().set_referenced_column("example");
/// ```
pub fn set_referenced_column<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.referenced_column = v.into();
self
}
}
impl wkt::message::Message for ColumnReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ColumnReference"
}
}
/// Represents a foreign key constraint on a table's columns.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ForeignKey {
/// Optional. Set only if the foreign key constraint is named.
pub name: std::string::String,
/// Required. The table that holds the primary key and is referenced by this
/// foreign key.
pub referenced_table: std::option::Option<crate::model::TableReference>,
/// Required. The columns that compose the foreign key.
pub column_references: std::vec::Vec<crate::model::ColumnReference>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ForeignKey {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ForeignKey::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignKey;
/// let x = ForeignKey::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [referenced_table][crate::model::ForeignKey::referenced_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignKey;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = ForeignKey::new().set_referenced_table(TableReference::default()/* use setters */);
/// ```
pub fn set_referenced_table<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.referenced_table = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [referenced_table][crate::model::ForeignKey::referenced_table].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignKey;
/// use google_cloud_bigquery_v2::model::TableReference;
/// let x = ForeignKey::new().set_or_clear_referenced_table(Some(TableReference::default()/* use setters */));
/// let x = ForeignKey::new().set_or_clear_referenced_table(None::<TableReference>);
/// ```
pub fn set_or_clear_referenced_table<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TableReference>,
{
self.referenced_table = v.map(|x| x.into());
self
}
/// Sets the value of [column_references][crate::model::ForeignKey::column_references].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignKey;
/// use google_cloud_bigquery_v2::model::ColumnReference;
/// let x = ForeignKey::new()
/// .set_column_references([
/// ColumnReference::default()/* use setters */,
/// ColumnReference::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_column_references<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ColumnReference>,
{
use std::iter::Iterator;
self.column_references = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ForeignKey {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ForeignKey"
}
}
/// The TableConstraints defines the primary key and foreign key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableConstraints {
/// Optional. Represents a primary key constraint on a table's columns.
/// Present only if the table has a primary key.
/// The primary key is not enforced.
pub primary_key: std::option::Option<crate::model::PrimaryKey>,
/// Optional. Present only if the table has a foreign key.
/// The foreign key is not enforced.
pub foreign_keys: std::vec::Vec<crate::model::ForeignKey>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableConstraints {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [primary_key][crate::model::TableConstraints::primary_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableConstraints;
/// use google_cloud_bigquery_v2::model::PrimaryKey;
/// let x = TableConstraints::new().set_primary_key(PrimaryKey::default()/* use setters */);
/// ```
pub fn set_primary_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PrimaryKey>,
{
self.primary_key = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [primary_key][crate::model::TableConstraints::primary_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableConstraints;
/// use google_cloud_bigquery_v2::model::PrimaryKey;
/// let x = TableConstraints::new().set_or_clear_primary_key(Some(PrimaryKey::default()/* use setters */));
/// let x = TableConstraints::new().set_or_clear_primary_key(None::<PrimaryKey>);
/// ```
pub fn set_or_clear_primary_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PrimaryKey>,
{
self.primary_key = v.map(|x| x.into());
self
}
/// Sets the value of [foreign_keys][crate::model::TableConstraints::foreign_keys].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableConstraints;
/// use google_cloud_bigquery_v2::model::ForeignKey;
/// let x = TableConstraints::new()
/// .set_foreign_keys([
/// ForeignKey::default()/* use setters */,
/// ForeignKey::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_foreign_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ForeignKey>,
{
use std::iter::Iterator;
self.foreign_keys = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TableConstraints {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableConstraints"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableReference {
/// Required. The ID of the project containing this table.
pub project_id: std::string::String,
/// Required. The ID of the dataset containing this table.
pub dataset_id: std::string::String,
/// Required. The ID of the table. The ID can contain Unicode characters in
/// category L (letter), M (mark), N (number), Pc (connector, including
/// underscore), Pd (dash), and Zs (space). For more information, see [General
/// Category](https://wikipedia.org/wiki/Unicode_character_property#General_Category).
/// The maximum length is 1,024 characters. Certain operations allow suffixing
/// of the table ID with a partition decorator, such as
/// `sample_table$20190123`.
pub table_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_id][crate::model::TableReference::project_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableReference::new().set_project_id("example");
/// ```
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
/// Sets the value of [dataset_id][crate::model::TableReference::dataset_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableReference::new().set_dataset_id("example");
/// ```
pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset_id = v.into();
self
}
/// Sets the value of [table_id][crate::model::TableReference::table_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableReference;
/// let x = TableReference::new().set_table_id("example");
/// ```
pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.table_id = v.into();
self
}
}
impl wkt::message::Message for TableReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableReference"
}
}
/// Schema of a table
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableSchema {
/// Describes the fields in a table.
pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
/// Optional. Specifies metadata of the foreign data type definition in field
/// schema
/// ([TableFieldSchema.foreign_type_definition][google.cloud.bigquery.v2.TableFieldSchema.foreign_type_definition]).
///
/// [google.cloud.bigquery.v2.TableFieldSchema.foreign_type_definition]: crate::model::TableFieldSchema::foreign_type_definition
pub foreign_type_info: std::option::Option<crate::model::ForeignTypeInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableSchema {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [fields][crate::model::TableSchema::fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableSchema;
/// use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableSchema::new()
/// .set_fields([
/// TableFieldSchema::default()/* use setters */,
/// TableFieldSchema::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableFieldSchema>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [foreign_type_info][crate::model::TableSchema::foreign_type_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableSchema;
/// use google_cloud_bigquery_v2::model::ForeignTypeInfo;
/// let x = TableSchema::new().set_foreign_type_info(ForeignTypeInfo::default()/* use setters */);
/// ```
pub fn set_foreign_type_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ForeignTypeInfo>,
{
self.foreign_type_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [foreign_type_info][crate::model::TableSchema::foreign_type_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableSchema;
/// use google_cloud_bigquery_v2::model::ForeignTypeInfo;
/// let x = TableSchema::new().set_or_clear_foreign_type_info(Some(ForeignTypeInfo::default()/* use setters */));
/// let x = TableSchema::new().set_or_clear_foreign_type_info(None::<ForeignTypeInfo>);
/// ```
pub fn set_or_clear_foreign_type_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ForeignTypeInfo>,
{
self.foreign_type_info = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableSchema {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableSchema"
}
}
/// Metadata about the foreign data type definition such as the system
/// in which the type is defined.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ForeignTypeInfo {
/// Required. Specifies the system which defines the foreign data type.
pub type_system: crate::model::foreign_type_info::TypeSystem,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ForeignTypeInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [type_system][crate::model::ForeignTypeInfo::type_system].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::ForeignTypeInfo;
/// use google_cloud_bigquery_v2::model::foreign_type_info::TypeSystem;
/// let x0 = ForeignTypeInfo::new().set_type_system(TypeSystem::Hive);
/// ```
pub fn set_type_system<T: std::convert::Into<crate::model::foreign_type_info::TypeSystem>>(
mut self,
v: T,
) -> Self {
self.type_system = v.into();
self
}
}
impl wkt::message::Message for ForeignTypeInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.ForeignTypeInfo"
}
}
/// Defines additional types related to [ForeignTypeInfo].
pub mod foreign_type_info {
#[allow(unused_imports)]
use super::*;
/// External systems, such as query engines or table formats, that have their
/// own data types.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TypeSystem {
/// TypeSystem not specified.
Unspecified,
/// Represents Hive data types.
Hive,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TypeSystem::value] or
/// [TypeSystem::name].
UnknownValue(type_system::UnknownValue),
}
#[doc(hidden)]
pub mod type_system {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TypeSystem {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Hive => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_SYSTEM_UNSPECIFIED"),
Self::Hive => std::option::Option::Some("HIVE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TypeSystem {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TypeSystem {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TypeSystem {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Hive,
_ => Self::UnknownValue(type_system::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TypeSystem {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_SYSTEM_UNSPECIFIED" => Self::Unspecified,
"HIVE" => Self::Hive,
_ => Self::UnknownValue(type_system::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TypeSystem {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Hive => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TypeSystem {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TypeSystem>::new(
".google.cloud.bigquery.v2.ForeignTypeInfo.TypeSystem",
))
}
}
}
/// Data policy option. For more information, see
/// [Mask data by applying data policies to a
/// column](https://docs.cloud.google.com/bigquery/docs/column-data-masking#data-policies-on-column).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataPolicyOption {
/// Data policy resource name in the form of
/// projects/project_id/locations/location_id/dataPolicies/data_policy_id.
pub name: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataPolicyOption {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DataPolicyOption::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataPolicyOption;
/// let x = DataPolicyOption::new().set_name("example");
/// ```
pub fn set_name<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.name = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [name][crate::model::DataPolicyOption::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataPolicyOption;
/// let x = DataPolicyOption::new().set_or_clear_name(Some("example"));
/// let x = DataPolicyOption::new().set_or_clear_name(None::<String>);
/// ```
pub fn set_or_clear_name<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.name = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DataPolicyOption {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DataPolicyOption"
}
}
/// A list of data policy options. For more information, see
/// [Mask data by applying data policies to a
/// column](https://docs.cloud.google.com/bigquery/docs/column-data-masking#data-policies-on-column).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataPolicyList {
/// Contains a list of data policy options. At most 9 data policies are
/// allowed per field.
pub data_policies: std::vec::Vec<crate::model::DataPolicyOption>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataPolicyList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [data_policies][crate::model::DataPolicyList::data_policies].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::DataPolicyList;
/// use google_cloud_bigquery_v2::model::DataPolicyOption;
/// let x = DataPolicyList::new()
/// .set_data_policies([
/// DataPolicyOption::default()/* use setters */,
/// DataPolicyOption::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_data_policies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::DataPolicyOption>,
{
use std::iter::Iterator;
self.data_policies = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DataPolicyList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.DataPolicyList"
}
}
/// A field in TableSchema
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableFieldSchema {
/// Required. The field name. The name must contain only letters (a-z, A-Z),
/// numbers (0-9), or underscores (_), and must start with a letter or
/// underscore. The maximum length is 300 characters.
pub name: std::string::String,
/// Required. The field data type. Possible values include:
///
/// * STRING
/// * BYTES
/// * INTEGER (or INT64)
/// * FLOAT (or FLOAT64)
/// * BOOLEAN (or BOOL)
/// * TIMESTAMP
/// * DATE
/// * TIME
/// * DATETIME
/// * GEOGRAPHY
/// * NUMERIC
/// * BIGNUMERIC
/// * JSON
/// * RECORD (or STRUCT)
/// * RANGE
///
/// Use of RECORD/STRUCT indicates that the field contains a nested schema.
pub r#type: std::string::String,
/// Optional. The field mode. Possible values include NULLABLE, REQUIRED and
/// REPEATED. The default value is NULLABLE.
pub mode: std::string::String,
/// Optional. Describes the nested schema fields if the type property is set
/// to RECORD.
pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
/// Optional. The field description. The maximum length is 1,024 characters.
pub description: std::option::Option<wkt::StringValue>,
/// Optional. The policy tags attached to this field, used for field-level
/// access control. If not set, defaults to empty policy_tags.
pub policy_tags: std::option::Option<crate::model::table_field_schema::PolicyTagList>,
/// Optional. Specifies the data governance tags on this field. This field
/// works with other column-level security fields as follows:
///
/// * **Precedence**: If a data governance tag is attached to a column, it
/// takes precedence over the policy tag attached to the column. However,
/// if a data policy is attached to a column, it takes precedence over the
/// data governance tag.
/// * **Patching behavior**: Describes how this field behaves during a
/// `Table.patch` schema update:
/// * **Unset**: If the `data_governance_tags_info` field is omitted from
/// the update request, the existing tags on the column are preserved.
/// * **Empty Field**: To clear data governance tags from a column, send
/// the `data_governance_tags_info` field as an empty object. This
/// removes all tags from the column.
/// * **Updating tags**: To replace an existing tag, send the field with
/// the new tag.
pub data_governance_tags_info:
std::option::Option<crate::model::table_field_schema::DataGovernanceTagsInfo>,
/// Optional. Data policies attached to this field, used for field-level access
/// control.
pub data_policies: std::vec::Vec<crate::model::DataPolicyOption>,
/// Optional. Specifies data policies attached to this field, used for
/// field-level access control. When set, this will be the source of truth for
/// data policy information.
pub data_policy_list: std::option::Option<crate::model::DataPolicyList>,
/// Optional. Maximum length of values of this field for STRINGS or BYTES.
///
/// If max_length is not specified, no maximum length constraint is imposed
/// on this field.
///
/// If type = "STRING", then max_length represents the maximum UTF-8
/// length of strings in this field.
///
/// If type = "BYTES", then max_length represents the maximum number of
/// bytes in this field.
///
/// It is invalid to set this field if type ≠ "STRING" and ≠ "BYTES".
pub max_length: i64,
/// Optional. Precision (maximum number of total digits in base 10) and scale
/// (maximum number of digits in the fractional part in base 10) constraints
/// for values of this field for NUMERIC or BIGNUMERIC.
///
/// It is invalid to set precision or scale if type ≠ "NUMERIC" and ≠
/// "BIGNUMERIC".
///
/// If precision and scale are not specified, no value range constraint is
/// imposed on this field insofar as values are permitted by the type.
///
/// Values of this NUMERIC or BIGNUMERIC field must be in this range when:
///
/// * Precision (\<var\>P\</var\>) and scale (\<var\>S\</var\>) are specified:
/// [-10\<sup\>\<var\>P\</var\>-\<var\>S\</var\>\</sup\> + 10\<sup\>-\<var\>S\</var\>\</sup\>,
/// 10\<sup\>\<var\>P\</var\>-\<var\>S\</var\>\</sup\> - 10\<sup\>-\<var\>S\</var\>\</sup\>]
/// * Precision (\<var\>P\</var\>) is specified but not scale (and thus scale is
/// interpreted to be equal to zero):
/// [-10\<sup\>\<var\>P\</var\>\</sup\> + 1, 10\<sup\>\<var\>P\</var\>\</sup\> - 1].
///
/// Acceptable values for precision and scale if both are specified:
///
/// * If type = "NUMERIC":
/// 1 ≤ precision - scale ≤ 29 and 0 ≤ scale ≤ 9.
/// * If type = "BIGNUMERIC":
/// 1 ≤ precision - scale ≤ 38 and 0 ≤ scale ≤ 38.
///
/// Acceptable values for precision if only precision is specified but not
/// scale (and thus scale is interpreted to be equal to zero):
///
/// * If type = "NUMERIC": 1 ≤ precision ≤ 29.
/// * If type = "BIGNUMERIC": 1 ≤ precision ≤ 38.
///
/// If scale is specified but not precision, then it is invalid.
pub precision: i64,
/// Optional. See documentation for precision.
pub scale: i64,
/// Optional. Precision (maximum number of total digits in base 10) for seconds
/// of TIMESTAMP type.
///
/// Possible values include:
///
/// * 6 (Default, for TIMESTAMP type with microsecond precision)
/// * 12 (For TIMESTAMP type with picosecond precision)
pub timestamp_precision: std::option::Option<wkt::Int64Value>,
/// Optional. Specifies the rounding mode to be used when storing values of
/// NUMERIC and BIGNUMERIC type.
pub rounding_mode: crate::model::table_field_schema::RoundingMode,
/// Optional. Field collation can be set only when the type of field is STRING.
/// The following values are supported:
///
/// * 'und:ci': undetermined locale, case insensitive.
/// * '': empty string. Default to case-sensitive behavior.
pub collation: std::option::Option<wkt::StringValue>,
/// Optional. A SQL expression to specify the [default value]
/// (<https://cloud.google.com/bigquery/docs/default-values>) for this field.
pub default_value_expression: std::option::Option<wkt::StringValue>,
/// Optional. The subtype of the RANGE, if the type of this field is RANGE. If
/// the type is RANGE, this field is required. Values for the field element
/// type can be the following:
///
/// * DATE
/// * DATETIME
/// * TIMESTAMP
pub range_element_type: std::option::Option<crate::model::table_field_schema::FieldElementType>,
/// Optional. Definition of the foreign data type.
/// Only valid for top-level schema fields (not nested fields).
/// If the type is FOREIGN, this field is required.
pub foreign_type_definition: std::string::String,
/// Optional. Definition of how values are generated for the field.
/// Only valid for top-level schema fields (not nested fields).
pub generated_column: std::option::Option<crate::model::table_field_schema::GeneratedColumn>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TableFieldSchema {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::TableFieldSchema::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [r#type][crate::model::TableFieldSchema::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [mode][crate::model::TableFieldSchema::mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_mode("example");
/// ```
pub fn set_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mode = v.into();
self
}
/// Sets the value of [fields][crate::model::TableFieldSchema::fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new()
/// .set_fields([
/// TableFieldSchema::default()/* use setters */,
/// TableFieldSchema::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TableFieldSchema>,
{
use std::iter::Iterator;
self.fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [description][crate::model::TableFieldSchema::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_description(StringValue::default()/* use setters */);
/// ```
pub fn set_description<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [description][crate::model::TableFieldSchema::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_or_clear_description(Some(StringValue::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_description(None::<StringValue>);
/// ```
pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.description = v.map(|x| x.into());
self
}
/// Sets the value of [policy_tags][crate::model::TableFieldSchema::policy_tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::PolicyTagList;
/// let x = TableFieldSchema::new().set_policy_tags(PolicyTagList::default()/* use setters */);
/// ```
pub fn set_policy_tags<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::PolicyTagList>,
{
self.policy_tags = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy_tags][crate::model::TableFieldSchema::policy_tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::PolicyTagList;
/// let x = TableFieldSchema::new().set_or_clear_policy_tags(Some(PolicyTagList::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_policy_tags(None::<PolicyTagList>);
/// ```
pub fn set_or_clear_policy_tags<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::PolicyTagList>,
{
self.policy_tags = v.map(|x| x.into());
self
}
/// Sets the value of [data_governance_tags_info][crate::model::TableFieldSchema::data_governance_tags_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::DataGovernanceTagsInfo;
/// let x = TableFieldSchema::new().set_data_governance_tags_info(DataGovernanceTagsInfo::default()/* use setters */);
/// ```
pub fn set_data_governance_tags_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::DataGovernanceTagsInfo>,
{
self.data_governance_tags_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_governance_tags_info][crate::model::TableFieldSchema::data_governance_tags_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::DataGovernanceTagsInfo;
/// let x = TableFieldSchema::new().set_or_clear_data_governance_tags_info(Some(DataGovernanceTagsInfo::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_data_governance_tags_info(None::<DataGovernanceTagsInfo>);
/// ```
pub fn set_or_clear_data_governance_tags_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::DataGovernanceTagsInfo>,
{
self.data_governance_tags_info = v.map(|x| x.into());
self
}
/// Sets the value of [data_policies][crate::model::TableFieldSchema::data_policies].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::DataPolicyOption;
/// let x = TableFieldSchema::new()
/// .set_data_policies([
/// DataPolicyOption::default()/* use setters */,
/// DataPolicyOption::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_data_policies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::DataPolicyOption>,
{
use std::iter::Iterator;
self.data_policies = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [data_policy_list][crate::model::TableFieldSchema::data_policy_list].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::DataPolicyList;
/// let x = TableFieldSchema::new().set_data_policy_list(DataPolicyList::default()/* use setters */);
/// ```
pub fn set_data_policy_list<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataPolicyList>,
{
self.data_policy_list = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_policy_list][crate::model::TableFieldSchema::data_policy_list].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::DataPolicyList;
/// let x = TableFieldSchema::new().set_or_clear_data_policy_list(Some(DataPolicyList::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_data_policy_list(None::<DataPolicyList>);
/// ```
pub fn set_or_clear_data_policy_list<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataPolicyList>,
{
self.data_policy_list = v.map(|x| x.into());
self
}
/// Sets the value of [max_length][crate::model::TableFieldSchema::max_length].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_max_length(42);
/// ```
pub fn set_max_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.max_length = v.into();
self
}
/// Sets the value of [precision][crate::model::TableFieldSchema::precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_precision(42);
/// ```
pub fn set_precision<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.precision = v.into();
self
}
/// Sets the value of [scale][crate::model::TableFieldSchema::scale].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_scale(42);
/// ```
pub fn set_scale<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.scale = v.into();
self
}
/// Sets the value of [timestamp_precision][crate::model::TableFieldSchema::timestamp_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::Int64Value;
/// let x = TableFieldSchema::new().set_timestamp_precision(Int64Value::default()/* use setters */);
/// ```
pub fn set_timestamp_precision<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.timestamp_precision = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timestamp_precision][crate::model::TableFieldSchema::timestamp_precision].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::Int64Value;
/// let x = TableFieldSchema::new().set_or_clear_timestamp_precision(Some(Int64Value::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_timestamp_precision(None::<Int64Value>);
/// ```
pub fn set_or_clear_timestamp_precision<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.timestamp_precision = v.map(|x| x.into());
self
}
/// Sets the value of [rounding_mode][crate::model::TableFieldSchema::rounding_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::RoundingMode;
/// let x0 = TableFieldSchema::new().set_rounding_mode(RoundingMode::RoundHalfAwayFromZero);
/// let x1 = TableFieldSchema::new().set_rounding_mode(RoundingMode::RoundHalfEven);
/// ```
pub fn set_rounding_mode<
T: std::convert::Into<crate::model::table_field_schema::RoundingMode>,
>(
mut self,
v: T,
) -> Self {
self.rounding_mode = v.into();
self
}
/// Sets the value of [collation][crate::model::TableFieldSchema::collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_collation(StringValue::default()/* use setters */);
/// ```
pub fn set_collation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.collation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [collation][crate::model::TableFieldSchema::collation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_or_clear_collation(Some(StringValue::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_collation(None::<StringValue>);
/// ```
pub fn set_or_clear_collation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.collation = v.map(|x| x.into());
self
}
/// Sets the value of [default_value_expression][crate::model::TableFieldSchema::default_value_expression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_default_value_expression(StringValue::default()/* use setters */);
/// ```
pub fn set_default_value_expression<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_value_expression = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [default_value_expression][crate::model::TableFieldSchema::default_value_expression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use wkt::StringValue;
/// let x = TableFieldSchema::new().set_or_clear_default_value_expression(Some(StringValue::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_default_value_expression(None::<StringValue>);
/// ```
pub fn set_or_clear_default_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.default_value_expression = v.map(|x| x.into());
self
}
/// Sets the value of [range_element_type][crate::model::TableFieldSchema::range_element_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::FieldElementType;
/// let x = TableFieldSchema::new().set_range_element_type(FieldElementType::default()/* use setters */);
/// ```
pub fn set_range_element_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::FieldElementType>,
{
self.range_element_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [range_element_type][crate::model::TableFieldSchema::range_element_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::FieldElementType;
/// let x = TableFieldSchema::new().set_or_clear_range_element_type(Some(FieldElementType::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_range_element_type(None::<FieldElementType>);
/// ```
pub fn set_or_clear_range_element_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::FieldElementType>,
{
self.range_element_type = v.map(|x| x.into());
self
}
/// Sets the value of [foreign_type_definition][crate::model::TableFieldSchema::foreign_type_definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// let x = TableFieldSchema::new().set_foreign_type_definition("example");
/// ```
pub fn set_foreign_type_definition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.foreign_type_definition = v.into();
self
}
/// Sets the value of [generated_column][crate::model::TableFieldSchema::generated_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// let x = TableFieldSchema::new().set_generated_column(GeneratedColumn::default()/* use setters */);
/// ```
pub fn set_generated_column<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::GeneratedColumn>,
{
self.generated_column = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generated_column][crate::model::TableFieldSchema::generated_column].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TableFieldSchema;
/// use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// let x = TableFieldSchema::new().set_or_clear_generated_column(Some(GeneratedColumn::default()/* use setters */));
/// let x = TableFieldSchema::new().set_or_clear_generated_column(None::<GeneratedColumn>);
/// ```
pub fn set_or_clear_generated_column<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::table_field_schema::GeneratedColumn>,
{
self.generated_column = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TableFieldSchema {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema"
}
}
/// Defines additional types related to [TableFieldSchema].
pub mod table_field_schema {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PolicyTagList {
/// A list of policy tag resource names. For example,
/// "projects/1/locations/eu/taxonomies/2/policyTags/3". At most 1 policy tag
/// is currently allowed.
pub names: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PolicyTagList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [names][crate::model::table_field_schema::PolicyTagList::names].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::PolicyTagList;
/// let x = PolicyTagList::new().set_names(["a", "b", "c"]);
/// ```
pub fn set_names<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.names = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PolicyTagList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema.PolicyTagList"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataGovernanceTagsInfo {
/// Optional. The data governance tags added to this field are used for
/// field-level access control. Only one data governance tag is currently
/// supported on a field. Tag keys are globally unique. Tag key is expected
/// to be in the namespaced format, for example "parent-id/pii" where
/// parent-id is the ID of the parent organization or project resource for
/// this tag key. Tag value is expected to be the short name, for example
/// "sensitive". See [Tag
/// definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions)
/// for more details. For example:
/// "parent-id/pii": "sensitive",
/// "myProject/cost_center": "sales"
pub data_governance_tags:
std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataGovernanceTagsInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [data_governance_tags][crate::model::table_field_schema::DataGovernanceTagsInfo::data_governance_tags].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::DataGovernanceTagsInfo;
/// let x = DataGovernanceTagsInfo::new().set_data_governance_tags([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_data_governance_tags<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.data_governance_tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for DataGovernanceTagsInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema.DataGovernanceTagsInfo"
}
}
/// Represents the type of a field element.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FieldElementType {
/// Required. The type of a field element. For more information, see
/// [TableFieldSchema.type][google.cloud.bigquery.v2.TableFieldSchema.type].
///
/// [google.cloud.bigquery.v2.TableFieldSchema.type]: crate::model::TableFieldSchema::type
pub r#type: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FieldElementType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::table_field_schema::FieldElementType::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::FieldElementType;
/// let x = FieldElementType::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
}
impl wkt::message::Message for FieldElementType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema.FieldElementType"
}
}
/// Definition of the expression used to generate the field.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratedExpressionInfo {
/// Optional. The generation expression (e.g. AI.EMBED(...)) used to generate
/// the field.
pub generation_expression: std::option::Option<std::string::String>,
/// Optional. Whether the column generation is done asynchronously.
pub asynchronous: std::option::Option<bool>,
/// Optional. Whether the generated column is stored in the table.
pub stored: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GeneratedExpressionInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generation_expression][crate::model::table_field_schema::GeneratedExpressionInfo::generation_expression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_generation_expression("example");
/// ```
pub fn set_generation_expression<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.generation_expression = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generation_expression][crate::model::table_field_schema::GeneratedExpressionInfo::generation_expression].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_or_clear_generation_expression(Some("example"));
/// let x = GeneratedExpressionInfo::new().set_or_clear_generation_expression(None::<String>);
/// ```
pub fn set_or_clear_generation_expression<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.generation_expression = v.map(|x| x.into());
self
}
/// Sets the value of [asynchronous][crate::model::table_field_schema::GeneratedExpressionInfo::asynchronous].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_asynchronous(true);
/// ```
pub fn set_asynchronous<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.asynchronous = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [asynchronous][crate::model::table_field_schema::GeneratedExpressionInfo::asynchronous].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_or_clear_asynchronous(Some(false));
/// let x = GeneratedExpressionInfo::new().set_or_clear_asynchronous(None::<bool>);
/// ```
pub fn set_or_clear_asynchronous<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.asynchronous = v.map(|x| x.into());
self
}
/// Sets the value of [stored][crate::model::table_field_schema::GeneratedExpressionInfo::stored].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_stored(true);
/// ```
pub fn set_stored<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.stored = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [stored][crate::model::table_field_schema::GeneratedExpressionInfo::stored].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedExpressionInfo::new().set_or_clear_stored(Some(false));
/// let x = GeneratedExpressionInfo::new().set_or_clear_stored(None::<bool>);
/// ```
pub fn set_or_clear_stored<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.stored = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GeneratedExpressionInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema.GeneratedExpressionInfo"
}
}
/// Optional. Definition of how values are generated for the field.
/// Only valid for top-level schema fields (not nested fields).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratedColumn {
/// Optional. Dictates when system generated values are used to populate the
/// field.
pub generated_mode:
std::option::Option<crate::model::table_field_schema::generated_column::GeneratedMode>,
/// Captures the metadata for the generated column.
pub definition:
std::option::Option<crate::model::table_field_schema::generated_column::Definition>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GeneratedColumn {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generated_mode][crate::model::table_field_schema::GeneratedColumn::generated_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// use google_cloud_bigquery_v2::model::table_field_schema::generated_column::GeneratedMode;
/// let x0 = GeneratedColumn::new().set_generated_mode(GeneratedMode::GeneratedAlways);
/// let x1 = GeneratedColumn::new().set_generated_mode(GeneratedMode::GeneratedByDefault);
/// ```
pub fn set_generated_mode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::table_field_schema::generated_column::GeneratedMode,
>,
{
self.generated_mode = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generated_mode][crate::model::table_field_schema::GeneratedColumn::generated_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// use google_cloud_bigquery_v2::model::table_field_schema::generated_column::GeneratedMode;
/// let x0 = GeneratedColumn::new().set_or_clear_generated_mode(Some(GeneratedMode::GeneratedAlways));
/// let x1 = GeneratedColumn::new().set_or_clear_generated_mode(Some(GeneratedMode::GeneratedByDefault));
/// let x_none = GeneratedColumn::new().set_or_clear_generated_mode(None::<GeneratedMode>);
/// ```
pub fn set_or_clear_generated_mode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::table_field_schema::generated_column::GeneratedMode,
>,
{
self.generated_mode = v.map(|x| x.into());
self
}
/// Sets the value of [definition][crate::model::table_field_schema::GeneratedColumn::definition].
///
/// Note that all the setters affecting `definition` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedColumn::new().set_definition(Some(
/// google_cloud_bigquery_v2::model::table_field_schema::generated_column::Definition::GeneratedExpressionInfo(GeneratedExpressionInfo::default().into())));
/// ```
pub fn set_definition<
T: std::convert::Into<
std::option::Option<
crate::model::table_field_schema::generated_column::Definition,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.definition = v.into();
self
}
/// The value of [definition][crate::model::table_field_schema::GeneratedColumn::definition]
/// if it holds a `GeneratedExpressionInfo`, `None` if the field is not set or
/// holds a different branch.
pub fn generated_expression_info(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::table_field_schema::GeneratedExpressionInfo>,
> {
#[allow(unreachable_patterns)]
self.definition.as_ref().and_then(|v| match v {
crate::model::table_field_schema::generated_column::Definition::GeneratedExpressionInfo(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [definition][crate::model::table_field_schema::GeneratedColumn::definition]
/// to hold a `GeneratedExpressionInfo`.
///
/// Note that all the setters affecting `definition` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::table_field_schema::GeneratedColumn;
/// use google_cloud_bigquery_v2::model::table_field_schema::GeneratedExpressionInfo;
/// let x = GeneratedColumn::new().set_generated_expression_info(GeneratedExpressionInfo::default()/* use setters */);
/// assert!(x.generated_expression_info().is_some());
/// ```
pub fn set_generated_expression_info<
T: std::convert::Into<
std::boxed::Box<crate::model::table_field_schema::GeneratedExpressionInfo>,
>,
>(
mut self,
v: T,
) -> Self {
self.definition = std::option::Option::Some(
crate::model::table_field_schema::generated_column::Definition::GeneratedExpressionInfo(
v.into()
)
);
self
}
}
impl wkt::message::Message for GeneratedColumn {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TableFieldSchema.GeneratedColumn"
}
}
/// Defines additional types related to [GeneratedColumn].
pub mod generated_column {
#[allow(unused_imports)]
use super::*;
/// Dictates when system generated values are used to populate the field.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum GeneratedMode {
/// Unspecified GeneratedMode will default to GENERATED_ALWAYS.
Unspecified,
/// Field can only have system generated values. Users cannot manually
/// insert values into the field.
GeneratedAlways,
/// Use system generated values only if the user does not explicitly
/// provide a value.
GeneratedByDefault,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [GeneratedMode::value] or
/// [GeneratedMode::name].
UnknownValue(generated_mode::UnknownValue),
}
#[doc(hidden)]
pub mod generated_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl GeneratedMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::GeneratedAlways => std::option::Option::Some(1),
Self::GeneratedByDefault => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("GENERATED_MODE_UNSPECIFIED"),
Self::GeneratedAlways => std::option::Option::Some("GENERATED_ALWAYS"),
Self::GeneratedByDefault => std::option::Option::Some("GENERATED_BY_DEFAULT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for GeneratedMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for GeneratedMode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for GeneratedMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::GeneratedAlways,
2 => Self::GeneratedByDefault,
_ => Self::UnknownValue(generated_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for GeneratedMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"GENERATED_MODE_UNSPECIFIED" => Self::Unspecified,
"GENERATED_ALWAYS" => Self::GeneratedAlways,
"GENERATED_BY_DEFAULT" => Self::GeneratedByDefault,
_ => Self::UnknownValue(generated_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for GeneratedMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::GeneratedAlways => serializer.serialize_i32(1),
Self::GeneratedByDefault => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for GeneratedMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<GeneratedMode>::new(
".google.cloud.bigquery.v2.TableFieldSchema.GeneratedColumn.GeneratedMode",
))
}
}
/// Captures the metadata for the generated column.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Definition {
/// Definition of the expression used to generate the field.
GeneratedExpressionInfo(
std::boxed::Box<crate::model::table_field_schema::GeneratedExpressionInfo>,
),
}
}
/// Rounding mode options that can be used when storing NUMERIC
/// or BIGNUMERIC values.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RoundingMode {
/// Unspecified will default to using ROUND_HALF_AWAY_FROM_ZERO.
Unspecified,
/// ROUND_HALF_AWAY_FROM_ZERO rounds half values away from zero
/// when applying precision and scale upon writing of NUMERIC and BIGNUMERIC
/// values.
/// For Scale: 0
/// 1.1, 1.2, 1.3, 1.4 => 1
/// 1.5, 1.6, 1.7, 1.8, 1.9 => 2
RoundHalfAwayFromZero,
/// ROUND_HALF_EVEN rounds half values to the nearest even value
/// when applying precision and scale upon writing of NUMERIC and BIGNUMERIC
/// values.
/// For Scale: 0
/// 1.1, 1.2, 1.3, 1.4 => 1
/// 1.5 => 2
/// 1.6, 1.7, 1.8, 1.9 => 2
/// 2.5 => 2
RoundHalfEven,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RoundingMode::value] or
/// [RoundingMode::name].
UnknownValue(rounding_mode::UnknownValue),
}
#[doc(hidden)]
pub mod rounding_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RoundingMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RoundHalfAwayFromZero => std::option::Option::Some(1),
Self::RoundHalfEven => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ROUNDING_MODE_UNSPECIFIED"),
Self::RoundHalfAwayFromZero => {
std::option::Option::Some("ROUND_HALF_AWAY_FROM_ZERO")
}
Self::RoundHalfEven => std::option::Option::Some("ROUND_HALF_EVEN"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RoundingMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RoundingMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RoundingMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::RoundHalfAwayFromZero,
2 => Self::RoundHalfEven,
_ => Self::UnknownValue(rounding_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RoundingMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ROUNDING_MODE_UNSPECIFIED" => Self::Unspecified,
"ROUND_HALF_AWAY_FROM_ZERO" => Self::RoundHalfAwayFromZero,
"ROUND_HALF_EVEN" => Self::RoundHalfEven,
_ => Self::UnknownValue(rounding_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RoundingMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RoundHalfAwayFromZero => serializer.serialize_i32(1),
Self::RoundHalfEven => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RoundingMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoundingMode>::new(
".google.cloud.bigquery.v2.TableFieldSchema.RoundingMode",
))
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TimePartitioning {
/// Required. The supported types are DAY, HOUR, MONTH, and YEAR, which will
/// generate one partition per day, hour, month, and year, respectively.
pub r#type: std::string::String,
/// Optional. Number of milliseconds for which to keep the storage for a
/// partition.
/// A wrapper is used here because 0 is an invalid value.
pub expiration_ms: std::option::Option<wkt::Int64Value>,
/// Optional. If not set, the table is partitioned by pseudo
/// column '_PARTITIONTIME'; if set, the table is partitioned by this field.
/// The field must be a top-level TIMESTAMP or DATE field. Its mode must be
/// NULLABLE or REQUIRED.
/// A wrapper is used here because an empty string is an invalid value.
pub field: std::option::Option<wkt::StringValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TimePartitioning {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::TimePartitioning::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TimePartitioning;
/// let x = TimePartitioning::new().set_type("example");
/// ```
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [expiration_ms][crate::model::TimePartitioning::expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TimePartitioning;
/// use wkt::Int64Value;
/// let x = TimePartitioning::new().set_expiration_ms(Int64Value::default()/* use setters */);
/// ```
pub fn set_expiration_ms<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.expiration_ms = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [expiration_ms][crate::model::TimePartitioning::expiration_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TimePartitioning;
/// use wkt::Int64Value;
/// let x = TimePartitioning::new().set_or_clear_expiration_ms(Some(Int64Value::default()/* use setters */));
/// let x = TimePartitioning::new().set_or_clear_expiration_ms(None::<Int64Value>);
/// ```
pub fn set_or_clear_expiration_ms<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Int64Value>,
{
self.expiration_ms = v.map(|x| x.into());
self
}
/// Sets the value of [field][crate::model::TimePartitioning::field].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TimePartitioning;
/// use wkt::StringValue;
/// let x = TimePartitioning::new().set_field(StringValue::default()/* use setters */);
/// ```
pub fn set_field<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.field = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [field][crate::model::TimePartitioning::field].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::TimePartitioning;
/// use wkt::StringValue;
/// let x = TimePartitioning::new().set_or_clear_field(Some(StringValue::default()/* use setters */));
/// let x = TimePartitioning::new().set_or_clear_field(None::<StringValue>);
/// ```
pub fn set_or_clear_field<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.field = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for TimePartitioning {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.TimePartitioning"
}
}
/// This is used for defining User Defined Function (UDF) resources only when
/// using legacy SQL. Users of GoogleSQL should leverage either DDL (e.g.
/// CREATE [TEMPORARY] FUNCTION ... ) or the Routines API to define UDF
/// resources.
///
/// For additional information on migrating, see:
/// <https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions>
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserDefinedFunctionResource {
/// [Pick one] A code resource to load from a Google Cloud Storage URI
/// (gs://bucket/path).
pub resource_uri: std::option::Option<wkt::StringValue>,
/// [Pick one] An inline resource that contains code for a user-defined
/// function (UDF). Providing a inline code resource is equivalent to providing
/// a URI for a file containing the same code.
pub inline_code: std::option::Option<wkt::StringValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserDefinedFunctionResource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [resource_uri][crate::model::UserDefinedFunctionResource::resource_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// use wkt::StringValue;
/// let x = UserDefinedFunctionResource::new().set_resource_uri(StringValue::default()/* use setters */);
/// ```
pub fn set_resource_uri<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.resource_uri = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [resource_uri][crate::model::UserDefinedFunctionResource::resource_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// use wkt::StringValue;
/// let x = UserDefinedFunctionResource::new().set_or_clear_resource_uri(Some(StringValue::default()/* use setters */));
/// let x = UserDefinedFunctionResource::new().set_or_clear_resource_uri(None::<StringValue>);
/// ```
pub fn set_or_clear_resource_uri<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.resource_uri = v.map(|x| x.into());
self
}
/// Sets the value of [inline_code][crate::model::UserDefinedFunctionResource::inline_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// use wkt::StringValue;
/// let x = UserDefinedFunctionResource::new().set_inline_code(StringValue::default()/* use setters */);
/// ```
pub fn set_inline_code<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.inline_code = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [inline_code][crate::model::UserDefinedFunctionResource::inline_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_bigquery_v2::model::UserDefinedFunctionResource;
/// use wkt::StringValue;
/// let x = UserDefinedFunctionResource::new().set_or_clear_inline_code(Some(StringValue::default()/* use setters */));
/// let x = UserDefinedFunctionResource::new().set_or_clear_inline_code(None::<StringValue>);
/// ```
pub fn set_or_clear_inline_code<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::StringValue>,
{
self.inline_code = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UserDefinedFunctionResource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.bigquery.v2.UserDefinedFunctionResource"
}
}
/// The data types that could be used as a target type when converting decimal
/// values.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DecimalTargetType {
/// Invalid type.
Unspecified,
/// Decimal values could be converted to NUMERIC
/// type.
Numeric,
/// Decimal values could be converted to BIGNUMERIC
/// type.
Bignumeric,
/// Decimal values could be converted to STRING type.
String,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DecimalTargetType::value] or
/// [DecimalTargetType::name].
UnknownValue(decimal_target_type::UnknownValue),
}
#[doc(hidden)]
pub mod decimal_target_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DecimalTargetType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Numeric => std::option::Option::Some(1),
Self::Bignumeric => std::option::Option::Some(2),
Self::String => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DECIMAL_TARGET_TYPE_UNSPECIFIED"),
Self::Numeric => std::option::Option::Some("NUMERIC"),
Self::Bignumeric => std::option::Option::Some("BIGNUMERIC"),
Self::String => std::option::Option::Some("STRING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DecimalTargetType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DecimalTargetType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DecimalTargetType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Numeric,
2 => Self::Bignumeric,
3 => Self::String,
_ => Self::UnknownValue(decimal_target_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DecimalTargetType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DECIMAL_TARGET_TYPE_UNSPECIFIED" => Self::Unspecified,
"NUMERIC" => Self::Numeric,
"BIGNUMERIC" => Self::Bignumeric,
"STRING" => Self::String,
_ => Self::UnknownValue(decimal_target_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DecimalTargetType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Numeric => serializer.serialize_i32(1),
Self::Bignumeric => serializer.serialize_i32(2),
Self::String => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DecimalTargetType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DecimalTargetType>::new(
".google.cloud.bigquery.v2.DecimalTargetType",
))
}
}
/// This enum defines how to interpret source URIs for load jobs and external
/// tables.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FileSetSpecType {
/// This option expands source URIs by listing files from the object store. It
/// is the default behavior if FileSetSpecType is not set.
FileSystemMatch,
/// This option indicates that the provided URIs are newline-delimited manifest
/// files, with one URI per line. Wildcard URIs are not supported.
NewLineDelimitedManifest,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [FileSetSpecType::value] or
/// [FileSetSpecType::name].
UnknownValue(file_set_spec_type::UnknownValue),
}
#[doc(hidden)]
pub mod file_set_spec_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FileSetSpecType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::FileSystemMatch => std::option::Option::Some(0),
Self::NewLineDelimitedManifest => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::FileSystemMatch => {
std::option::Option::Some("FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH")
}
Self::NewLineDelimitedManifest => {
std::option::Option::Some("FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FileSetSpecType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FileSetSpecType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FileSetSpecType {
fn from(value: i32) -> Self {
match value {
0 => Self::FileSystemMatch,
1 => Self::NewLineDelimitedManifest,
_ => Self::UnknownValue(file_set_spec_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FileSetSpecType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH" => Self::FileSystemMatch,
"FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST" => Self::NewLineDelimitedManifest,
_ => Self::UnknownValue(file_set_spec_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FileSetSpecType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::FileSystemMatch => serializer.serialize_i32(0),
Self::NewLineDelimitedManifest => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FileSetSpecType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FileSetSpecType>::new(
".google.cloud.bigquery.v2.FileSetSpecType",
))
}
}
/// The type of editions.
/// Different features and behaviors are provided to different editions
/// Capacity commitments and reservations are linked to editions.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ReservationEdition {
/// Default value, which will be treated as ENTERPRISE.
Unspecified,
/// Standard edition.
Standard,
/// Enterprise edition.
Enterprise,
/// Enterprise Plus edition.
EnterprisePlus,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ReservationEdition::value] or
/// [ReservationEdition::name].
UnknownValue(reservation_edition::UnknownValue),
}
#[doc(hidden)]
pub mod reservation_edition {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ReservationEdition {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Standard => std::option::Option::Some(1),
Self::Enterprise => std::option::Option::Some(2),
Self::EnterprisePlus => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RESERVATION_EDITION_UNSPECIFIED"),
Self::Standard => std::option::Option::Some("STANDARD"),
Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ReservationEdition {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ReservationEdition {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ReservationEdition {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Standard,
2 => Self::Enterprise,
3 => Self::EnterprisePlus,
_ => Self::UnknownValue(reservation_edition::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ReservationEdition {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESERVATION_EDITION_UNSPECIFIED" => Self::Unspecified,
"STANDARD" => Self::Standard,
"ENTERPRISE" => Self::Enterprise,
"ENTERPRISE_PLUS" => Self::EnterprisePlus,
_ => Self::UnknownValue(reservation_edition::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ReservationEdition {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Standard => serializer.serialize_i32(1),
Self::Enterprise => serializer.serialize_i32(2),
Self::EnterprisePlus => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ReservationEdition {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReservationEdition>::new(
".google.cloud.bigquery.v2.ReservationEdition",
))
}
}
/// Used to indicate that a JSON variant, rather than normal JSON, is being used
/// as the source_format. This should only be used in combination with the
/// JSON source format.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum JsonExtension {
/// The default if provided value is not one included in the enum, or the value
/// is not specified. The source format is parsed without any modification.
Unspecified,
/// Use GeoJSON variant of JSON. See <https://tools.ietf.org/html/rfc7946>.
Geojson,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [JsonExtension::value] or
/// [JsonExtension::name].
UnknownValue(json_extension::UnknownValue),
}
#[doc(hidden)]
pub mod json_extension {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl JsonExtension {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Geojson => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("JSON_EXTENSION_UNSPECIFIED"),
Self::Geojson => std::option::Option::Some("GEOJSON"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for JsonExtension {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for JsonExtension {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for JsonExtension {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Geojson,
_ => Self::UnknownValue(json_extension::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for JsonExtension {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"JSON_EXTENSION_UNSPECIFIED" => Self::Unspecified,
"GEOJSON" => Self::Geojson,
_ => Self::UnknownValue(json_extension::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for JsonExtension {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Geojson => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for JsonExtension {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonExtension>::new(
".google.cloud.bigquery.v2.JsonExtension",
))
}
}
/// The classification of managed table types that can be created.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ManagedTableType {
/// No managed table type specified.
Unspecified,
/// The managed table is a native BigQuery table.
Native,
/// The managed table is a BigLake table for Apache Iceberg in BigQuery.
Biglake,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ManagedTableType::value] or
/// [ManagedTableType::name].
UnknownValue(managed_table_type::UnknownValue),
}
#[doc(hidden)]
pub mod managed_table_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ManagedTableType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Native => std::option::Option::Some(1),
Self::Biglake => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MANAGED_TABLE_TYPE_UNSPECIFIED"),
Self::Native => std::option::Option::Some("NATIVE"),
Self::Biglake => std::option::Option::Some("BIGLAKE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ManagedTableType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ManagedTableType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ManagedTableType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Native,
2 => Self::Biglake,
_ => Self::UnknownValue(managed_table_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ManagedTableType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MANAGED_TABLE_TYPE_UNSPECIFIED" => Self::Unspecified,
"NATIVE" => Self::Native,
"BIGLAKE" => Self::Biglake,
_ => Self::UnknownValue(managed_table_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ManagedTableType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Native => serializer.serialize_i32(1),
Self::Biglake => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ManagedTableType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ManagedTableType>::new(
".google.cloud.bigquery.v2.ManagedTableType",
))
}
}
/// Indicates the map target type. Only applies to parquet maps.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MapTargetType {
/// In this mode, the map will have the following schema:
/// struct map_field_name { repeated struct key_value { key value } }.
Unspecified,
/// In this mode, the map will have the following schema:
/// repeated struct map_field_name { key value }.
ArrayOfStruct,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MapTargetType::value] or
/// [MapTargetType::name].
UnknownValue(map_target_type::UnknownValue),
}
#[doc(hidden)]
pub mod map_target_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MapTargetType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ArrayOfStruct => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MAP_TARGET_TYPE_UNSPECIFIED"),
Self::ArrayOfStruct => std::option::Option::Some("ARRAY_OF_STRUCT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MapTargetType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MapTargetType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MapTargetType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ArrayOfStruct,
_ => Self::UnknownValue(map_target_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MapTargetType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MAP_TARGET_TYPE_UNSPECIFIED" => Self::Unspecified,
"ARRAY_OF_STRUCT" => Self::ArrayOfStruct,
_ => Self::UnknownValue(map_target_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MapTargetType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ArrayOfStruct => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MapTargetType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MapTargetType>::new(
".google.cloud.bigquery.v2.MapTargetType",
))
}
}