google_cloud_datastore_admin_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate longrunning;
26extern crate lro;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35/// Metadata common to all Datastore Admin operations.
36#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct CommonMetadata {
39    /// The time that work began on the operation.
40    pub start_time: std::option::Option<wkt::Timestamp>,
41
42    /// The time the operation ended, either successfully or otherwise.
43    pub end_time: std::option::Option<wkt::Timestamp>,
44
45    /// The type of the operation. Can be used as a filter in
46    /// ListOperationsRequest.
47    pub operation_type: crate::model::OperationType,
48
49    /// The client-assigned labels which were provided when the operation was
50    /// created. May also include additional labels.
51    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
52
53    /// The current state of the Operation.
54    pub state: crate::model::common_metadata::State,
55
56    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
57}
58
59impl CommonMetadata {
60    pub fn new() -> Self {
61        std::default::Default::default()
62    }
63
64    /// Sets the value of [start_time][crate::model::CommonMetadata::start_time].
65    pub fn set_start_time<T>(mut self, v: T) -> Self
66    where
67        T: std::convert::Into<wkt::Timestamp>,
68    {
69        self.start_time = std::option::Option::Some(v.into());
70        self
71    }
72
73    /// Sets or clears the value of [start_time][crate::model::CommonMetadata::start_time].
74    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
75    where
76        T: std::convert::Into<wkt::Timestamp>,
77    {
78        self.start_time = v.map(|x| x.into());
79        self
80    }
81
82    /// Sets the value of [end_time][crate::model::CommonMetadata::end_time].
83    pub fn set_end_time<T>(mut self, v: T) -> Self
84    where
85        T: std::convert::Into<wkt::Timestamp>,
86    {
87        self.end_time = std::option::Option::Some(v.into());
88        self
89    }
90
91    /// Sets or clears the value of [end_time][crate::model::CommonMetadata::end_time].
92    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
93    where
94        T: std::convert::Into<wkt::Timestamp>,
95    {
96        self.end_time = v.map(|x| x.into());
97        self
98    }
99
100    /// Sets the value of [operation_type][crate::model::CommonMetadata::operation_type].
101    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
102        mut self,
103        v: T,
104    ) -> Self {
105        self.operation_type = v.into();
106        self
107    }
108
109    /// Sets the value of [labels][crate::model::CommonMetadata::labels].
110    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
111    where
112        T: std::iter::IntoIterator<Item = (K, V)>,
113        K: std::convert::Into<std::string::String>,
114        V: std::convert::Into<std::string::String>,
115    {
116        use std::iter::Iterator;
117        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
118        self
119    }
120
121    /// Sets the value of [state][crate::model::CommonMetadata::state].
122    pub fn set_state<T: std::convert::Into<crate::model::common_metadata::State>>(
123        mut self,
124        v: T,
125    ) -> Self {
126        self.state = v.into();
127        self
128    }
129}
130
131impl wkt::message::Message for CommonMetadata {
132    fn typename() -> &'static str {
133        "type.googleapis.com/google.datastore.admin.v1.CommonMetadata"
134    }
135}
136
137#[doc(hidden)]
138impl<'de> serde::de::Deserialize<'de> for CommonMetadata {
139    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
140    where
141        D: serde::Deserializer<'de>,
142    {
143        #[allow(non_camel_case_types)]
144        #[doc(hidden)]
145        #[derive(PartialEq, Eq, Hash)]
146        enum __FieldTag {
147            __start_time,
148            __end_time,
149            __operation_type,
150            __labels,
151            __state,
152            Unknown(std::string::String),
153        }
154        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
155            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
156            where
157                D: serde::Deserializer<'de>,
158            {
159                struct Visitor;
160                impl<'de> serde::de::Visitor<'de> for Visitor {
161                    type Value = __FieldTag;
162                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
163                        formatter.write_str("a field name for CommonMetadata")
164                    }
165                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
166                    where
167                        E: serde::de::Error,
168                    {
169                        use std::result::Result::Ok;
170                        use std::string::ToString;
171                        match value {
172                            "startTime" => Ok(__FieldTag::__start_time),
173                            "start_time" => Ok(__FieldTag::__start_time),
174                            "endTime" => Ok(__FieldTag::__end_time),
175                            "end_time" => Ok(__FieldTag::__end_time),
176                            "operationType" => Ok(__FieldTag::__operation_type),
177                            "operation_type" => Ok(__FieldTag::__operation_type),
178                            "labels" => Ok(__FieldTag::__labels),
179                            "state" => Ok(__FieldTag::__state),
180                            _ => Ok(__FieldTag::Unknown(value.to_string())),
181                        }
182                    }
183                }
184                deserializer.deserialize_identifier(Visitor)
185            }
186        }
187        struct Visitor;
188        impl<'de> serde::de::Visitor<'de> for Visitor {
189            type Value = CommonMetadata;
190            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
191                formatter.write_str("struct CommonMetadata")
192            }
193            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
194            where
195                A: serde::de::MapAccess<'de>,
196            {
197                #[allow(unused_imports)]
198                use serde::de::Error;
199                use std::option::Option::Some;
200                let mut fields = std::collections::HashSet::new();
201                let mut result = Self::Value::new();
202                while let Some(tag) = map.next_key::<__FieldTag>()? {
203                    #[allow(clippy::match_single_binding)]
204                    match tag {
205                        __FieldTag::__start_time => {
206                            if !fields.insert(__FieldTag::__start_time) {
207                                return std::result::Result::Err(A::Error::duplicate_field(
208                                    "multiple values for start_time",
209                                ));
210                            }
211                            result.start_time =
212                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
213                        }
214                        __FieldTag::__end_time => {
215                            if !fields.insert(__FieldTag::__end_time) {
216                                return std::result::Result::Err(A::Error::duplicate_field(
217                                    "multiple values for end_time",
218                                ));
219                            }
220                            result.end_time =
221                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
222                        }
223                        __FieldTag::__operation_type => {
224                            if !fields.insert(__FieldTag::__operation_type) {
225                                return std::result::Result::Err(A::Error::duplicate_field(
226                                    "multiple values for operation_type",
227                                ));
228                            }
229                            result.operation_type = map
230                                .next_value::<std::option::Option<crate::model::OperationType>>()?
231                                .unwrap_or_default();
232                        }
233                        __FieldTag::__labels => {
234                            if !fields.insert(__FieldTag::__labels) {
235                                return std::result::Result::Err(A::Error::duplicate_field(
236                                    "multiple values for labels",
237                                ));
238                            }
239                            result.labels = map
240                                .next_value::<std::option::Option<
241                                    std::collections::HashMap<
242                                        std::string::String,
243                                        std::string::String,
244                                    >,
245                                >>()?
246                                .unwrap_or_default();
247                        }
248                        __FieldTag::__state => {
249                            if !fields.insert(__FieldTag::__state) {
250                                return std::result::Result::Err(A::Error::duplicate_field(
251                                    "multiple values for state",
252                                ));
253                            }
254                            result.state = map.next_value::<std::option::Option<crate::model::common_metadata::State>>()?.unwrap_or_default();
255                        }
256                        __FieldTag::Unknown(key) => {
257                            let value = map.next_value::<serde_json::Value>()?;
258                            result._unknown_fields.insert(key, value);
259                        }
260                    }
261                }
262                std::result::Result::Ok(result)
263            }
264        }
265        deserializer.deserialize_any(Visitor)
266    }
267}
268
269#[doc(hidden)]
270impl serde::ser::Serialize for CommonMetadata {
271    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
272    where
273        S: serde::ser::Serializer,
274    {
275        use serde::ser::SerializeMap;
276        #[allow(unused_imports)]
277        use std::option::Option::Some;
278        let mut state = serializer.serialize_map(std::option::Option::None)?;
279        if self.start_time.is_some() {
280            state.serialize_entry("startTime", &self.start_time)?;
281        }
282        if self.end_time.is_some() {
283            state.serialize_entry("endTime", &self.end_time)?;
284        }
285        if !wkt::internal::is_default(&self.operation_type) {
286            state.serialize_entry("operationType", &self.operation_type)?;
287        }
288        if !self.labels.is_empty() {
289            state.serialize_entry("labels", &self.labels)?;
290        }
291        if !wkt::internal::is_default(&self.state) {
292            state.serialize_entry("state", &self.state)?;
293        }
294        if !self._unknown_fields.is_empty() {
295            for (key, value) in self._unknown_fields.iter() {
296                state.serialize_entry(key, &value)?;
297            }
298        }
299        state.end()
300    }
301}
302
303impl std::fmt::Debug for CommonMetadata {
304    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
305        let mut debug_struct = f.debug_struct("CommonMetadata");
306        debug_struct.field("start_time", &self.start_time);
307        debug_struct.field("end_time", &self.end_time);
308        debug_struct.field("operation_type", &self.operation_type);
309        debug_struct.field("labels", &self.labels);
310        debug_struct.field("state", &self.state);
311        if !self._unknown_fields.is_empty() {
312            debug_struct.field("_unknown_fields", &self._unknown_fields);
313        }
314        debug_struct.finish()
315    }
316}
317
318/// Defines additional types related to [CommonMetadata].
319pub mod common_metadata {
320    #[allow(unused_imports)]
321    use super::*;
322
323    /// The various possible states for an ongoing Operation.
324    ///
325    /// # Working with unknown values
326    ///
327    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
328    /// additional enum variants at any time. Adding new variants is not considered
329    /// a breaking change. Applications should write their code in anticipation of:
330    ///
331    /// - New values appearing in future releases of the client library, **and**
332    /// - New values received dynamically, without application changes.
333    ///
334    /// Please consult the [Working with enums] section in the user guide for some
335    /// guidelines.
336    ///
337    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
338    #[derive(Clone, Debug, PartialEq)]
339    #[non_exhaustive]
340    pub enum State {
341        /// Unspecified.
342        Unspecified,
343        /// Request is being prepared for processing.
344        Initializing,
345        /// Request is actively being processed.
346        Processing,
347        /// Request is in the process of being cancelled after user called
348        /// google.longrunning.Operations.CancelOperation on the operation.
349        Cancelling,
350        /// Request has been processed and is in its finalization stage.
351        Finalizing,
352        /// Request has completed successfully.
353        Successful,
354        /// Request has finished being processed, but encountered an error.
355        Failed,
356        /// Request has finished being cancelled after user called
357        /// google.longrunning.Operations.CancelOperation.
358        Cancelled,
359        /// If set, the enum was initialized with an unknown value.
360        ///
361        /// Applications can examine the value using [State::value] or
362        /// [State::name].
363        UnknownValue(state::UnknownValue),
364    }
365
366    #[doc(hidden)]
367    pub mod state {
368        #[allow(unused_imports)]
369        use super::*;
370        #[derive(Clone, Debug, PartialEq)]
371        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
372    }
373
374    impl State {
375        /// Gets the enum value.
376        ///
377        /// Returns `None` if the enum contains an unknown value deserialized from
378        /// the string representation of enums.
379        pub fn value(&self) -> std::option::Option<i32> {
380            match self {
381                Self::Unspecified => std::option::Option::Some(0),
382                Self::Initializing => std::option::Option::Some(1),
383                Self::Processing => std::option::Option::Some(2),
384                Self::Cancelling => std::option::Option::Some(3),
385                Self::Finalizing => std::option::Option::Some(4),
386                Self::Successful => std::option::Option::Some(5),
387                Self::Failed => std::option::Option::Some(6),
388                Self::Cancelled => std::option::Option::Some(7),
389                Self::UnknownValue(u) => u.0.value(),
390            }
391        }
392
393        /// Gets the enum value as a string.
394        ///
395        /// Returns `None` if the enum contains an unknown value deserialized from
396        /// the integer representation of enums.
397        pub fn name(&self) -> std::option::Option<&str> {
398            match self {
399                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
400                Self::Initializing => std::option::Option::Some("INITIALIZING"),
401                Self::Processing => std::option::Option::Some("PROCESSING"),
402                Self::Cancelling => std::option::Option::Some("CANCELLING"),
403                Self::Finalizing => std::option::Option::Some("FINALIZING"),
404                Self::Successful => std::option::Option::Some("SUCCESSFUL"),
405                Self::Failed => std::option::Option::Some("FAILED"),
406                Self::Cancelled => std::option::Option::Some("CANCELLED"),
407                Self::UnknownValue(u) => u.0.name(),
408            }
409        }
410    }
411
412    impl std::default::Default for State {
413        fn default() -> Self {
414            use std::convert::From;
415            Self::from(0)
416        }
417    }
418
419    impl std::fmt::Display for State {
420        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
421            wkt::internal::display_enum(f, self.name(), self.value())
422        }
423    }
424
425    impl std::convert::From<i32> for State {
426        fn from(value: i32) -> Self {
427            match value {
428                0 => Self::Unspecified,
429                1 => Self::Initializing,
430                2 => Self::Processing,
431                3 => Self::Cancelling,
432                4 => Self::Finalizing,
433                5 => Self::Successful,
434                6 => Self::Failed,
435                7 => Self::Cancelled,
436                _ => Self::UnknownValue(state::UnknownValue(
437                    wkt::internal::UnknownEnumValue::Integer(value),
438                )),
439            }
440        }
441    }
442
443    impl std::convert::From<&str> for State {
444        fn from(value: &str) -> Self {
445            use std::string::ToString;
446            match value {
447                "STATE_UNSPECIFIED" => Self::Unspecified,
448                "INITIALIZING" => Self::Initializing,
449                "PROCESSING" => Self::Processing,
450                "CANCELLING" => Self::Cancelling,
451                "FINALIZING" => Self::Finalizing,
452                "SUCCESSFUL" => Self::Successful,
453                "FAILED" => Self::Failed,
454                "CANCELLED" => Self::Cancelled,
455                _ => Self::UnknownValue(state::UnknownValue(
456                    wkt::internal::UnknownEnumValue::String(value.to_string()),
457                )),
458            }
459        }
460    }
461
462    impl serde::ser::Serialize for State {
463        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
464        where
465            S: serde::Serializer,
466        {
467            match self {
468                Self::Unspecified => serializer.serialize_i32(0),
469                Self::Initializing => serializer.serialize_i32(1),
470                Self::Processing => serializer.serialize_i32(2),
471                Self::Cancelling => serializer.serialize_i32(3),
472                Self::Finalizing => serializer.serialize_i32(4),
473                Self::Successful => serializer.serialize_i32(5),
474                Self::Failed => serializer.serialize_i32(6),
475                Self::Cancelled => serializer.serialize_i32(7),
476                Self::UnknownValue(u) => u.0.serialize(serializer),
477            }
478        }
479    }
480
481    impl<'de> serde::de::Deserialize<'de> for State {
482        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
483        where
484            D: serde::Deserializer<'de>,
485        {
486            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
487                ".google.datastore.admin.v1.CommonMetadata.State",
488            ))
489        }
490    }
491}
492
493/// Measures the progress of a particular metric.
494#[derive(Clone, Default, PartialEq)]
495#[non_exhaustive]
496pub struct Progress {
497    /// The amount of work that has been completed. Note that this may be greater
498    /// than work_estimated.
499    pub work_completed: i64,
500
501    /// An estimate of how much work needs to be performed. May be zero if the
502    /// work estimate is unavailable.
503    pub work_estimated: i64,
504
505    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
506}
507
508impl Progress {
509    pub fn new() -> Self {
510        std::default::Default::default()
511    }
512
513    /// Sets the value of [work_completed][crate::model::Progress::work_completed].
514    pub fn set_work_completed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
515        self.work_completed = v.into();
516        self
517    }
518
519    /// Sets the value of [work_estimated][crate::model::Progress::work_estimated].
520    pub fn set_work_estimated<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
521        self.work_estimated = v.into();
522        self
523    }
524}
525
526impl wkt::message::Message for Progress {
527    fn typename() -> &'static str {
528        "type.googleapis.com/google.datastore.admin.v1.Progress"
529    }
530}
531
532#[doc(hidden)]
533impl<'de> serde::de::Deserialize<'de> for Progress {
534    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
535    where
536        D: serde::Deserializer<'de>,
537    {
538        #[allow(non_camel_case_types)]
539        #[doc(hidden)]
540        #[derive(PartialEq, Eq, Hash)]
541        enum __FieldTag {
542            __work_completed,
543            __work_estimated,
544            Unknown(std::string::String),
545        }
546        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
547            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
548            where
549                D: serde::Deserializer<'de>,
550            {
551                struct Visitor;
552                impl<'de> serde::de::Visitor<'de> for Visitor {
553                    type Value = __FieldTag;
554                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
555                        formatter.write_str("a field name for Progress")
556                    }
557                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
558                    where
559                        E: serde::de::Error,
560                    {
561                        use std::result::Result::Ok;
562                        use std::string::ToString;
563                        match value {
564                            "workCompleted" => Ok(__FieldTag::__work_completed),
565                            "work_completed" => Ok(__FieldTag::__work_completed),
566                            "workEstimated" => Ok(__FieldTag::__work_estimated),
567                            "work_estimated" => Ok(__FieldTag::__work_estimated),
568                            _ => Ok(__FieldTag::Unknown(value.to_string())),
569                        }
570                    }
571                }
572                deserializer.deserialize_identifier(Visitor)
573            }
574        }
575        struct Visitor;
576        impl<'de> serde::de::Visitor<'de> for Visitor {
577            type Value = Progress;
578            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
579                formatter.write_str("struct Progress")
580            }
581            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
582            where
583                A: serde::de::MapAccess<'de>,
584            {
585                #[allow(unused_imports)]
586                use serde::de::Error;
587                use std::option::Option::Some;
588                let mut fields = std::collections::HashSet::new();
589                let mut result = Self::Value::new();
590                while let Some(tag) = map.next_key::<__FieldTag>()? {
591                    #[allow(clippy::match_single_binding)]
592                    match tag {
593                        __FieldTag::__work_completed => {
594                            if !fields.insert(__FieldTag::__work_completed) {
595                                return std::result::Result::Err(A::Error::duplicate_field(
596                                    "multiple values for work_completed",
597                                ));
598                            }
599                            struct __With(std::option::Option<i64>);
600                            impl<'de> serde::de::Deserialize<'de> for __With {
601                                fn deserialize<D>(
602                                    deserializer: D,
603                                ) -> std::result::Result<Self, D::Error>
604                                where
605                                    D: serde::de::Deserializer<'de>,
606                                {
607                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
608                                }
609                            }
610                            result.work_completed =
611                                map.next_value::<__With>()?.0.unwrap_or_default();
612                        }
613                        __FieldTag::__work_estimated => {
614                            if !fields.insert(__FieldTag::__work_estimated) {
615                                return std::result::Result::Err(A::Error::duplicate_field(
616                                    "multiple values for work_estimated",
617                                ));
618                            }
619                            struct __With(std::option::Option<i64>);
620                            impl<'de> serde::de::Deserialize<'de> for __With {
621                                fn deserialize<D>(
622                                    deserializer: D,
623                                ) -> std::result::Result<Self, D::Error>
624                                where
625                                    D: serde::de::Deserializer<'de>,
626                                {
627                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
628                                }
629                            }
630                            result.work_estimated =
631                                map.next_value::<__With>()?.0.unwrap_or_default();
632                        }
633                        __FieldTag::Unknown(key) => {
634                            let value = map.next_value::<serde_json::Value>()?;
635                            result._unknown_fields.insert(key, value);
636                        }
637                    }
638                }
639                std::result::Result::Ok(result)
640            }
641        }
642        deserializer.deserialize_any(Visitor)
643    }
644}
645
646#[doc(hidden)]
647impl serde::ser::Serialize for Progress {
648    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
649    where
650        S: serde::ser::Serializer,
651    {
652        use serde::ser::SerializeMap;
653        #[allow(unused_imports)]
654        use std::option::Option::Some;
655        let mut state = serializer.serialize_map(std::option::Option::None)?;
656        if !wkt::internal::is_default(&self.work_completed) {
657            struct __With<'a>(&'a i64);
658            impl<'a> serde::ser::Serialize for __With<'a> {
659                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
660                where
661                    S: serde::ser::Serializer,
662                {
663                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
664                }
665            }
666            state.serialize_entry("workCompleted", &__With(&self.work_completed))?;
667        }
668        if !wkt::internal::is_default(&self.work_estimated) {
669            struct __With<'a>(&'a i64);
670            impl<'a> serde::ser::Serialize for __With<'a> {
671                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
672                where
673                    S: serde::ser::Serializer,
674                {
675                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
676                }
677            }
678            state.serialize_entry("workEstimated", &__With(&self.work_estimated))?;
679        }
680        if !self._unknown_fields.is_empty() {
681            for (key, value) in self._unknown_fields.iter() {
682                state.serialize_entry(key, &value)?;
683            }
684        }
685        state.end()
686    }
687}
688
689impl std::fmt::Debug for Progress {
690    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
691        let mut debug_struct = f.debug_struct("Progress");
692        debug_struct.field("work_completed", &self.work_completed);
693        debug_struct.field("work_estimated", &self.work_estimated);
694        if !self._unknown_fields.is_empty() {
695            debug_struct.field("_unknown_fields", &self._unknown_fields);
696        }
697        debug_struct.finish()
698    }
699}
700
701/// The request for
702/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
703///
704/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
705#[derive(Clone, Default, PartialEq)]
706#[non_exhaustive]
707pub struct ExportEntitiesRequest {
708    /// Required. Project ID against which to make the request.
709    pub project_id: std::string::String,
710
711    /// Client-assigned labels.
712    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
713
714    /// Description of what data from the project is included in the export.
715    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
716
717    /// Required. Location for the export metadata and data files.
718    ///
719    /// The full resource URL of the external storage location. Currently, only
720    /// Google Cloud Storage is supported. So output_url_prefix should be of the
721    /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
722    /// name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud
723    /// Storage namespace path (this is not a Cloud Datastore namespace). For more
724    /// information about Cloud Storage namespace paths, see
725    /// [Object name
726    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
727    ///
728    /// The resulting files will be nested deeper than the specified URL prefix.
729    /// The final output URL will be provided in the
730    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
731    /// field. That value should be used for subsequent ImportEntities operations.
732    ///
733    /// By nesting the data files deeper, the same Cloud Storage bucket can be used
734    /// in multiple ExportEntities operations without conflict.
735    ///
736    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
737    pub output_url_prefix: std::string::String,
738
739    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
740}
741
742impl ExportEntitiesRequest {
743    pub fn new() -> Self {
744        std::default::Default::default()
745    }
746
747    /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
748    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
749        self.project_id = v.into();
750        self
751    }
752
753    /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
754    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
755    where
756        T: std::iter::IntoIterator<Item = (K, V)>,
757        K: std::convert::Into<std::string::String>,
758        V: std::convert::Into<std::string::String>,
759    {
760        use std::iter::Iterator;
761        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
762        self
763    }
764
765    /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
766    pub fn set_entity_filter<T>(mut self, v: T) -> Self
767    where
768        T: std::convert::Into<crate::model::EntityFilter>,
769    {
770        self.entity_filter = std::option::Option::Some(v.into());
771        self
772    }
773
774    /// Sets or clears the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
775    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
776    where
777        T: std::convert::Into<crate::model::EntityFilter>,
778    {
779        self.entity_filter = v.map(|x| x.into());
780        self
781    }
782
783    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
784    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
785        mut self,
786        v: T,
787    ) -> Self {
788        self.output_url_prefix = v.into();
789        self
790    }
791}
792
793impl wkt::message::Message for ExportEntitiesRequest {
794    fn typename() -> &'static str {
795        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesRequest"
796    }
797}
798
799#[doc(hidden)]
800impl<'de> serde::de::Deserialize<'de> for ExportEntitiesRequest {
801    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
802    where
803        D: serde::Deserializer<'de>,
804    {
805        #[allow(non_camel_case_types)]
806        #[doc(hidden)]
807        #[derive(PartialEq, Eq, Hash)]
808        enum __FieldTag {
809            __project_id,
810            __labels,
811            __entity_filter,
812            __output_url_prefix,
813            Unknown(std::string::String),
814        }
815        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
816            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
817            where
818                D: serde::Deserializer<'de>,
819            {
820                struct Visitor;
821                impl<'de> serde::de::Visitor<'de> for Visitor {
822                    type Value = __FieldTag;
823                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
824                        formatter.write_str("a field name for ExportEntitiesRequest")
825                    }
826                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
827                    where
828                        E: serde::de::Error,
829                    {
830                        use std::result::Result::Ok;
831                        use std::string::ToString;
832                        match value {
833                            "projectId" => Ok(__FieldTag::__project_id),
834                            "project_id" => Ok(__FieldTag::__project_id),
835                            "labels" => Ok(__FieldTag::__labels),
836                            "entityFilter" => Ok(__FieldTag::__entity_filter),
837                            "entity_filter" => Ok(__FieldTag::__entity_filter),
838                            "outputUrlPrefix" => Ok(__FieldTag::__output_url_prefix),
839                            "output_url_prefix" => Ok(__FieldTag::__output_url_prefix),
840                            _ => Ok(__FieldTag::Unknown(value.to_string())),
841                        }
842                    }
843                }
844                deserializer.deserialize_identifier(Visitor)
845            }
846        }
847        struct Visitor;
848        impl<'de> serde::de::Visitor<'de> for Visitor {
849            type Value = ExportEntitiesRequest;
850            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
851                formatter.write_str("struct ExportEntitiesRequest")
852            }
853            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
854            where
855                A: serde::de::MapAccess<'de>,
856            {
857                #[allow(unused_imports)]
858                use serde::de::Error;
859                use std::option::Option::Some;
860                let mut fields = std::collections::HashSet::new();
861                let mut result = Self::Value::new();
862                while let Some(tag) = map.next_key::<__FieldTag>()? {
863                    #[allow(clippy::match_single_binding)]
864                    match tag {
865                        __FieldTag::__project_id => {
866                            if !fields.insert(__FieldTag::__project_id) {
867                                return std::result::Result::Err(A::Error::duplicate_field(
868                                    "multiple values for project_id",
869                                ));
870                            }
871                            result.project_id = map
872                                .next_value::<std::option::Option<std::string::String>>()?
873                                .unwrap_or_default();
874                        }
875                        __FieldTag::__labels => {
876                            if !fields.insert(__FieldTag::__labels) {
877                                return std::result::Result::Err(A::Error::duplicate_field(
878                                    "multiple values for labels",
879                                ));
880                            }
881                            result.labels = map
882                                .next_value::<std::option::Option<
883                                    std::collections::HashMap<
884                                        std::string::String,
885                                        std::string::String,
886                                    >,
887                                >>()?
888                                .unwrap_or_default();
889                        }
890                        __FieldTag::__entity_filter => {
891                            if !fields.insert(__FieldTag::__entity_filter) {
892                                return std::result::Result::Err(A::Error::duplicate_field(
893                                    "multiple values for entity_filter",
894                                ));
895                            }
896                            result.entity_filter = map
897                                .next_value::<std::option::Option<crate::model::EntityFilter>>()?;
898                        }
899                        __FieldTag::__output_url_prefix => {
900                            if !fields.insert(__FieldTag::__output_url_prefix) {
901                                return std::result::Result::Err(A::Error::duplicate_field(
902                                    "multiple values for output_url_prefix",
903                                ));
904                            }
905                            result.output_url_prefix = map
906                                .next_value::<std::option::Option<std::string::String>>()?
907                                .unwrap_or_default();
908                        }
909                        __FieldTag::Unknown(key) => {
910                            let value = map.next_value::<serde_json::Value>()?;
911                            result._unknown_fields.insert(key, value);
912                        }
913                    }
914                }
915                std::result::Result::Ok(result)
916            }
917        }
918        deserializer.deserialize_any(Visitor)
919    }
920}
921
922#[doc(hidden)]
923impl serde::ser::Serialize for ExportEntitiesRequest {
924    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
925    where
926        S: serde::ser::Serializer,
927    {
928        use serde::ser::SerializeMap;
929        #[allow(unused_imports)]
930        use std::option::Option::Some;
931        let mut state = serializer.serialize_map(std::option::Option::None)?;
932        if !self.project_id.is_empty() {
933            state.serialize_entry("projectId", &self.project_id)?;
934        }
935        if !self.labels.is_empty() {
936            state.serialize_entry("labels", &self.labels)?;
937        }
938        if self.entity_filter.is_some() {
939            state.serialize_entry("entityFilter", &self.entity_filter)?;
940        }
941        if !self.output_url_prefix.is_empty() {
942            state.serialize_entry("outputUrlPrefix", &self.output_url_prefix)?;
943        }
944        if !self._unknown_fields.is_empty() {
945            for (key, value) in self._unknown_fields.iter() {
946                state.serialize_entry(key, &value)?;
947            }
948        }
949        state.end()
950    }
951}
952
953impl std::fmt::Debug for ExportEntitiesRequest {
954    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
955        let mut debug_struct = f.debug_struct("ExportEntitiesRequest");
956        debug_struct.field("project_id", &self.project_id);
957        debug_struct.field("labels", &self.labels);
958        debug_struct.field("entity_filter", &self.entity_filter);
959        debug_struct.field("output_url_prefix", &self.output_url_prefix);
960        if !self._unknown_fields.is_empty() {
961            debug_struct.field("_unknown_fields", &self._unknown_fields);
962        }
963        debug_struct.finish()
964    }
965}
966
967/// The request for
968/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities].
969///
970/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities]: crate::client::DatastoreAdmin::import_entities
971#[derive(Clone, Default, PartialEq)]
972#[non_exhaustive]
973pub struct ImportEntitiesRequest {
974    /// Required. Project ID against which to make the request.
975    pub project_id: std::string::String,
976
977    /// Client-assigned labels.
978    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
979
980    /// Required. The full resource URL of the external storage location.
981    /// Currently, only Google Cloud Storage is supported. So input_url should be
982    /// of the form:
983    /// `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where
984    /// `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is
985    /// an optional Cloud Storage namespace path (this is not a Cloud Datastore
986    /// namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written
987    /// by the ExportEntities operation. For more information about Cloud Storage
988    /// namespace paths, see
989    /// [Object name
990    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
991    ///
992    /// For more information, see
993    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
994    ///
995    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
996    pub input_url: std::string::String,
997
998    /// Optionally specify which kinds/namespaces are to be imported. If provided,
999    /// the list must be a subset of the EntityFilter used in creating the export,
1000    /// otherwise a FAILED_PRECONDITION error will be returned. If no filter is
1001    /// specified then all entities from the export are imported.
1002    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
1003
1004    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1005}
1006
1007impl ImportEntitiesRequest {
1008    pub fn new() -> Self {
1009        std::default::Default::default()
1010    }
1011
1012    /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
1013    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1014        self.project_id = v.into();
1015        self
1016    }
1017
1018    /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
1019    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1020    where
1021        T: std::iter::IntoIterator<Item = (K, V)>,
1022        K: std::convert::Into<std::string::String>,
1023        V: std::convert::Into<std::string::String>,
1024    {
1025        use std::iter::Iterator;
1026        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1027        self
1028    }
1029
1030    /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
1031    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1032        self.input_url = v.into();
1033        self
1034    }
1035
1036    /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
1037    pub fn set_entity_filter<T>(mut self, v: T) -> Self
1038    where
1039        T: std::convert::Into<crate::model::EntityFilter>,
1040    {
1041        self.entity_filter = std::option::Option::Some(v.into());
1042        self
1043    }
1044
1045    /// Sets or clears the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
1046    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
1047    where
1048        T: std::convert::Into<crate::model::EntityFilter>,
1049    {
1050        self.entity_filter = v.map(|x| x.into());
1051        self
1052    }
1053}
1054
1055impl wkt::message::Message for ImportEntitiesRequest {
1056    fn typename() -> &'static str {
1057        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesRequest"
1058    }
1059}
1060
1061#[doc(hidden)]
1062impl<'de> serde::de::Deserialize<'de> for ImportEntitiesRequest {
1063    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1064    where
1065        D: serde::Deserializer<'de>,
1066    {
1067        #[allow(non_camel_case_types)]
1068        #[doc(hidden)]
1069        #[derive(PartialEq, Eq, Hash)]
1070        enum __FieldTag {
1071            __project_id,
1072            __labels,
1073            __input_url,
1074            __entity_filter,
1075            Unknown(std::string::String),
1076        }
1077        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1078            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1079            where
1080                D: serde::Deserializer<'de>,
1081            {
1082                struct Visitor;
1083                impl<'de> serde::de::Visitor<'de> for Visitor {
1084                    type Value = __FieldTag;
1085                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1086                        formatter.write_str("a field name for ImportEntitiesRequest")
1087                    }
1088                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1089                    where
1090                        E: serde::de::Error,
1091                    {
1092                        use std::result::Result::Ok;
1093                        use std::string::ToString;
1094                        match value {
1095                            "projectId" => Ok(__FieldTag::__project_id),
1096                            "project_id" => Ok(__FieldTag::__project_id),
1097                            "labels" => Ok(__FieldTag::__labels),
1098                            "inputUrl" => Ok(__FieldTag::__input_url),
1099                            "input_url" => Ok(__FieldTag::__input_url),
1100                            "entityFilter" => Ok(__FieldTag::__entity_filter),
1101                            "entity_filter" => Ok(__FieldTag::__entity_filter),
1102                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1103                        }
1104                    }
1105                }
1106                deserializer.deserialize_identifier(Visitor)
1107            }
1108        }
1109        struct Visitor;
1110        impl<'de> serde::de::Visitor<'de> for Visitor {
1111            type Value = ImportEntitiesRequest;
1112            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1113                formatter.write_str("struct ImportEntitiesRequest")
1114            }
1115            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1116            where
1117                A: serde::de::MapAccess<'de>,
1118            {
1119                #[allow(unused_imports)]
1120                use serde::de::Error;
1121                use std::option::Option::Some;
1122                let mut fields = std::collections::HashSet::new();
1123                let mut result = Self::Value::new();
1124                while let Some(tag) = map.next_key::<__FieldTag>()? {
1125                    #[allow(clippy::match_single_binding)]
1126                    match tag {
1127                        __FieldTag::__project_id => {
1128                            if !fields.insert(__FieldTag::__project_id) {
1129                                return std::result::Result::Err(A::Error::duplicate_field(
1130                                    "multiple values for project_id",
1131                                ));
1132                            }
1133                            result.project_id = map
1134                                .next_value::<std::option::Option<std::string::String>>()?
1135                                .unwrap_or_default();
1136                        }
1137                        __FieldTag::__labels => {
1138                            if !fields.insert(__FieldTag::__labels) {
1139                                return std::result::Result::Err(A::Error::duplicate_field(
1140                                    "multiple values for labels",
1141                                ));
1142                            }
1143                            result.labels = map
1144                                .next_value::<std::option::Option<
1145                                    std::collections::HashMap<
1146                                        std::string::String,
1147                                        std::string::String,
1148                                    >,
1149                                >>()?
1150                                .unwrap_or_default();
1151                        }
1152                        __FieldTag::__input_url => {
1153                            if !fields.insert(__FieldTag::__input_url) {
1154                                return std::result::Result::Err(A::Error::duplicate_field(
1155                                    "multiple values for input_url",
1156                                ));
1157                            }
1158                            result.input_url = map
1159                                .next_value::<std::option::Option<std::string::String>>()?
1160                                .unwrap_or_default();
1161                        }
1162                        __FieldTag::__entity_filter => {
1163                            if !fields.insert(__FieldTag::__entity_filter) {
1164                                return std::result::Result::Err(A::Error::duplicate_field(
1165                                    "multiple values for entity_filter",
1166                                ));
1167                            }
1168                            result.entity_filter = map
1169                                .next_value::<std::option::Option<crate::model::EntityFilter>>()?;
1170                        }
1171                        __FieldTag::Unknown(key) => {
1172                            let value = map.next_value::<serde_json::Value>()?;
1173                            result._unknown_fields.insert(key, value);
1174                        }
1175                    }
1176                }
1177                std::result::Result::Ok(result)
1178            }
1179        }
1180        deserializer.deserialize_any(Visitor)
1181    }
1182}
1183
1184#[doc(hidden)]
1185impl serde::ser::Serialize for ImportEntitiesRequest {
1186    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1187    where
1188        S: serde::ser::Serializer,
1189    {
1190        use serde::ser::SerializeMap;
1191        #[allow(unused_imports)]
1192        use std::option::Option::Some;
1193        let mut state = serializer.serialize_map(std::option::Option::None)?;
1194        if !self.project_id.is_empty() {
1195            state.serialize_entry("projectId", &self.project_id)?;
1196        }
1197        if !self.labels.is_empty() {
1198            state.serialize_entry("labels", &self.labels)?;
1199        }
1200        if !self.input_url.is_empty() {
1201            state.serialize_entry("inputUrl", &self.input_url)?;
1202        }
1203        if self.entity_filter.is_some() {
1204            state.serialize_entry("entityFilter", &self.entity_filter)?;
1205        }
1206        if !self._unknown_fields.is_empty() {
1207            for (key, value) in self._unknown_fields.iter() {
1208                state.serialize_entry(key, &value)?;
1209            }
1210        }
1211        state.end()
1212    }
1213}
1214
1215impl std::fmt::Debug for ImportEntitiesRequest {
1216    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1217        let mut debug_struct = f.debug_struct("ImportEntitiesRequest");
1218        debug_struct.field("project_id", &self.project_id);
1219        debug_struct.field("labels", &self.labels);
1220        debug_struct.field("input_url", &self.input_url);
1221        debug_struct.field("entity_filter", &self.entity_filter);
1222        if !self._unknown_fields.is_empty() {
1223            debug_struct.field("_unknown_fields", &self._unknown_fields);
1224        }
1225        debug_struct.finish()
1226    }
1227}
1228
1229/// The response for
1230/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
1231///
1232/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
1233#[derive(Clone, Default, PartialEq)]
1234#[non_exhaustive]
1235pub struct ExportEntitiesResponse {
1236    /// Location of the output metadata file. This can be used to begin an import
1237    /// into Cloud Datastore (this project or another project). See
1238    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url].
1239    /// Only present if the operation completed successfully.
1240    ///
1241    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url]: crate::model::ImportEntitiesRequest::input_url
1242    pub output_url: std::string::String,
1243
1244    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1245}
1246
1247impl ExportEntitiesResponse {
1248    pub fn new() -> Self {
1249        std::default::Default::default()
1250    }
1251
1252    /// Sets the value of [output_url][crate::model::ExportEntitiesResponse::output_url].
1253    pub fn set_output_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1254        self.output_url = v.into();
1255        self
1256    }
1257}
1258
1259impl wkt::message::Message for ExportEntitiesResponse {
1260    fn typename() -> &'static str {
1261        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesResponse"
1262    }
1263}
1264
1265#[doc(hidden)]
1266impl<'de> serde::de::Deserialize<'de> for ExportEntitiesResponse {
1267    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1268    where
1269        D: serde::Deserializer<'de>,
1270    {
1271        #[allow(non_camel_case_types)]
1272        #[doc(hidden)]
1273        #[derive(PartialEq, Eq, Hash)]
1274        enum __FieldTag {
1275            __output_url,
1276            Unknown(std::string::String),
1277        }
1278        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1279            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1280            where
1281                D: serde::Deserializer<'de>,
1282            {
1283                struct Visitor;
1284                impl<'de> serde::de::Visitor<'de> for Visitor {
1285                    type Value = __FieldTag;
1286                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1287                        formatter.write_str("a field name for ExportEntitiesResponse")
1288                    }
1289                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1290                    where
1291                        E: serde::de::Error,
1292                    {
1293                        use std::result::Result::Ok;
1294                        use std::string::ToString;
1295                        match value {
1296                            "outputUrl" => Ok(__FieldTag::__output_url),
1297                            "output_url" => Ok(__FieldTag::__output_url),
1298                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1299                        }
1300                    }
1301                }
1302                deserializer.deserialize_identifier(Visitor)
1303            }
1304        }
1305        struct Visitor;
1306        impl<'de> serde::de::Visitor<'de> for Visitor {
1307            type Value = ExportEntitiesResponse;
1308            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1309                formatter.write_str("struct ExportEntitiesResponse")
1310            }
1311            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1312            where
1313                A: serde::de::MapAccess<'de>,
1314            {
1315                #[allow(unused_imports)]
1316                use serde::de::Error;
1317                use std::option::Option::Some;
1318                let mut fields = std::collections::HashSet::new();
1319                let mut result = Self::Value::new();
1320                while let Some(tag) = map.next_key::<__FieldTag>()? {
1321                    #[allow(clippy::match_single_binding)]
1322                    match tag {
1323                        __FieldTag::__output_url => {
1324                            if !fields.insert(__FieldTag::__output_url) {
1325                                return std::result::Result::Err(A::Error::duplicate_field(
1326                                    "multiple values for output_url",
1327                                ));
1328                            }
1329                            result.output_url = map
1330                                .next_value::<std::option::Option<std::string::String>>()?
1331                                .unwrap_or_default();
1332                        }
1333                        __FieldTag::Unknown(key) => {
1334                            let value = map.next_value::<serde_json::Value>()?;
1335                            result._unknown_fields.insert(key, value);
1336                        }
1337                    }
1338                }
1339                std::result::Result::Ok(result)
1340            }
1341        }
1342        deserializer.deserialize_any(Visitor)
1343    }
1344}
1345
1346#[doc(hidden)]
1347impl serde::ser::Serialize for ExportEntitiesResponse {
1348    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1349    where
1350        S: serde::ser::Serializer,
1351    {
1352        use serde::ser::SerializeMap;
1353        #[allow(unused_imports)]
1354        use std::option::Option::Some;
1355        let mut state = serializer.serialize_map(std::option::Option::None)?;
1356        if !self.output_url.is_empty() {
1357            state.serialize_entry("outputUrl", &self.output_url)?;
1358        }
1359        if !self._unknown_fields.is_empty() {
1360            for (key, value) in self._unknown_fields.iter() {
1361                state.serialize_entry(key, &value)?;
1362            }
1363        }
1364        state.end()
1365    }
1366}
1367
1368impl std::fmt::Debug for ExportEntitiesResponse {
1369    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1370        let mut debug_struct = f.debug_struct("ExportEntitiesResponse");
1371        debug_struct.field("output_url", &self.output_url);
1372        if !self._unknown_fields.is_empty() {
1373            debug_struct.field("_unknown_fields", &self._unknown_fields);
1374        }
1375        debug_struct.finish()
1376    }
1377}
1378
1379/// Metadata for ExportEntities operations.
1380#[derive(Clone, Default, PartialEq)]
1381#[non_exhaustive]
1382pub struct ExportEntitiesMetadata {
1383    /// Metadata common to all Datastore Admin operations.
1384    pub common: std::option::Option<crate::model::CommonMetadata>,
1385
1386    /// An estimate of the number of entities processed.
1387    pub progress_entities: std::option::Option<crate::model::Progress>,
1388
1389    /// An estimate of the number of bytes processed.
1390    pub progress_bytes: std::option::Option<crate::model::Progress>,
1391
1392    /// Description of which entities are being exported.
1393    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
1394
1395    /// Location for the export metadata and data files. This will be the same
1396    /// value as the
1397    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]
1398    /// field. The final output location is provided in
1399    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
1400    ///
1401    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]: crate::model::ExportEntitiesRequest::output_url_prefix
1402    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
1403    pub output_url_prefix: std::string::String,
1404
1405    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1406}
1407
1408impl ExportEntitiesMetadata {
1409    pub fn new() -> Self {
1410        std::default::Default::default()
1411    }
1412
1413    /// Sets the value of [common][crate::model::ExportEntitiesMetadata::common].
1414    pub fn set_common<T>(mut self, v: T) -> Self
1415    where
1416        T: std::convert::Into<crate::model::CommonMetadata>,
1417    {
1418        self.common = std::option::Option::Some(v.into());
1419        self
1420    }
1421
1422    /// Sets or clears the value of [common][crate::model::ExportEntitiesMetadata::common].
1423    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1424    where
1425        T: std::convert::Into<crate::model::CommonMetadata>,
1426    {
1427        self.common = v.map(|x| x.into());
1428        self
1429    }
1430
1431    /// Sets the value of [progress_entities][crate::model::ExportEntitiesMetadata::progress_entities].
1432    pub fn set_progress_entities<T>(mut self, v: T) -> Self
1433    where
1434        T: std::convert::Into<crate::model::Progress>,
1435    {
1436        self.progress_entities = std::option::Option::Some(v.into());
1437        self
1438    }
1439
1440    /// Sets or clears the value of [progress_entities][crate::model::ExportEntitiesMetadata::progress_entities].
1441    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
1442    where
1443        T: std::convert::Into<crate::model::Progress>,
1444    {
1445        self.progress_entities = v.map(|x| x.into());
1446        self
1447    }
1448
1449    /// Sets the value of [progress_bytes][crate::model::ExportEntitiesMetadata::progress_bytes].
1450    pub fn set_progress_bytes<T>(mut self, v: T) -> Self
1451    where
1452        T: std::convert::Into<crate::model::Progress>,
1453    {
1454        self.progress_bytes = std::option::Option::Some(v.into());
1455        self
1456    }
1457
1458    /// Sets or clears the value of [progress_bytes][crate::model::ExportEntitiesMetadata::progress_bytes].
1459    pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
1460    where
1461        T: std::convert::Into<crate::model::Progress>,
1462    {
1463        self.progress_bytes = v.map(|x| x.into());
1464        self
1465    }
1466
1467    /// Sets the value of [entity_filter][crate::model::ExportEntitiesMetadata::entity_filter].
1468    pub fn set_entity_filter<T>(mut self, v: T) -> Self
1469    where
1470        T: std::convert::Into<crate::model::EntityFilter>,
1471    {
1472        self.entity_filter = std::option::Option::Some(v.into());
1473        self
1474    }
1475
1476    /// Sets or clears the value of [entity_filter][crate::model::ExportEntitiesMetadata::entity_filter].
1477    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
1478    where
1479        T: std::convert::Into<crate::model::EntityFilter>,
1480    {
1481        self.entity_filter = v.map(|x| x.into());
1482        self
1483    }
1484
1485    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesMetadata::output_url_prefix].
1486    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
1487        mut self,
1488        v: T,
1489    ) -> Self {
1490        self.output_url_prefix = v.into();
1491        self
1492    }
1493}
1494
1495impl wkt::message::Message for ExportEntitiesMetadata {
1496    fn typename() -> &'static str {
1497        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata"
1498    }
1499}
1500
1501#[doc(hidden)]
1502impl<'de> serde::de::Deserialize<'de> for ExportEntitiesMetadata {
1503    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1504    where
1505        D: serde::Deserializer<'de>,
1506    {
1507        #[allow(non_camel_case_types)]
1508        #[doc(hidden)]
1509        #[derive(PartialEq, Eq, Hash)]
1510        enum __FieldTag {
1511            __common,
1512            __progress_entities,
1513            __progress_bytes,
1514            __entity_filter,
1515            __output_url_prefix,
1516            Unknown(std::string::String),
1517        }
1518        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1519            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1520            where
1521                D: serde::Deserializer<'de>,
1522            {
1523                struct Visitor;
1524                impl<'de> serde::de::Visitor<'de> for Visitor {
1525                    type Value = __FieldTag;
1526                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1527                        formatter.write_str("a field name for ExportEntitiesMetadata")
1528                    }
1529                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1530                    where
1531                        E: serde::de::Error,
1532                    {
1533                        use std::result::Result::Ok;
1534                        use std::string::ToString;
1535                        match value {
1536                            "common" => Ok(__FieldTag::__common),
1537                            "progressEntities" => Ok(__FieldTag::__progress_entities),
1538                            "progress_entities" => Ok(__FieldTag::__progress_entities),
1539                            "progressBytes" => Ok(__FieldTag::__progress_bytes),
1540                            "progress_bytes" => Ok(__FieldTag::__progress_bytes),
1541                            "entityFilter" => Ok(__FieldTag::__entity_filter),
1542                            "entity_filter" => Ok(__FieldTag::__entity_filter),
1543                            "outputUrlPrefix" => Ok(__FieldTag::__output_url_prefix),
1544                            "output_url_prefix" => Ok(__FieldTag::__output_url_prefix),
1545                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1546                        }
1547                    }
1548                }
1549                deserializer.deserialize_identifier(Visitor)
1550            }
1551        }
1552        struct Visitor;
1553        impl<'de> serde::de::Visitor<'de> for Visitor {
1554            type Value = ExportEntitiesMetadata;
1555            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1556                formatter.write_str("struct ExportEntitiesMetadata")
1557            }
1558            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1559            where
1560                A: serde::de::MapAccess<'de>,
1561            {
1562                #[allow(unused_imports)]
1563                use serde::de::Error;
1564                use std::option::Option::Some;
1565                let mut fields = std::collections::HashSet::new();
1566                let mut result = Self::Value::new();
1567                while let Some(tag) = map.next_key::<__FieldTag>()? {
1568                    #[allow(clippy::match_single_binding)]
1569                    match tag {
1570                        __FieldTag::__common => {
1571                            if !fields.insert(__FieldTag::__common) {
1572                                return std::result::Result::Err(A::Error::duplicate_field(
1573                                    "multiple values for common",
1574                                ));
1575                            }
1576                            result.common = map
1577                                .next_value::<std::option::Option<crate::model::CommonMetadata>>(
1578                                )?;
1579                        }
1580                        __FieldTag::__progress_entities => {
1581                            if !fields.insert(__FieldTag::__progress_entities) {
1582                                return std::result::Result::Err(A::Error::duplicate_field(
1583                                    "multiple values for progress_entities",
1584                                ));
1585                            }
1586                            result.progress_entities =
1587                                map.next_value::<std::option::Option<crate::model::Progress>>()?;
1588                        }
1589                        __FieldTag::__progress_bytes => {
1590                            if !fields.insert(__FieldTag::__progress_bytes) {
1591                                return std::result::Result::Err(A::Error::duplicate_field(
1592                                    "multiple values for progress_bytes",
1593                                ));
1594                            }
1595                            result.progress_bytes =
1596                                map.next_value::<std::option::Option<crate::model::Progress>>()?;
1597                        }
1598                        __FieldTag::__entity_filter => {
1599                            if !fields.insert(__FieldTag::__entity_filter) {
1600                                return std::result::Result::Err(A::Error::duplicate_field(
1601                                    "multiple values for entity_filter",
1602                                ));
1603                            }
1604                            result.entity_filter = map
1605                                .next_value::<std::option::Option<crate::model::EntityFilter>>()?;
1606                        }
1607                        __FieldTag::__output_url_prefix => {
1608                            if !fields.insert(__FieldTag::__output_url_prefix) {
1609                                return std::result::Result::Err(A::Error::duplicate_field(
1610                                    "multiple values for output_url_prefix",
1611                                ));
1612                            }
1613                            result.output_url_prefix = map
1614                                .next_value::<std::option::Option<std::string::String>>()?
1615                                .unwrap_or_default();
1616                        }
1617                        __FieldTag::Unknown(key) => {
1618                            let value = map.next_value::<serde_json::Value>()?;
1619                            result._unknown_fields.insert(key, value);
1620                        }
1621                    }
1622                }
1623                std::result::Result::Ok(result)
1624            }
1625        }
1626        deserializer.deserialize_any(Visitor)
1627    }
1628}
1629
1630#[doc(hidden)]
1631impl serde::ser::Serialize for ExportEntitiesMetadata {
1632    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1633    where
1634        S: serde::ser::Serializer,
1635    {
1636        use serde::ser::SerializeMap;
1637        #[allow(unused_imports)]
1638        use std::option::Option::Some;
1639        let mut state = serializer.serialize_map(std::option::Option::None)?;
1640        if self.common.is_some() {
1641            state.serialize_entry("common", &self.common)?;
1642        }
1643        if self.progress_entities.is_some() {
1644            state.serialize_entry("progressEntities", &self.progress_entities)?;
1645        }
1646        if self.progress_bytes.is_some() {
1647            state.serialize_entry("progressBytes", &self.progress_bytes)?;
1648        }
1649        if self.entity_filter.is_some() {
1650            state.serialize_entry("entityFilter", &self.entity_filter)?;
1651        }
1652        if !self.output_url_prefix.is_empty() {
1653            state.serialize_entry("outputUrlPrefix", &self.output_url_prefix)?;
1654        }
1655        if !self._unknown_fields.is_empty() {
1656            for (key, value) in self._unknown_fields.iter() {
1657                state.serialize_entry(key, &value)?;
1658            }
1659        }
1660        state.end()
1661    }
1662}
1663
1664impl std::fmt::Debug for ExportEntitiesMetadata {
1665    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1666        let mut debug_struct = f.debug_struct("ExportEntitiesMetadata");
1667        debug_struct.field("common", &self.common);
1668        debug_struct.field("progress_entities", &self.progress_entities);
1669        debug_struct.field("progress_bytes", &self.progress_bytes);
1670        debug_struct.field("entity_filter", &self.entity_filter);
1671        debug_struct.field("output_url_prefix", &self.output_url_prefix);
1672        if !self._unknown_fields.is_empty() {
1673            debug_struct.field("_unknown_fields", &self._unknown_fields);
1674        }
1675        debug_struct.finish()
1676    }
1677}
1678
1679/// Metadata for ImportEntities operations.
1680#[derive(Clone, Default, PartialEq)]
1681#[non_exhaustive]
1682pub struct ImportEntitiesMetadata {
1683    /// Metadata common to all Datastore Admin operations.
1684    pub common: std::option::Option<crate::model::CommonMetadata>,
1685
1686    /// An estimate of the number of entities processed.
1687    pub progress_entities: std::option::Option<crate::model::Progress>,
1688
1689    /// An estimate of the number of bytes processed.
1690    pub progress_bytes: std::option::Option<crate::model::Progress>,
1691
1692    /// Description of which entities are being imported.
1693    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
1694
1695    /// The location of the import metadata file. This will be the same value as
1696    /// the
1697    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
1698    /// field.
1699    ///
1700    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
1701    pub input_url: std::string::String,
1702
1703    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1704}
1705
1706impl ImportEntitiesMetadata {
1707    pub fn new() -> Self {
1708        std::default::Default::default()
1709    }
1710
1711    /// Sets the value of [common][crate::model::ImportEntitiesMetadata::common].
1712    pub fn set_common<T>(mut self, v: T) -> Self
1713    where
1714        T: std::convert::Into<crate::model::CommonMetadata>,
1715    {
1716        self.common = std::option::Option::Some(v.into());
1717        self
1718    }
1719
1720    /// Sets or clears the value of [common][crate::model::ImportEntitiesMetadata::common].
1721    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1722    where
1723        T: std::convert::Into<crate::model::CommonMetadata>,
1724    {
1725        self.common = v.map(|x| x.into());
1726        self
1727    }
1728
1729    /// Sets the value of [progress_entities][crate::model::ImportEntitiesMetadata::progress_entities].
1730    pub fn set_progress_entities<T>(mut self, v: T) -> Self
1731    where
1732        T: std::convert::Into<crate::model::Progress>,
1733    {
1734        self.progress_entities = std::option::Option::Some(v.into());
1735        self
1736    }
1737
1738    /// Sets or clears the value of [progress_entities][crate::model::ImportEntitiesMetadata::progress_entities].
1739    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
1740    where
1741        T: std::convert::Into<crate::model::Progress>,
1742    {
1743        self.progress_entities = v.map(|x| x.into());
1744        self
1745    }
1746
1747    /// Sets the value of [progress_bytes][crate::model::ImportEntitiesMetadata::progress_bytes].
1748    pub fn set_progress_bytes<T>(mut self, v: T) -> Self
1749    where
1750        T: std::convert::Into<crate::model::Progress>,
1751    {
1752        self.progress_bytes = std::option::Option::Some(v.into());
1753        self
1754    }
1755
1756    /// Sets or clears the value of [progress_bytes][crate::model::ImportEntitiesMetadata::progress_bytes].
1757    pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
1758    where
1759        T: std::convert::Into<crate::model::Progress>,
1760    {
1761        self.progress_bytes = v.map(|x| x.into());
1762        self
1763    }
1764
1765    /// Sets the value of [entity_filter][crate::model::ImportEntitiesMetadata::entity_filter].
1766    pub fn set_entity_filter<T>(mut self, v: T) -> Self
1767    where
1768        T: std::convert::Into<crate::model::EntityFilter>,
1769    {
1770        self.entity_filter = std::option::Option::Some(v.into());
1771        self
1772    }
1773
1774    /// Sets or clears the value of [entity_filter][crate::model::ImportEntitiesMetadata::entity_filter].
1775    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
1776    where
1777        T: std::convert::Into<crate::model::EntityFilter>,
1778    {
1779        self.entity_filter = v.map(|x| x.into());
1780        self
1781    }
1782
1783    /// Sets the value of [input_url][crate::model::ImportEntitiesMetadata::input_url].
1784    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1785        self.input_url = v.into();
1786        self
1787    }
1788}
1789
1790impl wkt::message::Message for ImportEntitiesMetadata {
1791    fn typename() -> &'static str {
1792        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesMetadata"
1793    }
1794}
1795
1796#[doc(hidden)]
1797impl<'de> serde::de::Deserialize<'de> for ImportEntitiesMetadata {
1798    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1799    where
1800        D: serde::Deserializer<'de>,
1801    {
1802        #[allow(non_camel_case_types)]
1803        #[doc(hidden)]
1804        #[derive(PartialEq, Eq, Hash)]
1805        enum __FieldTag {
1806            __common,
1807            __progress_entities,
1808            __progress_bytes,
1809            __entity_filter,
1810            __input_url,
1811            Unknown(std::string::String),
1812        }
1813        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1814            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1815            where
1816                D: serde::Deserializer<'de>,
1817            {
1818                struct Visitor;
1819                impl<'de> serde::de::Visitor<'de> for Visitor {
1820                    type Value = __FieldTag;
1821                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1822                        formatter.write_str("a field name for ImportEntitiesMetadata")
1823                    }
1824                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1825                    where
1826                        E: serde::de::Error,
1827                    {
1828                        use std::result::Result::Ok;
1829                        use std::string::ToString;
1830                        match value {
1831                            "common" => Ok(__FieldTag::__common),
1832                            "progressEntities" => Ok(__FieldTag::__progress_entities),
1833                            "progress_entities" => Ok(__FieldTag::__progress_entities),
1834                            "progressBytes" => Ok(__FieldTag::__progress_bytes),
1835                            "progress_bytes" => Ok(__FieldTag::__progress_bytes),
1836                            "entityFilter" => Ok(__FieldTag::__entity_filter),
1837                            "entity_filter" => Ok(__FieldTag::__entity_filter),
1838                            "inputUrl" => Ok(__FieldTag::__input_url),
1839                            "input_url" => Ok(__FieldTag::__input_url),
1840                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1841                        }
1842                    }
1843                }
1844                deserializer.deserialize_identifier(Visitor)
1845            }
1846        }
1847        struct Visitor;
1848        impl<'de> serde::de::Visitor<'de> for Visitor {
1849            type Value = ImportEntitiesMetadata;
1850            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1851                formatter.write_str("struct ImportEntitiesMetadata")
1852            }
1853            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1854            where
1855                A: serde::de::MapAccess<'de>,
1856            {
1857                #[allow(unused_imports)]
1858                use serde::de::Error;
1859                use std::option::Option::Some;
1860                let mut fields = std::collections::HashSet::new();
1861                let mut result = Self::Value::new();
1862                while let Some(tag) = map.next_key::<__FieldTag>()? {
1863                    #[allow(clippy::match_single_binding)]
1864                    match tag {
1865                        __FieldTag::__common => {
1866                            if !fields.insert(__FieldTag::__common) {
1867                                return std::result::Result::Err(A::Error::duplicate_field(
1868                                    "multiple values for common",
1869                                ));
1870                            }
1871                            result.common = map
1872                                .next_value::<std::option::Option<crate::model::CommonMetadata>>(
1873                                )?;
1874                        }
1875                        __FieldTag::__progress_entities => {
1876                            if !fields.insert(__FieldTag::__progress_entities) {
1877                                return std::result::Result::Err(A::Error::duplicate_field(
1878                                    "multiple values for progress_entities",
1879                                ));
1880                            }
1881                            result.progress_entities =
1882                                map.next_value::<std::option::Option<crate::model::Progress>>()?;
1883                        }
1884                        __FieldTag::__progress_bytes => {
1885                            if !fields.insert(__FieldTag::__progress_bytes) {
1886                                return std::result::Result::Err(A::Error::duplicate_field(
1887                                    "multiple values for progress_bytes",
1888                                ));
1889                            }
1890                            result.progress_bytes =
1891                                map.next_value::<std::option::Option<crate::model::Progress>>()?;
1892                        }
1893                        __FieldTag::__entity_filter => {
1894                            if !fields.insert(__FieldTag::__entity_filter) {
1895                                return std::result::Result::Err(A::Error::duplicate_field(
1896                                    "multiple values for entity_filter",
1897                                ));
1898                            }
1899                            result.entity_filter = map
1900                                .next_value::<std::option::Option<crate::model::EntityFilter>>()?;
1901                        }
1902                        __FieldTag::__input_url => {
1903                            if !fields.insert(__FieldTag::__input_url) {
1904                                return std::result::Result::Err(A::Error::duplicate_field(
1905                                    "multiple values for input_url",
1906                                ));
1907                            }
1908                            result.input_url = map
1909                                .next_value::<std::option::Option<std::string::String>>()?
1910                                .unwrap_or_default();
1911                        }
1912                        __FieldTag::Unknown(key) => {
1913                            let value = map.next_value::<serde_json::Value>()?;
1914                            result._unknown_fields.insert(key, value);
1915                        }
1916                    }
1917                }
1918                std::result::Result::Ok(result)
1919            }
1920        }
1921        deserializer.deserialize_any(Visitor)
1922    }
1923}
1924
1925#[doc(hidden)]
1926impl serde::ser::Serialize for ImportEntitiesMetadata {
1927    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1928    where
1929        S: serde::ser::Serializer,
1930    {
1931        use serde::ser::SerializeMap;
1932        #[allow(unused_imports)]
1933        use std::option::Option::Some;
1934        let mut state = serializer.serialize_map(std::option::Option::None)?;
1935        if self.common.is_some() {
1936            state.serialize_entry("common", &self.common)?;
1937        }
1938        if self.progress_entities.is_some() {
1939            state.serialize_entry("progressEntities", &self.progress_entities)?;
1940        }
1941        if self.progress_bytes.is_some() {
1942            state.serialize_entry("progressBytes", &self.progress_bytes)?;
1943        }
1944        if self.entity_filter.is_some() {
1945            state.serialize_entry("entityFilter", &self.entity_filter)?;
1946        }
1947        if !self.input_url.is_empty() {
1948            state.serialize_entry("inputUrl", &self.input_url)?;
1949        }
1950        if !self._unknown_fields.is_empty() {
1951            for (key, value) in self._unknown_fields.iter() {
1952                state.serialize_entry(key, &value)?;
1953            }
1954        }
1955        state.end()
1956    }
1957}
1958
1959impl std::fmt::Debug for ImportEntitiesMetadata {
1960    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1961        let mut debug_struct = f.debug_struct("ImportEntitiesMetadata");
1962        debug_struct.field("common", &self.common);
1963        debug_struct.field("progress_entities", &self.progress_entities);
1964        debug_struct.field("progress_bytes", &self.progress_bytes);
1965        debug_struct.field("entity_filter", &self.entity_filter);
1966        debug_struct.field("input_url", &self.input_url);
1967        if !self._unknown_fields.is_empty() {
1968            debug_struct.field("_unknown_fields", &self._unknown_fields);
1969        }
1970        debug_struct.finish()
1971    }
1972}
1973
1974/// Identifies a subset of entities in a project. This is specified as
1975/// combinations of kinds and namespaces (either or both of which may be all, as
1976/// described in the following examples).
1977/// Example usage:
1978///
1979/// Entire project:
1980/// kinds=[], namespace_ids=[]
1981///
1982/// Kinds Foo and Bar in all namespaces:
1983/// kinds=['Foo', 'Bar'], namespace_ids=[]
1984///
1985/// Kinds Foo and Bar only in the default namespace:
1986/// kinds=['Foo', 'Bar'], namespace_ids=['']
1987///
1988/// Kinds Foo and Bar in both the default and Baz namespaces:
1989/// kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
1990///
1991/// The entire Baz namespace:
1992/// kinds=[], namespace_ids=['Baz']
1993#[derive(Clone, Default, PartialEq)]
1994#[non_exhaustive]
1995pub struct EntityFilter {
1996    /// If empty, then this represents all kinds.
1997    pub kinds: std::vec::Vec<std::string::String>,
1998
1999    /// An empty list represents all namespaces. This is the preferred
2000    /// usage for projects that don't use namespaces.
2001    ///
2002    /// An empty string element represents the default namespace. This should be
2003    /// used if the project has data in non-default namespaces, but doesn't want to
2004    /// include them.
2005    /// Each namespace in this list must be unique.
2006    pub namespace_ids: std::vec::Vec<std::string::String>,
2007
2008    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2009}
2010
2011impl EntityFilter {
2012    pub fn new() -> Self {
2013        std::default::Default::default()
2014    }
2015
2016    /// Sets the value of [kinds][crate::model::EntityFilter::kinds].
2017    pub fn set_kinds<T, V>(mut self, v: T) -> Self
2018    where
2019        T: std::iter::IntoIterator<Item = V>,
2020        V: std::convert::Into<std::string::String>,
2021    {
2022        use std::iter::Iterator;
2023        self.kinds = v.into_iter().map(|i| i.into()).collect();
2024        self
2025    }
2026
2027    /// Sets the value of [namespace_ids][crate::model::EntityFilter::namespace_ids].
2028    pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
2029    where
2030        T: std::iter::IntoIterator<Item = V>,
2031        V: std::convert::Into<std::string::String>,
2032    {
2033        use std::iter::Iterator;
2034        self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
2035        self
2036    }
2037}
2038
2039impl wkt::message::Message for EntityFilter {
2040    fn typename() -> &'static str {
2041        "type.googleapis.com/google.datastore.admin.v1.EntityFilter"
2042    }
2043}
2044
2045#[doc(hidden)]
2046impl<'de> serde::de::Deserialize<'de> for EntityFilter {
2047    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2048    where
2049        D: serde::Deserializer<'de>,
2050    {
2051        #[allow(non_camel_case_types)]
2052        #[doc(hidden)]
2053        #[derive(PartialEq, Eq, Hash)]
2054        enum __FieldTag {
2055            __kinds,
2056            __namespace_ids,
2057            Unknown(std::string::String),
2058        }
2059        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2060            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2061            where
2062                D: serde::Deserializer<'de>,
2063            {
2064                struct Visitor;
2065                impl<'de> serde::de::Visitor<'de> for Visitor {
2066                    type Value = __FieldTag;
2067                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2068                        formatter.write_str("a field name for EntityFilter")
2069                    }
2070                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2071                    where
2072                        E: serde::de::Error,
2073                    {
2074                        use std::result::Result::Ok;
2075                        use std::string::ToString;
2076                        match value {
2077                            "kinds" => Ok(__FieldTag::__kinds),
2078                            "namespaceIds" => Ok(__FieldTag::__namespace_ids),
2079                            "namespace_ids" => Ok(__FieldTag::__namespace_ids),
2080                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2081                        }
2082                    }
2083                }
2084                deserializer.deserialize_identifier(Visitor)
2085            }
2086        }
2087        struct Visitor;
2088        impl<'de> serde::de::Visitor<'de> for Visitor {
2089            type Value = EntityFilter;
2090            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2091                formatter.write_str("struct EntityFilter")
2092            }
2093            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2094            where
2095                A: serde::de::MapAccess<'de>,
2096            {
2097                #[allow(unused_imports)]
2098                use serde::de::Error;
2099                use std::option::Option::Some;
2100                let mut fields = std::collections::HashSet::new();
2101                let mut result = Self::Value::new();
2102                while let Some(tag) = map.next_key::<__FieldTag>()? {
2103                    #[allow(clippy::match_single_binding)]
2104                    match tag {
2105                        __FieldTag::__kinds => {
2106                            if !fields.insert(__FieldTag::__kinds) {
2107                                return std::result::Result::Err(A::Error::duplicate_field(
2108                                    "multiple values for kinds",
2109                                ));
2110                            }
2111                            result.kinds = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
2112                        }
2113                        __FieldTag::__namespace_ids => {
2114                            if !fields.insert(__FieldTag::__namespace_ids) {
2115                                return std::result::Result::Err(A::Error::duplicate_field(
2116                                    "multiple values for namespace_ids",
2117                                ));
2118                            }
2119                            result.namespace_ids = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
2120                        }
2121                        __FieldTag::Unknown(key) => {
2122                            let value = map.next_value::<serde_json::Value>()?;
2123                            result._unknown_fields.insert(key, value);
2124                        }
2125                    }
2126                }
2127                std::result::Result::Ok(result)
2128            }
2129        }
2130        deserializer.deserialize_any(Visitor)
2131    }
2132}
2133
2134#[doc(hidden)]
2135impl serde::ser::Serialize for EntityFilter {
2136    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2137    where
2138        S: serde::ser::Serializer,
2139    {
2140        use serde::ser::SerializeMap;
2141        #[allow(unused_imports)]
2142        use std::option::Option::Some;
2143        let mut state = serializer.serialize_map(std::option::Option::None)?;
2144        if !self.kinds.is_empty() {
2145            state.serialize_entry("kinds", &self.kinds)?;
2146        }
2147        if !self.namespace_ids.is_empty() {
2148            state.serialize_entry("namespaceIds", &self.namespace_ids)?;
2149        }
2150        if !self._unknown_fields.is_empty() {
2151            for (key, value) in self._unknown_fields.iter() {
2152                state.serialize_entry(key, &value)?;
2153            }
2154        }
2155        state.end()
2156    }
2157}
2158
2159impl std::fmt::Debug for EntityFilter {
2160    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2161        let mut debug_struct = f.debug_struct("EntityFilter");
2162        debug_struct.field("kinds", &self.kinds);
2163        debug_struct.field("namespace_ids", &self.namespace_ids);
2164        if !self._unknown_fields.is_empty() {
2165            debug_struct.field("_unknown_fields", &self._unknown_fields);
2166        }
2167        debug_struct.finish()
2168    }
2169}
2170
2171/// The request for
2172/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
2173///
2174/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]: crate::client::DatastoreAdmin::create_index
2175#[derive(Clone, Default, PartialEq)]
2176#[non_exhaustive]
2177pub struct CreateIndexRequest {
2178    /// Project ID against which to make the request.
2179    pub project_id: std::string::String,
2180
2181    /// The index to create. The name and state fields are output only and will be
2182    /// ignored. Single property indexes cannot be created or deleted.
2183    pub index: std::option::Option<crate::model::Index>,
2184
2185    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2186}
2187
2188impl CreateIndexRequest {
2189    pub fn new() -> Self {
2190        std::default::Default::default()
2191    }
2192
2193    /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
2194    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2195        self.project_id = v.into();
2196        self
2197    }
2198
2199    /// Sets the value of [index][crate::model::CreateIndexRequest::index].
2200    pub fn set_index<T>(mut self, v: T) -> Self
2201    where
2202        T: std::convert::Into<crate::model::Index>,
2203    {
2204        self.index = std::option::Option::Some(v.into());
2205        self
2206    }
2207
2208    /// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
2209    pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
2210    where
2211        T: std::convert::Into<crate::model::Index>,
2212    {
2213        self.index = v.map(|x| x.into());
2214        self
2215    }
2216}
2217
2218impl wkt::message::Message for CreateIndexRequest {
2219    fn typename() -> &'static str {
2220        "type.googleapis.com/google.datastore.admin.v1.CreateIndexRequest"
2221    }
2222}
2223
2224#[doc(hidden)]
2225impl<'de> serde::de::Deserialize<'de> for CreateIndexRequest {
2226    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2227    where
2228        D: serde::Deserializer<'de>,
2229    {
2230        #[allow(non_camel_case_types)]
2231        #[doc(hidden)]
2232        #[derive(PartialEq, Eq, Hash)]
2233        enum __FieldTag {
2234            __project_id,
2235            __index,
2236            Unknown(std::string::String),
2237        }
2238        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2239            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2240            where
2241                D: serde::Deserializer<'de>,
2242            {
2243                struct Visitor;
2244                impl<'de> serde::de::Visitor<'de> for Visitor {
2245                    type Value = __FieldTag;
2246                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2247                        formatter.write_str("a field name for CreateIndexRequest")
2248                    }
2249                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2250                    where
2251                        E: serde::de::Error,
2252                    {
2253                        use std::result::Result::Ok;
2254                        use std::string::ToString;
2255                        match value {
2256                            "projectId" => Ok(__FieldTag::__project_id),
2257                            "project_id" => Ok(__FieldTag::__project_id),
2258                            "index" => Ok(__FieldTag::__index),
2259                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2260                        }
2261                    }
2262                }
2263                deserializer.deserialize_identifier(Visitor)
2264            }
2265        }
2266        struct Visitor;
2267        impl<'de> serde::de::Visitor<'de> for Visitor {
2268            type Value = CreateIndexRequest;
2269            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2270                formatter.write_str("struct CreateIndexRequest")
2271            }
2272            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2273            where
2274                A: serde::de::MapAccess<'de>,
2275            {
2276                #[allow(unused_imports)]
2277                use serde::de::Error;
2278                use std::option::Option::Some;
2279                let mut fields = std::collections::HashSet::new();
2280                let mut result = Self::Value::new();
2281                while let Some(tag) = map.next_key::<__FieldTag>()? {
2282                    #[allow(clippy::match_single_binding)]
2283                    match tag {
2284                        __FieldTag::__project_id => {
2285                            if !fields.insert(__FieldTag::__project_id) {
2286                                return std::result::Result::Err(A::Error::duplicate_field(
2287                                    "multiple values for project_id",
2288                                ));
2289                            }
2290                            result.project_id = map
2291                                .next_value::<std::option::Option<std::string::String>>()?
2292                                .unwrap_or_default();
2293                        }
2294                        __FieldTag::__index => {
2295                            if !fields.insert(__FieldTag::__index) {
2296                                return std::result::Result::Err(A::Error::duplicate_field(
2297                                    "multiple values for index",
2298                                ));
2299                            }
2300                            result.index =
2301                                map.next_value::<std::option::Option<crate::model::Index>>()?;
2302                        }
2303                        __FieldTag::Unknown(key) => {
2304                            let value = map.next_value::<serde_json::Value>()?;
2305                            result._unknown_fields.insert(key, value);
2306                        }
2307                    }
2308                }
2309                std::result::Result::Ok(result)
2310            }
2311        }
2312        deserializer.deserialize_any(Visitor)
2313    }
2314}
2315
2316#[doc(hidden)]
2317impl serde::ser::Serialize for CreateIndexRequest {
2318    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2319    where
2320        S: serde::ser::Serializer,
2321    {
2322        use serde::ser::SerializeMap;
2323        #[allow(unused_imports)]
2324        use std::option::Option::Some;
2325        let mut state = serializer.serialize_map(std::option::Option::None)?;
2326        if !self.project_id.is_empty() {
2327            state.serialize_entry("projectId", &self.project_id)?;
2328        }
2329        if self.index.is_some() {
2330            state.serialize_entry("index", &self.index)?;
2331        }
2332        if !self._unknown_fields.is_empty() {
2333            for (key, value) in self._unknown_fields.iter() {
2334                state.serialize_entry(key, &value)?;
2335            }
2336        }
2337        state.end()
2338    }
2339}
2340
2341impl std::fmt::Debug for CreateIndexRequest {
2342    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2343        let mut debug_struct = f.debug_struct("CreateIndexRequest");
2344        debug_struct.field("project_id", &self.project_id);
2345        debug_struct.field("index", &self.index);
2346        if !self._unknown_fields.is_empty() {
2347            debug_struct.field("_unknown_fields", &self._unknown_fields);
2348        }
2349        debug_struct.finish()
2350    }
2351}
2352
2353/// The request for
2354/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex].
2355///
2356/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex]: crate::client::DatastoreAdmin::delete_index
2357#[derive(Clone, Default, PartialEq)]
2358#[non_exhaustive]
2359pub struct DeleteIndexRequest {
2360    /// Project ID against which to make the request.
2361    pub project_id: std::string::String,
2362
2363    /// The resource ID of the index to delete.
2364    pub index_id: std::string::String,
2365
2366    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2367}
2368
2369impl DeleteIndexRequest {
2370    pub fn new() -> Self {
2371        std::default::Default::default()
2372    }
2373
2374    /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
2375    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2376        self.project_id = v.into();
2377        self
2378    }
2379
2380    /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
2381    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2382        self.index_id = v.into();
2383        self
2384    }
2385}
2386
2387impl wkt::message::Message for DeleteIndexRequest {
2388    fn typename() -> &'static str {
2389        "type.googleapis.com/google.datastore.admin.v1.DeleteIndexRequest"
2390    }
2391}
2392
2393#[doc(hidden)]
2394impl<'de> serde::de::Deserialize<'de> for DeleteIndexRequest {
2395    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2396    where
2397        D: serde::Deserializer<'de>,
2398    {
2399        #[allow(non_camel_case_types)]
2400        #[doc(hidden)]
2401        #[derive(PartialEq, Eq, Hash)]
2402        enum __FieldTag {
2403            __project_id,
2404            __index_id,
2405            Unknown(std::string::String),
2406        }
2407        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2408            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2409            where
2410                D: serde::Deserializer<'de>,
2411            {
2412                struct Visitor;
2413                impl<'de> serde::de::Visitor<'de> for Visitor {
2414                    type Value = __FieldTag;
2415                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2416                        formatter.write_str("a field name for DeleteIndexRequest")
2417                    }
2418                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2419                    where
2420                        E: serde::de::Error,
2421                    {
2422                        use std::result::Result::Ok;
2423                        use std::string::ToString;
2424                        match value {
2425                            "projectId" => Ok(__FieldTag::__project_id),
2426                            "project_id" => Ok(__FieldTag::__project_id),
2427                            "indexId" => Ok(__FieldTag::__index_id),
2428                            "index_id" => Ok(__FieldTag::__index_id),
2429                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2430                        }
2431                    }
2432                }
2433                deserializer.deserialize_identifier(Visitor)
2434            }
2435        }
2436        struct Visitor;
2437        impl<'de> serde::de::Visitor<'de> for Visitor {
2438            type Value = DeleteIndexRequest;
2439            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2440                formatter.write_str("struct DeleteIndexRequest")
2441            }
2442            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2443            where
2444                A: serde::de::MapAccess<'de>,
2445            {
2446                #[allow(unused_imports)]
2447                use serde::de::Error;
2448                use std::option::Option::Some;
2449                let mut fields = std::collections::HashSet::new();
2450                let mut result = Self::Value::new();
2451                while let Some(tag) = map.next_key::<__FieldTag>()? {
2452                    #[allow(clippy::match_single_binding)]
2453                    match tag {
2454                        __FieldTag::__project_id => {
2455                            if !fields.insert(__FieldTag::__project_id) {
2456                                return std::result::Result::Err(A::Error::duplicate_field(
2457                                    "multiple values for project_id",
2458                                ));
2459                            }
2460                            result.project_id = map
2461                                .next_value::<std::option::Option<std::string::String>>()?
2462                                .unwrap_or_default();
2463                        }
2464                        __FieldTag::__index_id => {
2465                            if !fields.insert(__FieldTag::__index_id) {
2466                                return std::result::Result::Err(A::Error::duplicate_field(
2467                                    "multiple values for index_id",
2468                                ));
2469                            }
2470                            result.index_id = map
2471                                .next_value::<std::option::Option<std::string::String>>()?
2472                                .unwrap_or_default();
2473                        }
2474                        __FieldTag::Unknown(key) => {
2475                            let value = map.next_value::<serde_json::Value>()?;
2476                            result._unknown_fields.insert(key, value);
2477                        }
2478                    }
2479                }
2480                std::result::Result::Ok(result)
2481            }
2482        }
2483        deserializer.deserialize_any(Visitor)
2484    }
2485}
2486
2487#[doc(hidden)]
2488impl serde::ser::Serialize for DeleteIndexRequest {
2489    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2490    where
2491        S: serde::ser::Serializer,
2492    {
2493        use serde::ser::SerializeMap;
2494        #[allow(unused_imports)]
2495        use std::option::Option::Some;
2496        let mut state = serializer.serialize_map(std::option::Option::None)?;
2497        if !self.project_id.is_empty() {
2498            state.serialize_entry("projectId", &self.project_id)?;
2499        }
2500        if !self.index_id.is_empty() {
2501            state.serialize_entry("indexId", &self.index_id)?;
2502        }
2503        if !self._unknown_fields.is_empty() {
2504            for (key, value) in self._unknown_fields.iter() {
2505                state.serialize_entry(key, &value)?;
2506            }
2507        }
2508        state.end()
2509    }
2510}
2511
2512impl std::fmt::Debug for DeleteIndexRequest {
2513    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2514        let mut debug_struct = f.debug_struct("DeleteIndexRequest");
2515        debug_struct.field("project_id", &self.project_id);
2516        debug_struct.field("index_id", &self.index_id);
2517        if !self._unknown_fields.is_empty() {
2518            debug_struct.field("_unknown_fields", &self._unknown_fields);
2519        }
2520        debug_struct.finish()
2521    }
2522}
2523
2524/// The request for
2525/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex].
2526///
2527/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex]: crate::client::DatastoreAdmin::get_index
2528#[derive(Clone, Default, PartialEq)]
2529#[non_exhaustive]
2530pub struct GetIndexRequest {
2531    /// Project ID against which to make the request.
2532    pub project_id: std::string::String,
2533
2534    /// The resource ID of the index to get.
2535    pub index_id: std::string::String,
2536
2537    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2538}
2539
2540impl GetIndexRequest {
2541    pub fn new() -> Self {
2542        std::default::Default::default()
2543    }
2544
2545    /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
2546    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2547        self.project_id = v.into();
2548        self
2549    }
2550
2551    /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
2552    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2553        self.index_id = v.into();
2554        self
2555    }
2556}
2557
2558impl wkt::message::Message for GetIndexRequest {
2559    fn typename() -> &'static str {
2560        "type.googleapis.com/google.datastore.admin.v1.GetIndexRequest"
2561    }
2562}
2563
2564#[doc(hidden)]
2565impl<'de> serde::de::Deserialize<'de> for GetIndexRequest {
2566    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2567    where
2568        D: serde::Deserializer<'de>,
2569    {
2570        #[allow(non_camel_case_types)]
2571        #[doc(hidden)]
2572        #[derive(PartialEq, Eq, Hash)]
2573        enum __FieldTag {
2574            __project_id,
2575            __index_id,
2576            Unknown(std::string::String),
2577        }
2578        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2579            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2580            where
2581                D: serde::Deserializer<'de>,
2582            {
2583                struct Visitor;
2584                impl<'de> serde::de::Visitor<'de> for Visitor {
2585                    type Value = __FieldTag;
2586                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2587                        formatter.write_str("a field name for GetIndexRequest")
2588                    }
2589                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2590                    where
2591                        E: serde::de::Error,
2592                    {
2593                        use std::result::Result::Ok;
2594                        use std::string::ToString;
2595                        match value {
2596                            "projectId" => Ok(__FieldTag::__project_id),
2597                            "project_id" => Ok(__FieldTag::__project_id),
2598                            "indexId" => Ok(__FieldTag::__index_id),
2599                            "index_id" => Ok(__FieldTag::__index_id),
2600                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2601                        }
2602                    }
2603                }
2604                deserializer.deserialize_identifier(Visitor)
2605            }
2606        }
2607        struct Visitor;
2608        impl<'de> serde::de::Visitor<'de> for Visitor {
2609            type Value = GetIndexRequest;
2610            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2611                formatter.write_str("struct GetIndexRequest")
2612            }
2613            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2614            where
2615                A: serde::de::MapAccess<'de>,
2616            {
2617                #[allow(unused_imports)]
2618                use serde::de::Error;
2619                use std::option::Option::Some;
2620                let mut fields = std::collections::HashSet::new();
2621                let mut result = Self::Value::new();
2622                while let Some(tag) = map.next_key::<__FieldTag>()? {
2623                    #[allow(clippy::match_single_binding)]
2624                    match tag {
2625                        __FieldTag::__project_id => {
2626                            if !fields.insert(__FieldTag::__project_id) {
2627                                return std::result::Result::Err(A::Error::duplicate_field(
2628                                    "multiple values for project_id",
2629                                ));
2630                            }
2631                            result.project_id = map
2632                                .next_value::<std::option::Option<std::string::String>>()?
2633                                .unwrap_or_default();
2634                        }
2635                        __FieldTag::__index_id => {
2636                            if !fields.insert(__FieldTag::__index_id) {
2637                                return std::result::Result::Err(A::Error::duplicate_field(
2638                                    "multiple values for index_id",
2639                                ));
2640                            }
2641                            result.index_id = map
2642                                .next_value::<std::option::Option<std::string::String>>()?
2643                                .unwrap_or_default();
2644                        }
2645                        __FieldTag::Unknown(key) => {
2646                            let value = map.next_value::<serde_json::Value>()?;
2647                            result._unknown_fields.insert(key, value);
2648                        }
2649                    }
2650                }
2651                std::result::Result::Ok(result)
2652            }
2653        }
2654        deserializer.deserialize_any(Visitor)
2655    }
2656}
2657
2658#[doc(hidden)]
2659impl serde::ser::Serialize for GetIndexRequest {
2660    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2661    where
2662        S: serde::ser::Serializer,
2663    {
2664        use serde::ser::SerializeMap;
2665        #[allow(unused_imports)]
2666        use std::option::Option::Some;
2667        let mut state = serializer.serialize_map(std::option::Option::None)?;
2668        if !self.project_id.is_empty() {
2669            state.serialize_entry("projectId", &self.project_id)?;
2670        }
2671        if !self.index_id.is_empty() {
2672            state.serialize_entry("indexId", &self.index_id)?;
2673        }
2674        if !self._unknown_fields.is_empty() {
2675            for (key, value) in self._unknown_fields.iter() {
2676                state.serialize_entry(key, &value)?;
2677            }
2678        }
2679        state.end()
2680    }
2681}
2682
2683impl std::fmt::Debug for GetIndexRequest {
2684    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2685        let mut debug_struct = f.debug_struct("GetIndexRequest");
2686        debug_struct.field("project_id", &self.project_id);
2687        debug_struct.field("index_id", &self.index_id);
2688        if !self._unknown_fields.is_empty() {
2689            debug_struct.field("_unknown_fields", &self._unknown_fields);
2690        }
2691        debug_struct.finish()
2692    }
2693}
2694
2695/// The request for
2696/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
2697///
2698/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
2699#[derive(Clone, Default, PartialEq)]
2700#[non_exhaustive]
2701pub struct ListIndexesRequest {
2702    /// Project ID against which to make the request.
2703    pub project_id: std::string::String,
2704
2705    pub filter: std::string::String,
2706
2707    /// The maximum number of items to return.  If zero, then all results will be
2708    /// returned.
2709    pub page_size: i32,
2710
2711    /// The next_page_token value returned from a previous List request, if any.
2712    pub page_token: std::string::String,
2713
2714    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2715}
2716
2717impl ListIndexesRequest {
2718    pub fn new() -> Self {
2719        std::default::Default::default()
2720    }
2721
2722    /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
2723    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2724        self.project_id = v.into();
2725        self
2726    }
2727
2728    /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
2729    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2730        self.filter = v.into();
2731        self
2732    }
2733
2734    /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
2735    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2736        self.page_size = v.into();
2737        self
2738    }
2739
2740    /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
2741    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2742        self.page_token = v.into();
2743        self
2744    }
2745}
2746
2747impl wkt::message::Message for ListIndexesRequest {
2748    fn typename() -> &'static str {
2749        "type.googleapis.com/google.datastore.admin.v1.ListIndexesRequest"
2750    }
2751}
2752
2753#[doc(hidden)]
2754impl<'de> serde::de::Deserialize<'de> for ListIndexesRequest {
2755    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2756    where
2757        D: serde::Deserializer<'de>,
2758    {
2759        #[allow(non_camel_case_types)]
2760        #[doc(hidden)]
2761        #[derive(PartialEq, Eq, Hash)]
2762        enum __FieldTag {
2763            __project_id,
2764            __filter,
2765            __page_size,
2766            __page_token,
2767            Unknown(std::string::String),
2768        }
2769        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2770            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2771            where
2772                D: serde::Deserializer<'de>,
2773            {
2774                struct Visitor;
2775                impl<'de> serde::de::Visitor<'de> for Visitor {
2776                    type Value = __FieldTag;
2777                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2778                        formatter.write_str("a field name for ListIndexesRequest")
2779                    }
2780                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2781                    where
2782                        E: serde::de::Error,
2783                    {
2784                        use std::result::Result::Ok;
2785                        use std::string::ToString;
2786                        match value {
2787                            "projectId" => Ok(__FieldTag::__project_id),
2788                            "project_id" => Ok(__FieldTag::__project_id),
2789                            "filter" => Ok(__FieldTag::__filter),
2790                            "pageSize" => Ok(__FieldTag::__page_size),
2791                            "page_size" => Ok(__FieldTag::__page_size),
2792                            "pageToken" => Ok(__FieldTag::__page_token),
2793                            "page_token" => Ok(__FieldTag::__page_token),
2794                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2795                        }
2796                    }
2797                }
2798                deserializer.deserialize_identifier(Visitor)
2799            }
2800        }
2801        struct Visitor;
2802        impl<'de> serde::de::Visitor<'de> for Visitor {
2803            type Value = ListIndexesRequest;
2804            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2805                formatter.write_str("struct ListIndexesRequest")
2806            }
2807            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2808            where
2809                A: serde::de::MapAccess<'de>,
2810            {
2811                #[allow(unused_imports)]
2812                use serde::de::Error;
2813                use std::option::Option::Some;
2814                let mut fields = std::collections::HashSet::new();
2815                let mut result = Self::Value::new();
2816                while let Some(tag) = map.next_key::<__FieldTag>()? {
2817                    #[allow(clippy::match_single_binding)]
2818                    match tag {
2819                        __FieldTag::__project_id => {
2820                            if !fields.insert(__FieldTag::__project_id) {
2821                                return std::result::Result::Err(A::Error::duplicate_field(
2822                                    "multiple values for project_id",
2823                                ));
2824                            }
2825                            result.project_id = map
2826                                .next_value::<std::option::Option<std::string::String>>()?
2827                                .unwrap_or_default();
2828                        }
2829                        __FieldTag::__filter => {
2830                            if !fields.insert(__FieldTag::__filter) {
2831                                return std::result::Result::Err(A::Error::duplicate_field(
2832                                    "multiple values for filter",
2833                                ));
2834                            }
2835                            result.filter = map
2836                                .next_value::<std::option::Option<std::string::String>>()?
2837                                .unwrap_or_default();
2838                        }
2839                        __FieldTag::__page_size => {
2840                            if !fields.insert(__FieldTag::__page_size) {
2841                                return std::result::Result::Err(A::Error::duplicate_field(
2842                                    "multiple values for page_size",
2843                                ));
2844                            }
2845                            struct __With(std::option::Option<i32>);
2846                            impl<'de> serde::de::Deserialize<'de> for __With {
2847                                fn deserialize<D>(
2848                                    deserializer: D,
2849                                ) -> std::result::Result<Self, D::Error>
2850                                where
2851                                    D: serde::de::Deserializer<'de>,
2852                                {
2853                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2854                                }
2855                            }
2856                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2857                        }
2858                        __FieldTag::__page_token => {
2859                            if !fields.insert(__FieldTag::__page_token) {
2860                                return std::result::Result::Err(A::Error::duplicate_field(
2861                                    "multiple values for page_token",
2862                                ));
2863                            }
2864                            result.page_token = map
2865                                .next_value::<std::option::Option<std::string::String>>()?
2866                                .unwrap_or_default();
2867                        }
2868                        __FieldTag::Unknown(key) => {
2869                            let value = map.next_value::<serde_json::Value>()?;
2870                            result._unknown_fields.insert(key, value);
2871                        }
2872                    }
2873                }
2874                std::result::Result::Ok(result)
2875            }
2876        }
2877        deserializer.deserialize_any(Visitor)
2878    }
2879}
2880
2881#[doc(hidden)]
2882impl serde::ser::Serialize for ListIndexesRequest {
2883    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2884    where
2885        S: serde::ser::Serializer,
2886    {
2887        use serde::ser::SerializeMap;
2888        #[allow(unused_imports)]
2889        use std::option::Option::Some;
2890        let mut state = serializer.serialize_map(std::option::Option::None)?;
2891        if !self.project_id.is_empty() {
2892            state.serialize_entry("projectId", &self.project_id)?;
2893        }
2894        if !self.filter.is_empty() {
2895            state.serialize_entry("filter", &self.filter)?;
2896        }
2897        if !wkt::internal::is_default(&self.page_size) {
2898            struct __With<'a>(&'a i32);
2899            impl<'a> serde::ser::Serialize for __With<'a> {
2900                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2901                where
2902                    S: serde::ser::Serializer,
2903                {
2904                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2905                }
2906            }
2907            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2908        }
2909        if !self.page_token.is_empty() {
2910            state.serialize_entry("pageToken", &self.page_token)?;
2911        }
2912        if !self._unknown_fields.is_empty() {
2913            for (key, value) in self._unknown_fields.iter() {
2914                state.serialize_entry(key, &value)?;
2915            }
2916        }
2917        state.end()
2918    }
2919}
2920
2921impl std::fmt::Debug for ListIndexesRequest {
2922    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2923        let mut debug_struct = f.debug_struct("ListIndexesRequest");
2924        debug_struct.field("project_id", &self.project_id);
2925        debug_struct.field("filter", &self.filter);
2926        debug_struct.field("page_size", &self.page_size);
2927        debug_struct.field("page_token", &self.page_token);
2928        if !self._unknown_fields.is_empty() {
2929            debug_struct.field("_unknown_fields", &self._unknown_fields);
2930        }
2931        debug_struct.finish()
2932    }
2933}
2934
2935/// The response for
2936/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
2937///
2938/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
2939#[derive(Clone, Default, PartialEq)]
2940#[non_exhaustive]
2941pub struct ListIndexesResponse {
2942    /// The indexes.
2943    pub indexes: std::vec::Vec<crate::model::Index>,
2944
2945    /// The standard List next-page token.
2946    pub next_page_token: std::string::String,
2947
2948    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2949}
2950
2951impl ListIndexesResponse {
2952    pub fn new() -> Self {
2953        std::default::Default::default()
2954    }
2955
2956    /// Sets the value of [indexes][crate::model::ListIndexesResponse::indexes].
2957    pub fn set_indexes<T, V>(mut self, v: T) -> Self
2958    where
2959        T: std::iter::IntoIterator<Item = V>,
2960        V: std::convert::Into<crate::model::Index>,
2961    {
2962        use std::iter::Iterator;
2963        self.indexes = v.into_iter().map(|i| i.into()).collect();
2964        self
2965    }
2966
2967    /// Sets the value of [next_page_token][crate::model::ListIndexesResponse::next_page_token].
2968    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2969        self.next_page_token = v.into();
2970        self
2971    }
2972}
2973
2974impl wkt::message::Message for ListIndexesResponse {
2975    fn typename() -> &'static str {
2976        "type.googleapis.com/google.datastore.admin.v1.ListIndexesResponse"
2977    }
2978}
2979
2980#[doc(hidden)]
2981impl gax::paginator::internal::PageableResponse for ListIndexesResponse {
2982    type PageItem = crate::model::Index;
2983
2984    fn items(self) -> std::vec::Vec<Self::PageItem> {
2985        self.indexes
2986    }
2987
2988    fn next_page_token(&self) -> std::string::String {
2989        use std::clone::Clone;
2990        self.next_page_token.clone()
2991    }
2992}
2993
2994#[doc(hidden)]
2995impl<'de> serde::de::Deserialize<'de> for ListIndexesResponse {
2996    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2997    where
2998        D: serde::Deserializer<'de>,
2999    {
3000        #[allow(non_camel_case_types)]
3001        #[doc(hidden)]
3002        #[derive(PartialEq, Eq, Hash)]
3003        enum __FieldTag {
3004            __indexes,
3005            __next_page_token,
3006            Unknown(std::string::String),
3007        }
3008        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3009            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3010            where
3011                D: serde::Deserializer<'de>,
3012            {
3013                struct Visitor;
3014                impl<'de> serde::de::Visitor<'de> for Visitor {
3015                    type Value = __FieldTag;
3016                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3017                        formatter.write_str("a field name for ListIndexesResponse")
3018                    }
3019                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3020                    where
3021                        E: serde::de::Error,
3022                    {
3023                        use std::result::Result::Ok;
3024                        use std::string::ToString;
3025                        match value {
3026                            "indexes" => Ok(__FieldTag::__indexes),
3027                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3028                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3029                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3030                        }
3031                    }
3032                }
3033                deserializer.deserialize_identifier(Visitor)
3034            }
3035        }
3036        struct Visitor;
3037        impl<'de> serde::de::Visitor<'de> for Visitor {
3038            type Value = ListIndexesResponse;
3039            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3040                formatter.write_str("struct ListIndexesResponse")
3041            }
3042            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3043            where
3044                A: serde::de::MapAccess<'de>,
3045            {
3046                #[allow(unused_imports)]
3047                use serde::de::Error;
3048                use std::option::Option::Some;
3049                let mut fields = std::collections::HashSet::new();
3050                let mut result = Self::Value::new();
3051                while let Some(tag) = map.next_key::<__FieldTag>()? {
3052                    #[allow(clippy::match_single_binding)]
3053                    match tag {
3054                        __FieldTag::__indexes => {
3055                            if !fields.insert(__FieldTag::__indexes) {
3056                                return std::result::Result::Err(A::Error::duplicate_field(
3057                                    "multiple values for indexes",
3058                                ));
3059                            }
3060                            result.indexes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Index>>>()?.unwrap_or_default();
3061                        }
3062                        __FieldTag::__next_page_token => {
3063                            if !fields.insert(__FieldTag::__next_page_token) {
3064                                return std::result::Result::Err(A::Error::duplicate_field(
3065                                    "multiple values for next_page_token",
3066                                ));
3067                            }
3068                            result.next_page_token = map
3069                                .next_value::<std::option::Option<std::string::String>>()?
3070                                .unwrap_or_default();
3071                        }
3072                        __FieldTag::Unknown(key) => {
3073                            let value = map.next_value::<serde_json::Value>()?;
3074                            result._unknown_fields.insert(key, value);
3075                        }
3076                    }
3077                }
3078                std::result::Result::Ok(result)
3079            }
3080        }
3081        deserializer.deserialize_any(Visitor)
3082    }
3083}
3084
3085#[doc(hidden)]
3086impl serde::ser::Serialize for ListIndexesResponse {
3087    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3088    where
3089        S: serde::ser::Serializer,
3090    {
3091        use serde::ser::SerializeMap;
3092        #[allow(unused_imports)]
3093        use std::option::Option::Some;
3094        let mut state = serializer.serialize_map(std::option::Option::None)?;
3095        if !self.indexes.is_empty() {
3096            state.serialize_entry("indexes", &self.indexes)?;
3097        }
3098        if !self.next_page_token.is_empty() {
3099            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3100        }
3101        if !self._unknown_fields.is_empty() {
3102            for (key, value) in self._unknown_fields.iter() {
3103                state.serialize_entry(key, &value)?;
3104            }
3105        }
3106        state.end()
3107    }
3108}
3109
3110impl std::fmt::Debug for ListIndexesResponse {
3111    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3112        let mut debug_struct = f.debug_struct("ListIndexesResponse");
3113        debug_struct.field("indexes", &self.indexes);
3114        debug_struct.field("next_page_token", &self.next_page_token);
3115        if !self._unknown_fields.is_empty() {
3116            debug_struct.field("_unknown_fields", &self._unknown_fields);
3117        }
3118        debug_struct.finish()
3119    }
3120}
3121
3122/// Metadata for Index operations.
3123#[derive(Clone, Default, PartialEq)]
3124#[non_exhaustive]
3125pub struct IndexOperationMetadata {
3126    /// Metadata common to all Datastore Admin operations.
3127    pub common: std::option::Option<crate::model::CommonMetadata>,
3128
3129    /// An estimate of the number of entities processed.
3130    pub progress_entities: std::option::Option<crate::model::Progress>,
3131
3132    /// The index resource ID that this operation is acting on.
3133    pub index_id: std::string::String,
3134
3135    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3136}
3137
3138impl IndexOperationMetadata {
3139    pub fn new() -> Self {
3140        std::default::Default::default()
3141    }
3142
3143    /// Sets the value of [common][crate::model::IndexOperationMetadata::common].
3144    pub fn set_common<T>(mut self, v: T) -> Self
3145    where
3146        T: std::convert::Into<crate::model::CommonMetadata>,
3147    {
3148        self.common = std::option::Option::Some(v.into());
3149        self
3150    }
3151
3152    /// Sets or clears the value of [common][crate::model::IndexOperationMetadata::common].
3153    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
3154    where
3155        T: std::convert::Into<crate::model::CommonMetadata>,
3156    {
3157        self.common = v.map(|x| x.into());
3158        self
3159    }
3160
3161    /// Sets the value of [progress_entities][crate::model::IndexOperationMetadata::progress_entities].
3162    pub fn set_progress_entities<T>(mut self, v: T) -> Self
3163    where
3164        T: std::convert::Into<crate::model::Progress>,
3165    {
3166        self.progress_entities = std::option::Option::Some(v.into());
3167        self
3168    }
3169
3170    /// Sets or clears the value of [progress_entities][crate::model::IndexOperationMetadata::progress_entities].
3171    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
3172    where
3173        T: std::convert::Into<crate::model::Progress>,
3174    {
3175        self.progress_entities = v.map(|x| x.into());
3176        self
3177    }
3178
3179    /// Sets the value of [index_id][crate::model::IndexOperationMetadata::index_id].
3180    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3181        self.index_id = v.into();
3182        self
3183    }
3184}
3185
3186impl wkt::message::Message for IndexOperationMetadata {
3187    fn typename() -> &'static str {
3188        "type.googleapis.com/google.datastore.admin.v1.IndexOperationMetadata"
3189    }
3190}
3191
3192#[doc(hidden)]
3193impl<'de> serde::de::Deserialize<'de> for IndexOperationMetadata {
3194    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3195    where
3196        D: serde::Deserializer<'de>,
3197    {
3198        #[allow(non_camel_case_types)]
3199        #[doc(hidden)]
3200        #[derive(PartialEq, Eq, Hash)]
3201        enum __FieldTag {
3202            __common,
3203            __progress_entities,
3204            __index_id,
3205            Unknown(std::string::String),
3206        }
3207        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3208            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3209            where
3210                D: serde::Deserializer<'de>,
3211            {
3212                struct Visitor;
3213                impl<'de> serde::de::Visitor<'de> for Visitor {
3214                    type Value = __FieldTag;
3215                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3216                        formatter.write_str("a field name for IndexOperationMetadata")
3217                    }
3218                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3219                    where
3220                        E: serde::de::Error,
3221                    {
3222                        use std::result::Result::Ok;
3223                        use std::string::ToString;
3224                        match value {
3225                            "common" => Ok(__FieldTag::__common),
3226                            "progressEntities" => Ok(__FieldTag::__progress_entities),
3227                            "progress_entities" => Ok(__FieldTag::__progress_entities),
3228                            "indexId" => Ok(__FieldTag::__index_id),
3229                            "index_id" => Ok(__FieldTag::__index_id),
3230                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3231                        }
3232                    }
3233                }
3234                deserializer.deserialize_identifier(Visitor)
3235            }
3236        }
3237        struct Visitor;
3238        impl<'de> serde::de::Visitor<'de> for Visitor {
3239            type Value = IndexOperationMetadata;
3240            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3241                formatter.write_str("struct IndexOperationMetadata")
3242            }
3243            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3244            where
3245                A: serde::de::MapAccess<'de>,
3246            {
3247                #[allow(unused_imports)]
3248                use serde::de::Error;
3249                use std::option::Option::Some;
3250                let mut fields = std::collections::HashSet::new();
3251                let mut result = Self::Value::new();
3252                while let Some(tag) = map.next_key::<__FieldTag>()? {
3253                    #[allow(clippy::match_single_binding)]
3254                    match tag {
3255                        __FieldTag::__common => {
3256                            if !fields.insert(__FieldTag::__common) {
3257                                return std::result::Result::Err(A::Error::duplicate_field(
3258                                    "multiple values for common",
3259                                ));
3260                            }
3261                            result.common = map
3262                                .next_value::<std::option::Option<crate::model::CommonMetadata>>(
3263                                )?;
3264                        }
3265                        __FieldTag::__progress_entities => {
3266                            if !fields.insert(__FieldTag::__progress_entities) {
3267                                return std::result::Result::Err(A::Error::duplicate_field(
3268                                    "multiple values for progress_entities",
3269                                ));
3270                            }
3271                            result.progress_entities =
3272                                map.next_value::<std::option::Option<crate::model::Progress>>()?;
3273                        }
3274                        __FieldTag::__index_id => {
3275                            if !fields.insert(__FieldTag::__index_id) {
3276                                return std::result::Result::Err(A::Error::duplicate_field(
3277                                    "multiple values for index_id",
3278                                ));
3279                            }
3280                            result.index_id = map
3281                                .next_value::<std::option::Option<std::string::String>>()?
3282                                .unwrap_or_default();
3283                        }
3284                        __FieldTag::Unknown(key) => {
3285                            let value = map.next_value::<serde_json::Value>()?;
3286                            result._unknown_fields.insert(key, value);
3287                        }
3288                    }
3289                }
3290                std::result::Result::Ok(result)
3291            }
3292        }
3293        deserializer.deserialize_any(Visitor)
3294    }
3295}
3296
3297#[doc(hidden)]
3298impl serde::ser::Serialize for IndexOperationMetadata {
3299    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3300    where
3301        S: serde::ser::Serializer,
3302    {
3303        use serde::ser::SerializeMap;
3304        #[allow(unused_imports)]
3305        use std::option::Option::Some;
3306        let mut state = serializer.serialize_map(std::option::Option::None)?;
3307        if self.common.is_some() {
3308            state.serialize_entry("common", &self.common)?;
3309        }
3310        if self.progress_entities.is_some() {
3311            state.serialize_entry("progressEntities", &self.progress_entities)?;
3312        }
3313        if !self.index_id.is_empty() {
3314            state.serialize_entry("indexId", &self.index_id)?;
3315        }
3316        if !self._unknown_fields.is_empty() {
3317            for (key, value) in self._unknown_fields.iter() {
3318                state.serialize_entry(key, &value)?;
3319            }
3320        }
3321        state.end()
3322    }
3323}
3324
3325impl std::fmt::Debug for IndexOperationMetadata {
3326    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3327        let mut debug_struct = f.debug_struct("IndexOperationMetadata");
3328        debug_struct.field("common", &self.common);
3329        debug_struct.field("progress_entities", &self.progress_entities);
3330        debug_struct.field("index_id", &self.index_id);
3331        if !self._unknown_fields.is_empty() {
3332            debug_struct.field("_unknown_fields", &self._unknown_fields);
3333        }
3334        debug_struct.finish()
3335    }
3336}
3337
3338/// Metadata for Datastore to Firestore migration operations.
3339///
3340/// The DatastoreFirestoreMigration operation is not started by the end-user via
3341/// an explicit "creation" method. This is an intentional deviation from the LRO
3342/// design pattern.
3343///
3344/// This singleton resource can be accessed at:
3345/// "projects/{project_id}/operations/datastore-firestore-migration"
3346#[derive(Clone, Default, PartialEq)]
3347#[non_exhaustive]
3348pub struct DatastoreFirestoreMigrationMetadata {
3349    /// The current state of migration from Cloud Datastore to Cloud Firestore in
3350    /// Datastore mode.
3351    pub migration_state: crate::model::MigrationState,
3352
3353    /// The current step of migration from Cloud Datastore to Cloud Firestore in
3354    /// Datastore mode.
3355    pub migration_step: crate::model::MigrationStep,
3356
3357    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3358}
3359
3360impl DatastoreFirestoreMigrationMetadata {
3361    pub fn new() -> Self {
3362        std::default::Default::default()
3363    }
3364
3365    /// Sets the value of [migration_state][crate::model::DatastoreFirestoreMigrationMetadata::migration_state].
3366    pub fn set_migration_state<T: std::convert::Into<crate::model::MigrationState>>(
3367        mut self,
3368        v: T,
3369    ) -> Self {
3370        self.migration_state = v.into();
3371        self
3372    }
3373
3374    /// Sets the value of [migration_step][crate::model::DatastoreFirestoreMigrationMetadata::migration_step].
3375    pub fn set_migration_step<T: std::convert::Into<crate::model::MigrationStep>>(
3376        mut self,
3377        v: T,
3378    ) -> Self {
3379        self.migration_step = v.into();
3380        self
3381    }
3382}
3383
3384impl wkt::message::Message for DatastoreFirestoreMigrationMetadata {
3385    fn typename() -> &'static str {
3386        "type.googleapis.com/google.datastore.admin.v1.DatastoreFirestoreMigrationMetadata"
3387    }
3388}
3389
3390#[doc(hidden)]
3391impl<'de> serde::de::Deserialize<'de> for DatastoreFirestoreMigrationMetadata {
3392    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3393    where
3394        D: serde::Deserializer<'de>,
3395    {
3396        #[allow(non_camel_case_types)]
3397        #[doc(hidden)]
3398        #[derive(PartialEq, Eq, Hash)]
3399        enum __FieldTag {
3400            __migration_state,
3401            __migration_step,
3402            Unknown(std::string::String),
3403        }
3404        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3405            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3406            where
3407                D: serde::Deserializer<'de>,
3408            {
3409                struct Visitor;
3410                impl<'de> serde::de::Visitor<'de> for Visitor {
3411                    type Value = __FieldTag;
3412                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3413                        formatter.write_str("a field name for DatastoreFirestoreMigrationMetadata")
3414                    }
3415                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3416                    where
3417                        E: serde::de::Error,
3418                    {
3419                        use std::result::Result::Ok;
3420                        use std::string::ToString;
3421                        match value {
3422                            "migrationState" => Ok(__FieldTag::__migration_state),
3423                            "migration_state" => Ok(__FieldTag::__migration_state),
3424                            "migrationStep" => Ok(__FieldTag::__migration_step),
3425                            "migration_step" => Ok(__FieldTag::__migration_step),
3426                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3427                        }
3428                    }
3429                }
3430                deserializer.deserialize_identifier(Visitor)
3431            }
3432        }
3433        struct Visitor;
3434        impl<'de> serde::de::Visitor<'de> for Visitor {
3435            type Value = DatastoreFirestoreMigrationMetadata;
3436            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3437                formatter.write_str("struct DatastoreFirestoreMigrationMetadata")
3438            }
3439            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3440            where
3441                A: serde::de::MapAccess<'de>,
3442            {
3443                #[allow(unused_imports)]
3444                use serde::de::Error;
3445                use std::option::Option::Some;
3446                let mut fields = std::collections::HashSet::new();
3447                let mut result = Self::Value::new();
3448                while let Some(tag) = map.next_key::<__FieldTag>()? {
3449                    #[allow(clippy::match_single_binding)]
3450                    match tag {
3451                        __FieldTag::__migration_state => {
3452                            if !fields.insert(__FieldTag::__migration_state) {
3453                                return std::result::Result::Err(A::Error::duplicate_field(
3454                                    "multiple values for migration_state",
3455                                ));
3456                            }
3457                            result.migration_state = map
3458                                .next_value::<std::option::Option<crate::model::MigrationState>>()?
3459                                .unwrap_or_default();
3460                        }
3461                        __FieldTag::__migration_step => {
3462                            if !fields.insert(__FieldTag::__migration_step) {
3463                                return std::result::Result::Err(A::Error::duplicate_field(
3464                                    "multiple values for migration_step",
3465                                ));
3466                            }
3467                            result.migration_step = map
3468                                .next_value::<std::option::Option<crate::model::MigrationStep>>()?
3469                                .unwrap_or_default();
3470                        }
3471                        __FieldTag::Unknown(key) => {
3472                            let value = map.next_value::<serde_json::Value>()?;
3473                            result._unknown_fields.insert(key, value);
3474                        }
3475                    }
3476                }
3477                std::result::Result::Ok(result)
3478            }
3479        }
3480        deserializer.deserialize_any(Visitor)
3481    }
3482}
3483
3484#[doc(hidden)]
3485impl serde::ser::Serialize for DatastoreFirestoreMigrationMetadata {
3486    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3487    where
3488        S: serde::ser::Serializer,
3489    {
3490        use serde::ser::SerializeMap;
3491        #[allow(unused_imports)]
3492        use std::option::Option::Some;
3493        let mut state = serializer.serialize_map(std::option::Option::None)?;
3494        if !wkt::internal::is_default(&self.migration_state) {
3495            state.serialize_entry("migrationState", &self.migration_state)?;
3496        }
3497        if !wkt::internal::is_default(&self.migration_step) {
3498            state.serialize_entry("migrationStep", &self.migration_step)?;
3499        }
3500        if !self._unknown_fields.is_empty() {
3501            for (key, value) in self._unknown_fields.iter() {
3502                state.serialize_entry(key, &value)?;
3503            }
3504        }
3505        state.end()
3506    }
3507}
3508
3509impl std::fmt::Debug for DatastoreFirestoreMigrationMetadata {
3510    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3511        let mut debug_struct = f.debug_struct("DatastoreFirestoreMigrationMetadata");
3512        debug_struct.field("migration_state", &self.migration_state);
3513        debug_struct.field("migration_step", &self.migration_step);
3514        if !self._unknown_fields.is_empty() {
3515            debug_struct.field("_unknown_fields", &self._unknown_fields);
3516        }
3517        debug_struct.finish()
3518    }
3519}
3520
3521/// Datastore composite index definition.
3522#[derive(Clone, Default, PartialEq)]
3523#[non_exhaustive]
3524pub struct Index {
3525    /// Output only. Project ID.
3526    pub project_id: std::string::String,
3527
3528    /// Output only. The resource ID of the index.
3529    pub index_id: std::string::String,
3530
3531    /// Required. The entity kind to which this index applies.
3532    pub kind: std::string::String,
3533
3534    /// Required. The index's ancestor mode.  Must not be
3535    /// ANCESTOR_MODE_UNSPECIFIED.
3536    pub ancestor: crate::model::index::AncestorMode,
3537
3538    /// Required. An ordered sequence of property names and their index attributes.
3539    ///
3540    /// Requires:
3541    ///
3542    /// * A maximum of 100 properties.
3543    pub properties: std::vec::Vec<crate::model::index::IndexedProperty>,
3544
3545    /// Output only. The state of the index.
3546    pub state: crate::model::index::State,
3547
3548    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3549}
3550
3551impl Index {
3552    pub fn new() -> Self {
3553        std::default::Default::default()
3554    }
3555
3556    /// Sets the value of [project_id][crate::model::Index::project_id].
3557    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3558        self.project_id = v.into();
3559        self
3560    }
3561
3562    /// Sets the value of [index_id][crate::model::Index::index_id].
3563    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3564        self.index_id = v.into();
3565        self
3566    }
3567
3568    /// Sets the value of [kind][crate::model::Index::kind].
3569    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3570        self.kind = v.into();
3571        self
3572    }
3573
3574    /// Sets the value of [ancestor][crate::model::Index::ancestor].
3575    pub fn set_ancestor<T: std::convert::Into<crate::model::index::AncestorMode>>(
3576        mut self,
3577        v: T,
3578    ) -> Self {
3579        self.ancestor = v.into();
3580        self
3581    }
3582
3583    /// Sets the value of [properties][crate::model::Index::properties].
3584    pub fn set_properties<T, V>(mut self, v: T) -> Self
3585    where
3586        T: std::iter::IntoIterator<Item = V>,
3587        V: std::convert::Into<crate::model::index::IndexedProperty>,
3588    {
3589        use std::iter::Iterator;
3590        self.properties = v.into_iter().map(|i| i.into()).collect();
3591        self
3592    }
3593
3594    /// Sets the value of [state][crate::model::Index::state].
3595    pub fn set_state<T: std::convert::Into<crate::model::index::State>>(mut self, v: T) -> Self {
3596        self.state = v.into();
3597        self
3598    }
3599}
3600
3601impl wkt::message::Message for Index {
3602    fn typename() -> &'static str {
3603        "type.googleapis.com/google.datastore.admin.v1.Index"
3604    }
3605}
3606
3607#[doc(hidden)]
3608impl<'de> serde::de::Deserialize<'de> for Index {
3609    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3610    where
3611        D: serde::Deserializer<'de>,
3612    {
3613        #[allow(non_camel_case_types)]
3614        #[doc(hidden)]
3615        #[derive(PartialEq, Eq, Hash)]
3616        enum __FieldTag {
3617            __project_id,
3618            __index_id,
3619            __kind,
3620            __ancestor,
3621            __properties,
3622            __state,
3623            Unknown(std::string::String),
3624        }
3625        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3626            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3627            where
3628                D: serde::Deserializer<'de>,
3629            {
3630                struct Visitor;
3631                impl<'de> serde::de::Visitor<'de> for Visitor {
3632                    type Value = __FieldTag;
3633                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3634                        formatter.write_str("a field name for Index")
3635                    }
3636                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3637                    where
3638                        E: serde::de::Error,
3639                    {
3640                        use std::result::Result::Ok;
3641                        use std::string::ToString;
3642                        match value {
3643                            "projectId" => Ok(__FieldTag::__project_id),
3644                            "project_id" => Ok(__FieldTag::__project_id),
3645                            "indexId" => Ok(__FieldTag::__index_id),
3646                            "index_id" => Ok(__FieldTag::__index_id),
3647                            "kind" => Ok(__FieldTag::__kind),
3648                            "ancestor" => Ok(__FieldTag::__ancestor),
3649                            "properties" => Ok(__FieldTag::__properties),
3650                            "state" => Ok(__FieldTag::__state),
3651                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3652                        }
3653                    }
3654                }
3655                deserializer.deserialize_identifier(Visitor)
3656            }
3657        }
3658        struct Visitor;
3659        impl<'de> serde::de::Visitor<'de> for Visitor {
3660            type Value = Index;
3661            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3662                formatter.write_str("struct Index")
3663            }
3664            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3665            where
3666                A: serde::de::MapAccess<'de>,
3667            {
3668                #[allow(unused_imports)]
3669                use serde::de::Error;
3670                use std::option::Option::Some;
3671                let mut fields = std::collections::HashSet::new();
3672                let mut result = Self::Value::new();
3673                while let Some(tag) = map.next_key::<__FieldTag>()? {
3674                    #[allow(clippy::match_single_binding)]
3675                    match tag {
3676                        __FieldTag::__project_id => {
3677                            if !fields.insert(__FieldTag::__project_id) {
3678                                return std::result::Result::Err(A::Error::duplicate_field(
3679                                    "multiple values for project_id",
3680                                ));
3681                            }
3682                            result.project_id = map
3683                                .next_value::<std::option::Option<std::string::String>>()?
3684                                .unwrap_or_default();
3685                        }
3686                        __FieldTag::__index_id => {
3687                            if !fields.insert(__FieldTag::__index_id) {
3688                                return std::result::Result::Err(A::Error::duplicate_field(
3689                                    "multiple values for index_id",
3690                                ));
3691                            }
3692                            result.index_id = map
3693                                .next_value::<std::option::Option<std::string::String>>()?
3694                                .unwrap_or_default();
3695                        }
3696                        __FieldTag::__kind => {
3697                            if !fields.insert(__FieldTag::__kind) {
3698                                return std::result::Result::Err(A::Error::duplicate_field(
3699                                    "multiple values for kind",
3700                                ));
3701                            }
3702                            result.kind = map
3703                                .next_value::<std::option::Option<std::string::String>>()?
3704                                .unwrap_or_default();
3705                        }
3706                        __FieldTag::__ancestor => {
3707                            if !fields.insert(__FieldTag::__ancestor) {
3708                                return std::result::Result::Err(A::Error::duplicate_field(
3709                                    "multiple values for ancestor",
3710                                ));
3711                            }
3712                            result.ancestor = map.next_value::<std::option::Option<crate::model::index::AncestorMode>>()?.unwrap_or_default();
3713                        }
3714                        __FieldTag::__properties => {
3715                            if !fields.insert(__FieldTag::__properties) {
3716                                return std::result::Result::Err(A::Error::duplicate_field(
3717                                    "multiple values for properties",
3718                                ));
3719                            }
3720                            result.properties = map
3721                                .next_value::<std::option::Option<
3722                                    std::vec::Vec<crate::model::index::IndexedProperty>,
3723                                >>()?
3724                                .unwrap_or_default();
3725                        }
3726                        __FieldTag::__state => {
3727                            if !fields.insert(__FieldTag::__state) {
3728                                return std::result::Result::Err(A::Error::duplicate_field(
3729                                    "multiple values for state",
3730                                ));
3731                            }
3732                            result.state = map
3733                                .next_value::<std::option::Option<crate::model::index::State>>()?
3734                                .unwrap_or_default();
3735                        }
3736                        __FieldTag::Unknown(key) => {
3737                            let value = map.next_value::<serde_json::Value>()?;
3738                            result._unknown_fields.insert(key, value);
3739                        }
3740                    }
3741                }
3742                std::result::Result::Ok(result)
3743            }
3744        }
3745        deserializer.deserialize_any(Visitor)
3746    }
3747}
3748
3749#[doc(hidden)]
3750impl serde::ser::Serialize for Index {
3751    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3752    where
3753        S: serde::ser::Serializer,
3754    {
3755        use serde::ser::SerializeMap;
3756        #[allow(unused_imports)]
3757        use std::option::Option::Some;
3758        let mut state = serializer.serialize_map(std::option::Option::None)?;
3759        if !self.project_id.is_empty() {
3760            state.serialize_entry("projectId", &self.project_id)?;
3761        }
3762        if !self.index_id.is_empty() {
3763            state.serialize_entry("indexId", &self.index_id)?;
3764        }
3765        if !self.kind.is_empty() {
3766            state.serialize_entry("kind", &self.kind)?;
3767        }
3768        if !wkt::internal::is_default(&self.ancestor) {
3769            state.serialize_entry("ancestor", &self.ancestor)?;
3770        }
3771        if !self.properties.is_empty() {
3772            state.serialize_entry("properties", &self.properties)?;
3773        }
3774        if !wkt::internal::is_default(&self.state) {
3775            state.serialize_entry("state", &self.state)?;
3776        }
3777        if !self._unknown_fields.is_empty() {
3778            for (key, value) in self._unknown_fields.iter() {
3779                state.serialize_entry(key, &value)?;
3780            }
3781        }
3782        state.end()
3783    }
3784}
3785
3786impl std::fmt::Debug for Index {
3787    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3788        let mut debug_struct = f.debug_struct("Index");
3789        debug_struct.field("project_id", &self.project_id);
3790        debug_struct.field("index_id", &self.index_id);
3791        debug_struct.field("kind", &self.kind);
3792        debug_struct.field("ancestor", &self.ancestor);
3793        debug_struct.field("properties", &self.properties);
3794        debug_struct.field("state", &self.state);
3795        if !self._unknown_fields.is_empty() {
3796            debug_struct.field("_unknown_fields", &self._unknown_fields);
3797        }
3798        debug_struct.finish()
3799    }
3800}
3801
3802/// Defines additional types related to [Index].
3803pub mod index {
3804    #[allow(unused_imports)]
3805    use super::*;
3806
3807    /// A property of an index.
3808    #[derive(Clone, Default, PartialEq)]
3809    #[non_exhaustive]
3810    pub struct IndexedProperty {
3811        /// Required. The property name to index.
3812        pub name: std::string::String,
3813
3814        /// Required. The indexed property's direction.  Must not be
3815        /// DIRECTION_UNSPECIFIED.
3816        pub direction: crate::model::index::Direction,
3817
3818        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3819    }
3820
3821    impl IndexedProperty {
3822        pub fn new() -> Self {
3823            std::default::Default::default()
3824        }
3825
3826        /// Sets the value of [name][crate::model::index::IndexedProperty::name].
3827        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3828            self.name = v.into();
3829            self
3830        }
3831
3832        /// Sets the value of [direction][crate::model::index::IndexedProperty::direction].
3833        pub fn set_direction<T: std::convert::Into<crate::model::index::Direction>>(
3834            mut self,
3835            v: T,
3836        ) -> Self {
3837            self.direction = v.into();
3838            self
3839        }
3840    }
3841
3842    impl wkt::message::Message for IndexedProperty {
3843        fn typename() -> &'static str {
3844            "type.googleapis.com/google.datastore.admin.v1.Index.IndexedProperty"
3845        }
3846    }
3847
3848    #[doc(hidden)]
3849    impl<'de> serde::de::Deserialize<'de> for IndexedProperty {
3850        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3851        where
3852            D: serde::Deserializer<'de>,
3853        {
3854            #[allow(non_camel_case_types)]
3855            #[doc(hidden)]
3856            #[derive(PartialEq, Eq, Hash)]
3857            enum __FieldTag {
3858                __name,
3859                __direction,
3860                Unknown(std::string::String),
3861            }
3862            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3863                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3864                where
3865                    D: serde::Deserializer<'de>,
3866                {
3867                    struct Visitor;
3868                    impl<'de> serde::de::Visitor<'de> for Visitor {
3869                        type Value = __FieldTag;
3870                        fn expecting(
3871                            &self,
3872                            formatter: &mut std::fmt::Formatter,
3873                        ) -> std::fmt::Result {
3874                            formatter.write_str("a field name for IndexedProperty")
3875                        }
3876                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3877                        where
3878                            E: serde::de::Error,
3879                        {
3880                            use std::result::Result::Ok;
3881                            use std::string::ToString;
3882                            match value {
3883                                "name" => Ok(__FieldTag::__name),
3884                                "direction" => Ok(__FieldTag::__direction),
3885                                _ => Ok(__FieldTag::Unknown(value.to_string())),
3886                            }
3887                        }
3888                    }
3889                    deserializer.deserialize_identifier(Visitor)
3890                }
3891            }
3892            struct Visitor;
3893            impl<'de> serde::de::Visitor<'de> for Visitor {
3894                type Value = IndexedProperty;
3895                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3896                    formatter.write_str("struct IndexedProperty")
3897                }
3898                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3899                where
3900                    A: serde::de::MapAccess<'de>,
3901                {
3902                    #[allow(unused_imports)]
3903                    use serde::de::Error;
3904                    use std::option::Option::Some;
3905                    let mut fields = std::collections::HashSet::new();
3906                    let mut result = Self::Value::new();
3907                    while let Some(tag) = map.next_key::<__FieldTag>()? {
3908                        #[allow(clippy::match_single_binding)]
3909                        match tag {
3910                            __FieldTag::__name => {
3911                                if !fields.insert(__FieldTag::__name) {
3912                                    return std::result::Result::Err(A::Error::duplicate_field(
3913                                        "multiple values for name",
3914                                    ));
3915                                }
3916                                result.name = map
3917                                    .next_value::<std::option::Option<std::string::String>>()?
3918                                    .unwrap_or_default();
3919                            }
3920                            __FieldTag::__direction => {
3921                                if !fields.insert(__FieldTag::__direction) {
3922                                    return std::result::Result::Err(A::Error::duplicate_field(
3923                                        "multiple values for direction",
3924                                    ));
3925                                }
3926                                result.direction = map.next_value::<std::option::Option<crate::model::index::Direction>>()?.unwrap_or_default();
3927                            }
3928                            __FieldTag::Unknown(key) => {
3929                                let value = map.next_value::<serde_json::Value>()?;
3930                                result._unknown_fields.insert(key, value);
3931                            }
3932                        }
3933                    }
3934                    std::result::Result::Ok(result)
3935                }
3936            }
3937            deserializer.deserialize_any(Visitor)
3938        }
3939    }
3940
3941    #[doc(hidden)]
3942    impl serde::ser::Serialize for IndexedProperty {
3943        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3944        where
3945            S: serde::ser::Serializer,
3946        {
3947            use serde::ser::SerializeMap;
3948            #[allow(unused_imports)]
3949            use std::option::Option::Some;
3950            let mut state = serializer.serialize_map(std::option::Option::None)?;
3951            if !self.name.is_empty() {
3952                state.serialize_entry("name", &self.name)?;
3953            }
3954            if !wkt::internal::is_default(&self.direction) {
3955                state.serialize_entry("direction", &self.direction)?;
3956            }
3957            if !self._unknown_fields.is_empty() {
3958                for (key, value) in self._unknown_fields.iter() {
3959                    state.serialize_entry(key, &value)?;
3960                }
3961            }
3962            state.end()
3963        }
3964    }
3965
3966    impl std::fmt::Debug for IndexedProperty {
3967        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3968            let mut debug_struct = f.debug_struct("IndexedProperty");
3969            debug_struct.field("name", &self.name);
3970            debug_struct.field("direction", &self.direction);
3971            if !self._unknown_fields.is_empty() {
3972                debug_struct.field("_unknown_fields", &self._unknown_fields);
3973            }
3974            debug_struct.finish()
3975        }
3976    }
3977
3978    /// For an ordered index, specifies whether each of the entity's ancestors
3979    /// will be included.
3980    ///
3981    /// # Working with unknown values
3982    ///
3983    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3984    /// additional enum variants at any time. Adding new variants is not considered
3985    /// a breaking change. Applications should write their code in anticipation of:
3986    ///
3987    /// - New values appearing in future releases of the client library, **and**
3988    /// - New values received dynamically, without application changes.
3989    ///
3990    /// Please consult the [Working with enums] section in the user guide for some
3991    /// guidelines.
3992    ///
3993    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3994    #[derive(Clone, Debug, PartialEq)]
3995    #[non_exhaustive]
3996    pub enum AncestorMode {
3997        /// The ancestor mode is unspecified.
3998        Unspecified,
3999        /// Do not include the entity's ancestors in the index.
4000        None,
4001        /// Include all the entity's ancestors in the index.
4002        AllAncestors,
4003        /// If set, the enum was initialized with an unknown value.
4004        ///
4005        /// Applications can examine the value using [AncestorMode::value] or
4006        /// [AncestorMode::name].
4007        UnknownValue(ancestor_mode::UnknownValue),
4008    }
4009
4010    #[doc(hidden)]
4011    pub mod ancestor_mode {
4012        #[allow(unused_imports)]
4013        use super::*;
4014        #[derive(Clone, Debug, PartialEq)]
4015        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4016    }
4017
4018    impl AncestorMode {
4019        /// Gets the enum value.
4020        ///
4021        /// Returns `None` if the enum contains an unknown value deserialized from
4022        /// the string representation of enums.
4023        pub fn value(&self) -> std::option::Option<i32> {
4024            match self {
4025                Self::Unspecified => std::option::Option::Some(0),
4026                Self::None => std::option::Option::Some(1),
4027                Self::AllAncestors => std::option::Option::Some(2),
4028                Self::UnknownValue(u) => u.0.value(),
4029            }
4030        }
4031
4032        /// Gets the enum value as a string.
4033        ///
4034        /// Returns `None` if the enum contains an unknown value deserialized from
4035        /// the integer representation of enums.
4036        pub fn name(&self) -> std::option::Option<&str> {
4037            match self {
4038                Self::Unspecified => std::option::Option::Some("ANCESTOR_MODE_UNSPECIFIED"),
4039                Self::None => std::option::Option::Some("NONE"),
4040                Self::AllAncestors => std::option::Option::Some("ALL_ANCESTORS"),
4041                Self::UnknownValue(u) => u.0.name(),
4042            }
4043        }
4044    }
4045
4046    impl std::default::Default for AncestorMode {
4047        fn default() -> Self {
4048            use std::convert::From;
4049            Self::from(0)
4050        }
4051    }
4052
4053    impl std::fmt::Display for AncestorMode {
4054        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4055            wkt::internal::display_enum(f, self.name(), self.value())
4056        }
4057    }
4058
4059    impl std::convert::From<i32> for AncestorMode {
4060        fn from(value: i32) -> Self {
4061            match value {
4062                0 => Self::Unspecified,
4063                1 => Self::None,
4064                2 => Self::AllAncestors,
4065                _ => Self::UnknownValue(ancestor_mode::UnknownValue(
4066                    wkt::internal::UnknownEnumValue::Integer(value),
4067                )),
4068            }
4069        }
4070    }
4071
4072    impl std::convert::From<&str> for AncestorMode {
4073        fn from(value: &str) -> Self {
4074            use std::string::ToString;
4075            match value {
4076                "ANCESTOR_MODE_UNSPECIFIED" => Self::Unspecified,
4077                "NONE" => Self::None,
4078                "ALL_ANCESTORS" => Self::AllAncestors,
4079                _ => Self::UnknownValue(ancestor_mode::UnknownValue(
4080                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4081                )),
4082            }
4083        }
4084    }
4085
4086    impl serde::ser::Serialize for AncestorMode {
4087        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4088        where
4089            S: serde::Serializer,
4090        {
4091            match self {
4092                Self::Unspecified => serializer.serialize_i32(0),
4093                Self::None => serializer.serialize_i32(1),
4094                Self::AllAncestors => serializer.serialize_i32(2),
4095                Self::UnknownValue(u) => u.0.serialize(serializer),
4096            }
4097        }
4098    }
4099
4100    impl<'de> serde::de::Deserialize<'de> for AncestorMode {
4101        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4102        where
4103            D: serde::Deserializer<'de>,
4104        {
4105            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AncestorMode>::new(
4106                ".google.datastore.admin.v1.Index.AncestorMode",
4107            ))
4108        }
4109    }
4110
4111    /// The direction determines how a property is indexed.
4112    ///
4113    /// # Working with unknown values
4114    ///
4115    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4116    /// additional enum variants at any time. Adding new variants is not considered
4117    /// a breaking change. Applications should write their code in anticipation of:
4118    ///
4119    /// - New values appearing in future releases of the client library, **and**
4120    /// - New values received dynamically, without application changes.
4121    ///
4122    /// Please consult the [Working with enums] section in the user guide for some
4123    /// guidelines.
4124    ///
4125    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4126    #[derive(Clone, Debug, PartialEq)]
4127    #[non_exhaustive]
4128    pub enum Direction {
4129        /// The direction is unspecified.
4130        Unspecified,
4131        /// The property's values are indexed so as to support sequencing in
4132        /// ascending order and also query by <, >, <=, >=, and =.
4133        Ascending,
4134        /// The property's values are indexed so as to support sequencing in
4135        /// descending order and also query by <, >, <=, >=, and =.
4136        Descending,
4137        /// If set, the enum was initialized with an unknown value.
4138        ///
4139        /// Applications can examine the value using [Direction::value] or
4140        /// [Direction::name].
4141        UnknownValue(direction::UnknownValue),
4142    }
4143
4144    #[doc(hidden)]
4145    pub mod direction {
4146        #[allow(unused_imports)]
4147        use super::*;
4148        #[derive(Clone, Debug, PartialEq)]
4149        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4150    }
4151
4152    impl Direction {
4153        /// Gets the enum value.
4154        ///
4155        /// Returns `None` if the enum contains an unknown value deserialized from
4156        /// the string representation of enums.
4157        pub fn value(&self) -> std::option::Option<i32> {
4158            match self {
4159                Self::Unspecified => std::option::Option::Some(0),
4160                Self::Ascending => std::option::Option::Some(1),
4161                Self::Descending => std::option::Option::Some(2),
4162                Self::UnknownValue(u) => u.0.value(),
4163            }
4164        }
4165
4166        /// Gets the enum value as a string.
4167        ///
4168        /// Returns `None` if the enum contains an unknown value deserialized from
4169        /// the integer representation of enums.
4170        pub fn name(&self) -> std::option::Option<&str> {
4171            match self {
4172                Self::Unspecified => std::option::Option::Some("DIRECTION_UNSPECIFIED"),
4173                Self::Ascending => std::option::Option::Some("ASCENDING"),
4174                Self::Descending => std::option::Option::Some("DESCENDING"),
4175                Self::UnknownValue(u) => u.0.name(),
4176            }
4177        }
4178    }
4179
4180    impl std::default::Default for Direction {
4181        fn default() -> Self {
4182            use std::convert::From;
4183            Self::from(0)
4184        }
4185    }
4186
4187    impl std::fmt::Display for Direction {
4188        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4189            wkt::internal::display_enum(f, self.name(), self.value())
4190        }
4191    }
4192
4193    impl std::convert::From<i32> for Direction {
4194        fn from(value: i32) -> Self {
4195            match value {
4196                0 => Self::Unspecified,
4197                1 => Self::Ascending,
4198                2 => Self::Descending,
4199                _ => Self::UnknownValue(direction::UnknownValue(
4200                    wkt::internal::UnknownEnumValue::Integer(value),
4201                )),
4202            }
4203        }
4204    }
4205
4206    impl std::convert::From<&str> for Direction {
4207        fn from(value: &str) -> Self {
4208            use std::string::ToString;
4209            match value {
4210                "DIRECTION_UNSPECIFIED" => Self::Unspecified,
4211                "ASCENDING" => Self::Ascending,
4212                "DESCENDING" => Self::Descending,
4213                _ => Self::UnknownValue(direction::UnknownValue(
4214                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4215                )),
4216            }
4217        }
4218    }
4219
4220    impl serde::ser::Serialize for Direction {
4221        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4222        where
4223            S: serde::Serializer,
4224        {
4225            match self {
4226                Self::Unspecified => serializer.serialize_i32(0),
4227                Self::Ascending => serializer.serialize_i32(1),
4228                Self::Descending => serializer.serialize_i32(2),
4229                Self::UnknownValue(u) => u.0.serialize(serializer),
4230            }
4231        }
4232    }
4233
4234    impl<'de> serde::de::Deserialize<'de> for Direction {
4235        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4236        where
4237            D: serde::Deserializer<'de>,
4238        {
4239            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Direction>::new(
4240                ".google.datastore.admin.v1.Index.Direction",
4241            ))
4242        }
4243    }
4244
4245    /// The possible set of states of an index.
4246    ///
4247    /// # Working with unknown values
4248    ///
4249    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4250    /// additional enum variants at any time. Adding new variants is not considered
4251    /// a breaking change. Applications should write their code in anticipation of:
4252    ///
4253    /// - New values appearing in future releases of the client library, **and**
4254    /// - New values received dynamically, without application changes.
4255    ///
4256    /// Please consult the [Working with enums] section in the user guide for some
4257    /// guidelines.
4258    ///
4259    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4260    #[derive(Clone, Debug, PartialEq)]
4261    #[non_exhaustive]
4262    pub enum State {
4263        /// The state is unspecified.
4264        Unspecified,
4265        /// The index is being created, and cannot be used by queries.
4266        /// There is an active long-running operation for the index.
4267        /// The index is updated when writing an entity.
4268        /// Some index data may exist.
4269        Creating,
4270        /// The index is ready to be used.
4271        /// The index is updated when writing an entity.
4272        /// The index is fully populated from all stored entities it applies to.
4273        Ready,
4274        /// The index is being deleted, and cannot be used by queries.
4275        /// There is an active long-running operation for the index.
4276        /// The index is not updated when writing an entity.
4277        /// Some index data may exist.
4278        Deleting,
4279        /// The index was being created or deleted, but something went wrong.
4280        /// The index cannot by used by queries.
4281        /// There is no active long-running operation for the index,
4282        /// and the most recently finished long-running operation failed.
4283        /// The index is not updated when writing an entity.
4284        /// Some index data may exist.
4285        Error,
4286        /// If set, the enum was initialized with an unknown value.
4287        ///
4288        /// Applications can examine the value using [State::value] or
4289        /// [State::name].
4290        UnknownValue(state::UnknownValue),
4291    }
4292
4293    #[doc(hidden)]
4294    pub mod state {
4295        #[allow(unused_imports)]
4296        use super::*;
4297        #[derive(Clone, Debug, PartialEq)]
4298        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4299    }
4300
4301    impl State {
4302        /// Gets the enum value.
4303        ///
4304        /// Returns `None` if the enum contains an unknown value deserialized from
4305        /// the string representation of enums.
4306        pub fn value(&self) -> std::option::Option<i32> {
4307            match self {
4308                Self::Unspecified => std::option::Option::Some(0),
4309                Self::Creating => std::option::Option::Some(1),
4310                Self::Ready => std::option::Option::Some(2),
4311                Self::Deleting => std::option::Option::Some(3),
4312                Self::Error => std::option::Option::Some(4),
4313                Self::UnknownValue(u) => u.0.value(),
4314            }
4315        }
4316
4317        /// Gets the enum value as a string.
4318        ///
4319        /// Returns `None` if the enum contains an unknown value deserialized from
4320        /// the integer representation of enums.
4321        pub fn name(&self) -> std::option::Option<&str> {
4322            match self {
4323                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4324                Self::Creating => std::option::Option::Some("CREATING"),
4325                Self::Ready => std::option::Option::Some("READY"),
4326                Self::Deleting => std::option::Option::Some("DELETING"),
4327                Self::Error => std::option::Option::Some("ERROR"),
4328                Self::UnknownValue(u) => u.0.name(),
4329            }
4330        }
4331    }
4332
4333    impl std::default::Default for State {
4334        fn default() -> Self {
4335            use std::convert::From;
4336            Self::from(0)
4337        }
4338    }
4339
4340    impl std::fmt::Display for State {
4341        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4342            wkt::internal::display_enum(f, self.name(), self.value())
4343        }
4344    }
4345
4346    impl std::convert::From<i32> for State {
4347        fn from(value: i32) -> Self {
4348            match value {
4349                0 => Self::Unspecified,
4350                1 => Self::Creating,
4351                2 => Self::Ready,
4352                3 => Self::Deleting,
4353                4 => Self::Error,
4354                _ => Self::UnknownValue(state::UnknownValue(
4355                    wkt::internal::UnknownEnumValue::Integer(value),
4356                )),
4357            }
4358        }
4359    }
4360
4361    impl std::convert::From<&str> for State {
4362        fn from(value: &str) -> Self {
4363            use std::string::ToString;
4364            match value {
4365                "STATE_UNSPECIFIED" => Self::Unspecified,
4366                "CREATING" => Self::Creating,
4367                "READY" => Self::Ready,
4368                "DELETING" => Self::Deleting,
4369                "ERROR" => Self::Error,
4370                _ => Self::UnknownValue(state::UnknownValue(
4371                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4372                )),
4373            }
4374        }
4375    }
4376
4377    impl serde::ser::Serialize for State {
4378        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4379        where
4380            S: serde::Serializer,
4381        {
4382            match self {
4383                Self::Unspecified => serializer.serialize_i32(0),
4384                Self::Creating => serializer.serialize_i32(1),
4385                Self::Ready => serializer.serialize_i32(2),
4386                Self::Deleting => serializer.serialize_i32(3),
4387                Self::Error => serializer.serialize_i32(4),
4388                Self::UnknownValue(u) => u.0.serialize(serializer),
4389            }
4390        }
4391    }
4392
4393    impl<'de> serde::de::Deserialize<'de> for State {
4394        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4395        where
4396            D: serde::Deserializer<'de>,
4397        {
4398            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4399                ".google.datastore.admin.v1.Index.State",
4400            ))
4401        }
4402    }
4403}
4404
4405/// An event signifying a change in state of a [migration from Cloud Datastore to
4406/// Cloud Firestore in Datastore
4407/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
4408#[derive(Clone, Default, PartialEq)]
4409#[non_exhaustive]
4410pub struct MigrationStateEvent {
4411    /// The new state of the migration.
4412    pub state: crate::model::MigrationState,
4413
4414    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4415}
4416
4417impl MigrationStateEvent {
4418    pub fn new() -> Self {
4419        std::default::Default::default()
4420    }
4421
4422    /// Sets the value of [state][crate::model::MigrationStateEvent::state].
4423    pub fn set_state<T: std::convert::Into<crate::model::MigrationState>>(mut self, v: T) -> Self {
4424        self.state = v.into();
4425        self
4426    }
4427}
4428
4429impl wkt::message::Message for MigrationStateEvent {
4430    fn typename() -> &'static str {
4431        "type.googleapis.com/google.datastore.admin.v1.MigrationStateEvent"
4432    }
4433}
4434
4435#[doc(hidden)]
4436impl<'de> serde::de::Deserialize<'de> for MigrationStateEvent {
4437    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4438    where
4439        D: serde::Deserializer<'de>,
4440    {
4441        #[allow(non_camel_case_types)]
4442        #[doc(hidden)]
4443        #[derive(PartialEq, Eq, Hash)]
4444        enum __FieldTag {
4445            __state,
4446            Unknown(std::string::String),
4447        }
4448        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4449            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4450            where
4451                D: serde::Deserializer<'de>,
4452            {
4453                struct Visitor;
4454                impl<'de> serde::de::Visitor<'de> for Visitor {
4455                    type Value = __FieldTag;
4456                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4457                        formatter.write_str("a field name for MigrationStateEvent")
4458                    }
4459                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4460                    where
4461                        E: serde::de::Error,
4462                    {
4463                        use std::result::Result::Ok;
4464                        use std::string::ToString;
4465                        match value {
4466                            "state" => Ok(__FieldTag::__state),
4467                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4468                        }
4469                    }
4470                }
4471                deserializer.deserialize_identifier(Visitor)
4472            }
4473        }
4474        struct Visitor;
4475        impl<'de> serde::de::Visitor<'de> for Visitor {
4476            type Value = MigrationStateEvent;
4477            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4478                formatter.write_str("struct MigrationStateEvent")
4479            }
4480            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4481            where
4482                A: serde::de::MapAccess<'de>,
4483            {
4484                #[allow(unused_imports)]
4485                use serde::de::Error;
4486                use std::option::Option::Some;
4487                let mut fields = std::collections::HashSet::new();
4488                let mut result = Self::Value::new();
4489                while let Some(tag) = map.next_key::<__FieldTag>()? {
4490                    #[allow(clippy::match_single_binding)]
4491                    match tag {
4492                        __FieldTag::__state => {
4493                            if !fields.insert(__FieldTag::__state) {
4494                                return std::result::Result::Err(A::Error::duplicate_field(
4495                                    "multiple values for state",
4496                                ));
4497                            }
4498                            result.state = map
4499                                .next_value::<std::option::Option<crate::model::MigrationState>>()?
4500                                .unwrap_or_default();
4501                        }
4502                        __FieldTag::Unknown(key) => {
4503                            let value = map.next_value::<serde_json::Value>()?;
4504                            result._unknown_fields.insert(key, value);
4505                        }
4506                    }
4507                }
4508                std::result::Result::Ok(result)
4509            }
4510        }
4511        deserializer.deserialize_any(Visitor)
4512    }
4513}
4514
4515#[doc(hidden)]
4516impl serde::ser::Serialize for MigrationStateEvent {
4517    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4518    where
4519        S: serde::ser::Serializer,
4520    {
4521        use serde::ser::SerializeMap;
4522        #[allow(unused_imports)]
4523        use std::option::Option::Some;
4524        let mut state = serializer.serialize_map(std::option::Option::None)?;
4525        if !wkt::internal::is_default(&self.state) {
4526            state.serialize_entry("state", &self.state)?;
4527        }
4528        if !self._unknown_fields.is_empty() {
4529            for (key, value) in self._unknown_fields.iter() {
4530                state.serialize_entry(key, &value)?;
4531            }
4532        }
4533        state.end()
4534    }
4535}
4536
4537impl std::fmt::Debug for MigrationStateEvent {
4538    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4539        let mut debug_struct = f.debug_struct("MigrationStateEvent");
4540        debug_struct.field("state", &self.state);
4541        if !self._unknown_fields.is_empty() {
4542            debug_struct.field("_unknown_fields", &self._unknown_fields);
4543        }
4544        debug_struct.finish()
4545    }
4546}
4547
4548/// An event signifying the start of a new step in a [migration from Cloud
4549/// Datastore to Cloud Firestore in Datastore
4550/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
4551#[derive(Clone, Default, PartialEq)]
4552#[non_exhaustive]
4553pub struct MigrationProgressEvent {
4554    /// The step that is starting.
4555    ///
4556    /// An event with step set to `START` indicates that the migration
4557    /// has been reverted back to the initial pre-migration state.
4558    pub step: crate::model::MigrationStep,
4559
4560    /// Details about this step.
4561    pub step_details: std::option::Option<crate::model::migration_progress_event::StepDetails>,
4562
4563    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4564}
4565
4566impl MigrationProgressEvent {
4567    pub fn new() -> Self {
4568        std::default::Default::default()
4569    }
4570
4571    /// Sets the value of [step][crate::model::MigrationProgressEvent::step].
4572    pub fn set_step<T: std::convert::Into<crate::model::MigrationStep>>(mut self, v: T) -> Self {
4573        self.step = v.into();
4574        self
4575    }
4576
4577    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details].
4578    ///
4579    /// Note that all the setters affecting `step_details` are mutually
4580    /// exclusive.
4581    pub fn set_step_details<
4582        T: std::convert::Into<
4583                std::option::Option<crate::model::migration_progress_event::StepDetails>,
4584            >,
4585    >(
4586        mut self,
4587        v: T,
4588    ) -> Self {
4589        self.step_details = v.into();
4590        self
4591    }
4592
4593    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
4594    /// if it holds a `PrepareStepDetails`, `None` if the field is not set or
4595    /// holds a different branch.
4596    pub fn prepare_step_details(
4597        &self,
4598    ) -> std::option::Option<
4599        &std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
4600    > {
4601        #[allow(unreachable_patterns)]
4602        self.step_details.as_ref().and_then(|v| match v {
4603            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v) => {
4604                std::option::Option::Some(v)
4605            }
4606            _ => std::option::Option::None,
4607        })
4608    }
4609
4610    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
4611    /// to hold a `PrepareStepDetails`.
4612    ///
4613    /// Note that all the setters affecting `step_details` are
4614    /// mutually exclusive.
4615    pub fn set_prepare_step_details<
4616        T: std::convert::Into<
4617                std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
4618            >,
4619    >(
4620        mut self,
4621        v: T,
4622    ) -> Self {
4623        self.step_details = std::option::Option::Some(
4624            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v.into()),
4625        );
4626        self
4627    }
4628
4629    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
4630    /// if it holds a `RedirectWritesStepDetails`, `None` if the field is not set or
4631    /// holds a different branch.
4632    pub fn redirect_writes_step_details(
4633        &self,
4634    ) -> std::option::Option<
4635        &std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
4636    > {
4637        #[allow(unreachable_patterns)]
4638        self.step_details.as_ref().and_then(|v| match v {
4639            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(v) => {
4640                std::option::Option::Some(v)
4641            }
4642            _ => std::option::Option::None,
4643        })
4644    }
4645
4646    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
4647    /// to hold a `RedirectWritesStepDetails`.
4648    ///
4649    /// Note that all the setters affecting `step_details` are
4650    /// mutually exclusive.
4651    pub fn set_redirect_writes_step_details<
4652        T: std::convert::Into<
4653                std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
4654            >,
4655    >(
4656        mut self,
4657        v: T,
4658    ) -> Self {
4659        self.step_details = std::option::Option::Some(
4660            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(
4661                v.into(),
4662            ),
4663        );
4664        self
4665    }
4666}
4667
4668impl wkt::message::Message for MigrationProgressEvent {
4669    fn typename() -> &'static str {
4670        "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent"
4671    }
4672}
4673
4674#[doc(hidden)]
4675impl<'de> serde::de::Deserialize<'de> for MigrationProgressEvent {
4676    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4677    where
4678        D: serde::Deserializer<'de>,
4679    {
4680        #[allow(non_camel_case_types)]
4681        #[doc(hidden)]
4682        #[derive(PartialEq, Eq, Hash)]
4683        enum __FieldTag {
4684            __step,
4685            __prepare_step_details,
4686            __redirect_writes_step_details,
4687            Unknown(std::string::String),
4688        }
4689        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4690            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4691            where
4692                D: serde::Deserializer<'de>,
4693            {
4694                struct Visitor;
4695                impl<'de> serde::de::Visitor<'de> for Visitor {
4696                    type Value = __FieldTag;
4697                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4698                        formatter.write_str("a field name for MigrationProgressEvent")
4699                    }
4700                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4701                    where
4702                        E: serde::de::Error,
4703                    {
4704                        use std::result::Result::Ok;
4705                        use std::string::ToString;
4706                        match value {
4707                            "step" => Ok(__FieldTag::__step),
4708                            "prepareStepDetails" => Ok(__FieldTag::__prepare_step_details),
4709                            "prepare_step_details" => Ok(__FieldTag::__prepare_step_details),
4710                            "redirectWritesStepDetails" => {
4711                                Ok(__FieldTag::__redirect_writes_step_details)
4712                            }
4713                            "redirect_writes_step_details" => {
4714                                Ok(__FieldTag::__redirect_writes_step_details)
4715                            }
4716                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4717                        }
4718                    }
4719                }
4720                deserializer.deserialize_identifier(Visitor)
4721            }
4722        }
4723        struct Visitor;
4724        impl<'de> serde::de::Visitor<'de> for Visitor {
4725            type Value = MigrationProgressEvent;
4726            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4727                formatter.write_str("struct MigrationProgressEvent")
4728            }
4729            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4730            where
4731                A: serde::de::MapAccess<'de>,
4732            {
4733                #[allow(unused_imports)]
4734                use serde::de::Error;
4735                use std::option::Option::Some;
4736                let mut fields = std::collections::HashSet::new();
4737                let mut result = Self::Value::new();
4738                while let Some(tag) = map.next_key::<__FieldTag>()? {
4739                    #[allow(clippy::match_single_binding)]
4740                    match tag {
4741                        __FieldTag::__step => {
4742                            if !fields.insert(__FieldTag::__step) {
4743                                return std::result::Result::Err(A::Error::duplicate_field(
4744                                    "multiple values for step",
4745                                ));
4746                            }
4747                            result.step = map
4748                                .next_value::<std::option::Option<crate::model::MigrationStep>>()?
4749                                .unwrap_or_default();
4750                        }
4751                        __FieldTag::__prepare_step_details => {
4752                            if !fields.insert(__FieldTag::__prepare_step_details) {
4753                                return std::result::Result::Err(A::Error::duplicate_field(
4754                                    "multiple values for prepare_step_details",
4755                                ));
4756                            }
4757                            if result.step_details.is_some() {
4758                                return std::result::Result::Err(A::Error::duplicate_field(
4759                                    "multiple values for `step_details`, a oneof with full ID .google.datastore.admin.v1.MigrationProgressEvent.prepare_step_details, latest field was prepareStepDetails",
4760                                ));
4761                            }
4762                            result.step_details = std::option::Option::Some(
4763                                crate::model::migration_progress_event::StepDetails::PrepareStepDetails(
4764                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>>>()?.unwrap_or_default()
4765                                ),
4766                            );
4767                        }
4768                        __FieldTag::__redirect_writes_step_details => {
4769                            if !fields.insert(__FieldTag::__redirect_writes_step_details) {
4770                                return std::result::Result::Err(A::Error::duplicate_field(
4771                                    "multiple values for redirect_writes_step_details",
4772                                ));
4773                            }
4774                            if result.step_details.is_some() {
4775                                return std::result::Result::Err(A::Error::duplicate_field(
4776                                    "multiple values for `step_details`, a oneof with full ID .google.datastore.admin.v1.MigrationProgressEvent.redirect_writes_step_details, latest field was redirectWritesStepDetails",
4777                                ));
4778                            }
4779                            result.step_details = std::option::Option::Some(
4780                                crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(
4781                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>>>()?.unwrap_or_default()
4782                                ),
4783                            );
4784                        }
4785                        __FieldTag::Unknown(key) => {
4786                            let value = map.next_value::<serde_json::Value>()?;
4787                            result._unknown_fields.insert(key, value);
4788                        }
4789                    }
4790                }
4791                std::result::Result::Ok(result)
4792            }
4793        }
4794        deserializer.deserialize_any(Visitor)
4795    }
4796}
4797
4798#[doc(hidden)]
4799impl serde::ser::Serialize for MigrationProgressEvent {
4800    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4801    where
4802        S: serde::ser::Serializer,
4803    {
4804        use serde::ser::SerializeMap;
4805        #[allow(unused_imports)]
4806        use std::option::Option::Some;
4807        let mut state = serializer.serialize_map(std::option::Option::None)?;
4808        if !wkt::internal::is_default(&self.step) {
4809            state.serialize_entry("step", &self.step)?;
4810        }
4811        if let Some(value) = self.prepare_step_details() {
4812            state.serialize_entry("prepareStepDetails", value)?;
4813        }
4814        if let Some(value) = self.redirect_writes_step_details() {
4815            state.serialize_entry("redirectWritesStepDetails", value)?;
4816        }
4817        if !self._unknown_fields.is_empty() {
4818            for (key, value) in self._unknown_fields.iter() {
4819                state.serialize_entry(key, &value)?;
4820            }
4821        }
4822        state.end()
4823    }
4824}
4825
4826impl std::fmt::Debug for MigrationProgressEvent {
4827    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4828        let mut debug_struct = f.debug_struct("MigrationProgressEvent");
4829        debug_struct.field("step", &self.step);
4830        debug_struct.field("step_details", &self.step_details);
4831        if !self._unknown_fields.is_empty() {
4832            debug_struct.field("_unknown_fields", &self._unknown_fields);
4833        }
4834        debug_struct.finish()
4835    }
4836}
4837
4838/// Defines additional types related to [MigrationProgressEvent].
4839pub mod migration_progress_event {
4840    #[allow(unused_imports)]
4841    use super::*;
4842
4843    /// Details for the `PREPARE` step.
4844    #[derive(Clone, Default, PartialEq)]
4845    #[non_exhaustive]
4846    pub struct PrepareStepDetails {
4847        /// The concurrency mode this database will use when it reaches the
4848        /// `REDIRECT_WRITES` step.
4849        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
4850
4851        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4852    }
4853
4854    impl PrepareStepDetails {
4855        pub fn new() -> Self {
4856            std::default::Default::default()
4857        }
4858
4859        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::PrepareStepDetails::concurrency_mode].
4860        pub fn set_concurrency_mode<
4861            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
4862        >(
4863            mut self,
4864            v: T,
4865        ) -> Self {
4866            self.concurrency_mode = v.into();
4867            self
4868        }
4869    }
4870
4871    impl wkt::message::Message for PrepareStepDetails {
4872        fn typename() -> &'static str {
4873            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails"
4874        }
4875    }
4876
4877    #[doc(hidden)]
4878    impl<'de> serde::de::Deserialize<'de> for PrepareStepDetails {
4879        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4880        where
4881            D: serde::Deserializer<'de>,
4882        {
4883            #[allow(non_camel_case_types)]
4884            #[doc(hidden)]
4885            #[derive(PartialEq, Eq, Hash)]
4886            enum __FieldTag {
4887                __concurrency_mode,
4888                Unknown(std::string::String),
4889            }
4890            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4891                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4892                where
4893                    D: serde::Deserializer<'de>,
4894                {
4895                    struct Visitor;
4896                    impl<'de> serde::de::Visitor<'de> for Visitor {
4897                        type Value = __FieldTag;
4898                        fn expecting(
4899                            &self,
4900                            formatter: &mut std::fmt::Formatter,
4901                        ) -> std::fmt::Result {
4902                            formatter.write_str("a field name for PrepareStepDetails")
4903                        }
4904                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4905                        where
4906                            E: serde::de::Error,
4907                        {
4908                            use std::result::Result::Ok;
4909                            use std::string::ToString;
4910                            match value {
4911                                "concurrencyMode" => Ok(__FieldTag::__concurrency_mode),
4912                                "concurrency_mode" => Ok(__FieldTag::__concurrency_mode),
4913                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4914                            }
4915                        }
4916                    }
4917                    deserializer.deserialize_identifier(Visitor)
4918                }
4919            }
4920            struct Visitor;
4921            impl<'de> serde::de::Visitor<'de> for Visitor {
4922                type Value = PrepareStepDetails;
4923                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4924                    formatter.write_str("struct PrepareStepDetails")
4925                }
4926                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4927                where
4928                    A: serde::de::MapAccess<'de>,
4929                {
4930                    #[allow(unused_imports)]
4931                    use serde::de::Error;
4932                    use std::option::Option::Some;
4933                    let mut fields = std::collections::HashSet::new();
4934                    let mut result = Self::Value::new();
4935                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4936                        #[allow(clippy::match_single_binding)]
4937                        match tag {
4938                            __FieldTag::__concurrency_mode => {
4939                                if !fields.insert(__FieldTag::__concurrency_mode) {
4940                                    return std::result::Result::Err(A::Error::duplicate_field(
4941                                        "multiple values for concurrency_mode",
4942                                    ));
4943                                }
4944                                result.concurrency_mode = map
4945                                    .next_value::<std::option::Option<
4946                                        crate::model::migration_progress_event::ConcurrencyMode,
4947                                    >>()?
4948                                    .unwrap_or_default();
4949                            }
4950                            __FieldTag::Unknown(key) => {
4951                                let value = map.next_value::<serde_json::Value>()?;
4952                                result._unknown_fields.insert(key, value);
4953                            }
4954                        }
4955                    }
4956                    std::result::Result::Ok(result)
4957                }
4958            }
4959            deserializer.deserialize_any(Visitor)
4960        }
4961    }
4962
4963    #[doc(hidden)]
4964    impl serde::ser::Serialize for PrepareStepDetails {
4965        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4966        where
4967            S: serde::ser::Serializer,
4968        {
4969            use serde::ser::SerializeMap;
4970            #[allow(unused_imports)]
4971            use std::option::Option::Some;
4972            let mut state = serializer.serialize_map(std::option::Option::None)?;
4973            if !wkt::internal::is_default(&self.concurrency_mode) {
4974                state.serialize_entry("concurrencyMode", &self.concurrency_mode)?;
4975            }
4976            if !self._unknown_fields.is_empty() {
4977                for (key, value) in self._unknown_fields.iter() {
4978                    state.serialize_entry(key, &value)?;
4979                }
4980            }
4981            state.end()
4982        }
4983    }
4984
4985    impl std::fmt::Debug for PrepareStepDetails {
4986        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4987            let mut debug_struct = f.debug_struct("PrepareStepDetails");
4988            debug_struct.field("concurrency_mode", &self.concurrency_mode);
4989            if !self._unknown_fields.is_empty() {
4990                debug_struct.field("_unknown_fields", &self._unknown_fields);
4991            }
4992            debug_struct.finish()
4993        }
4994    }
4995
4996    /// Details for the `REDIRECT_WRITES` step.
4997    #[derive(Clone, Default, PartialEq)]
4998    #[non_exhaustive]
4999    pub struct RedirectWritesStepDetails {
5000        /// Ths concurrency mode for this database.
5001        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
5002
5003        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5004    }
5005
5006    impl RedirectWritesStepDetails {
5007        pub fn new() -> Self {
5008            std::default::Default::default()
5009        }
5010
5011        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::RedirectWritesStepDetails::concurrency_mode].
5012        pub fn set_concurrency_mode<
5013            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
5014        >(
5015            mut self,
5016            v: T,
5017        ) -> Self {
5018            self.concurrency_mode = v.into();
5019            self
5020        }
5021    }
5022
5023    impl wkt::message::Message for RedirectWritesStepDetails {
5024        fn typename() -> &'static str {
5025            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails"
5026        }
5027    }
5028
5029    #[doc(hidden)]
5030    impl<'de> serde::de::Deserialize<'de> for RedirectWritesStepDetails {
5031        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5032        where
5033            D: serde::Deserializer<'de>,
5034        {
5035            #[allow(non_camel_case_types)]
5036            #[doc(hidden)]
5037            #[derive(PartialEq, Eq, Hash)]
5038            enum __FieldTag {
5039                __concurrency_mode,
5040                Unknown(std::string::String),
5041            }
5042            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5043                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5044                where
5045                    D: serde::Deserializer<'de>,
5046                {
5047                    struct Visitor;
5048                    impl<'de> serde::de::Visitor<'de> for Visitor {
5049                        type Value = __FieldTag;
5050                        fn expecting(
5051                            &self,
5052                            formatter: &mut std::fmt::Formatter,
5053                        ) -> std::fmt::Result {
5054                            formatter.write_str("a field name for RedirectWritesStepDetails")
5055                        }
5056                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5057                        where
5058                            E: serde::de::Error,
5059                        {
5060                            use std::result::Result::Ok;
5061                            use std::string::ToString;
5062                            match value {
5063                                "concurrencyMode" => Ok(__FieldTag::__concurrency_mode),
5064                                "concurrency_mode" => Ok(__FieldTag::__concurrency_mode),
5065                                _ => Ok(__FieldTag::Unknown(value.to_string())),
5066                            }
5067                        }
5068                    }
5069                    deserializer.deserialize_identifier(Visitor)
5070                }
5071            }
5072            struct Visitor;
5073            impl<'de> serde::de::Visitor<'de> for Visitor {
5074                type Value = RedirectWritesStepDetails;
5075                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5076                    formatter.write_str("struct RedirectWritesStepDetails")
5077                }
5078                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5079                where
5080                    A: serde::de::MapAccess<'de>,
5081                {
5082                    #[allow(unused_imports)]
5083                    use serde::de::Error;
5084                    use std::option::Option::Some;
5085                    let mut fields = std::collections::HashSet::new();
5086                    let mut result = Self::Value::new();
5087                    while let Some(tag) = map.next_key::<__FieldTag>()? {
5088                        #[allow(clippy::match_single_binding)]
5089                        match tag {
5090                            __FieldTag::__concurrency_mode => {
5091                                if !fields.insert(__FieldTag::__concurrency_mode) {
5092                                    return std::result::Result::Err(A::Error::duplicate_field(
5093                                        "multiple values for concurrency_mode",
5094                                    ));
5095                                }
5096                                result.concurrency_mode = map
5097                                    .next_value::<std::option::Option<
5098                                        crate::model::migration_progress_event::ConcurrencyMode,
5099                                    >>()?
5100                                    .unwrap_or_default();
5101                            }
5102                            __FieldTag::Unknown(key) => {
5103                                let value = map.next_value::<serde_json::Value>()?;
5104                                result._unknown_fields.insert(key, value);
5105                            }
5106                        }
5107                    }
5108                    std::result::Result::Ok(result)
5109                }
5110            }
5111            deserializer.deserialize_any(Visitor)
5112        }
5113    }
5114
5115    #[doc(hidden)]
5116    impl serde::ser::Serialize for RedirectWritesStepDetails {
5117        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5118        where
5119            S: serde::ser::Serializer,
5120        {
5121            use serde::ser::SerializeMap;
5122            #[allow(unused_imports)]
5123            use std::option::Option::Some;
5124            let mut state = serializer.serialize_map(std::option::Option::None)?;
5125            if !wkt::internal::is_default(&self.concurrency_mode) {
5126                state.serialize_entry("concurrencyMode", &self.concurrency_mode)?;
5127            }
5128            if !self._unknown_fields.is_empty() {
5129                for (key, value) in self._unknown_fields.iter() {
5130                    state.serialize_entry(key, &value)?;
5131                }
5132            }
5133            state.end()
5134        }
5135    }
5136
5137    impl std::fmt::Debug for RedirectWritesStepDetails {
5138        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5139            let mut debug_struct = f.debug_struct("RedirectWritesStepDetails");
5140            debug_struct.field("concurrency_mode", &self.concurrency_mode);
5141            if !self._unknown_fields.is_empty() {
5142                debug_struct.field("_unknown_fields", &self._unknown_fields);
5143            }
5144            debug_struct.finish()
5145        }
5146    }
5147
5148    /// Concurrency modes for transactions in Cloud Firestore.
5149    ///
5150    /// # Working with unknown values
5151    ///
5152    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5153    /// additional enum variants at any time. Adding new variants is not considered
5154    /// a breaking change. Applications should write their code in anticipation of:
5155    ///
5156    /// - New values appearing in future releases of the client library, **and**
5157    /// - New values received dynamically, without application changes.
5158    ///
5159    /// Please consult the [Working with enums] section in the user guide for some
5160    /// guidelines.
5161    ///
5162    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5163    #[derive(Clone, Debug, PartialEq)]
5164    #[non_exhaustive]
5165    pub enum ConcurrencyMode {
5166        /// Unspecified.
5167        Unspecified,
5168        /// Pessimistic concurrency.
5169        Pessimistic,
5170        /// Optimistic concurrency.
5171        Optimistic,
5172        /// Optimistic concurrency with entity groups.
5173        OptimisticWithEntityGroups,
5174        /// If set, the enum was initialized with an unknown value.
5175        ///
5176        /// Applications can examine the value using [ConcurrencyMode::value] or
5177        /// [ConcurrencyMode::name].
5178        UnknownValue(concurrency_mode::UnknownValue),
5179    }
5180
5181    #[doc(hidden)]
5182    pub mod concurrency_mode {
5183        #[allow(unused_imports)]
5184        use super::*;
5185        #[derive(Clone, Debug, PartialEq)]
5186        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5187    }
5188
5189    impl ConcurrencyMode {
5190        /// Gets the enum value.
5191        ///
5192        /// Returns `None` if the enum contains an unknown value deserialized from
5193        /// the string representation of enums.
5194        pub fn value(&self) -> std::option::Option<i32> {
5195            match self {
5196                Self::Unspecified => std::option::Option::Some(0),
5197                Self::Pessimistic => std::option::Option::Some(1),
5198                Self::Optimistic => std::option::Option::Some(2),
5199                Self::OptimisticWithEntityGroups => std::option::Option::Some(3),
5200                Self::UnknownValue(u) => u.0.value(),
5201            }
5202        }
5203
5204        /// Gets the enum value as a string.
5205        ///
5206        /// Returns `None` if the enum contains an unknown value deserialized from
5207        /// the integer representation of enums.
5208        pub fn name(&self) -> std::option::Option<&str> {
5209            match self {
5210                Self::Unspecified => std::option::Option::Some("CONCURRENCY_MODE_UNSPECIFIED"),
5211                Self::Pessimistic => std::option::Option::Some("PESSIMISTIC"),
5212                Self::Optimistic => std::option::Option::Some("OPTIMISTIC"),
5213                Self::OptimisticWithEntityGroups => {
5214                    std::option::Option::Some("OPTIMISTIC_WITH_ENTITY_GROUPS")
5215                }
5216                Self::UnknownValue(u) => u.0.name(),
5217            }
5218        }
5219    }
5220
5221    impl std::default::Default for ConcurrencyMode {
5222        fn default() -> Self {
5223            use std::convert::From;
5224            Self::from(0)
5225        }
5226    }
5227
5228    impl std::fmt::Display for ConcurrencyMode {
5229        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5230            wkt::internal::display_enum(f, self.name(), self.value())
5231        }
5232    }
5233
5234    impl std::convert::From<i32> for ConcurrencyMode {
5235        fn from(value: i32) -> Self {
5236            match value {
5237                0 => Self::Unspecified,
5238                1 => Self::Pessimistic,
5239                2 => Self::Optimistic,
5240                3 => Self::OptimisticWithEntityGroups,
5241                _ => Self::UnknownValue(concurrency_mode::UnknownValue(
5242                    wkt::internal::UnknownEnumValue::Integer(value),
5243                )),
5244            }
5245        }
5246    }
5247
5248    impl std::convert::From<&str> for ConcurrencyMode {
5249        fn from(value: &str) -> Self {
5250            use std::string::ToString;
5251            match value {
5252                "CONCURRENCY_MODE_UNSPECIFIED" => Self::Unspecified,
5253                "PESSIMISTIC" => Self::Pessimistic,
5254                "OPTIMISTIC" => Self::Optimistic,
5255                "OPTIMISTIC_WITH_ENTITY_GROUPS" => Self::OptimisticWithEntityGroups,
5256                _ => Self::UnknownValue(concurrency_mode::UnknownValue(
5257                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5258                )),
5259            }
5260        }
5261    }
5262
5263    impl serde::ser::Serialize for ConcurrencyMode {
5264        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5265        where
5266            S: serde::Serializer,
5267        {
5268            match self {
5269                Self::Unspecified => serializer.serialize_i32(0),
5270                Self::Pessimistic => serializer.serialize_i32(1),
5271                Self::Optimistic => serializer.serialize_i32(2),
5272                Self::OptimisticWithEntityGroups => serializer.serialize_i32(3),
5273                Self::UnknownValue(u) => u.0.serialize(serializer),
5274            }
5275        }
5276    }
5277
5278    impl<'de> serde::de::Deserialize<'de> for ConcurrencyMode {
5279        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5280        where
5281            D: serde::Deserializer<'de>,
5282        {
5283            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConcurrencyMode>::new(
5284                ".google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode",
5285            ))
5286        }
5287    }
5288
5289    /// Details about this step.
5290    #[derive(Clone, Debug, PartialEq)]
5291    #[non_exhaustive]
5292    pub enum StepDetails {
5293        /// Details for the `PREPARE` step.
5294        PrepareStepDetails(
5295            std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
5296        ),
5297        /// Details for the `REDIRECT_WRITES` step.
5298        RedirectWritesStepDetails(
5299            std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
5300        ),
5301    }
5302}
5303
5304/// Operation types.
5305///
5306/// # Working with unknown values
5307///
5308/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5309/// additional enum variants at any time. Adding new variants is not considered
5310/// a breaking change. Applications should write their code in anticipation of:
5311///
5312/// - New values appearing in future releases of the client library, **and**
5313/// - New values received dynamically, without application changes.
5314///
5315/// Please consult the [Working with enums] section in the user guide for some
5316/// guidelines.
5317///
5318/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5319#[derive(Clone, Debug, PartialEq)]
5320#[non_exhaustive]
5321pub enum OperationType {
5322    /// Unspecified.
5323    Unspecified,
5324    /// ExportEntities.
5325    ExportEntities,
5326    /// ImportEntities.
5327    ImportEntities,
5328    /// CreateIndex.
5329    CreateIndex,
5330    /// DeleteIndex.
5331    DeleteIndex,
5332    /// If set, the enum was initialized with an unknown value.
5333    ///
5334    /// Applications can examine the value using [OperationType::value] or
5335    /// [OperationType::name].
5336    UnknownValue(operation_type::UnknownValue),
5337}
5338
5339#[doc(hidden)]
5340pub mod operation_type {
5341    #[allow(unused_imports)]
5342    use super::*;
5343    #[derive(Clone, Debug, PartialEq)]
5344    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5345}
5346
5347impl OperationType {
5348    /// Gets the enum value.
5349    ///
5350    /// Returns `None` if the enum contains an unknown value deserialized from
5351    /// the string representation of enums.
5352    pub fn value(&self) -> std::option::Option<i32> {
5353        match self {
5354            Self::Unspecified => std::option::Option::Some(0),
5355            Self::ExportEntities => std::option::Option::Some(1),
5356            Self::ImportEntities => std::option::Option::Some(2),
5357            Self::CreateIndex => std::option::Option::Some(3),
5358            Self::DeleteIndex => std::option::Option::Some(4),
5359            Self::UnknownValue(u) => u.0.value(),
5360        }
5361    }
5362
5363    /// Gets the enum value as a string.
5364    ///
5365    /// Returns `None` if the enum contains an unknown value deserialized from
5366    /// the integer representation of enums.
5367    pub fn name(&self) -> std::option::Option<&str> {
5368        match self {
5369            Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
5370            Self::ExportEntities => std::option::Option::Some("EXPORT_ENTITIES"),
5371            Self::ImportEntities => std::option::Option::Some("IMPORT_ENTITIES"),
5372            Self::CreateIndex => std::option::Option::Some("CREATE_INDEX"),
5373            Self::DeleteIndex => std::option::Option::Some("DELETE_INDEX"),
5374            Self::UnknownValue(u) => u.0.name(),
5375        }
5376    }
5377}
5378
5379impl std::default::Default for OperationType {
5380    fn default() -> Self {
5381        use std::convert::From;
5382        Self::from(0)
5383    }
5384}
5385
5386impl std::fmt::Display for OperationType {
5387    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5388        wkt::internal::display_enum(f, self.name(), self.value())
5389    }
5390}
5391
5392impl std::convert::From<i32> for OperationType {
5393    fn from(value: i32) -> Self {
5394        match value {
5395            0 => Self::Unspecified,
5396            1 => Self::ExportEntities,
5397            2 => Self::ImportEntities,
5398            3 => Self::CreateIndex,
5399            4 => Self::DeleteIndex,
5400            _ => Self::UnknownValue(operation_type::UnknownValue(
5401                wkt::internal::UnknownEnumValue::Integer(value),
5402            )),
5403        }
5404    }
5405}
5406
5407impl std::convert::From<&str> for OperationType {
5408    fn from(value: &str) -> Self {
5409        use std::string::ToString;
5410        match value {
5411            "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
5412            "EXPORT_ENTITIES" => Self::ExportEntities,
5413            "IMPORT_ENTITIES" => Self::ImportEntities,
5414            "CREATE_INDEX" => Self::CreateIndex,
5415            "DELETE_INDEX" => Self::DeleteIndex,
5416            _ => Self::UnknownValue(operation_type::UnknownValue(
5417                wkt::internal::UnknownEnumValue::String(value.to_string()),
5418            )),
5419        }
5420    }
5421}
5422
5423impl serde::ser::Serialize for OperationType {
5424    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5425    where
5426        S: serde::Serializer,
5427    {
5428        match self {
5429            Self::Unspecified => serializer.serialize_i32(0),
5430            Self::ExportEntities => serializer.serialize_i32(1),
5431            Self::ImportEntities => serializer.serialize_i32(2),
5432            Self::CreateIndex => serializer.serialize_i32(3),
5433            Self::DeleteIndex => serializer.serialize_i32(4),
5434            Self::UnknownValue(u) => u.0.serialize(serializer),
5435        }
5436    }
5437}
5438
5439impl<'de> serde::de::Deserialize<'de> for OperationType {
5440    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5441    where
5442        D: serde::Deserializer<'de>,
5443    {
5444        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
5445            ".google.datastore.admin.v1.OperationType",
5446        ))
5447    }
5448}
5449
5450/// States for a migration.
5451///
5452/// # Working with unknown values
5453///
5454/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5455/// additional enum variants at any time. Adding new variants is not considered
5456/// a breaking change. Applications should write their code in anticipation of:
5457///
5458/// - New values appearing in future releases of the client library, **and**
5459/// - New values received dynamically, without application changes.
5460///
5461/// Please consult the [Working with enums] section in the user guide for some
5462/// guidelines.
5463///
5464/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5465#[derive(Clone, Debug, PartialEq)]
5466#[non_exhaustive]
5467pub enum MigrationState {
5468    /// Unspecified.
5469    Unspecified,
5470    /// The migration is running.
5471    Running,
5472    /// The migration is paused.
5473    Paused,
5474    /// The migration is complete.
5475    Complete,
5476    /// If set, the enum was initialized with an unknown value.
5477    ///
5478    /// Applications can examine the value using [MigrationState::value] or
5479    /// [MigrationState::name].
5480    UnknownValue(migration_state::UnknownValue),
5481}
5482
5483#[doc(hidden)]
5484pub mod migration_state {
5485    #[allow(unused_imports)]
5486    use super::*;
5487    #[derive(Clone, Debug, PartialEq)]
5488    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5489}
5490
5491impl MigrationState {
5492    /// Gets the enum value.
5493    ///
5494    /// Returns `None` if the enum contains an unknown value deserialized from
5495    /// the string representation of enums.
5496    pub fn value(&self) -> std::option::Option<i32> {
5497        match self {
5498            Self::Unspecified => std::option::Option::Some(0),
5499            Self::Running => std::option::Option::Some(1),
5500            Self::Paused => std::option::Option::Some(2),
5501            Self::Complete => std::option::Option::Some(3),
5502            Self::UnknownValue(u) => u.0.value(),
5503        }
5504    }
5505
5506    /// Gets the enum value as a string.
5507    ///
5508    /// Returns `None` if the enum contains an unknown value deserialized from
5509    /// the integer representation of enums.
5510    pub fn name(&self) -> std::option::Option<&str> {
5511        match self {
5512            Self::Unspecified => std::option::Option::Some("MIGRATION_STATE_UNSPECIFIED"),
5513            Self::Running => std::option::Option::Some("RUNNING"),
5514            Self::Paused => std::option::Option::Some("PAUSED"),
5515            Self::Complete => std::option::Option::Some("COMPLETE"),
5516            Self::UnknownValue(u) => u.0.name(),
5517        }
5518    }
5519}
5520
5521impl std::default::Default for MigrationState {
5522    fn default() -> Self {
5523        use std::convert::From;
5524        Self::from(0)
5525    }
5526}
5527
5528impl std::fmt::Display for MigrationState {
5529    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5530        wkt::internal::display_enum(f, self.name(), self.value())
5531    }
5532}
5533
5534impl std::convert::From<i32> for MigrationState {
5535    fn from(value: i32) -> Self {
5536        match value {
5537            0 => Self::Unspecified,
5538            1 => Self::Running,
5539            2 => Self::Paused,
5540            3 => Self::Complete,
5541            _ => Self::UnknownValue(migration_state::UnknownValue(
5542                wkt::internal::UnknownEnumValue::Integer(value),
5543            )),
5544        }
5545    }
5546}
5547
5548impl std::convert::From<&str> for MigrationState {
5549    fn from(value: &str) -> Self {
5550        use std::string::ToString;
5551        match value {
5552            "MIGRATION_STATE_UNSPECIFIED" => Self::Unspecified,
5553            "RUNNING" => Self::Running,
5554            "PAUSED" => Self::Paused,
5555            "COMPLETE" => Self::Complete,
5556            _ => Self::UnknownValue(migration_state::UnknownValue(
5557                wkt::internal::UnknownEnumValue::String(value.to_string()),
5558            )),
5559        }
5560    }
5561}
5562
5563impl serde::ser::Serialize for MigrationState {
5564    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5565    where
5566        S: serde::Serializer,
5567    {
5568        match self {
5569            Self::Unspecified => serializer.serialize_i32(0),
5570            Self::Running => serializer.serialize_i32(1),
5571            Self::Paused => serializer.serialize_i32(2),
5572            Self::Complete => serializer.serialize_i32(3),
5573            Self::UnknownValue(u) => u.0.serialize(serializer),
5574        }
5575    }
5576}
5577
5578impl<'de> serde::de::Deserialize<'de> for MigrationState {
5579    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5580    where
5581        D: serde::Deserializer<'de>,
5582    {
5583        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationState>::new(
5584            ".google.datastore.admin.v1.MigrationState",
5585        ))
5586    }
5587}
5588
5589/// Steps in a migration.
5590///
5591/// # Working with unknown values
5592///
5593/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5594/// additional enum variants at any time. Adding new variants is not considered
5595/// a breaking change. Applications should write their code in anticipation of:
5596///
5597/// - New values appearing in future releases of the client library, **and**
5598/// - New values received dynamically, without application changes.
5599///
5600/// Please consult the [Working with enums] section in the user guide for some
5601/// guidelines.
5602///
5603/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5604#[derive(Clone, Debug, PartialEq)]
5605#[non_exhaustive]
5606pub enum MigrationStep {
5607    /// Unspecified.
5608    Unspecified,
5609    /// Pre-migration: the database is prepared for migration.
5610    Prepare,
5611    /// Start of migration.
5612    Start,
5613    /// Writes are applied synchronously to at least one replica.
5614    ApplyWritesSynchronously,
5615    /// Data is copied to Cloud Firestore and then verified to match the data in
5616    /// Cloud Datastore.
5617    CopyAndVerify,
5618    /// Eventually-consistent reads are redirected to Cloud Firestore.
5619    RedirectEventuallyConsistentReads,
5620    /// Strongly-consistent reads are redirected to Cloud Firestore.
5621    RedirectStronglyConsistentReads,
5622    /// Writes are redirected to Cloud Firestore.
5623    RedirectWrites,
5624    /// If set, the enum was initialized with an unknown value.
5625    ///
5626    /// Applications can examine the value using [MigrationStep::value] or
5627    /// [MigrationStep::name].
5628    UnknownValue(migration_step::UnknownValue),
5629}
5630
5631#[doc(hidden)]
5632pub mod migration_step {
5633    #[allow(unused_imports)]
5634    use super::*;
5635    #[derive(Clone, Debug, PartialEq)]
5636    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5637}
5638
5639impl MigrationStep {
5640    /// Gets the enum value.
5641    ///
5642    /// Returns `None` if the enum contains an unknown value deserialized from
5643    /// the string representation of enums.
5644    pub fn value(&self) -> std::option::Option<i32> {
5645        match self {
5646            Self::Unspecified => std::option::Option::Some(0),
5647            Self::Prepare => std::option::Option::Some(6),
5648            Self::Start => std::option::Option::Some(1),
5649            Self::ApplyWritesSynchronously => std::option::Option::Some(7),
5650            Self::CopyAndVerify => std::option::Option::Some(2),
5651            Self::RedirectEventuallyConsistentReads => std::option::Option::Some(3),
5652            Self::RedirectStronglyConsistentReads => std::option::Option::Some(4),
5653            Self::RedirectWrites => std::option::Option::Some(5),
5654            Self::UnknownValue(u) => u.0.value(),
5655        }
5656    }
5657
5658    /// Gets the enum value as a string.
5659    ///
5660    /// Returns `None` if the enum contains an unknown value deserialized from
5661    /// the integer representation of enums.
5662    pub fn name(&self) -> std::option::Option<&str> {
5663        match self {
5664            Self::Unspecified => std::option::Option::Some("MIGRATION_STEP_UNSPECIFIED"),
5665            Self::Prepare => std::option::Option::Some("PREPARE"),
5666            Self::Start => std::option::Option::Some("START"),
5667            Self::ApplyWritesSynchronously => {
5668                std::option::Option::Some("APPLY_WRITES_SYNCHRONOUSLY")
5669            }
5670            Self::CopyAndVerify => std::option::Option::Some("COPY_AND_VERIFY"),
5671            Self::RedirectEventuallyConsistentReads => {
5672                std::option::Option::Some("REDIRECT_EVENTUALLY_CONSISTENT_READS")
5673            }
5674            Self::RedirectStronglyConsistentReads => {
5675                std::option::Option::Some("REDIRECT_STRONGLY_CONSISTENT_READS")
5676            }
5677            Self::RedirectWrites => std::option::Option::Some("REDIRECT_WRITES"),
5678            Self::UnknownValue(u) => u.0.name(),
5679        }
5680    }
5681}
5682
5683impl std::default::Default for MigrationStep {
5684    fn default() -> Self {
5685        use std::convert::From;
5686        Self::from(0)
5687    }
5688}
5689
5690impl std::fmt::Display for MigrationStep {
5691    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5692        wkt::internal::display_enum(f, self.name(), self.value())
5693    }
5694}
5695
5696impl std::convert::From<i32> for MigrationStep {
5697    fn from(value: i32) -> Self {
5698        match value {
5699            0 => Self::Unspecified,
5700            1 => Self::Start,
5701            2 => Self::CopyAndVerify,
5702            3 => Self::RedirectEventuallyConsistentReads,
5703            4 => Self::RedirectStronglyConsistentReads,
5704            5 => Self::RedirectWrites,
5705            6 => Self::Prepare,
5706            7 => Self::ApplyWritesSynchronously,
5707            _ => Self::UnknownValue(migration_step::UnknownValue(
5708                wkt::internal::UnknownEnumValue::Integer(value),
5709            )),
5710        }
5711    }
5712}
5713
5714impl std::convert::From<&str> for MigrationStep {
5715    fn from(value: &str) -> Self {
5716        use std::string::ToString;
5717        match value {
5718            "MIGRATION_STEP_UNSPECIFIED" => Self::Unspecified,
5719            "PREPARE" => Self::Prepare,
5720            "START" => Self::Start,
5721            "APPLY_WRITES_SYNCHRONOUSLY" => Self::ApplyWritesSynchronously,
5722            "COPY_AND_VERIFY" => Self::CopyAndVerify,
5723            "REDIRECT_EVENTUALLY_CONSISTENT_READS" => Self::RedirectEventuallyConsistentReads,
5724            "REDIRECT_STRONGLY_CONSISTENT_READS" => Self::RedirectStronglyConsistentReads,
5725            "REDIRECT_WRITES" => Self::RedirectWrites,
5726            _ => Self::UnknownValue(migration_step::UnknownValue(
5727                wkt::internal::UnknownEnumValue::String(value.to_string()),
5728            )),
5729        }
5730    }
5731}
5732
5733impl serde::ser::Serialize for MigrationStep {
5734    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5735    where
5736        S: serde::Serializer,
5737    {
5738        match self {
5739            Self::Unspecified => serializer.serialize_i32(0),
5740            Self::Prepare => serializer.serialize_i32(6),
5741            Self::Start => serializer.serialize_i32(1),
5742            Self::ApplyWritesSynchronously => serializer.serialize_i32(7),
5743            Self::CopyAndVerify => serializer.serialize_i32(2),
5744            Self::RedirectEventuallyConsistentReads => serializer.serialize_i32(3),
5745            Self::RedirectStronglyConsistentReads => serializer.serialize_i32(4),
5746            Self::RedirectWrites => serializer.serialize_i32(5),
5747            Self::UnknownValue(u) => u.0.serialize(serializer),
5748        }
5749    }
5750}
5751
5752impl<'de> serde::de::Deserialize<'de> for MigrationStep {
5753    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5754    where
5755        D: serde::Deserializer<'de>,
5756    {
5757        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationStep>::new(
5758            ".google.datastore.admin.v1.MigrationStep",
5759        ))
5760    }
5761}