Skip to main content

google_cloud_bigquery/write/generated/gapic_storage/
model.rs

1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22mod debug;
23mod deserialize;
24mod serialize;
25
26/// Arrow schema as specified in
27/// <https://arrow.apache.org/docs/python/api/datatypes.html>
28/// and serialized to bytes using IPC:
29/// <https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc>
30///
31/// See code samples on how this message can be deserialized.
32#[derive(Clone, Default, PartialEq)]
33#[non_exhaustive]
34pub struct ArrowSchema {
35    /// IPC serialized Arrow schema.
36    pub serialized_schema: ::bytes::Bytes,
37
38    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39}
40
41impl ArrowSchema {
42    /// Creates a new default instance.
43    pub fn new() -> Self {
44        std::default::Default::default()
45    }
46
47    /// Sets the value of [serialized_schema][crate::write::generated::gapic_storage::model::ArrowSchema::serialized_schema].
48    pub fn set_serialized_schema<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
49        self.serialized_schema = v.into();
50        self
51    }
52}
53
54impl wkt::message::Message for ArrowSchema {
55    fn typename() -> &'static str {
56        "type.googleapis.com/google.cloud.bigquery.storage.v1.ArrowSchema"
57    }
58}
59
60/// Arrow RecordBatch.
61#[derive(Clone, Default, PartialEq)]
62#[non_exhaustive]
63pub struct ArrowRecordBatch {
64    /// IPC-serialized Arrow RecordBatch.
65    pub serialized_record_batch: ::bytes::Bytes,
66
67    /// [Deprecated] The count of rows in `serialized_record_batch`.
68    /// Please use the format-independent ReadRowsResponse.row_count instead.
69    #[deprecated]
70    pub row_count: i64,
71
72    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
73}
74
75impl ArrowRecordBatch {
76    /// Creates a new default instance.
77    pub fn new() -> Self {
78        std::default::Default::default()
79    }
80
81    /// Sets the value of [serialized_record_batch][crate::write::generated::gapic_storage::model::ArrowRecordBatch::serialized_record_batch].
82    pub fn set_serialized_record_batch<T: std::convert::Into<::bytes::Bytes>>(
83        mut self,
84        v: T,
85    ) -> Self {
86        self.serialized_record_batch = v.into();
87        self
88    }
89
90    /// Sets the value of [row_count][crate::write::generated::gapic_storage::model::ArrowRecordBatch::row_count].
91    #[deprecated]
92    pub fn set_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
93        self.row_count = v.into();
94        self
95    }
96}
97
98impl wkt::message::Message for ArrowRecordBatch {
99    fn typename() -> &'static str {
100        "type.googleapis.com/google.cloud.bigquery.storage.v1.ArrowRecordBatch"
101    }
102}
103
104/// Contains options specific to Arrow Serialization.
105#[derive(Clone, Default, PartialEq)]
106#[non_exhaustive]
107pub struct ArrowSerializationOptions {
108
109    /// The compression codec to use for Arrow buffers in serialized record
110    /// batches.
111    pub buffer_compression: crate::write::generated::gapic_storage::model::arrow_serialization_options::CompressionCodec,
112
113    /// Optional. Set timestamp precision option. If not set, the default precision
114    /// is microseconds.
115    pub picos_timestamp_precision: crate::write::generated::gapic_storage::model::arrow_serialization_options::PicosTimestampPrecision,
116
117    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
118}
119
120impl ArrowSerializationOptions {
121    /// Creates a new default instance.
122    pub fn new() -> Self {
123        std::default::Default::default()
124    }
125
126    /// Sets the value of [buffer_compression][crate::write::generated::gapic_storage::model::ArrowSerializationOptions::buffer_compression].
127    pub fn set_buffer_compression<T: std::convert::Into<crate::write::generated::gapic_storage::model::arrow_serialization_options::CompressionCodec>>(mut self, v: T) -> Self{
128        self.buffer_compression = v.into();
129        self
130    }
131
132    /// Sets the value of [picos_timestamp_precision][crate::write::generated::gapic_storage::model::ArrowSerializationOptions::picos_timestamp_precision].
133    pub fn set_picos_timestamp_precision<T: std::convert::Into<crate::write::generated::gapic_storage::model::arrow_serialization_options::PicosTimestampPrecision>>(mut self, v: T) -> Self{
134        self.picos_timestamp_precision = v.into();
135        self
136    }
137}
138
139impl wkt::message::Message for ArrowSerializationOptions {
140    fn typename() -> &'static str {
141        "type.googleapis.com/google.cloud.bigquery.storage.v1.ArrowSerializationOptions"
142    }
143}
144
145/// Defines additional types related to [ArrowSerializationOptions].
146pub mod arrow_serialization_options {
147    #[allow(unused_imports)]
148    use super::*;
149
150    /// Compression codec's supported by Arrow.
151    ///
152    /// # Working with unknown values
153    ///
154    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
155    /// additional enum variants at any time. Adding new variants is not considered
156    /// a breaking change. Applications should write their code in anticipation of:
157    ///
158    /// - New values appearing in future releases of the client library, **and**
159    /// - New values received dynamically, without application changes.
160    ///
161    /// Please consult the [Working with enums] section in the user guide for some
162    /// guidelines.
163    ///
164    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
165    #[derive(Clone, Debug, PartialEq)]
166    #[non_exhaustive]
167    pub enum CompressionCodec {
168        /// If unspecified no compression will be used.
169        CompressionUnspecified,
170        /// LZ4 Frame (<https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md>)
171        Lz4Frame,
172        /// Zstandard compression.
173        Zstd,
174        /// If set, the enum was initialized with an unknown value.
175        ///
176        /// Applications can examine the value using [CompressionCodec::value] or
177        /// [CompressionCodec::name].
178        UnknownValue(compression_codec::UnknownValue),
179    }
180
181    #[doc(hidden)]
182    pub mod compression_codec {
183        #[allow(unused_imports)]
184        use super::*;
185        #[derive(Clone, Debug, PartialEq)]
186        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
187    }
188
189    impl CompressionCodec {
190        /// Gets the enum value.
191        ///
192        /// Returns `None` if the enum contains an unknown value deserialized from
193        /// the string representation of enums.
194        pub fn value(&self) -> std::option::Option<i32> {
195            match self {
196                Self::CompressionUnspecified => std::option::Option::Some(0),
197                Self::Lz4Frame => std::option::Option::Some(1),
198                Self::Zstd => std::option::Option::Some(2),
199                Self::UnknownValue(u) => u.0.value(),
200            }
201        }
202
203        /// Gets the enum value as a string.
204        ///
205        /// Returns `None` if the enum contains an unknown value deserialized from
206        /// the integer representation of enums.
207        pub fn name(&self) -> std::option::Option<&str> {
208            match self {
209                Self::CompressionUnspecified => {
210                    std::option::Option::Some("COMPRESSION_UNSPECIFIED")
211                }
212                Self::Lz4Frame => std::option::Option::Some("LZ4_FRAME"),
213                Self::Zstd => std::option::Option::Some("ZSTD"),
214                Self::UnknownValue(u) => u.0.name(),
215            }
216        }
217    }
218
219    impl std::default::Default for CompressionCodec {
220        fn default() -> Self {
221            use std::convert::From;
222            Self::from(0)
223        }
224    }
225
226    impl std::fmt::Display for CompressionCodec {
227        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
228            wkt::internal::display_enum(f, self.name(), self.value())
229        }
230    }
231
232    impl std::convert::From<i32> for CompressionCodec {
233        fn from(value: i32) -> Self {
234            match value {
235                0 => Self::CompressionUnspecified,
236                1 => Self::Lz4Frame,
237                2 => Self::Zstd,
238                _ => Self::UnknownValue(compression_codec::UnknownValue(
239                    wkt::internal::UnknownEnumValue::Integer(value),
240                )),
241            }
242        }
243    }
244
245    impl std::convert::From<&str> for CompressionCodec {
246        fn from(value: &str) -> Self {
247            use std::string::ToString;
248            match value {
249                "COMPRESSION_UNSPECIFIED" => Self::CompressionUnspecified,
250                "LZ4_FRAME" => Self::Lz4Frame,
251                "ZSTD" => Self::Zstd,
252                _ => Self::UnknownValue(compression_codec::UnknownValue(
253                    wkt::internal::UnknownEnumValue::String(value.to_string()),
254                )),
255            }
256        }
257    }
258
259    impl serde::ser::Serialize for CompressionCodec {
260        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
261        where
262            S: serde::Serializer,
263        {
264            match self {
265                Self::CompressionUnspecified => serializer.serialize_i32(0),
266                Self::Lz4Frame => serializer.serialize_i32(1),
267                Self::Zstd => serializer.serialize_i32(2),
268                Self::UnknownValue(u) => u.0.serialize(serializer),
269            }
270        }
271    }
272
273    impl<'de> serde::de::Deserialize<'de> for CompressionCodec {
274        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
275        where
276            D: serde::Deserializer<'de>,
277        {
278            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionCodec>::new(
279                ".google.cloud.bigquery.storage.v1.ArrowSerializationOptions.CompressionCodec",
280            ))
281        }
282    }
283
284    /// The precision of the timestamp value in the Avro message. This precision
285    /// will **only** be applied to the column(s) with the `TIMESTAMP_PICOS` type.
286    ///
287    /// # Working with unknown values
288    ///
289    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
290    /// additional enum variants at any time. Adding new variants is not considered
291    /// a breaking change. Applications should write their code in anticipation of:
292    ///
293    /// - New values appearing in future releases of the client library, **and**
294    /// - New values received dynamically, without application changes.
295    ///
296    /// Please consult the [Working with enums] section in the user guide for some
297    /// guidelines.
298    ///
299    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
300    #[derive(Clone, Debug, PartialEq)]
301    #[non_exhaustive]
302    pub enum PicosTimestampPrecision {
303        /// Unspecified timestamp precision. The default precision is microseconds.
304        Unspecified,
305        /// Timestamp values returned by Read API will be truncated to microsecond
306        /// level precision. The value will be encoded as Arrow TIMESTAMP type in a
307        /// 64 bit integer.
308        TimestampPrecisionMicros,
309        /// Timestamp values returned by Read API will be truncated to nanosecond
310        /// level precision. The value will be encoded as Arrow TIMESTAMP type in a
311        /// 64 bit integer.
312        TimestampPrecisionNanos,
313        /// Read API will return full precision picosecond value. The value will be
314        /// encoded as a string which conforms to ISO 8601 format.
315        TimestampPrecisionPicos,
316        /// If set, the enum was initialized with an unknown value.
317        ///
318        /// Applications can examine the value using [PicosTimestampPrecision::value] or
319        /// [PicosTimestampPrecision::name].
320        UnknownValue(picos_timestamp_precision::UnknownValue),
321    }
322
323    #[doc(hidden)]
324    pub mod picos_timestamp_precision {
325        #[allow(unused_imports)]
326        use super::*;
327        #[derive(Clone, Debug, PartialEq)]
328        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
329    }
330
331    impl PicosTimestampPrecision {
332        /// Gets the enum value.
333        ///
334        /// Returns `None` if the enum contains an unknown value deserialized from
335        /// the string representation of enums.
336        pub fn value(&self) -> std::option::Option<i32> {
337            match self {
338                Self::Unspecified => std::option::Option::Some(0),
339                Self::TimestampPrecisionMicros => std::option::Option::Some(1),
340                Self::TimestampPrecisionNanos => std::option::Option::Some(2),
341                Self::TimestampPrecisionPicos => std::option::Option::Some(3),
342                Self::UnknownValue(u) => u.0.value(),
343            }
344        }
345
346        /// Gets the enum value as a string.
347        ///
348        /// Returns `None` if the enum contains an unknown value deserialized from
349        /// the integer representation of enums.
350        pub fn name(&self) -> std::option::Option<&str> {
351            match self {
352                Self::Unspecified => {
353                    std::option::Option::Some("PICOS_TIMESTAMP_PRECISION_UNSPECIFIED")
354                }
355                Self::TimestampPrecisionMicros => {
356                    std::option::Option::Some("TIMESTAMP_PRECISION_MICROS")
357                }
358                Self::TimestampPrecisionNanos => {
359                    std::option::Option::Some("TIMESTAMP_PRECISION_NANOS")
360                }
361                Self::TimestampPrecisionPicos => {
362                    std::option::Option::Some("TIMESTAMP_PRECISION_PICOS")
363                }
364                Self::UnknownValue(u) => u.0.name(),
365            }
366        }
367    }
368
369    impl std::default::Default for PicosTimestampPrecision {
370        fn default() -> Self {
371            use std::convert::From;
372            Self::from(0)
373        }
374    }
375
376    impl std::fmt::Display for PicosTimestampPrecision {
377        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
378            wkt::internal::display_enum(f, self.name(), self.value())
379        }
380    }
381
382    impl std::convert::From<i32> for PicosTimestampPrecision {
383        fn from(value: i32) -> Self {
384            match value {
385                0 => Self::Unspecified,
386                1 => Self::TimestampPrecisionMicros,
387                2 => Self::TimestampPrecisionNanos,
388                3 => Self::TimestampPrecisionPicos,
389                _ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
390                    wkt::internal::UnknownEnumValue::Integer(value),
391                )),
392            }
393        }
394    }
395
396    impl std::convert::From<&str> for PicosTimestampPrecision {
397        fn from(value: &str) -> Self {
398            use std::string::ToString;
399            match value {
400                "PICOS_TIMESTAMP_PRECISION_UNSPECIFIED" => Self::Unspecified,
401                "TIMESTAMP_PRECISION_MICROS" => Self::TimestampPrecisionMicros,
402                "TIMESTAMP_PRECISION_NANOS" => Self::TimestampPrecisionNanos,
403                "TIMESTAMP_PRECISION_PICOS" => Self::TimestampPrecisionPicos,
404                _ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
405                    wkt::internal::UnknownEnumValue::String(value.to_string()),
406                )),
407            }
408        }
409    }
410
411    impl serde::ser::Serialize for PicosTimestampPrecision {
412        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
413        where
414            S: serde::Serializer,
415        {
416            match self {
417                Self::Unspecified => serializer.serialize_i32(0),
418                Self::TimestampPrecisionMicros => serializer.serialize_i32(1),
419                Self::TimestampPrecisionNanos => serializer.serialize_i32(2),
420                Self::TimestampPrecisionPicos => serializer.serialize_i32(3),
421                Self::UnknownValue(u) => u.0.serialize(serializer),
422            }
423        }
424    }
425
426    impl<'de> serde::de::Deserialize<'de> for PicosTimestampPrecision {
427        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
428        where
429            D: serde::Deserializer<'de>,
430        {
431            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PicosTimestampPrecision>::new(
432                ".google.cloud.bigquery.storage.v1.ArrowSerializationOptions.PicosTimestampPrecision"))
433        }
434    }
435}
436
437/// Avro schema.
438#[derive(Clone, Default, PartialEq)]
439#[non_exhaustive]
440pub struct AvroSchema {
441    /// Json serialized schema, as described at
442    /// <https://avro.apache.org/docs/1.8.1/spec.html>.
443    pub schema: std::string::String,
444
445    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
446}
447
448impl AvroSchema {
449    /// Creates a new default instance.
450    pub fn new() -> Self {
451        std::default::Default::default()
452    }
453
454    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::AvroSchema::schema].
455    pub fn set_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
456        self.schema = v.into();
457        self
458    }
459}
460
461impl wkt::message::Message for AvroSchema {
462    fn typename() -> &'static str {
463        "type.googleapis.com/google.cloud.bigquery.storage.v1.AvroSchema"
464    }
465}
466
467/// Avro rows.
468#[derive(Clone, Default, PartialEq)]
469#[non_exhaustive]
470pub struct AvroRows {
471    /// Binary serialized rows in a block.
472    pub serialized_binary_rows: ::bytes::Bytes,
473
474    /// [Deprecated] The count of rows in the returning block.
475    /// Please use the format-independent ReadRowsResponse.row_count instead.
476    #[deprecated]
477    pub row_count: i64,
478
479    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
480}
481
482impl AvroRows {
483    /// Creates a new default instance.
484    pub fn new() -> Self {
485        std::default::Default::default()
486    }
487
488    /// Sets the value of [serialized_binary_rows][crate::write::generated::gapic_storage::model::AvroRows::serialized_binary_rows].
489    pub fn set_serialized_binary_rows<T: std::convert::Into<::bytes::Bytes>>(
490        mut self,
491        v: T,
492    ) -> Self {
493        self.serialized_binary_rows = v.into();
494        self
495    }
496
497    /// Sets the value of [row_count][crate::write::generated::gapic_storage::model::AvroRows::row_count].
498    #[deprecated]
499    pub fn set_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
500        self.row_count = v.into();
501        self
502    }
503}
504
505impl wkt::message::Message for AvroRows {
506    fn typename() -> &'static str {
507        "type.googleapis.com/google.cloud.bigquery.storage.v1.AvroRows"
508    }
509}
510
511/// Contains options specific to Avro Serialization.
512#[derive(Clone, Default, PartialEq)]
513#[non_exhaustive]
514pub struct AvroSerializationOptions {
515
516    /// Enable displayName attribute in Avro schema.
517    ///
518    /// The Avro specification requires field names to be alphanumeric.  By
519    /// default, in cases when column names do not conform to these requirements
520    /// (e.g. non-ascii unicode codepoints) and Avro is requested as an output
521    /// format, the CreateReadSession call will fail.
522    ///
523    /// Setting this field to true, populates avro field names with a placeholder
524    /// value and populates a "displayName" attribute for every avro field with the
525    /// original column name.
526    pub enable_display_name_attribute: bool,
527
528    /// Optional. Set timestamp precision option. If not set, the default precision
529    /// is microseconds.
530    pub picos_timestamp_precision: crate::write::generated::gapic_storage::model::avro_serialization_options::PicosTimestampPrecision,
531
532    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
533}
534
535impl AvroSerializationOptions {
536    /// Creates a new default instance.
537    pub fn new() -> Self {
538        std::default::Default::default()
539    }
540
541    /// Sets the value of [enable_display_name_attribute][crate::write::generated::gapic_storage::model::AvroSerializationOptions::enable_display_name_attribute].
542    pub fn set_enable_display_name_attribute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
543        self.enable_display_name_attribute = v.into();
544        self
545    }
546
547    /// Sets the value of [picos_timestamp_precision][crate::write::generated::gapic_storage::model::AvroSerializationOptions::picos_timestamp_precision].
548    pub fn set_picos_timestamp_precision<T: std::convert::Into<crate::write::generated::gapic_storage::model::avro_serialization_options::PicosTimestampPrecision>>(mut self, v: T) -> Self{
549        self.picos_timestamp_precision = v.into();
550        self
551    }
552}
553
554impl wkt::message::Message for AvroSerializationOptions {
555    fn typename() -> &'static str {
556        "type.googleapis.com/google.cloud.bigquery.storage.v1.AvroSerializationOptions"
557    }
558}
559
560/// Defines additional types related to [AvroSerializationOptions].
561pub mod avro_serialization_options {
562    #[allow(unused_imports)]
563    use super::*;
564
565    /// The precision of the timestamp value in the Avro message. This precision
566    /// will **only** be applied to the column(s) with the `TIMESTAMP_PICOS` type.
567    ///
568    /// # Working with unknown values
569    ///
570    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
571    /// additional enum variants at any time. Adding new variants is not considered
572    /// a breaking change. Applications should write their code in anticipation of:
573    ///
574    /// - New values appearing in future releases of the client library, **and**
575    /// - New values received dynamically, without application changes.
576    ///
577    /// Please consult the [Working with enums] section in the user guide for some
578    /// guidelines.
579    ///
580    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
581    #[derive(Clone, Debug, PartialEq)]
582    #[non_exhaustive]
583    pub enum PicosTimestampPrecision {
584        /// Unspecified timestamp precision. The default precision is microseconds.
585        Unspecified,
586        /// Timestamp values returned by Read API will be truncated to microsecond
587        /// level precision. The value will be encoded as Avro TIMESTAMP type in a
588        /// 64 bit integer.
589        TimestampPrecisionMicros,
590        /// Timestamp values returned by Read API will be truncated to nanosecond
591        /// level precision. The value will be encoded as Avro TIMESTAMP type in a
592        /// 64 bit integer.
593        TimestampPrecisionNanos,
594        /// Read API will return full precision picosecond value. The value will be
595        /// encoded as a string which conforms to ISO 8601 format.
596        TimestampPrecisionPicos,
597        /// If set, the enum was initialized with an unknown value.
598        ///
599        /// Applications can examine the value using [PicosTimestampPrecision::value] or
600        /// [PicosTimestampPrecision::name].
601        UnknownValue(picos_timestamp_precision::UnknownValue),
602    }
603
604    #[doc(hidden)]
605    pub mod picos_timestamp_precision {
606        #[allow(unused_imports)]
607        use super::*;
608        #[derive(Clone, Debug, PartialEq)]
609        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
610    }
611
612    impl PicosTimestampPrecision {
613        /// Gets the enum value.
614        ///
615        /// Returns `None` if the enum contains an unknown value deserialized from
616        /// the string representation of enums.
617        pub fn value(&self) -> std::option::Option<i32> {
618            match self {
619                Self::Unspecified => std::option::Option::Some(0),
620                Self::TimestampPrecisionMicros => std::option::Option::Some(1),
621                Self::TimestampPrecisionNanos => std::option::Option::Some(2),
622                Self::TimestampPrecisionPicos => std::option::Option::Some(3),
623                Self::UnknownValue(u) => u.0.value(),
624            }
625        }
626
627        /// Gets the enum value as a string.
628        ///
629        /// Returns `None` if the enum contains an unknown value deserialized from
630        /// the integer representation of enums.
631        pub fn name(&self) -> std::option::Option<&str> {
632            match self {
633                Self::Unspecified => {
634                    std::option::Option::Some("PICOS_TIMESTAMP_PRECISION_UNSPECIFIED")
635                }
636                Self::TimestampPrecisionMicros => {
637                    std::option::Option::Some("TIMESTAMP_PRECISION_MICROS")
638                }
639                Self::TimestampPrecisionNanos => {
640                    std::option::Option::Some("TIMESTAMP_PRECISION_NANOS")
641                }
642                Self::TimestampPrecisionPicos => {
643                    std::option::Option::Some("TIMESTAMP_PRECISION_PICOS")
644                }
645                Self::UnknownValue(u) => u.0.name(),
646            }
647        }
648    }
649
650    impl std::default::Default for PicosTimestampPrecision {
651        fn default() -> Self {
652            use std::convert::From;
653            Self::from(0)
654        }
655    }
656
657    impl std::fmt::Display for PicosTimestampPrecision {
658        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
659            wkt::internal::display_enum(f, self.name(), self.value())
660        }
661    }
662
663    impl std::convert::From<i32> for PicosTimestampPrecision {
664        fn from(value: i32) -> Self {
665            match value {
666                0 => Self::Unspecified,
667                1 => Self::TimestampPrecisionMicros,
668                2 => Self::TimestampPrecisionNanos,
669                3 => Self::TimestampPrecisionPicos,
670                _ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
671                    wkt::internal::UnknownEnumValue::Integer(value),
672                )),
673            }
674        }
675    }
676
677    impl std::convert::From<&str> for PicosTimestampPrecision {
678        fn from(value: &str) -> Self {
679            use std::string::ToString;
680            match value {
681                "PICOS_TIMESTAMP_PRECISION_UNSPECIFIED" => Self::Unspecified,
682                "TIMESTAMP_PRECISION_MICROS" => Self::TimestampPrecisionMicros,
683                "TIMESTAMP_PRECISION_NANOS" => Self::TimestampPrecisionNanos,
684                "TIMESTAMP_PRECISION_PICOS" => Self::TimestampPrecisionPicos,
685                _ => Self::UnknownValue(picos_timestamp_precision::UnknownValue(
686                    wkt::internal::UnknownEnumValue::String(value.to_string()),
687                )),
688            }
689        }
690    }
691
692    impl serde::ser::Serialize for PicosTimestampPrecision {
693        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
694        where
695            S: serde::Serializer,
696        {
697            match self {
698                Self::Unspecified => serializer.serialize_i32(0),
699                Self::TimestampPrecisionMicros => serializer.serialize_i32(1),
700                Self::TimestampPrecisionNanos => serializer.serialize_i32(2),
701                Self::TimestampPrecisionPicos => serializer.serialize_i32(3),
702                Self::UnknownValue(u) => u.0.serialize(serializer),
703            }
704        }
705    }
706
707    impl<'de> serde::de::Deserialize<'de> for PicosTimestampPrecision {
708        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
709        where
710            D: serde::Deserializer<'de>,
711        {
712            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PicosTimestampPrecision>::new(
713                ".google.cloud.bigquery.storage.v1.AvroSerializationOptions.PicosTimestampPrecision"))
714        }
715    }
716}
717
718/// ProtoSchema describes the schema of the serialized protocol buffer data rows.
719#[derive(Clone, Default, PartialEq)]
720#[non_exhaustive]
721pub struct ProtoSchema {
722    /// Descriptor for input message.  The provided descriptor must be self
723    /// contained, such that data rows sent can be fully decoded using only the
724    /// single descriptor.  For data rows that are compositions of multiple
725    /// independent messages, this means the descriptor may need to be transformed
726    /// to only use nested types:
727    /// <https://developers.google.com/protocol-buffers/docs/proto#nested>
728    ///
729    /// For additional information for how proto types and values map onto BigQuery
730    /// see: <https://cloud.google.com/bigquery/docs/write-api#data_type_conversions>
731    pub proto_descriptor: std::option::Option<wkt::DescriptorProto>,
732
733    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
734}
735
736impl ProtoSchema {
737    /// Creates a new default instance.
738    pub fn new() -> Self {
739        std::default::Default::default()
740    }
741
742    /// Sets the value of [proto_descriptor][crate::write::generated::gapic_storage::model::ProtoSchema::proto_descriptor].
743    pub fn set_proto_descriptor<T>(mut self, v: T) -> Self
744    where
745        T: std::convert::Into<wkt::DescriptorProto>,
746    {
747        self.proto_descriptor = std::option::Option::Some(v.into());
748        self
749    }
750
751    /// Sets or clears the value of [proto_descriptor][crate::write::generated::gapic_storage::model::ProtoSchema::proto_descriptor].
752    pub fn set_or_clear_proto_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
753    where
754        T: std::convert::Into<wkt::DescriptorProto>,
755    {
756        self.proto_descriptor = v.map(|x| x.into());
757        self
758    }
759}
760
761impl wkt::message::Message for ProtoSchema {
762    fn typename() -> &'static str {
763        "type.googleapis.com/google.cloud.bigquery.storage.v1.ProtoSchema"
764    }
765}
766
767#[allow(missing_docs)]
768#[derive(Clone, Default, PartialEq)]
769#[non_exhaustive]
770pub struct ProtoRows {
771    /// A sequence of rows serialized as a Protocol Buffer.
772    ///
773    /// See <https://developers.google.com/protocol-buffers/docs/overview> for more
774    /// information on deserializing this field.
775    pub serialized_rows: std::vec::Vec<::bytes::Bytes>,
776
777    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
778}
779
780impl ProtoRows {
781    /// Creates a new default instance.
782    pub fn new() -> Self {
783        std::default::Default::default()
784    }
785
786    /// Sets the value of [serialized_rows][crate::write::generated::gapic_storage::model::ProtoRows::serialized_rows].
787    pub fn set_serialized_rows<T, V>(mut self, v: T) -> Self
788    where
789        T: std::iter::IntoIterator<Item = V>,
790        V: std::convert::Into<::bytes::Bytes>,
791    {
792        use std::iter::Iterator;
793        self.serialized_rows = v.into_iter().map(|i| i.into()).collect();
794        self
795    }
796}
797
798impl wkt::message::Message for ProtoRows {
799    fn typename() -> &'static str {
800        "type.googleapis.com/google.cloud.bigquery.storage.v1.ProtoRows"
801    }
802}
803
804/// Request message for `CreateReadSession`.
805#[derive(Clone, Default, PartialEq)]
806#[non_exhaustive]
807pub struct CreateReadSessionRequest {
808    /// Required. The request project that owns the session, in the form of
809    /// `projects/{project_id}`.
810    pub parent: std::string::String,
811
812    /// Required. Session to be created.
813    pub read_session:
814        std::option::Option<crate::write::generated::gapic_storage::model::ReadSession>,
815
816    /// Max initial number of streams. If unset or zero, the server will
817    /// provide a value of streams so as to produce reasonable throughput. Must be
818    /// non-negative. The number of streams may be lower than the requested number,
819    /// depending on the amount parallelism that is reasonable for the table.
820    /// There is a default system max limit of 1,000.
821    ///
822    /// This must be greater than or equal to preferred_min_stream_count.
823    /// Typically, clients should either leave this unset to let the system to
824    /// determine an upper bound OR set this a size for the maximum "units of work"
825    /// it can gracefully handle.
826    pub max_stream_count: i32,
827
828    /// The minimum preferred stream count. This parameter can be used to inform
829    /// the service that there is a desired lower bound on the number of streams.
830    /// This is typically a target parallelism of the client (e.g. a Spark
831    /// cluster with N-workers would set this to a low multiple of N to ensure
832    /// good cluster utilization).
833    ///
834    /// The system will make a best effort to provide at least this number of
835    /// streams, but in some cases might provide less.
836    pub preferred_min_stream_count: i32,
837
838    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
839}
840
841impl CreateReadSessionRequest {
842    /// Creates a new default instance.
843    pub fn new() -> Self {
844        std::default::Default::default()
845    }
846
847    /// Sets the value of [parent][crate::write::generated::gapic_storage::model::CreateReadSessionRequest::parent].
848    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
849        self.parent = v.into();
850        self
851    }
852
853    /// Sets the value of [read_session][crate::write::generated::gapic_storage::model::CreateReadSessionRequest::read_session].
854    pub fn set_read_session<T>(mut self, v: T) -> Self
855    where
856        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadSession>,
857    {
858        self.read_session = std::option::Option::Some(v.into());
859        self
860    }
861
862    /// Sets or clears the value of [read_session][crate::write::generated::gapic_storage::model::CreateReadSessionRequest::read_session].
863    pub fn set_or_clear_read_session<T>(mut self, v: std::option::Option<T>) -> Self
864    where
865        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadSession>,
866    {
867        self.read_session = v.map(|x| x.into());
868        self
869    }
870
871    /// Sets the value of [max_stream_count][crate::write::generated::gapic_storage::model::CreateReadSessionRequest::max_stream_count].
872    pub fn set_max_stream_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
873        self.max_stream_count = v.into();
874        self
875    }
876
877    /// Sets the value of [preferred_min_stream_count][crate::write::generated::gapic_storage::model::CreateReadSessionRequest::preferred_min_stream_count].
878    pub fn set_preferred_min_stream_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
879        self.preferred_min_stream_count = v.into();
880        self
881    }
882}
883
884impl wkt::message::Message for CreateReadSessionRequest {
885    fn typename() -> &'static str {
886        "type.googleapis.com/google.cloud.bigquery.storage.v1.CreateReadSessionRequest"
887    }
888}
889
890/// Request message for `ReadRows`.
891#[derive(Clone, Default, PartialEq)]
892#[non_exhaustive]
893pub struct ReadRowsRequest {
894
895    /// Required. Stream to read rows from.
896    pub read_stream: std::string::String,
897
898    /// The offset requested must be less than the last row read from Read.
899    /// Requesting a larger offset is undefined. If not specified, start reading
900    /// from offset zero.
901    pub offset: i64,
902
903    /// Specifies output serialization options. Only job _default streams are
904    /// supported.
905    ///
906    /// This feature is not yet available.
907    pub output_format_serialization_options: std::option::Option<crate::write::generated::gapic_storage::model::read_rows_request::OutputFormatSerializationOptions>,
908
909    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
910}
911
912impl ReadRowsRequest {
913    /// Creates a new default instance.
914    pub fn new() -> Self {
915        std::default::Default::default()
916    }
917
918    /// Sets the value of [read_stream][crate::write::generated::gapic_storage::model::ReadRowsRequest::read_stream].
919    pub fn set_read_stream<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
920        self.read_stream = v.into();
921        self
922    }
923
924    /// Sets the value of [offset][crate::write::generated::gapic_storage::model::ReadRowsRequest::offset].
925    pub fn set_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
926        self.offset = v.into();
927        self
928    }
929
930    /// Sets the value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::ReadRowsRequest::output_format_serialization_options].
931    ///
932    /// Note that all the setters affecting `output_format_serialization_options` are mutually
933    /// exclusive.
934    pub fn set_output_format_serialization_options<T: std::convert::Into<std::option::Option<crate::write::generated::gapic_storage::model::read_rows_request::OutputFormatSerializationOptions>>>(mut self, v: T) -> Self
935    {
936        self.output_format_serialization_options = v.into();
937        self
938    }
939
940    /// The value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::ReadRowsRequest::output_format_serialization_options]
941    /// if it holds a `ArrowSerializationOptions`, `None` if the field is not set or
942    /// holds a different branch.
943    pub fn arrow_serialization_options(
944        &self,
945    ) -> std::option::Option<
946        &std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSerializationOptions>,
947    > {
948        #[allow(unreachable_patterns)]
949        self.output_format_serialization_options.as_ref().and_then(|v| match v {
950            crate::write::generated::gapic_storage::model::read_rows_request::OutputFormatSerializationOptions::ArrowSerializationOptions(v) => std::option::Option::Some(v),
951            _ => std::option::Option::None,
952        })
953    }
954
955    /// Sets the value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::ReadRowsRequest::output_format_serialization_options]
956    /// to hold a `ArrowSerializationOptions`.
957    ///
958    /// Note that all the setters affecting `output_format_serialization_options` are
959    /// mutually exclusive.
960    pub fn set_arrow_serialization_options<
961        T: std::convert::Into<
962                std::boxed::Box<
963                    crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
964                >,
965            >,
966    >(
967        mut self,
968        v: T,
969    ) -> Self {
970        self.output_format_serialization_options = std::option::Option::Some(
971            crate::write::generated::gapic_storage::model::read_rows_request::OutputFormatSerializationOptions::ArrowSerializationOptions(
972                v.into()
973            )
974        );
975        self
976    }
977}
978
979impl wkt::message::Message for ReadRowsRequest {
980    fn typename() -> &'static str {
981        "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadRowsRequest"
982    }
983}
984
985/// Defines additional types related to [ReadRowsRequest].
986pub mod read_rows_request {
987    #[allow(unused_imports)]
988    use super::*;
989
990    /// Specifies output serialization options. Only job _default streams are
991    /// supported.
992    ///
993    /// This feature is not yet available.
994    #[derive(Clone, Debug, PartialEq)]
995    #[non_exhaustive]
996    pub enum OutputFormatSerializationOptions {
997        /// Optional. Options specific to the Apache Arrow output format.
998        ///
999        /// This feature is not yet available.
1000        ArrowSerializationOptions(
1001            std::boxed::Box<
1002                crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
1003            >,
1004        ),
1005    }
1006
1007    impl OutputFormatSerializationOptions {
1008        /// Initializes the enum to the [ArrowSerializationOptions](Self::ArrowSerializationOptions) branch.
1009        pub fn from_arrow_serialization_options(
1010            value: impl std::convert::Into<
1011                std::boxed::Box<
1012                    crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
1013                >,
1014            >,
1015        ) -> Self {
1016            Self::ArrowSerializationOptions(value.into())
1017        }
1018    }
1019}
1020
1021/// Information on if the current connection is being throttled.
1022#[derive(Clone, Default, PartialEq)]
1023#[non_exhaustive]
1024pub struct ThrottleState {
1025    /// How much this connection is being throttled. Zero means no throttling,
1026    /// 100 means fully throttled.
1027    pub throttle_percent: i32,
1028
1029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1030}
1031
1032impl ThrottleState {
1033    /// Creates a new default instance.
1034    pub fn new() -> Self {
1035        std::default::Default::default()
1036    }
1037
1038    /// Sets the value of [throttle_percent][crate::write::generated::gapic_storage::model::ThrottleState::throttle_percent].
1039    pub fn set_throttle_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1040        self.throttle_percent = v.into();
1041        self
1042    }
1043}
1044
1045impl wkt::message::Message for ThrottleState {
1046    fn typename() -> &'static str {
1047        "type.googleapis.com/google.cloud.bigquery.storage.v1.ThrottleState"
1048    }
1049}
1050
1051/// Estimated stream statistics for a given read Stream.
1052#[derive(Clone, Default, PartialEq)]
1053#[non_exhaustive]
1054pub struct StreamStats {
1055    /// Represents the progress of the current stream.
1056    pub progress:
1057        std::option::Option<crate::write::generated::gapic_storage::model::stream_stats::Progress>,
1058
1059    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1060}
1061
1062impl StreamStats {
1063    /// Creates a new default instance.
1064    pub fn new() -> Self {
1065        std::default::Default::default()
1066    }
1067
1068    /// Sets the value of [progress][crate::write::generated::gapic_storage::model::StreamStats::progress].
1069    pub fn set_progress<T>(mut self, v: T) -> Self
1070    where
1071        T: std::convert::Into<
1072                crate::write::generated::gapic_storage::model::stream_stats::Progress,
1073            >,
1074    {
1075        self.progress = std::option::Option::Some(v.into());
1076        self
1077    }
1078
1079    /// Sets or clears the value of [progress][crate::write::generated::gapic_storage::model::StreamStats::progress].
1080    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
1081    where
1082        T: std::convert::Into<
1083                crate::write::generated::gapic_storage::model::stream_stats::Progress,
1084            >,
1085    {
1086        self.progress = v.map(|x| x.into());
1087        self
1088    }
1089}
1090
1091impl wkt::message::Message for StreamStats {
1092    fn typename() -> &'static str {
1093        "type.googleapis.com/google.cloud.bigquery.storage.v1.StreamStats"
1094    }
1095}
1096
1097/// Defines additional types related to [StreamStats].
1098pub mod stream_stats {
1099    #[allow(unused_imports)]
1100    use super::*;
1101
1102    #[allow(missing_docs)]
1103    #[derive(Clone, Default, PartialEq)]
1104    #[non_exhaustive]
1105    pub struct Progress {
1106        /// The fraction of rows assigned to the stream that have been processed by
1107        /// the server so far, not including the rows in the current response
1108        /// message.
1109        ///
1110        /// This value, along with `at_response_end`, can be used to interpolate
1111        /// the progress made as the rows in the message are being processed using
1112        /// the following formula: `at_response_start + (at_response_end -
1113        /// at_response_start) * rows_processed_from_response / rows_in_response`.
1114        ///
1115        /// Note that if a filter is provided, the `at_response_end` value of the
1116        /// previous response may not necessarily be equal to the
1117        /// `at_response_start` value of the current response.
1118        pub at_response_start: f64,
1119
1120        /// Similar to `at_response_start`, except that this value includes the
1121        /// rows in the current response.
1122        pub at_response_end: f64,
1123
1124        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1125    }
1126
1127    impl Progress {
1128        /// Creates a new default instance.
1129        pub fn new() -> Self {
1130            std::default::Default::default()
1131        }
1132
1133        /// Sets the value of [at_response_start][crate::write::generated::gapic_storage::model::stream_stats::Progress::at_response_start].
1134        pub fn set_at_response_start<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1135            self.at_response_start = v.into();
1136            self
1137        }
1138
1139        /// Sets the value of [at_response_end][crate::write::generated::gapic_storage::model::stream_stats::Progress::at_response_end].
1140        pub fn set_at_response_end<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1141            self.at_response_end = v.into();
1142            self
1143        }
1144    }
1145
1146    impl wkt::message::Message for Progress {
1147        fn typename() -> &'static str {
1148            "type.googleapis.com/google.cloud.bigquery.storage.v1.StreamStats.Progress"
1149        }
1150    }
1151}
1152
1153/// Response from calling `ReadRows` may include row data, progress and
1154/// throttling information.
1155#[derive(Clone, Default, PartialEq)]
1156#[non_exhaustive]
1157pub struct ReadRowsResponse {
1158    /// Number of serialized rows in the rows block.
1159    pub row_count: i64,
1160
1161    /// Statistics for the stream.
1162    pub stats: std::option::Option<crate::write::generated::gapic_storage::model::StreamStats>,
1163
1164    /// Throttling state. If unset, the latest response still describes
1165    /// the current throttling status.
1166    pub throttle_state:
1167        std::option::Option<crate::write::generated::gapic_storage::model::ThrottleState>,
1168
1169    /// Optional. If the row data in this ReadRowsResponse is compressed, then
1170    /// uncompressed byte size is the original size of the uncompressed row data.
1171    /// If it is set to a value greater than 0, then decompress into a buffer of
1172    /// size uncompressed_byte_size using the compression codec that was requested
1173    /// during session creation time and which is specified in
1174    /// TableReadOptions.response_compression_codec in ReadSession.
1175    /// This value is not set if no response_compression_codec was not requested
1176    /// and it is -1 if the requested compression would not have reduced the size
1177    /// of this ReadRowsResponse's row data. This attempts to match Apache Arrow's
1178    /// behavior described here <https://github.com/apache/arrow/issues/15102> where
1179    /// the uncompressed length may be set to -1 to indicate that the data that
1180    /// follows is not compressed, which can be useful for cases where compression
1181    /// does not yield appreciable savings. When uncompressed_byte_size is not
1182    /// greater than 0, the client should skip decompression.
1183    pub uncompressed_byte_size: std::option::Option<i64>,
1184
1185    /// Output only. The total estimated number of rows in the query results.
1186    /// Only populated when reading data from a BigQuery job.
1187    ///
1188    /// This feature is not yet available.
1189    pub total_estimated_row_count: std::option::Option<i64>,
1190
1191    /// Row data is returned in format specified during session creation.
1192    pub rows: std::option::Option<
1193        crate::write::generated::gapic_storage::model::read_rows_response::Rows,
1194    >,
1195
1196    /// The schema for the read. If read_options.selected_fields is set, the
1197    /// schema may be different from the table schema as it will only contain
1198    /// the selected fields. This schema is equivalent to the one returned by
1199    /// CreateSession. This field is only populated in the first ReadRowsResponse
1200    /// RPC.
1201    pub schema: std::option::Option<
1202        crate::write::generated::gapic_storage::model::read_rows_response::Schema,
1203    >,
1204
1205    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1206}
1207
1208impl ReadRowsResponse {
1209    /// Creates a new default instance.
1210    pub fn new() -> Self {
1211        std::default::Default::default()
1212    }
1213
1214    /// Sets the value of [row_count][crate::write::generated::gapic_storage::model::ReadRowsResponse::row_count].
1215    pub fn set_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1216        self.row_count = v.into();
1217        self
1218    }
1219
1220    /// Sets the value of [stats][crate::write::generated::gapic_storage::model::ReadRowsResponse::stats].
1221    pub fn set_stats<T>(mut self, v: T) -> Self
1222    where
1223        T: std::convert::Into<crate::write::generated::gapic_storage::model::StreamStats>,
1224    {
1225        self.stats = std::option::Option::Some(v.into());
1226        self
1227    }
1228
1229    /// Sets or clears the value of [stats][crate::write::generated::gapic_storage::model::ReadRowsResponse::stats].
1230    pub fn set_or_clear_stats<T>(mut self, v: std::option::Option<T>) -> Self
1231    where
1232        T: std::convert::Into<crate::write::generated::gapic_storage::model::StreamStats>,
1233    {
1234        self.stats = v.map(|x| x.into());
1235        self
1236    }
1237
1238    /// Sets the value of [throttle_state][crate::write::generated::gapic_storage::model::ReadRowsResponse::throttle_state].
1239    pub fn set_throttle_state<T>(mut self, v: T) -> Self
1240    where
1241        T: std::convert::Into<crate::write::generated::gapic_storage::model::ThrottleState>,
1242    {
1243        self.throttle_state = std::option::Option::Some(v.into());
1244        self
1245    }
1246
1247    /// Sets or clears the value of [throttle_state][crate::write::generated::gapic_storage::model::ReadRowsResponse::throttle_state].
1248    pub fn set_or_clear_throttle_state<T>(mut self, v: std::option::Option<T>) -> Self
1249    where
1250        T: std::convert::Into<crate::write::generated::gapic_storage::model::ThrottleState>,
1251    {
1252        self.throttle_state = v.map(|x| x.into());
1253        self
1254    }
1255
1256    /// Sets the value of [uncompressed_byte_size][crate::write::generated::gapic_storage::model::ReadRowsResponse::uncompressed_byte_size].
1257    pub fn set_uncompressed_byte_size<T>(mut self, v: T) -> Self
1258    where
1259        T: std::convert::Into<i64>,
1260    {
1261        self.uncompressed_byte_size = std::option::Option::Some(v.into());
1262        self
1263    }
1264
1265    /// Sets or clears the value of [uncompressed_byte_size][crate::write::generated::gapic_storage::model::ReadRowsResponse::uncompressed_byte_size].
1266    pub fn set_or_clear_uncompressed_byte_size<T>(mut self, v: std::option::Option<T>) -> Self
1267    where
1268        T: std::convert::Into<i64>,
1269    {
1270        self.uncompressed_byte_size = v.map(|x| x.into());
1271        self
1272    }
1273
1274    /// Sets the value of [total_estimated_row_count][crate::write::generated::gapic_storage::model::ReadRowsResponse::total_estimated_row_count].
1275    pub fn set_total_estimated_row_count<T>(mut self, v: T) -> Self
1276    where
1277        T: std::convert::Into<i64>,
1278    {
1279        self.total_estimated_row_count = std::option::Option::Some(v.into());
1280        self
1281    }
1282
1283    /// Sets or clears the value of [total_estimated_row_count][crate::write::generated::gapic_storage::model::ReadRowsResponse::total_estimated_row_count].
1284    pub fn set_or_clear_total_estimated_row_count<T>(mut self, v: std::option::Option<T>) -> Self
1285    where
1286        T: std::convert::Into<i64>,
1287    {
1288        self.total_estimated_row_count = v.map(|x| x.into());
1289        self
1290    }
1291
1292    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::ReadRowsResponse::rows].
1293    ///
1294    /// Note that all the setters affecting `rows` are mutually
1295    /// exclusive.
1296    pub fn set_rows<
1297        T: std::convert::Into<
1298                std::option::Option<
1299                    crate::write::generated::gapic_storage::model::read_rows_response::Rows,
1300                >,
1301            >,
1302    >(
1303        mut self,
1304        v: T,
1305    ) -> Self {
1306        self.rows = v.into();
1307        self
1308    }
1309
1310    /// The value of [rows][crate::write::generated::gapic_storage::model::ReadRowsResponse::rows]
1311    /// if it holds a `AvroRows`, `None` if the field is not set or
1312    /// holds a different branch.
1313    pub fn avro_rows(
1314        &self,
1315    ) -> std::option::Option<
1316        &std::boxed::Box<crate::write::generated::gapic_storage::model::AvroRows>,
1317    > {
1318        #[allow(unreachable_patterns)]
1319        self.rows.as_ref().and_then(|v| match v {
1320            crate::write::generated::gapic_storage::model::read_rows_response::Rows::AvroRows(
1321                v,
1322            ) => std::option::Option::Some(v),
1323            _ => std::option::Option::None,
1324        })
1325    }
1326
1327    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::ReadRowsResponse::rows]
1328    /// to hold a `AvroRows`.
1329    ///
1330    /// Note that all the setters affecting `rows` are
1331    /// mutually exclusive.
1332    pub fn set_avro_rows<
1333        T: std::convert::Into<
1334                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroRows>,
1335            >,
1336    >(
1337        mut self,
1338        v: T,
1339    ) -> Self {
1340        self.rows = std::option::Option::Some(
1341            crate::write::generated::gapic_storage::model::read_rows_response::Rows::AvroRows(
1342                v.into(),
1343            ),
1344        );
1345        self
1346    }
1347
1348    /// The value of [rows][crate::write::generated::gapic_storage::model::ReadRowsResponse::rows]
1349    /// if it holds a `ArrowRecordBatch`, `None` if the field is not set or
1350    /// holds a different branch.
1351    pub fn arrow_record_batch(
1352        &self,
1353    ) -> std::option::Option<
1354        &std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
1355    > {
1356        #[allow(unreachable_patterns)]
1357        self.rows.as_ref().and_then(|v| match v {
1358            crate::write::generated::gapic_storage::model::read_rows_response::Rows::ArrowRecordBatch(v) => std::option::Option::Some(v),
1359            _ => std::option::Option::None,
1360        })
1361    }
1362
1363    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::ReadRowsResponse::rows]
1364    /// to hold a `ArrowRecordBatch`.
1365    ///
1366    /// Note that all the setters affecting `rows` are
1367    /// mutually exclusive.
1368    pub fn set_arrow_record_batch<
1369        T: std::convert::Into<
1370                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
1371            >,
1372    >(
1373        mut self,
1374        v: T,
1375    ) -> Self {
1376        self.rows = std::option::Option::Some(
1377            crate::write::generated::gapic_storage::model::read_rows_response::Rows::ArrowRecordBatch(
1378                v.into()
1379            )
1380        );
1381        self
1382    }
1383
1384    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadRowsResponse::schema].
1385    ///
1386    /// Note that all the setters affecting `schema` are mutually
1387    /// exclusive.
1388    pub fn set_schema<
1389        T: std::convert::Into<
1390                std::option::Option<
1391                    crate::write::generated::gapic_storage::model::read_rows_response::Schema,
1392                >,
1393            >,
1394    >(
1395        mut self,
1396        v: T,
1397    ) -> Self {
1398        self.schema = v.into();
1399        self
1400    }
1401
1402    /// The value of [schema][crate::write::generated::gapic_storage::model::ReadRowsResponse::schema]
1403    /// if it holds a `AvroSchema`, `None` if the field is not set or
1404    /// holds a different branch.
1405    pub fn avro_schema(
1406        &self,
1407    ) -> std::option::Option<
1408        &std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
1409    > {
1410        #[allow(unreachable_patterns)]
1411        self.schema.as_ref().and_then(|v| match v {
1412            crate::write::generated::gapic_storage::model::read_rows_response::Schema::AvroSchema(v) => std::option::Option::Some(v),
1413            _ => std::option::Option::None,
1414        })
1415    }
1416
1417    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadRowsResponse::schema]
1418    /// to hold a `AvroSchema`.
1419    ///
1420    /// Note that all the setters affecting `schema` are
1421    /// mutually exclusive.
1422    pub fn set_avro_schema<
1423        T: std::convert::Into<
1424                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
1425            >,
1426    >(
1427        mut self,
1428        v: T,
1429    ) -> Self {
1430        self.schema = std::option::Option::Some(
1431            crate::write::generated::gapic_storage::model::read_rows_response::Schema::AvroSchema(
1432                v.into(),
1433            ),
1434        );
1435        self
1436    }
1437
1438    /// The value of [schema][crate::write::generated::gapic_storage::model::ReadRowsResponse::schema]
1439    /// if it holds a `ArrowSchema`, `None` if the field is not set or
1440    /// holds a different branch.
1441    pub fn arrow_schema(
1442        &self,
1443    ) -> std::option::Option<
1444        &std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
1445    > {
1446        #[allow(unreachable_patterns)]
1447        self.schema.as_ref().and_then(|v| match v {
1448            crate::write::generated::gapic_storage::model::read_rows_response::Schema::ArrowSchema(v) => std::option::Option::Some(v),
1449            _ => std::option::Option::None,
1450        })
1451    }
1452
1453    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadRowsResponse::schema]
1454    /// to hold a `ArrowSchema`.
1455    ///
1456    /// Note that all the setters affecting `schema` are
1457    /// mutually exclusive.
1458    pub fn set_arrow_schema<
1459        T: std::convert::Into<
1460                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
1461            >,
1462    >(
1463        mut self,
1464        v: T,
1465    ) -> Self {
1466        self.schema = std::option::Option::Some(
1467            crate::write::generated::gapic_storage::model::read_rows_response::Schema::ArrowSchema(
1468                v.into(),
1469            ),
1470        );
1471        self
1472    }
1473}
1474
1475impl wkt::message::Message for ReadRowsResponse {
1476    fn typename() -> &'static str {
1477        "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadRowsResponse"
1478    }
1479}
1480
1481/// Defines additional types related to [ReadRowsResponse].
1482pub mod read_rows_response {
1483    #[allow(unused_imports)]
1484    use super::*;
1485
1486    /// Row data is returned in format specified during session creation.
1487    #[derive(Clone, Debug, PartialEq)]
1488    #[non_exhaustive]
1489    pub enum Rows {
1490        /// Serialized row data in AVRO format.
1491        AvroRows(std::boxed::Box<crate::write::generated::gapic_storage::model::AvroRows>),
1492        /// Serialized row data in Arrow RecordBatch format.
1493        ArrowRecordBatch(
1494            std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
1495        ),
1496    }
1497
1498    impl Rows {
1499        /// Initializes the enum to the [AvroRows](Self::AvroRows) branch.
1500        pub fn from_avro_rows(
1501            value: impl std::convert::Into<
1502                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroRows>,
1503            >,
1504        ) -> Self {
1505            Self::AvroRows(value.into())
1506        }
1507        /// Initializes the enum to the [ArrowRecordBatch](Self::ArrowRecordBatch) branch.
1508        pub fn from_arrow_record_batch(
1509            value: impl std::convert::Into<
1510                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
1511            >,
1512        ) -> Self {
1513            Self::ArrowRecordBatch(value.into())
1514        }
1515    }
1516
1517    /// The schema for the read. If read_options.selected_fields is set, the
1518    /// schema may be different from the table schema as it will only contain
1519    /// the selected fields. This schema is equivalent to the one returned by
1520    /// CreateSession. This field is only populated in the first ReadRowsResponse
1521    /// RPC.
1522    #[derive(Clone, Debug, PartialEq)]
1523    #[non_exhaustive]
1524    pub enum Schema {
1525        /// Output only. Avro schema.
1526        AvroSchema(std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>),
1527        /// Output only. Arrow schema.
1528        ArrowSchema(std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>),
1529    }
1530
1531    impl Schema {
1532        /// Initializes the enum to the [AvroSchema](Self::AvroSchema) branch.
1533        pub fn from_avro_schema(
1534            value: impl std::convert::Into<
1535                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
1536            >,
1537        ) -> Self {
1538            Self::AvroSchema(value.into())
1539        }
1540        /// Initializes the enum to the [ArrowSchema](Self::ArrowSchema) branch.
1541        pub fn from_arrow_schema(
1542            value: impl std::convert::Into<
1543                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
1544            >,
1545        ) -> Self {
1546            Self::ArrowSchema(value.into())
1547        }
1548    }
1549}
1550
1551/// Request message for `SplitReadStream`.
1552#[derive(Clone, Default, PartialEq)]
1553#[non_exhaustive]
1554pub struct SplitReadStreamRequest {
1555    /// Required. Name of the stream to split.
1556    pub name: std::string::String,
1557
1558    /// A value in the range (0.0, 1.0) that specifies the fractional point at
1559    /// which the original stream should be split. The actual split point is
1560    /// evaluated on pre-filtered rows, so if a filter is provided, then there is
1561    /// no guarantee that the division of the rows between the new child streams
1562    /// will be proportional to this fractional value. Additionally, because the
1563    /// server-side unit for assigning data is collections of rows, this fraction
1564    /// will always map to a data storage boundary on the server side.
1565    pub fraction: f64,
1566
1567    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1568}
1569
1570impl SplitReadStreamRequest {
1571    /// Creates a new default instance.
1572    pub fn new() -> Self {
1573        std::default::Default::default()
1574    }
1575
1576    /// Sets the value of [name][crate::write::generated::gapic_storage::model::SplitReadStreamRequest::name].
1577    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1578        self.name = v.into();
1579        self
1580    }
1581
1582    /// Sets the value of [fraction][crate::write::generated::gapic_storage::model::SplitReadStreamRequest::fraction].
1583    pub fn set_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1584        self.fraction = v.into();
1585        self
1586    }
1587}
1588
1589impl wkt::message::Message for SplitReadStreamRequest {
1590    fn typename() -> &'static str {
1591        "type.googleapis.com/google.cloud.bigquery.storage.v1.SplitReadStreamRequest"
1592    }
1593}
1594
1595/// Response message for `SplitReadStream`.
1596#[derive(Clone, Default, PartialEq)]
1597#[non_exhaustive]
1598pub struct SplitReadStreamResponse {
1599    /// Primary stream, which contains the beginning portion of
1600    /// |original_stream|. An empty value indicates that the original stream can no
1601    /// longer be split.
1602    pub primary_stream:
1603        std::option::Option<crate::write::generated::gapic_storage::model::ReadStream>,
1604
1605    /// Remainder stream, which contains the tail of |original_stream|. An empty
1606    /// value indicates that the original stream can no longer be split.
1607    pub remainder_stream:
1608        std::option::Option<crate::write::generated::gapic_storage::model::ReadStream>,
1609
1610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1611}
1612
1613impl SplitReadStreamResponse {
1614    /// Creates a new default instance.
1615    pub fn new() -> Self {
1616        std::default::Default::default()
1617    }
1618
1619    /// Sets the value of [primary_stream][crate::write::generated::gapic_storage::model::SplitReadStreamResponse::primary_stream].
1620    pub fn set_primary_stream<T>(mut self, v: T) -> Self
1621    where
1622        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadStream>,
1623    {
1624        self.primary_stream = std::option::Option::Some(v.into());
1625        self
1626    }
1627
1628    /// Sets or clears the value of [primary_stream][crate::write::generated::gapic_storage::model::SplitReadStreamResponse::primary_stream].
1629    pub fn set_or_clear_primary_stream<T>(mut self, v: std::option::Option<T>) -> Self
1630    where
1631        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadStream>,
1632    {
1633        self.primary_stream = v.map(|x| x.into());
1634        self
1635    }
1636
1637    /// Sets the value of [remainder_stream][crate::write::generated::gapic_storage::model::SplitReadStreamResponse::remainder_stream].
1638    pub fn set_remainder_stream<T>(mut self, v: T) -> Self
1639    where
1640        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadStream>,
1641    {
1642        self.remainder_stream = std::option::Option::Some(v.into());
1643        self
1644    }
1645
1646    /// Sets or clears the value of [remainder_stream][crate::write::generated::gapic_storage::model::SplitReadStreamResponse::remainder_stream].
1647    pub fn set_or_clear_remainder_stream<T>(mut self, v: std::option::Option<T>) -> Self
1648    where
1649        T: std::convert::Into<crate::write::generated::gapic_storage::model::ReadStream>,
1650    {
1651        self.remainder_stream = v.map(|x| x.into());
1652        self
1653    }
1654}
1655
1656impl wkt::message::Message for SplitReadStreamResponse {
1657    fn typename() -> &'static str {
1658        "type.googleapis.com/google.cloud.bigquery.storage.v1.SplitReadStreamResponse"
1659    }
1660}
1661
1662/// Request message for `CreateWriteStream`.
1663#[derive(Clone, Default, PartialEq)]
1664#[non_exhaustive]
1665pub struct CreateWriteStreamRequest {
1666    /// Required. Reference to the table to which the stream belongs, in the format
1667    /// of `projects/{project}/datasets/{dataset}/tables/{table}`.
1668    pub parent: std::string::String,
1669
1670    /// Required. Stream to be created.
1671    pub write_stream:
1672        std::option::Option<crate::write::generated::gapic_storage::model::WriteStream>,
1673
1674    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1675}
1676
1677impl CreateWriteStreamRequest {
1678    /// Creates a new default instance.
1679    pub fn new() -> Self {
1680        std::default::Default::default()
1681    }
1682
1683    /// Sets the value of [parent][crate::write::generated::gapic_storage::model::CreateWriteStreamRequest::parent].
1684    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1685        self.parent = v.into();
1686        self
1687    }
1688
1689    /// Sets the value of [write_stream][crate::write::generated::gapic_storage::model::CreateWriteStreamRequest::write_stream].
1690    pub fn set_write_stream<T>(mut self, v: T) -> Self
1691    where
1692        T: std::convert::Into<crate::write::generated::gapic_storage::model::WriteStream>,
1693    {
1694        self.write_stream = std::option::Option::Some(v.into());
1695        self
1696    }
1697
1698    /// Sets or clears the value of [write_stream][crate::write::generated::gapic_storage::model::CreateWriteStreamRequest::write_stream].
1699    pub fn set_or_clear_write_stream<T>(mut self, v: std::option::Option<T>) -> Self
1700    where
1701        T: std::convert::Into<crate::write::generated::gapic_storage::model::WriteStream>,
1702    {
1703        self.write_stream = v.map(|x| x.into());
1704        self
1705    }
1706}
1707
1708impl wkt::message::Message for CreateWriteStreamRequest {
1709    fn typename() -> &'static str {
1710        "type.googleapis.com/google.cloud.bigquery.storage.v1.CreateWriteStreamRequest"
1711    }
1712}
1713
1714/// Request message for `AppendRows`.
1715///
1716/// Because AppendRows is a bidirectional streaming RPC, certain parts of the
1717/// AppendRowsRequest need only be specified for the first request before
1718/// switching table destinations. You can also switch table destinations within
1719/// the same connection for the default stream.
1720///
1721/// The size of a single AppendRowsRequest must be less than 20 MB in size.
1722/// Requests larger than this return an error, typically `INVALID_ARGUMENT`.
1723#[derive(Clone, Default, PartialEq)]
1724#[non_exhaustive]
1725pub struct AppendRowsRequest {
1726
1727    /// Required. The write_stream identifies the append operation. It must be
1728    /// provided in the following scenarios:
1729    ///
1730    /// * In the first request to an AppendRows connection.
1731    ///
1732    /// * In all subsequent requests to an AppendRows connection, if you use the
1733    ///   same connection to write to multiple tables or change the input schema for
1734    ///   default streams.
1735    ///
1736    ///
1737    /// For explicitly created write streams, the format is:
1738    ///
1739    /// * `projects/{project}/datasets/{dataset}/tables/{table}/streams/{id}`
1740    ///
1741    /// For the special default stream, the format is:
1742    ///
1743    /// * `projects/{project}/datasets/{dataset}/tables/{table}/streams/_default`.
1744    ///
1745    /// An example of a possible sequence of requests with write_stream fields
1746    /// within a single connection:
1747    ///
1748    /// * r1: {write_stream: stream_name_1}
1749    ///
1750    /// * r2: {write_stream: /*omit*/}
1751    ///
1752    /// * r3: {write_stream: /*omit*/}
1753    ///
1754    /// * r4: {write_stream: stream_name_2}
1755    ///
1756    /// * r5: {write_stream: stream_name_2}
1757    ///
1758    ///
1759    /// The destination changed in request_4, so the write_stream field must be
1760    /// populated in all subsequent requests in this stream.
1761    pub write_stream: std::string::String,
1762
1763    /// If present, the write is only performed if the next append offset is same
1764    /// as the provided value. If not present, the write is performed at the
1765    /// current end of stream. Specifying a value for this field is not allowed
1766    /// when calling AppendRows for the '_default' stream.
1767    pub offset: std::option::Option<wkt::Int64Value>,
1768
1769    /// Id set by client to annotate its identity. Only initial request setting is
1770    /// respected.
1771    pub trace_id: std::string::String,
1772
1773    /// A map to indicate how to interpret missing value for some fields. Missing
1774    /// values are fields present in user schema but missing in rows. The key is
1775    /// the field name. The value is the interpretation of missing values for the
1776    /// field.
1777    ///
1778    /// For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all
1779    /// missing values in field foo are interpreted as NULL, all missing values in
1780    /// field bar are interpreted as the default value of field bar in table
1781    /// schema.
1782    ///
1783    /// If a field is not in this map and has missing values, the missing values
1784    /// in this field are interpreted as NULL.
1785    ///
1786    /// This field only applies to the current request, it won't affect other
1787    /// requests on the connection.
1788    ///
1789    /// Currently, field name can only be top-level column name, can't be a struct
1790    /// field path like 'foo.bar'.
1791    pub missing_value_interpretations: std::collections::HashMap<std::string::String,crate::write::generated::gapic_storage::model::append_rows_request::MissingValueInterpretation>,
1792
1793    /// Optional. Default missing value interpretation for all columns in the
1794    /// table. When a value is specified on an `AppendRowsRequest`, it is applied
1795    /// to all requests from that point forward, until a subsequent
1796    /// `AppendRowsRequest` sets it to a different value.
1797    /// `missing_value_interpretation` can override
1798    /// `default_missing_value_interpretation`. For example, if you want to write
1799    /// `NULL` instead of using default values for some columns, you can set
1800    /// `default_missing_value_interpretation` to `DEFAULT_VALUE` and at the same
1801    /// time, set `missing_value_interpretations` to `NULL_VALUE` on those columns.
1802    pub default_missing_value_interpretation: crate::write::generated::gapic_storage::model::append_rows_request::MissingValueInterpretation,
1803
1804    /// Optional. Stats and telemetry data gathered on the client side.
1805    pub client_stats: std::option::Option<crate::write::generated::gapic_storage::model::ClientStats>,
1806
1807    /// Input rows. The `writer_schema` field must be specified at the initial
1808    /// request and currently, it will be ignored if specified in following
1809    /// requests. Following requests must have data in the same format as the
1810    /// initial request.
1811    pub rows: std::option::Option<crate::write::generated::gapic_storage::model::append_rows_request::Rows>,
1812
1813    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1814}
1815
1816impl AppendRowsRequest {
1817    /// Creates a new default instance.
1818    pub fn new() -> Self {
1819        std::default::Default::default()
1820    }
1821
1822    /// Sets the value of [write_stream][crate::write::generated::gapic_storage::model::AppendRowsRequest::write_stream].
1823    pub fn set_write_stream<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1824        self.write_stream = v.into();
1825        self
1826    }
1827
1828    /// Sets the value of [offset][crate::write::generated::gapic_storage::model::AppendRowsRequest::offset].
1829    pub fn set_offset<T>(mut self, v: T) -> Self
1830    where
1831        T: std::convert::Into<wkt::Int64Value>,
1832    {
1833        self.offset = std::option::Option::Some(v.into());
1834        self
1835    }
1836
1837    /// Sets or clears the value of [offset][crate::write::generated::gapic_storage::model::AppendRowsRequest::offset].
1838    pub fn set_or_clear_offset<T>(mut self, v: std::option::Option<T>) -> Self
1839    where
1840        T: std::convert::Into<wkt::Int64Value>,
1841    {
1842        self.offset = v.map(|x| x.into());
1843        self
1844    }
1845
1846    /// Sets the value of [trace_id][crate::write::generated::gapic_storage::model::AppendRowsRequest::trace_id].
1847    pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1848        self.trace_id = v.into();
1849        self
1850    }
1851
1852    /// Sets the value of [missing_value_interpretations][crate::write::generated::gapic_storage::model::AppendRowsRequest::missing_value_interpretations].
1853    pub fn set_missing_value_interpretations<T, K, V>(mut self, v: T) -> Self
1854    where
1855        T: std::iter::IntoIterator<Item = (K, V)>,
1856        K: std::convert::Into<std::string::String>,
1857        V: std::convert::Into<crate::write::generated::gapic_storage::model::append_rows_request::MissingValueInterpretation>,
1858    {
1859        use std::iter::Iterator;
1860        self.missing_value_interpretations =
1861            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1862        self
1863    }
1864
1865    /// Sets the value of [default_missing_value_interpretation][crate::write::generated::gapic_storage::model::AppendRowsRequest::default_missing_value_interpretation].
1866    pub fn set_default_missing_value_interpretation<T: std::convert::Into<crate::write::generated::gapic_storage::model::append_rows_request::MissingValueInterpretation>>(mut self, v: T) -> Self{
1867        self.default_missing_value_interpretation = v.into();
1868        self
1869    }
1870
1871    /// Sets the value of [client_stats][crate::write::generated::gapic_storage::model::AppendRowsRequest::client_stats].
1872    pub fn set_client_stats<T>(mut self, v: T) -> Self
1873    where
1874        T: std::convert::Into<crate::write::generated::gapic_storage::model::ClientStats>,
1875    {
1876        self.client_stats = std::option::Option::Some(v.into());
1877        self
1878    }
1879
1880    /// Sets or clears the value of [client_stats][crate::write::generated::gapic_storage::model::AppendRowsRequest::client_stats].
1881    pub fn set_or_clear_client_stats<T>(mut self, v: std::option::Option<T>) -> Self
1882    where
1883        T: std::convert::Into<crate::write::generated::gapic_storage::model::ClientStats>,
1884    {
1885        self.client_stats = v.map(|x| x.into());
1886        self
1887    }
1888
1889    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::AppendRowsRequest::rows].
1890    ///
1891    /// Note that all the setters affecting `rows` are mutually
1892    /// exclusive.
1893    pub fn set_rows<
1894        T: std::convert::Into<
1895                std::option::Option<
1896                    crate::write::generated::gapic_storage::model::append_rows_request::Rows,
1897                >,
1898            >,
1899    >(
1900        mut self,
1901        v: T,
1902    ) -> Self {
1903        self.rows = v.into();
1904        self
1905    }
1906
1907    /// The value of [rows][crate::write::generated::gapic_storage::model::AppendRowsRequest::rows]
1908    /// if it holds a `ProtoRows`, `None` if the field is not set or
1909    /// holds a different branch.
1910    pub fn proto_rows(
1911        &self,
1912    ) -> std::option::Option<
1913        &std::boxed::Box<
1914            crate::write::generated::gapic_storage::model::append_rows_request::ProtoData,
1915        >,
1916    > {
1917        #[allow(unreachable_patterns)]
1918        self.rows.as_ref().and_then(|v| match v {
1919            crate::write::generated::gapic_storage::model::append_rows_request::Rows::ProtoRows(
1920                v,
1921            ) => std::option::Option::Some(v),
1922            _ => std::option::Option::None,
1923        })
1924    }
1925
1926    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::AppendRowsRequest::rows]
1927    /// to hold a `ProtoRows`.
1928    ///
1929    /// Note that all the setters affecting `rows` are
1930    /// mutually exclusive.
1931    pub fn set_proto_rows<
1932        T: std::convert::Into<
1933                std::boxed::Box<
1934                    crate::write::generated::gapic_storage::model::append_rows_request::ProtoData,
1935                >,
1936            >,
1937    >(
1938        mut self,
1939        v: T,
1940    ) -> Self {
1941        self.rows = std::option::Option::Some(
1942            crate::write::generated::gapic_storage::model::append_rows_request::Rows::ProtoRows(
1943                v.into(),
1944            ),
1945        );
1946        self
1947    }
1948
1949    /// The value of [rows][crate::write::generated::gapic_storage::model::AppendRowsRequest::rows]
1950    /// if it holds a `ArrowRows`, `None` if the field is not set or
1951    /// holds a different branch.
1952    pub fn arrow_rows(
1953        &self,
1954    ) -> std::option::Option<
1955        &std::boxed::Box<
1956            crate::write::generated::gapic_storage::model::append_rows_request::ArrowData,
1957        >,
1958    > {
1959        #[allow(unreachable_patterns)]
1960        self.rows.as_ref().and_then(|v| match v {
1961            crate::write::generated::gapic_storage::model::append_rows_request::Rows::ArrowRows(
1962                v,
1963            ) => std::option::Option::Some(v),
1964            _ => std::option::Option::None,
1965        })
1966    }
1967
1968    /// Sets the value of [rows][crate::write::generated::gapic_storage::model::AppendRowsRequest::rows]
1969    /// to hold a `ArrowRows`.
1970    ///
1971    /// Note that all the setters affecting `rows` are
1972    /// mutually exclusive.
1973    pub fn set_arrow_rows<
1974        T: std::convert::Into<
1975                std::boxed::Box<
1976                    crate::write::generated::gapic_storage::model::append_rows_request::ArrowData,
1977                >,
1978            >,
1979    >(
1980        mut self,
1981        v: T,
1982    ) -> Self {
1983        self.rows = std::option::Option::Some(
1984            crate::write::generated::gapic_storage::model::append_rows_request::Rows::ArrowRows(
1985                v.into(),
1986            ),
1987        );
1988        self
1989    }
1990}
1991
1992impl wkt::message::Message for AppendRowsRequest {
1993    fn typename() -> &'static str {
1994        "type.googleapis.com/google.cloud.bigquery.storage.v1.AppendRowsRequest"
1995    }
1996}
1997
1998/// Defines additional types related to [AppendRowsRequest].
1999pub mod append_rows_request {
2000    #[allow(unused_imports)]
2001    use super::*;
2002
2003    /// Arrow schema and data.
2004    #[derive(Clone, Default, PartialEq)]
2005    #[non_exhaustive]
2006    pub struct ArrowData {
2007        /// Optional. Arrow Schema used to serialize the data.
2008        pub writer_schema:
2009            std::option::Option<crate::write::generated::gapic_storage::model::ArrowSchema>,
2010
2011        /// Required. Serialized row data in Arrow format.
2012        pub rows:
2013            std::option::Option<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
2014
2015        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2016    }
2017
2018    impl ArrowData {
2019        /// Creates a new default instance.
2020        pub fn new() -> Self {
2021            std::default::Default::default()
2022        }
2023
2024        /// Sets the value of [writer_schema][crate::write::generated::gapic_storage::model::append_rows_request::ArrowData::writer_schema].
2025        pub fn set_writer_schema<T>(mut self, v: T) -> Self
2026        where
2027            T: std::convert::Into<crate::write::generated::gapic_storage::model::ArrowSchema>,
2028        {
2029            self.writer_schema = std::option::Option::Some(v.into());
2030            self
2031        }
2032
2033        /// Sets or clears the value of [writer_schema][crate::write::generated::gapic_storage::model::append_rows_request::ArrowData::writer_schema].
2034        pub fn set_or_clear_writer_schema<T>(mut self, v: std::option::Option<T>) -> Self
2035        where
2036            T: std::convert::Into<crate::write::generated::gapic_storage::model::ArrowSchema>,
2037        {
2038            self.writer_schema = v.map(|x| x.into());
2039            self
2040        }
2041
2042        /// Sets the value of [rows][crate::write::generated::gapic_storage::model::append_rows_request::ArrowData::rows].
2043        pub fn set_rows<T>(mut self, v: T) -> Self
2044        where
2045            T: std::convert::Into<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
2046        {
2047            self.rows = std::option::Option::Some(v.into());
2048            self
2049        }
2050
2051        /// Sets or clears the value of [rows][crate::write::generated::gapic_storage::model::append_rows_request::ArrowData::rows].
2052        pub fn set_or_clear_rows<T>(mut self, v: std::option::Option<T>) -> Self
2053        where
2054            T: std::convert::Into<crate::write::generated::gapic_storage::model::ArrowRecordBatch>,
2055        {
2056            self.rows = v.map(|x| x.into());
2057            self
2058        }
2059    }
2060
2061    impl wkt::message::Message for ArrowData {
2062        fn typename() -> &'static str {
2063            "type.googleapis.com/google.cloud.bigquery.storage.v1.AppendRowsRequest.ArrowData"
2064        }
2065    }
2066
2067    /// ProtoData contains the data rows and schema when constructing append
2068    /// requests.
2069    #[derive(Clone, Default, PartialEq)]
2070    #[non_exhaustive]
2071    pub struct ProtoData {
2072        /// Optional. The protocol buffer schema used to serialize the data. Provide
2073        /// this value whenever:
2074        ///
2075        /// * You send the first request of an RPC connection.
2076        ///
2077        /// * You change the input schema.
2078        ///
2079        /// * You specify a new destination table.
2080        ///
2081        pub writer_schema:
2082            std::option::Option<crate::write::generated::gapic_storage::model::ProtoSchema>,
2083
2084        /// Required. Serialized row data in protobuf message format.
2085        /// Currently, the backend expects the serialized rows to adhere to
2086        /// proto2 semantics when appending rows, particularly with respect to
2087        /// how default values are encoded.
2088        pub rows: std::option::Option<crate::write::generated::gapic_storage::model::ProtoRows>,
2089
2090        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2091    }
2092
2093    impl ProtoData {
2094        /// Creates a new default instance.
2095        pub fn new() -> Self {
2096            std::default::Default::default()
2097        }
2098
2099        /// Sets the value of [writer_schema][crate::write::generated::gapic_storage::model::append_rows_request::ProtoData::writer_schema].
2100        pub fn set_writer_schema<T>(mut self, v: T) -> Self
2101        where
2102            T: std::convert::Into<crate::write::generated::gapic_storage::model::ProtoSchema>,
2103        {
2104            self.writer_schema = std::option::Option::Some(v.into());
2105            self
2106        }
2107
2108        /// Sets or clears the value of [writer_schema][crate::write::generated::gapic_storage::model::append_rows_request::ProtoData::writer_schema].
2109        pub fn set_or_clear_writer_schema<T>(mut self, v: std::option::Option<T>) -> Self
2110        where
2111            T: std::convert::Into<crate::write::generated::gapic_storage::model::ProtoSchema>,
2112        {
2113            self.writer_schema = v.map(|x| x.into());
2114            self
2115        }
2116
2117        /// Sets the value of [rows][crate::write::generated::gapic_storage::model::append_rows_request::ProtoData::rows].
2118        pub fn set_rows<T>(mut self, v: T) -> Self
2119        where
2120            T: std::convert::Into<crate::write::generated::gapic_storage::model::ProtoRows>,
2121        {
2122            self.rows = std::option::Option::Some(v.into());
2123            self
2124        }
2125
2126        /// Sets or clears the value of [rows][crate::write::generated::gapic_storage::model::append_rows_request::ProtoData::rows].
2127        pub fn set_or_clear_rows<T>(mut self, v: std::option::Option<T>) -> Self
2128        where
2129            T: std::convert::Into<crate::write::generated::gapic_storage::model::ProtoRows>,
2130        {
2131            self.rows = v.map(|x| x.into());
2132            self
2133        }
2134    }
2135
2136    impl wkt::message::Message for ProtoData {
2137        fn typename() -> &'static str {
2138            "type.googleapis.com/google.cloud.bigquery.storage.v1.AppendRowsRequest.ProtoData"
2139        }
2140    }
2141
2142    /// An enum to indicate how to interpret missing values of fields that are
2143    /// present in user schema but missing in rows. A missing value can represent a
2144    /// NULL or a column default value defined in BigQuery table schema.
2145    ///
2146    /// # Working with unknown values
2147    ///
2148    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2149    /// additional enum variants at any time. Adding new variants is not considered
2150    /// a breaking change. Applications should write their code in anticipation of:
2151    ///
2152    /// - New values appearing in future releases of the client library, **and**
2153    /// - New values received dynamically, without application changes.
2154    ///
2155    /// Please consult the [Working with enums] section in the user guide for some
2156    /// guidelines.
2157    ///
2158    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2159    #[derive(Clone, Debug, PartialEq)]
2160    #[non_exhaustive]
2161    pub enum MissingValueInterpretation {
2162        /// Invalid missing value interpretation. Requests with this value will be
2163        /// rejected.
2164        Unspecified,
2165        /// Missing value is interpreted as NULL.
2166        NullValue,
2167        /// Missing value is interpreted as column default value if declared in the
2168        /// table schema, NULL otherwise.
2169        DefaultValue,
2170        /// If set, the enum was initialized with an unknown value.
2171        ///
2172        /// Applications can examine the value using [MissingValueInterpretation::value] or
2173        /// [MissingValueInterpretation::name].
2174        UnknownValue(missing_value_interpretation::UnknownValue),
2175    }
2176
2177    #[doc(hidden)]
2178    pub mod missing_value_interpretation {
2179        #[allow(unused_imports)]
2180        use super::*;
2181        #[derive(Clone, Debug, PartialEq)]
2182        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2183    }
2184
2185    impl MissingValueInterpretation {
2186        /// Gets the enum value.
2187        ///
2188        /// Returns `None` if the enum contains an unknown value deserialized from
2189        /// the string representation of enums.
2190        pub fn value(&self) -> std::option::Option<i32> {
2191            match self {
2192                Self::Unspecified => std::option::Option::Some(0),
2193                Self::NullValue => std::option::Option::Some(1),
2194                Self::DefaultValue => std::option::Option::Some(2),
2195                Self::UnknownValue(u) => u.0.value(),
2196            }
2197        }
2198
2199        /// Gets the enum value as a string.
2200        ///
2201        /// Returns `None` if the enum contains an unknown value deserialized from
2202        /// the integer representation of enums.
2203        pub fn name(&self) -> std::option::Option<&str> {
2204            match self {
2205                Self::Unspecified => {
2206                    std::option::Option::Some("MISSING_VALUE_INTERPRETATION_UNSPECIFIED")
2207                }
2208                Self::NullValue => std::option::Option::Some("NULL_VALUE"),
2209                Self::DefaultValue => std::option::Option::Some("DEFAULT_VALUE"),
2210                Self::UnknownValue(u) => u.0.name(),
2211            }
2212        }
2213    }
2214
2215    impl std::default::Default for MissingValueInterpretation {
2216        fn default() -> Self {
2217            use std::convert::From;
2218            Self::from(0)
2219        }
2220    }
2221
2222    impl std::fmt::Display for MissingValueInterpretation {
2223        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2224            wkt::internal::display_enum(f, self.name(), self.value())
2225        }
2226    }
2227
2228    impl std::convert::From<i32> for MissingValueInterpretation {
2229        fn from(value: i32) -> Self {
2230            match value {
2231                0 => Self::Unspecified,
2232                1 => Self::NullValue,
2233                2 => Self::DefaultValue,
2234                _ => Self::UnknownValue(missing_value_interpretation::UnknownValue(
2235                    wkt::internal::UnknownEnumValue::Integer(value),
2236                )),
2237            }
2238        }
2239    }
2240
2241    impl std::convert::From<&str> for MissingValueInterpretation {
2242        fn from(value: &str) -> Self {
2243            use std::string::ToString;
2244            match value {
2245                "MISSING_VALUE_INTERPRETATION_UNSPECIFIED" => Self::Unspecified,
2246                "NULL_VALUE" => Self::NullValue,
2247                "DEFAULT_VALUE" => Self::DefaultValue,
2248                _ => Self::UnknownValue(missing_value_interpretation::UnknownValue(
2249                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2250                )),
2251            }
2252        }
2253    }
2254
2255    impl serde::ser::Serialize for MissingValueInterpretation {
2256        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2257        where
2258            S: serde::Serializer,
2259        {
2260            match self {
2261                Self::Unspecified => serializer.serialize_i32(0),
2262                Self::NullValue => serializer.serialize_i32(1),
2263                Self::DefaultValue => serializer.serialize_i32(2),
2264                Self::UnknownValue(u) => u.0.serialize(serializer),
2265            }
2266        }
2267    }
2268
2269    impl<'de> serde::de::Deserialize<'de> for MissingValueInterpretation {
2270        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2271        where
2272            D: serde::Deserializer<'de>,
2273        {
2274            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MissingValueInterpretation>::new(
2275                ".google.cloud.bigquery.storage.v1.AppendRowsRequest.MissingValueInterpretation"))
2276        }
2277    }
2278
2279    /// Input rows. The `writer_schema` field must be specified at the initial
2280    /// request and currently, it will be ignored if specified in following
2281    /// requests. Following requests must have data in the same format as the
2282    /// initial request.
2283    #[derive(Clone, Debug, PartialEq)]
2284    #[non_exhaustive]
2285    pub enum Rows {
2286        /// Rows in proto format.
2287        ProtoRows(
2288            std::boxed::Box<
2289                crate::write::generated::gapic_storage::model::append_rows_request::ProtoData,
2290            >,
2291        ),
2292        /// Rows in arrow format.
2293        ArrowRows(
2294            std::boxed::Box<
2295                crate::write::generated::gapic_storage::model::append_rows_request::ArrowData,
2296            >,
2297        ),
2298    }
2299
2300    impl Rows {
2301        /// Initializes the enum to the [ProtoRows](Self::ProtoRows) branch.
2302        pub fn from_proto_rows(
2303            value: impl std::convert::Into<
2304                std::boxed::Box<
2305                    crate::write::generated::gapic_storage::model::append_rows_request::ProtoData,
2306                >,
2307            >,
2308        ) -> Self {
2309            Self::ProtoRows(value.into())
2310        }
2311        /// Initializes the enum to the [ArrowRows](Self::ArrowRows) branch.
2312        pub fn from_arrow_rows(
2313            value: impl std::convert::Into<
2314                std::boxed::Box<
2315                    crate::write::generated::gapic_storage::model::append_rows_request::ArrowData,
2316                >,
2317            >,
2318        ) -> Self {
2319            Self::ArrowRows(value.into())
2320        }
2321    }
2322}
2323
2324/// Response message for `AppendRows`.
2325#[derive(Clone, Default, PartialEq)]
2326#[non_exhaustive]
2327pub struct AppendRowsResponse {
2328    /// If backend detects a schema update, pass it to user so that user can
2329    /// use it to input new type of message. It will be empty when no schema
2330    /// updates have occurred.
2331    pub updated_schema:
2332        std::option::Option<crate::write::generated::gapic_storage::model::TableSchema>,
2333
2334    /// If a request failed due to corrupted rows, no rows in the batch will be
2335    /// appended. The API will return row level error info, so that the caller can
2336    /// remove the bad rows and retry the request.
2337    pub row_errors: std::vec::Vec<crate::write::generated::gapic_storage::model::RowError>,
2338
2339    /// The target of the append operation. Matches the write_stream in the
2340    /// corresponding request.
2341    pub write_stream: std::string::String,
2342
2343    #[allow(missing_docs)]
2344    pub response: std::option::Option<
2345        crate::write::generated::gapic_storage::model::append_rows_response::Response,
2346    >,
2347
2348    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2349}
2350
2351impl AppendRowsResponse {
2352    /// Creates a new default instance.
2353    pub fn new() -> Self {
2354        std::default::Default::default()
2355    }
2356
2357    /// Sets the value of [updated_schema][crate::write::generated::gapic_storage::model::AppendRowsResponse::updated_schema].
2358    pub fn set_updated_schema<T>(mut self, v: T) -> Self
2359    where
2360        T: std::convert::Into<crate::write::generated::gapic_storage::model::TableSchema>,
2361    {
2362        self.updated_schema = std::option::Option::Some(v.into());
2363        self
2364    }
2365
2366    /// Sets or clears the value of [updated_schema][crate::write::generated::gapic_storage::model::AppendRowsResponse::updated_schema].
2367    pub fn set_or_clear_updated_schema<T>(mut self, v: std::option::Option<T>) -> Self
2368    where
2369        T: std::convert::Into<crate::write::generated::gapic_storage::model::TableSchema>,
2370    {
2371        self.updated_schema = v.map(|x| x.into());
2372        self
2373    }
2374
2375    /// Sets the value of [row_errors][crate::write::generated::gapic_storage::model::AppendRowsResponse::row_errors].
2376    pub fn set_row_errors<T, V>(mut self, v: T) -> Self
2377    where
2378        T: std::iter::IntoIterator<Item = V>,
2379        V: std::convert::Into<crate::write::generated::gapic_storage::model::RowError>,
2380    {
2381        use std::iter::Iterator;
2382        self.row_errors = v.into_iter().map(|i| i.into()).collect();
2383        self
2384    }
2385
2386    /// Sets the value of [write_stream][crate::write::generated::gapic_storage::model::AppendRowsResponse::write_stream].
2387    pub fn set_write_stream<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2388        self.write_stream = v.into();
2389        self
2390    }
2391
2392    /// Sets the value of [response][crate::write::generated::gapic_storage::model::AppendRowsResponse::response].
2393    ///
2394    /// Note that all the setters affecting `response` are mutually
2395    /// exclusive.
2396    pub fn set_response<
2397        T: std::convert::Into<
2398                std::option::Option<
2399                    crate::write::generated::gapic_storage::model::append_rows_response::Response,
2400                >,
2401            >,
2402    >(
2403        mut self,
2404        v: T,
2405    ) -> Self {
2406        self.response = v.into();
2407        self
2408    }
2409
2410    /// The value of [response][crate::write::generated::gapic_storage::model::AppendRowsResponse::response]
2411    /// if it holds a `AppendResult`, `None` if the field is not set or
2412    /// holds a different branch.
2413    pub fn append_result(
2414        &self,
2415    ) -> std::option::Option<
2416        &std::boxed::Box<
2417            crate::write::generated::gapic_storage::model::append_rows_response::AppendResult,
2418        >,
2419    > {
2420        #[allow(unreachable_patterns)]
2421        self.response.as_ref().and_then(|v| match v {
2422            crate::write::generated::gapic_storage::model::append_rows_response::Response::AppendResult(v) => std::option::Option::Some(v),
2423            _ => std::option::Option::None,
2424        })
2425    }
2426
2427    /// Sets the value of [response][crate::write::generated::gapic_storage::model::AppendRowsResponse::response]
2428    /// to hold a `AppendResult`.
2429    ///
2430    /// Note that all the setters affecting `response` are
2431    /// mutually exclusive.
2432    pub fn set_append_result<T: std::convert::Into<std::boxed::Box<crate::write::generated::gapic_storage::model::append_rows_response::AppendResult>>>(mut self, v: T) -> Self{
2433        self.response = std::option::Option::Some(
2434            crate::write::generated::gapic_storage::model::append_rows_response::Response::AppendResult(
2435                v.into()
2436            )
2437        );
2438        self
2439    }
2440
2441    /// The value of [response][crate::write::generated::gapic_storage::model::AppendRowsResponse::response]
2442    /// if it holds a `Error`, `None` if the field is not set or
2443    /// holds a different branch.
2444    pub fn error(&self) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>> {
2445        #[allow(unreachable_patterns)]
2446        self.response.as_ref().and_then(|v| match v {
2447            crate::write::generated::gapic_storage::model::append_rows_response::Response::Error(v) => std::option::Option::Some(v),
2448            _ => std::option::Option::None,
2449        })
2450    }
2451
2452    /// Sets the value of [response][crate::write::generated::gapic_storage::model::AppendRowsResponse::response]
2453    /// to hold a `Error`.
2454    ///
2455    /// Note that all the setters affecting `response` are
2456    /// mutually exclusive.
2457    pub fn set_error<T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>>(
2458        mut self,
2459        v: T,
2460    ) -> Self {
2461        self.response = std::option::Option::Some(
2462            crate::write::generated::gapic_storage::model::append_rows_response::Response::Error(
2463                v.into(),
2464            ),
2465        );
2466        self
2467    }
2468}
2469
2470impl wkt::message::Message for AppendRowsResponse {
2471    fn typename() -> &'static str {
2472        "type.googleapis.com/google.cloud.bigquery.storage.v1.AppendRowsResponse"
2473    }
2474}
2475
2476/// Defines additional types related to [AppendRowsResponse].
2477pub mod append_rows_response {
2478    #[allow(unused_imports)]
2479    use super::*;
2480
2481    /// AppendResult is returned for successful append requests.
2482    #[derive(Clone, Default, PartialEq)]
2483    #[non_exhaustive]
2484    pub struct AppendResult {
2485        /// The row offset at which the last append occurred. The offset will not be
2486        /// set if appending using default streams.
2487        pub offset: std::option::Option<wkt::Int64Value>,
2488
2489        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2490    }
2491
2492    impl AppendResult {
2493        /// Creates a new default instance.
2494        pub fn new() -> Self {
2495            std::default::Default::default()
2496        }
2497
2498        /// Sets the value of [offset][crate::write::generated::gapic_storage::model::append_rows_response::AppendResult::offset].
2499        pub fn set_offset<T>(mut self, v: T) -> Self
2500        where
2501            T: std::convert::Into<wkt::Int64Value>,
2502        {
2503            self.offset = std::option::Option::Some(v.into());
2504            self
2505        }
2506
2507        /// Sets or clears the value of [offset][crate::write::generated::gapic_storage::model::append_rows_response::AppendResult::offset].
2508        pub fn set_or_clear_offset<T>(mut self, v: std::option::Option<T>) -> Self
2509        where
2510            T: std::convert::Into<wkt::Int64Value>,
2511        {
2512            self.offset = v.map(|x| x.into());
2513            self
2514        }
2515    }
2516
2517    impl wkt::message::Message for AppendResult {
2518        fn typename() -> &'static str {
2519            "type.googleapis.com/google.cloud.bigquery.storage.v1.AppendRowsResponse.AppendResult"
2520        }
2521    }
2522
2523    #[allow(missing_docs)]
2524    #[derive(Clone, Debug, PartialEq)]
2525    #[non_exhaustive]
2526    pub enum Response {
2527        /// Result if the append is successful.
2528        AppendResult(
2529            std::boxed::Box<
2530                crate::write::generated::gapic_storage::model::append_rows_response::AppendResult,
2531            >,
2532        ),
2533        /// Error returned when problems were encountered.  If present,
2534        /// it indicates rows were not accepted into the system.
2535        /// Users can retry or continue with other append requests within the
2536        /// same connection.
2537        ///
2538        /// Additional information about error signalling:
2539        ///
2540        /// ALREADY_EXISTS: Happens when an append specified an offset, and the
2541        /// backend already has received data at this offset.  Typically encountered
2542        /// in retry scenarios, and can be ignored.
2543        ///
2544        /// OUT_OF_RANGE: Returned when the specified offset in the stream is beyond
2545        /// the current end of the stream.
2546        ///
2547        /// INVALID_ARGUMENT: Indicates a malformed request or data.
2548        ///
2549        /// ABORTED: Request processing is aborted because of prior failures.  The
2550        /// request can be retried if previous failure is addressed.
2551        ///
2552        /// INTERNAL: Indicates server side error(s) that can be retried.
2553        Error(std::boxed::Box<google_cloud_rpc::model::Status>),
2554    }
2555
2556    impl Response {
2557        /// Initializes the enum to the [AppendResult](Self::AppendResult) branch.
2558        pub fn from_append_result(
2559            value: impl std::convert::Into<std::boxed::Box<crate::write::generated::gapic_storage::model::append_rows_response::AppendResult>>,
2560        ) -> Self {
2561            Self::AppendResult(value.into())
2562        }
2563        /// Initializes the enum to the [Error](Self::Error) branch.
2564        pub fn from_error(
2565            value: impl std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>,
2566        ) -> Self {
2567            Self::Error(value.into())
2568        }
2569    }
2570}
2571
2572/// Request message for `GetWriteStreamRequest`.
2573#[derive(Clone, Default, PartialEq)]
2574#[non_exhaustive]
2575pub struct GetWriteStreamRequest {
2576    /// Required. Name of the stream to get, in the form of
2577    /// `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
2578    pub name: std::string::String,
2579
2580    /// Indicates whether to get full or partial view of the WriteStream. If
2581    /// not set, view returned will be basic.
2582    pub view: crate::write::generated::gapic_storage::model::WriteStreamView,
2583
2584    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2585}
2586
2587impl GetWriteStreamRequest {
2588    /// Creates a new default instance.
2589    pub fn new() -> Self {
2590        std::default::Default::default()
2591    }
2592
2593    /// Sets the value of [name][crate::write::generated::gapic_storage::model::GetWriteStreamRequest::name].
2594    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2595        self.name = v.into();
2596        self
2597    }
2598
2599    /// Sets the value of [view][crate::write::generated::gapic_storage::model::GetWriteStreamRequest::view].
2600    pub fn set_view<
2601        T: std::convert::Into<crate::write::generated::gapic_storage::model::WriteStreamView>,
2602    >(
2603        mut self,
2604        v: T,
2605    ) -> Self {
2606        self.view = v.into();
2607        self
2608    }
2609}
2610
2611impl wkt::message::Message for GetWriteStreamRequest {
2612    fn typename() -> &'static str {
2613        "type.googleapis.com/google.cloud.bigquery.storage.v1.GetWriteStreamRequest"
2614    }
2615}
2616
2617/// Request message for `BatchCommitWriteStreams`.
2618#[derive(Clone, Default, PartialEq)]
2619#[non_exhaustive]
2620pub struct BatchCommitWriteStreamsRequest {
2621    /// Required. Parent table that all the streams should belong to, in the form
2622    /// of `projects/{project}/datasets/{dataset}/tables/{table}`.
2623    pub parent: std::string::String,
2624
2625    /// Required. The group of streams that will be committed atomically.
2626    pub write_streams: std::vec::Vec<std::string::String>,
2627
2628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2629}
2630
2631impl BatchCommitWriteStreamsRequest {
2632    /// Creates a new default instance.
2633    pub fn new() -> Self {
2634        std::default::Default::default()
2635    }
2636
2637    /// Sets the value of [parent][crate::write::generated::gapic_storage::model::BatchCommitWriteStreamsRequest::parent].
2638    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2639        self.parent = v.into();
2640        self
2641    }
2642
2643    /// Sets the value of [write_streams][crate::write::generated::gapic_storage::model::BatchCommitWriteStreamsRequest::write_streams].
2644    pub fn set_write_streams<T, V>(mut self, v: T) -> Self
2645    where
2646        T: std::iter::IntoIterator<Item = V>,
2647        V: std::convert::Into<std::string::String>,
2648    {
2649        use std::iter::Iterator;
2650        self.write_streams = v.into_iter().map(|i| i.into()).collect();
2651        self
2652    }
2653}
2654
2655impl wkt::message::Message for BatchCommitWriteStreamsRequest {
2656    fn typename() -> &'static str {
2657        "type.googleapis.com/google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsRequest"
2658    }
2659}
2660
2661/// Response message for `BatchCommitWriteStreams`.
2662#[derive(Clone, Default, PartialEq)]
2663#[non_exhaustive]
2664pub struct BatchCommitWriteStreamsResponse {
2665    /// The time at which streams were committed in microseconds granularity.
2666    /// This field will only exist when there are no stream errors.
2667    /// **Note** if this field is not set, it means the commit was not successful.
2668    pub commit_time: std::option::Option<wkt::Timestamp>,
2669
2670    /// Stream level error if commit failed. Only streams with error will be in
2671    /// the list.
2672    /// If empty, there is no error and all streams are committed successfully.
2673    /// If non empty, certain streams have errors and ZERO stream is committed due
2674    /// to atomicity guarantee.
2675    pub stream_errors: std::vec::Vec<crate::write::generated::gapic_storage::model::StorageError>,
2676
2677    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2678}
2679
2680impl BatchCommitWriteStreamsResponse {
2681    /// Creates a new default instance.
2682    pub fn new() -> Self {
2683        std::default::Default::default()
2684    }
2685
2686    /// Sets the value of [commit_time][crate::write::generated::gapic_storage::model::BatchCommitWriteStreamsResponse::commit_time].
2687    pub fn set_commit_time<T>(mut self, v: T) -> Self
2688    where
2689        T: std::convert::Into<wkt::Timestamp>,
2690    {
2691        self.commit_time = std::option::Option::Some(v.into());
2692        self
2693    }
2694
2695    /// Sets or clears the value of [commit_time][crate::write::generated::gapic_storage::model::BatchCommitWriteStreamsResponse::commit_time].
2696    pub fn set_or_clear_commit_time<T>(mut self, v: std::option::Option<T>) -> Self
2697    where
2698        T: std::convert::Into<wkt::Timestamp>,
2699    {
2700        self.commit_time = v.map(|x| x.into());
2701        self
2702    }
2703
2704    /// Sets the value of [stream_errors][crate::write::generated::gapic_storage::model::BatchCommitWriteStreamsResponse::stream_errors].
2705    pub fn set_stream_errors<T, V>(mut self, v: T) -> Self
2706    where
2707        T: std::iter::IntoIterator<Item = V>,
2708        V: std::convert::Into<crate::write::generated::gapic_storage::model::StorageError>,
2709    {
2710        use std::iter::Iterator;
2711        self.stream_errors = v.into_iter().map(|i| i.into()).collect();
2712        self
2713    }
2714}
2715
2716impl wkt::message::Message for BatchCommitWriteStreamsResponse {
2717    fn typename() -> &'static str {
2718        "type.googleapis.com/google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsResponse"
2719    }
2720}
2721
2722/// Request message for invoking `FinalizeWriteStream`.
2723#[derive(Clone, Default, PartialEq)]
2724#[non_exhaustive]
2725pub struct FinalizeWriteStreamRequest {
2726    /// Required. Name of the stream to finalize, in the form of
2727    /// `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
2728    pub name: std::string::String,
2729
2730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2731}
2732
2733impl FinalizeWriteStreamRequest {
2734    /// Creates a new default instance.
2735    pub fn new() -> Self {
2736        std::default::Default::default()
2737    }
2738
2739    /// Sets the value of [name][crate::write::generated::gapic_storage::model::FinalizeWriteStreamRequest::name].
2740    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2741        self.name = v.into();
2742        self
2743    }
2744}
2745
2746impl wkt::message::Message for FinalizeWriteStreamRequest {
2747    fn typename() -> &'static str {
2748        "type.googleapis.com/google.cloud.bigquery.storage.v1.FinalizeWriteStreamRequest"
2749    }
2750}
2751
2752/// Response message for `FinalizeWriteStream`.
2753#[derive(Clone, Default, PartialEq)]
2754#[non_exhaustive]
2755pub struct FinalizeWriteStreamResponse {
2756    /// Number of rows in the finalized stream.
2757    pub row_count: i64,
2758
2759    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2760}
2761
2762impl FinalizeWriteStreamResponse {
2763    /// Creates a new default instance.
2764    pub fn new() -> Self {
2765        std::default::Default::default()
2766    }
2767
2768    /// Sets the value of [row_count][crate::write::generated::gapic_storage::model::FinalizeWriteStreamResponse::row_count].
2769    pub fn set_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2770        self.row_count = v.into();
2771        self
2772    }
2773}
2774
2775impl wkt::message::Message for FinalizeWriteStreamResponse {
2776    fn typename() -> &'static str {
2777        "type.googleapis.com/google.cloud.bigquery.storage.v1.FinalizeWriteStreamResponse"
2778    }
2779}
2780
2781/// Request message for `FlushRows`.
2782#[derive(Clone, Default, PartialEq)]
2783#[non_exhaustive]
2784pub struct FlushRowsRequest {
2785    /// Required. The stream that is the target of the flush operation.
2786    pub write_stream: std::string::String,
2787
2788    /// Ending offset of the flush operation. Rows before this offset(including
2789    /// this offset) will be flushed.
2790    pub offset: std::option::Option<wkt::Int64Value>,
2791
2792    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2793}
2794
2795impl FlushRowsRequest {
2796    /// Creates a new default instance.
2797    pub fn new() -> Self {
2798        std::default::Default::default()
2799    }
2800
2801    /// Sets the value of [write_stream][crate::write::generated::gapic_storage::model::FlushRowsRequest::write_stream].
2802    pub fn set_write_stream<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2803        self.write_stream = v.into();
2804        self
2805    }
2806
2807    /// Sets the value of [offset][crate::write::generated::gapic_storage::model::FlushRowsRequest::offset].
2808    pub fn set_offset<T>(mut self, v: T) -> Self
2809    where
2810        T: std::convert::Into<wkt::Int64Value>,
2811    {
2812        self.offset = std::option::Option::Some(v.into());
2813        self
2814    }
2815
2816    /// Sets or clears the value of [offset][crate::write::generated::gapic_storage::model::FlushRowsRequest::offset].
2817    pub fn set_or_clear_offset<T>(mut self, v: std::option::Option<T>) -> Self
2818    where
2819        T: std::convert::Into<wkt::Int64Value>,
2820    {
2821        self.offset = v.map(|x| x.into());
2822        self
2823    }
2824}
2825
2826impl wkt::message::Message for FlushRowsRequest {
2827    fn typename() -> &'static str {
2828        "type.googleapis.com/google.cloud.bigquery.storage.v1.FlushRowsRequest"
2829    }
2830}
2831
2832/// Respond message for `FlushRows`.
2833#[derive(Clone, Default, PartialEq)]
2834#[non_exhaustive]
2835pub struct FlushRowsResponse {
2836    /// The rows before this offset (including this offset) are flushed.
2837    pub offset: i64,
2838
2839    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2840}
2841
2842impl FlushRowsResponse {
2843    /// Creates a new default instance.
2844    pub fn new() -> Self {
2845        std::default::Default::default()
2846    }
2847
2848    /// Sets the value of [offset][crate::write::generated::gapic_storage::model::FlushRowsResponse::offset].
2849    pub fn set_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2850        self.offset = v.into();
2851        self
2852    }
2853}
2854
2855impl wkt::message::Message for FlushRowsResponse {
2856    fn typename() -> &'static str {
2857        "type.googleapis.com/google.cloud.bigquery.storage.v1.FlushRowsResponse"
2858    }
2859}
2860
2861/// Structured custom BigQuery Storage error message. The error can be attached
2862/// as error details in the returned rpc Status. In particular, the use of error
2863/// codes allows more structured error handling, and reduces the need to evaluate
2864/// unstructured error text strings.
2865#[derive(Clone, Default, PartialEq)]
2866#[non_exhaustive]
2867pub struct StorageError {
2868    /// BigQuery Storage specific error code.
2869    pub code: crate::write::generated::gapic_storage::model::storage_error::StorageErrorCode,
2870
2871    /// Name of the failed entity.
2872    pub entity: std::string::String,
2873
2874    /// Message that describes the error.
2875    pub error_message: std::string::String,
2876
2877    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2878}
2879
2880impl StorageError {
2881    /// Creates a new default instance.
2882    pub fn new() -> Self {
2883        std::default::Default::default()
2884    }
2885
2886    /// Sets the value of [code][crate::write::generated::gapic_storage::model::StorageError::code].
2887    pub fn set_code<
2888        T: std::convert::Into<
2889                crate::write::generated::gapic_storage::model::storage_error::StorageErrorCode,
2890            >,
2891    >(
2892        mut self,
2893        v: T,
2894    ) -> Self {
2895        self.code = v.into();
2896        self
2897    }
2898
2899    /// Sets the value of [entity][crate::write::generated::gapic_storage::model::StorageError::entity].
2900    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2901        self.entity = v.into();
2902        self
2903    }
2904
2905    /// Sets the value of [error_message][crate::write::generated::gapic_storage::model::StorageError::error_message].
2906    pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2907        self.error_message = v.into();
2908        self
2909    }
2910}
2911
2912impl wkt::message::Message for StorageError {
2913    fn typename() -> &'static str {
2914        "type.googleapis.com/google.cloud.bigquery.storage.v1.StorageError"
2915    }
2916}
2917
2918/// Defines additional types related to [StorageError].
2919pub mod storage_error {
2920    #[allow(unused_imports)]
2921    use super::*;
2922
2923    /// Error code for `StorageError`.
2924    ///
2925    /// # Working with unknown values
2926    ///
2927    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2928    /// additional enum variants at any time. Adding new variants is not considered
2929    /// a breaking change. Applications should write their code in anticipation of:
2930    ///
2931    /// - New values appearing in future releases of the client library, **and**
2932    /// - New values received dynamically, without application changes.
2933    ///
2934    /// Please consult the [Working with enums] section in the user guide for some
2935    /// guidelines.
2936    ///
2937    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2938    #[derive(Clone, Debug, PartialEq)]
2939    #[non_exhaustive]
2940    pub enum StorageErrorCode {
2941        /// Default error.
2942        Unspecified,
2943        /// Table is not found in the system.
2944        TableNotFound,
2945        /// Stream is already committed.
2946        StreamAlreadyCommitted,
2947        /// Stream is not found.
2948        StreamNotFound,
2949        /// Invalid Stream type.
2950        /// For example, you try to commit a stream that is not pending.
2951        InvalidStreamType,
2952        /// Invalid Stream state.
2953        /// For example, you try to commit a stream that is not finalized or is
2954        /// garbaged.
2955        InvalidStreamState,
2956        /// Stream is finalized.
2957        StreamFinalized,
2958        /// There is a schema mismatch and it is caused by user schema has extra
2959        /// field than bigquery schema.
2960        SchemaMismatchExtraFields,
2961        /// Offset already exists.
2962        OffsetAlreadyExists,
2963        /// Offset out of range.
2964        OffsetOutOfRange,
2965        /// Customer-managed encryption key (CMEK) not provided for CMEK-enabled
2966        /// data.
2967        CmekNotProvided,
2968        /// Customer-managed encryption key (CMEK) was incorrectly provided.
2969        InvalidCmekProvided,
2970        /// There is an encryption error while using customer-managed encryption key.
2971        CmekEncryptionError,
2972        /// Key Management Service (KMS) service returned an error, which can be
2973        /// retried.
2974        KmsServiceError,
2975        /// Permission denied while using customer-managed encryption key.
2976        KmsPermissionDenied,
2977        /// If set, the enum was initialized with an unknown value.
2978        ///
2979        /// Applications can examine the value using [StorageErrorCode::value] or
2980        /// [StorageErrorCode::name].
2981        UnknownValue(storage_error_code::UnknownValue),
2982    }
2983
2984    #[doc(hidden)]
2985    pub mod storage_error_code {
2986        #[allow(unused_imports)]
2987        use super::*;
2988        #[derive(Clone, Debug, PartialEq)]
2989        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2990    }
2991
2992    impl StorageErrorCode {
2993        /// Gets the enum value.
2994        ///
2995        /// Returns `None` if the enum contains an unknown value deserialized from
2996        /// the string representation of enums.
2997        pub fn value(&self) -> std::option::Option<i32> {
2998            match self {
2999                Self::Unspecified => std::option::Option::Some(0),
3000                Self::TableNotFound => std::option::Option::Some(1),
3001                Self::StreamAlreadyCommitted => std::option::Option::Some(2),
3002                Self::StreamNotFound => std::option::Option::Some(3),
3003                Self::InvalidStreamType => std::option::Option::Some(4),
3004                Self::InvalidStreamState => std::option::Option::Some(5),
3005                Self::StreamFinalized => std::option::Option::Some(6),
3006                Self::SchemaMismatchExtraFields => std::option::Option::Some(7),
3007                Self::OffsetAlreadyExists => std::option::Option::Some(8),
3008                Self::OffsetOutOfRange => std::option::Option::Some(9),
3009                Self::CmekNotProvided => std::option::Option::Some(10),
3010                Self::InvalidCmekProvided => std::option::Option::Some(11),
3011                Self::CmekEncryptionError => std::option::Option::Some(12),
3012                Self::KmsServiceError => std::option::Option::Some(13),
3013                Self::KmsPermissionDenied => std::option::Option::Some(14),
3014                Self::UnknownValue(u) => u.0.value(),
3015            }
3016        }
3017
3018        /// Gets the enum value as a string.
3019        ///
3020        /// Returns `None` if the enum contains an unknown value deserialized from
3021        /// the integer representation of enums.
3022        pub fn name(&self) -> std::option::Option<&str> {
3023            match self {
3024                Self::Unspecified => std::option::Option::Some("STORAGE_ERROR_CODE_UNSPECIFIED"),
3025                Self::TableNotFound => std::option::Option::Some("TABLE_NOT_FOUND"),
3026                Self::StreamAlreadyCommitted => {
3027                    std::option::Option::Some("STREAM_ALREADY_COMMITTED")
3028                }
3029                Self::StreamNotFound => std::option::Option::Some("STREAM_NOT_FOUND"),
3030                Self::InvalidStreamType => std::option::Option::Some("INVALID_STREAM_TYPE"),
3031                Self::InvalidStreamState => std::option::Option::Some("INVALID_STREAM_STATE"),
3032                Self::StreamFinalized => std::option::Option::Some("STREAM_FINALIZED"),
3033                Self::SchemaMismatchExtraFields => {
3034                    std::option::Option::Some("SCHEMA_MISMATCH_EXTRA_FIELDS")
3035                }
3036                Self::OffsetAlreadyExists => std::option::Option::Some("OFFSET_ALREADY_EXISTS"),
3037                Self::OffsetOutOfRange => std::option::Option::Some("OFFSET_OUT_OF_RANGE"),
3038                Self::CmekNotProvided => std::option::Option::Some("CMEK_NOT_PROVIDED"),
3039                Self::InvalidCmekProvided => std::option::Option::Some("INVALID_CMEK_PROVIDED"),
3040                Self::CmekEncryptionError => std::option::Option::Some("CMEK_ENCRYPTION_ERROR"),
3041                Self::KmsServiceError => std::option::Option::Some("KMS_SERVICE_ERROR"),
3042                Self::KmsPermissionDenied => std::option::Option::Some("KMS_PERMISSION_DENIED"),
3043                Self::UnknownValue(u) => u.0.name(),
3044            }
3045        }
3046    }
3047
3048    impl std::default::Default for StorageErrorCode {
3049        fn default() -> Self {
3050            use std::convert::From;
3051            Self::from(0)
3052        }
3053    }
3054
3055    impl std::fmt::Display for StorageErrorCode {
3056        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3057            wkt::internal::display_enum(f, self.name(), self.value())
3058        }
3059    }
3060
3061    impl std::convert::From<i32> for StorageErrorCode {
3062        fn from(value: i32) -> Self {
3063            match value {
3064                0 => Self::Unspecified,
3065                1 => Self::TableNotFound,
3066                2 => Self::StreamAlreadyCommitted,
3067                3 => Self::StreamNotFound,
3068                4 => Self::InvalidStreamType,
3069                5 => Self::InvalidStreamState,
3070                6 => Self::StreamFinalized,
3071                7 => Self::SchemaMismatchExtraFields,
3072                8 => Self::OffsetAlreadyExists,
3073                9 => Self::OffsetOutOfRange,
3074                10 => Self::CmekNotProvided,
3075                11 => Self::InvalidCmekProvided,
3076                12 => Self::CmekEncryptionError,
3077                13 => Self::KmsServiceError,
3078                14 => Self::KmsPermissionDenied,
3079                _ => Self::UnknownValue(storage_error_code::UnknownValue(
3080                    wkt::internal::UnknownEnumValue::Integer(value),
3081                )),
3082            }
3083        }
3084    }
3085
3086    impl std::convert::From<&str> for StorageErrorCode {
3087        fn from(value: &str) -> Self {
3088            use std::string::ToString;
3089            match value {
3090                "STORAGE_ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
3091                "TABLE_NOT_FOUND" => Self::TableNotFound,
3092                "STREAM_ALREADY_COMMITTED" => Self::StreamAlreadyCommitted,
3093                "STREAM_NOT_FOUND" => Self::StreamNotFound,
3094                "INVALID_STREAM_TYPE" => Self::InvalidStreamType,
3095                "INVALID_STREAM_STATE" => Self::InvalidStreamState,
3096                "STREAM_FINALIZED" => Self::StreamFinalized,
3097                "SCHEMA_MISMATCH_EXTRA_FIELDS" => Self::SchemaMismatchExtraFields,
3098                "OFFSET_ALREADY_EXISTS" => Self::OffsetAlreadyExists,
3099                "OFFSET_OUT_OF_RANGE" => Self::OffsetOutOfRange,
3100                "CMEK_NOT_PROVIDED" => Self::CmekNotProvided,
3101                "INVALID_CMEK_PROVIDED" => Self::InvalidCmekProvided,
3102                "CMEK_ENCRYPTION_ERROR" => Self::CmekEncryptionError,
3103                "KMS_SERVICE_ERROR" => Self::KmsServiceError,
3104                "KMS_PERMISSION_DENIED" => Self::KmsPermissionDenied,
3105                _ => Self::UnknownValue(storage_error_code::UnknownValue(
3106                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3107                )),
3108            }
3109        }
3110    }
3111
3112    impl serde::ser::Serialize for StorageErrorCode {
3113        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3114        where
3115            S: serde::Serializer,
3116        {
3117            match self {
3118                Self::Unspecified => serializer.serialize_i32(0),
3119                Self::TableNotFound => serializer.serialize_i32(1),
3120                Self::StreamAlreadyCommitted => serializer.serialize_i32(2),
3121                Self::StreamNotFound => serializer.serialize_i32(3),
3122                Self::InvalidStreamType => serializer.serialize_i32(4),
3123                Self::InvalidStreamState => serializer.serialize_i32(5),
3124                Self::StreamFinalized => serializer.serialize_i32(6),
3125                Self::SchemaMismatchExtraFields => serializer.serialize_i32(7),
3126                Self::OffsetAlreadyExists => serializer.serialize_i32(8),
3127                Self::OffsetOutOfRange => serializer.serialize_i32(9),
3128                Self::CmekNotProvided => serializer.serialize_i32(10),
3129                Self::InvalidCmekProvided => serializer.serialize_i32(11),
3130                Self::CmekEncryptionError => serializer.serialize_i32(12),
3131                Self::KmsServiceError => serializer.serialize_i32(13),
3132                Self::KmsPermissionDenied => serializer.serialize_i32(14),
3133                Self::UnknownValue(u) => u.0.serialize(serializer),
3134            }
3135        }
3136    }
3137
3138    impl<'de> serde::de::Deserialize<'de> for StorageErrorCode {
3139        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3140        where
3141            D: serde::Deserializer<'de>,
3142        {
3143            deserializer.deserialize_any(wkt::internal::EnumVisitor::<StorageErrorCode>::new(
3144                ".google.cloud.bigquery.storage.v1.StorageError.StorageErrorCode",
3145            ))
3146        }
3147    }
3148}
3149
3150/// The message that presents row level error info in a request.
3151#[derive(Clone, Default, PartialEq)]
3152#[non_exhaustive]
3153pub struct RowError {
3154    /// Index of the malformed row in the request.
3155    pub index: i64,
3156
3157    /// Structured error reason for a row error.
3158    pub code: crate::write::generated::gapic_storage::model::row_error::RowErrorCode,
3159
3160    /// Description of the issue encountered when processing the row.
3161    pub message: std::string::String,
3162
3163    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3164}
3165
3166impl RowError {
3167    /// Creates a new default instance.
3168    pub fn new() -> Self {
3169        std::default::Default::default()
3170    }
3171
3172    /// Sets the value of [index][crate::write::generated::gapic_storage::model::RowError::index].
3173    pub fn set_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3174        self.index = v.into();
3175        self
3176    }
3177
3178    /// Sets the value of [code][crate::write::generated::gapic_storage::model::RowError::code].
3179    pub fn set_code<
3180        T: std::convert::Into<crate::write::generated::gapic_storage::model::row_error::RowErrorCode>,
3181    >(
3182        mut self,
3183        v: T,
3184    ) -> Self {
3185        self.code = v.into();
3186        self
3187    }
3188
3189    /// Sets the value of [message][crate::write::generated::gapic_storage::model::RowError::message].
3190    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3191        self.message = v.into();
3192        self
3193    }
3194}
3195
3196impl wkt::message::Message for RowError {
3197    fn typename() -> &'static str {
3198        "type.googleapis.com/google.cloud.bigquery.storage.v1.RowError"
3199    }
3200}
3201
3202/// Defines additional types related to [RowError].
3203pub mod row_error {
3204    #[allow(unused_imports)]
3205    use super::*;
3206
3207    /// Error code for `RowError`.
3208    ///
3209    /// # Working with unknown values
3210    ///
3211    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3212    /// additional enum variants at any time. Adding new variants is not considered
3213    /// a breaking change. Applications should write their code in anticipation of:
3214    ///
3215    /// - New values appearing in future releases of the client library, **and**
3216    /// - New values received dynamically, without application changes.
3217    ///
3218    /// Please consult the [Working with enums] section in the user guide for some
3219    /// guidelines.
3220    ///
3221    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3222    #[derive(Clone, Debug, PartialEq)]
3223    #[non_exhaustive]
3224    pub enum RowErrorCode {
3225        /// Default error.
3226        Unspecified,
3227        /// One or more fields in the row has errors.
3228        FieldsError,
3229        /// If set, the enum was initialized with an unknown value.
3230        ///
3231        /// Applications can examine the value using [RowErrorCode::value] or
3232        /// [RowErrorCode::name].
3233        UnknownValue(row_error_code::UnknownValue),
3234    }
3235
3236    #[doc(hidden)]
3237    pub mod row_error_code {
3238        #[allow(unused_imports)]
3239        use super::*;
3240        #[derive(Clone, Debug, PartialEq)]
3241        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3242    }
3243
3244    impl RowErrorCode {
3245        /// Gets the enum value.
3246        ///
3247        /// Returns `None` if the enum contains an unknown value deserialized from
3248        /// the string representation of enums.
3249        pub fn value(&self) -> std::option::Option<i32> {
3250            match self {
3251                Self::Unspecified => std::option::Option::Some(0),
3252                Self::FieldsError => std::option::Option::Some(1),
3253                Self::UnknownValue(u) => u.0.value(),
3254            }
3255        }
3256
3257        /// Gets the enum value as a string.
3258        ///
3259        /// Returns `None` if the enum contains an unknown value deserialized from
3260        /// the integer representation of enums.
3261        pub fn name(&self) -> std::option::Option<&str> {
3262            match self {
3263                Self::Unspecified => std::option::Option::Some("ROW_ERROR_CODE_UNSPECIFIED"),
3264                Self::FieldsError => std::option::Option::Some("FIELDS_ERROR"),
3265                Self::UnknownValue(u) => u.0.name(),
3266            }
3267        }
3268    }
3269
3270    impl std::default::Default for RowErrorCode {
3271        fn default() -> Self {
3272            use std::convert::From;
3273            Self::from(0)
3274        }
3275    }
3276
3277    impl std::fmt::Display for RowErrorCode {
3278        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3279            wkt::internal::display_enum(f, self.name(), self.value())
3280        }
3281    }
3282
3283    impl std::convert::From<i32> for RowErrorCode {
3284        fn from(value: i32) -> Self {
3285            match value {
3286                0 => Self::Unspecified,
3287                1 => Self::FieldsError,
3288                _ => Self::UnknownValue(row_error_code::UnknownValue(
3289                    wkt::internal::UnknownEnumValue::Integer(value),
3290                )),
3291            }
3292        }
3293    }
3294
3295    impl std::convert::From<&str> for RowErrorCode {
3296        fn from(value: &str) -> Self {
3297            use std::string::ToString;
3298            match value {
3299                "ROW_ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
3300                "FIELDS_ERROR" => Self::FieldsError,
3301                _ => Self::UnknownValue(row_error_code::UnknownValue(
3302                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3303                )),
3304            }
3305        }
3306    }
3307
3308    impl serde::ser::Serialize for RowErrorCode {
3309        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3310        where
3311            S: serde::Serializer,
3312        {
3313            match self {
3314                Self::Unspecified => serializer.serialize_i32(0),
3315                Self::FieldsError => serializer.serialize_i32(1),
3316                Self::UnknownValue(u) => u.0.serialize(serializer),
3317            }
3318        }
3319    }
3320
3321    impl<'de> serde::de::Deserialize<'de> for RowErrorCode {
3322        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3323        where
3324            D: serde::Deserializer<'de>,
3325        {
3326            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RowErrorCode>::new(
3327                ".google.cloud.bigquery.storage.v1.RowError.RowErrorCode",
3328            ))
3329        }
3330    }
3331}
3332
3333/// Stats and telemetry data gathered on the client side about requests
3334/// being sent to the BigQuery Storage service, for internal use only.
3335#[derive(Clone, Default, PartialEq)]
3336#[non_exhaustive]
3337pub struct ClientStats {
3338    /// Optional. Per-request stats.
3339    pub request_stats: std::option::Option<
3340        crate::write::generated::gapic_storage::model::client_stats::RequestStats,
3341    >,
3342
3343    /// Optional. Windowed stats.
3344    pub window_stats: std::option::Option<
3345        crate::write::generated::gapic_storage::model::client_stats::WindowStats,
3346    >,
3347
3348    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3349}
3350
3351impl ClientStats {
3352    /// Creates a new default instance.
3353    pub fn new() -> Self {
3354        std::default::Default::default()
3355    }
3356
3357    /// Sets the value of [request_stats][crate::write::generated::gapic_storage::model::ClientStats::request_stats].
3358    pub fn set_request_stats<T>(mut self, v: T) -> Self
3359    where
3360        T: std::convert::Into<
3361                crate::write::generated::gapic_storage::model::client_stats::RequestStats,
3362            >,
3363    {
3364        self.request_stats = std::option::Option::Some(v.into());
3365        self
3366    }
3367
3368    /// Sets or clears the value of [request_stats][crate::write::generated::gapic_storage::model::ClientStats::request_stats].
3369    pub fn set_or_clear_request_stats<T>(mut self, v: std::option::Option<T>) -> Self
3370    where
3371        T: std::convert::Into<
3372                crate::write::generated::gapic_storage::model::client_stats::RequestStats,
3373            >,
3374    {
3375        self.request_stats = v.map(|x| x.into());
3376        self
3377    }
3378
3379    /// Sets the value of [window_stats][crate::write::generated::gapic_storage::model::ClientStats::window_stats].
3380    pub fn set_window_stats<T>(mut self, v: T) -> Self
3381    where
3382        T: std::convert::Into<
3383                crate::write::generated::gapic_storage::model::client_stats::WindowStats,
3384            >,
3385    {
3386        self.window_stats = std::option::Option::Some(v.into());
3387        self
3388    }
3389
3390    /// Sets or clears the value of [window_stats][crate::write::generated::gapic_storage::model::ClientStats::window_stats].
3391    pub fn set_or_clear_window_stats<T>(mut self, v: std::option::Option<T>) -> Self
3392    where
3393        T: std::convert::Into<
3394                crate::write::generated::gapic_storage::model::client_stats::WindowStats,
3395            >,
3396    {
3397        self.window_stats = v.map(|x| x.into());
3398        self
3399    }
3400}
3401
3402impl wkt::message::Message for ClientStats {
3403    fn typename() -> &'static str {
3404        "type.googleapis.com/google.cloud.bigquery.storage.v1.ClientStats"
3405    }
3406}
3407
3408/// Defines additional types related to [ClientStats].
3409pub mod client_stats {
3410    #[allow(unused_imports)]
3411    use super::*;
3412
3413    /// Stats and telemetry data gathered on the client side about a single
3414    /// request.
3415    #[derive(Clone, Default, PartialEq)]
3416    #[non_exhaustive]
3417    pub struct RequestStats {
3418        /// Optional. Timestamp indicating when the request was sent over the
3419        /// network, expressed in epoch milliseconds.
3420        pub send_time_millis: std::option::Option<i64>,
3421
3422        /// Optional. Number of pending requests at the moment this request was sent.
3423        /// This includes requests waiting to be sent, and those that are inflight.
3424        pub queued_requests_count: std::option::Option<i64>,
3425
3426        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3427    }
3428
3429    impl RequestStats {
3430        /// Creates a new default instance.
3431        pub fn new() -> Self {
3432            std::default::Default::default()
3433        }
3434
3435        /// Sets the value of [send_time_millis][crate::write::generated::gapic_storage::model::client_stats::RequestStats::send_time_millis].
3436        pub fn set_send_time_millis<T>(mut self, v: T) -> Self
3437        where
3438            T: std::convert::Into<i64>,
3439        {
3440            self.send_time_millis = std::option::Option::Some(v.into());
3441            self
3442        }
3443
3444        /// Sets or clears the value of [send_time_millis][crate::write::generated::gapic_storage::model::client_stats::RequestStats::send_time_millis].
3445        pub fn set_or_clear_send_time_millis<T>(mut self, v: std::option::Option<T>) -> Self
3446        where
3447            T: std::convert::Into<i64>,
3448        {
3449            self.send_time_millis = v.map(|x| x.into());
3450            self
3451        }
3452
3453        /// Sets the value of [queued_requests_count][crate::write::generated::gapic_storage::model::client_stats::RequestStats::queued_requests_count].
3454        pub fn set_queued_requests_count<T>(mut self, v: T) -> Self
3455        where
3456            T: std::convert::Into<i64>,
3457        {
3458            self.queued_requests_count = std::option::Option::Some(v.into());
3459            self
3460        }
3461
3462        /// Sets or clears the value of [queued_requests_count][crate::write::generated::gapic_storage::model::client_stats::RequestStats::queued_requests_count].
3463        pub fn set_or_clear_queued_requests_count<T>(mut self, v: std::option::Option<T>) -> Self
3464        where
3465            T: std::convert::Into<i64>,
3466        {
3467            self.queued_requests_count = v.map(|x| x.into());
3468            self
3469        }
3470    }
3471
3472    impl wkt::message::Message for RequestStats {
3473        fn typename() -> &'static str {
3474            "type.googleapis.com/google.cloud.bigquery.storage.v1.ClientStats.RequestStats"
3475        }
3476    }
3477
3478    /// Aggregate connection metrics over a window interval.
3479    #[derive(Clone, Default, PartialEq)]
3480    #[non_exhaustive]
3481    pub struct WindowStats {
3482        /// Optional. The maximum response latency observed in the window, expressed
3483        /// in milliseconds.
3484        pub max_response_latency_millis: std::option::Option<i64>,
3485
3486        /// Optional. The average response latency observed in the window, expressed
3487        /// in milliseconds.
3488        pub avg_response_latency_millis: std::option::Option<i64>,
3489
3490        /// Optional. The longest time spent waiting without receiving a response in
3491        /// the window. This could exceed max_response_latency_millis because the
3492        /// latter is evaluated only when a response is received. Expressed in
3493        /// milliseconds.
3494        pub longest_wait_no_response_millis: std::option::Option<i64>,
3495
3496        /// Optional. How many requests were sent in the window.
3497        pub requests_sent_count: std::option::Option<i64>,
3498
3499        /// Optional. How many responses were received in the window.
3500        pub responses_received_count: std::option::Option<i64>,
3501
3502        /// Optional. How many bytes were sent in the window.
3503        pub bytes_sent_count: std::option::Option<i64>,
3504
3505        /// Optional. Start time of the window interval for which these stats are
3506        /// aggregated, expressed in epoch milliseconds.
3507        pub window_start_time_epoch_millis: std::option::Option<i64>,
3508
3509        /// Optional. Duration of the window interval for which these stats are
3510        /// aggregated, expressed in milliseconds.
3511        pub window_millis: std::option::Option<i64>,
3512
3513        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3514    }
3515
3516    impl WindowStats {
3517        /// Creates a new default instance.
3518        pub fn new() -> Self {
3519            std::default::Default::default()
3520        }
3521
3522        /// Sets the value of [max_response_latency_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::max_response_latency_millis].
3523        pub fn set_max_response_latency_millis<T>(mut self, v: T) -> Self
3524        where
3525            T: std::convert::Into<i64>,
3526        {
3527            self.max_response_latency_millis = std::option::Option::Some(v.into());
3528            self
3529        }
3530
3531        /// Sets or clears the value of [max_response_latency_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::max_response_latency_millis].
3532        pub fn set_or_clear_max_response_latency_millis<T>(
3533            mut self,
3534            v: std::option::Option<T>,
3535        ) -> Self
3536        where
3537            T: std::convert::Into<i64>,
3538        {
3539            self.max_response_latency_millis = v.map(|x| x.into());
3540            self
3541        }
3542
3543        /// Sets the value of [avg_response_latency_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::avg_response_latency_millis].
3544        pub fn set_avg_response_latency_millis<T>(mut self, v: T) -> Self
3545        where
3546            T: std::convert::Into<i64>,
3547        {
3548            self.avg_response_latency_millis = std::option::Option::Some(v.into());
3549            self
3550        }
3551
3552        /// Sets or clears the value of [avg_response_latency_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::avg_response_latency_millis].
3553        pub fn set_or_clear_avg_response_latency_millis<T>(
3554            mut self,
3555            v: std::option::Option<T>,
3556        ) -> Self
3557        where
3558            T: std::convert::Into<i64>,
3559        {
3560            self.avg_response_latency_millis = v.map(|x| x.into());
3561            self
3562        }
3563
3564        /// Sets the value of [longest_wait_no_response_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::longest_wait_no_response_millis].
3565        pub fn set_longest_wait_no_response_millis<T>(mut self, v: T) -> Self
3566        where
3567            T: std::convert::Into<i64>,
3568        {
3569            self.longest_wait_no_response_millis = std::option::Option::Some(v.into());
3570            self
3571        }
3572
3573        /// Sets or clears the value of [longest_wait_no_response_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::longest_wait_no_response_millis].
3574        pub fn set_or_clear_longest_wait_no_response_millis<T>(
3575            mut self,
3576            v: std::option::Option<T>,
3577        ) -> Self
3578        where
3579            T: std::convert::Into<i64>,
3580        {
3581            self.longest_wait_no_response_millis = v.map(|x| x.into());
3582            self
3583        }
3584
3585        /// Sets the value of [requests_sent_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::requests_sent_count].
3586        pub fn set_requests_sent_count<T>(mut self, v: T) -> Self
3587        where
3588            T: std::convert::Into<i64>,
3589        {
3590            self.requests_sent_count = std::option::Option::Some(v.into());
3591            self
3592        }
3593
3594        /// Sets or clears the value of [requests_sent_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::requests_sent_count].
3595        pub fn set_or_clear_requests_sent_count<T>(mut self, v: std::option::Option<T>) -> Self
3596        where
3597            T: std::convert::Into<i64>,
3598        {
3599            self.requests_sent_count = v.map(|x| x.into());
3600            self
3601        }
3602
3603        /// Sets the value of [responses_received_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::responses_received_count].
3604        pub fn set_responses_received_count<T>(mut self, v: T) -> Self
3605        where
3606            T: std::convert::Into<i64>,
3607        {
3608            self.responses_received_count = std::option::Option::Some(v.into());
3609            self
3610        }
3611
3612        /// Sets or clears the value of [responses_received_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::responses_received_count].
3613        pub fn set_or_clear_responses_received_count<T>(mut self, v: std::option::Option<T>) -> Self
3614        where
3615            T: std::convert::Into<i64>,
3616        {
3617            self.responses_received_count = v.map(|x| x.into());
3618            self
3619        }
3620
3621        /// Sets the value of [bytes_sent_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::bytes_sent_count].
3622        pub fn set_bytes_sent_count<T>(mut self, v: T) -> Self
3623        where
3624            T: std::convert::Into<i64>,
3625        {
3626            self.bytes_sent_count = std::option::Option::Some(v.into());
3627            self
3628        }
3629
3630        /// Sets or clears the value of [bytes_sent_count][crate::write::generated::gapic_storage::model::client_stats::WindowStats::bytes_sent_count].
3631        pub fn set_or_clear_bytes_sent_count<T>(mut self, v: std::option::Option<T>) -> Self
3632        where
3633            T: std::convert::Into<i64>,
3634        {
3635            self.bytes_sent_count = v.map(|x| x.into());
3636            self
3637        }
3638
3639        /// Sets the value of [window_start_time_epoch_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::window_start_time_epoch_millis].
3640        pub fn set_window_start_time_epoch_millis<T>(mut self, v: T) -> Self
3641        where
3642            T: std::convert::Into<i64>,
3643        {
3644            self.window_start_time_epoch_millis = std::option::Option::Some(v.into());
3645            self
3646        }
3647
3648        /// Sets or clears the value of [window_start_time_epoch_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::window_start_time_epoch_millis].
3649        pub fn set_or_clear_window_start_time_epoch_millis<T>(
3650            mut self,
3651            v: std::option::Option<T>,
3652        ) -> Self
3653        where
3654            T: std::convert::Into<i64>,
3655        {
3656            self.window_start_time_epoch_millis = v.map(|x| x.into());
3657            self
3658        }
3659
3660        /// Sets the value of [window_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::window_millis].
3661        pub fn set_window_millis<T>(mut self, v: T) -> Self
3662        where
3663            T: std::convert::Into<i64>,
3664        {
3665            self.window_millis = std::option::Option::Some(v.into());
3666            self
3667        }
3668
3669        /// Sets or clears the value of [window_millis][crate::write::generated::gapic_storage::model::client_stats::WindowStats::window_millis].
3670        pub fn set_or_clear_window_millis<T>(mut self, v: std::option::Option<T>) -> Self
3671        where
3672            T: std::convert::Into<i64>,
3673        {
3674            self.window_millis = v.map(|x| x.into());
3675            self
3676        }
3677    }
3678
3679    impl wkt::message::Message for WindowStats {
3680        fn typename() -> &'static str {
3681            "type.googleapis.com/google.cloud.bigquery.storage.v1.ClientStats.WindowStats"
3682        }
3683    }
3684}
3685
3686/// Information about the ReadSession.
3687#[derive(Clone, Default, PartialEq)]
3688#[non_exhaustive]
3689pub struct ReadSession {
3690    /// Output only. Unique identifier for the session, in the form
3691    /// `projects/{project_id}/locations/{location}/sessions/{session_id}`.
3692    pub name: std::string::String,
3693
3694    /// Output only. Time at which the session becomes invalid. After this time,
3695    /// subsequent requests to read this Session will return errors. The
3696    /// expire_time is automatically assigned and currently cannot be specified or
3697    /// updated.
3698    pub expire_time: std::option::Option<wkt::Timestamp>,
3699
3700    /// Immutable. Data format of the output data. DATA_FORMAT_UNSPECIFIED not
3701    /// supported.
3702    pub data_format: crate::write::generated::gapic_storage::model::DataFormat,
3703
3704    /// Immutable. Table that this ReadSession is reading from, in the form
3705    /// `projects/{project_id}/datasets/{dataset_id}/tables/{table_id}`
3706    pub table: std::string::String,
3707
3708    /// Optional. Any modifiers which are applied when reading from the specified
3709    /// table.
3710    pub table_modifiers: std::option::Option<
3711        crate::write::generated::gapic_storage::model::read_session::TableModifiers,
3712    >,
3713
3714    /// Optional. Read options for this session (e.g. column selection, filters).
3715    pub read_options: std::option::Option<
3716        crate::write::generated::gapic_storage::model::read_session::TableReadOptions,
3717    >,
3718
3719    /// Output only. A list of streams created with the session.
3720    ///
3721    /// At least one stream is created with the session. In the future, larger
3722    /// request_stream_count values *may* result in this list being unpopulated,
3723    /// in that case, the user will need to use a List method to get the streams
3724    /// instead, which is not yet available.
3725    pub streams: std::vec::Vec<crate::write::generated::gapic_storage::model::ReadStream>,
3726
3727    /// Output only. An estimate on the number of bytes this session will scan when
3728    /// all streams are completely consumed. This estimate is based on
3729    /// metadata from the table which might be incomplete or stale.
3730    pub estimated_total_bytes_scanned: i64,
3731
3732    /// Output only. A pre-projected estimate of the total physical size of files
3733    /// (in bytes) that this session will scan when all streams are consumed. This
3734    /// estimate is independent of the selected columns and can be based on
3735    /// incomplete or stale metadata from the table.  This field is only set for
3736    /// BigLake tables.
3737    pub estimated_total_physical_file_size: i64,
3738
3739    /// Output only. An estimate on the number of rows present in this session's
3740    /// streams. This estimate is based on metadata from the table which might be
3741    /// incomplete or stale.
3742    pub estimated_row_count: i64,
3743
3744    /// Optional. ID set by client to annotate a session identity.  This does not
3745    /// need to be strictly unique, but instead the same ID should be used to group
3746    /// logically connected sessions (e.g. All using the same ID for all sessions
3747    /// needed to complete a Spark SQL query is reasonable).
3748    ///
3749    /// Maximum length is 256 bytes.
3750    pub trace_id: std::string::String,
3751
3752    /// The schema for the read. If read_options.selected_fields is set, the
3753    /// schema may be different from the table schema as it will only contain
3754    /// the selected fields.
3755    pub schema:
3756        std::option::Option<crate::write::generated::gapic_storage::model::read_session::Schema>,
3757
3758    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3759}
3760
3761impl ReadSession {
3762    /// Creates a new default instance.
3763    pub fn new() -> Self {
3764        std::default::Default::default()
3765    }
3766
3767    /// Sets the value of [name][crate::write::generated::gapic_storage::model::ReadSession::name].
3768    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3769        self.name = v.into();
3770        self
3771    }
3772
3773    /// Sets the value of [expire_time][crate::write::generated::gapic_storage::model::ReadSession::expire_time].
3774    pub fn set_expire_time<T>(mut self, v: T) -> Self
3775    where
3776        T: std::convert::Into<wkt::Timestamp>,
3777    {
3778        self.expire_time = std::option::Option::Some(v.into());
3779        self
3780    }
3781
3782    /// Sets or clears the value of [expire_time][crate::write::generated::gapic_storage::model::ReadSession::expire_time].
3783    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
3784    where
3785        T: std::convert::Into<wkt::Timestamp>,
3786    {
3787        self.expire_time = v.map(|x| x.into());
3788        self
3789    }
3790
3791    /// Sets the value of [data_format][crate::write::generated::gapic_storage::model::ReadSession::data_format].
3792    pub fn set_data_format<
3793        T: std::convert::Into<crate::write::generated::gapic_storage::model::DataFormat>,
3794    >(
3795        mut self,
3796        v: T,
3797    ) -> Self {
3798        self.data_format = v.into();
3799        self
3800    }
3801
3802    /// Sets the value of [table][crate::write::generated::gapic_storage::model::ReadSession::table].
3803    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3804        self.table = v.into();
3805        self
3806    }
3807
3808    /// Sets the value of [table_modifiers][crate::write::generated::gapic_storage::model::ReadSession::table_modifiers].
3809    pub fn set_table_modifiers<T>(mut self, v: T) -> Self
3810    where
3811        T: std::convert::Into<
3812                crate::write::generated::gapic_storage::model::read_session::TableModifiers,
3813            >,
3814    {
3815        self.table_modifiers = std::option::Option::Some(v.into());
3816        self
3817    }
3818
3819    /// Sets or clears the value of [table_modifiers][crate::write::generated::gapic_storage::model::ReadSession::table_modifiers].
3820    pub fn set_or_clear_table_modifiers<T>(mut self, v: std::option::Option<T>) -> Self
3821    where
3822        T: std::convert::Into<
3823                crate::write::generated::gapic_storage::model::read_session::TableModifiers,
3824            >,
3825    {
3826        self.table_modifiers = v.map(|x| x.into());
3827        self
3828    }
3829
3830    /// Sets the value of [read_options][crate::write::generated::gapic_storage::model::ReadSession::read_options].
3831    pub fn set_read_options<T>(mut self, v: T) -> Self
3832    where
3833        T: std::convert::Into<
3834                crate::write::generated::gapic_storage::model::read_session::TableReadOptions,
3835            >,
3836    {
3837        self.read_options = std::option::Option::Some(v.into());
3838        self
3839    }
3840
3841    /// Sets or clears the value of [read_options][crate::write::generated::gapic_storage::model::ReadSession::read_options].
3842    pub fn set_or_clear_read_options<T>(mut self, v: std::option::Option<T>) -> Self
3843    where
3844        T: std::convert::Into<
3845                crate::write::generated::gapic_storage::model::read_session::TableReadOptions,
3846            >,
3847    {
3848        self.read_options = v.map(|x| x.into());
3849        self
3850    }
3851
3852    /// Sets the value of [streams][crate::write::generated::gapic_storage::model::ReadSession::streams].
3853    pub fn set_streams<T, V>(mut self, v: T) -> Self
3854    where
3855        T: std::iter::IntoIterator<Item = V>,
3856        V: std::convert::Into<crate::write::generated::gapic_storage::model::ReadStream>,
3857    {
3858        use std::iter::Iterator;
3859        self.streams = v.into_iter().map(|i| i.into()).collect();
3860        self
3861    }
3862
3863    /// Sets the value of [estimated_total_bytes_scanned][crate::write::generated::gapic_storage::model::ReadSession::estimated_total_bytes_scanned].
3864    pub fn set_estimated_total_bytes_scanned<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3865        self.estimated_total_bytes_scanned = v.into();
3866        self
3867    }
3868
3869    /// Sets the value of [estimated_total_physical_file_size][crate::write::generated::gapic_storage::model::ReadSession::estimated_total_physical_file_size].
3870    pub fn set_estimated_total_physical_file_size<T: std::convert::Into<i64>>(
3871        mut self,
3872        v: T,
3873    ) -> Self {
3874        self.estimated_total_physical_file_size = v.into();
3875        self
3876    }
3877
3878    /// Sets the value of [estimated_row_count][crate::write::generated::gapic_storage::model::ReadSession::estimated_row_count].
3879    pub fn set_estimated_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3880        self.estimated_row_count = v.into();
3881        self
3882    }
3883
3884    /// Sets the value of [trace_id][crate::write::generated::gapic_storage::model::ReadSession::trace_id].
3885    pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3886        self.trace_id = v.into();
3887        self
3888    }
3889
3890    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadSession::schema].
3891    ///
3892    /// Note that all the setters affecting `schema` are mutually
3893    /// exclusive.
3894    pub fn set_schema<
3895        T: std::convert::Into<
3896                std::option::Option<
3897                    crate::write::generated::gapic_storage::model::read_session::Schema,
3898                >,
3899            >,
3900    >(
3901        mut self,
3902        v: T,
3903    ) -> Self {
3904        self.schema = v.into();
3905        self
3906    }
3907
3908    /// The value of [schema][crate::write::generated::gapic_storage::model::ReadSession::schema]
3909    /// if it holds a `AvroSchema`, `None` if the field is not set or
3910    /// holds a different branch.
3911    pub fn avro_schema(
3912        &self,
3913    ) -> std::option::Option<
3914        &std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
3915    > {
3916        #[allow(unreachable_patterns)]
3917        self.schema.as_ref().and_then(|v| match v {
3918            crate::write::generated::gapic_storage::model::read_session::Schema::AvroSchema(v) => {
3919                std::option::Option::Some(v)
3920            }
3921            _ => std::option::Option::None,
3922        })
3923    }
3924
3925    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadSession::schema]
3926    /// to hold a `AvroSchema`.
3927    ///
3928    /// Note that all the setters affecting `schema` are
3929    /// mutually exclusive.
3930    pub fn set_avro_schema<
3931        T: std::convert::Into<
3932                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
3933            >,
3934    >(
3935        mut self,
3936        v: T,
3937    ) -> Self {
3938        self.schema = std::option::Option::Some(
3939            crate::write::generated::gapic_storage::model::read_session::Schema::AvroSchema(
3940                v.into(),
3941            ),
3942        );
3943        self
3944    }
3945
3946    /// The value of [schema][crate::write::generated::gapic_storage::model::ReadSession::schema]
3947    /// if it holds a `ArrowSchema`, `None` if the field is not set or
3948    /// holds a different branch.
3949    pub fn arrow_schema(
3950        &self,
3951    ) -> std::option::Option<
3952        &std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
3953    > {
3954        #[allow(unreachable_patterns)]
3955        self.schema.as_ref().and_then(|v| match v {
3956            crate::write::generated::gapic_storage::model::read_session::Schema::ArrowSchema(v) => {
3957                std::option::Option::Some(v)
3958            }
3959            _ => std::option::Option::None,
3960        })
3961    }
3962
3963    /// Sets the value of [schema][crate::write::generated::gapic_storage::model::ReadSession::schema]
3964    /// to hold a `ArrowSchema`.
3965    ///
3966    /// Note that all the setters affecting `schema` are
3967    /// mutually exclusive.
3968    pub fn set_arrow_schema<
3969        T: std::convert::Into<
3970                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
3971            >,
3972    >(
3973        mut self,
3974        v: T,
3975    ) -> Self {
3976        self.schema = std::option::Option::Some(
3977            crate::write::generated::gapic_storage::model::read_session::Schema::ArrowSchema(
3978                v.into(),
3979            ),
3980        );
3981        self
3982    }
3983}
3984
3985impl wkt::message::Message for ReadSession {
3986    fn typename() -> &'static str {
3987        "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadSession"
3988    }
3989}
3990
3991/// Defines additional types related to [ReadSession].
3992pub mod read_session {
3993    #[allow(unused_imports)]
3994    use super::*;
3995
3996    /// Additional attributes when reading a table.
3997    #[derive(Clone, Default, PartialEq)]
3998    #[non_exhaustive]
3999    pub struct TableModifiers {
4000        /// The snapshot time of the table. If not set, interpreted as now.
4001        pub snapshot_time: std::option::Option<wkt::Timestamp>,
4002
4003        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4004    }
4005
4006    impl TableModifiers {
4007        /// Creates a new default instance.
4008        pub fn new() -> Self {
4009            std::default::Default::default()
4010        }
4011
4012        /// Sets the value of [snapshot_time][crate::write::generated::gapic_storage::model::read_session::TableModifiers::snapshot_time].
4013        pub fn set_snapshot_time<T>(mut self, v: T) -> Self
4014        where
4015            T: std::convert::Into<wkt::Timestamp>,
4016        {
4017            self.snapshot_time = std::option::Option::Some(v.into());
4018            self
4019        }
4020
4021        /// Sets or clears the value of [snapshot_time][crate::write::generated::gapic_storage::model::read_session::TableModifiers::snapshot_time].
4022        pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
4023        where
4024            T: std::convert::Into<wkt::Timestamp>,
4025        {
4026            self.snapshot_time = v.map(|x| x.into());
4027            self
4028        }
4029    }
4030
4031    impl wkt::message::Message for TableModifiers {
4032        fn typename() -> &'static str {
4033            "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadSession.TableModifiers"
4034        }
4035    }
4036
4037    /// Options dictating how we read a table.
4038    #[derive(Clone, Default, PartialEq)]
4039    #[non_exhaustive]
4040    pub struct TableReadOptions {
4041
4042        /// Optional. The names of the fields in the table to be returned. If no
4043        /// field names are specified, then all fields in the table are returned.
4044        ///
4045        /// Nested fields -- the child elements of a STRUCT field -- can be selected
4046        /// individually using their fully-qualified names, and will be returned as
4047        /// record fields containing only the selected nested fields. If a STRUCT
4048        /// field is specified in the selected fields list, all of the child elements
4049        /// will be returned.
4050        ///
4051        /// As an example, consider a table with the following schema:
4052        ///
4053        /// {
4054        /// "name": "struct_field",
4055        /// "type": "RECORD",
4056        /// "mode": "NULLABLE",
4057        /// "fields": [
4058        /// {
4059        /// "name": "string_field1",
4060        /// "type": "STRING",
4061        /// .              "mode": "NULLABLE"
4062        /// },
4063        /// {
4064        /// "name": "string_field2",
4065        /// "type": "STRING",
4066        /// "mode": "NULLABLE"
4067        /// }
4068        /// ]
4069        /// }
4070        ///
4071        /// Specifying "struct_field" in the selected fields list will result in a
4072        /// read session schema with the following logical structure:
4073        ///
4074        /// struct_field {
4075        /// string_field1
4076        /// string_field2
4077        /// }
4078        ///
4079        /// Specifying "struct_field.string_field1" in the selected fields list will
4080        /// result in a read session schema with the following logical structure:
4081        ///
4082        /// struct_field {
4083        /// string_field1
4084        /// }
4085        ///
4086        /// The order of the fields in the read session schema is derived from the
4087        /// table schema and does not correspond to the order in which the fields are
4088        /// specified in this list.
4089        pub selected_fields: std::vec::Vec<std::string::String>,
4090
4091        /// SQL text filtering statement, similar to a WHERE clause in a query.
4092        /// Aggregates are not supported.
4093        ///
4094        /// Examples: "int_field > 5"
4095        /// "date_field = CAST('2014-9-27' as DATE)"
4096        /// "nullable_field is not NULL"
4097        /// "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))"
4098        /// "numeric_field BETWEEN 1.0 AND 5.0"
4099        ///
4100        /// Restricted to a maximum length for 1 MB.
4101        pub row_restriction: std::string::String,
4102
4103        /// Optional. Specifies a table sampling percentage. Specifically, the query
4104        /// planner will use TABLESAMPLE SYSTEM (sample_percentage PERCENT). The
4105        /// sampling percentage is applied at the data block granularity. It will
4106        /// randomly choose for each data block whether to read the rows in that data
4107        /// block. For more details, see
4108        /// <https://cloud.google.com/bigquery/docs/table-sampling>)
4109        pub sample_percentage: std::option::Option<f64>,
4110
4111        /// Optional. Set response_compression_codec when creating a read session to
4112        /// enable application-level compression of ReadRows responses.
4113        pub response_compression_codec: std::option::Option<crate::write::generated::gapic_storage::model::read_session::table_read_options::ResponseCompressionCodec>,
4114
4115        #[allow(missing_docs)]
4116        pub output_format_serialization_options: std::option::Option<crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions>,
4117
4118        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4119    }
4120
4121    impl TableReadOptions {
4122        /// Creates a new default instance.
4123        pub fn new() -> Self {
4124            std::default::Default::default()
4125        }
4126
4127        /// Sets the value of [selected_fields][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::selected_fields].
4128        pub fn set_selected_fields<T, V>(mut self, v: T) -> Self
4129        where
4130            T: std::iter::IntoIterator<Item = V>,
4131            V: std::convert::Into<std::string::String>,
4132        {
4133            use std::iter::Iterator;
4134            self.selected_fields = v.into_iter().map(|i| i.into()).collect();
4135            self
4136        }
4137
4138        /// Sets the value of [row_restriction][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::row_restriction].
4139        pub fn set_row_restriction<T: std::convert::Into<std::string::String>>(
4140            mut self,
4141            v: T,
4142        ) -> Self {
4143            self.row_restriction = v.into();
4144            self
4145        }
4146
4147        /// Sets the value of [sample_percentage][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::sample_percentage].
4148        pub fn set_sample_percentage<T>(mut self, v: T) -> Self
4149        where
4150            T: std::convert::Into<f64>,
4151        {
4152            self.sample_percentage = std::option::Option::Some(v.into());
4153            self
4154        }
4155
4156        /// Sets or clears the value of [sample_percentage][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::sample_percentage].
4157        pub fn set_or_clear_sample_percentage<T>(mut self, v: std::option::Option<T>) -> Self
4158        where
4159            T: std::convert::Into<f64>,
4160        {
4161            self.sample_percentage = v.map(|x| x.into());
4162            self
4163        }
4164
4165        /// Sets the value of [response_compression_codec][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::response_compression_codec].
4166        pub fn set_response_compression_codec<T>(mut self, v: T) -> Self
4167        where T: std::convert::Into<crate::write::generated::gapic_storage::model::read_session::table_read_options::ResponseCompressionCodec>
4168        {
4169            self.response_compression_codec = std::option::Option::Some(v.into());
4170            self
4171        }
4172
4173        /// Sets or clears the value of [response_compression_codec][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::response_compression_codec].
4174        pub fn set_or_clear_response_compression_codec<T>(mut self, v: std::option::Option<T>) -> Self
4175        where T: std::convert::Into<crate::write::generated::gapic_storage::model::read_session::table_read_options::ResponseCompressionCodec>
4176        {
4177            self.response_compression_codec = v.map(|x| x.into());
4178            self
4179        }
4180
4181        /// Sets the value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::output_format_serialization_options].
4182        ///
4183        /// Note that all the setters affecting `output_format_serialization_options` are mutually
4184        /// exclusive.
4185        pub fn set_output_format_serialization_options<T: std::convert::Into<std::option::Option<crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions>>>(mut self, v: T) -> Self
4186        {
4187            self.output_format_serialization_options = v.into();
4188            self
4189        }
4190
4191        /// The value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::output_format_serialization_options]
4192        /// if it holds a `ArrowSerializationOptions`, `None` if the field is not set or
4193        /// holds a different branch.
4194        pub fn arrow_serialization_options(
4195            &self,
4196        ) -> std::option::Option<
4197            &std::boxed::Box<
4198                crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
4199            >,
4200        > {
4201            #[allow(unreachable_patterns)]
4202            self.output_format_serialization_options.as_ref().and_then(|v| match v {
4203                crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions::ArrowSerializationOptions(v) => std::option::Option::Some(v),
4204                _ => std::option::Option::None,
4205            })
4206        }
4207
4208        /// Sets the value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::output_format_serialization_options]
4209        /// to hold a `ArrowSerializationOptions`.
4210        ///
4211        /// Note that all the setters affecting `output_format_serialization_options` are
4212        /// mutually exclusive.
4213        pub fn set_arrow_serialization_options<
4214            T: std::convert::Into<
4215                    std::boxed::Box<
4216                        crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
4217                    >,
4218                >,
4219        >(
4220            mut self,
4221            v: T,
4222        ) -> Self {
4223            self.output_format_serialization_options = std::option::Option::Some(
4224                crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions::ArrowSerializationOptions(
4225                    v.into()
4226                )
4227            );
4228            self
4229        }
4230
4231        /// The value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::output_format_serialization_options]
4232        /// if it holds a `AvroSerializationOptions`, `None` if the field is not set or
4233        /// holds a different branch.
4234        pub fn avro_serialization_options(
4235            &self,
4236        ) -> std::option::Option<
4237            &std::boxed::Box<
4238                crate::write::generated::gapic_storage::model::AvroSerializationOptions,
4239            >,
4240        > {
4241            #[allow(unreachable_patterns)]
4242            self.output_format_serialization_options.as_ref().and_then(|v| match v {
4243                crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions::AvroSerializationOptions(v) => std::option::Option::Some(v),
4244                _ => std::option::Option::None,
4245            })
4246        }
4247
4248        /// Sets the value of [output_format_serialization_options][crate::write::generated::gapic_storage::model::read_session::TableReadOptions::output_format_serialization_options]
4249        /// to hold a `AvroSerializationOptions`.
4250        ///
4251        /// Note that all the setters affecting `output_format_serialization_options` are
4252        /// mutually exclusive.
4253        pub fn set_avro_serialization_options<
4254            T: std::convert::Into<
4255                    std::boxed::Box<
4256                        crate::write::generated::gapic_storage::model::AvroSerializationOptions,
4257                    >,
4258                >,
4259        >(
4260            mut self,
4261            v: T,
4262        ) -> Self {
4263            self.output_format_serialization_options = std::option::Option::Some(
4264                crate::write::generated::gapic_storage::model::read_session::table_read_options::OutputFormatSerializationOptions::AvroSerializationOptions(
4265                    v.into()
4266                )
4267            );
4268            self
4269        }
4270    }
4271
4272    impl wkt::message::Message for TableReadOptions {
4273        fn typename() -> &'static str {
4274            "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadSession.TableReadOptions"
4275        }
4276    }
4277
4278    /// Defines additional types related to [TableReadOptions].
4279    pub mod table_read_options {
4280        #[allow(unused_imports)]
4281        use super::*;
4282
4283        /// Specifies which compression codec to attempt on the entire serialized
4284        /// response payload (either Arrow record batch or Avro rows). This is
4285        /// not to be confused with the Apache Arrow native compression codecs
4286        /// specified in ArrowSerializationOptions. For performance reasons, when
4287        /// creating a read session requesting Arrow responses, setting both native
4288        /// Arrow compression and application-level response compression will not be
4289        /// allowed - choose, at most, one kind of compression.
4290        ///
4291        /// # Working with unknown values
4292        ///
4293        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4294        /// additional enum variants at any time. Adding new variants is not considered
4295        /// a breaking change. Applications should write their code in anticipation of:
4296        ///
4297        /// - New values appearing in future releases of the client library, **and**
4298        /// - New values received dynamically, without application changes.
4299        ///
4300        /// Please consult the [Working with enums] section in the user guide for some
4301        /// guidelines.
4302        ///
4303        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4304        #[derive(Clone, Debug, PartialEq)]
4305        #[non_exhaustive]
4306        pub enum ResponseCompressionCodec {
4307            /// Default is no compression.
4308            Unspecified,
4309            /// Use raw LZ4 compression.
4310            Lz4,
4311            /// If set, the enum was initialized with an unknown value.
4312            ///
4313            /// Applications can examine the value using [ResponseCompressionCodec::value] or
4314            /// [ResponseCompressionCodec::name].
4315            UnknownValue(response_compression_codec::UnknownValue),
4316        }
4317
4318        #[doc(hidden)]
4319        pub mod response_compression_codec {
4320            #[allow(unused_imports)]
4321            use super::*;
4322            #[derive(Clone, Debug, PartialEq)]
4323            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4324        }
4325
4326        impl ResponseCompressionCodec {
4327            /// Gets the enum value.
4328            ///
4329            /// Returns `None` if the enum contains an unknown value deserialized from
4330            /// the string representation of enums.
4331            pub fn value(&self) -> std::option::Option<i32> {
4332                match self {
4333                    Self::Unspecified => std::option::Option::Some(0),
4334                    Self::Lz4 => std::option::Option::Some(2),
4335                    Self::UnknownValue(u) => u.0.value(),
4336                }
4337            }
4338
4339            /// Gets the enum value as a string.
4340            ///
4341            /// Returns `None` if the enum contains an unknown value deserialized from
4342            /// the integer representation of enums.
4343            pub fn name(&self) -> std::option::Option<&str> {
4344                match self {
4345                    Self::Unspecified => {
4346                        std::option::Option::Some("RESPONSE_COMPRESSION_CODEC_UNSPECIFIED")
4347                    }
4348                    Self::Lz4 => std::option::Option::Some("RESPONSE_COMPRESSION_CODEC_LZ4"),
4349                    Self::UnknownValue(u) => u.0.name(),
4350                }
4351            }
4352        }
4353
4354        impl std::default::Default for ResponseCompressionCodec {
4355            fn default() -> Self {
4356                use std::convert::From;
4357                Self::from(0)
4358            }
4359        }
4360
4361        impl std::fmt::Display for ResponseCompressionCodec {
4362            fn fmt(
4363                &self,
4364                f: &mut std::fmt::Formatter<'_>,
4365            ) -> std::result::Result<(), std::fmt::Error> {
4366                wkt::internal::display_enum(f, self.name(), self.value())
4367            }
4368        }
4369
4370        impl std::convert::From<i32> for ResponseCompressionCodec {
4371            fn from(value: i32) -> Self {
4372                match value {
4373                    0 => Self::Unspecified,
4374                    2 => Self::Lz4,
4375                    _ => Self::UnknownValue(response_compression_codec::UnknownValue(
4376                        wkt::internal::UnknownEnumValue::Integer(value),
4377                    )),
4378                }
4379            }
4380        }
4381
4382        impl std::convert::From<&str> for ResponseCompressionCodec {
4383            fn from(value: &str) -> Self {
4384                use std::string::ToString;
4385                match value {
4386                    "RESPONSE_COMPRESSION_CODEC_UNSPECIFIED" => Self::Unspecified,
4387                    "RESPONSE_COMPRESSION_CODEC_LZ4" => Self::Lz4,
4388                    _ => Self::UnknownValue(response_compression_codec::UnknownValue(
4389                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4390                    )),
4391                }
4392            }
4393        }
4394
4395        impl serde::ser::Serialize for ResponseCompressionCodec {
4396            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4397            where
4398                S: serde::Serializer,
4399            {
4400                match self {
4401                    Self::Unspecified => serializer.serialize_i32(0),
4402                    Self::Lz4 => serializer.serialize_i32(2),
4403                    Self::UnknownValue(u) => u.0.serialize(serializer),
4404                }
4405            }
4406        }
4407
4408        impl<'de> serde::de::Deserialize<'de> for ResponseCompressionCodec {
4409            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4410            where
4411                D: serde::Deserializer<'de>,
4412            {
4413                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseCompressionCodec>::new(
4414                    ".google.cloud.bigquery.storage.v1.ReadSession.TableReadOptions.ResponseCompressionCodec"))
4415            }
4416        }
4417
4418        #[allow(missing_docs)]
4419        #[derive(Clone, Debug, PartialEq)]
4420        #[non_exhaustive]
4421        pub enum OutputFormatSerializationOptions {
4422            /// Optional. Options specific to the Apache Arrow output format.
4423            ArrowSerializationOptions(
4424                std::boxed::Box<
4425                    crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
4426                >,
4427            ),
4428            /// Optional. Options specific to the Apache Avro output format
4429            AvroSerializationOptions(
4430                std::boxed::Box<
4431                    crate::write::generated::gapic_storage::model::AvroSerializationOptions,
4432                >,
4433            ),
4434        }
4435
4436        impl OutputFormatSerializationOptions {
4437            /// Initializes the enum to the [ArrowSerializationOptions](Self::ArrowSerializationOptions) branch.
4438            pub fn from_arrow_serialization_options(
4439                value: impl std::convert::Into<
4440                    std::boxed::Box<
4441                        crate::write::generated::gapic_storage::model::ArrowSerializationOptions,
4442                    >,
4443                >,
4444            ) -> Self {
4445                Self::ArrowSerializationOptions(value.into())
4446            }
4447            /// Initializes the enum to the [AvroSerializationOptions](Self::AvroSerializationOptions) branch.
4448            pub fn from_avro_serialization_options(
4449                value: impl std::convert::Into<
4450                    std::boxed::Box<
4451                        crate::write::generated::gapic_storage::model::AvroSerializationOptions,
4452                    >,
4453                >,
4454            ) -> Self {
4455                Self::AvroSerializationOptions(value.into())
4456            }
4457        }
4458    }
4459
4460    /// The schema for the read. If read_options.selected_fields is set, the
4461    /// schema may be different from the table schema as it will only contain
4462    /// the selected fields.
4463    #[derive(Clone, Debug, PartialEq)]
4464    #[non_exhaustive]
4465    pub enum Schema {
4466        /// Output only. Avro schema.
4467        AvroSchema(std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>),
4468        /// Output only. Arrow schema.
4469        ArrowSchema(std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>),
4470    }
4471
4472    impl Schema {
4473        /// Initializes the enum to the [AvroSchema](Self::AvroSchema) branch.
4474        pub fn from_avro_schema(
4475            value: impl std::convert::Into<
4476                std::boxed::Box<crate::write::generated::gapic_storage::model::AvroSchema>,
4477            >,
4478        ) -> Self {
4479            Self::AvroSchema(value.into())
4480        }
4481        /// Initializes the enum to the [ArrowSchema](Self::ArrowSchema) branch.
4482        pub fn from_arrow_schema(
4483            value: impl std::convert::Into<
4484                std::boxed::Box<crate::write::generated::gapic_storage::model::ArrowSchema>,
4485            >,
4486        ) -> Self {
4487            Self::ArrowSchema(value.into())
4488        }
4489    }
4490}
4491
4492/// Information about a single stream that gets data out of the storage system.
4493/// Most of the information about `ReadStream` instances is aggregated, making
4494/// `ReadStream` lightweight.
4495#[derive(Clone, Default, PartialEq)]
4496#[non_exhaustive]
4497pub struct ReadStream {
4498    /// Output only. Name of the stream, in the form
4499    /// `projects/{project_id}/locations/{location}/sessions/{session_id}/streams/{stream_id}`.
4500    pub name: std::string::String,
4501
4502    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4503}
4504
4505impl ReadStream {
4506    /// Creates a new default instance.
4507    pub fn new() -> Self {
4508        std::default::Default::default()
4509    }
4510
4511    /// Sets the value of [name][crate::write::generated::gapic_storage::model::ReadStream::name].
4512    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4513        self.name = v.into();
4514        self
4515    }
4516}
4517
4518impl wkt::message::Message for ReadStream {
4519    fn typename() -> &'static str {
4520        "type.googleapis.com/google.cloud.bigquery.storage.v1.ReadStream"
4521    }
4522}
4523
4524/// Information about a single stream that gets data inside the storage system.
4525#[derive(Clone, Default, PartialEq)]
4526#[non_exhaustive]
4527pub struct WriteStream {
4528    /// Output only. Name of the stream, in the form
4529    /// `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`.
4530    pub name: std::string::String,
4531
4532    /// Immutable. Type of the stream.
4533    pub r#type: crate::write::generated::gapic_storage::model::write_stream::Type,
4534
4535    /// Output only. Create time of the stream. For the _default stream, this is
4536    /// the creation_time of the table.
4537    pub create_time: std::option::Option<wkt::Timestamp>,
4538
4539    /// Output only. Commit time of the stream.
4540    /// If a stream is of `COMMITTED` type, then it will have a commit_time same as
4541    /// `create_time`. If the stream is of `PENDING` type, empty commit_time
4542    /// means it is not committed.
4543    pub commit_time: std::option::Option<wkt::Timestamp>,
4544
4545    /// Output only. The schema of the destination table. It is only returned in
4546    /// `CreateWriteStream` response. Caller should generate data that's
4547    /// compatible with this schema to send in initial `AppendRowsRequest`.
4548    /// The table schema could go out of date during the life time of the stream.
4549    pub table_schema:
4550        std::option::Option<crate::write::generated::gapic_storage::model::TableSchema>,
4551
4552    /// Immutable. Mode of the stream.
4553    pub write_mode: crate::write::generated::gapic_storage::model::write_stream::WriteMode,
4554
4555    /// Output only. The geographic location where the stream's dataset resides.
4556    /// See <https://cloud.google.com/bigquery/docs/locations> for supported
4557    /// locations.
4558    pub location: std::string::String,
4559
4560    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4561}
4562
4563impl WriteStream {
4564    /// Creates a new default instance.
4565    pub fn new() -> Self {
4566        std::default::Default::default()
4567    }
4568
4569    /// Sets the value of [name][crate::write::generated::gapic_storage::model::WriteStream::name].
4570    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4571        self.name = v.into();
4572        self
4573    }
4574
4575    /// Sets the value of [r#type][crate::write::generated::gapic_storage::model::WriteStream::type].
4576    pub fn set_type<
4577        T: std::convert::Into<crate::write::generated::gapic_storage::model::write_stream::Type>,
4578    >(
4579        mut self,
4580        v: T,
4581    ) -> Self {
4582        self.r#type = v.into();
4583        self
4584    }
4585
4586    /// Sets the value of [create_time][crate::write::generated::gapic_storage::model::WriteStream::create_time].
4587    pub fn set_create_time<T>(mut self, v: T) -> Self
4588    where
4589        T: std::convert::Into<wkt::Timestamp>,
4590    {
4591        self.create_time = std::option::Option::Some(v.into());
4592        self
4593    }
4594
4595    /// Sets or clears the value of [create_time][crate::write::generated::gapic_storage::model::WriteStream::create_time].
4596    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4597    where
4598        T: std::convert::Into<wkt::Timestamp>,
4599    {
4600        self.create_time = v.map(|x| x.into());
4601        self
4602    }
4603
4604    /// Sets the value of [commit_time][crate::write::generated::gapic_storage::model::WriteStream::commit_time].
4605    pub fn set_commit_time<T>(mut self, v: T) -> Self
4606    where
4607        T: std::convert::Into<wkt::Timestamp>,
4608    {
4609        self.commit_time = std::option::Option::Some(v.into());
4610        self
4611    }
4612
4613    /// Sets or clears the value of [commit_time][crate::write::generated::gapic_storage::model::WriteStream::commit_time].
4614    pub fn set_or_clear_commit_time<T>(mut self, v: std::option::Option<T>) -> Self
4615    where
4616        T: std::convert::Into<wkt::Timestamp>,
4617    {
4618        self.commit_time = v.map(|x| x.into());
4619        self
4620    }
4621
4622    /// Sets the value of [table_schema][crate::write::generated::gapic_storage::model::WriteStream::table_schema].
4623    pub fn set_table_schema<T>(mut self, v: T) -> Self
4624    where
4625        T: std::convert::Into<crate::write::generated::gapic_storage::model::TableSchema>,
4626    {
4627        self.table_schema = std::option::Option::Some(v.into());
4628        self
4629    }
4630
4631    /// Sets or clears the value of [table_schema][crate::write::generated::gapic_storage::model::WriteStream::table_schema].
4632    pub fn set_or_clear_table_schema<T>(mut self, v: std::option::Option<T>) -> Self
4633    where
4634        T: std::convert::Into<crate::write::generated::gapic_storage::model::TableSchema>,
4635    {
4636        self.table_schema = v.map(|x| x.into());
4637        self
4638    }
4639
4640    /// Sets the value of [write_mode][crate::write::generated::gapic_storage::model::WriteStream::write_mode].
4641    pub fn set_write_mode<
4642        T: std::convert::Into<crate::write::generated::gapic_storage::model::write_stream::WriteMode>,
4643    >(
4644        mut self,
4645        v: T,
4646    ) -> Self {
4647        self.write_mode = v.into();
4648        self
4649    }
4650
4651    /// Sets the value of [location][crate::write::generated::gapic_storage::model::WriteStream::location].
4652    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4653        self.location = v.into();
4654        self
4655    }
4656}
4657
4658impl wkt::message::Message for WriteStream {
4659    fn typename() -> &'static str {
4660        "type.googleapis.com/google.cloud.bigquery.storage.v1.WriteStream"
4661    }
4662}
4663
4664/// Defines additional types related to [WriteStream].
4665pub mod write_stream {
4666    #[allow(unused_imports)]
4667    use super::*;
4668
4669    /// Type enum of the stream.
4670    ///
4671    /// # Working with unknown values
4672    ///
4673    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4674    /// additional enum variants at any time. Adding new variants is not considered
4675    /// a breaking change. Applications should write their code in anticipation of:
4676    ///
4677    /// - New values appearing in future releases of the client library, **and**
4678    /// - New values received dynamically, without application changes.
4679    ///
4680    /// Please consult the [Working with enums] section in the user guide for some
4681    /// guidelines.
4682    ///
4683    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4684    #[derive(Clone, Debug, PartialEq)]
4685    #[non_exhaustive]
4686    pub enum Type {
4687        /// Unknown type.
4688        Unspecified,
4689        /// Data will commit automatically and appear as soon as the write is
4690        /// acknowledged.
4691        Committed,
4692        /// Data is invisible until the stream is committed.
4693        Pending,
4694        /// Data is only visible up to the offset to which it was flushed.
4695        Buffered,
4696        /// If set, the enum was initialized with an unknown value.
4697        ///
4698        /// Applications can examine the value using [Type::value] or
4699        /// [Type::name].
4700        UnknownValue(r#type::UnknownValue),
4701    }
4702
4703    #[doc(hidden)]
4704    pub mod r#type {
4705        #[allow(unused_imports)]
4706        use super::*;
4707        #[derive(Clone, Debug, PartialEq)]
4708        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4709    }
4710
4711    impl Type {
4712        /// Gets the enum value.
4713        ///
4714        /// Returns `None` if the enum contains an unknown value deserialized from
4715        /// the string representation of enums.
4716        pub fn value(&self) -> std::option::Option<i32> {
4717            match self {
4718                Self::Unspecified => std::option::Option::Some(0),
4719                Self::Committed => std::option::Option::Some(1),
4720                Self::Pending => std::option::Option::Some(2),
4721                Self::Buffered => std::option::Option::Some(3),
4722                Self::UnknownValue(u) => u.0.value(),
4723            }
4724        }
4725
4726        /// Gets the enum value as a string.
4727        ///
4728        /// Returns `None` if the enum contains an unknown value deserialized from
4729        /// the integer representation of enums.
4730        pub fn name(&self) -> std::option::Option<&str> {
4731            match self {
4732                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
4733                Self::Committed => std::option::Option::Some("COMMITTED"),
4734                Self::Pending => std::option::Option::Some("PENDING"),
4735                Self::Buffered => std::option::Option::Some("BUFFERED"),
4736                Self::UnknownValue(u) => u.0.name(),
4737            }
4738        }
4739    }
4740
4741    impl std::default::Default for Type {
4742        fn default() -> Self {
4743            use std::convert::From;
4744            Self::from(0)
4745        }
4746    }
4747
4748    impl std::fmt::Display for Type {
4749        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4750            wkt::internal::display_enum(f, self.name(), self.value())
4751        }
4752    }
4753
4754    impl std::convert::From<i32> for Type {
4755        fn from(value: i32) -> Self {
4756            match value {
4757                0 => Self::Unspecified,
4758                1 => Self::Committed,
4759                2 => Self::Pending,
4760                3 => Self::Buffered,
4761                _ => Self::UnknownValue(r#type::UnknownValue(
4762                    wkt::internal::UnknownEnumValue::Integer(value),
4763                )),
4764            }
4765        }
4766    }
4767
4768    impl std::convert::From<&str> for Type {
4769        fn from(value: &str) -> Self {
4770            use std::string::ToString;
4771            match value {
4772                "TYPE_UNSPECIFIED" => Self::Unspecified,
4773                "COMMITTED" => Self::Committed,
4774                "PENDING" => Self::Pending,
4775                "BUFFERED" => Self::Buffered,
4776                _ => Self::UnknownValue(r#type::UnknownValue(
4777                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4778                )),
4779            }
4780        }
4781    }
4782
4783    impl serde::ser::Serialize for Type {
4784        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4785        where
4786            S: serde::Serializer,
4787        {
4788            match self {
4789                Self::Unspecified => serializer.serialize_i32(0),
4790                Self::Committed => serializer.serialize_i32(1),
4791                Self::Pending => serializer.serialize_i32(2),
4792                Self::Buffered => serializer.serialize_i32(3),
4793                Self::UnknownValue(u) => u.0.serialize(serializer),
4794            }
4795        }
4796    }
4797
4798    impl<'de> serde::de::Deserialize<'de> for Type {
4799        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4800        where
4801            D: serde::Deserializer<'de>,
4802        {
4803            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
4804                ".google.cloud.bigquery.storage.v1.WriteStream.Type",
4805            ))
4806        }
4807    }
4808
4809    /// Mode enum of the stream.
4810    ///
4811    /// # Working with unknown values
4812    ///
4813    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4814    /// additional enum variants at any time. Adding new variants is not considered
4815    /// a breaking change. Applications should write their code in anticipation of:
4816    ///
4817    /// - New values appearing in future releases of the client library, **and**
4818    /// - New values received dynamically, without application changes.
4819    ///
4820    /// Please consult the [Working with enums] section in the user guide for some
4821    /// guidelines.
4822    ///
4823    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4824    #[derive(Clone, Debug, PartialEq)]
4825    #[non_exhaustive]
4826    pub enum WriteMode {
4827        /// Unknown type.
4828        Unspecified,
4829        /// Insert new records into the table.
4830        /// It is the default value if customers do not specify it.
4831        Insert,
4832        /// If set, the enum was initialized with an unknown value.
4833        ///
4834        /// Applications can examine the value using [WriteMode::value] or
4835        /// [WriteMode::name].
4836        UnknownValue(write_mode::UnknownValue),
4837    }
4838
4839    #[doc(hidden)]
4840    pub mod write_mode {
4841        #[allow(unused_imports)]
4842        use super::*;
4843        #[derive(Clone, Debug, PartialEq)]
4844        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4845    }
4846
4847    impl WriteMode {
4848        /// Gets the enum value.
4849        ///
4850        /// Returns `None` if the enum contains an unknown value deserialized from
4851        /// the string representation of enums.
4852        pub fn value(&self) -> std::option::Option<i32> {
4853            match self {
4854                Self::Unspecified => std::option::Option::Some(0),
4855                Self::Insert => std::option::Option::Some(1),
4856                Self::UnknownValue(u) => u.0.value(),
4857            }
4858        }
4859
4860        /// Gets the enum value as a string.
4861        ///
4862        /// Returns `None` if the enum contains an unknown value deserialized from
4863        /// the integer representation of enums.
4864        pub fn name(&self) -> std::option::Option<&str> {
4865            match self {
4866                Self::Unspecified => std::option::Option::Some("WRITE_MODE_UNSPECIFIED"),
4867                Self::Insert => std::option::Option::Some("INSERT"),
4868                Self::UnknownValue(u) => u.0.name(),
4869            }
4870        }
4871    }
4872
4873    impl std::default::Default for WriteMode {
4874        fn default() -> Self {
4875            use std::convert::From;
4876            Self::from(0)
4877        }
4878    }
4879
4880    impl std::fmt::Display for WriteMode {
4881        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4882            wkt::internal::display_enum(f, self.name(), self.value())
4883        }
4884    }
4885
4886    impl std::convert::From<i32> for WriteMode {
4887        fn from(value: i32) -> Self {
4888            match value {
4889                0 => Self::Unspecified,
4890                1 => Self::Insert,
4891                _ => Self::UnknownValue(write_mode::UnknownValue(
4892                    wkt::internal::UnknownEnumValue::Integer(value),
4893                )),
4894            }
4895        }
4896    }
4897
4898    impl std::convert::From<&str> for WriteMode {
4899        fn from(value: &str) -> Self {
4900            use std::string::ToString;
4901            match value {
4902                "WRITE_MODE_UNSPECIFIED" => Self::Unspecified,
4903                "INSERT" => Self::Insert,
4904                _ => Self::UnknownValue(write_mode::UnknownValue(
4905                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4906                )),
4907            }
4908        }
4909    }
4910
4911    impl serde::ser::Serialize for WriteMode {
4912        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4913        where
4914            S: serde::Serializer,
4915        {
4916            match self {
4917                Self::Unspecified => serializer.serialize_i32(0),
4918                Self::Insert => serializer.serialize_i32(1),
4919                Self::UnknownValue(u) => u.0.serialize(serializer),
4920            }
4921        }
4922    }
4923
4924    impl<'de> serde::de::Deserialize<'de> for WriteMode {
4925        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4926        where
4927            D: serde::Deserializer<'de>,
4928        {
4929            deserializer.deserialize_any(wkt::internal::EnumVisitor::<WriteMode>::new(
4930                ".google.cloud.bigquery.storage.v1.WriteStream.WriteMode",
4931            ))
4932        }
4933    }
4934}
4935
4936/// Schema of a table. This schema is a subset of
4937/// google.cloud.bigquery.v2.TableSchema containing information necessary to
4938/// generate valid message to write to BigQuery.
4939#[derive(Clone, Default, PartialEq)]
4940#[non_exhaustive]
4941pub struct TableSchema {
4942    /// Describes the fields in a table.
4943    pub fields: std::vec::Vec<crate::write::generated::gapic_storage::model::TableFieldSchema>,
4944
4945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4946}
4947
4948impl TableSchema {
4949    /// Creates a new default instance.
4950    pub fn new() -> Self {
4951        std::default::Default::default()
4952    }
4953
4954    /// Sets the value of [fields][crate::write::generated::gapic_storage::model::TableSchema::fields].
4955    pub fn set_fields<T, V>(mut self, v: T) -> Self
4956    where
4957        T: std::iter::IntoIterator<Item = V>,
4958        V: std::convert::Into<crate::write::generated::gapic_storage::model::TableFieldSchema>,
4959    {
4960        use std::iter::Iterator;
4961        self.fields = v.into_iter().map(|i| i.into()).collect();
4962        self
4963    }
4964}
4965
4966impl wkt::message::Message for TableSchema {
4967    fn typename() -> &'static str {
4968        "type.googleapis.com/google.cloud.bigquery.storage.v1.TableSchema"
4969    }
4970}
4971
4972/// TableFieldSchema defines a single field/column within a table schema.
4973#[derive(Clone, Default, PartialEq)]
4974#[non_exhaustive]
4975pub struct TableFieldSchema {
4976    /// Required. The field name. The name must contain only letters (a-z, A-Z),
4977    /// numbers (0-9), or underscores (_), and must start with a letter or
4978    /// underscore. The maximum length is 128 characters.
4979    pub name: std::string::String,
4980
4981    /// Required. The field data type.
4982    pub r#type: crate::write::generated::gapic_storage::model::table_field_schema::Type,
4983
4984    /// Optional. The field mode. The default value is NULLABLE.
4985    pub mode: crate::write::generated::gapic_storage::model::table_field_schema::Mode,
4986
4987    /// Optional. Describes the nested schema fields if the type property is set to
4988    /// STRUCT.
4989    pub fields: std::vec::Vec<crate::write::generated::gapic_storage::model::TableFieldSchema>,
4990
4991    /// Optional. The field description. The maximum length is 1,024 characters.
4992    pub description: std::string::String,
4993
4994    /// Optional. Maximum length of values of this field for STRINGS or BYTES.
4995    ///
4996    /// If max_length is not specified, no maximum length constraint is imposed
4997    /// on this field.
4998    ///
4999    /// If type = "STRING", then max_length represents the maximum UTF-8
5000    /// length of strings in this field.
5001    ///
5002    /// If type = "BYTES", then max_length represents the maximum number of
5003    /// bytes in this field.
5004    ///
5005    /// It is invalid to set this field if type is not "STRING" or "BYTES".
5006    pub max_length: i64,
5007
5008    /// Optional. Precision (maximum number of total digits in base 10) and scale
5009    /// (maximum number of digits in the fractional part in base 10) constraints
5010    /// for values of this field for NUMERIC or BIGNUMERIC.
5011    ///
5012    /// It is invalid to set precision or scale if type is not "NUMERIC" or
5013    /// "BIGNUMERIC".
5014    ///
5015    /// If precision and scale are not specified, no value range constraint is
5016    /// imposed on this field insofar as values are permitted by the type.
5017    ///
5018    /// Values of this NUMERIC or BIGNUMERIC field must be in this range when:
5019    ///
5020    /// * Precision (P) and scale (S) are specified:
5021    ///   [-10^(P-S) + 10^(-S), 10^(P-S) - 10^(-S)]
5022    /// * Precision (P) is specified but not scale (and thus scale is
5023    ///   interpreted to be equal to zero):
5024    ///   [-10^P + 1, 10^P - 1].
5025    ///
5026    /// Acceptable values for precision and scale if both are specified:
5027    ///
5028    /// * If type = "NUMERIC":
5029    ///   1 <= precision - scale <= 29 and 0 <= scale <= 9.
5030    /// * If type = "BIGNUMERIC":
5031    ///   1 <= precision - scale <= 38 and 0 <= scale <= 38.
5032    ///
5033    /// Acceptable values for precision if only precision is specified but not
5034    /// scale (and thus scale is interpreted to be equal to zero):
5035    ///
5036    /// * If type = "NUMERIC": 1 <= precision <= 29.
5037    /// * If type = "BIGNUMERIC": 1 <= precision <= 38.
5038    ///
5039    /// If scale is specified but not precision, then it is invalid.
5040    pub precision: i64,
5041
5042    /// Optional. See documentation for precision.
5043    pub scale: i64,
5044
5045    /// Optional. A SQL expression to specify the [default value]
5046    /// (<https://cloud.google.com/bigquery/docs/default-values>) for this field.
5047    pub default_value_expression: std::string::String,
5048
5049    /// Optional. Precision (maximum number of total digits in base 10) for seconds
5050    /// of TIMESTAMP type.
5051    ///
5052    /// Possible values include:
5053    ///
5054    /// * 6 (Default, for TIMESTAMP type with microsecond precision)
5055    /// * 12 (For TIMESTAMP type with picosecond precision)
5056    pub timestamp_precision: std::option::Option<wkt::Int64Value>,
5057
5058    /// Optional. The subtype of the RANGE, if the type of this field is RANGE. If
5059    /// the type is RANGE, this field is required. Possible values for the field
5060    /// element type of a RANGE include:
5061    ///
5062    /// * DATE
5063    /// * DATETIME
5064    /// * TIMESTAMP
5065    pub range_element_type: std::option::Option<
5066        crate::write::generated::gapic_storage::model::table_field_schema::FieldElementType,
5067    >,
5068
5069    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5070}
5071
5072impl TableFieldSchema {
5073    /// Creates a new default instance.
5074    pub fn new() -> Self {
5075        std::default::Default::default()
5076    }
5077
5078    /// Sets the value of [name][crate::write::generated::gapic_storage::model::TableFieldSchema::name].
5079    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5080        self.name = v.into();
5081        self
5082    }
5083
5084    /// Sets the value of [r#type][crate::write::generated::gapic_storage::model::TableFieldSchema::type].
5085    pub fn set_type<
5086        T: std::convert::Into<crate::write::generated::gapic_storage::model::table_field_schema::Type>,
5087    >(
5088        mut self,
5089        v: T,
5090    ) -> Self {
5091        self.r#type = v.into();
5092        self
5093    }
5094
5095    /// Sets the value of [mode][crate::write::generated::gapic_storage::model::TableFieldSchema::mode].
5096    pub fn set_mode<
5097        T: std::convert::Into<crate::write::generated::gapic_storage::model::table_field_schema::Mode>,
5098    >(
5099        mut self,
5100        v: T,
5101    ) -> Self {
5102        self.mode = v.into();
5103        self
5104    }
5105
5106    /// Sets the value of [fields][crate::write::generated::gapic_storage::model::TableFieldSchema::fields].
5107    pub fn set_fields<T, V>(mut self, v: T) -> Self
5108    where
5109        T: std::iter::IntoIterator<Item = V>,
5110        V: std::convert::Into<crate::write::generated::gapic_storage::model::TableFieldSchema>,
5111    {
5112        use std::iter::Iterator;
5113        self.fields = v.into_iter().map(|i| i.into()).collect();
5114        self
5115    }
5116
5117    /// Sets the value of [description][crate::write::generated::gapic_storage::model::TableFieldSchema::description].
5118    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5119        self.description = v.into();
5120        self
5121    }
5122
5123    /// Sets the value of [max_length][crate::write::generated::gapic_storage::model::TableFieldSchema::max_length].
5124    pub fn set_max_length<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5125        self.max_length = v.into();
5126        self
5127    }
5128
5129    /// Sets the value of [precision][crate::write::generated::gapic_storage::model::TableFieldSchema::precision].
5130    pub fn set_precision<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5131        self.precision = v.into();
5132        self
5133    }
5134
5135    /// Sets the value of [scale][crate::write::generated::gapic_storage::model::TableFieldSchema::scale].
5136    pub fn set_scale<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5137        self.scale = v.into();
5138        self
5139    }
5140
5141    /// Sets the value of [default_value_expression][crate::write::generated::gapic_storage::model::TableFieldSchema::default_value_expression].
5142    pub fn set_default_value_expression<T: std::convert::Into<std::string::String>>(
5143        mut self,
5144        v: T,
5145    ) -> Self {
5146        self.default_value_expression = v.into();
5147        self
5148    }
5149
5150    /// Sets the value of [timestamp_precision][crate::write::generated::gapic_storage::model::TableFieldSchema::timestamp_precision].
5151    pub fn set_timestamp_precision<T>(mut self, v: T) -> Self
5152    where
5153        T: std::convert::Into<wkt::Int64Value>,
5154    {
5155        self.timestamp_precision = std::option::Option::Some(v.into());
5156        self
5157    }
5158
5159    /// Sets or clears the value of [timestamp_precision][crate::write::generated::gapic_storage::model::TableFieldSchema::timestamp_precision].
5160    pub fn set_or_clear_timestamp_precision<T>(mut self, v: std::option::Option<T>) -> Self
5161    where
5162        T: std::convert::Into<wkt::Int64Value>,
5163    {
5164        self.timestamp_precision = v.map(|x| x.into());
5165        self
5166    }
5167
5168    /// Sets the value of [range_element_type][crate::write::generated::gapic_storage::model::TableFieldSchema::range_element_type].
5169    pub fn set_range_element_type<T>(mut self, v: T) -> Self
5170    where
5171        T: std::convert::Into<
5172                crate::write::generated::gapic_storage::model::table_field_schema::FieldElementType,
5173            >,
5174    {
5175        self.range_element_type = std::option::Option::Some(v.into());
5176        self
5177    }
5178
5179    /// Sets or clears the value of [range_element_type][crate::write::generated::gapic_storage::model::TableFieldSchema::range_element_type].
5180    pub fn set_or_clear_range_element_type<T>(mut self, v: std::option::Option<T>) -> Self
5181    where
5182        T: std::convert::Into<
5183                crate::write::generated::gapic_storage::model::table_field_schema::FieldElementType,
5184            >,
5185    {
5186        self.range_element_type = v.map(|x| x.into());
5187        self
5188    }
5189}
5190
5191impl wkt::message::Message for TableFieldSchema {
5192    fn typename() -> &'static str {
5193        "type.googleapis.com/google.cloud.bigquery.storage.v1.TableFieldSchema"
5194    }
5195}
5196
5197/// Defines additional types related to [TableFieldSchema].
5198pub mod table_field_schema {
5199    #[allow(unused_imports)]
5200    use super::*;
5201
5202    /// Represents the type of a field element.
5203    #[derive(Clone, Default, PartialEq)]
5204    #[non_exhaustive]
5205    pub struct FieldElementType {
5206        /// Required. The type of a field element.
5207        pub r#type: crate::write::generated::gapic_storage::model::table_field_schema::Type,
5208
5209        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5210    }
5211
5212    impl FieldElementType {
5213        /// Creates a new default instance.
5214        pub fn new() -> Self {
5215            std::default::Default::default()
5216        }
5217
5218        /// Sets the value of [r#type][crate::write::generated::gapic_storage::model::table_field_schema::FieldElementType::type].
5219        pub fn set_type<
5220            T: std::convert::Into<
5221                    crate::write::generated::gapic_storage::model::table_field_schema::Type,
5222                >,
5223        >(
5224            mut self,
5225            v: T,
5226        ) -> Self {
5227            self.r#type = v.into();
5228            self
5229        }
5230    }
5231
5232    impl wkt::message::Message for FieldElementType {
5233        fn typename() -> &'static str {
5234            "type.googleapis.com/google.cloud.bigquery.storage.v1.TableFieldSchema.FieldElementType"
5235        }
5236    }
5237
5238    /// Enum for [Type].
5239    ///
5240    /// # Working with unknown values
5241    ///
5242    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5243    /// additional enum variants at any time. Adding new variants is not considered
5244    /// a breaking change. Applications should write their code in anticipation of:
5245    ///
5246    /// - New values appearing in future releases of the client library, **and**
5247    /// - New values received dynamically, without application changes.
5248    ///
5249    /// Please consult the [Working with enums] section in the user guide for some
5250    /// guidelines.
5251    ///
5252    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5253    #[derive(Clone, Debug, PartialEq)]
5254    #[non_exhaustive]
5255    pub enum Type {
5256        /// Illegal value
5257        Unspecified,
5258        /// 64K, UTF8
5259        String,
5260        /// 64-bit signed
5261        Int64,
5262        /// 64-bit IEEE floating point
5263        Double,
5264        /// Aggregate type
5265        Struct,
5266        /// 64K, Binary
5267        Bytes,
5268        /// 2-valued
5269        Bool,
5270        /// 64-bit signed usec since UTC epoch
5271        Timestamp,
5272        /// Civil date - Year, Month, Day
5273        Date,
5274        /// Civil time - Hour, Minute, Second, Microseconds
5275        Time,
5276        /// Combination of civil date and civil time
5277        Datetime,
5278        /// Geography object
5279        Geography,
5280        /// Numeric value
5281        Numeric,
5282        /// BigNumeric value
5283        Bignumeric,
5284        /// Interval
5285        Interval,
5286        /// JSON, String
5287        Json,
5288        /// RANGE
5289        Range,
5290        /// If set, the enum was initialized with an unknown value.
5291        ///
5292        /// Applications can examine the value using [Type::value] or
5293        /// [Type::name].
5294        UnknownValue(r#type::UnknownValue),
5295    }
5296
5297    #[doc(hidden)]
5298    pub mod r#type {
5299        #[allow(unused_imports)]
5300        use super::*;
5301        #[derive(Clone, Debug, PartialEq)]
5302        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5303    }
5304
5305    impl Type {
5306        /// Gets the enum value.
5307        ///
5308        /// Returns `None` if the enum contains an unknown value deserialized from
5309        /// the string representation of enums.
5310        pub fn value(&self) -> std::option::Option<i32> {
5311            match self {
5312                Self::Unspecified => std::option::Option::Some(0),
5313                Self::String => std::option::Option::Some(1),
5314                Self::Int64 => std::option::Option::Some(2),
5315                Self::Double => std::option::Option::Some(3),
5316                Self::Struct => std::option::Option::Some(4),
5317                Self::Bytes => std::option::Option::Some(5),
5318                Self::Bool => std::option::Option::Some(6),
5319                Self::Timestamp => std::option::Option::Some(7),
5320                Self::Date => std::option::Option::Some(8),
5321                Self::Time => std::option::Option::Some(9),
5322                Self::Datetime => std::option::Option::Some(10),
5323                Self::Geography => std::option::Option::Some(11),
5324                Self::Numeric => std::option::Option::Some(12),
5325                Self::Bignumeric => std::option::Option::Some(13),
5326                Self::Interval => std::option::Option::Some(14),
5327                Self::Json => std::option::Option::Some(15),
5328                Self::Range => std::option::Option::Some(16),
5329                Self::UnknownValue(u) => u.0.value(),
5330            }
5331        }
5332
5333        /// Gets the enum value as a string.
5334        ///
5335        /// Returns `None` if the enum contains an unknown value deserialized from
5336        /// the integer representation of enums.
5337        pub fn name(&self) -> std::option::Option<&str> {
5338            match self {
5339                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
5340                Self::String => std::option::Option::Some("STRING"),
5341                Self::Int64 => std::option::Option::Some("INT64"),
5342                Self::Double => std::option::Option::Some("DOUBLE"),
5343                Self::Struct => std::option::Option::Some("STRUCT"),
5344                Self::Bytes => std::option::Option::Some("BYTES"),
5345                Self::Bool => std::option::Option::Some("BOOL"),
5346                Self::Timestamp => std::option::Option::Some("TIMESTAMP"),
5347                Self::Date => std::option::Option::Some("DATE"),
5348                Self::Time => std::option::Option::Some("TIME"),
5349                Self::Datetime => std::option::Option::Some("DATETIME"),
5350                Self::Geography => std::option::Option::Some("GEOGRAPHY"),
5351                Self::Numeric => std::option::Option::Some("NUMERIC"),
5352                Self::Bignumeric => std::option::Option::Some("BIGNUMERIC"),
5353                Self::Interval => std::option::Option::Some("INTERVAL"),
5354                Self::Json => std::option::Option::Some("JSON"),
5355                Self::Range => std::option::Option::Some("RANGE"),
5356                Self::UnknownValue(u) => u.0.name(),
5357            }
5358        }
5359    }
5360
5361    impl std::default::Default for Type {
5362        fn default() -> Self {
5363            use std::convert::From;
5364            Self::from(0)
5365        }
5366    }
5367
5368    impl std::fmt::Display for Type {
5369        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5370            wkt::internal::display_enum(f, self.name(), self.value())
5371        }
5372    }
5373
5374    impl std::convert::From<i32> for Type {
5375        fn from(value: i32) -> Self {
5376            match value {
5377                0 => Self::Unspecified,
5378                1 => Self::String,
5379                2 => Self::Int64,
5380                3 => Self::Double,
5381                4 => Self::Struct,
5382                5 => Self::Bytes,
5383                6 => Self::Bool,
5384                7 => Self::Timestamp,
5385                8 => Self::Date,
5386                9 => Self::Time,
5387                10 => Self::Datetime,
5388                11 => Self::Geography,
5389                12 => Self::Numeric,
5390                13 => Self::Bignumeric,
5391                14 => Self::Interval,
5392                15 => Self::Json,
5393                16 => Self::Range,
5394                _ => Self::UnknownValue(r#type::UnknownValue(
5395                    wkt::internal::UnknownEnumValue::Integer(value),
5396                )),
5397            }
5398        }
5399    }
5400
5401    impl std::convert::From<&str> for Type {
5402        fn from(value: &str) -> Self {
5403            use std::string::ToString;
5404            match value {
5405                "TYPE_UNSPECIFIED" => Self::Unspecified,
5406                "STRING" => Self::String,
5407                "INT64" => Self::Int64,
5408                "DOUBLE" => Self::Double,
5409                "STRUCT" => Self::Struct,
5410                "BYTES" => Self::Bytes,
5411                "BOOL" => Self::Bool,
5412                "TIMESTAMP" => Self::Timestamp,
5413                "DATE" => Self::Date,
5414                "TIME" => Self::Time,
5415                "DATETIME" => Self::Datetime,
5416                "GEOGRAPHY" => Self::Geography,
5417                "NUMERIC" => Self::Numeric,
5418                "BIGNUMERIC" => Self::Bignumeric,
5419                "INTERVAL" => Self::Interval,
5420                "JSON" => Self::Json,
5421                "RANGE" => Self::Range,
5422                _ => Self::UnknownValue(r#type::UnknownValue(
5423                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5424                )),
5425            }
5426        }
5427    }
5428
5429    impl serde::ser::Serialize for Type {
5430        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5431        where
5432            S: serde::Serializer,
5433        {
5434            match self {
5435                Self::Unspecified => serializer.serialize_i32(0),
5436                Self::String => serializer.serialize_i32(1),
5437                Self::Int64 => serializer.serialize_i32(2),
5438                Self::Double => serializer.serialize_i32(3),
5439                Self::Struct => serializer.serialize_i32(4),
5440                Self::Bytes => serializer.serialize_i32(5),
5441                Self::Bool => serializer.serialize_i32(6),
5442                Self::Timestamp => serializer.serialize_i32(7),
5443                Self::Date => serializer.serialize_i32(8),
5444                Self::Time => serializer.serialize_i32(9),
5445                Self::Datetime => serializer.serialize_i32(10),
5446                Self::Geography => serializer.serialize_i32(11),
5447                Self::Numeric => serializer.serialize_i32(12),
5448                Self::Bignumeric => serializer.serialize_i32(13),
5449                Self::Interval => serializer.serialize_i32(14),
5450                Self::Json => serializer.serialize_i32(15),
5451                Self::Range => serializer.serialize_i32(16),
5452                Self::UnknownValue(u) => u.0.serialize(serializer),
5453            }
5454        }
5455    }
5456
5457    impl<'de> serde::de::Deserialize<'de> for Type {
5458        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5459        where
5460            D: serde::Deserializer<'de>,
5461        {
5462            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
5463                ".google.cloud.bigquery.storage.v1.TableFieldSchema.Type",
5464            ))
5465        }
5466    }
5467
5468    /// Enum for [Mode].
5469    ///
5470    /// # Working with unknown values
5471    ///
5472    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5473    /// additional enum variants at any time. Adding new variants is not considered
5474    /// a breaking change. Applications should write their code in anticipation of:
5475    ///
5476    /// - New values appearing in future releases of the client library, **and**
5477    /// - New values received dynamically, without application changes.
5478    ///
5479    /// Please consult the [Working with enums] section in the user guide for some
5480    /// guidelines.
5481    ///
5482    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5483    #[derive(Clone, Debug, PartialEq)]
5484    #[non_exhaustive]
5485    pub enum Mode {
5486        /// Illegal value
5487        Unspecified,
5488        #[allow(missing_docs)]
5489        Nullable,
5490        #[allow(missing_docs)]
5491        Required,
5492        #[allow(missing_docs)]
5493        Repeated,
5494        /// If set, the enum was initialized with an unknown value.
5495        ///
5496        /// Applications can examine the value using [Mode::value] or
5497        /// [Mode::name].
5498        UnknownValue(mode::UnknownValue),
5499    }
5500
5501    #[doc(hidden)]
5502    pub mod mode {
5503        #[allow(unused_imports)]
5504        use super::*;
5505        #[derive(Clone, Debug, PartialEq)]
5506        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5507    }
5508
5509    impl Mode {
5510        /// Gets the enum value.
5511        ///
5512        /// Returns `None` if the enum contains an unknown value deserialized from
5513        /// the string representation of enums.
5514        pub fn value(&self) -> std::option::Option<i32> {
5515            match self {
5516                Self::Unspecified => std::option::Option::Some(0),
5517                Self::Nullable => std::option::Option::Some(1),
5518                Self::Required => std::option::Option::Some(2),
5519                Self::Repeated => std::option::Option::Some(3),
5520                Self::UnknownValue(u) => u.0.value(),
5521            }
5522        }
5523
5524        /// Gets the enum value as a string.
5525        ///
5526        /// Returns `None` if the enum contains an unknown value deserialized from
5527        /// the integer representation of enums.
5528        pub fn name(&self) -> std::option::Option<&str> {
5529            match self {
5530                Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
5531                Self::Nullable => std::option::Option::Some("NULLABLE"),
5532                Self::Required => std::option::Option::Some("REQUIRED"),
5533                Self::Repeated => std::option::Option::Some("REPEATED"),
5534                Self::UnknownValue(u) => u.0.name(),
5535            }
5536        }
5537    }
5538
5539    impl std::default::Default for Mode {
5540        fn default() -> Self {
5541            use std::convert::From;
5542            Self::from(0)
5543        }
5544    }
5545
5546    impl std::fmt::Display for Mode {
5547        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5548            wkt::internal::display_enum(f, self.name(), self.value())
5549        }
5550    }
5551
5552    impl std::convert::From<i32> for Mode {
5553        fn from(value: i32) -> Self {
5554            match value {
5555                0 => Self::Unspecified,
5556                1 => Self::Nullable,
5557                2 => Self::Required,
5558                3 => Self::Repeated,
5559                _ => Self::UnknownValue(mode::UnknownValue(
5560                    wkt::internal::UnknownEnumValue::Integer(value),
5561                )),
5562            }
5563        }
5564    }
5565
5566    impl std::convert::From<&str> for Mode {
5567        fn from(value: &str) -> Self {
5568            use std::string::ToString;
5569            match value {
5570                "MODE_UNSPECIFIED" => Self::Unspecified,
5571                "NULLABLE" => Self::Nullable,
5572                "REQUIRED" => Self::Required,
5573                "REPEATED" => Self::Repeated,
5574                _ => Self::UnknownValue(mode::UnknownValue(
5575                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5576                )),
5577            }
5578        }
5579    }
5580
5581    impl serde::ser::Serialize for Mode {
5582        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5583        where
5584            S: serde::Serializer,
5585        {
5586            match self {
5587                Self::Unspecified => serializer.serialize_i32(0),
5588                Self::Nullable => serializer.serialize_i32(1),
5589                Self::Required => serializer.serialize_i32(2),
5590                Self::Repeated => serializer.serialize_i32(3),
5591                Self::UnknownValue(u) => u.0.serialize(serializer),
5592            }
5593        }
5594    }
5595
5596    impl<'de> serde::de::Deserialize<'de> for Mode {
5597        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5598        where
5599            D: serde::Deserializer<'de>,
5600        {
5601            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
5602                ".google.cloud.bigquery.storage.v1.TableFieldSchema.Mode",
5603            ))
5604        }
5605    }
5606}
5607
5608/// Data format for input or output data.
5609///
5610/// # Working with unknown values
5611///
5612/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5613/// additional enum variants at any time. Adding new variants is not considered
5614/// a breaking change. Applications should write their code in anticipation of:
5615///
5616/// - New values appearing in future releases of the client library, **and**
5617/// - New values received dynamically, without application changes.
5618///
5619/// Please consult the [Working with enums] section in the user guide for some
5620/// guidelines.
5621///
5622/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5623#[derive(Clone, Debug, PartialEq)]
5624#[non_exhaustive]
5625pub enum DataFormat {
5626    /// Data format is unspecified.
5627    Unspecified,
5628    /// Avro is a standard open source row based file format.
5629    /// See <https://avro.apache.org/> for more details.
5630    Avro,
5631    /// Arrow is a standard open source column-based message format.
5632    /// See <https://arrow.apache.org/> for more details.
5633    Arrow,
5634    /// If set, the enum was initialized with an unknown value.
5635    ///
5636    /// Applications can examine the value using [DataFormat::value] or
5637    /// [DataFormat::name].
5638    UnknownValue(data_format::UnknownValue),
5639}
5640
5641#[doc(hidden)]
5642pub mod data_format {
5643    #[allow(unused_imports)]
5644    use super::*;
5645    #[derive(Clone, Debug, PartialEq)]
5646    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5647}
5648
5649impl DataFormat {
5650    /// Gets the enum value.
5651    ///
5652    /// Returns `None` if the enum contains an unknown value deserialized from
5653    /// the string representation of enums.
5654    pub fn value(&self) -> std::option::Option<i32> {
5655        match self {
5656            Self::Unspecified => std::option::Option::Some(0),
5657            Self::Avro => std::option::Option::Some(1),
5658            Self::Arrow => std::option::Option::Some(2),
5659            Self::UnknownValue(u) => u.0.value(),
5660        }
5661    }
5662
5663    /// Gets the enum value as a string.
5664    ///
5665    /// Returns `None` if the enum contains an unknown value deserialized from
5666    /// the integer representation of enums.
5667    pub fn name(&self) -> std::option::Option<&str> {
5668        match self {
5669            Self::Unspecified => std::option::Option::Some("DATA_FORMAT_UNSPECIFIED"),
5670            Self::Avro => std::option::Option::Some("AVRO"),
5671            Self::Arrow => std::option::Option::Some("ARROW"),
5672            Self::UnknownValue(u) => u.0.name(),
5673        }
5674    }
5675}
5676
5677impl std::default::Default for DataFormat {
5678    fn default() -> Self {
5679        use std::convert::From;
5680        Self::from(0)
5681    }
5682}
5683
5684impl std::fmt::Display for DataFormat {
5685    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5686        wkt::internal::display_enum(f, self.name(), self.value())
5687    }
5688}
5689
5690impl std::convert::From<i32> for DataFormat {
5691    fn from(value: i32) -> Self {
5692        match value {
5693            0 => Self::Unspecified,
5694            1 => Self::Avro,
5695            2 => Self::Arrow,
5696            _ => Self::UnknownValue(data_format::UnknownValue(
5697                wkt::internal::UnknownEnumValue::Integer(value),
5698            )),
5699        }
5700    }
5701}
5702
5703impl std::convert::From<&str> for DataFormat {
5704    fn from(value: &str) -> Self {
5705        use std::string::ToString;
5706        match value {
5707            "DATA_FORMAT_UNSPECIFIED" => Self::Unspecified,
5708            "AVRO" => Self::Avro,
5709            "ARROW" => Self::Arrow,
5710            _ => Self::UnknownValue(data_format::UnknownValue(
5711                wkt::internal::UnknownEnumValue::String(value.to_string()),
5712            )),
5713        }
5714    }
5715}
5716
5717impl serde::ser::Serialize for DataFormat {
5718    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5719    where
5720        S: serde::Serializer,
5721    {
5722        match self {
5723            Self::Unspecified => serializer.serialize_i32(0),
5724            Self::Avro => serializer.serialize_i32(1),
5725            Self::Arrow => serializer.serialize_i32(2),
5726            Self::UnknownValue(u) => u.0.serialize(serializer),
5727        }
5728    }
5729}
5730
5731impl<'de> serde::de::Deserialize<'de> for DataFormat {
5732    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5733    where
5734        D: serde::Deserializer<'de>,
5735    {
5736        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataFormat>::new(
5737            ".google.cloud.bigquery.storage.v1.DataFormat",
5738        ))
5739    }
5740}
5741
5742/// WriteStreamView is a view enum that controls what details about a write
5743/// stream should be returned.
5744///
5745/// # Working with unknown values
5746///
5747/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5748/// additional enum variants at any time. Adding new variants is not considered
5749/// a breaking change. Applications should write their code in anticipation of:
5750///
5751/// - New values appearing in future releases of the client library, **and**
5752/// - New values received dynamically, without application changes.
5753///
5754/// Please consult the [Working with enums] section in the user guide for some
5755/// guidelines.
5756///
5757/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5758#[derive(Clone, Debug, PartialEq)]
5759#[non_exhaustive]
5760pub enum WriteStreamView {
5761    /// The default / unset value.
5762    Unspecified,
5763    /// The BASIC projection returns basic metadata about a write stream.  The
5764    /// basic view does not include schema information.  This is the default view
5765    /// returned by GetWriteStream.
5766    Basic,
5767    /// The FULL projection returns all available write stream metadata, including
5768    /// the schema.  CreateWriteStream returns the full projection of write stream
5769    /// metadata.
5770    Full,
5771    /// If set, the enum was initialized with an unknown value.
5772    ///
5773    /// Applications can examine the value using [WriteStreamView::value] or
5774    /// [WriteStreamView::name].
5775    UnknownValue(write_stream_view::UnknownValue),
5776}
5777
5778#[doc(hidden)]
5779pub mod write_stream_view {
5780    #[allow(unused_imports)]
5781    use super::*;
5782    #[derive(Clone, Debug, PartialEq)]
5783    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5784}
5785
5786impl WriteStreamView {
5787    /// Gets the enum value.
5788    ///
5789    /// Returns `None` if the enum contains an unknown value deserialized from
5790    /// the string representation of enums.
5791    pub fn value(&self) -> std::option::Option<i32> {
5792        match self {
5793            Self::Unspecified => std::option::Option::Some(0),
5794            Self::Basic => std::option::Option::Some(1),
5795            Self::Full => std::option::Option::Some(2),
5796            Self::UnknownValue(u) => u.0.value(),
5797        }
5798    }
5799
5800    /// Gets the enum value as a string.
5801    ///
5802    /// Returns `None` if the enum contains an unknown value deserialized from
5803    /// the integer representation of enums.
5804    pub fn name(&self) -> std::option::Option<&str> {
5805        match self {
5806            Self::Unspecified => std::option::Option::Some("WRITE_STREAM_VIEW_UNSPECIFIED"),
5807            Self::Basic => std::option::Option::Some("BASIC"),
5808            Self::Full => std::option::Option::Some("FULL"),
5809            Self::UnknownValue(u) => u.0.name(),
5810        }
5811    }
5812}
5813
5814impl std::default::Default for WriteStreamView {
5815    fn default() -> Self {
5816        use std::convert::From;
5817        Self::from(0)
5818    }
5819}
5820
5821impl std::fmt::Display for WriteStreamView {
5822    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5823        wkt::internal::display_enum(f, self.name(), self.value())
5824    }
5825}
5826
5827impl std::convert::From<i32> for WriteStreamView {
5828    fn from(value: i32) -> Self {
5829        match value {
5830            0 => Self::Unspecified,
5831            1 => Self::Basic,
5832            2 => Self::Full,
5833            _ => Self::UnknownValue(write_stream_view::UnknownValue(
5834                wkt::internal::UnknownEnumValue::Integer(value),
5835            )),
5836        }
5837    }
5838}
5839
5840impl std::convert::From<&str> for WriteStreamView {
5841    fn from(value: &str) -> Self {
5842        use std::string::ToString;
5843        match value {
5844            "WRITE_STREAM_VIEW_UNSPECIFIED" => Self::Unspecified,
5845            "BASIC" => Self::Basic,
5846            "FULL" => Self::Full,
5847            _ => Self::UnknownValue(write_stream_view::UnknownValue(
5848                wkt::internal::UnknownEnumValue::String(value.to_string()),
5849            )),
5850        }
5851    }
5852}
5853
5854impl serde::ser::Serialize for WriteStreamView {
5855    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5856    where
5857        S: serde::Serializer,
5858    {
5859        match self {
5860            Self::Unspecified => serializer.serialize_i32(0),
5861            Self::Basic => serializer.serialize_i32(1),
5862            Self::Full => serializer.serialize_i32(2),
5863            Self::UnknownValue(u) => u.0.serialize(serializer),
5864        }
5865    }
5866}
5867
5868impl<'de> serde::de::Deserialize<'de> for WriteStreamView {
5869    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5870    where
5871        D: serde::Deserializer<'de>,
5872    {
5873        deserializer.deserialize_any(wkt::internal::EnumVisitor::<WriteStreamView>::new(
5874            ".google.cloud.bigquery.storage.v1.WriteStreamView",
5875        ))
5876    }
5877}