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