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