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