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