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
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Metadata common to all Datastore Admin operations.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct CommonMetadata {
43    /// The time that work began on the operation.
44    pub start_time: std::option::Option<wkt::Timestamp>,
45
46    /// The time the operation ended, either successfully or otherwise.
47    pub end_time: std::option::Option<wkt::Timestamp>,
48
49    /// The type of the operation. Can be used as a filter in
50    /// ListOperationsRequest.
51    pub operation_type: crate::model::OperationType,
52
53    /// The client-assigned labels which were provided when the operation was
54    /// created. May also include additional labels.
55    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
56
57    /// The current state of the Operation.
58    pub state: crate::model::common_metadata::State,
59
60    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
61}
62
63impl CommonMetadata {
64    pub fn new() -> Self {
65        std::default::Default::default()
66    }
67
68    /// Sets the value of [start_time][crate::model::CommonMetadata::start_time].
69    pub fn set_start_time<T>(mut self, v: T) -> Self
70    where
71        T: std::convert::Into<wkt::Timestamp>,
72    {
73        self.start_time = std::option::Option::Some(v.into());
74        self
75    }
76
77    /// Sets or clears the value of [start_time][crate::model::CommonMetadata::start_time].
78    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
79    where
80        T: std::convert::Into<wkt::Timestamp>,
81    {
82        self.start_time = v.map(|x| x.into());
83        self
84    }
85
86    /// Sets the value of [end_time][crate::model::CommonMetadata::end_time].
87    pub fn set_end_time<T>(mut self, v: T) -> Self
88    where
89        T: std::convert::Into<wkt::Timestamp>,
90    {
91        self.end_time = std::option::Option::Some(v.into());
92        self
93    }
94
95    /// Sets or clears the value of [end_time][crate::model::CommonMetadata::end_time].
96    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
97    where
98        T: std::convert::Into<wkt::Timestamp>,
99    {
100        self.end_time = v.map(|x| x.into());
101        self
102    }
103
104    /// Sets the value of [operation_type][crate::model::CommonMetadata::operation_type].
105    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
106        mut self,
107        v: T,
108    ) -> Self {
109        self.operation_type = v.into();
110        self
111    }
112
113    /// Sets the value of [labels][crate::model::CommonMetadata::labels].
114    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
115    where
116        T: std::iter::IntoIterator<Item = (K, V)>,
117        K: std::convert::Into<std::string::String>,
118        V: std::convert::Into<std::string::String>,
119    {
120        use std::iter::Iterator;
121        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
122        self
123    }
124
125    /// Sets the value of [state][crate::model::CommonMetadata::state].
126    pub fn set_state<T: std::convert::Into<crate::model::common_metadata::State>>(
127        mut self,
128        v: T,
129    ) -> Self {
130        self.state = v.into();
131        self
132    }
133}
134
135impl wkt::message::Message for CommonMetadata {
136    fn typename() -> &'static str {
137        "type.googleapis.com/google.datastore.admin.v1.CommonMetadata"
138    }
139}
140
141/// Defines additional types related to [CommonMetadata].
142pub mod common_metadata {
143    #[allow(unused_imports)]
144    use super::*;
145
146    /// The various possible states for an ongoing Operation.
147    ///
148    /// # Working with unknown values
149    ///
150    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
151    /// additional enum variants at any time. Adding new variants is not considered
152    /// a breaking change. Applications should write their code in anticipation of:
153    ///
154    /// - New values appearing in future releases of the client library, **and**
155    /// - New values received dynamically, without application changes.
156    ///
157    /// Please consult the [Working with enums] section in the user guide for some
158    /// guidelines.
159    ///
160    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
161    #[derive(Clone, Debug, PartialEq)]
162    #[non_exhaustive]
163    pub enum State {
164        /// Unspecified.
165        Unspecified,
166        /// Request is being prepared for processing.
167        Initializing,
168        /// Request is actively being processed.
169        Processing,
170        /// Request is in the process of being cancelled after user called
171        /// google.longrunning.Operations.CancelOperation on the operation.
172        Cancelling,
173        /// Request has been processed and is in its finalization stage.
174        Finalizing,
175        /// Request has completed successfully.
176        Successful,
177        /// Request has finished being processed, but encountered an error.
178        Failed,
179        /// Request has finished being cancelled after user called
180        /// google.longrunning.Operations.CancelOperation.
181        Cancelled,
182        /// If set, the enum was initialized with an unknown value.
183        ///
184        /// Applications can examine the value using [State::value] or
185        /// [State::name].
186        UnknownValue(state::UnknownValue),
187    }
188
189    #[doc(hidden)]
190    pub mod state {
191        #[allow(unused_imports)]
192        use super::*;
193        #[derive(Clone, Debug, PartialEq)]
194        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
195    }
196
197    impl State {
198        /// Gets the enum value.
199        ///
200        /// Returns `None` if the enum contains an unknown value deserialized from
201        /// the string representation of enums.
202        pub fn value(&self) -> std::option::Option<i32> {
203            match self {
204                Self::Unspecified => std::option::Option::Some(0),
205                Self::Initializing => std::option::Option::Some(1),
206                Self::Processing => std::option::Option::Some(2),
207                Self::Cancelling => std::option::Option::Some(3),
208                Self::Finalizing => std::option::Option::Some(4),
209                Self::Successful => std::option::Option::Some(5),
210                Self::Failed => std::option::Option::Some(6),
211                Self::Cancelled => std::option::Option::Some(7),
212                Self::UnknownValue(u) => u.0.value(),
213            }
214        }
215
216        /// Gets the enum value as a string.
217        ///
218        /// Returns `None` if the enum contains an unknown value deserialized from
219        /// the integer representation of enums.
220        pub fn name(&self) -> std::option::Option<&str> {
221            match self {
222                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
223                Self::Initializing => std::option::Option::Some("INITIALIZING"),
224                Self::Processing => std::option::Option::Some("PROCESSING"),
225                Self::Cancelling => std::option::Option::Some("CANCELLING"),
226                Self::Finalizing => std::option::Option::Some("FINALIZING"),
227                Self::Successful => std::option::Option::Some("SUCCESSFUL"),
228                Self::Failed => std::option::Option::Some("FAILED"),
229                Self::Cancelled => std::option::Option::Some("CANCELLED"),
230                Self::UnknownValue(u) => u.0.name(),
231            }
232        }
233    }
234
235    impl std::default::Default for State {
236        fn default() -> Self {
237            use std::convert::From;
238            Self::from(0)
239        }
240    }
241
242    impl std::fmt::Display for State {
243        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
244            wkt::internal::display_enum(f, self.name(), self.value())
245        }
246    }
247
248    impl std::convert::From<i32> for State {
249        fn from(value: i32) -> Self {
250            match value {
251                0 => Self::Unspecified,
252                1 => Self::Initializing,
253                2 => Self::Processing,
254                3 => Self::Cancelling,
255                4 => Self::Finalizing,
256                5 => Self::Successful,
257                6 => Self::Failed,
258                7 => Self::Cancelled,
259                _ => Self::UnknownValue(state::UnknownValue(
260                    wkt::internal::UnknownEnumValue::Integer(value),
261                )),
262            }
263        }
264    }
265
266    impl std::convert::From<&str> for State {
267        fn from(value: &str) -> Self {
268            use std::string::ToString;
269            match value {
270                "STATE_UNSPECIFIED" => Self::Unspecified,
271                "INITIALIZING" => Self::Initializing,
272                "PROCESSING" => Self::Processing,
273                "CANCELLING" => Self::Cancelling,
274                "FINALIZING" => Self::Finalizing,
275                "SUCCESSFUL" => Self::Successful,
276                "FAILED" => Self::Failed,
277                "CANCELLED" => Self::Cancelled,
278                _ => Self::UnknownValue(state::UnknownValue(
279                    wkt::internal::UnknownEnumValue::String(value.to_string()),
280                )),
281            }
282        }
283    }
284
285    impl serde::ser::Serialize for State {
286        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
287        where
288            S: serde::Serializer,
289        {
290            match self {
291                Self::Unspecified => serializer.serialize_i32(0),
292                Self::Initializing => serializer.serialize_i32(1),
293                Self::Processing => serializer.serialize_i32(2),
294                Self::Cancelling => serializer.serialize_i32(3),
295                Self::Finalizing => serializer.serialize_i32(4),
296                Self::Successful => serializer.serialize_i32(5),
297                Self::Failed => serializer.serialize_i32(6),
298                Self::Cancelled => serializer.serialize_i32(7),
299                Self::UnknownValue(u) => u.0.serialize(serializer),
300            }
301        }
302    }
303
304    impl<'de> serde::de::Deserialize<'de> for State {
305        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
306        where
307            D: serde::Deserializer<'de>,
308        {
309            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
310                ".google.datastore.admin.v1.CommonMetadata.State",
311            ))
312        }
313    }
314}
315
316/// Measures the progress of a particular metric.
317#[derive(Clone, Default, PartialEq)]
318#[non_exhaustive]
319pub struct Progress {
320    /// The amount of work that has been completed. Note that this may be greater
321    /// than work_estimated.
322    pub work_completed: i64,
323
324    /// An estimate of how much work needs to be performed. May be zero if the
325    /// work estimate is unavailable.
326    pub work_estimated: i64,
327
328    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
329}
330
331impl Progress {
332    pub fn new() -> Self {
333        std::default::Default::default()
334    }
335
336    /// Sets the value of [work_completed][crate::model::Progress::work_completed].
337    pub fn set_work_completed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
338        self.work_completed = v.into();
339        self
340    }
341
342    /// Sets the value of [work_estimated][crate::model::Progress::work_estimated].
343    pub fn set_work_estimated<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
344        self.work_estimated = v.into();
345        self
346    }
347}
348
349impl wkt::message::Message for Progress {
350    fn typename() -> &'static str {
351        "type.googleapis.com/google.datastore.admin.v1.Progress"
352    }
353}
354
355/// The request for
356/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
357///
358/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
359#[derive(Clone, Default, PartialEq)]
360#[non_exhaustive]
361pub struct ExportEntitiesRequest {
362    /// Required. Project ID against which to make the request.
363    pub project_id: std::string::String,
364
365    /// Client-assigned labels.
366    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
367
368    /// Description of what data from the project is included in the export.
369    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
370
371    /// Required. Location for the export metadata and data files.
372    ///
373    /// The full resource URL of the external storage location. Currently, only
374    /// Google Cloud Storage is supported. So output_url_prefix should be of the
375    /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
376    /// name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud
377    /// Storage namespace path (this is not a Cloud Datastore namespace). For more
378    /// information about Cloud Storage namespace paths, see
379    /// [Object name
380    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
381    ///
382    /// The resulting files will be nested deeper than the specified URL prefix.
383    /// The final output URL will be provided in the
384    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
385    /// field. That value should be used for subsequent ImportEntities operations.
386    ///
387    /// By nesting the data files deeper, the same Cloud Storage bucket can be used
388    /// in multiple ExportEntities operations without conflict.
389    ///
390    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
391    pub output_url_prefix: std::string::String,
392
393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
394}
395
396impl ExportEntitiesRequest {
397    pub fn new() -> Self {
398        std::default::Default::default()
399    }
400
401    /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
402    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
403        self.project_id = v.into();
404        self
405    }
406
407    /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
408    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
409    where
410        T: std::iter::IntoIterator<Item = (K, V)>,
411        K: std::convert::Into<std::string::String>,
412        V: std::convert::Into<std::string::String>,
413    {
414        use std::iter::Iterator;
415        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
416        self
417    }
418
419    /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
420    pub fn set_entity_filter<T>(mut self, v: T) -> Self
421    where
422        T: std::convert::Into<crate::model::EntityFilter>,
423    {
424        self.entity_filter = std::option::Option::Some(v.into());
425        self
426    }
427
428    /// Sets or clears the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
429    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
430    where
431        T: std::convert::Into<crate::model::EntityFilter>,
432    {
433        self.entity_filter = v.map(|x| x.into());
434        self
435    }
436
437    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
438    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
439        mut self,
440        v: T,
441    ) -> Self {
442        self.output_url_prefix = v.into();
443        self
444    }
445}
446
447impl wkt::message::Message for ExportEntitiesRequest {
448    fn typename() -> &'static str {
449        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesRequest"
450    }
451}
452
453/// The request for
454/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities].
455///
456/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities]: crate::client::DatastoreAdmin::import_entities
457#[derive(Clone, Default, PartialEq)]
458#[non_exhaustive]
459pub struct ImportEntitiesRequest {
460    /// Required. Project ID against which to make the request.
461    pub project_id: std::string::String,
462
463    /// Client-assigned labels.
464    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
465
466    /// Required. The full resource URL of the external storage location.
467    /// Currently, only Google Cloud Storage is supported. So input_url should be
468    /// of the form:
469    /// `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where
470    /// `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is
471    /// an optional Cloud Storage namespace path (this is not a Cloud Datastore
472    /// namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written
473    /// by the ExportEntities operation. For more information about Cloud Storage
474    /// namespace paths, see
475    /// [Object name
476    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
477    ///
478    /// For more information, see
479    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
480    ///
481    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
482    pub input_url: std::string::String,
483
484    /// Optionally specify which kinds/namespaces are to be imported. If provided,
485    /// the list must be a subset of the EntityFilter used in creating the export,
486    /// otherwise a FAILED_PRECONDITION error will be returned. If no filter is
487    /// specified then all entities from the export are imported.
488    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
489
490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
491}
492
493impl ImportEntitiesRequest {
494    pub fn new() -> Self {
495        std::default::Default::default()
496    }
497
498    /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
499    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
500        self.project_id = v.into();
501        self
502    }
503
504    /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
505    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
506    where
507        T: std::iter::IntoIterator<Item = (K, V)>,
508        K: std::convert::Into<std::string::String>,
509        V: std::convert::Into<std::string::String>,
510    {
511        use std::iter::Iterator;
512        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
513        self
514    }
515
516    /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
517    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
518        self.input_url = v.into();
519        self
520    }
521
522    /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
523    pub fn set_entity_filter<T>(mut self, v: T) -> Self
524    where
525        T: std::convert::Into<crate::model::EntityFilter>,
526    {
527        self.entity_filter = std::option::Option::Some(v.into());
528        self
529    }
530
531    /// Sets or clears the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
532    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
533    where
534        T: std::convert::Into<crate::model::EntityFilter>,
535    {
536        self.entity_filter = v.map(|x| x.into());
537        self
538    }
539}
540
541impl wkt::message::Message for ImportEntitiesRequest {
542    fn typename() -> &'static str {
543        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesRequest"
544    }
545}
546
547/// The response for
548/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
549///
550/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
551#[derive(Clone, Default, PartialEq)]
552#[non_exhaustive]
553pub struct ExportEntitiesResponse {
554    /// Location of the output metadata file. This can be used to begin an import
555    /// into Cloud Datastore (this project or another project). See
556    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url].
557    /// Only present if the operation completed successfully.
558    ///
559    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url]: crate::model::ImportEntitiesRequest::input_url
560    pub output_url: std::string::String,
561
562    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
563}
564
565impl ExportEntitiesResponse {
566    pub fn new() -> Self {
567        std::default::Default::default()
568    }
569
570    /// Sets the value of [output_url][crate::model::ExportEntitiesResponse::output_url].
571    pub fn set_output_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
572        self.output_url = v.into();
573        self
574    }
575}
576
577impl wkt::message::Message for ExportEntitiesResponse {
578    fn typename() -> &'static str {
579        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesResponse"
580    }
581}
582
583/// Metadata for ExportEntities operations.
584#[derive(Clone, Default, PartialEq)]
585#[non_exhaustive]
586pub struct ExportEntitiesMetadata {
587    /// Metadata common to all Datastore Admin operations.
588    pub common: std::option::Option<crate::model::CommonMetadata>,
589
590    /// An estimate of the number of entities processed.
591    pub progress_entities: std::option::Option<crate::model::Progress>,
592
593    /// An estimate of the number of bytes processed.
594    pub progress_bytes: std::option::Option<crate::model::Progress>,
595
596    /// Description of which entities are being exported.
597    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
598
599    /// Location for the export metadata and data files. This will be the same
600    /// value as the
601    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]
602    /// field. The final output location is provided in
603    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
604    ///
605    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]: crate::model::ExportEntitiesRequest::output_url_prefix
606    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
607    pub output_url_prefix: std::string::String,
608
609    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
610}
611
612impl ExportEntitiesMetadata {
613    pub fn new() -> Self {
614        std::default::Default::default()
615    }
616
617    /// Sets the value of [common][crate::model::ExportEntitiesMetadata::common].
618    pub fn set_common<T>(mut self, v: T) -> Self
619    where
620        T: std::convert::Into<crate::model::CommonMetadata>,
621    {
622        self.common = std::option::Option::Some(v.into());
623        self
624    }
625
626    /// Sets or clears the value of [common][crate::model::ExportEntitiesMetadata::common].
627    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
628    where
629        T: std::convert::Into<crate::model::CommonMetadata>,
630    {
631        self.common = v.map(|x| x.into());
632        self
633    }
634
635    /// Sets the value of [progress_entities][crate::model::ExportEntitiesMetadata::progress_entities].
636    pub fn set_progress_entities<T>(mut self, v: T) -> Self
637    where
638        T: std::convert::Into<crate::model::Progress>,
639    {
640        self.progress_entities = std::option::Option::Some(v.into());
641        self
642    }
643
644    /// Sets or clears the value of [progress_entities][crate::model::ExportEntitiesMetadata::progress_entities].
645    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
646    where
647        T: std::convert::Into<crate::model::Progress>,
648    {
649        self.progress_entities = v.map(|x| x.into());
650        self
651    }
652
653    /// Sets the value of [progress_bytes][crate::model::ExportEntitiesMetadata::progress_bytes].
654    pub fn set_progress_bytes<T>(mut self, v: T) -> Self
655    where
656        T: std::convert::Into<crate::model::Progress>,
657    {
658        self.progress_bytes = std::option::Option::Some(v.into());
659        self
660    }
661
662    /// Sets or clears the value of [progress_bytes][crate::model::ExportEntitiesMetadata::progress_bytes].
663    pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
664    where
665        T: std::convert::Into<crate::model::Progress>,
666    {
667        self.progress_bytes = v.map(|x| x.into());
668        self
669    }
670
671    /// Sets the value of [entity_filter][crate::model::ExportEntitiesMetadata::entity_filter].
672    pub fn set_entity_filter<T>(mut self, v: T) -> Self
673    where
674        T: std::convert::Into<crate::model::EntityFilter>,
675    {
676        self.entity_filter = std::option::Option::Some(v.into());
677        self
678    }
679
680    /// Sets or clears the value of [entity_filter][crate::model::ExportEntitiesMetadata::entity_filter].
681    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
682    where
683        T: std::convert::Into<crate::model::EntityFilter>,
684    {
685        self.entity_filter = v.map(|x| x.into());
686        self
687    }
688
689    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesMetadata::output_url_prefix].
690    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
691        mut self,
692        v: T,
693    ) -> Self {
694        self.output_url_prefix = v.into();
695        self
696    }
697}
698
699impl wkt::message::Message for ExportEntitiesMetadata {
700    fn typename() -> &'static str {
701        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata"
702    }
703}
704
705/// Metadata for ImportEntities operations.
706#[derive(Clone, Default, PartialEq)]
707#[non_exhaustive]
708pub struct ImportEntitiesMetadata {
709    /// Metadata common to all Datastore Admin operations.
710    pub common: std::option::Option<crate::model::CommonMetadata>,
711
712    /// An estimate of the number of entities processed.
713    pub progress_entities: std::option::Option<crate::model::Progress>,
714
715    /// An estimate of the number of bytes processed.
716    pub progress_bytes: std::option::Option<crate::model::Progress>,
717
718    /// Description of which entities are being imported.
719    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
720
721    /// The location of the import metadata file. This will be the same value as
722    /// the
723    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
724    /// field.
725    ///
726    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
727    pub input_url: std::string::String,
728
729    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
730}
731
732impl ImportEntitiesMetadata {
733    pub fn new() -> Self {
734        std::default::Default::default()
735    }
736
737    /// Sets the value of [common][crate::model::ImportEntitiesMetadata::common].
738    pub fn set_common<T>(mut self, v: T) -> Self
739    where
740        T: std::convert::Into<crate::model::CommonMetadata>,
741    {
742        self.common = std::option::Option::Some(v.into());
743        self
744    }
745
746    /// Sets or clears the value of [common][crate::model::ImportEntitiesMetadata::common].
747    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
748    where
749        T: std::convert::Into<crate::model::CommonMetadata>,
750    {
751        self.common = v.map(|x| x.into());
752        self
753    }
754
755    /// Sets the value of [progress_entities][crate::model::ImportEntitiesMetadata::progress_entities].
756    pub fn set_progress_entities<T>(mut self, v: T) -> Self
757    where
758        T: std::convert::Into<crate::model::Progress>,
759    {
760        self.progress_entities = std::option::Option::Some(v.into());
761        self
762    }
763
764    /// Sets or clears the value of [progress_entities][crate::model::ImportEntitiesMetadata::progress_entities].
765    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
766    where
767        T: std::convert::Into<crate::model::Progress>,
768    {
769        self.progress_entities = v.map(|x| x.into());
770        self
771    }
772
773    /// Sets the value of [progress_bytes][crate::model::ImportEntitiesMetadata::progress_bytes].
774    pub fn set_progress_bytes<T>(mut self, v: T) -> Self
775    where
776        T: std::convert::Into<crate::model::Progress>,
777    {
778        self.progress_bytes = std::option::Option::Some(v.into());
779        self
780    }
781
782    /// Sets or clears the value of [progress_bytes][crate::model::ImportEntitiesMetadata::progress_bytes].
783    pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
784    where
785        T: std::convert::Into<crate::model::Progress>,
786    {
787        self.progress_bytes = v.map(|x| x.into());
788        self
789    }
790
791    /// Sets the value of [entity_filter][crate::model::ImportEntitiesMetadata::entity_filter].
792    pub fn set_entity_filter<T>(mut self, v: T) -> Self
793    where
794        T: std::convert::Into<crate::model::EntityFilter>,
795    {
796        self.entity_filter = std::option::Option::Some(v.into());
797        self
798    }
799
800    /// Sets or clears the value of [entity_filter][crate::model::ImportEntitiesMetadata::entity_filter].
801    pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
802    where
803        T: std::convert::Into<crate::model::EntityFilter>,
804    {
805        self.entity_filter = v.map(|x| x.into());
806        self
807    }
808
809    /// Sets the value of [input_url][crate::model::ImportEntitiesMetadata::input_url].
810    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
811        self.input_url = v.into();
812        self
813    }
814}
815
816impl wkt::message::Message for ImportEntitiesMetadata {
817    fn typename() -> &'static str {
818        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesMetadata"
819    }
820}
821
822/// Identifies a subset of entities in a project. This is specified as
823/// combinations of kinds and namespaces (either or both of which may be all, as
824/// described in the following examples).
825/// Example usage:
826///
827/// Entire project:
828/// kinds=[], namespace_ids=[]
829///
830/// Kinds Foo and Bar in all namespaces:
831/// kinds=['Foo', 'Bar'], namespace_ids=[]
832///
833/// Kinds Foo and Bar only in the default namespace:
834/// kinds=['Foo', 'Bar'], namespace_ids=['']
835///
836/// Kinds Foo and Bar in both the default and Baz namespaces:
837/// kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
838///
839/// The entire Baz namespace:
840/// kinds=[], namespace_ids=['Baz']
841#[derive(Clone, Default, PartialEq)]
842#[non_exhaustive]
843pub struct EntityFilter {
844    /// If empty, then this represents all kinds.
845    pub kinds: std::vec::Vec<std::string::String>,
846
847    /// An empty list represents all namespaces. This is the preferred
848    /// usage for projects that don't use namespaces.
849    ///
850    /// An empty string element represents the default namespace. This should be
851    /// used if the project has data in non-default namespaces, but doesn't want to
852    /// include them.
853    /// Each namespace in this list must be unique.
854    pub namespace_ids: std::vec::Vec<std::string::String>,
855
856    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
857}
858
859impl EntityFilter {
860    pub fn new() -> Self {
861        std::default::Default::default()
862    }
863
864    /// Sets the value of [kinds][crate::model::EntityFilter::kinds].
865    pub fn set_kinds<T, V>(mut self, v: T) -> Self
866    where
867        T: std::iter::IntoIterator<Item = V>,
868        V: std::convert::Into<std::string::String>,
869    {
870        use std::iter::Iterator;
871        self.kinds = v.into_iter().map(|i| i.into()).collect();
872        self
873    }
874
875    /// Sets the value of [namespace_ids][crate::model::EntityFilter::namespace_ids].
876    pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
877    where
878        T: std::iter::IntoIterator<Item = V>,
879        V: std::convert::Into<std::string::String>,
880    {
881        use std::iter::Iterator;
882        self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
883        self
884    }
885}
886
887impl wkt::message::Message for EntityFilter {
888    fn typename() -> &'static str {
889        "type.googleapis.com/google.datastore.admin.v1.EntityFilter"
890    }
891}
892
893/// The request for
894/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
895///
896/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]: crate::client::DatastoreAdmin::create_index
897#[derive(Clone, Default, PartialEq)]
898#[non_exhaustive]
899pub struct CreateIndexRequest {
900    /// Project ID against which to make the request.
901    pub project_id: std::string::String,
902
903    /// The index to create. The name and state fields are output only and will be
904    /// ignored. Single property indexes cannot be created or deleted.
905    pub index: std::option::Option<crate::model::Index>,
906
907    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
908}
909
910impl CreateIndexRequest {
911    pub fn new() -> Self {
912        std::default::Default::default()
913    }
914
915    /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
916    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
917        self.project_id = v.into();
918        self
919    }
920
921    /// Sets the value of [index][crate::model::CreateIndexRequest::index].
922    pub fn set_index<T>(mut self, v: T) -> Self
923    where
924        T: std::convert::Into<crate::model::Index>,
925    {
926        self.index = std::option::Option::Some(v.into());
927        self
928    }
929
930    /// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
931    pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
932    where
933        T: std::convert::Into<crate::model::Index>,
934    {
935        self.index = v.map(|x| x.into());
936        self
937    }
938}
939
940impl wkt::message::Message for CreateIndexRequest {
941    fn typename() -> &'static str {
942        "type.googleapis.com/google.datastore.admin.v1.CreateIndexRequest"
943    }
944}
945
946/// The request for
947/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex].
948///
949/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex]: crate::client::DatastoreAdmin::delete_index
950#[derive(Clone, Default, PartialEq)]
951#[non_exhaustive]
952pub struct DeleteIndexRequest {
953    /// Project ID against which to make the request.
954    pub project_id: std::string::String,
955
956    /// The resource ID of the index to delete.
957    pub index_id: std::string::String,
958
959    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
960}
961
962impl DeleteIndexRequest {
963    pub fn new() -> Self {
964        std::default::Default::default()
965    }
966
967    /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
968    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
969        self.project_id = v.into();
970        self
971    }
972
973    /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
974    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
975        self.index_id = v.into();
976        self
977    }
978}
979
980impl wkt::message::Message for DeleteIndexRequest {
981    fn typename() -> &'static str {
982        "type.googleapis.com/google.datastore.admin.v1.DeleteIndexRequest"
983    }
984}
985
986/// The request for
987/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex].
988///
989/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex]: crate::client::DatastoreAdmin::get_index
990#[derive(Clone, Default, PartialEq)]
991#[non_exhaustive]
992pub struct GetIndexRequest {
993    /// Project ID against which to make the request.
994    pub project_id: std::string::String,
995
996    /// The resource ID of the index to get.
997    pub index_id: std::string::String,
998
999    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1000}
1001
1002impl GetIndexRequest {
1003    pub fn new() -> Self {
1004        std::default::Default::default()
1005    }
1006
1007    /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
1008    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1009        self.project_id = v.into();
1010        self
1011    }
1012
1013    /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
1014    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1015        self.index_id = v.into();
1016        self
1017    }
1018}
1019
1020impl wkt::message::Message for GetIndexRequest {
1021    fn typename() -> &'static str {
1022        "type.googleapis.com/google.datastore.admin.v1.GetIndexRequest"
1023    }
1024}
1025
1026/// The request for
1027/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
1028///
1029/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
1030#[derive(Clone, Default, PartialEq)]
1031#[non_exhaustive]
1032pub struct ListIndexesRequest {
1033    /// Project ID against which to make the request.
1034    pub project_id: std::string::String,
1035
1036    pub filter: std::string::String,
1037
1038    /// The maximum number of items to return.  If zero, then all results will be
1039    /// returned.
1040    pub page_size: i32,
1041
1042    /// The next_page_token value returned from a previous List request, if any.
1043    pub page_token: std::string::String,
1044
1045    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1046}
1047
1048impl ListIndexesRequest {
1049    pub fn new() -> Self {
1050        std::default::Default::default()
1051    }
1052
1053    /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
1054    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1055        self.project_id = v.into();
1056        self
1057    }
1058
1059    /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
1060    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1061        self.filter = v.into();
1062        self
1063    }
1064
1065    /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
1066    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1067        self.page_size = v.into();
1068        self
1069    }
1070
1071    /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
1072    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1073        self.page_token = v.into();
1074        self
1075    }
1076}
1077
1078impl wkt::message::Message for ListIndexesRequest {
1079    fn typename() -> &'static str {
1080        "type.googleapis.com/google.datastore.admin.v1.ListIndexesRequest"
1081    }
1082}
1083
1084/// The response for
1085/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
1086///
1087/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
1088#[derive(Clone, Default, PartialEq)]
1089#[non_exhaustive]
1090pub struct ListIndexesResponse {
1091    /// The indexes.
1092    pub indexes: std::vec::Vec<crate::model::Index>,
1093
1094    /// The standard List next-page token.
1095    pub next_page_token: std::string::String,
1096
1097    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1098}
1099
1100impl ListIndexesResponse {
1101    pub fn new() -> Self {
1102        std::default::Default::default()
1103    }
1104
1105    /// Sets the value of [indexes][crate::model::ListIndexesResponse::indexes].
1106    pub fn set_indexes<T, V>(mut self, v: T) -> Self
1107    where
1108        T: std::iter::IntoIterator<Item = V>,
1109        V: std::convert::Into<crate::model::Index>,
1110    {
1111        use std::iter::Iterator;
1112        self.indexes = v.into_iter().map(|i| i.into()).collect();
1113        self
1114    }
1115
1116    /// Sets the value of [next_page_token][crate::model::ListIndexesResponse::next_page_token].
1117    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1118        self.next_page_token = v.into();
1119        self
1120    }
1121}
1122
1123impl wkt::message::Message for ListIndexesResponse {
1124    fn typename() -> &'static str {
1125        "type.googleapis.com/google.datastore.admin.v1.ListIndexesResponse"
1126    }
1127}
1128
1129#[doc(hidden)]
1130impl gax::paginator::internal::PageableResponse for ListIndexesResponse {
1131    type PageItem = crate::model::Index;
1132
1133    fn items(self) -> std::vec::Vec<Self::PageItem> {
1134        self.indexes
1135    }
1136
1137    fn next_page_token(&self) -> std::string::String {
1138        use std::clone::Clone;
1139        self.next_page_token.clone()
1140    }
1141}
1142
1143/// Metadata for Index operations.
1144#[derive(Clone, Default, PartialEq)]
1145#[non_exhaustive]
1146pub struct IndexOperationMetadata {
1147    /// Metadata common to all Datastore Admin operations.
1148    pub common: std::option::Option<crate::model::CommonMetadata>,
1149
1150    /// An estimate of the number of entities processed.
1151    pub progress_entities: std::option::Option<crate::model::Progress>,
1152
1153    /// The index resource ID that this operation is acting on.
1154    pub index_id: std::string::String,
1155
1156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1157}
1158
1159impl IndexOperationMetadata {
1160    pub fn new() -> Self {
1161        std::default::Default::default()
1162    }
1163
1164    /// Sets the value of [common][crate::model::IndexOperationMetadata::common].
1165    pub fn set_common<T>(mut self, v: T) -> Self
1166    where
1167        T: std::convert::Into<crate::model::CommonMetadata>,
1168    {
1169        self.common = std::option::Option::Some(v.into());
1170        self
1171    }
1172
1173    /// Sets or clears the value of [common][crate::model::IndexOperationMetadata::common].
1174    pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
1175    where
1176        T: std::convert::Into<crate::model::CommonMetadata>,
1177    {
1178        self.common = v.map(|x| x.into());
1179        self
1180    }
1181
1182    /// Sets the value of [progress_entities][crate::model::IndexOperationMetadata::progress_entities].
1183    pub fn set_progress_entities<T>(mut self, v: T) -> Self
1184    where
1185        T: std::convert::Into<crate::model::Progress>,
1186    {
1187        self.progress_entities = std::option::Option::Some(v.into());
1188        self
1189    }
1190
1191    /// Sets or clears the value of [progress_entities][crate::model::IndexOperationMetadata::progress_entities].
1192    pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
1193    where
1194        T: std::convert::Into<crate::model::Progress>,
1195    {
1196        self.progress_entities = v.map(|x| x.into());
1197        self
1198    }
1199
1200    /// Sets the value of [index_id][crate::model::IndexOperationMetadata::index_id].
1201    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1202        self.index_id = v.into();
1203        self
1204    }
1205}
1206
1207impl wkt::message::Message for IndexOperationMetadata {
1208    fn typename() -> &'static str {
1209        "type.googleapis.com/google.datastore.admin.v1.IndexOperationMetadata"
1210    }
1211}
1212
1213/// Metadata for Datastore to Firestore migration operations.
1214///
1215/// The DatastoreFirestoreMigration operation is not started by the end-user via
1216/// an explicit "creation" method. This is an intentional deviation from the LRO
1217/// design pattern.
1218///
1219/// This singleton resource can be accessed at:
1220/// "projects/{project_id}/operations/datastore-firestore-migration"
1221#[derive(Clone, Default, PartialEq)]
1222#[non_exhaustive]
1223pub struct DatastoreFirestoreMigrationMetadata {
1224    /// The current state of migration from Cloud Datastore to Cloud Firestore in
1225    /// Datastore mode.
1226    pub migration_state: crate::model::MigrationState,
1227
1228    /// The current step of migration from Cloud Datastore to Cloud Firestore in
1229    /// Datastore mode.
1230    pub migration_step: crate::model::MigrationStep,
1231
1232    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1233}
1234
1235impl DatastoreFirestoreMigrationMetadata {
1236    pub fn new() -> Self {
1237        std::default::Default::default()
1238    }
1239
1240    /// Sets the value of [migration_state][crate::model::DatastoreFirestoreMigrationMetadata::migration_state].
1241    pub fn set_migration_state<T: std::convert::Into<crate::model::MigrationState>>(
1242        mut self,
1243        v: T,
1244    ) -> Self {
1245        self.migration_state = v.into();
1246        self
1247    }
1248
1249    /// Sets the value of [migration_step][crate::model::DatastoreFirestoreMigrationMetadata::migration_step].
1250    pub fn set_migration_step<T: std::convert::Into<crate::model::MigrationStep>>(
1251        mut self,
1252        v: T,
1253    ) -> Self {
1254        self.migration_step = v.into();
1255        self
1256    }
1257}
1258
1259impl wkt::message::Message for DatastoreFirestoreMigrationMetadata {
1260    fn typename() -> &'static str {
1261        "type.googleapis.com/google.datastore.admin.v1.DatastoreFirestoreMigrationMetadata"
1262    }
1263}
1264
1265/// Datastore composite index definition.
1266#[derive(Clone, Default, PartialEq)]
1267#[non_exhaustive]
1268pub struct Index {
1269    /// Output only. Project ID.
1270    pub project_id: std::string::String,
1271
1272    /// Output only. The resource ID of the index.
1273    pub index_id: std::string::String,
1274
1275    /// Required. The entity kind to which this index applies.
1276    pub kind: std::string::String,
1277
1278    /// Required. The index's ancestor mode.  Must not be
1279    /// ANCESTOR_MODE_UNSPECIFIED.
1280    pub ancestor: crate::model::index::AncestorMode,
1281
1282    /// Required. An ordered sequence of property names and their index attributes.
1283    ///
1284    /// Requires:
1285    ///
1286    /// * A maximum of 100 properties.
1287    pub properties: std::vec::Vec<crate::model::index::IndexedProperty>,
1288
1289    /// Output only. The state of the index.
1290    pub state: crate::model::index::State,
1291
1292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1293}
1294
1295impl Index {
1296    pub fn new() -> Self {
1297        std::default::Default::default()
1298    }
1299
1300    /// Sets the value of [project_id][crate::model::Index::project_id].
1301    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1302        self.project_id = v.into();
1303        self
1304    }
1305
1306    /// Sets the value of [index_id][crate::model::Index::index_id].
1307    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1308        self.index_id = v.into();
1309        self
1310    }
1311
1312    /// Sets the value of [kind][crate::model::Index::kind].
1313    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314        self.kind = v.into();
1315        self
1316    }
1317
1318    /// Sets the value of [ancestor][crate::model::Index::ancestor].
1319    pub fn set_ancestor<T: std::convert::Into<crate::model::index::AncestorMode>>(
1320        mut self,
1321        v: T,
1322    ) -> Self {
1323        self.ancestor = v.into();
1324        self
1325    }
1326
1327    /// Sets the value of [properties][crate::model::Index::properties].
1328    pub fn set_properties<T, V>(mut self, v: T) -> Self
1329    where
1330        T: std::iter::IntoIterator<Item = V>,
1331        V: std::convert::Into<crate::model::index::IndexedProperty>,
1332    {
1333        use std::iter::Iterator;
1334        self.properties = v.into_iter().map(|i| i.into()).collect();
1335        self
1336    }
1337
1338    /// Sets the value of [state][crate::model::Index::state].
1339    pub fn set_state<T: std::convert::Into<crate::model::index::State>>(mut self, v: T) -> Self {
1340        self.state = v.into();
1341        self
1342    }
1343}
1344
1345impl wkt::message::Message for Index {
1346    fn typename() -> &'static str {
1347        "type.googleapis.com/google.datastore.admin.v1.Index"
1348    }
1349}
1350
1351/// Defines additional types related to [Index].
1352pub mod index {
1353    #[allow(unused_imports)]
1354    use super::*;
1355
1356    /// A property of an index.
1357    #[derive(Clone, Default, PartialEq)]
1358    #[non_exhaustive]
1359    pub struct IndexedProperty {
1360        /// Required. The property name to index.
1361        pub name: std::string::String,
1362
1363        /// Required. The indexed property's direction.  Must not be
1364        /// DIRECTION_UNSPECIFIED.
1365        pub direction: crate::model::index::Direction,
1366
1367        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1368    }
1369
1370    impl IndexedProperty {
1371        pub fn new() -> Self {
1372            std::default::Default::default()
1373        }
1374
1375        /// Sets the value of [name][crate::model::index::IndexedProperty::name].
1376        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1377            self.name = v.into();
1378            self
1379        }
1380
1381        /// Sets the value of [direction][crate::model::index::IndexedProperty::direction].
1382        pub fn set_direction<T: std::convert::Into<crate::model::index::Direction>>(
1383            mut self,
1384            v: T,
1385        ) -> Self {
1386            self.direction = v.into();
1387            self
1388        }
1389    }
1390
1391    impl wkt::message::Message for IndexedProperty {
1392        fn typename() -> &'static str {
1393            "type.googleapis.com/google.datastore.admin.v1.Index.IndexedProperty"
1394        }
1395    }
1396
1397    /// For an ordered index, specifies whether each of the entity's ancestors
1398    /// will be included.
1399    ///
1400    /// # Working with unknown values
1401    ///
1402    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1403    /// additional enum variants at any time. Adding new variants is not considered
1404    /// a breaking change. Applications should write their code in anticipation of:
1405    ///
1406    /// - New values appearing in future releases of the client library, **and**
1407    /// - New values received dynamically, without application changes.
1408    ///
1409    /// Please consult the [Working with enums] section in the user guide for some
1410    /// guidelines.
1411    ///
1412    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1413    #[derive(Clone, Debug, PartialEq)]
1414    #[non_exhaustive]
1415    pub enum AncestorMode {
1416        /// The ancestor mode is unspecified.
1417        Unspecified,
1418        /// Do not include the entity's ancestors in the index.
1419        None,
1420        /// Include all the entity's ancestors in the index.
1421        AllAncestors,
1422        /// If set, the enum was initialized with an unknown value.
1423        ///
1424        /// Applications can examine the value using [AncestorMode::value] or
1425        /// [AncestorMode::name].
1426        UnknownValue(ancestor_mode::UnknownValue),
1427    }
1428
1429    #[doc(hidden)]
1430    pub mod ancestor_mode {
1431        #[allow(unused_imports)]
1432        use super::*;
1433        #[derive(Clone, Debug, PartialEq)]
1434        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1435    }
1436
1437    impl AncestorMode {
1438        /// Gets the enum value.
1439        ///
1440        /// Returns `None` if the enum contains an unknown value deserialized from
1441        /// the string representation of enums.
1442        pub fn value(&self) -> std::option::Option<i32> {
1443            match self {
1444                Self::Unspecified => std::option::Option::Some(0),
1445                Self::None => std::option::Option::Some(1),
1446                Self::AllAncestors => std::option::Option::Some(2),
1447                Self::UnknownValue(u) => u.0.value(),
1448            }
1449        }
1450
1451        /// Gets the enum value as a string.
1452        ///
1453        /// Returns `None` if the enum contains an unknown value deserialized from
1454        /// the integer representation of enums.
1455        pub fn name(&self) -> std::option::Option<&str> {
1456            match self {
1457                Self::Unspecified => std::option::Option::Some("ANCESTOR_MODE_UNSPECIFIED"),
1458                Self::None => std::option::Option::Some("NONE"),
1459                Self::AllAncestors => std::option::Option::Some("ALL_ANCESTORS"),
1460                Self::UnknownValue(u) => u.0.name(),
1461            }
1462        }
1463    }
1464
1465    impl std::default::Default for AncestorMode {
1466        fn default() -> Self {
1467            use std::convert::From;
1468            Self::from(0)
1469        }
1470    }
1471
1472    impl std::fmt::Display for AncestorMode {
1473        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1474            wkt::internal::display_enum(f, self.name(), self.value())
1475        }
1476    }
1477
1478    impl std::convert::From<i32> for AncestorMode {
1479        fn from(value: i32) -> Self {
1480            match value {
1481                0 => Self::Unspecified,
1482                1 => Self::None,
1483                2 => Self::AllAncestors,
1484                _ => Self::UnknownValue(ancestor_mode::UnknownValue(
1485                    wkt::internal::UnknownEnumValue::Integer(value),
1486                )),
1487            }
1488        }
1489    }
1490
1491    impl std::convert::From<&str> for AncestorMode {
1492        fn from(value: &str) -> Self {
1493            use std::string::ToString;
1494            match value {
1495                "ANCESTOR_MODE_UNSPECIFIED" => Self::Unspecified,
1496                "NONE" => Self::None,
1497                "ALL_ANCESTORS" => Self::AllAncestors,
1498                _ => Self::UnknownValue(ancestor_mode::UnknownValue(
1499                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1500                )),
1501            }
1502        }
1503    }
1504
1505    impl serde::ser::Serialize for AncestorMode {
1506        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1507        where
1508            S: serde::Serializer,
1509        {
1510            match self {
1511                Self::Unspecified => serializer.serialize_i32(0),
1512                Self::None => serializer.serialize_i32(1),
1513                Self::AllAncestors => serializer.serialize_i32(2),
1514                Self::UnknownValue(u) => u.0.serialize(serializer),
1515            }
1516        }
1517    }
1518
1519    impl<'de> serde::de::Deserialize<'de> for AncestorMode {
1520        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1521        where
1522            D: serde::Deserializer<'de>,
1523        {
1524            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AncestorMode>::new(
1525                ".google.datastore.admin.v1.Index.AncestorMode",
1526            ))
1527        }
1528    }
1529
1530    /// The direction determines how a property is indexed.
1531    ///
1532    /// # Working with unknown values
1533    ///
1534    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1535    /// additional enum variants at any time. Adding new variants is not considered
1536    /// a breaking change. Applications should write their code in anticipation of:
1537    ///
1538    /// - New values appearing in future releases of the client library, **and**
1539    /// - New values received dynamically, without application changes.
1540    ///
1541    /// Please consult the [Working with enums] section in the user guide for some
1542    /// guidelines.
1543    ///
1544    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1545    #[derive(Clone, Debug, PartialEq)]
1546    #[non_exhaustive]
1547    pub enum Direction {
1548        /// The direction is unspecified.
1549        Unspecified,
1550        /// The property's values are indexed so as to support sequencing in
1551        /// ascending order and also query by <, >, <=, >=, and =.
1552        Ascending,
1553        /// The property's values are indexed so as to support sequencing in
1554        /// descending order and also query by <, >, <=, >=, and =.
1555        Descending,
1556        /// If set, the enum was initialized with an unknown value.
1557        ///
1558        /// Applications can examine the value using [Direction::value] or
1559        /// [Direction::name].
1560        UnknownValue(direction::UnknownValue),
1561    }
1562
1563    #[doc(hidden)]
1564    pub mod direction {
1565        #[allow(unused_imports)]
1566        use super::*;
1567        #[derive(Clone, Debug, PartialEq)]
1568        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1569    }
1570
1571    impl Direction {
1572        /// Gets the enum value.
1573        ///
1574        /// Returns `None` if the enum contains an unknown value deserialized from
1575        /// the string representation of enums.
1576        pub fn value(&self) -> std::option::Option<i32> {
1577            match self {
1578                Self::Unspecified => std::option::Option::Some(0),
1579                Self::Ascending => std::option::Option::Some(1),
1580                Self::Descending => std::option::Option::Some(2),
1581                Self::UnknownValue(u) => u.0.value(),
1582            }
1583        }
1584
1585        /// Gets the enum value as a string.
1586        ///
1587        /// Returns `None` if the enum contains an unknown value deserialized from
1588        /// the integer representation of enums.
1589        pub fn name(&self) -> std::option::Option<&str> {
1590            match self {
1591                Self::Unspecified => std::option::Option::Some("DIRECTION_UNSPECIFIED"),
1592                Self::Ascending => std::option::Option::Some("ASCENDING"),
1593                Self::Descending => std::option::Option::Some("DESCENDING"),
1594                Self::UnknownValue(u) => u.0.name(),
1595            }
1596        }
1597    }
1598
1599    impl std::default::Default for Direction {
1600        fn default() -> Self {
1601            use std::convert::From;
1602            Self::from(0)
1603        }
1604    }
1605
1606    impl std::fmt::Display for Direction {
1607        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1608            wkt::internal::display_enum(f, self.name(), self.value())
1609        }
1610    }
1611
1612    impl std::convert::From<i32> for Direction {
1613        fn from(value: i32) -> Self {
1614            match value {
1615                0 => Self::Unspecified,
1616                1 => Self::Ascending,
1617                2 => Self::Descending,
1618                _ => Self::UnknownValue(direction::UnknownValue(
1619                    wkt::internal::UnknownEnumValue::Integer(value),
1620                )),
1621            }
1622        }
1623    }
1624
1625    impl std::convert::From<&str> for Direction {
1626        fn from(value: &str) -> Self {
1627            use std::string::ToString;
1628            match value {
1629                "DIRECTION_UNSPECIFIED" => Self::Unspecified,
1630                "ASCENDING" => Self::Ascending,
1631                "DESCENDING" => Self::Descending,
1632                _ => Self::UnknownValue(direction::UnknownValue(
1633                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1634                )),
1635            }
1636        }
1637    }
1638
1639    impl serde::ser::Serialize for Direction {
1640        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1641        where
1642            S: serde::Serializer,
1643        {
1644            match self {
1645                Self::Unspecified => serializer.serialize_i32(0),
1646                Self::Ascending => serializer.serialize_i32(1),
1647                Self::Descending => serializer.serialize_i32(2),
1648                Self::UnknownValue(u) => u.0.serialize(serializer),
1649            }
1650        }
1651    }
1652
1653    impl<'de> serde::de::Deserialize<'de> for Direction {
1654        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1655        where
1656            D: serde::Deserializer<'de>,
1657        {
1658            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Direction>::new(
1659                ".google.datastore.admin.v1.Index.Direction",
1660            ))
1661        }
1662    }
1663
1664    /// The possible set of states of an index.
1665    ///
1666    /// # Working with unknown values
1667    ///
1668    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1669    /// additional enum variants at any time. Adding new variants is not considered
1670    /// a breaking change. Applications should write their code in anticipation of:
1671    ///
1672    /// - New values appearing in future releases of the client library, **and**
1673    /// - New values received dynamically, without application changes.
1674    ///
1675    /// Please consult the [Working with enums] section in the user guide for some
1676    /// guidelines.
1677    ///
1678    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1679    #[derive(Clone, Debug, PartialEq)]
1680    #[non_exhaustive]
1681    pub enum State {
1682        /// The state is unspecified.
1683        Unspecified,
1684        /// The index is being created, and cannot be used by queries.
1685        /// There is an active long-running operation for the index.
1686        /// The index is updated when writing an entity.
1687        /// Some index data may exist.
1688        Creating,
1689        /// The index is ready to be used.
1690        /// The index is updated when writing an entity.
1691        /// The index is fully populated from all stored entities it applies to.
1692        Ready,
1693        /// The index is being deleted, and cannot be used by queries.
1694        /// There is an active long-running operation for the index.
1695        /// The index is not updated when writing an entity.
1696        /// Some index data may exist.
1697        Deleting,
1698        /// The index was being created or deleted, but something went wrong.
1699        /// The index cannot by used by queries.
1700        /// There is no active long-running operation for the index,
1701        /// and the most recently finished long-running operation failed.
1702        /// The index is not updated when writing an entity.
1703        /// Some index data may exist.
1704        Error,
1705        /// If set, the enum was initialized with an unknown value.
1706        ///
1707        /// Applications can examine the value using [State::value] or
1708        /// [State::name].
1709        UnknownValue(state::UnknownValue),
1710    }
1711
1712    #[doc(hidden)]
1713    pub mod state {
1714        #[allow(unused_imports)]
1715        use super::*;
1716        #[derive(Clone, Debug, PartialEq)]
1717        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1718    }
1719
1720    impl State {
1721        /// Gets the enum value.
1722        ///
1723        /// Returns `None` if the enum contains an unknown value deserialized from
1724        /// the string representation of enums.
1725        pub fn value(&self) -> std::option::Option<i32> {
1726            match self {
1727                Self::Unspecified => std::option::Option::Some(0),
1728                Self::Creating => std::option::Option::Some(1),
1729                Self::Ready => std::option::Option::Some(2),
1730                Self::Deleting => std::option::Option::Some(3),
1731                Self::Error => std::option::Option::Some(4),
1732                Self::UnknownValue(u) => u.0.value(),
1733            }
1734        }
1735
1736        /// Gets the enum value as a string.
1737        ///
1738        /// Returns `None` if the enum contains an unknown value deserialized from
1739        /// the integer representation of enums.
1740        pub fn name(&self) -> std::option::Option<&str> {
1741            match self {
1742                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1743                Self::Creating => std::option::Option::Some("CREATING"),
1744                Self::Ready => std::option::Option::Some("READY"),
1745                Self::Deleting => std::option::Option::Some("DELETING"),
1746                Self::Error => std::option::Option::Some("ERROR"),
1747                Self::UnknownValue(u) => u.0.name(),
1748            }
1749        }
1750    }
1751
1752    impl std::default::Default for State {
1753        fn default() -> Self {
1754            use std::convert::From;
1755            Self::from(0)
1756        }
1757    }
1758
1759    impl std::fmt::Display for State {
1760        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1761            wkt::internal::display_enum(f, self.name(), self.value())
1762        }
1763    }
1764
1765    impl std::convert::From<i32> for State {
1766        fn from(value: i32) -> Self {
1767            match value {
1768                0 => Self::Unspecified,
1769                1 => Self::Creating,
1770                2 => Self::Ready,
1771                3 => Self::Deleting,
1772                4 => Self::Error,
1773                _ => Self::UnknownValue(state::UnknownValue(
1774                    wkt::internal::UnknownEnumValue::Integer(value),
1775                )),
1776            }
1777        }
1778    }
1779
1780    impl std::convert::From<&str> for State {
1781        fn from(value: &str) -> Self {
1782            use std::string::ToString;
1783            match value {
1784                "STATE_UNSPECIFIED" => Self::Unspecified,
1785                "CREATING" => Self::Creating,
1786                "READY" => Self::Ready,
1787                "DELETING" => Self::Deleting,
1788                "ERROR" => Self::Error,
1789                _ => Self::UnknownValue(state::UnknownValue(
1790                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1791                )),
1792            }
1793        }
1794    }
1795
1796    impl serde::ser::Serialize for State {
1797        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1798        where
1799            S: serde::Serializer,
1800        {
1801            match self {
1802                Self::Unspecified => serializer.serialize_i32(0),
1803                Self::Creating => serializer.serialize_i32(1),
1804                Self::Ready => serializer.serialize_i32(2),
1805                Self::Deleting => serializer.serialize_i32(3),
1806                Self::Error => serializer.serialize_i32(4),
1807                Self::UnknownValue(u) => u.0.serialize(serializer),
1808            }
1809        }
1810    }
1811
1812    impl<'de> serde::de::Deserialize<'de> for State {
1813        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1814        where
1815            D: serde::Deserializer<'de>,
1816        {
1817            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1818                ".google.datastore.admin.v1.Index.State",
1819            ))
1820        }
1821    }
1822}
1823
1824/// An event signifying a change in state of a [migration from Cloud Datastore to
1825/// Cloud Firestore in Datastore
1826/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
1827#[derive(Clone, Default, PartialEq)]
1828#[non_exhaustive]
1829pub struct MigrationStateEvent {
1830    /// The new state of the migration.
1831    pub state: crate::model::MigrationState,
1832
1833    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1834}
1835
1836impl MigrationStateEvent {
1837    pub fn new() -> Self {
1838        std::default::Default::default()
1839    }
1840
1841    /// Sets the value of [state][crate::model::MigrationStateEvent::state].
1842    pub fn set_state<T: std::convert::Into<crate::model::MigrationState>>(mut self, v: T) -> Self {
1843        self.state = v.into();
1844        self
1845    }
1846}
1847
1848impl wkt::message::Message for MigrationStateEvent {
1849    fn typename() -> &'static str {
1850        "type.googleapis.com/google.datastore.admin.v1.MigrationStateEvent"
1851    }
1852}
1853
1854/// An event signifying the start of a new step in a [migration from Cloud
1855/// Datastore to Cloud Firestore in Datastore
1856/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
1857#[derive(Clone, Default, PartialEq)]
1858#[non_exhaustive]
1859pub struct MigrationProgressEvent {
1860    /// The step that is starting.
1861    ///
1862    /// An event with step set to `START` indicates that the migration
1863    /// has been reverted back to the initial pre-migration state.
1864    pub step: crate::model::MigrationStep,
1865
1866    /// Details about this step.
1867    pub step_details: std::option::Option<crate::model::migration_progress_event::StepDetails>,
1868
1869    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1870}
1871
1872impl MigrationProgressEvent {
1873    pub fn new() -> Self {
1874        std::default::Default::default()
1875    }
1876
1877    /// Sets the value of [step][crate::model::MigrationProgressEvent::step].
1878    pub fn set_step<T: std::convert::Into<crate::model::MigrationStep>>(mut self, v: T) -> Self {
1879        self.step = v.into();
1880        self
1881    }
1882
1883    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details].
1884    ///
1885    /// Note that all the setters affecting `step_details` are mutually
1886    /// exclusive.
1887    pub fn set_step_details<
1888        T: std::convert::Into<
1889                std::option::Option<crate::model::migration_progress_event::StepDetails>,
1890            >,
1891    >(
1892        mut self,
1893        v: T,
1894    ) -> Self {
1895        self.step_details = v.into();
1896        self
1897    }
1898
1899    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
1900    /// if it holds a `PrepareStepDetails`, `None` if the field is not set or
1901    /// holds a different branch.
1902    pub fn prepare_step_details(
1903        &self,
1904    ) -> std::option::Option<
1905        &std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
1906    > {
1907        #[allow(unreachable_patterns)]
1908        self.step_details.as_ref().and_then(|v| match v {
1909            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v) => {
1910                std::option::Option::Some(v)
1911            }
1912            _ => std::option::Option::None,
1913        })
1914    }
1915
1916    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
1917    /// to hold a `PrepareStepDetails`.
1918    ///
1919    /// Note that all the setters affecting `step_details` are
1920    /// mutually exclusive.
1921    pub fn set_prepare_step_details<
1922        T: std::convert::Into<
1923                std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
1924            >,
1925    >(
1926        mut self,
1927        v: T,
1928    ) -> Self {
1929        self.step_details = std::option::Option::Some(
1930            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v.into()),
1931        );
1932        self
1933    }
1934
1935    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
1936    /// if it holds a `RedirectWritesStepDetails`, `None` if the field is not set or
1937    /// holds a different branch.
1938    pub fn redirect_writes_step_details(
1939        &self,
1940    ) -> std::option::Option<
1941        &std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
1942    > {
1943        #[allow(unreachable_patterns)]
1944        self.step_details.as_ref().and_then(|v| match v {
1945            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(v) => {
1946                std::option::Option::Some(v)
1947            }
1948            _ => std::option::Option::None,
1949        })
1950    }
1951
1952    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
1953    /// to hold a `RedirectWritesStepDetails`.
1954    ///
1955    /// Note that all the setters affecting `step_details` are
1956    /// mutually exclusive.
1957    pub fn set_redirect_writes_step_details<
1958        T: std::convert::Into<
1959                std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
1960            >,
1961    >(
1962        mut self,
1963        v: T,
1964    ) -> Self {
1965        self.step_details = std::option::Option::Some(
1966            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(
1967                v.into(),
1968            ),
1969        );
1970        self
1971    }
1972}
1973
1974impl wkt::message::Message for MigrationProgressEvent {
1975    fn typename() -> &'static str {
1976        "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent"
1977    }
1978}
1979
1980/// Defines additional types related to [MigrationProgressEvent].
1981pub mod migration_progress_event {
1982    #[allow(unused_imports)]
1983    use super::*;
1984
1985    /// Details for the `PREPARE` step.
1986    #[derive(Clone, Default, PartialEq)]
1987    #[non_exhaustive]
1988    pub struct PrepareStepDetails {
1989        /// The concurrency mode this database will use when it reaches the
1990        /// `REDIRECT_WRITES` step.
1991        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
1992
1993        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1994    }
1995
1996    impl PrepareStepDetails {
1997        pub fn new() -> Self {
1998            std::default::Default::default()
1999        }
2000
2001        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::PrepareStepDetails::concurrency_mode].
2002        pub fn set_concurrency_mode<
2003            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
2004        >(
2005            mut self,
2006            v: T,
2007        ) -> Self {
2008            self.concurrency_mode = v.into();
2009            self
2010        }
2011    }
2012
2013    impl wkt::message::Message for PrepareStepDetails {
2014        fn typename() -> &'static str {
2015            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails"
2016        }
2017    }
2018
2019    /// Details for the `REDIRECT_WRITES` step.
2020    #[derive(Clone, Default, PartialEq)]
2021    #[non_exhaustive]
2022    pub struct RedirectWritesStepDetails {
2023        /// Ths concurrency mode for this database.
2024        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
2025
2026        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2027    }
2028
2029    impl RedirectWritesStepDetails {
2030        pub fn new() -> Self {
2031            std::default::Default::default()
2032        }
2033
2034        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::RedirectWritesStepDetails::concurrency_mode].
2035        pub fn set_concurrency_mode<
2036            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
2037        >(
2038            mut self,
2039            v: T,
2040        ) -> Self {
2041            self.concurrency_mode = v.into();
2042            self
2043        }
2044    }
2045
2046    impl wkt::message::Message for RedirectWritesStepDetails {
2047        fn typename() -> &'static str {
2048            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails"
2049        }
2050    }
2051
2052    /// Concurrency modes for transactions in Cloud Firestore.
2053    ///
2054    /// # Working with unknown values
2055    ///
2056    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2057    /// additional enum variants at any time. Adding new variants is not considered
2058    /// a breaking change. Applications should write their code in anticipation of:
2059    ///
2060    /// - New values appearing in future releases of the client library, **and**
2061    /// - New values received dynamically, without application changes.
2062    ///
2063    /// Please consult the [Working with enums] section in the user guide for some
2064    /// guidelines.
2065    ///
2066    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2067    #[derive(Clone, Debug, PartialEq)]
2068    #[non_exhaustive]
2069    pub enum ConcurrencyMode {
2070        /// Unspecified.
2071        Unspecified,
2072        /// Pessimistic concurrency.
2073        Pessimistic,
2074        /// Optimistic concurrency.
2075        Optimistic,
2076        /// Optimistic concurrency with entity groups.
2077        OptimisticWithEntityGroups,
2078        /// If set, the enum was initialized with an unknown value.
2079        ///
2080        /// Applications can examine the value using [ConcurrencyMode::value] or
2081        /// [ConcurrencyMode::name].
2082        UnknownValue(concurrency_mode::UnknownValue),
2083    }
2084
2085    #[doc(hidden)]
2086    pub mod concurrency_mode {
2087        #[allow(unused_imports)]
2088        use super::*;
2089        #[derive(Clone, Debug, PartialEq)]
2090        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2091    }
2092
2093    impl ConcurrencyMode {
2094        /// Gets the enum value.
2095        ///
2096        /// Returns `None` if the enum contains an unknown value deserialized from
2097        /// the string representation of enums.
2098        pub fn value(&self) -> std::option::Option<i32> {
2099            match self {
2100                Self::Unspecified => std::option::Option::Some(0),
2101                Self::Pessimistic => std::option::Option::Some(1),
2102                Self::Optimistic => std::option::Option::Some(2),
2103                Self::OptimisticWithEntityGroups => std::option::Option::Some(3),
2104                Self::UnknownValue(u) => u.0.value(),
2105            }
2106        }
2107
2108        /// Gets the enum value as a string.
2109        ///
2110        /// Returns `None` if the enum contains an unknown value deserialized from
2111        /// the integer representation of enums.
2112        pub fn name(&self) -> std::option::Option<&str> {
2113            match self {
2114                Self::Unspecified => std::option::Option::Some("CONCURRENCY_MODE_UNSPECIFIED"),
2115                Self::Pessimistic => std::option::Option::Some("PESSIMISTIC"),
2116                Self::Optimistic => std::option::Option::Some("OPTIMISTIC"),
2117                Self::OptimisticWithEntityGroups => {
2118                    std::option::Option::Some("OPTIMISTIC_WITH_ENTITY_GROUPS")
2119                }
2120                Self::UnknownValue(u) => u.0.name(),
2121            }
2122        }
2123    }
2124
2125    impl std::default::Default for ConcurrencyMode {
2126        fn default() -> Self {
2127            use std::convert::From;
2128            Self::from(0)
2129        }
2130    }
2131
2132    impl std::fmt::Display for ConcurrencyMode {
2133        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2134            wkt::internal::display_enum(f, self.name(), self.value())
2135        }
2136    }
2137
2138    impl std::convert::From<i32> for ConcurrencyMode {
2139        fn from(value: i32) -> Self {
2140            match value {
2141                0 => Self::Unspecified,
2142                1 => Self::Pessimistic,
2143                2 => Self::Optimistic,
2144                3 => Self::OptimisticWithEntityGroups,
2145                _ => Self::UnknownValue(concurrency_mode::UnknownValue(
2146                    wkt::internal::UnknownEnumValue::Integer(value),
2147                )),
2148            }
2149        }
2150    }
2151
2152    impl std::convert::From<&str> for ConcurrencyMode {
2153        fn from(value: &str) -> Self {
2154            use std::string::ToString;
2155            match value {
2156                "CONCURRENCY_MODE_UNSPECIFIED" => Self::Unspecified,
2157                "PESSIMISTIC" => Self::Pessimistic,
2158                "OPTIMISTIC" => Self::Optimistic,
2159                "OPTIMISTIC_WITH_ENTITY_GROUPS" => Self::OptimisticWithEntityGroups,
2160                _ => Self::UnknownValue(concurrency_mode::UnknownValue(
2161                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2162                )),
2163            }
2164        }
2165    }
2166
2167    impl serde::ser::Serialize for ConcurrencyMode {
2168        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2169        where
2170            S: serde::Serializer,
2171        {
2172            match self {
2173                Self::Unspecified => serializer.serialize_i32(0),
2174                Self::Pessimistic => serializer.serialize_i32(1),
2175                Self::Optimistic => serializer.serialize_i32(2),
2176                Self::OptimisticWithEntityGroups => serializer.serialize_i32(3),
2177                Self::UnknownValue(u) => u.0.serialize(serializer),
2178            }
2179        }
2180    }
2181
2182    impl<'de> serde::de::Deserialize<'de> for ConcurrencyMode {
2183        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2184        where
2185            D: serde::Deserializer<'de>,
2186        {
2187            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConcurrencyMode>::new(
2188                ".google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode",
2189            ))
2190        }
2191    }
2192
2193    /// Details about this step.
2194    #[derive(Clone, Debug, PartialEq)]
2195    #[non_exhaustive]
2196    pub enum StepDetails {
2197        /// Details for the `PREPARE` step.
2198        PrepareStepDetails(
2199            std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
2200        ),
2201        /// Details for the `REDIRECT_WRITES` step.
2202        RedirectWritesStepDetails(
2203            std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
2204        ),
2205    }
2206}
2207
2208/// Operation types.
2209///
2210/// # Working with unknown values
2211///
2212/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2213/// additional enum variants at any time. Adding new variants is not considered
2214/// a breaking change. Applications should write their code in anticipation of:
2215///
2216/// - New values appearing in future releases of the client library, **and**
2217/// - New values received dynamically, without application changes.
2218///
2219/// Please consult the [Working with enums] section in the user guide for some
2220/// guidelines.
2221///
2222/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2223#[derive(Clone, Debug, PartialEq)]
2224#[non_exhaustive]
2225pub enum OperationType {
2226    /// Unspecified.
2227    Unspecified,
2228    /// ExportEntities.
2229    ExportEntities,
2230    /// ImportEntities.
2231    ImportEntities,
2232    /// CreateIndex.
2233    CreateIndex,
2234    /// DeleteIndex.
2235    DeleteIndex,
2236    /// If set, the enum was initialized with an unknown value.
2237    ///
2238    /// Applications can examine the value using [OperationType::value] or
2239    /// [OperationType::name].
2240    UnknownValue(operation_type::UnknownValue),
2241}
2242
2243#[doc(hidden)]
2244pub mod operation_type {
2245    #[allow(unused_imports)]
2246    use super::*;
2247    #[derive(Clone, Debug, PartialEq)]
2248    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2249}
2250
2251impl OperationType {
2252    /// Gets the enum value.
2253    ///
2254    /// Returns `None` if the enum contains an unknown value deserialized from
2255    /// the string representation of enums.
2256    pub fn value(&self) -> std::option::Option<i32> {
2257        match self {
2258            Self::Unspecified => std::option::Option::Some(0),
2259            Self::ExportEntities => std::option::Option::Some(1),
2260            Self::ImportEntities => std::option::Option::Some(2),
2261            Self::CreateIndex => std::option::Option::Some(3),
2262            Self::DeleteIndex => std::option::Option::Some(4),
2263            Self::UnknownValue(u) => u.0.value(),
2264        }
2265    }
2266
2267    /// Gets the enum value as a string.
2268    ///
2269    /// Returns `None` if the enum contains an unknown value deserialized from
2270    /// the integer representation of enums.
2271    pub fn name(&self) -> std::option::Option<&str> {
2272        match self {
2273            Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
2274            Self::ExportEntities => std::option::Option::Some("EXPORT_ENTITIES"),
2275            Self::ImportEntities => std::option::Option::Some("IMPORT_ENTITIES"),
2276            Self::CreateIndex => std::option::Option::Some("CREATE_INDEX"),
2277            Self::DeleteIndex => std::option::Option::Some("DELETE_INDEX"),
2278            Self::UnknownValue(u) => u.0.name(),
2279        }
2280    }
2281}
2282
2283impl std::default::Default for OperationType {
2284    fn default() -> Self {
2285        use std::convert::From;
2286        Self::from(0)
2287    }
2288}
2289
2290impl std::fmt::Display for OperationType {
2291    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2292        wkt::internal::display_enum(f, self.name(), self.value())
2293    }
2294}
2295
2296impl std::convert::From<i32> for OperationType {
2297    fn from(value: i32) -> Self {
2298        match value {
2299            0 => Self::Unspecified,
2300            1 => Self::ExportEntities,
2301            2 => Self::ImportEntities,
2302            3 => Self::CreateIndex,
2303            4 => Self::DeleteIndex,
2304            _ => Self::UnknownValue(operation_type::UnknownValue(
2305                wkt::internal::UnknownEnumValue::Integer(value),
2306            )),
2307        }
2308    }
2309}
2310
2311impl std::convert::From<&str> for OperationType {
2312    fn from(value: &str) -> Self {
2313        use std::string::ToString;
2314        match value {
2315            "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
2316            "EXPORT_ENTITIES" => Self::ExportEntities,
2317            "IMPORT_ENTITIES" => Self::ImportEntities,
2318            "CREATE_INDEX" => Self::CreateIndex,
2319            "DELETE_INDEX" => Self::DeleteIndex,
2320            _ => Self::UnknownValue(operation_type::UnknownValue(
2321                wkt::internal::UnknownEnumValue::String(value.to_string()),
2322            )),
2323        }
2324    }
2325}
2326
2327impl serde::ser::Serialize for OperationType {
2328    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2329    where
2330        S: serde::Serializer,
2331    {
2332        match self {
2333            Self::Unspecified => serializer.serialize_i32(0),
2334            Self::ExportEntities => serializer.serialize_i32(1),
2335            Self::ImportEntities => serializer.serialize_i32(2),
2336            Self::CreateIndex => serializer.serialize_i32(3),
2337            Self::DeleteIndex => serializer.serialize_i32(4),
2338            Self::UnknownValue(u) => u.0.serialize(serializer),
2339        }
2340    }
2341}
2342
2343impl<'de> serde::de::Deserialize<'de> for OperationType {
2344    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2345    where
2346        D: serde::Deserializer<'de>,
2347    {
2348        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
2349            ".google.datastore.admin.v1.OperationType",
2350        ))
2351    }
2352}
2353
2354/// States for a migration.
2355///
2356/// # Working with unknown values
2357///
2358/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2359/// additional enum variants at any time. Adding new variants is not considered
2360/// a breaking change. Applications should write their code in anticipation of:
2361///
2362/// - New values appearing in future releases of the client library, **and**
2363/// - New values received dynamically, without application changes.
2364///
2365/// Please consult the [Working with enums] section in the user guide for some
2366/// guidelines.
2367///
2368/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2369#[derive(Clone, Debug, PartialEq)]
2370#[non_exhaustive]
2371pub enum MigrationState {
2372    /// Unspecified.
2373    Unspecified,
2374    /// The migration is running.
2375    Running,
2376    /// The migration is paused.
2377    Paused,
2378    /// The migration is complete.
2379    Complete,
2380    /// If set, the enum was initialized with an unknown value.
2381    ///
2382    /// Applications can examine the value using [MigrationState::value] or
2383    /// [MigrationState::name].
2384    UnknownValue(migration_state::UnknownValue),
2385}
2386
2387#[doc(hidden)]
2388pub mod migration_state {
2389    #[allow(unused_imports)]
2390    use super::*;
2391    #[derive(Clone, Debug, PartialEq)]
2392    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2393}
2394
2395impl MigrationState {
2396    /// Gets the enum value.
2397    ///
2398    /// Returns `None` if the enum contains an unknown value deserialized from
2399    /// the string representation of enums.
2400    pub fn value(&self) -> std::option::Option<i32> {
2401        match self {
2402            Self::Unspecified => std::option::Option::Some(0),
2403            Self::Running => std::option::Option::Some(1),
2404            Self::Paused => std::option::Option::Some(2),
2405            Self::Complete => std::option::Option::Some(3),
2406            Self::UnknownValue(u) => u.0.value(),
2407        }
2408    }
2409
2410    /// Gets the enum value as a string.
2411    ///
2412    /// Returns `None` if the enum contains an unknown value deserialized from
2413    /// the integer representation of enums.
2414    pub fn name(&self) -> std::option::Option<&str> {
2415        match self {
2416            Self::Unspecified => std::option::Option::Some("MIGRATION_STATE_UNSPECIFIED"),
2417            Self::Running => std::option::Option::Some("RUNNING"),
2418            Self::Paused => std::option::Option::Some("PAUSED"),
2419            Self::Complete => std::option::Option::Some("COMPLETE"),
2420            Self::UnknownValue(u) => u.0.name(),
2421        }
2422    }
2423}
2424
2425impl std::default::Default for MigrationState {
2426    fn default() -> Self {
2427        use std::convert::From;
2428        Self::from(0)
2429    }
2430}
2431
2432impl std::fmt::Display for MigrationState {
2433    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2434        wkt::internal::display_enum(f, self.name(), self.value())
2435    }
2436}
2437
2438impl std::convert::From<i32> for MigrationState {
2439    fn from(value: i32) -> Self {
2440        match value {
2441            0 => Self::Unspecified,
2442            1 => Self::Running,
2443            2 => Self::Paused,
2444            3 => Self::Complete,
2445            _ => Self::UnknownValue(migration_state::UnknownValue(
2446                wkt::internal::UnknownEnumValue::Integer(value),
2447            )),
2448        }
2449    }
2450}
2451
2452impl std::convert::From<&str> for MigrationState {
2453    fn from(value: &str) -> Self {
2454        use std::string::ToString;
2455        match value {
2456            "MIGRATION_STATE_UNSPECIFIED" => Self::Unspecified,
2457            "RUNNING" => Self::Running,
2458            "PAUSED" => Self::Paused,
2459            "COMPLETE" => Self::Complete,
2460            _ => Self::UnknownValue(migration_state::UnknownValue(
2461                wkt::internal::UnknownEnumValue::String(value.to_string()),
2462            )),
2463        }
2464    }
2465}
2466
2467impl serde::ser::Serialize for MigrationState {
2468    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2469    where
2470        S: serde::Serializer,
2471    {
2472        match self {
2473            Self::Unspecified => serializer.serialize_i32(0),
2474            Self::Running => serializer.serialize_i32(1),
2475            Self::Paused => serializer.serialize_i32(2),
2476            Self::Complete => serializer.serialize_i32(3),
2477            Self::UnknownValue(u) => u.0.serialize(serializer),
2478        }
2479    }
2480}
2481
2482impl<'de> serde::de::Deserialize<'de> for MigrationState {
2483    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2484    where
2485        D: serde::Deserializer<'de>,
2486    {
2487        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationState>::new(
2488            ".google.datastore.admin.v1.MigrationState",
2489        ))
2490    }
2491}
2492
2493/// Steps in a migration.
2494///
2495/// # Working with unknown values
2496///
2497/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2498/// additional enum variants at any time. Adding new variants is not considered
2499/// a breaking change. Applications should write their code in anticipation of:
2500///
2501/// - New values appearing in future releases of the client library, **and**
2502/// - New values received dynamically, without application changes.
2503///
2504/// Please consult the [Working with enums] section in the user guide for some
2505/// guidelines.
2506///
2507/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2508#[derive(Clone, Debug, PartialEq)]
2509#[non_exhaustive]
2510pub enum MigrationStep {
2511    /// Unspecified.
2512    Unspecified,
2513    /// Pre-migration: the database is prepared for migration.
2514    Prepare,
2515    /// Start of migration.
2516    Start,
2517    /// Writes are applied synchronously to at least one replica.
2518    ApplyWritesSynchronously,
2519    /// Data is copied to Cloud Firestore and then verified to match the data in
2520    /// Cloud Datastore.
2521    CopyAndVerify,
2522    /// Eventually-consistent reads are redirected to Cloud Firestore.
2523    RedirectEventuallyConsistentReads,
2524    /// Strongly-consistent reads are redirected to Cloud Firestore.
2525    RedirectStronglyConsistentReads,
2526    /// Writes are redirected to Cloud Firestore.
2527    RedirectWrites,
2528    /// If set, the enum was initialized with an unknown value.
2529    ///
2530    /// Applications can examine the value using [MigrationStep::value] or
2531    /// [MigrationStep::name].
2532    UnknownValue(migration_step::UnknownValue),
2533}
2534
2535#[doc(hidden)]
2536pub mod migration_step {
2537    #[allow(unused_imports)]
2538    use super::*;
2539    #[derive(Clone, Debug, PartialEq)]
2540    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2541}
2542
2543impl MigrationStep {
2544    /// Gets the enum value.
2545    ///
2546    /// Returns `None` if the enum contains an unknown value deserialized from
2547    /// the string representation of enums.
2548    pub fn value(&self) -> std::option::Option<i32> {
2549        match self {
2550            Self::Unspecified => std::option::Option::Some(0),
2551            Self::Prepare => std::option::Option::Some(6),
2552            Self::Start => std::option::Option::Some(1),
2553            Self::ApplyWritesSynchronously => std::option::Option::Some(7),
2554            Self::CopyAndVerify => std::option::Option::Some(2),
2555            Self::RedirectEventuallyConsistentReads => std::option::Option::Some(3),
2556            Self::RedirectStronglyConsistentReads => std::option::Option::Some(4),
2557            Self::RedirectWrites => std::option::Option::Some(5),
2558            Self::UnknownValue(u) => u.0.value(),
2559        }
2560    }
2561
2562    /// Gets the enum value as a string.
2563    ///
2564    /// Returns `None` if the enum contains an unknown value deserialized from
2565    /// the integer representation of enums.
2566    pub fn name(&self) -> std::option::Option<&str> {
2567        match self {
2568            Self::Unspecified => std::option::Option::Some("MIGRATION_STEP_UNSPECIFIED"),
2569            Self::Prepare => std::option::Option::Some("PREPARE"),
2570            Self::Start => std::option::Option::Some("START"),
2571            Self::ApplyWritesSynchronously => {
2572                std::option::Option::Some("APPLY_WRITES_SYNCHRONOUSLY")
2573            }
2574            Self::CopyAndVerify => std::option::Option::Some("COPY_AND_VERIFY"),
2575            Self::RedirectEventuallyConsistentReads => {
2576                std::option::Option::Some("REDIRECT_EVENTUALLY_CONSISTENT_READS")
2577            }
2578            Self::RedirectStronglyConsistentReads => {
2579                std::option::Option::Some("REDIRECT_STRONGLY_CONSISTENT_READS")
2580            }
2581            Self::RedirectWrites => std::option::Option::Some("REDIRECT_WRITES"),
2582            Self::UnknownValue(u) => u.0.name(),
2583        }
2584    }
2585}
2586
2587impl std::default::Default for MigrationStep {
2588    fn default() -> Self {
2589        use std::convert::From;
2590        Self::from(0)
2591    }
2592}
2593
2594impl std::fmt::Display for MigrationStep {
2595    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2596        wkt::internal::display_enum(f, self.name(), self.value())
2597    }
2598}
2599
2600impl std::convert::From<i32> for MigrationStep {
2601    fn from(value: i32) -> Self {
2602        match value {
2603            0 => Self::Unspecified,
2604            1 => Self::Start,
2605            2 => Self::CopyAndVerify,
2606            3 => Self::RedirectEventuallyConsistentReads,
2607            4 => Self::RedirectStronglyConsistentReads,
2608            5 => Self::RedirectWrites,
2609            6 => Self::Prepare,
2610            7 => Self::ApplyWritesSynchronously,
2611            _ => Self::UnknownValue(migration_step::UnknownValue(
2612                wkt::internal::UnknownEnumValue::Integer(value),
2613            )),
2614        }
2615    }
2616}
2617
2618impl std::convert::From<&str> for MigrationStep {
2619    fn from(value: &str) -> Self {
2620        use std::string::ToString;
2621        match value {
2622            "MIGRATION_STEP_UNSPECIFIED" => Self::Unspecified,
2623            "PREPARE" => Self::Prepare,
2624            "START" => Self::Start,
2625            "APPLY_WRITES_SYNCHRONOUSLY" => Self::ApplyWritesSynchronously,
2626            "COPY_AND_VERIFY" => Self::CopyAndVerify,
2627            "REDIRECT_EVENTUALLY_CONSISTENT_READS" => Self::RedirectEventuallyConsistentReads,
2628            "REDIRECT_STRONGLY_CONSISTENT_READS" => Self::RedirectStronglyConsistentReads,
2629            "REDIRECT_WRITES" => Self::RedirectWrites,
2630            _ => Self::UnknownValue(migration_step::UnknownValue(
2631                wkt::internal::UnknownEnumValue::String(value.to_string()),
2632            )),
2633        }
2634    }
2635}
2636
2637impl serde::ser::Serialize for MigrationStep {
2638    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2639    where
2640        S: serde::Serializer,
2641    {
2642        match self {
2643            Self::Unspecified => serializer.serialize_i32(0),
2644            Self::Prepare => serializer.serialize_i32(6),
2645            Self::Start => serializer.serialize_i32(1),
2646            Self::ApplyWritesSynchronously => serializer.serialize_i32(7),
2647            Self::CopyAndVerify => serializer.serialize_i32(2),
2648            Self::RedirectEventuallyConsistentReads => serializer.serialize_i32(3),
2649            Self::RedirectStronglyConsistentReads => serializer.serialize_i32(4),
2650            Self::RedirectWrites => serializer.serialize_i32(5),
2651            Self::UnknownValue(u) => u.0.serialize(serializer),
2652        }
2653    }
2654}
2655
2656impl<'de> serde::de::Deserialize<'de> for MigrationStep {
2657    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2658    where
2659        D: serde::Deserializer<'de>,
2660    {
2661        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationStep>::new(
2662            ".google.datastore.admin.v1.MigrationStep",
2663        ))
2664    }
2665}