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