Skip to main content

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