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 [state][crate::model::CommonMetadata::state].
98    pub fn set_state<T: std::convert::Into<crate::model::common_metadata::State>>(
99        mut self,
100        v: T,
101    ) -> Self {
102        self.state = v.into();
103        self
104    }
105
106    /// Sets the value of [labels][crate::model::CommonMetadata::labels].
107    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
108    where
109        T: std::iter::IntoIterator<Item = (K, V)>,
110        K: std::convert::Into<std::string::String>,
111        V: std::convert::Into<std::string::String>,
112    {
113        use std::iter::Iterator;
114        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
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    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
132    pub struct State(i32);
133
134    impl State {
135        /// Unspecified.
136        pub const STATE_UNSPECIFIED: State = State::new(0);
137
138        /// Request is being prepared for processing.
139        pub const INITIALIZING: State = State::new(1);
140
141        /// Request is actively being processed.
142        pub const PROCESSING: State = State::new(2);
143
144        /// Request is in the process of being cancelled after user called
145        /// google.longrunning.Operations.CancelOperation on the operation.
146        pub const CANCELLING: State = State::new(3);
147
148        /// Request has been processed and is in its finalization stage.
149        pub const FINALIZING: State = State::new(4);
150
151        /// Request has completed successfully.
152        pub const SUCCESSFUL: State = State::new(5);
153
154        /// Request has finished being processed, but encountered an error.
155        pub const FAILED: State = State::new(6);
156
157        /// Request has finished being cancelled after user called
158        /// google.longrunning.Operations.CancelOperation.
159        pub const CANCELLED: State = State::new(7);
160
161        /// Creates a new State instance.
162        pub(crate) const fn new(value: i32) -> Self {
163            Self(value)
164        }
165
166        /// Gets the enum value.
167        pub fn value(&self) -> i32 {
168            self.0
169        }
170
171        /// Gets the enum value as a string.
172        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
173            match self.0 {
174                0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
175                1 => std::borrow::Cow::Borrowed("INITIALIZING"),
176                2 => std::borrow::Cow::Borrowed("PROCESSING"),
177                3 => std::borrow::Cow::Borrowed("CANCELLING"),
178                4 => std::borrow::Cow::Borrowed("FINALIZING"),
179                5 => std::borrow::Cow::Borrowed("SUCCESSFUL"),
180                6 => std::borrow::Cow::Borrowed("FAILED"),
181                7 => std::borrow::Cow::Borrowed("CANCELLED"),
182                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
183            }
184        }
185
186        /// Creates an enum value from the value name.
187        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
188            match name {
189                "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
190                "INITIALIZING" => std::option::Option::Some(Self::INITIALIZING),
191                "PROCESSING" => std::option::Option::Some(Self::PROCESSING),
192                "CANCELLING" => std::option::Option::Some(Self::CANCELLING),
193                "FINALIZING" => std::option::Option::Some(Self::FINALIZING),
194                "SUCCESSFUL" => std::option::Option::Some(Self::SUCCESSFUL),
195                "FAILED" => std::option::Option::Some(Self::FAILED),
196                "CANCELLED" => std::option::Option::Some(Self::CANCELLED),
197                _ => std::option::Option::None,
198            }
199        }
200    }
201
202    impl std::convert::From<i32> for State {
203        fn from(value: i32) -> Self {
204            Self::new(value)
205        }
206    }
207
208    impl std::default::Default for State {
209        fn default() -> Self {
210            Self::new(0)
211        }
212    }
213}
214
215/// Measures the progress of a particular metric.
216#[serde_with::serde_as]
217#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
218#[serde(default, rename_all = "camelCase")]
219#[non_exhaustive]
220pub struct Progress {
221    /// The amount of work that has been completed. Note that this may be greater
222    /// than work_estimated.
223    #[serde_as(as = "serde_with::DisplayFromStr")]
224    pub work_completed: i64,
225
226    /// An estimate of how much work needs to be performed. May be zero if the
227    /// work estimate is unavailable.
228    #[serde_as(as = "serde_with::DisplayFromStr")]
229    pub work_estimated: i64,
230
231    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
232    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
233}
234
235impl Progress {
236    pub fn new() -> Self {
237        std::default::Default::default()
238    }
239
240    /// Sets the value of [work_completed][crate::model::Progress::work_completed].
241    pub fn set_work_completed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
242        self.work_completed = v.into();
243        self
244    }
245
246    /// Sets the value of [work_estimated][crate::model::Progress::work_estimated].
247    pub fn set_work_estimated<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
248        self.work_estimated = v.into();
249        self
250    }
251}
252
253impl wkt::message::Message for Progress {
254    fn typename() -> &'static str {
255        "type.googleapis.com/google.datastore.admin.v1.Progress"
256    }
257}
258
259/// The request for
260/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
261///
262/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
263#[serde_with::serde_as]
264#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
265#[serde(default, rename_all = "camelCase")]
266#[non_exhaustive]
267pub struct ExportEntitiesRequest {
268    /// Required. Project ID against which to make the request.
269    #[serde(skip_serializing_if = "std::string::String::is_empty")]
270    pub project_id: std::string::String,
271
272    /// Client-assigned labels.
273    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
274    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
275
276    /// Description of what data from the project is included in the export.
277    #[serde(skip_serializing_if = "std::option::Option::is_none")]
278    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
279
280    /// Required. Location for the export metadata and data files.
281    ///
282    /// The full resource URL of the external storage location. Currently, only
283    /// Google Cloud Storage is supported. So output_url_prefix should be of the
284    /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
285    /// name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud
286    /// Storage namespace path (this is not a Cloud Datastore namespace). For more
287    /// information about Cloud Storage namespace paths, see
288    /// [Object name
289    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
290    ///
291    /// The resulting files will be nested deeper than the specified URL prefix.
292    /// The final output URL will be provided in the
293    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
294    /// field. That value should be used for subsequent ImportEntities operations.
295    ///
296    /// By nesting the data files deeper, the same Cloud Storage bucket can be used
297    /// in multiple ExportEntities operations without conflict.
298    ///
299    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
300    #[serde(skip_serializing_if = "std::string::String::is_empty")]
301    pub output_url_prefix: std::string::String,
302
303    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
304    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
305}
306
307impl ExportEntitiesRequest {
308    pub fn new() -> Self {
309        std::default::Default::default()
310    }
311
312    /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
313    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
314        self.project_id = v.into();
315        self
316    }
317
318    /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
319    pub fn set_entity_filter<
320        T: std::convert::Into<std::option::Option<crate::model::EntityFilter>>,
321    >(
322        mut self,
323        v: T,
324    ) -> Self {
325        self.entity_filter = v.into();
326        self
327    }
328
329    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
330    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
331        mut self,
332        v: T,
333    ) -> Self {
334        self.output_url_prefix = v.into();
335        self
336    }
337
338    /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
339    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
340    where
341        T: std::iter::IntoIterator<Item = (K, V)>,
342        K: std::convert::Into<std::string::String>,
343        V: std::convert::Into<std::string::String>,
344    {
345        use std::iter::Iterator;
346        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
347        self
348    }
349}
350
351impl wkt::message::Message for ExportEntitiesRequest {
352    fn typename() -> &'static str {
353        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesRequest"
354    }
355}
356
357/// The request for
358/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities].
359///
360/// [google.datastore.admin.v1.DatastoreAdmin.ImportEntities]: crate::client::DatastoreAdmin::import_entities
361#[serde_with::serde_as]
362#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
363#[serde(default, rename_all = "camelCase")]
364#[non_exhaustive]
365pub struct ImportEntitiesRequest {
366    /// Required. Project ID against which to make the request.
367    #[serde(skip_serializing_if = "std::string::String::is_empty")]
368    pub project_id: std::string::String,
369
370    /// Client-assigned labels.
371    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
372    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
373
374    /// Required. The full resource URL of the external storage location.
375    /// Currently, only Google Cloud Storage is supported. So input_url should be
376    /// of the form:
377    /// `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where
378    /// `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is
379    /// an optional Cloud Storage namespace path (this is not a Cloud Datastore
380    /// namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written
381    /// by the ExportEntities operation. For more information about Cloud Storage
382    /// namespace paths, see
383    /// [Object name
384    /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
385    ///
386    /// For more information, see
387    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
388    ///
389    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
390    #[serde(skip_serializing_if = "std::string::String::is_empty")]
391    pub input_url: std::string::String,
392
393    /// Optionally specify which kinds/namespaces are to be imported. If provided,
394    /// the list must be a subset of the EntityFilter used in creating the export,
395    /// otherwise a FAILED_PRECONDITION error will be returned. If no filter is
396    /// specified then all entities from the export are imported.
397    #[serde(skip_serializing_if = "std::option::Option::is_none")]
398    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
399
400    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
401    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
402}
403
404impl ImportEntitiesRequest {
405    pub fn new() -> Self {
406        std::default::Default::default()
407    }
408
409    /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
410    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
411        self.project_id = v.into();
412        self
413    }
414
415    /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
416    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
417        self.input_url = v.into();
418        self
419    }
420
421    /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
422    pub fn set_entity_filter<
423        T: std::convert::Into<std::option::Option<crate::model::EntityFilter>>,
424    >(
425        mut self,
426        v: T,
427    ) -> Self {
428        self.entity_filter = v.into();
429        self
430    }
431
432    /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
433    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
434    where
435        T: std::iter::IntoIterator<Item = (K, V)>,
436        K: std::convert::Into<std::string::String>,
437        V: std::convert::Into<std::string::String>,
438    {
439        use std::iter::Iterator;
440        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
441        self
442    }
443}
444
445impl wkt::message::Message for ImportEntitiesRequest {
446    fn typename() -> &'static str {
447        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesRequest"
448    }
449}
450
451/// The response for
452/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
453///
454/// [google.datastore.admin.v1.DatastoreAdmin.ExportEntities]: crate::client::DatastoreAdmin::export_entities
455#[serde_with::serde_as]
456#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
457#[serde(default, rename_all = "camelCase")]
458#[non_exhaustive]
459pub struct ExportEntitiesResponse {
460    /// Location of the output metadata file. This can be used to begin an import
461    /// into Cloud Datastore (this project or another project). See
462    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url].
463    /// Only present if the operation completed successfully.
464    ///
465    /// [google.datastore.admin.v1.ImportEntitiesRequest.input_url]: crate::model::ImportEntitiesRequest::input_url
466    #[serde(skip_serializing_if = "std::string::String::is_empty")]
467    pub output_url: std::string::String,
468
469    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
470    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
471}
472
473impl ExportEntitiesResponse {
474    pub fn new() -> Self {
475        std::default::Default::default()
476    }
477
478    /// Sets the value of [output_url][crate::model::ExportEntitiesResponse::output_url].
479    pub fn set_output_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
480        self.output_url = v.into();
481        self
482    }
483}
484
485impl wkt::message::Message for ExportEntitiesResponse {
486    fn typename() -> &'static str {
487        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesResponse"
488    }
489}
490
491/// Metadata for ExportEntities operations.
492#[serde_with::serde_as]
493#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
494#[serde(default, rename_all = "camelCase")]
495#[non_exhaustive]
496pub struct ExportEntitiesMetadata {
497    /// Metadata common to all Datastore Admin operations.
498    #[serde(skip_serializing_if = "std::option::Option::is_none")]
499    pub common: std::option::Option<crate::model::CommonMetadata>,
500
501    /// An estimate of the number of entities processed.
502    #[serde(skip_serializing_if = "std::option::Option::is_none")]
503    pub progress_entities: std::option::Option<crate::model::Progress>,
504
505    /// An estimate of the number of bytes processed.
506    #[serde(skip_serializing_if = "std::option::Option::is_none")]
507    pub progress_bytes: std::option::Option<crate::model::Progress>,
508
509    /// Description of which entities are being exported.
510    #[serde(skip_serializing_if = "std::option::Option::is_none")]
511    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
512
513    /// Location for the export metadata and data files. This will be the same
514    /// value as the
515    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]
516    /// field. The final output location is provided in
517    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
518    ///
519    /// [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]: crate::model::ExportEntitiesRequest::output_url_prefix
520    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
521    #[serde(skip_serializing_if = "std::string::String::is_empty")]
522    pub output_url_prefix: std::string::String,
523
524    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
525    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
526}
527
528impl ExportEntitiesMetadata {
529    pub fn new() -> Self {
530        std::default::Default::default()
531    }
532
533    /// Sets the value of [common][crate::model::ExportEntitiesMetadata::common].
534    pub fn set_common<T: std::convert::Into<std::option::Option<crate::model::CommonMetadata>>>(
535        mut self,
536        v: T,
537    ) -> Self {
538        self.common = v.into();
539        self
540    }
541
542    /// Sets the value of [progress_entities][crate::model::ExportEntitiesMetadata::progress_entities].
543    pub fn set_progress_entities<
544        T: std::convert::Into<std::option::Option<crate::model::Progress>>,
545    >(
546        mut self,
547        v: T,
548    ) -> Self {
549        self.progress_entities = v.into();
550        self
551    }
552
553    /// Sets the value of [progress_bytes][crate::model::ExportEntitiesMetadata::progress_bytes].
554    pub fn set_progress_bytes<
555        T: std::convert::Into<std::option::Option<crate::model::Progress>>,
556    >(
557        mut self,
558        v: T,
559    ) -> Self {
560        self.progress_bytes = v.into();
561        self
562    }
563
564    /// Sets the value of [entity_filter][crate::model::ExportEntitiesMetadata::entity_filter].
565    pub fn set_entity_filter<
566        T: std::convert::Into<std::option::Option<crate::model::EntityFilter>>,
567    >(
568        mut self,
569        v: T,
570    ) -> Self {
571        self.entity_filter = v.into();
572        self
573    }
574
575    /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesMetadata::output_url_prefix].
576    pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
577        mut self,
578        v: T,
579    ) -> Self {
580        self.output_url_prefix = v.into();
581        self
582    }
583}
584
585impl wkt::message::Message for ExportEntitiesMetadata {
586    fn typename() -> &'static str {
587        "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata"
588    }
589}
590
591/// Metadata for ImportEntities operations.
592#[serde_with::serde_as]
593#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
594#[serde(default, rename_all = "camelCase")]
595#[non_exhaustive]
596pub struct ImportEntitiesMetadata {
597    /// Metadata common to all Datastore Admin operations.
598    #[serde(skip_serializing_if = "std::option::Option::is_none")]
599    pub common: std::option::Option<crate::model::CommonMetadata>,
600
601    /// An estimate of the number of entities processed.
602    #[serde(skip_serializing_if = "std::option::Option::is_none")]
603    pub progress_entities: std::option::Option<crate::model::Progress>,
604
605    /// An estimate of the number of bytes processed.
606    #[serde(skip_serializing_if = "std::option::Option::is_none")]
607    pub progress_bytes: std::option::Option<crate::model::Progress>,
608
609    /// Description of which entities are being imported.
610    #[serde(skip_serializing_if = "std::option::Option::is_none")]
611    pub entity_filter: std::option::Option<crate::model::EntityFilter>,
612
613    /// The location of the import metadata file. This will be the same value as
614    /// the
615    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]
616    /// field.
617    ///
618    /// [google.datastore.admin.v1.ExportEntitiesResponse.output_url]: crate::model::ExportEntitiesResponse::output_url
619    #[serde(skip_serializing_if = "std::string::String::is_empty")]
620    pub input_url: std::string::String,
621
622    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
623    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
624}
625
626impl ImportEntitiesMetadata {
627    pub fn new() -> Self {
628        std::default::Default::default()
629    }
630
631    /// Sets the value of [common][crate::model::ImportEntitiesMetadata::common].
632    pub fn set_common<T: std::convert::Into<std::option::Option<crate::model::CommonMetadata>>>(
633        mut self,
634        v: T,
635    ) -> Self {
636        self.common = v.into();
637        self
638    }
639
640    /// Sets the value of [progress_entities][crate::model::ImportEntitiesMetadata::progress_entities].
641    pub fn set_progress_entities<
642        T: std::convert::Into<std::option::Option<crate::model::Progress>>,
643    >(
644        mut self,
645        v: T,
646    ) -> Self {
647        self.progress_entities = v.into();
648        self
649    }
650
651    /// Sets the value of [progress_bytes][crate::model::ImportEntitiesMetadata::progress_bytes].
652    pub fn set_progress_bytes<
653        T: std::convert::Into<std::option::Option<crate::model::Progress>>,
654    >(
655        mut self,
656        v: T,
657    ) -> Self {
658        self.progress_bytes = v.into();
659        self
660    }
661
662    /// Sets the value of [entity_filter][crate::model::ImportEntitiesMetadata::entity_filter].
663    pub fn set_entity_filter<
664        T: std::convert::Into<std::option::Option<crate::model::EntityFilter>>,
665    >(
666        mut self,
667        v: T,
668    ) -> Self {
669        self.entity_filter = v.into();
670        self
671    }
672
673    /// Sets the value of [input_url][crate::model::ImportEntitiesMetadata::input_url].
674    pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
675        self.input_url = v.into();
676        self
677    }
678}
679
680impl wkt::message::Message for ImportEntitiesMetadata {
681    fn typename() -> &'static str {
682        "type.googleapis.com/google.datastore.admin.v1.ImportEntitiesMetadata"
683    }
684}
685
686/// Identifies a subset of entities in a project. This is specified as
687/// combinations of kinds and namespaces (either or both of which may be all, as
688/// described in the following examples).
689/// Example usage:
690///
691/// Entire project:
692/// kinds=[], namespace_ids=[]
693///
694/// Kinds Foo and Bar in all namespaces:
695/// kinds=['Foo', 'Bar'], namespace_ids=[]
696///
697/// Kinds Foo and Bar only in the default namespace:
698/// kinds=['Foo', 'Bar'], namespace_ids=['']
699///
700/// Kinds Foo and Bar in both the default and Baz namespaces:
701/// kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
702///
703/// The entire Baz namespace:
704/// kinds=[], namespace_ids=['Baz']
705#[serde_with::serde_as]
706#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
707#[serde(default, rename_all = "camelCase")]
708#[non_exhaustive]
709pub struct EntityFilter {
710    /// If empty, then this represents all kinds.
711    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
712    pub kinds: std::vec::Vec<std::string::String>,
713
714    /// An empty list represents all namespaces. This is the preferred
715    /// usage for projects that don't use namespaces.
716    ///
717    /// An empty string element represents the default namespace. This should be
718    /// used if the project has data in non-default namespaces, but doesn't want to
719    /// include them.
720    /// Each namespace in this list must be unique.
721    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
722    pub namespace_ids: std::vec::Vec<std::string::String>,
723
724    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
725    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
726}
727
728impl EntityFilter {
729    pub fn new() -> Self {
730        std::default::Default::default()
731    }
732
733    /// Sets the value of [kinds][crate::model::EntityFilter::kinds].
734    pub fn set_kinds<T, V>(mut self, v: T) -> Self
735    where
736        T: std::iter::IntoIterator<Item = V>,
737        V: std::convert::Into<std::string::String>,
738    {
739        use std::iter::Iterator;
740        self.kinds = v.into_iter().map(|i| i.into()).collect();
741        self
742    }
743
744    /// Sets the value of [namespace_ids][crate::model::EntityFilter::namespace_ids].
745    pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
746    where
747        T: std::iter::IntoIterator<Item = V>,
748        V: std::convert::Into<std::string::String>,
749    {
750        use std::iter::Iterator;
751        self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
752        self
753    }
754}
755
756impl wkt::message::Message for EntityFilter {
757    fn typename() -> &'static str {
758        "type.googleapis.com/google.datastore.admin.v1.EntityFilter"
759    }
760}
761
762/// The request for
763/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
764///
765/// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]: crate::client::DatastoreAdmin::create_index
766#[serde_with::serde_as]
767#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
768#[serde(default, rename_all = "camelCase")]
769#[non_exhaustive]
770pub struct CreateIndexRequest {
771    /// Project ID against which to make the request.
772    #[serde(skip_serializing_if = "std::string::String::is_empty")]
773    pub project_id: std::string::String,
774
775    /// The index to create. The name and state fields are output only and will be
776    /// ignored. Single property indexes cannot be created or deleted.
777    #[serde(skip_serializing_if = "std::option::Option::is_none")]
778    pub index: std::option::Option<crate::model::Index>,
779
780    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
781    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
782}
783
784impl CreateIndexRequest {
785    pub fn new() -> Self {
786        std::default::Default::default()
787    }
788
789    /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
790    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
791        self.project_id = v.into();
792        self
793    }
794
795    /// Sets the value of [index][crate::model::CreateIndexRequest::index].
796    pub fn set_index<T: std::convert::Into<std::option::Option<crate::model::Index>>>(
797        mut self,
798        v: T,
799    ) -> Self {
800        self.index = v.into();
801        self
802    }
803}
804
805impl wkt::message::Message for CreateIndexRequest {
806    fn typename() -> &'static str {
807        "type.googleapis.com/google.datastore.admin.v1.CreateIndexRequest"
808    }
809}
810
811/// The request for
812/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex].
813///
814/// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex]: crate::client::DatastoreAdmin::delete_index
815#[serde_with::serde_as]
816#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
817#[serde(default, rename_all = "camelCase")]
818#[non_exhaustive]
819pub struct DeleteIndexRequest {
820    /// Project ID against which to make the request.
821    #[serde(skip_serializing_if = "std::string::String::is_empty")]
822    pub project_id: std::string::String,
823
824    /// The resource ID of the index to delete.
825    #[serde(skip_serializing_if = "std::string::String::is_empty")]
826    pub index_id: std::string::String,
827
828    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
829    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
830}
831
832impl DeleteIndexRequest {
833    pub fn new() -> Self {
834        std::default::Default::default()
835    }
836
837    /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
838    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
839        self.project_id = v.into();
840        self
841    }
842
843    /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
844    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
845        self.index_id = v.into();
846        self
847    }
848}
849
850impl wkt::message::Message for DeleteIndexRequest {
851    fn typename() -> &'static str {
852        "type.googleapis.com/google.datastore.admin.v1.DeleteIndexRequest"
853    }
854}
855
856/// The request for
857/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex].
858///
859/// [google.datastore.admin.v1.DatastoreAdmin.GetIndex]: crate::client::DatastoreAdmin::get_index
860#[serde_with::serde_as]
861#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
862#[serde(default, rename_all = "camelCase")]
863#[non_exhaustive]
864pub struct GetIndexRequest {
865    /// Project ID against which to make the request.
866    #[serde(skip_serializing_if = "std::string::String::is_empty")]
867    pub project_id: std::string::String,
868
869    /// The resource ID of the index to get.
870    #[serde(skip_serializing_if = "std::string::String::is_empty")]
871    pub index_id: std::string::String,
872
873    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
874    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
875}
876
877impl GetIndexRequest {
878    pub fn new() -> Self {
879        std::default::Default::default()
880    }
881
882    /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
883    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
884        self.project_id = v.into();
885        self
886    }
887
888    /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
889    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
890        self.index_id = v.into();
891        self
892    }
893}
894
895impl wkt::message::Message for GetIndexRequest {
896    fn typename() -> &'static str {
897        "type.googleapis.com/google.datastore.admin.v1.GetIndexRequest"
898    }
899}
900
901/// The request for
902/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
903///
904/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
905#[serde_with::serde_as]
906#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
907#[serde(default, rename_all = "camelCase")]
908#[non_exhaustive]
909pub struct ListIndexesRequest {
910    /// Project ID against which to make the request.
911    #[serde(skip_serializing_if = "std::string::String::is_empty")]
912    pub project_id: std::string::String,
913
914    #[serde(skip_serializing_if = "std::string::String::is_empty")]
915    pub filter: std::string::String,
916
917    /// The maximum number of items to return.  If zero, then all results will be
918    /// returned.
919    pub page_size: i32,
920
921    /// The next_page_token value returned from a previous List request, if any.
922    #[serde(skip_serializing_if = "std::string::String::is_empty")]
923    pub page_token: std::string::String,
924
925    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
926    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
927}
928
929impl ListIndexesRequest {
930    pub fn new() -> Self {
931        std::default::Default::default()
932    }
933
934    /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
935    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
936        self.project_id = v.into();
937        self
938    }
939
940    /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
941    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
942        self.filter = v.into();
943        self
944    }
945
946    /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
947    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
948        self.page_size = v.into();
949        self
950    }
951
952    /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
953    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
954        self.page_token = v.into();
955        self
956    }
957}
958
959impl wkt::message::Message for ListIndexesRequest {
960    fn typename() -> &'static str {
961        "type.googleapis.com/google.datastore.admin.v1.ListIndexesRequest"
962    }
963}
964
965/// The response for
966/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
967///
968/// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes]: crate::client::DatastoreAdmin::list_indexes
969#[serde_with::serde_as]
970#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
971#[serde(default, rename_all = "camelCase")]
972#[non_exhaustive]
973pub struct ListIndexesResponse {
974    /// The indexes.
975    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
976    pub indexes: std::vec::Vec<crate::model::Index>,
977
978    /// The standard List next-page token.
979    #[serde(skip_serializing_if = "std::string::String::is_empty")]
980    pub next_page_token: std::string::String,
981
982    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
983    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
984}
985
986impl ListIndexesResponse {
987    pub fn new() -> Self {
988        std::default::Default::default()
989    }
990
991    /// Sets the value of [next_page_token][crate::model::ListIndexesResponse::next_page_token].
992    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
993        self.next_page_token = v.into();
994        self
995    }
996
997    /// Sets the value of [indexes][crate::model::ListIndexesResponse::indexes].
998    pub fn set_indexes<T, V>(mut self, v: T) -> Self
999    where
1000        T: std::iter::IntoIterator<Item = V>,
1001        V: std::convert::Into<crate::model::Index>,
1002    {
1003        use std::iter::Iterator;
1004        self.indexes = v.into_iter().map(|i| i.into()).collect();
1005        self
1006    }
1007}
1008
1009impl wkt::message::Message for ListIndexesResponse {
1010    fn typename() -> &'static str {
1011        "type.googleapis.com/google.datastore.admin.v1.ListIndexesResponse"
1012    }
1013}
1014
1015#[doc(hidden)]
1016impl gax::paginator::internal::PageableResponse for ListIndexesResponse {
1017    type PageItem = crate::model::Index;
1018
1019    fn items(self) -> std::vec::Vec<Self::PageItem> {
1020        self.indexes
1021    }
1022
1023    fn next_page_token(&self) -> std::string::String {
1024        use std::clone::Clone;
1025        self.next_page_token.clone()
1026    }
1027}
1028
1029/// Metadata for Index operations.
1030#[serde_with::serde_as]
1031#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1032#[serde(default, rename_all = "camelCase")]
1033#[non_exhaustive]
1034pub struct IndexOperationMetadata {
1035    /// Metadata common to all Datastore Admin operations.
1036    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1037    pub common: std::option::Option<crate::model::CommonMetadata>,
1038
1039    /// An estimate of the number of entities processed.
1040    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1041    pub progress_entities: std::option::Option<crate::model::Progress>,
1042
1043    /// The index resource ID that this operation is acting on.
1044    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1045    pub index_id: std::string::String,
1046
1047    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1048    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1049}
1050
1051impl IndexOperationMetadata {
1052    pub fn new() -> Self {
1053        std::default::Default::default()
1054    }
1055
1056    /// Sets the value of [common][crate::model::IndexOperationMetadata::common].
1057    pub fn set_common<T: std::convert::Into<std::option::Option<crate::model::CommonMetadata>>>(
1058        mut self,
1059        v: T,
1060    ) -> Self {
1061        self.common = v.into();
1062        self
1063    }
1064
1065    /// Sets the value of [progress_entities][crate::model::IndexOperationMetadata::progress_entities].
1066    pub fn set_progress_entities<
1067        T: std::convert::Into<std::option::Option<crate::model::Progress>>,
1068    >(
1069        mut self,
1070        v: T,
1071    ) -> Self {
1072        self.progress_entities = v.into();
1073        self
1074    }
1075
1076    /// Sets the value of [index_id][crate::model::IndexOperationMetadata::index_id].
1077    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1078        self.index_id = v.into();
1079        self
1080    }
1081}
1082
1083impl wkt::message::Message for IndexOperationMetadata {
1084    fn typename() -> &'static str {
1085        "type.googleapis.com/google.datastore.admin.v1.IndexOperationMetadata"
1086    }
1087}
1088
1089/// Metadata for Datastore to Firestore migration operations.
1090///
1091/// The DatastoreFirestoreMigration operation is not started by the end-user via
1092/// an explicit "creation" method. This is an intentional deviation from the LRO
1093/// design pattern.
1094///
1095/// This singleton resource can be accessed at:
1096/// "projects/{project_id}/operations/datastore-firestore-migration"
1097#[serde_with::serde_as]
1098#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1099#[serde(default, rename_all = "camelCase")]
1100#[non_exhaustive]
1101pub struct DatastoreFirestoreMigrationMetadata {
1102    /// The current state of migration from Cloud Datastore to Cloud Firestore in
1103    /// Datastore mode.
1104    pub migration_state: crate::model::MigrationState,
1105
1106    /// The current step of migration from Cloud Datastore to Cloud Firestore in
1107    /// Datastore mode.
1108    pub migration_step: crate::model::MigrationStep,
1109
1110    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1111    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1112}
1113
1114impl DatastoreFirestoreMigrationMetadata {
1115    pub fn new() -> Self {
1116        std::default::Default::default()
1117    }
1118
1119    /// Sets the value of [migration_state][crate::model::DatastoreFirestoreMigrationMetadata::migration_state].
1120    pub fn set_migration_state<T: std::convert::Into<crate::model::MigrationState>>(
1121        mut self,
1122        v: T,
1123    ) -> Self {
1124        self.migration_state = v.into();
1125        self
1126    }
1127
1128    /// Sets the value of [migration_step][crate::model::DatastoreFirestoreMigrationMetadata::migration_step].
1129    pub fn set_migration_step<T: std::convert::Into<crate::model::MigrationStep>>(
1130        mut self,
1131        v: T,
1132    ) -> Self {
1133        self.migration_step = v.into();
1134        self
1135    }
1136}
1137
1138impl wkt::message::Message for DatastoreFirestoreMigrationMetadata {
1139    fn typename() -> &'static str {
1140        "type.googleapis.com/google.datastore.admin.v1.DatastoreFirestoreMigrationMetadata"
1141    }
1142}
1143
1144/// Datastore composite index definition.
1145#[serde_with::serde_as]
1146#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1147#[serde(default, rename_all = "camelCase")]
1148#[non_exhaustive]
1149pub struct Index {
1150    /// Output only. Project ID.
1151    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1152    pub project_id: std::string::String,
1153
1154    /// Output only. The resource ID of the index.
1155    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1156    pub index_id: std::string::String,
1157
1158    /// Required. The entity kind to which this index applies.
1159    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1160    pub kind: std::string::String,
1161
1162    /// Required. The index's ancestor mode.  Must not be
1163    /// ANCESTOR_MODE_UNSPECIFIED.
1164    pub ancestor: crate::model::index::AncestorMode,
1165
1166    /// Required. An ordered sequence of property names and their index attributes.
1167    ///
1168    /// Requires:
1169    ///
1170    /// * A maximum of 100 properties.
1171    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1172    pub properties: std::vec::Vec<crate::model::index::IndexedProperty>,
1173
1174    /// Output only. The state of the index.
1175    pub state: crate::model::index::State,
1176
1177    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1178    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1179}
1180
1181impl Index {
1182    pub fn new() -> Self {
1183        std::default::Default::default()
1184    }
1185
1186    /// Sets the value of [project_id][crate::model::Index::project_id].
1187    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1188        self.project_id = v.into();
1189        self
1190    }
1191
1192    /// Sets the value of [index_id][crate::model::Index::index_id].
1193    pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1194        self.index_id = v.into();
1195        self
1196    }
1197
1198    /// Sets the value of [kind][crate::model::Index::kind].
1199    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1200        self.kind = v.into();
1201        self
1202    }
1203
1204    /// Sets the value of [ancestor][crate::model::Index::ancestor].
1205    pub fn set_ancestor<T: std::convert::Into<crate::model::index::AncestorMode>>(
1206        mut self,
1207        v: T,
1208    ) -> Self {
1209        self.ancestor = v.into();
1210        self
1211    }
1212
1213    /// Sets the value of [state][crate::model::Index::state].
1214    pub fn set_state<T: std::convert::Into<crate::model::index::State>>(mut self, v: T) -> Self {
1215        self.state = v.into();
1216        self
1217    }
1218
1219    /// Sets the value of [properties][crate::model::Index::properties].
1220    pub fn set_properties<T, V>(mut self, v: T) -> Self
1221    where
1222        T: std::iter::IntoIterator<Item = V>,
1223        V: std::convert::Into<crate::model::index::IndexedProperty>,
1224    {
1225        use std::iter::Iterator;
1226        self.properties = v.into_iter().map(|i| i.into()).collect();
1227        self
1228    }
1229}
1230
1231impl wkt::message::Message for Index {
1232    fn typename() -> &'static str {
1233        "type.googleapis.com/google.datastore.admin.v1.Index"
1234    }
1235}
1236
1237/// Defines additional types related to [Index].
1238pub mod index {
1239    #[allow(unused_imports)]
1240    use super::*;
1241
1242    /// A property of an index.
1243    #[serde_with::serde_as]
1244    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1245    #[serde(default, rename_all = "camelCase")]
1246    #[non_exhaustive]
1247    pub struct IndexedProperty {
1248        /// Required. The property name to index.
1249        #[serde(skip_serializing_if = "std::string::String::is_empty")]
1250        pub name: std::string::String,
1251
1252        /// Required. The indexed property's direction.  Must not be
1253        /// DIRECTION_UNSPECIFIED.
1254        pub direction: crate::model::index::Direction,
1255
1256        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1257        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1258    }
1259
1260    impl IndexedProperty {
1261        pub fn new() -> Self {
1262            std::default::Default::default()
1263        }
1264
1265        /// Sets the value of [name][crate::model::index::IndexedProperty::name].
1266        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267            self.name = v.into();
1268            self
1269        }
1270
1271        /// Sets the value of [direction][crate::model::index::IndexedProperty::direction].
1272        pub fn set_direction<T: std::convert::Into<crate::model::index::Direction>>(
1273            mut self,
1274            v: T,
1275        ) -> Self {
1276            self.direction = v.into();
1277            self
1278        }
1279    }
1280
1281    impl wkt::message::Message for IndexedProperty {
1282        fn typename() -> &'static str {
1283            "type.googleapis.com/google.datastore.admin.v1.Index.IndexedProperty"
1284        }
1285    }
1286
1287    /// For an ordered index, specifies whether each of the entity's ancestors
1288    /// will be included.
1289    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1290    pub struct AncestorMode(i32);
1291
1292    impl AncestorMode {
1293        /// The ancestor mode is unspecified.
1294        pub const ANCESTOR_MODE_UNSPECIFIED: AncestorMode = AncestorMode::new(0);
1295
1296        /// Do not include the entity's ancestors in the index.
1297        pub const NONE: AncestorMode = AncestorMode::new(1);
1298
1299        /// Include all the entity's ancestors in the index.
1300        pub const ALL_ANCESTORS: AncestorMode = AncestorMode::new(2);
1301
1302        /// Creates a new AncestorMode instance.
1303        pub(crate) const fn new(value: i32) -> Self {
1304            Self(value)
1305        }
1306
1307        /// Gets the enum value.
1308        pub fn value(&self) -> i32 {
1309            self.0
1310        }
1311
1312        /// Gets the enum value as a string.
1313        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1314            match self.0 {
1315                0 => std::borrow::Cow::Borrowed("ANCESTOR_MODE_UNSPECIFIED"),
1316                1 => std::borrow::Cow::Borrowed("NONE"),
1317                2 => std::borrow::Cow::Borrowed("ALL_ANCESTORS"),
1318                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1319            }
1320        }
1321
1322        /// Creates an enum value from the value name.
1323        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1324            match name {
1325                "ANCESTOR_MODE_UNSPECIFIED" => {
1326                    std::option::Option::Some(Self::ANCESTOR_MODE_UNSPECIFIED)
1327                }
1328                "NONE" => std::option::Option::Some(Self::NONE),
1329                "ALL_ANCESTORS" => std::option::Option::Some(Self::ALL_ANCESTORS),
1330                _ => std::option::Option::None,
1331            }
1332        }
1333    }
1334
1335    impl std::convert::From<i32> for AncestorMode {
1336        fn from(value: i32) -> Self {
1337            Self::new(value)
1338        }
1339    }
1340
1341    impl std::default::Default for AncestorMode {
1342        fn default() -> Self {
1343            Self::new(0)
1344        }
1345    }
1346
1347    /// The direction determines how a property is indexed.
1348    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1349    pub struct Direction(i32);
1350
1351    impl Direction {
1352        /// The direction is unspecified.
1353        pub const DIRECTION_UNSPECIFIED: Direction = Direction::new(0);
1354
1355        /// The property's values are indexed so as to support sequencing in
1356        /// ascending order and also query by <, >, <=, >=, and =.
1357        pub const ASCENDING: Direction = Direction::new(1);
1358
1359        /// The property's values are indexed so as to support sequencing in
1360        /// descending order and also query by <, >, <=, >=, and =.
1361        pub const DESCENDING: Direction = Direction::new(2);
1362
1363        /// Creates a new Direction instance.
1364        pub(crate) const fn new(value: i32) -> Self {
1365            Self(value)
1366        }
1367
1368        /// Gets the enum value.
1369        pub fn value(&self) -> i32 {
1370            self.0
1371        }
1372
1373        /// Gets the enum value as a string.
1374        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1375            match self.0 {
1376                0 => std::borrow::Cow::Borrowed("DIRECTION_UNSPECIFIED"),
1377                1 => std::borrow::Cow::Borrowed("ASCENDING"),
1378                2 => std::borrow::Cow::Borrowed("DESCENDING"),
1379                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1380            }
1381        }
1382
1383        /// Creates an enum value from the value name.
1384        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1385            match name {
1386                "DIRECTION_UNSPECIFIED" => std::option::Option::Some(Self::DIRECTION_UNSPECIFIED),
1387                "ASCENDING" => std::option::Option::Some(Self::ASCENDING),
1388                "DESCENDING" => std::option::Option::Some(Self::DESCENDING),
1389                _ => std::option::Option::None,
1390            }
1391        }
1392    }
1393
1394    impl std::convert::From<i32> for Direction {
1395        fn from(value: i32) -> Self {
1396            Self::new(value)
1397        }
1398    }
1399
1400    impl std::default::Default for Direction {
1401        fn default() -> Self {
1402            Self::new(0)
1403        }
1404    }
1405
1406    /// The possible set of states of an index.
1407    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1408    pub struct State(i32);
1409
1410    impl State {
1411        /// The state is unspecified.
1412        pub const STATE_UNSPECIFIED: State = State::new(0);
1413
1414        /// The index is being created, and cannot be used by queries.
1415        /// There is an active long-running operation for the index.
1416        /// The index is updated when writing an entity.
1417        /// Some index data may exist.
1418        pub const CREATING: State = State::new(1);
1419
1420        /// The index is ready to be used.
1421        /// The index is updated when writing an entity.
1422        /// The index is fully populated from all stored entities it applies to.
1423        pub const READY: State = State::new(2);
1424
1425        /// The index is being deleted, and cannot be used by queries.
1426        /// There is an active long-running operation for the index.
1427        /// The index is not updated when writing an entity.
1428        /// Some index data may exist.
1429        pub const DELETING: State = State::new(3);
1430
1431        /// The index was being created or deleted, but something went wrong.
1432        /// The index cannot by used by queries.
1433        /// There is no active long-running operation for the index,
1434        /// and the most recently finished long-running operation failed.
1435        /// The index is not updated when writing an entity.
1436        /// Some index data may exist.
1437        pub const ERROR: State = State::new(4);
1438
1439        /// Creates a new State instance.
1440        pub(crate) const fn new(value: i32) -> Self {
1441            Self(value)
1442        }
1443
1444        /// Gets the enum value.
1445        pub fn value(&self) -> i32 {
1446            self.0
1447        }
1448
1449        /// Gets the enum value as a string.
1450        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1451            match self.0 {
1452                0 => std::borrow::Cow::Borrowed("STATE_UNSPECIFIED"),
1453                1 => std::borrow::Cow::Borrowed("CREATING"),
1454                2 => std::borrow::Cow::Borrowed("READY"),
1455                3 => std::borrow::Cow::Borrowed("DELETING"),
1456                4 => std::borrow::Cow::Borrowed("ERROR"),
1457                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1458            }
1459        }
1460
1461        /// Creates an enum value from the value name.
1462        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1463            match name {
1464                "STATE_UNSPECIFIED" => std::option::Option::Some(Self::STATE_UNSPECIFIED),
1465                "CREATING" => std::option::Option::Some(Self::CREATING),
1466                "READY" => std::option::Option::Some(Self::READY),
1467                "DELETING" => std::option::Option::Some(Self::DELETING),
1468                "ERROR" => std::option::Option::Some(Self::ERROR),
1469                _ => std::option::Option::None,
1470            }
1471        }
1472    }
1473
1474    impl std::convert::From<i32> for State {
1475        fn from(value: i32) -> Self {
1476            Self::new(value)
1477        }
1478    }
1479
1480    impl std::default::Default for State {
1481        fn default() -> Self {
1482            Self::new(0)
1483        }
1484    }
1485}
1486
1487/// An event signifying a change in state of a [migration from Cloud Datastore to
1488/// Cloud Firestore in Datastore
1489/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
1490#[serde_with::serde_as]
1491#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1492#[serde(default, rename_all = "camelCase")]
1493#[non_exhaustive]
1494pub struct MigrationStateEvent {
1495    /// The new state of the migration.
1496    pub state: crate::model::MigrationState,
1497
1498    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1499    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1500}
1501
1502impl MigrationStateEvent {
1503    pub fn new() -> Self {
1504        std::default::Default::default()
1505    }
1506
1507    /// Sets the value of [state][crate::model::MigrationStateEvent::state].
1508    pub fn set_state<T: std::convert::Into<crate::model::MigrationState>>(mut self, v: T) -> Self {
1509        self.state = v.into();
1510        self
1511    }
1512}
1513
1514impl wkt::message::Message for MigrationStateEvent {
1515    fn typename() -> &'static str {
1516        "type.googleapis.com/google.datastore.admin.v1.MigrationStateEvent"
1517    }
1518}
1519
1520/// An event signifying the start of a new step in a [migration from Cloud
1521/// Datastore to Cloud Firestore in Datastore
1522/// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore).
1523#[serde_with::serde_as]
1524#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1525#[serde(default, rename_all = "camelCase")]
1526#[non_exhaustive]
1527pub struct MigrationProgressEvent {
1528    /// The step that is starting.
1529    ///
1530    /// An event with step set to `START` indicates that the migration
1531    /// has been reverted back to the initial pre-migration state.
1532    pub step: crate::model::MigrationStep,
1533
1534    /// Details about this step.
1535    #[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
1536    pub step_details: std::option::Option<crate::model::migration_progress_event::StepDetails>,
1537
1538    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1539    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1540}
1541
1542impl MigrationProgressEvent {
1543    pub fn new() -> Self {
1544        std::default::Default::default()
1545    }
1546
1547    /// Sets the value of [step][crate::model::MigrationProgressEvent::step].
1548    pub fn set_step<T: std::convert::Into<crate::model::MigrationStep>>(mut self, v: T) -> Self {
1549        self.step = v.into();
1550        self
1551    }
1552
1553    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details].
1554    ///
1555    /// Note that all the setters affecting `step_details` are mutually
1556    /// exclusive.
1557    pub fn set_step_details<
1558        T: std::convert::Into<
1559                std::option::Option<crate::model::migration_progress_event::StepDetails>,
1560            >,
1561    >(
1562        mut self,
1563        v: T,
1564    ) -> Self {
1565        self.step_details = v.into();
1566        self
1567    }
1568
1569    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
1570    /// if it holds a `PrepareStepDetails`, `None` if the field is not set or
1571    /// holds a different branch.
1572    pub fn prepare_step_details(
1573        &self,
1574    ) -> std::option::Option<
1575        &std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
1576    > {
1577        #[allow(unreachable_patterns)]
1578        self.step_details.as_ref().and_then(|v| match v {
1579            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v) => {
1580                std::option::Option::Some(v)
1581            }
1582            _ => std::option::Option::None,
1583        })
1584    }
1585
1586    /// The value of [step_details][crate::model::MigrationProgressEvent::step_details]
1587    /// if it holds a `RedirectWritesStepDetails`, `None` if the field is not set or
1588    /// holds a different branch.
1589    pub fn redirect_writes_step_details(
1590        &self,
1591    ) -> std::option::Option<
1592        &std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
1593    > {
1594        #[allow(unreachable_patterns)]
1595        self.step_details.as_ref().and_then(|v| match v {
1596            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(v) => {
1597                std::option::Option::Some(v)
1598            }
1599            _ => std::option::Option::None,
1600        })
1601    }
1602
1603    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
1604    /// to hold a `PrepareStepDetails`.
1605    ///
1606    /// Note that all the setters affecting `step_details` are
1607    /// mutually exclusive.
1608    pub fn set_prepare_step_details<
1609        T: std::convert::Into<
1610                std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
1611            >,
1612    >(
1613        mut self,
1614        v: T,
1615    ) -> Self {
1616        self.step_details = std::option::Option::Some(
1617            crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v.into()),
1618        );
1619        self
1620    }
1621
1622    /// Sets the value of [step_details][crate::model::MigrationProgressEvent::step_details]
1623    /// to hold a `RedirectWritesStepDetails`.
1624    ///
1625    /// Note that all the setters affecting `step_details` are
1626    /// mutually exclusive.
1627    pub fn set_redirect_writes_step_details<
1628        T: std::convert::Into<
1629                std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
1630            >,
1631    >(
1632        mut self,
1633        v: T,
1634    ) -> Self {
1635        self.step_details = std::option::Option::Some(
1636            crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(
1637                v.into(),
1638            ),
1639        );
1640        self
1641    }
1642}
1643
1644impl wkt::message::Message for MigrationProgressEvent {
1645    fn typename() -> &'static str {
1646        "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent"
1647    }
1648}
1649
1650/// Defines additional types related to [MigrationProgressEvent].
1651pub mod migration_progress_event {
1652    #[allow(unused_imports)]
1653    use super::*;
1654
1655    /// Details for the `PREPARE` step.
1656    #[serde_with::serde_as]
1657    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1658    #[serde(default, rename_all = "camelCase")]
1659    #[non_exhaustive]
1660    pub struct PrepareStepDetails {
1661        /// The concurrency mode this database will use when it reaches the
1662        /// `REDIRECT_WRITES` step.
1663        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
1664
1665        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1666        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1667    }
1668
1669    impl PrepareStepDetails {
1670        pub fn new() -> Self {
1671            std::default::Default::default()
1672        }
1673
1674        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::PrepareStepDetails::concurrency_mode].
1675        pub fn set_concurrency_mode<
1676            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
1677        >(
1678            mut self,
1679            v: T,
1680        ) -> Self {
1681            self.concurrency_mode = v.into();
1682            self
1683        }
1684    }
1685
1686    impl wkt::message::Message for PrepareStepDetails {
1687        fn typename() -> &'static str {
1688            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails"
1689        }
1690    }
1691
1692    /// Details for the `REDIRECT_WRITES` step.
1693    #[serde_with::serde_as]
1694    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1695    #[serde(default, rename_all = "camelCase")]
1696    #[non_exhaustive]
1697    pub struct RedirectWritesStepDetails {
1698        /// Ths concurrency mode for this database.
1699        pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
1700
1701        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1702        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1703    }
1704
1705    impl RedirectWritesStepDetails {
1706        pub fn new() -> Self {
1707            std::default::Default::default()
1708        }
1709
1710        /// Sets the value of [concurrency_mode][crate::model::migration_progress_event::RedirectWritesStepDetails::concurrency_mode].
1711        pub fn set_concurrency_mode<
1712            T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
1713        >(
1714            mut self,
1715            v: T,
1716        ) -> Self {
1717            self.concurrency_mode = v.into();
1718            self
1719        }
1720    }
1721
1722    impl wkt::message::Message for RedirectWritesStepDetails {
1723        fn typename() -> &'static str {
1724            "type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails"
1725        }
1726    }
1727
1728    /// Concurrency modes for transactions in Cloud Firestore.
1729    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1730    pub struct ConcurrencyMode(i32);
1731
1732    impl ConcurrencyMode {
1733        /// Unspecified.
1734        pub const CONCURRENCY_MODE_UNSPECIFIED: ConcurrencyMode = ConcurrencyMode::new(0);
1735
1736        /// Pessimistic concurrency.
1737        pub const PESSIMISTIC: ConcurrencyMode = ConcurrencyMode::new(1);
1738
1739        /// Optimistic concurrency.
1740        pub const OPTIMISTIC: ConcurrencyMode = ConcurrencyMode::new(2);
1741
1742        /// Optimistic concurrency with entity groups.
1743        pub const OPTIMISTIC_WITH_ENTITY_GROUPS: ConcurrencyMode = ConcurrencyMode::new(3);
1744
1745        /// Creates a new ConcurrencyMode instance.
1746        pub(crate) const fn new(value: i32) -> Self {
1747            Self(value)
1748        }
1749
1750        /// Gets the enum value.
1751        pub fn value(&self) -> i32 {
1752            self.0
1753        }
1754
1755        /// Gets the enum value as a string.
1756        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1757            match self.0 {
1758                0 => std::borrow::Cow::Borrowed("CONCURRENCY_MODE_UNSPECIFIED"),
1759                1 => std::borrow::Cow::Borrowed("PESSIMISTIC"),
1760                2 => std::borrow::Cow::Borrowed("OPTIMISTIC"),
1761                3 => std::borrow::Cow::Borrowed("OPTIMISTIC_WITH_ENTITY_GROUPS"),
1762                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1763            }
1764        }
1765
1766        /// Creates an enum value from the value name.
1767        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1768            match name {
1769                "CONCURRENCY_MODE_UNSPECIFIED" => {
1770                    std::option::Option::Some(Self::CONCURRENCY_MODE_UNSPECIFIED)
1771                }
1772                "PESSIMISTIC" => std::option::Option::Some(Self::PESSIMISTIC),
1773                "OPTIMISTIC" => std::option::Option::Some(Self::OPTIMISTIC),
1774                "OPTIMISTIC_WITH_ENTITY_GROUPS" => {
1775                    std::option::Option::Some(Self::OPTIMISTIC_WITH_ENTITY_GROUPS)
1776                }
1777                _ => std::option::Option::None,
1778            }
1779        }
1780    }
1781
1782    impl std::convert::From<i32> for ConcurrencyMode {
1783        fn from(value: i32) -> Self {
1784            Self::new(value)
1785        }
1786    }
1787
1788    impl std::default::Default for ConcurrencyMode {
1789        fn default() -> Self {
1790            Self::new(0)
1791        }
1792    }
1793
1794    /// Details about this step.
1795    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1796    #[serde(rename_all = "camelCase")]
1797    #[non_exhaustive]
1798    pub enum StepDetails {
1799        /// Details for the `PREPARE` step.
1800        PrepareStepDetails(
1801            std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
1802        ),
1803        /// Details for the `REDIRECT_WRITES` step.
1804        RedirectWritesStepDetails(
1805            std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
1806        ),
1807    }
1808}
1809
1810/// Operation types.
1811#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1812pub struct OperationType(i32);
1813
1814impl OperationType {
1815    /// Unspecified.
1816    pub const OPERATION_TYPE_UNSPECIFIED: OperationType = OperationType::new(0);
1817
1818    /// ExportEntities.
1819    pub const EXPORT_ENTITIES: OperationType = OperationType::new(1);
1820
1821    /// ImportEntities.
1822    pub const IMPORT_ENTITIES: OperationType = OperationType::new(2);
1823
1824    /// CreateIndex.
1825    pub const CREATE_INDEX: OperationType = OperationType::new(3);
1826
1827    /// DeleteIndex.
1828    pub const DELETE_INDEX: OperationType = OperationType::new(4);
1829
1830    /// Creates a new OperationType instance.
1831    pub(crate) const fn new(value: i32) -> Self {
1832        Self(value)
1833    }
1834
1835    /// Gets the enum value.
1836    pub fn value(&self) -> i32 {
1837        self.0
1838    }
1839
1840    /// Gets the enum value as a string.
1841    pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1842        match self.0 {
1843            0 => std::borrow::Cow::Borrowed("OPERATION_TYPE_UNSPECIFIED"),
1844            1 => std::borrow::Cow::Borrowed("EXPORT_ENTITIES"),
1845            2 => std::borrow::Cow::Borrowed("IMPORT_ENTITIES"),
1846            3 => std::borrow::Cow::Borrowed("CREATE_INDEX"),
1847            4 => std::borrow::Cow::Borrowed("DELETE_INDEX"),
1848            _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1849        }
1850    }
1851
1852    /// Creates an enum value from the value name.
1853    pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1854        match name {
1855            "OPERATION_TYPE_UNSPECIFIED" => {
1856                std::option::Option::Some(Self::OPERATION_TYPE_UNSPECIFIED)
1857            }
1858            "EXPORT_ENTITIES" => std::option::Option::Some(Self::EXPORT_ENTITIES),
1859            "IMPORT_ENTITIES" => std::option::Option::Some(Self::IMPORT_ENTITIES),
1860            "CREATE_INDEX" => std::option::Option::Some(Self::CREATE_INDEX),
1861            "DELETE_INDEX" => std::option::Option::Some(Self::DELETE_INDEX),
1862            _ => std::option::Option::None,
1863        }
1864    }
1865}
1866
1867impl std::convert::From<i32> for OperationType {
1868    fn from(value: i32) -> Self {
1869        Self::new(value)
1870    }
1871}
1872
1873impl std::default::Default for OperationType {
1874    fn default() -> Self {
1875        Self::new(0)
1876    }
1877}
1878
1879/// States for a migration.
1880#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1881pub struct MigrationState(i32);
1882
1883impl MigrationState {
1884    /// Unspecified.
1885    pub const MIGRATION_STATE_UNSPECIFIED: MigrationState = MigrationState::new(0);
1886
1887    /// The migration is running.
1888    pub const RUNNING: MigrationState = MigrationState::new(1);
1889
1890    /// The migration is paused.
1891    pub const PAUSED: MigrationState = MigrationState::new(2);
1892
1893    /// The migration is complete.
1894    pub const COMPLETE: MigrationState = MigrationState::new(3);
1895
1896    /// Creates a new MigrationState instance.
1897    pub(crate) const fn new(value: i32) -> Self {
1898        Self(value)
1899    }
1900
1901    /// Gets the enum value.
1902    pub fn value(&self) -> i32 {
1903        self.0
1904    }
1905
1906    /// Gets the enum value as a string.
1907    pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1908        match self.0 {
1909            0 => std::borrow::Cow::Borrowed("MIGRATION_STATE_UNSPECIFIED"),
1910            1 => std::borrow::Cow::Borrowed("RUNNING"),
1911            2 => std::borrow::Cow::Borrowed("PAUSED"),
1912            3 => std::borrow::Cow::Borrowed("COMPLETE"),
1913            _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1914        }
1915    }
1916
1917    /// Creates an enum value from the value name.
1918    pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1919        match name {
1920            "MIGRATION_STATE_UNSPECIFIED" => {
1921                std::option::Option::Some(Self::MIGRATION_STATE_UNSPECIFIED)
1922            }
1923            "RUNNING" => std::option::Option::Some(Self::RUNNING),
1924            "PAUSED" => std::option::Option::Some(Self::PAUSED),
1925            "COMPLETE" => std::option::Option::Some(Self::COMPLETE),
1926            _ => std::option::Option::None,
1927        }
1928    }
1929}
1930
1931impl std::convert::From<i32> for MigrationState {
1932    fn from(value: i32) -> Self {
1933        Self::new(value)
1934    }
1935}
1936
1937impl std::default::Default for MigrationState {
1938    fn default() -> Self {
1939        Self::new(0)
1940    }
1941}
1942
1943/// Steps in a migration.
1944#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1945pub struct MigrationStep(i32);
1946
1947impl MigrationStep {
1948    /// Unspecified.
1949    pub const MIGRATION_STEP_UNSPECIFIED: MigrationStep = MigrationStep::new(0);
1950
1951    /// Pre-migration: the database is prepared for migration.
1952    pub const PREPARE: MigrationStep = MigrationStep::new(6);
1953
1954    /// Start of migration.
1955    pub const START: MigrationStep = MigrationStep::new(1);
1956
1957    /// Writes are applied synchronously to at least one replica.
1958    pub const APPLY_WRITES_SYNCHRONOUSLY: MigrationStep = MigrationStep::new(7);
1959
1960    /// Data is copied to Cloud Firestore and then verified to match the data in
1961    /// Cloud Datastore.
1962    pub const COPY_AND_VERIFY: MigrationStep = MigrationStep::new(2);
1963
1964    /// Eventually-consistent reads are redirected to Cloud Firestore.
1965    pub const REDIRECT_EVENTUALLY_CONSISTENT_READS: MigrationStep = MigrationStep::new(3);
1966
1967    /// Strongly-consistent reads are redirected to Cloud Firestore.
1968    pub const REDIRECT_STRONGLY_CONSISTENT_READS: MigrationStep = MigrationStep::new(4);
1969
1970    /// Writes are redirected to Cloud Firestore.
1971    pub const REDIRECT_WRITES: MigrationStep = MigrationStep::new(5);
1972
1973    /// Creates a new MigrationStep instance.
1974    pub(crate) const fn new(value: i32) -> Self {
1975        Self(value)
1976    }
1977
1978    /// Gets the enum value.
1979    pub fn value(&self) -> i32 {
1980        self.0
1981    }
1982
1983    /// Gets the enum value as a string.
1984    pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1985        match self.0 {
1986            0 => std::borrow::Cow::Borrowed("MIGRATION_STEP_UNSPECIFIED"),
1987            1 => std::borrow::Cow::Borrowed("START"),
1988            2 => std::borrow::Cow::Borrowed("COPY_AND_VERIFY"),
1989            3 => std::borrow::Cow::Borrowed("REDIRECT_EVENTUALLY_CONSISTENT_READS"),
1990            4 => std::borrow::Cow::Borrowed("REDIRECT_STRONGLY_CONSISTENT_READS"),
1991            5 => std::borrow::Cow::Borrowed("REDIRECT_WRITES"),
1992            6 => std::borrow::Cow::Borrowed("PREPARE"),
1993            7 => std::borrow::Cow::Borrowed("APPLY_WRITES_SYNCHRONOUSLY"),
1994            _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1995        }
1996    }
1997
1998    /// Creates an enum value from the value name.
1999    pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2000        match name {
2001            "MIGRATION_STEP_UNSPECIFIED" => {
2002                std::option::Option::Some(Self::MIGRATION_STEP_UNSPECIFIED)
2003            }
2004            "PREPARE" => std::option::Option::Some(Self::PREPARE),
2005            "START" => std::option::Option::Some(Self::START),
2006            "APPLY_WRITES_SYNCHRONOUSLY" => {
2007                std::option::Option::Some(Self::APPLY_WRITES_SYNCHRONOUSLY)
2008            }
2009            "COPY_AND_VERIFY" => std::option::Option::Some(Self::COPY_AND_VERIFY),
2010            "REDIRECT_EVENTUALLY_CONSISTENT_READS" => {
2011                std::option::Option::Some(Self::REDIRECT_EVENTUALLY_CONSISTENT_READS)
2012            }
2013            "REDIRECT_STRONGLY_CONSISTENT_READS" => {
2014                std::option::Option::Some(Self::REDIRECT_STRONGLY_CONSISTENT_READS)
2015            }
2016            "REDIRECT_WRITES" => std::option::Option::Some(Self::REDIRECT_WRITES),
2017            _ => std::option::Option::None,
2018        }
2019    }
2020}
2021
2022impl std::convert::From<i32> for MigrationStep {
2023    fn from(value: i32) -> Self {
2024        Self::new(value)
2025    }
2026}
2027
2028impl std::default::Default for MigrationStep {
2029    fn default() -> Self {
2030        Self::new(0)
2031    }
2032}