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