google_cloud_datastore_admin_v1/
model.rs

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