google_cloud_firestore_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 google_cloud_type;
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/// A Backup of a Cloud Firestore Database.
39///
40/// The backup contains all documents and index configurations for the given
41/// database at a specific point in time.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Backup {
45 /// Output only. The unique resource name of the Backup.
46 ///
47 /// Format is `projects/{project}/locations/{location}/backups/{backup}`.
48 ///
49 /// The location in the name will be the Standard Managed Multi-Region (SMMR)
50 /// location (e.g. `us`) if the backup was created with an SMMR location, or
51 /// the Google Managed Multi-Region (GMMR) location (e.g. `nam5`) if the backup
52 /// was created with a GMMR location.
53 pub name: std::string::String,
54
55 /// Output only. Name of the Firestore database that the backup is from.
56 ///
57 /// Format is `projects/{project}/databases/{database}`.
58 pub database: std::string::String,
59
60 /// Output only. The system-generated UUID4 for the Firestore database that the
61 /// backup is from.
62 pub database_uid: std::string::String,
63
64 /// Output only. The backup contains an externally consistent copy of the
65 /// database at this time.
66 pub snapshot_time: std::option::Option<wkt::Timestamp>,
67
68 /// Output only. The timestamp at which this backup expires.
69 pub expire_time: std::option::Option<wkt::Timestamp>,
70
71 /// Output only. Statistics about the backup.
72 ///
73 /// This data only becomes available after the backup is fully materialized to
74 /// secondary storage. This field will be empty till then.
75 pub stats: std::option::Option<crate::model::backup::Stats>,
76
77 /// Output only. The current state of the backup.
78 pub state: crate::model::backup::State,
79
80 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
81}
82
83impl Backup {
84 /// Creates a new default instance.
85 pub fn new() -> Self {
86 std::default::Default::default()
87 }
88
89 /// Sets the value of [name][crate::model::Backup::name].
90 ///
91 /// # Example
92 /// ```ignore,no_run
93 /// # use google_cloud_firestore_admin_v1::model::Backup;
94 /// let x = Backup::new().set_name("example");
95 /// ```
96 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
97 self.name = v.into();
98 self
99 }
100
101 /// Sets the value of [database][crate::model::Backup::database].
102 ///
103 /// # Example
104 /// ```ignore,no_run
105 /// # use google_cloud_firestore_admin_v1::model::Backup;
106 /// let x = Backup::new().set_database("example");
107 /// ```
108 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
109 self.database = v.into();
110 self
111 }
112
113 /// Sets the value of [database_uid][crate::model::Backup::database_uid].
114 ///
115 /// # Example
116 /// ```ignore,no_run
117 /// # use google_cloud_firestore_admin_v1::model::Backup;
118 /// let x = Backup::new().set_database_uid("example");
119 /// ```
120 pub fn set_database_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
121 self.database_uid = v.into();
122 self
123 }
124
125 /// Sets the value of [snapshot_time][crate::model::Backup::snapshot_time].
126 ///
127 /// # Example
128 /// ```ignore,no_run
129 /// # use google_cloud_firestore_admin_v1::model::Backup;
130 /// use wkt::Timestamp;
131 /// let x = Backup::new().set_snapshot_time(Timestamp::default()/* use setters */);
132 /// ```
133 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
134 where
135 T: std::convert::Into<wkt::Timestamp>,
136 {
137 self.snapshot_time = std::option::Option::Some(v.into());
138 self
139 }
140
141 /// Sets or clears the value of [snapshot_time][crate::model::Backup::snapshot_time].
142 ///
143 /// # Example
144 /// ```ignore,no_run
145 /// # use google_cloud_firestore_admin_v1::model::Backup;
146 /// use wkt::Timestamp;
147 /// let x = Backup::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
148 /// let x = Backup::new().set_or_clear_snapshot_time(None::<Timestamp>);
149 /// ```
150 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
151 where
152 T: std::convert::Into<wkt::Timestamp>,
153 {
154 self.snapshot_time = v.map(|x| x.into());
155 self
156 }
157
158 /// Sets the value of [expire_time][crate::model::Backup::expire_time].
159 ///
160 /// # Example
161 /// ```ignore,no_run
162 /// # use google_cloud_firestore_admin_v1::model::Backup;
163 /// use wkt::Timestamp;
164 /// let x = Backup::new().set_expire_time(Timestamp::default()/* use setters */);
165 /// ```
166 pub fn set_expire_time<T>(mut self, v: T) -> Self
167 where
168 T: std::convert::Into<wkt::Timestamp>,
169 {
170 self.expire_time = std::option::Option::Some(v.into());
171 self
172 }
173
174 /// Sets or clears the value of [expire_time][crate::model::Backup::expire_time].
175 ///
176 /// # Example
177 /// ```ignore,no_run
178 /// # use google_cloud_firestore_admin_v1::model::Backup;
179 /// use wkt::Timestamp;
180 /// let x = Backup::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
181 /// let x = Backup::new().set_or_clear_expire_time(None::<Timestamp>);
182 /// ```
183 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
184 where
185 T: std::convert::Into<wkt::Timestamp>,
186 {
187 self.expire_time = v.map(|x| x.into());
188 self
189 }
190
191 /// Sets the value of [stats][crate::model::Backup::stats].
192 ///
193 /// # Example
194 /// ```ignore,no_run
195 /// # use google_cloud_firestore_admin_v1::model::Backup;
196 /// use google_cloud_firestore_admin_v1::model::backup::Stats;
197 /// let x = Backup::new().set_stats(Stats::default()/* use setters */);
198 /// ```
199 pub fn set_stats<T>(mut self, v: T) -> Self
200 where
201 T: std::convert::Into<crate::model::backup::Stats>,
202 {
203 self.stats = std::option::Option::Some(v.into());
204 self
205 }
206
207 /// Sets or clears the value of [stats][crate::model::Backup::stats].
208 ///
209 /// # Example
210 /// ```ignore,no_run
211 /// # use google_cloud_firestore_admin_v1::model::Backup;
212 /// use google_cloud_firestore_admin_v1::model::backup::Stats;
213 /// let x = Backup::new().set_or_clear_stats(Some(Stats::default()/* use setters */));
214 /// let x = Backup::new().set_or_clear_stats(None::<Stats>);
215 /// ```
216 pub fn set_or_clear_stats<T>(mut self, v: std::option::Option<T>) -> Self
217 where
218 T: std::convert::Into<crate::model::backup::Stats>,
219 {
220 self.stats = v.map(|x| x.into());
221 self
222 }
223
224 /// Sets the value of [state][crate::model::Backup::state].
225 ///
226 /// # Example
227 /// ```ignore,no_run
228 /// # use google_cloud_firestore_admin_v1::model::Backup;
229 /// use google_cloud_firestore_admin_v1::model::backup::State;
230 /// let x0 = Backup::new().set_state(State::Creating);
231 /// let x1 = Backup::new().set_state(State::Ready);
232 /// let x2 = Backup::new().set_state(State::NotAvailable);
233 /// ```
234 pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
235 self.state = v.into();
236 self
237 }
238}
239
240impl wkt::message::Message for Backup {
241 fn typename() -> &'static str {
242 "type.googleapis.com/google.firestore.admin.v1.Backup"
243 }
244}
245
246/// Defines additional types related to [Backup].
247pub mod backup {
248 #[allow(unused_imports)]
249 use super::*;
250
251 /// Backup specific statistics.
252 #[derive(Clone, Default, PartialEq)]
253 #[non_exhaustive]
254 pub struct Stats {
255 /// Output only. Summation of the size of all documents and index entries in
256 /// the backup, measured in bytes.
257 pub size_bytes: i64,
258
259 /// Output only. The total number of documents contained in the backup.
260 pub document_count: i64,
261
262 /// Output only. The total number of index entries contained in the backup.
263 pub index_count: i64,
264
265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
266 }
267
268 impl Stats {
269 /// Creates a new default instance.
270 pub fn new() -> Self {
271 std::default::Default::default()
272 }
273
274 /// Sets the value of [size_bytes][crate::model::backup::Stats::size_bytes].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_firestore_admin_v1::model::backup::Stats;
279 /// let x = Stats::new().set_size_bytes(42);
280 /// ```
281 pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
282 self.size_bytes = v.into();
283 self
284 }
285
286 /// Sets the value of [document_count][crate::model::backup::Stats::document_count].
287 ///
288 /// # Example
289 /// ```ignore,no_run
290 /// # use google_cloud_firestore_admin_v1::model::backup::Stats;
291 /// let x = Stats::new().set_document_count(42);
292 /// ```
293 pub fn set_document_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
294 self.document_count = v.into();
295 self
296 }
297
298 /// Sets the value of [index_count][crate::model::backup::Stats::index_count].
299 ///
300 /// # Example
301 /// ```ignore,no_run
302 /// # use google_cloud_firestore_admin_v1::model::backup::Stats;
303 /// let x = Stats::new().set_index_count(42);
304 /// ```
305 pub fn set_index_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
306 self.index_count = v.into();
307 self
308 }
309 }
310
311 impl wkt::message::Message for Stats {
312 fn typename() -> &'static str {
313 "type.googleapis.com/google.firestore.admin.v1.Backup.Stats"
314 }
315 }
316
317 /// Indicate the current state of the backup.
318 ///
319 /// # Working with unknown values
320 ///
321 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
322 /// additional enum variants at any time. Adding new variants is not considered
323 /// a breaking change. Applications should write their code in anticipation of:
324 ///
325 /// - New values appearing in future releases of the client library, **and**
326 /// - New values received dynamically, without application changes.
327 ///
328 /// Please consult the [Working with enums] section in the user guide for some
329 /// guidelines.
330 ///
331 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
332 #[derive(Clone, Debug, PartialEq)]
333 #[non_exhaustive]
334 pub enum State {
335 /// The state is unspecified.
336 Unspecified,
337 /// The pending backup is still being created. Operations on the
338 /// backup will be rejected in this state.
339 Creating,
340 /// The backup is complete and ready to use.
341 Ready,
342 /// The backup is not available at this moment.
343 NotAvailable,
344 /// If set, the enum was initialized with an unknown value.
345 ///
346 /// Applications can examine the value using [State::value] or
347 /// [State::name].
348 UnknownValue(state::UnknownValue),
349 }
350
351 #[doc(hidden)]
352 pub mod state {
353 #[allow(unused_imports)]
354 use super::*;
355 #[derive(Clone, Debug, PartialEq)]
356 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
357 }
358
359 impl State {
360 /// Gets the enum value.
361 ///
362 /// Returns `None` if the enum contains an unknown value deserialized from
363 /// the string representation of enums.
364 pub fn value(&self) -> std::option::Option<i32> {
365 match self {
366 Self::Unspecified => std::option::Option::Some(0),
367 Self::Creating => std::option::Option::Some(1),
368 Self::Ready => std::option::Option::Some(2),
369 Self::NotAvailable => std::option::Option::Some(3),
370 Self::UnknownValue(u) => u.0.value(),
371 }
372 }
373
374 /// Gets the enum value as a string.
375 ///
376 /// Returns `None` if the enum contains an unknown value deserialized from
377 /// the integer representation of enums.
378 pub fn name(&self) -> std::option::Option<&str> {
379 match self {
380 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
381 Self::Creating => std::option::Option::Some("CREATING"),
382 Self::Ready => std::option::Option::Some("READY"),
383 Self::NotAvailable => std::option::Option::Some("NOT_AVAILABLE"),
384 Self::UnknownValue(u) => u.0.name(),
385 }
386 }
387 }
388
389 impl std::default::Default for State {
390 fn default() -> Self {
391 use std::convert::From;
392 Self::from(0)
393 }
394 }
395
396 impl std::fmt::Display for State {
397 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
398 wkt::internal::display_enum(f, self.name(), self.value())
399 }
400 }
401
402 impl std::convert::From<i32> for State {
403 fn from(value: i32) -> Self {
404 match value {
405 0 => Self::Unspecified,
406 1 => Self::Creating,
407 2 => Self::Ready,
408 3 => Self::NotAvailable,
409 _ => Self::UnknownValue(state::UnknownValue(
410 wkt::internal::UnknownEnumValue::Integer(value),
411 )),
412 }
413 }
414 }
415
416 impl std::convert::From<&str> for State {
417 fn from(value: &str) -> Self {
418 use std::string::ToString;
419 match value {
420 "STATE_UNSPECIFIED" => Self::Unspecified,
421 "CREATING" => Self::Creating,
422 "READY" => Self::Ready,
423 "NOT_AVAILABLE" => Self::NotAvailable,
424 _ => Self::UnknownValue(state::UnknownValue(
425 wkt::internal::UnknownEnumValue::String(value.to_string()),
426 )),
427 }
428 }
429 }
430
431 impl serde::ser::Serialize for State {
432 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
433 where
434 S: serde::Serializer,
435 {
436 match self {
437 Self::Unspecified => serializer.serialize_i32(0),
438 Self::Creating => serializer.serialize_i32(1),
439 Self::Ready => serializer.serialize_i32(2),
440 Self::NotAvailable => serializer.serialize_i32(3),
441 Self::UnknownValue(u) => u.0.serialize(serializer),
442 }
443 }
444 }
445
446 impl<'de> serde::de::Deserialize<'de> for State {
447 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
448 where
449 D: serde::Deserializer<'de>,
450 {
451 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
452 ".google.firestore.admin.v1.Backup.State",
453 ))
454 }
455 }
456}
457
458/// A Cloud Firestore Database.
459#[derive(Clone, Default, PartialEq)]
460#[non_exhaustive]
461pub struct Database {
462 /// The resource name of the Database.
463 /// Format: `projects/{project}/databases/{database}`
464 pub name: std::string::String,
465
466 /// Output only. The system-generated UUID4 for this Database.
467 pub uid: std::string::String,
468
469 /// Output only. The timestamp at which this database was created. Databases
470 /// created before 2016 do not populate create_time.
471 pub create_time: std::option::Option<wkt::Timestamp>,
472
473 /// Output only. The timestamp at which this database was most recently
474 /// updated. Note this only includes updates to the database resource and not
475 /// data contained by the database.
476 pub update_time: std::option::Option<wkt::Timestamp>,
477
478 /// Output only. The timestamp at which this database was deleted. Only set if
479 /// the database has been deleted.
480 pub delete_time: std::option::Option<wkt::Timestamp>,
481
482 /// The location of the database. Available locations are listed at
483 /// <https://cloud.google.com/firestore/docs/locations>.
484 pub location_id: std::string::String,
485
486 /// The type of the database.
487 /// See <https://cloud.google.com/datastore/docs/firestore-or-datastore> for
488 /// information about how to choose.
489 pub r#type: crate::model::database::DatabaseType,
490
491 /// The concurrency control mode to use for this database.
492 ///
493 /// If unspecified in a CreateDatabase request, this will default based on the
494 /// database edition: Optimistic for Enterprise and Pessimistic for all other
495 /// databases.
496 pub concurrency_mode: crate::model::database::ConcurrencyMode,
497
498 /// Output only. The period during which past versions of data are retained in
499 /// the database.
500 ///
501 /// Any [read][google.firestore.v1.GetDocumentRequest.read_time]
502 /// or [query][google.firestore.v1.ListDocumentsRequest.read_time] can specify
503 /// a `read_time` within this window, and will read the state of the database
504 /// at that time.
505 ///
506 /// If the PITR feature is enabled, the retention period is 7 days. Otherwise,
507 /// the retention period is 1 hour.
508 pub version_retention_period: std::option::Option<wkt::Duration>,
509
510 /// Output only. The earliest timestamp at which older versions of the data can
511 /// be read from the database. See [version_retention_period] above; this field
512 /// is populated with `now - version_retention_period`.
513 ///
514 /// This value is continuously updated, and becomes stale the moment it is
515 /// queried. If you are using this value to recover data, make sure to account
516 /// for the time from the moment when the value is queried to the moment when
517 /// you initiate the recovery.
518 pub earliest_version_time: std::option::Option<wkt::Timestamp>,
519
520 /// Whether to enable the PITR feature on this database.
521 pub point_in_time_recovery_enablement: crate::model::database::PointInTimeRecoveryEnablement,
522
523 /// The App Engine integration mode to use for this database.
524 pub app_engine_integration_mode: crate::model::database::AppEngineIntegrationMode,
525
526 /// Output only. The key_prefix for this database. This key_prefix is used, in
527 /// combination with the project ID ("\<key prefix\>~\<project id\>") to construct
528 /// the application ID that is returned from the Cloud Datastore APIs in Google
529 /// App Engine first generation runtimes.
530 ///
531 /// This value may be empty in which case the appid to use for URL-encoded keys
532 /// is the project_id (eg: foo instead of v~foo).
533 pub key_prefix: std::string::String,
534
535 /// State of delete protection for the database.
536 pub delete_protection_state: crate::model::database::DeleteProtectionState,
537
538 /// Optional. Presence indicates CMEK is enabled for this database.
539 pub cmek_config: std::option::Option<crate::model::database::CmekConfig>,
540
541 /// Output only. The database resource's prior database ID. This field is only
542 /// populated for deleted databases.
543 pub previous_id: std::string::String,
544
545 /// Output only. Information about the provenance of this database.
546 pub source_info: std::option::Option<crate::model::database::SourceInfo>,
547
548 /// Optional. Input only. Immutable. Tag keys/values directly bound to this
549 /// resource. For example:
550 /// "123/environment": "production",
551 /// "123/costCenter": "marketing"
552 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
553
554 /// Output only. Background: Free tier is the ability of a Firestore database
555 /// to use a small amount of resources every day without being charged. Once
556 /// usage exceeds the free tier limit further usage is charged.
557 ///
558 /// Whether this database can make use of the free tier. Only one database
559 /// per project can be eligible for the free tier.
560 ///
561 /// The first (or next) database that is created in a project without a free
562 /// tier database will be marked as eligible for the free tier. Databases that
563 /// are created while there is a free tier database will not be eligible for
564 /// the free tier.
565 pub free_tier: std::option::Option<bool>,
566
567 /// This checksum is computed by the server based on the value of other
568 /// fields, and may be sent on update and delete requests to ensure the
569 /// client has an up-to-date value before proceeding.
570 pub etag: std::string::String,
571
572 /// Immutable. The edition of the database.
573 pub database_edition: crate::model::database::DatabaseEdition,
574
575 /// Immutable. The default Realtime Updates mode to use for this database.
576 pub realtime_updates_mode: crate::model::RealtimeUpdatesMode,
577
578 /// Optional. The Firestore API data access mode to use for this database. If
579 /// not set on write:
580 ///
581 /// - the default value is DATA_ACCESS_MODE_DISABLED for Enterprise Edition.
582 /// - the default value is DATA_ACCESS_MODE_ENABLED for Standard Edition.
583 pub firestore_data_access_mode: crate::model::database::DataAccessMode,
584
585 /// Optional. The MongoDB compatible API data access mode to use for this
586 /// database. If not set on write, the default value is
587 /// DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value is always
588 /// DATA_ACCESS_MODE_DISABLED for Standard Edition.
589 pub mongodb_compatible_data_access_mode: crate::model::database::DataAccessMode,
590
591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
592}
593
594impl Database {
595 /// Creates a new default instance.
596 pub fn new() -> Self {
597 std::default::Default::default()
598 }
599
600 /// Sets the value of [name][crate::model::Database::name].
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_firestore_admin_v1::model::Database;
605 /// let x = Database::new().set_name("example");
606 /// ```
607 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
608 self.name = v.into();
609 self
610 }
611
612 /// Sets the value of [uid][crate::model::Database::uid].
613 ///
614 /// # Example
615 /// ```ignore,no_run
616 /// # use google_cloud_firestore_admin_v1::model::Database;
617 /// let x = Database::new().set_uid("example");
618 /// ```
619 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
620 self.uid = v.into();
621 self
622 }
623
624 /// Sets the value of [create_time][crate::model::Database::create_time].
625 ///
626 /// # Example
627 /// ```ignore,no_run
628 /// # use google_cloud_firestore_admin_v1::model::Database;
629 /// use wkt::Timestamp;
630 /// let x = Database::new().set_create_time(Timestamp::default()/* use setters */);
631 /// ```
632 pub fn set_create_time<T>(mut self, v: T) -> Self
633 where
634 T: std::convert::Into<wkt::Timestamp>,
635 {
636 self.create_time = std::option::Option::Some(v.into());
637 self
638 }
639
640 /// Sets or clears the value of [create_time][crate::model::Database::create_time].
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_firestore_admin_v1::model::Database;
645 /// use wkt::Timestamp;
646 /// let x = Database::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
647 /// let x = Database::new().set_or_clear_create_time(None::<Timestamp>);
648 /// ```
649 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
650 where
651 T: std::convert::Into<wkt::Timestamp>,
652 {
653 self.create_time = v.map(|x| x.into());
654 self
655 }
656
657 /// Sets the value of [update_time][crate::model::Database::update_time].
658 ///
659 /// # Example
660 /// ```ignore,no_run
661 /// # use google_cloud_firestore_admin_v1::model::Database;
662 /// use wkt::Timestamp;
663 /// let x = Database::new().set_update_time(Timestamp::default()/* use setters */);
664 /// ```
665 pub fn set_update_time<T>(mut self, v: T) -> Self
666 where
667 T: std::convert::Into<wkt::Timestamp>,
668 {
669 self.update_time = std::option::Option::Some(v.into());
670 self
671 }
672
673 /// Sets or clears the value of [update_time][crate::model::Database::update_time].
674 ///
675 /// # Example
676 /// ```ignore,no_run
677 /// # use google_cloud_firestore_admin_v1::model::Database;
678 /// use wkt::Timestamp;
679 /// let x = Database::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
680 /// let x = Database::new().set_or_clear_update_time(None::<Timestamp>);
681 /// ```
682 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
683 where
684 T: std::convert::Into<wkt::Timestamp>,
685 {
686 self.update_time = v.map(|x| x.into());
687 self
688 }
689
690 /// Sets the value of [delete_time][crate::model::Database::delete_time].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_firestore_admin_v1::model::Database;
695 /// use wkt::Timestamp;
696 /// let x = Database::new().set_delete_time(Timestamp::default()/* use setters */);
697 /// ```
698 pub fn set_delete_time<T>(mut self, v: T) -> Self
699 where
700 T: std::convert::Into<wkt::Timestamp>,
701 {
702 self.delete_time = std::option::Option::Some(v.into());
703 self
704 }
705
706 /// Sets or clears the value of [delete_time][crate::model::Database::delete_time].
707 ///
708 /// # Example
709 /// ```ignore,no_run
710 /// # use google_cloud_firestore_admin_v1::model::Database;
711 /// use wkt::Timestamp;
712 /// let x = Database::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
713 /// let x = Database::new().set_or_clear_delete_time(None::<Timestamp>);
714 /// ```
715 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
716 where
717 T: std::convert::Into<wkt::Timestamp>,
718 {
719 self.delete_time = v.map(|x| x.into());
720 self
721 }
722
723 /// Sets the value of [location_id][crate::model::Database::location_id].
724 ///
725 /// # Example
726 /// ```ignore,no_run
727 /// # use google_cloud_firestore_admin_v1::model::Database;
728 /// let x = Database::new().set_location_id("example");
729 /// ```
730 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
731 self.location_id = v.into();
732 self
733 }
734
735 /// Sets the value of [r#type][crate::model::Database::type].
736 ///
737 /// # Example
738 /// ```ignore,no_run
739 /// # use google_cloud_firestore_admin_v1::model::Database;
740 /// use google_cloud_firestore_admin_v1::model::database::DatabaseType;
741 /// let x0 = Database::new().set_type(DatabaseType::FirestoreNative);
742 /// let x1 = Database::new().set_type(DatabaseType::DatastoreMode);
743 /// ```
744 pub fn set_type<T: std::convert::Into<crate::model::database::DatabaseType>>(
745 mut self,
746 v: T,
747 ) -> Self {
748 self.r#type = v.into();
749 self
750 }
751
752 /// Sets the value of [concurrency_mode][crate::model::Database::concurrency_mode].
753 ///
754 /// # Example
755 /// ```ignore,no_run
756 /// # use google_cloud_firestore_admin_v1::model::Database;
757 /// use google_cloud_firestore_admin_v1::model::database::ConcurrencyMode;
758 /// let x0 = Database::new().set_concurrency_mode(ConcurrencyMode::Optimistic);
759 /// let x1 = Database::new().set_concurrency_mode(ConcurrencyMode::Pessimistic);
760 /// let x2 = Database::new().set_concurrency_mode(ConcurrencyMode::OptimisticWithEntityGroups);
761 /// ```
762 pub fn set_concurrency_mode<T: std::convert::Into<crate::model::database::ConcurrencyMode>>(
763 mut self,
764 v: T,
765 ) -> Self {
766 self.concurrency_mode = v.into();
767 self
768 }
769
770 /// Sets the value of [version_retention_period][crate::model::Database::version_retention_period].
771 ///
772 /// # Example
773 /// ```ignore,no_run
774 /// # use google_cloud_firestore_admin_v1::model::Database;
775 /// use wkt::Duration;
776 /// let x = Database::new().set_version_retention_period(Duration::default()/* use setters */);
777 /// ```
778 pub fn set_version_retention_period<T>(mut self, v: T) -> Self
779 where
780 T: std::convert::Into<wkt::Duration>,
781 {
782 self.version_retention_period = std::option::Option::Some(v.into());
783 self
784 }
785
786 /// Sets or clears the value of [version_retention_period][crate::model::Database::version_retention_period].
787 ///
788 /// # Example
789 /// ```ignore,no_run
790 /// # use google_cloud_firestore_admin_v1::model::Database;
791 /// use wkt::Duration;
792 /// let x = Database::new().set_or_clear_version_retention_period(Some(Duration::default()/* use setters */));
793 /// let x = Database::new().set_or_clear_version_retention_period(None::<Duration>);
794 /// ```
795 pub fn set_or_clear_version_retention_period<T>(mut self, v: std::option::Option<T>) -> Self
796 where
797 T: std::convert::Into<wkt::Duration>,
798 {
799 self.version_retention_period = v.map(|x| x.into());
800 self
801 }
802
803 /// Sets the value of [earliest_version_time][crate::model::Database::earliest_version_time].
804 ///
805 /// # Example
806 /// ```ignore,no_run
807 /// # use google_cloud_firestore_admin_v1::model::Database;
808 /// use wkt::Timestamp;
809 /// let x = Database::new().set_earliest_version_time(Timestamp::default()/* use setters */);
810 /// ```
811 pub fn set_earliest_version_time<T>(mut self, v: T) -> Self
812 where
813 T: std::convert::Into<wkt::Timestamp>,
814 {
815 self.earliest_version_time = std::option::Option::Some(v.into());
816 self
817 }
818
819 /// Sets or clears the value of [earliest_version_time][crate::model::Database::earliest_version_time].
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_firestore_admin_v1::model::Database;
824 /// use wkt::Timestamp;
825 /// let x = Database::new().set_or_clear_earliest_version_time(Some(Timestamp::default()/* use setters */));
826 /// let x = Database::new().set_or_clear_earliest_version_time(None::<Timestamp>);
827 /// ```
828 pub fn set_or_clear_earliest_version_time<T>(mut self, v: std::option::Option<T>) -> Self
829 where
830 T: std::convert::Into<wkt::Timestamp>,
831 {
832 self.earliest_version_time = v.map(|x| x.into());
833 self
834 }
835
836 /// Sets the value of [point_in_time_recovery_enablement][crate::model::Database::point_in_time_recovery_enablement].
837 ///
838 /// # Example
839 /// ```ignore,no_run
840 /// # use google_cloud_firestore_admin_v1::model::Database;
841 /// use google_cloud_firestore_admin_v1::model::database::PointInTimeRecoveryEnablement;
842 /// let x0 = Database::new().set_point_in_time_recovery_enablement(PointInTimeRecoveryEnablement::PointInTimeRecoveryEnabled);
843 /// let x1 = Database::new().set_point_in_time_recovery_enablement(PointInTimeRecoveryEnablement::PointInTimeRecoveryDisabled);
844 /// ```
845 pub fn set_point_in_time_recovery_enablement<
846 T: std::convert::Into<crate::model::database::PointInTimeRecoveryEnablement>,
847 >(
848 mut self,
849 v: T,
850 ) -> Self {
851 self.point_in_time_recovery_enablement = v.into();
852 self
853 }
854
855 /// Sets the value of [app_engine_integration_mode][crate::model::Database::app_engine_integration_mode].
856 ///
857 /// # Example
858 /// ```ignore,no_run
859 /// # use google_cloud_firestore_admin_v1::model::Database;
860 /// use google_cloud_firestore_admin_v1::model::database::AppEngineIntegrationMode;
861 /// let x0 = Database::new().set_app_engine_integration_mode(AppEngineIntegrationMode::Enabled);
862 /// let x1 = Database::new().set_app_engine_integration_mode(AppEngineIntegrationMode::Disabled);
863 /// ```
864 pub fn set_app_engine_integration_mode<
865 T: std::convert::Into<crate::model::database::AppEngineIntegrationMode>,
866 >(
867 mut self,
868 v: T,
869 ) -> Self {
870 self.app_engine_integration_mode = v.into();
871 self
872 }
873
874 /// Sets the value of [key_prefix][crate::model::Database::key_prefix].
875 ///
876 /// # Example
877 /// ```ignore,no_run
878 /// # use google_cloud_firestore_admin_v1::model::Database;
879 /// let x = Database::new().set_key_prefix("example");
880 /// ```
881 pub fn set_key_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
882 self.key_prefix = v.into();
883 self
884 }
885
886 /// Sets the value of [delete_protection_state][crate::model::Database::delete_protection_state].
887 ///
888 /// # Example
889 /// ```ignore,no_run
890 /// # use google_cloud_firestore_admin_v1::model::Database;
891 /// use google_cloud_firestore_admin_v1::model::database::DeleteProtectionState;
892 /// let x0 = Database::new().set_delete_protection_state(DeleteProtectionState::DeleteProtectionDisabled);
893 /// let x1 = Database::new().set_delete_protection_state(DeleteProtectionState::DeleteProtectionEnabled);
894 /// ```
895 pub fn set_delete_protection_state<
896 T: std::convert::Into<crate::model::database::DeleteProtectionState>,
897 >(
898 mut self,
899 v: T,
900 ) -> Self {
901 self.delete_protection_state = v.into();
902 self
903 }
904
905 /// Sets the value of [cmek_config][crate::model::Database::cmek_config].
906 ///
907 /// # Example
908 /// ```ignore,no_run
909 /// # use google_cloud_firestore_admin_v1::model::Database;
910 /// use google_cloud_firestore_admin_v1::model::database::CmekConfig;
911 /// let x = Database::new().set_cmek_config(CmekConfig::default()/* use setters */);
912 /// ```
913 pub fn set_cmek_config<T>(mut self, v: T) -> Self
914 where
915 T: std::convert::Into<crate::model::database::CmekConfig>,
916 {
917 self.cmek_config = std::option::Option::Some(v.into());
918 self
919 }
920
921 /// Sets or clears the value of [cmek_config][crate::model::Database::cmek_config].
922 ///
923 /// # Example
924 /// ```ignore,no_run
925 /// # use google_cloud_firestore_admin_v1::model::Database;
926 /// use google_cloud_firestore_admin_v1::model::database::CmekConfig;
927 /// let x = Database::new().set_or_clear_cmek_config(Some(CmekConfig::default()/* use setters */));
928 /// let x = Database::new().set_or_clear_cmek_config(None::<CmekConfig>);
929 /// ```
930 pub fn set_or_clear_cmek_config<T>(mut self, v: std::option::Option<T>) -> Self
931 where
932 T: std::convert::Into<crate::model::database::CmekConfig>,
933 {
934 self.cmek_config = v.map(|x| x.into());
935 self
936 }
937
938 /// Sets the value of [previous_id][crate::model::Database::previous_id].
939 ///
940 /// # Example
941 /// ```ignore,no_run
942 /// # use google_cloud_firestore_admin_v1::model::Database;
943 /// let x = Database::new().set_previous_id("example");
944 /// ```
945 pub fn set_previous_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
946 self.previous_id = v.into();
947 self
948 }
949
950 /// Sets the value of [source_info][crate::model::Database::source_info].
951 ///
952 /// # Example
953 /// ```ignore,no_run
954 /// # use google_cloud_firestore_admin_v1::model::Database;
955 /// use google_cloud_firestore_admin_v1::model::database::SourceInfo;
956 /// let x = Database::new().set_source_info(SourceInfo::default()/* use setters */);
957 /// ```
958 pub fn set_source_info<T>(mut self, v: T) -> Self
959 where
960 T: std::convert::Into<crate::model::database::SourceInfo>,
961 {
962 self.source_info = std::option::Option::Some(v.into());
963 self
964 }
965
966 /// Sets or clears the value of [source_info][crate::model::Database::source_info].
967 ///
968 /// # Example
969 /// ```ignore,no_run
970 /// # use google_cloud_firestore_admin_v1::model::Database;
971 /// use google_cloud_firestore_admin_v1::model::database::SourceInfo;
972 /// let x = Database::new().set_or_clear_source_info(Some(SourceInfo::default()/* use setters */));
973 /// let x = Database::new().set_or_clear_source_info(None::<SourceInfo>);
974 /// ```
975 pub fn set_or_clear_source_info<T>(mut self, v: std::option::Option<T>) -> Self
976 where
977 T: std::convert::Into<crate::model::database::SourceInfo>,
978 {
979 self.source_info = v.map(|x| x.into());
980 self
981 }
982
983 /// Sets the value of [tags][crate::model::Database::tags].
984 ///
985 /// # Example
986 /// ```ignore,no_run
987 /// # use google_cloud_firestore_admin_v1::model::Database;
988 /// let x = Database::new().set_tags([
989 /// ("key0", "abc"),
990 /// ("key1", "xyz"),
991 /// ]);
992 /// ```
993 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
994 where
995 T: std::iter::IntoIterator<Item = (K, V)>,
996 K: std::convert::Into<std::string::String>,
997 V: std::convert::Into<std::string::String>,
998 {
999 use std::iter::Iterator;
1000 self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1001 self
1002 }
1003
1004 /// Sets the value of [free_tier][crate::model::Database::free_tier].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_firestore_admin_v1::model::Database;
1009 /// let x = Database::new().set_free_tier(true);
1010 /// ```
1011 pub fn set_free_tier<T>(mut self, v: T) -> Self
1012 where
1013 T: std::convert::Into<bool>,
1014 {
1015 self.free_tier = std::option::Option::Some(v.into());
1016 self
1017 }
1018
1019 /// Sets or clears the value of [free_tier][crate::model::Database::free_tier].
1020 ///
1021 /// # Example
1022 /// ```ignore,no_run
1023 /// # use google_cloud_firestore_admin_v1::model::Database;
1024 /// let x = Database::new().set_or_clear_free_tier(Some(false));
1025 /// let x = Database::new().set_or_clear_free_tier(None::<bool>);
1026 /// ```
1027 pub fn set_or_clear_free_tier<T>(mut self, v: std::option::Option<T>) -> Self
1028 where
1029 T: std::convert::Into<bool>,
1030 {
1031 self.free_tier = v.map(|x| x.into());
1032 self
1033 }
1034
1035 /// Sets the value of [etag][crate::model::Database::etag].
1036 ///
1037 /// # Example
1038 /// ```ignore,no_run
1039 /// # use google_cloud_firestore_admin_v1::model::Database;
1040 /// let x = Database::new().set_etag("example");
1041 /// ```
1042 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1043 self.etag = v.into();
1044 self
1045 }
1046
1047 /// Sets the value of [database_edition][crate::model::Database::database_edition].
1048 ///
1049 /// # Example
1050 /// ```ignore,no_run
1051 /// # use google_cloud_firestore_admin_v1::model::Database;
1052 /// use google_cloud_firestore_admin_v1::model::database::DatabaseEdition;
1053 /// let x0 = Database::new().set_database_edition(DatabaseEdition::Standard);
1054 /// let x1 = Database::new().set_database_edition(DatabaseEdition::Enterprise);
1055 /// ```
1056 pub fn set_database_edition<T: std::convert::Into<crate::model::database::DatabaseEdition>>(
1057 mut self,
1058 v: T,
1059 ) -> Self {
1060 self.database_edition = v.into();
1061 self
1062 }
1063
1064 /// Sets the value of [realtime_updates_mode][crate::model::Database::realtime_updates_mode].
1065 ///
1066 /// # Example
1067 /// ```ignore,no_run
1068 /// # use google_cloud_firestore_admin_v1::model::Database;
1069 /// use google_cloud_firestore_admin_v1::model::RealtimeUpdatesMode;
1070 /// let x0 = Database::new().set_realtime_updates_mode(RealtimeUpdatesMode::Enabled);
1071 /// let x1 = Database::new().set_realtime_updates_mode(RealtimeUpdatesMode::Disabled);
1072 /// ```
1073 pub fn set_realtime_updates_mode<T: std::convert::Into<crate::model::RealtimeUpdatesMode>>(
1074 mut self,
1075 v: T,
1076 ) -> Self {
1077 self.realtime_updates_mode = v.into();
1078 self
1079 }
1080
1081 /// Sets the value of [firestore_data_access_mode][crate::model::Database::firestore_data_access_mode].
1082 ///
1083 /// # Example
1084 /// ```ignore,no_run
1085 /// # use google_cloud_firestore_admin_v1::model::Database;
1086 /// use google_cloud_firestore_admin_v1::model::database::DataAccessMode;
1087 /// let x0 = Database::new().set_firestore_data_access_mode(DataAccessMode::Enabled);
1088 /// let x1 = Database::new().set_firestore_data_access_mode(DataAccessMode::Disabled);
1089 /// ```
1090 pub fn set_firestore_data_access_mode<
1091 T: std::convert::Into<crate::model::database::DataAccessMode>,
1092 >(
1093 mut self,
1094 v: T,
1095 ) -> Self {
1096 self.firestore_data_access_mode = v.into();
1097 self
1098 }
1099
1100 /// Sets the value of [mongodb_compatible_data_access_mode][crate::model::Database::mongodb_compatible_data_access_mode].
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_firestore_admin_v1::model::Database;
1105 /// use google_cloud_firestore_admin_v1::model::database::DataAccessMode;
1106 /// let x0 = Database::new().set_mongodb_compatible_data_access_mode(DataAccessMode::Enabled);
1107 /// let x1 = Database::new().set_mongodb_compatible_data_access_mode(DataAccessMode::Disabled);
1108 /// ```
1109 pub fn set_mongodb_compatible_data_access_mode<
1110 T: std::convert::Into<crate::model::database::DataAccessMode>,
1111 >(
1112 mut self,
1113 v: T,
1114 ) -> Self {
1115 self.mongodb_compatible_data_access_mode = v.into();
1116 self
1117 }
1118}
1119
1120impl wkt::message::Message for Database {
1121 fn typename() -> &'static str {
1122 "type.googleapis.com/google.firestore.admin.v1.Database"
1123 }
1124}
1125
1126/// Defines additional types related to [Database].
1127pub mod database {
1128 #[allow(unused_imports)]
1129 use super::*;
1130
1131 /// The CMEK (Customer Managed Encryption Key) configuration for a Firestore
1132 /// database. If not present, the database is secured by the default Google
1133 /// encryption key.
1134 #[derive(Clone, Default, PartialEq)]
1135 #[non_exhaustive]
1136 pub struct CmekConfig {
1137 /// Required. Only keys in the same location as this database are allowed to
1138 /// be used for encryption.
1139 ///
1140 /// For Firestore's nam5 multi-region, this corresponds to Cloud KMS
1141 /// multi-region us. For Firestore's eur3 multi-region, this corresponds to
1142 /// Cloud KMS multi-region europe. See
1143 /// <https://cloud.google.com/kms/docs/locations>.
1144 ///
1145 /// The expected format is
1146 /// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
1147 pub kms_key_name: std::string::String,
1148
1149 /// Output only. Currently in-use [KMS key
1150 /// versions](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions).
1151 /// During [key rotation](https://cloud.google.com/kms/docs/key-rotation),
1152 /// there can be multiple in-use key versions.
1153 ///
1154 /// The expected format is
1155 /// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{key_version}`.
1156 pub active_key_version: std::vec::Vec<std::string::String>,
1157
1158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1159 }
1160
1161 impl CmekConfig {
1162 /// Creates a new default instance.
1163 pub fn new() -> Self {
1164 std::default::Default::default()
1165 }
1166
1167 /// Sets the value of [kms_key_name][crate::model::database::CmekConfig::kms_key_name].
1168 ///
1169 /// # Example
1170 /// ```ignore,no_run
1171 /// # use google_cloud_firestore_admin_v1::model::database::CmekConfig;
1172 /// let x = CmekConfig::new().set_kms_key_name("example");
1173 /// ```
1174 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(
1175 mut self,
1176 v: T,
1177 ) -> Self {
1178 self.kms_key_name = v.into();
1179 self
1180 }
1181
1182 /// Sets the value of [active_key_version][crate::model::database::CmekConfig::active_key_version].
1183 ///
1184 /// # Example
1185 /// ```ignore,no_run
1186 /// # use google_cloud_firestore_admin_v1::model::database::CmekConfig;
1187 /// let x = CmekConfig::new().set_active_key_version(["a", "b", "c"]);
1188 /// ```
1189 pub fn set_active_key_version<T, V>(mut self, v: T) -> Self
1190 where
1191 T: std::iter::IntoIterator<Item = V>,
1192 V: std::convert::Into<std::string::String>,
1193 {
1194 use std::iter::Iterator;
1195 self.active_key_version = v.into_iter().map(|i| i.into()).collect();
1196 self
1197 }
1198 }
1199
1200 impl wkt::message::Message for CmekConfig {
1201 fn typename() -> &'static str {
1202 "type.googleapis.com/google.firestore.admin.v1.Database.CmekConfig"
1203 }
1204 }
1205
1206 /// Information about the provenance of this database.
1207 #[derive(Clone, Default, PartialEq)]
1208 #[non_exhaustive]
1209 pub struct SourceInfo {
1210 /// The associated long-running operation. This field may not be set after
1211 /// the operation has completed. Format:
1212 /// `projects/{project}/databases/{database}/operations/{operation}`.
1213 pub operation: std::string::String,
1214
1215 /// The source from which this database is derived.
1216 pub source: std::option::Option<crate::model::database::source_info::Source>,
1217
1218 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1219 }
1220
1221 impl SourceInfo {
1222 /// Creates a new default instance.
1223 pub fn new() -> Self {
1224 std::default::Default::default()
1225 }
1226
1227 /// Sets the value of [operation][crate::model::database::SourceInfo::operation].
1228 ///
1229 /// # Example
1230 /// ```ignore,no_run
1231 /// # use google_cloud_firestore_admin_v1::model::database::SourceInfo;
1232 /// let x = SourceInfo::new().set_operation("example");
1233 /// ```
1234 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1235 self.operation = v.into();
1236 self
1237 }
1238
1239 /// Sets the value of [source][crate::model::database::SourceInfo::source].
1240 ///
1241 /// Note that all the setters affecting `source` are mutually
1242 /// exclusive.
1243 ///
1244 /// # Example
1245 /// ```ignore,no_run
1246 /// # use google_cloud_firestore_admin_v1::model::database::SourceInfo;
1247 /// use google_cloud_firestore_admin_v1::model::database::source_info::BackupSource;
1248 /// let x = SourceInfo::new().set_source(Some(
1249 /// google_cloud_firestore_admin_v1::model::database::source_info::Source::Backup(BackupSource::default().into())));
1250 /// ```
1251 pub fn set_source<
1252 T: std::convert::Into<std::option::Option<crate::model::database::source_info::Source>>,
1253 >(
1254 mut self,
1255 v: T,
1256 ) -> Self {
1257 self.source = v.into();
1258 self
1259 }
1260
1261 /// The value of [source][crate::model::database::SourceInfo::source]
1262 /// if it holds a `Backup`, `None` if the field is not set or
1263 /// holds a different branch.
1264 pub fn backup(
1265 &self,
1266 ) -> std::option::Option<&std::boxed::Box<crate::model::database::source_info::BackupSource>>
1267 {
1268 #[allow(unreachable_patterns)]
1269 self.source.as_ref().and_then(|v| match v {
1270 crate::model::database::source_info::Source::Backup(v) => {
1271 std::option::Option::Some(v)
1272 }
1273 _ => std::option::Option::None,
1274 })
1275 }
1276
1277 /// Sets the value of [source][crate::model::database::SourceInfo::source]
1278 /// to hold a `Backup`.
1279 ///
1280 /// Note that all the setters affecting `source` are
1281 /// mutually exclusive.
1282 ///
1283 /// # Example
1284 /// ```ignore,no_run
1285 /// # use google_cloud_firestore_admin_v1::model::database::SourceInfo;
1286 /// use google_cloud_firestore_admin_v1::model::database::source_info::BackupSource;
1287 /// let x = SourceInfo::new().set_backup(BackupSource::default()/* use setters */);
1288 /// assert!(x.backup().is_some());
1289 /// ```
1290 pub fn set_backup<
1291 T: std::convert::Into<std::boxed::Box<crate::model::database::source_info::BackupSource>>,
1292 >(
1293 mut self,
1294 v: T,
1295 ) -> Self {
1296 self.source = std::option::Option::Some(
1297 crate::model::database::source_info::Source::Backup(v.into()),
1298 );
1299 self
1300 }
1301 }
1302
1303 impl wkt::message::Message for SourceInfo {
1304 fn typename() -> &'static str {
1305 "type.googleapis.com/google.firestore.admin.v1.Database.SourceInfo"
1306 }
1307 }
1308
1309 /// Defines additional types related to [SourceInfo].
1310 pub mod source_info {
1311 #[allow(unused_imports)]
1312 use super::*;
1313
1314 /// Information about a backup that was used to restore a database.
1315 #[derive(Clone, Default, PartialEq)]
1316 #[non_exhaustive]
1317 pub struct BackupSource {
1318 /// The resource name of the backup that was used to restore this
1319 /// database. Format:
1320 /// `projects/{project}/locations/{location}/backups/{backup}`.
1321 pub backup: std::string::String,
1322
1323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1324 }
1325
1326 impl BackupSource {
1327 /// Creates a new default instance.
1328 pub fn new() -> Self {
1329 std::default::Default::default()
1330 }
1331
1332 /// Sets the value of [backup][crate::model::database::source_info::BackupSource::backup].
1333 ///
1334 /// # Example
1335 /// ```ignore,no_run
1336 /// # use google_cloud_firestore_admin_v1::model::database::source_info::BackupSource;
1337 /// let x = BackupSource::new().set_backup("example");
1338 /// ```
1339 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1340 self.backup = v.into();
1341 self
1342 }
1343 }
1344
1345 impl wkt::message::Message for BackupSource {
1346 fn typename() -> &'static str {
1347 "type.googleapis.com/google.firestore.admin.v1.Database.SourceInfo.BackupSource"
1348 }
1349 }
1350
1351 /// The source from which this database is derived.
1352 #[derive(Clone, Debug, PartialEq)]
1353 #[non_exhaustive]
1354 pub enum Source {
1355 /// If set, this database was restored from the specified backup (or a
1356 /// snapshot thereof).
1357 Backup(std::boxed::Box<crate::model::database::source_info::BackupSource>),
1358 }
1359 }
1360
1361 /// Encryption configuration for a new database being created from another
1362 /// source.
1363 ///
1364 /// The source could be a [Backup][google.firestore.admin.v1.Backup] or a
1365 /// [PitrSnapshot][google.firestore.admin.v1.PitrSnapshot].
1366 ///
1367 /// [google.firestore.admin.v1.Backup]: crate::model::Backup
1368 /// [google.firestore.admin.v1.PitrSnapshot]: crate::model::PitrSnapshot
1369 #[derive(Clone, Default, PartialEq)]
1370 #[non_exhaustive]
1371 pub struct EncryptionConfig {
1372 /// The method for encrypting the database.
1373 pub encryption_type:
1374 std::option::Option<crate::model::database::encryption_config::EncryptionType>,
1375
1376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1377 }
1378
1379 impl EncryptionConfig {
1380 /// Creates a new default instance.
1381 pub fn new() -> Self {
1382 std::default::Default::default()
1383 }
1384
1385 /// Sets the value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type].
1386 ///
1387 /// Note that all the setters affecting `encryption_type` are mutually
1388 /// exclusive.
1389 ///
1390 /// # Example
1391 /// ```ignore,no_run
1392 /// # use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
1393 /// use google_cloud_firestore_admin_v1::model::database::encryption_config::GoogleDefaultEncryptionOptions;
1394 /// let x = EncryptionConfig::new().set_encryption_type(Some(
1395 /// google_cloud_firestore_admin_v1::model::database::encryption_config::EncryptionType::GoogleDefaultEncryption(GoogleDefaultEncryptionOptions::default().into())));
1396 /// ```
1397 pub fn set_encryption_type<
1398 T: std::convert::Into<
1399 std::option::Option<crate::model::database::encryption_config::EncryptionType>,
1400 >,
1401 >(
1402 mut self,
1403 v: T,
1404 ) -> Self {
1405 self.encryption_type = v.into();
1406 self
1407 }
1408
1409 /// The value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1410 /// if it holds a `GoogleDefaultEncryption`, `None` if the field is not set or
1411 /// holds a different branch.
1412 pub fn google_default_encryption(
1413 &self,
1414 ) -> std::option::Option<
1415 &std::boxed::Box<
1416 crate::model::database::encryption_config::GoogleDefaultEncryptionOptions,
1417 >,
1418 > {
1419 #[allow(unreachable_patterns)]
1420 self.encryption_type.as_ref().and_then(|v| match v {
1421 crate::model::database::encryption_config::EncryptionType::GoogleDefaultEncryption(v) => std::option::Option::Some(v),
1422 _ => std::option::Option::None,
1423 })
1424 }
1425
1426 /// Sets the value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1427 /// to hold a `GoogleDefaultEncryption`.
1428 ///
1429 /// Note that all the setters affecting `encryption_type` are
1430 /// mutually exclusive.
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
1435 /// use google_cloud_firestore_admin_v1::model::database::encryption_config::GoogleDefaultEncryptionOptions;
1436 /// let x = EncryptionConfig::new().set_google_default_encryption(GoogleDefaultEncryptionOptions::default()/* use setters */);
1437 /// assert!(x.google_default_encryption().is_some());
1438 /// assert!(x.use_source_encryption().is_none());
1439 /// assert!(x.customer_managed_encryption().is_none());
1440 /// ```
1441 pub fn set_google_default_encryption<
1442 T: std::convert::Into<
1443 std::boxed::Box<
1444 crate::model::database::encryption_config::GoogleDefaultEncryptionOptions,
1445 >,
1446 >,
1447 >(
1448 mut self,
1449 v: T,
1450 ) -> Self {
1451 self.encryption_type = std::option::Option::Some(
1452 crate::model::database::encryption_config::EncryptionType::GoogleDefaultEncryption(
1453 v.into(),
1454 ),
1455 );
1456 self
1457 }
1458
1459 /// The value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1460 /// if it holds a `UseSourceEncryption`, `None` if the field is not set or
1461 /// holds a different branch.
1462 pub fn use_source_encryption(
1463 &self,
1464 ) -> std::option::Option<
1465 &std::boxed::Box<crate::model::database::encryption_config::SourceEncryptionOptions>,
1466 > {
1467 #[allow(unreachable_patterns)]
1468 self.encryption_type.as_ref().and_then(|v| match v {
1469 crate::model::database::encryption_config::EncryptionType::UseSourceEncryption(
1470 v,
1471 ) => std::option::Option::Some(v),
1472 _ => std::option::Option::None,
1473 })
1474 }
1475
1476 /// Sets the value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1477 /// to hold a `UseSourceEncryption`.
1478 ///
1479 /// Note that all the setters affecting `encryption_type` are
1480 /// mutually exclusive.
1481 ///
1482 /// # Example
1483 /// ```ignore,no_run
1484 /// # use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
1485 /// use google_cloud_firestore_admin_v1::model::database::encryption_config::SourceEncryptionOptions;
1486 /// let x = EncryptionConfig::new().set_use_source_encryption(SourceEncryptionOptions::default()/* use setters */);
1487 /// assert!(x.use_source_encryption().is_some());
1488 /// assert!(x.google_default_encryption().is_none());
1489 /// assert!(x.customer_managed_encryption().is_none());
1490 /// ```
1491 pub fn set_use_source_encryption<
1492 T: std::convert::Into<
1493 std::boxed::Box<
1494 crate::model::database::encryption_config::SourceEncryptionOptions,
1495 >,
1496 >,
1497 >(
1498 mut self,
1499 v: T,
1500 ) -> Self {
1501 self.encryption_type = std::option::Option::Some(
1502 crate::model::database::encryption_config::EncryptionType::UseSourceEncryption(
1503 v.into(),
1504 ),
1505 );
1506 self
1507 }
1508
1509 /// The value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1510 /// if it holds a `CustomerManagedEncryption`, `None` if the field is not set or
1511 /// holds a different branch.
1512 pub fn customer_managed_encryption(
1513 &self,
1514 ) -> std::option::Option<
1515 &std::boxed::Box<
1516 crate::model::database::encryption_config::CustomerManagedEncryptionOptions,
1517 >,
1518 > {
1519 #[allow(unreachable_patterns)]
1520 self.encryption_type.as_ref().and_then(|v| match v {
1521 crate::model::database::encryption_config::EncryptionType::CustomerManagedEncryption(v) => std::option::Option::Some(v),
1522 _ => std::option::Option::None,
1523 })
1524 }
1525
1526 /// Sets the value of [encryption_type][crate::model::database::EncryptionConfig::encryption_type]
1527 /// to hold a `CustomerManagedEncryption`.
1528 ///
1529 /// Note that all the setters affecting `encryption_type` are
1530 /// mutually exclusive.
1531 ///
1532 /// # Example
1533 /// ```ignore,no_run
1534 /// # use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
1535 /// use google_cloud_firestore_admin_v1::model::database::encryption_config::CustomerManagedEncryptionOptions;
1536 /// let x = EncryptionConfig::new().set_customer_managed_encryption(CustomerManagedEncryptionOptions::default()/* use setters */);
1537 /// assert!(x.customer_managed_encryption().is_some());
1538 /// assert!(x.google_default_encryption().is_none());
1539 /// assert!(x.use_source_encryption().is_none());
1540 /// ```
1541 pub fn set_customer_managed_encryption<
1542 T: std::convert::Into<
1543 std::boxed::Box<
1544 crate::model::database::encryption_config::CustomerManagedEncryptionOptions,
1545 >,
1546 >,
1547 >(
1548 mut self,
1549 v: T,
1550 ) -> Self {
1551 self.encryption_type = std::option::Option::Some(
1552 crate::model::database::encryption_config::EncryptionType::CustomerManagedEncryption(
1553 v.into()
1554 )
1555 );
1556 self
1557 }
1558 }
1559
1560 impl wkt::message::Message for EncryptionConfig {
1561 fn typename() -> &'static str {
1562 "type.googleapis.com/google.firestore.admin.v1.Database.EncryptionConfig"
1563 }
1564 }
1565
1566 /// Defines additional types related to [EncryptionConfig].
1567 pub mod encryption_config {
1568 #[allow(unused_imports)]
1569 use super::*;
1570
1571 /// The configuration options for using Google default encryption.
1572 #[derive(Clone, Default, PartialEq)]
1573 #[non_exhaustive]
1574 pub struct GoogleDefaultEncryptionOptions {
1575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1576 }
1577
1578 impl GoogleDefaultEncryptionOptions {
1579 /// Creates a new default instance.
1580 pub fn new() -> Self {
1581 std::default::Default::default()
1582 }
1583 }
1584
1585 impl wkt::message::Message for GoogleDefaultEncryptionOptions {
1586 fn typename() -> &'static str {
1587 "type.googleapis.com/google.firestore.admin.v1.Database.EncryptionConfig.GoogleDefaultEncryptionOptions"
1588 }
1589 }
1590
1591 /// The configuration options for using the same encryption method as the
1592 /// source.
1593 #[derive(Clone, Default, PartialEq)]
1594 #[non_exhaustive]
1595 pub struct SourceEncryptionOptions {
1596 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1597 }
1598
1599 impl SourceEncryptionOptions {
1600 /// Creates a new default instance.
1601 pub fn new() -> Self {
1602 std::default::Default::default()
1603 }
1604 }
1605
1606 impl wkt::message::Message for SourceEncryptionOptions {
1607 fn typename() -> &'static str {
1608 "type.googleapis.com/google.firestore.admin.v1.Database.EncryptionConfig.SourceEncryptionOptions"
1609 }
1610 }
1611
1612 /// The configuration options for using CMEK (Customer Managed Encryption
1613 /// Key) encryption.
1614 #[derive(Clone, Default, PartialEq)]
1615 #[non_exhaustive]
1616 pub struct CustomerManagedEncryptionOptions {
1617 /// Required. Only keys in the same location as the database are allowed to
1618 /// be used for encryption.
1619 ///
1620 /// For Firestore's nam5 multi-region, this corresponds to Cloud KMS
1621 /// multi-region us. For Firestore's eur3 multi-region, this corresponds to
1622 /// Cloud KMS multi-region europe. See
1623 /// <https://cloud.google.com/kms/docs/locations>.
1624 ///
1625 /// The expected format is
1626 /// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
1627 pub kms_key_name: std::string::String,
1628
1629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1630 }
1631
1632 impl CustomerManagedEncryptionOptions {
1633 /// Creates a new default instance.
1634 pub fn new() -> Self {
1635 std::default::Default::default()
1636 }
1637
1638 /// Sets the value of [kms_key_name][crate::model::database::encryption_config::CustomerManagedEncryptionOptions::kms_key_name].
1639 ///
1640 /// # Example
1641 /// ```ignore,no_run
1642 /// # use google_cloud_firestore_admin_v1::model::database::encryption_config::CustomerManagedEncryptionOptions;
1643 /// let x = CustomerManagedEncryptionOptions::new().set_kms_key_name("example");
1644 /// ```
1645 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(
1646 mut self,
1647 v: T,
1648 ) -> Self {
1649 self.kms_key_name = v.into();
1650 self
1651 }
1652 }
1653
1654 impl wkt::message::Message for CustomerManagedEncryptionOptions {
1655 fn typename() -> &'static str {
1656 "type.googleapis.com/google.firestore.admin.v1.Database.EncryptionConfig.CustomerManagedEncryptionOptions"
1657 }
1658 }
1659
1660 /// The method for encrypting the database.
1661 #[derive(Clone, Debug, PartialEq)]
1662 #[non_exhaustive]
1663 pub enum EncryptionType {
1664 /// Use Google default encryption.
1665 GoogleDefaultEncryption(
1666 std::boxed::Box<
1667 crate::model::database::encryption_config::GoogleDefaultEncryptionOptions,
1668 >,
1669 ),
1670 /// The database will use the same encryption configuration as the source.
1671 UseSourceEncryption(
1672 std::boxed::Box<crate::model::database::encryption_config::SourceEncryptionOptions>,
1673 ),
1674 /// Use Customer Managed Encryption Keys (CMEK) for encryption.
1675 CustomerManagedEncryption(
1676 std::boxed::Box<
1677 crate::model::database::encryption_config::CustomerManagedEncryptionOptions,
1678 >,
1679 ),
1680 }
1681 }
1682
1683 /// The type of the database.
1684 /// See <https://cloud.google.com/datastore/docs/firestore-or-datastore> for
1685 /// information about how to choose.
1686 ///
1687 /// Mode changes are only allowed if the database is empty.
1688 ///
1689 /// # Working with unknown values
1690 ///
1691 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1692 /// additional enum variants at any time. Adding new variants is not considered
1693 /// a breaking change. Applications should write their code in anticipation of:
1694 ///
1695 /// - New values appearing in future releases of the client library, **and**
1696 /// - New values received dynamically, without application changes.
1697 ///
1698 /// Please consult the [Working with enums] section in the user guide for some
1699 /// guidelines.
1700 ///
1701 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1702 #[derive(Clone, Debug, PartialEq)]
1703 #[non_exhaustive]
1704 pub enum DatabaseType {
1705 /// Not used.
1706 Unspecified,
1707 /// Firestore Native Mode
1708 FirestoreNative,
1709 /// Firestore in Datastore Mode.
1710 DatastoreMode,
1711 /// If set, the enum was initialized with an unknown value.
1712 ///
1713 /// Applications can examine the value using [DatabaseType::value] or
1714 /// [DatabaseType::name].
1715 UnknownValue(database_type::UnknownValue),
1716 }
1717
1718 #[doc(hidden)]
1719 pub mod database_type {
1720 #[allow(unused_imports)]
1721 use super::*;
1722 #[derive(Clone, Debug, PartialEq)]
1723 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1724 }
1725
1726 impl DatabaseType {
1727 /// Gets the enum value.
1728 ///
1729 /// Returns `None` if the enum contains an unknown value deserialized from
1730 /// the string representation of enums.
1731 pub fn value(&self) -> std::option::Option<i32> {
1732 match self {
1733 Self::Unspecified => std::option::Option::Some(0),
1734 Self::FirestoreNative => std::option::Option::Some(1),
1735 Self::DatastoreMode => std::option::Option::Some(2),
1736 Self::UnknownValue(u) => u.0.value(),
1737 }
1738 }
1739
1740 /// Gets the enum value as a string.
1741 ///
1742 /// Returns `None` if the enum contains an unknown value deserialized from
1743 /// the integer representation of enums.
1744 pub fn name(&self) -> std::option::Option<&str> {
1745 match self {
1746 Self::Unspecified => std::option::Option::Some("DATABASE_TYPE_UNSPECIFIED"),
1747 Self::FirestoreNative => std::option::Option::Some("FIRESTORE_NATIVE"),
1748 Self::DatastoreMode => std::option::Option::Some("DATASTORE_MODE"),
1749 Self::UnknownValue(u) => u.0.name(),
1750 }
1751 }
1752 }
1753
1754 impl std::default::Default for DatabaseType {
1755 fn default() -> Self {
1756 use std::convert::From;
1757 Self::from(0)
1758 }
1759 }
1760
1761 impl std::fmt::Display for DatabaseType {
1762 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1763 wkt::internal::display_enum(f, self.name(), self.value())
1764 }
1765 }
1766
1767 impl std::convert::From<i32> for DatabaseType {
1768 fn from(value: i32) -> Self {
1769 match value {
1770 0 => Self::Unspecified,
1771 1 => Self::FirestoreNative,
1772 2 => Self::DatastoreMode,
1773 _ => Self::UnknownValue(database_type::UnknownValue(
1774 wkt::internal::UnknownEnumValue::Integer(value),
1775 )),
1776 }
1777 }
1778 }
1779
1780 impl std::convert::From<&str> for DatabaseType {
1781 fn from(value: &str) -> Self {
1782 use std::string::ToString;
1783 match value {
1784 "DATABASE_TYPE_UNSPECIFIED" => Self::Unspecified,
1785 "FIRESTORE_NATIVE" => Self::FirestoreNative,
1786 "DATASTORE_MODE" => Self::DatastoreMode,
1787 _ => Self::UnknownValue(database_type::UnknownValue(
1788 wkt::internal::UnknownEnumValue::String(value.to_string()),
1789 )),
1790 }
1791 }
1792 }
1793
1794 impl serde::ser::Serialize for DatabaseType {
1795 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1796 where
1797 S: serde::Serializer,
1798 {
1799 match self {
1800 Self::Unspecified => serializer.serialize_i32(0),
1801 Self::FirestoreNative => serializer.serialize_i32(1),
1802 Self::DatastoreMode => serializer.serialize_i32(2),
1803 Self::UnknownValue(u) => u.0.serialize(serializer),
1804 }
1805 }
1806 }
1807
1808 impl<'de> serde::de::Deserialize<'de> for DatabaseType {
1809 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1810 where
1811 D: serde::Deserializer<'de>,
1812 {
1813 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatabaseType>::new(
1814 ".google.firestore.admin.v1.Database.DatabaseType",
1815 ))
1816 }
1817 }
1818
1819 /// The type of concurrency control mode for transactions.
1820 ///
1821 /// # Working with unknown values
1822 ///
1823 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1824 /// additional enum variants at any time. Adding new variants is not considered
1825 /// a breaking change. Applications should write their code in anticipation of:
1826 ///
1827 /// - New values appearing in future releases of the client library, **and**
1828 /// - New values received dynamically, without application changes.
1829 ///
1830 /// Please consult the [Working with enums] section in the user guide for some
1831 /// guidelines.
1832 ///
1833 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1834 #[derive(Clone, Debug, PartialEq)]
1835 #[non_exhaustive]
1836 pub enum ConcurrencyMode {
1837 /// Not used.
1838 Unspecified,
1839 /// Use optimistic concurrency control by default. This mode is available
1840 /// for Cloud Firestore databases.
1841 ///
1842 /// This is the default setting for Cloud Firestore Enterprise Edition
1843 /// databases.
1844 Optimistic,
1845 /// Use pessimistic concurrency control by default. This mode is available
1846 /// for Cloud Firestore databases.
1847 ///
1848 /// This is the default setting for Cloud Firestore Standard Edition
1849 /// databases.
1850 Pessimistic,
1851 /// Use optimistic concurrency control with entity groups by default.
1852 ///
1853 /// This mode is enabled for some databases that were automatically upgraded
1854 /// from Cloud Datastore to Cloud Firestore with Datastore Mode.
1855 ///
1856 /// It is not recommended for any new databases, and not supported for
1857 /// Firestore Native databases.
1858 OptimisticWithEntityGroups,
1859 /// If set, the enum was initialized with an unknown value.
1860 ///
1861 /// Applications can examine the value using [ConcurrencyMode::value] or
1862 /// [ConcurrencyMode::name].
1863 UnknownValue(concurrency_mode::UnknownValue),
1864 }
1865
1866 #[doc(hidden)]
1867 pub mod concurrency_mode {
1868 #[allow(unused_imports)]
1869 use super::*;
1870 #[derive(Clone, Debug, PartialEq)]
1871 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1872 }
1873
1874 impl ConcurrencyMode {
1875 /// Gets the enum value.
1876 ///
1877 /// Returns `None` if the enum contains an unknown value deserialized from
1878 /// the string representation of enums.
1879 pub fn value(&self) -> std::option::Option<i32> {
1880 match self {
1881 Self::Unspecified => std::option::Option::Some(0),
1882 Self::Optimistic => std::option::Option::Some(1),
1883 Self::Pessimistic => std::option::Option::Some(2),
1884 Self::OptimisticWithEntityGroups => std::option::Option::Some(3),
1885 Self::UnknownValue(u) => u.0.value(),
1886 }
1887 }
1888
1889 /// Gets the enum value as a string.
1890 ///
1891 /// Returns `None` if the enum contains an unknown value deserialized from
1892 /// the integer representation of enums.
1893 pub fn name(&self) -> std::option::Option<&str> {
1894 match self {
1895 Self::Unspecified => std::option::Option::Some("CONCURRENCY_MODE_UNSPECIFIED"),
1896 Self::Optimistic => std::option::Option::Some("OPTIMISTIC"),
1897 Self::Pessimistic => std::option::Option::Some("PESSIMISTIC"),
1898 Self::OptimisticWithEntityGroups => {
1899 std::option::Option::Some("OPTIMISTIC_WITH_ENTITY_GROUPS")
1900 }
1901 Self::UnknownValue(u) => u.0.name(),
1902 }
1903 }
1904 }
1905
1906 impl std::default::Default for ConcurrencyMode {
1907 fn default() -> Self {
1908 use std::convert::From;
1909 Self::from(0)
1910 }
1911 }
1912
1913 impl std::fmt::Display for ConcurrencyMode {
1914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1915 wkt::internal::display_enum(f, self.name(), self.value())
1916 }
1917 }
1918
1919 impl std::convert::From<i32> for ConcurrencyMode {
1920 fn from(value: i32) -> Self {
1921 match value {
1922 0 => Self::Unspecified,
1923 1 => Self::Optimistic,
1924 2 => Self::Pessimistic,
1925 3 => Self::OptimisticWithEntityGroups,
1926 _ => Self::UnknownValue(concurrency_mode::UnknownValue(
1927 wkt::internal::UnknownEnumValue::Integer(value),
1928 )),
1929 }
1930 }
1931 }
1932
1933 impl std::convert::From<&str> for ConcurrencyMode {
1934 fn from(value: &str) -> Self {
1935 use std::string::ToString;
1936 match value {
1937 "CONCURRENCY_MODE_UNSPECIFIED" => Self::Unspecified,
1938 "OPTIMISTIC" => Self::Optimistic,
1939 "PESSIMISTIC" => Self::Pessimistic,
1940 "OPTIMISTIC_WITH_ENTITY_GROUPS" => Self::OptimisticWithEntityGroups,
1941 _ => Self::UnknownValue(concurrency_mode::UnknownValue(
1942 wkt::internal::UnknownEnumValue::String(value.to_string()),
1943 )),
1944 }
1945 }
1946 }
1947
1948 impl serde::ser::Serialize for ConcurrencyMode {
1949 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1950 where
1951 S: serde::Serializer,
1952 {
1953 match self {
1954 Self::Unspecified => serializer.serialize_i32(0),
1955 Self::Optimistic => serializer.serialize_i32(1),
1956 Self::Pessimistic => serializer.serialize_i32(2),
1957 Self::OptimisticWithEntityGroups => serializer.serialize_i32(3),
1958 Self::UnknownValue(u) => u.0.serialize(serializer),
1959 }
1960 }
1961 }
1962
1963 impl<'de> serde::de::Deserialize<'de> for ConcurrencyMode {
1964 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1965 where
1966 D: serde::Deserializer<'de>,
1967 {
1968 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConcurrencyMode>::new(
1969 ".google.firestore.admin.v1.Database.ConcurrencyMode",
1970 ))
1971 }
1972 }
1973
1974 /// Point In Time Recovery feature enablement.
1975 ///
1976 /// # Working with unknown values
1977 ///
1978 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1979 /// additional enum variants at any time. Adding new variants is not considered
1980 /// a breaking change. Applications should write their code in anticipation of:
1981 ///
1982 /// - New values appearing in future releases of the client library, **and**
1983 /// - New values received dynamically, without application changes.
1984 ///
1985 /// Please consult the [Working with enums] section in the user guide for some
1986 /// guidelines.
1987 ///
1988 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1989 #[derive(Clone, Debug, PartialEq)]
1990 #[non_exhaustive]
1991 pub enum PointInTimeRecoveryEnablement {
1992 /// Not used.
1993 Unspecified,
1994 /// Reads are supported on selected versions of the data from within the past
1995 /// 7 days:
1996 ///
1997 /// * Reads against any timestamp within the past hour
1998 /// * Reads against 1-minute snapshots beyond 1 hour and within 7 days
1999 ///
2000 /// `version_retention_period` and `earliest_version_time` can be
2001 /// used to determine the supported versions.
2002 PointInTimeRecoveryEnabled,
2003 /// Reads are supported on any version of the data from within the past 1
2004 /// hour.
2005 PointInTimeRecoveryDisabled,
2006 /// If set, the enum was initialized with an unknown value.
2007 ///
2008 /// Applications can examine the value using [PointInTimeRecoveryEnablement::value] or
2009 /// [PointInTimeRecoveryEnablement::name].
2010 UnknownValue(point_in_time_recovery_enablement::UnknownValue),
2011 }
2012
2013 #[doc(hidden)]
2014 pub mod point_in_time_recovery_enablement {
2015 #[allow(unused_imports)]
2016 use super::*;
2017 #[derive(Clone, Debug, PartialEq)]
2018 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2019 }
2020
2021 impl PointInTimeRecoveryEnablement {
2022 /// Gets the enum value.
2023 ///
2024 /// Returns `None` if the enum contains an unknown value deserialized from
2025 /// the string representation of enums.
2026 pub fn value(&self) -> std::option::Option<i32> {
2027 match self {
2028 Self::Unspecified => std::option::Option::Some(0),
2029 Self::PointInTimeRecoveryEnabled => std::option::Option::Some(1),
2030 Self::PointInTimeRecoveryDisabled => std::option::Option::Some(2),
2031 Self::UnknownValue(u) => u.0.value(),
2032 }
2033 }
2034
2035 /// Gets the enum value as a string.
2036 ///
2037 /// Returns `None` if the enum contains an unknown value deserialized from
2038 /// the integer representation of enums.
2039 pub fn name(&self) -> std::option::Option<&str> {
2040 match self {
2041 Self::Unspecified => {
2042 std::option::Option::Some("POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED")
2043 }
2044 Self::PointInTimeRecoveryEnabled => {
2045 std::option::Option::Some("POINT_IN_TIME_RECOVERY_ENABLED")
2046 }
2047 Self::PointInTimeRecoveryDisabled => {
2048 std::option::Option::Some("POINT_IN_TIME_RECOVERY_DISABLED")
2049 }
2050 Self::UnknownValue(u) => u.0.name(),
2051 }
2052 }
2053 }
2054
2055 impl std::default::Default for PointInTimeRecoveryEnablement {
2056 fn default() -> Self {
2057 use std::convert::From;
2058 Self::from(0)
2059 }
2060 }
2061
2062 impl std::fmt::Display for PointInTimeRecoveryEnablement {
2063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2064 wkt::internal::display_enum(f, self.name(), self.value())
2065 }
2066 }
2067
2068 impl std::convert::From<i32> for PointInTimeRecoveryEnablement {
2069 fn from(value: i32) -> Self {
2070 match value {
2071 0 => Self::Unspecified,
2072 1 => Self::PointInTimeRecoveryEnabled,
2073 2 => Self::PointInTimeRecoveryDisabled,
2074 _ => Self::UnknownValue(point_in_time_recovery_enablement::UnknownValue(
2075 wkt::internal::UnknownEnumValue::Integer(value),
2076 )),
2077 }
2078 }
2079 }
2080
2081 impl std::convert::From<&str> for PointInTimeRecoveryEnablement {
2082 fn from(value: &str) -> Self {
2083 use std::string::ToString;
2084 match value {
2085 "POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED" => Self::Unspecified,
2086 "POINT_IN_TIME_RECOVERY_ENABLED" => Self::PointInTimeRecoveryEnabled,
2087 "POINT_IN_TIME_RECOVERY_DISABLED" => Self::PointInTimeRecoveryDisabled,
2088 _ => Self::UnknownValue(point_in_time_recovery_enablement::UnknownValue(
2089 wkt::internal::UnknownEnumValue::String(value.to_string()),
2090 )),
2091 }
2092 }
2093 }
2094
2095 impl serde::ser::Serialize for PointInTimeRecoveryEnablement {
2096 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2097 where
2098 S: serde::Serializer,
2099 {
2100 match self {
2101 Self::Unspecified => serializer.serialize_i32(0),
2102 Self::PointInTimeRecoveryEnabled => serializer.serialize_i32(1),
2103 Self::PointInTimeRecoveryDisabled => serializer.serialize_i32(2),
2104 Self::UnknownValue(u) => u.0.serialize(serializer),
2105 }
2106 }
2107 }
2108
2109 impl<'de> serde::de::Deserialize<'de> for PointInTimeRecoveryEnablement {
2110 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2111 where
2112 D: serde::Deserializer<'de>,
2113 {
2114 deserializer.deserialize_any(
2115 wkt::internal::EnumVisitor::<PointInTimeRecoveryEnablement>::new(
2116 ".google.firestore.admin.v1.Database.PointInTimeRecoveryEnablement",
2117 ),
2118 )
2119 }
2120 }
2121
2122 /// The type of App Engine integration mode.
2123 ///
2124 /// # Working with unknown values
2125 ///
2126 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2127 /// additional enum variants at any time. Adding new variants is not considered
2128 /// a breaking change. Applications should write their code in anticipation of:
2129 ///
2130 /// - New values appearing in future releases of the client library, **and**
2131 /// - New values received dynamically, without application changes.
2132 ///
2133 /// Please consult the [Working with enums] section in the user guide for some
2134 /// guidelines.
2135 ///
2136 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2137 #[derive(Clone, Debug, PartialEq)]
2138 #[non_exhaustive]
2139 pub enum AppEngineIntegrationMode {
2140 /// Not used.
2141 Unspecified,
2142 /// If an App Engine application exists in the same region as this database,
2143 /// App Engine configuration will impact this database. This includes
2144 /// disabling of the application & database, as well as disabling writes to
2145 /// the database.
2146 Enabled,
2147 /// App Engine has no effect on the ability of this database to serve
2148 /// requests.
2149 ///
2150 /// This is the default setting for databases created with the Firestore API.
2151 Disabled,
2152 /// If set, the enum was initialized with an unknown value.
2153 ///
2154 /// Applications can examine the value using [AppEngineIntegrationMode::value] or
2155 /// [AppEngineIntegrationMode::name].
2156 UnknownValue(app_engine_integration_mode::UnknownValue),
2157 }
2158
2159 #[doc(hidden)]
2160 pub mod app_engine_integration_mode {
2161 #[allow(unused_imports)]
2162 use super::*;
2163 #[derive(Clone, Debug, PartialEq)]
2164 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2165 }
2166
2167 impl AppEngineIntegrationMode {
2168 /// Gets the enum value.
2169 ///
2170 /// Returns `None` if the enum contains an unknown value deserialized from
2171 /// the string representation of enums.
2172 pub fn value(&self) -> std::option::Option<i32> {
2173 match self {
2174 Self::Unspecified => std::option::Option::Some(0),
2175 Self::Enabled => std::option::Option::Some(1),
2176 Self::Disabled => std::option::Option::Some(2),
2177 Self::UnknownValue(u) => u.0.value(),
2178 }
2179 }
2180
2181 /// Gets the enum value as a string.
2182 ///
2183 /// Returns `None` if the enum contains an unknown value deserialized from
2184 /// the integer representation of enums.
2185 pub fn name(&self) -> std::option::Option<&str> {
2186 match self {
2187 Self::Unspecified => {
2188 std::option::Option::Some("APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED")
2189 }
2190 Self::Enabled => std::option::Option::Some("ENABLED"),
2191 Self::Disabled => std::option::Option::Some("DISABLED"),
2192 Self::UnknownValue(u) => u.0.name(),
2193 }
2194 }
2195 }
2196
2197 impl std::default::Default for AppEngineIntegrationMode {
2198 fn default() -> Self {
2199 use std::convert::From;
2200 Self::from(0)
2201 }
2202 }
2203
2204 impl std::fmt::Display for AppEngineIntegrationMode {
2205 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2206 wkt::internal::display_enum(f, self.name(), self.value())
2207 }
2208 }
2209
2210 impl std::convert::From<i32> for AppEngineIntegrationMode {
2211 fn from(value: i32) -> Self {
2212 match value {
2213 0 => Self::Unspecified,
2214 1 => Self::Enabled,
2215 2 => Self::Disabled,
2216 _ => Self::UnknownValue(app_engine_integration_mode::UnknownValue(
2217 wkt::internal::UnknownEnumValue::Integer(value),
2218 )),
2219 }
2220 }
2221 }
2222
2223 impl std::convert::From<&str> for AppEngineIntegrationMode {
2224 fn from(value: &str) -> Self {
2225 use std::string::ToString;
2226 match value {
2227 "APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED" => Self::Unspecified,
2228 "ENABLED" => Self::Enabled,
2229 "DISABLED" => Self::Disabled,
2230 _ => Self::UnknownValue(app_engine_integration_mode::UnknownValue(
2231 wkt::internal::UnknownEnumValue::String(value.to_string()),
2232 )),
2233 }
2234 }
2235 }
2236
2237 impl serde::ser::Serialize for AppEngineIntegrationMode {
2238 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2239 where
2240 S: serde::Serializer,
2241 {
2242 match self {
2243 Self::Unspecified => serializer.serialize_i32(0),
2244 Self::Enabled => serializer.serialize_i32(1),
2245 Self::Disabled => serializer.serialize_i32(2),
2246 Self::UnknownValue(u) => u.0.serialize(serializer),
2247 }
2248 }
2249 }
2250
2251 impl<'de> serde::de::Deserialize<'de> for AppEngineIntegrationMode {
2252 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2253 where
2254 D: serde::Deserializer<'de>,
2255 {
2256 deserializer.deserialize_any(
2257 wkt::internal::EnumVisitor::<AppEngineIntegrationMode>::new(
2258 ".google.firestore.admin.v1.Database.AppEngineIntegrationMode",
2259 ),
2260 )
2261 }
2262 }
2263
2264 /// The delete protection state of the database.
2265 ///
2266 /// # Working with unknown values
2267 ///
2268 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2269 /// additional enum variants at any time. Adding new variants is not considered
2270 /// a breaking change. Applications should write their code in anticipation of:
2271 ///
2272 /// - New values appearing in future releases of the client library, **and**
2273 /// - New values received dynamically, without application changes.
2274 ///
2275 /// Please consult the [Working with enums] section in the user guide for some
2276 /// guidelines.
2277 ///
2278 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2279 #[derive(Clone, Debug, PartialEq)]
2280 #[non_exhaustive]
2281 pub enum DeleteProtectionState {
2282 /// The default value. Delete protection type is not specified
2283 Unspecified,
2284 /// Delete protection is disabled
2285 DeleteProtectionDisabled,
2286 /// Delete protection is enabled
2287 DeleteProtectionEnabled,
2288 /// If set, the enum was initialized with an unknown value.
2289 ///
2290 /// Applications can examine the value using [DeleteProtectionState::value] or
2291 /// [DeleteProtectionState::name].
2292 UnknownValue(delete_protection_state::UnknownValue),
2293 }
2294
2295 #[doc(hidden)]
2296 pub mod delete_protection_state {
2297 #[allow(unused_imports)]
2298 use super::*;
2299 #[derive(Clone, Debug, PartialEq)]
2300 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2301 }
2302
2303 impl DeleteProtectionState {
2304 /// Gets the enum value.
2305 ///
2306 /// Returns `None` if the enum contains an unknown value deserialized from
2307 /// the string representation of enums.
2308 pub fn value(&self) -> std::option::Option<i32> {
2309 match self {
2310 Self::Unspecified => std::option::Option::Some(0),
2311 Self::DeleteProtectionDisabled => std::option::Option::Some(1),
2312 Self::DeleteProtectionEnabled => std::option::Option::Some(2),
2313 Self::UnknownValue(u) => u.0.value(),
2314 }
2315 }
2316
2317 /// Gets the enum value as a string.
2318 ///
2319 /// Returns `None` if the enum contains an unknown value deserialized from
2320 /// the integer representation of enums.
2321 pub fn name(&self) -> std::option::Option<&str> {
2322 match self {
2323 Self::Unspecified => {
2324 std::option::Option::Some("DELETE_PROTECTION_STATE_UNSPECIFIED")
2325 }
2326 Self::DeleteProtectionDisabled => {
2327 std::option::Option::Some("DELETE_PROTECTION_DISABLED")
2328 }
2329 Self::DeleteProtectionEnabled => {
2330 std::option::Option::Some("DELETE_PROTECTION_ENABLED")
2331 }
2332 Self::UnknownValue(u) => u.0.name(),
2333 }
2334 }
2335 }
2336
2337 impl std::default::Default for DeleteProtectionState {
2338 fn default() -> Self {
2339 use std::convert::From;
2340 Self::from(0)
2341 }
2342 }
2343
2344 impl std::fmt::Display for DeleteProtectionState {
2345 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2346 wkt::internal::display_enum(f, self.name(), self.value())
2347 }
2348 }
2349
2350 impl std::convert::From<i32> for DeleteProtectionState {
2351 fn from(value: i32) -> Self {
2352 match value {
2353 0 => Self::Unspecified,
2354 1 => Self::DeleteProtectionDisabled,
2355 2 => Self::DeleteProtectionEnabled,
2356 _ => Self::UnknownValue(delete_protection_state::UnknownValue(
2357 wkt::internal::UnknownEnumValue::Integer(value),
2358 )),
2359 }
2360 }
2361 }
2362
2363 impl std::convert::From<&str> for DeleteProtectionState {
2364 fn from(value: &str) -> Self {
2365 use std::string::ToString;
2366 match value {
2367 "DELETE_PROTECTION_STATE_UNSPECIFIED" => Self::Unspecified,
2368 "DELETE_PROTECTION_DISABLED" => Self::DeleteProtectionDisabled,
2369 "DELETE_PROTECTION_ENABLED" => Self::DeleteProtectionEnabled,
2370 _ => Self::UnknownValue(delete_protection_state::UnknownValue(
2371 wkt::internal::UnknownEnumValue::String(value.to_string()),
2372 )),
2373 }
2374 }
2375 }
2376
2377 impl serde::ser::Serialize for DeleteProtectionState {
2378 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2379 where
2380 S: serde::Serializer,
2381 {
2382 match self {
2383 Self::Unspecified => serializer.serialize_i32(0),
2384 Self::DeleteProtectionDisabled => serializer.serialize_i32(1),
2385 Self::DeleteProtectionEnabled => serializer.serialize_i32(2),
2386 Self::UnknownValue(u) => u.0.serialize(serializer),
2387 }
2388 }
2389 }
2390
2391 impl<'de> serde::de::Deserialize<'de> for DeleteProtectionState {
2392 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2393 where
2394 D: serde::Deserializer<'de>,
2395 {
2396 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeleteProtectionState>::new(
2397 ".google.firestore.admin.v1.Database.DeleteProtectionState",
2398 ))
2399 }
2400 }
2401
2402 /// The edition of the database.
2403 ///
2404 /// # Working with unknown values
2405 ///
2406 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2407 /// additional enum variants at any time. Adding new variants is not considered
2408 /// a breaking change. Applications should write their code in anticipation of:
2409 ///
2410 /// - New values appearing in future releases of the client library, **and**
2411 /// - New values received dynamically, without application changes.
2412 ///
2413 /// Please consult the [Working with enums] section in the user guide for some
2414 /// guidelines.
2415 ///
2416 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2417 #[derive(Clone, Debug, PartialEq)]
2418 #[non_exhaustive]
2419 pub enum DatabaseEdition {
2420 /// Not used.
2421 Unspecified,
2422 /// Standard edition.
2423 ///
2424 /// This is the default setting if not specified.
2425 Standard,
2426 /// Enterprise edition.
2427 Enterprise,
2428 /// If set, the enum was initialized with an unknown value.
2429 ///
2430 /// Applications can examine the value using [DatabaseEdition::value] or
2431 /// [DatabaseEdition::name].
2432 UnknownValue(database_edition::UnknownValue),
2433 }
2434
2435 #[doc(hidden)]
2436 pub mod database_edition {
2437 #[allow(unused_imports)]
2438 use super::*;
2439 #[derive(Clone, Debug, PartialEq)]
2440 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2441 }
2442
2443 impl DatabaseEdition {
2444 /// Gets the enum value.
2445 ///
2446 /// Returns `None` if the enum contains an unknown value deserialized from
2447 /// the string representation of enums.
2448 pub fn value(&self) -> std::option::Option<i32> {
2449 match self {
2450 Self::Unspecified => std::option::Option::Some(0),
2451 Self::Standard => std::option::Option::Some(1),
2452 Self::Enterprise => std::option::Option::Some(2),
2453 Self::UnknownValue(u) => u.0.value(),
2454 }
2455 }
2456
2457 /// Gets the enum value as a string.
2458 ///
2459 /// Returns `None` if the enum contains an unknown value deserialized from
2460 /// the integer representation of enums.
2461 pub fn name(&self) -> std::option::Option<&str> {
2462 match self {
2463 Self::Unspecified => std::option::Option::Some("DATABASE_EDITION_UNSPECIFIED"),
2464 Self::Standard => std::option::Option::Some("STANDARD"),
2465 Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
2466 Self::UnknownValue(u) => u.0.name(),
2467 }
2468 }
2469 }
2470
2471 impl std::default::Default for DatabaseEdition {
2472 fn default() -> Self {
2473 use std::convert::From;
2474 Self::from(0)
2475 }
2476 }
2477
2478 impl std::fmt::Display for DatabaseEdition {
2479 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2480 wkt::internal::display_enum(f, self.name(), self.value())
2481 }
2482 }
2483
2484 impl std::convert::From<i32> for DatabaseEdition {
2485 fn from(value: i32) -> Self {
2486 match value {
2487 0 => Self::Unspecified,
2488 1 => Self::Standard,
2489 2 => Self::Enterprise,
2490 _ => Self::UnknownValue(database_edition::UnknownValue(
2491 wkt::internal::UnknownEnumValue::Integer(value),
2492 )),
2493 }
2494 }
2495 }
2496
2497 impl std::convert::From<&str> for DatabaseEdition {
2498 fn from(value: &str) -> Self {
2499 use std::string::ToString;
2500 match value {
2501 "DATABASE_EDITION_UNSPECIFIED" => Self::Unspecified,
2502 "STANDARD" => Self::Standard,
2503 "ENTERPRISE" => Self::Enterprise,
2504 _ => Self::UnknownValue(database_edition::UnknownValue(
2505 wkt::internal::UnknownEnumValue::String(value.to_string()),
2506 )),
2507 }
2508 }
2509 }
2510
2511 impl serde::ser::Serialize for DatabaseEdition {
2512 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2513 where
2514 S: serde::Serializer,
2515 {
2516 match self {
2517 Self::Unspecified => serializer.serialize_i32(0),
2518 Self::Standard => serializer.serialize_i32(1),
2519 Self::Enterprise => serializer.serialize_i32(2),
2520 Self::UnknownValue(u) => u.0.serialize(serializer),
2521 }
2522 }
2523 }
2524
2525 impl<'de> serde::de::Deserialize<'de> for DatabaseEdition {
2526 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2527 where
2528 D: serde::Deserializer<'de>,
2529 {
2530 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatabaseEdition>::new(
2531 ".google.firestore.admin.v1.Database.DatabaseEdition",
2532 ))
2533 }
2534 }
2535
2536 /// The data access mode.
2537 ///
2538 /// # Working with unknown values
2539 ///
2540 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2541 /// additional enum variants at any time. Adding new variants is not considered
2542 /// a breaking change. Applications should write their code in anticipation of:
2543 ///
2544 /// - New values appearing in future releases of the client library, **and**
2545 /// - New values received dynamically, without application changes.
2546 ///
2547 /// Please consult the [Working with enums] section in the user guide for some
2548 /// guidelines.
2549 ///
2550 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2551 #[derive(Clone, Debug, PartialEq)]
2552 #[non_exhaustive]
2553 pub enum DataAccessMode {
2554 /// Not Used.
2555 Unspecified,
2556 /// Accessing the database through the API is allowed.
2557 Enabled,
2558 /// Accessing the database through the API is disallowed.
2559 Disabled,
2560 /// If set, the enum was initialized with an unknown value.
2561 ///
2562 /// Applications can examine the value using [DataAccessMode::value] or
2563 /// [DataAccessMode::name].
2564 UnknownValue(data_access_mode::UnknownValue),
2565 }
2566
2567 #[doc(hidden)]
2568 pub mod data_access_mode {
2569 #[allow(unused_imports)]
2570 use super::*;
2571 #[derive(Clone, Debug, PartialEq)]
2572 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2573 }
2574
2575 impl DataAccessMode {
2576 /// Gets the enum value.
2577 ///
2578 /// Returns `None` if the enum contains an unknown value deserialized from
2579 /// the string representation of enums.
2580 pub fn value(&self) -> std::option::Option<i32> {
2581 match self {
2582 Self::Unspecified => std::option::Option::Some(0),
2583 Self::Enabled => std::option::Option::Some(1),
2584 Self::Disabled => std::option::Option::Some(2),
2585 Self::UnknownValue(u) => u.0.value(),
2586 }
2587 }
2588
2589 /// Gets the enum value as a string.
2590 ///
2591 /// Returns `None` if the enum contains an unknown value deserialized from
2592 /// the integer representation of enums.
2593 pub fn name(&self) -> std::option::Option<&str> {
2594 match self {
2595 Self::Unspecified => std::option::Option::Some("DATA_ACCESS_MODE_UNSPECIFIED"),
2596 Self::Enabled => std::option::Option::Some("DATA_ACCESS_MODE_ENABLED"),
2597 Self::Disabled => std::option::Option::Some("DATA_ACCESS_MODE_DISABLED"),
2598 Self::UnknownValue(u) => u.0.name(),
2599 }
2600 }
2601 }
2602
2603 impl std::default::Default for DataAccessMode {
2604 fn default() -> Self {
2605 use std::convert::From;
2606 Self::from(0)
2607 }
2608 }
2609
2610 impl std::fmt::Display for DataAccessMode {
2611 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2612 wkt::internal::display_enum(f, self.name(), self.value())
2613 }
2614 }
2615
2616 impl std::convert::From<i32> for DataAccessMode {
2617 fn from(value: i32) -> Self {
2618 match value {
2619 0 => Self::Unspecified,
2620 1 => Self::Enabled,
2621 2 => Self::Disabled,
2622 _ => Self::UnknownValue(data_access_mode::UnknownValue(
2623 wkt::internal::UnknownEnumValue::Integer(value),
2624 )),
2625 }
2626 }
2627 }
2628
2629 impl std::convert::From<&str> for DataAccessMode {
2630 fn from(value: &str) -> Self {
2631 use std::string::ToString;
2632 match value {
2633 "DATA_ACCESS_MODE_UNSPECIFIED" => Self::Unspecified,
2634 "DATA_ACCESS_MODE_ENABLED" => Self::Enabled,
2635 "DATA_ACCESS_MODE_DISABLED" => Self::Disabled,
2636 _ => Self::UnknownValue(data_access_mode::UnknownValue(
2637 wkt::internal::UnknownEnumValue::String(value.to_string()),
2638 )),
2639 }
2640 }
2641 }
2642
2643 impl serde::ser::Serialize for DataAccessMode {
2644 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2645 where
2646 S: serde::Serializer,
2647 {
2648 match self {
2649 Self::Unspecified => serializer.serialize_i32(0),
2650 Self::Enabled => serializer.serialize_i32(1),
2651 Self::Disabled => serializer.serialize_i32(2),
2652 Self::UnknownValue(u) => u.0.serialize(serializer),
2653 }
2654 }
2655 }
2656
2657 impl<'de> serde::de::Deserialize<'de> for DataAccessMode {
2658 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2659 where
2660 D: serde::Deserializer<'de>,
2661 {
2662 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataAccessMode>::new(
2663 ".google.firestore.admin.v1.Database.DataAccessMode",
2664 ))
2665 }
2666 }
2667}
2668
2669/// Represents a single field in the database.
2670///
2671/// Fields are grouped by their "Collection Group", which represent all
2672/// collections in the database with the same ID.
2673#[derive(Clone, Default, PartialEq)]
2674#[non_exhaustive]
2675pub struct Field {
2676 /// Required. A field name of the form:
2677 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
2678 ///
2679 /// A field path can be a simple field name, e.g. `address` or a path to fields
2680 /// within `map_value` , e.g. `address.city`,
2681 /// or a special field path. The only valid special field is `*`, which
2682 /// represents any field.
2683 ///
2684 /// Field paths can be quoted using `` ` `` (backtick). The only character that
2685 /// must be escaped within a quoted field path is the backtick character
2686 /// itself, escaped using a backslash. Special characters in field paths that
2687 /// must be quoted include: `*`, `.`,
2688 /// `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
2689 ///
2690 /// Examples:
2691 /// `` `address.city` `` represents a field named `address.city`, not the map
2692 /// key `city` in the field `address`. `` `*` `` represents a field named `*`,
2693 /// not any field.
2694 ///
2695 /// A special `Field` contains the default indexing settings for all fields.
2696 /// This field's resource name is:
2697 /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`
2698 /// Indexes defined on this `Field` will be applied to all fields which do not
2699 /// have their own `Field` index configuration.
2700 pub name: std::string::String,
2701
2702 /// The index configuration for this field. If unset, field indexing will
2703 /// revert to the configuration defined by the `ancestor_field`. To
2704 /// explicitly remove all indexes for this field, specify an index config
2705 /// with an empty list of indexes.
2706 pub index_config: std::option::Option<crate::model::field::IndexConfig>,
2707
2708 /// The TTL configuration for this `Field`.
2709 /// Setting or unsetting this will enable or disable the TTL for
2710 /// documents that have this `Field`.
2711 pub ttl_config: std::option::Option<crate::model::field::TtlConfig>,
2712
2713 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2714}
2715
2716impl Field {
2717 /// Creates a new default instance.
2718 pub fn new() -> Self {
2719 std::default::Default::default()
2720 }
2721
2722 /// Sets the value of [name][crate::model::Field::name].
2723 ///
2724 /// # Example
2725 /// ```ignore,no_run
2726 /// # use google_cloud_firestore_admin_v1::model::Field;
2727 /// let x = Field::new().set_name("example");
2728 /// ```
2729 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2730 self.name = v.into();
2731 self
2732 }
2733
2734 /// Sets the value of [index_config][crate::model::Field::index_config].
2735 ///
2736 /// # Example
2737 /// ```ignore,no_run
2738 /// # use google_cloud_firestore_admin_v1::model::Field;
2739 /// use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2740 /// let x = Field::new().set_index_config(IndexConfig::default()/* use setters */);
2741 /// ```
2742 pub fn set_index_config<T>(mut self, v: T) -> Self
2743 where
2744 T: std::convert::Into<crate::model::field::IndexConfig>,
2745 {
2746 self.index_config = std::option::Option::Some(v.into());
2747 self
2748 }
2749
2750 /// Sets or clears the value of [index_config][crate::model::Field::index_config].
2751 ///
2752 /// # Example
2753 /// ```ignore,no_run
2754 /// # use google_cloud_firestore_admin_v1::model::Field;
2755 /// use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2756 /// let x = Field::new().set_or_clear_index_config(Some(IndexConfig::default()/* use setters */));
2757 /// let x = Field::new().set_or_clear_index_config(None::<IndexConfig>);
2758 /// ```
2759 pub fn set_or_clear_index_config<T>(mut self, v: std::option::Option<T>) -> Self
2760 where
2761 T: std::convert::Into<crate::model::field::IndexConfig>,
2762 {
2763 self.index_config = v.map(|x| x.into());
2764 self
2765 }
2766
2767 /// Sets the value of [ttl_config][crate::model::Field::ttl_config].
2768 ///
2769 /// # Example
2770 /// ```ignore,no_run
2771 /// # use google_cloud_firestore_admin_v1::model::Field;
2772 /// use google_cloud_firestore_admin_v1::model::field::TtlConfig;
2773 /// let x = Field::new().set_ttl_config(TtlConfig::default()/* use setters */);
2774 /// ```
2775 pub fn set_ttl_config<T>(mut self, v: T) -> Self
2776 where
2777 T: std::convert::Into<crate::model::field::TtlConfig>,
2778 {
2779 self.ttl_config = std::option::Option::Some(v.into());
2780 self
2781 }
2782
2783 /// Sets or clears the value of [ttl_config][crate::model::Field::ttl_config].
2784 ///
2785 /// # Example
2786 /// ```ignore,no_run
2787 /// # use google_cloud_firestore_admin_v1::model::Field;
2788 /// use google_cloud_firestore_admin_v1::model::field::TtlConfig;
2789 /// let x = Field::new().set_or_clear_ttl_config(Some(TtlConfig::default()/* use setters */));
2790 /// let x = Field::new().set_or_clear_ttl_config(None::<TtlConfig>);
2791 /// ```
2792 pub fn set_or_clear_ttl_config<T>(mut self, v: std::option::Option<T>) -> Self
2793 where
2794 T: std::convert::Into<crate::model::field::TtlConfig>,
2795 {
2796 self.ttl_config = v.map(|x| x.into());
2797 self
2798 }
2799}
2800
2801impl wkt::message::Message for Field {
2802 fn typename() -> &'static str {
2803 "type.googleapis.com/google.firestore.admin.v1.Field"
2804 }
2805}
2806
2807/// Defines additional types related to [Field].
2808pub mod field {
2809 #[allow(unused_imports)]
2810 use super::*;
2811
2812 /// The index configuration for this field.
2813 #[derive(Clone, Default, PartialEq)]
2814 #[non_exhaustive]
2815 pub struct IndexConfig {
2816 /// The indexes supported for this field.
2817 pub indexes: std::vec::Vec<crate::model::Index>,
2818
2819 /// Output only. When true, the `Field`'s index configuration is set from the
2820 /// configuration specified by the `ancestor_field`.
2821 /// When false, the `Field`'s index configuration is defined explicitly.
2822 pub uses_ancestor_config: bool,
2823
2824 /// Output only. Specifies the resource name of the `Field` from which this
2825 /// field's index configuration is set (when `uses_ancestor_config` is true),
2826 /// or from which it *would* be set if this field had no index configuration
2827 /// (when `uses_ancestor_config` is false).
2828 pub ancestor_field: std::string::String,
2829
2830 /// Output only
2831 /// When true, the `Field`'s index configuration is in the process of being
2832 /// reverted. Once complete, the index config will transition to the same
2833 /// state as the field specified by `ancestor_field`, at which point
2834 /// `uses_ancestor_config` will be `true` and `reverting` will be `false`.
2835 pub reverting: bool,
2836
2837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2838 }
2839
2840 impl IndexConfig {
2841 /// Creates a new default instance.
2842 pub fn new() -> Self {
2843 std::default::Default::default()
2844 }
2845
2846 /// Sets the value of [indexes][crate::model::field::IndexConfig::indexes].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2851 /// use google_cloud_firestore_admin_v1::model::Index;
2852 /// let x = IndexConfig::new()
2853 /// .set_indexes([
2854 /// Index::default()/* use setters */,
2855 /// Index::default()/* use (different) setters */,
2856 /// ]);
2857 /// ```
2858 pub fn set_indexes<T, V>(mut self, v: T) -> Self
2859 where
2860 T: std::iter::IntoIterator<Item = V>,
2861 V: std::convert::Into<crate::model::Index>,
2862 {
2863 use std::iter::Iterator;
2864 self.indexes = v.into_iter().map(|i| i.into()).collect();
2865 self
2866 }
2867
2868 /// Sets the value of [uses_ancestor_config][crate::model::field::IndexConfig::uses_ancestor_config].
2869 ///
2870 /// # Example
2871 /// ```ignore,no_run
2872 /// # use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2873 /// let x = IndexConfig::new().set_uses_ancestor_config(true);
2874 /// ```
2875 pub fn set_uses_ancestor_config<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2876 self.uses_ancestor_config = v.into();
2877 self
2878 }
2879
2880 /// Sets the value of [ancestor_field][crate::model::field::IndexConfig::ancestor_field].
2881 ///
2882 /// # Example
2883 /// ```ignore,no_run
2884 /// # use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2885 /// let x = IndexConfig::new().set_ancestor_field("example");
2886 /// ```
2887 pub fn set_ancestor_field<T: std::convert::Into<std::string::String>>(
2888 mut self,
2889 v: T,
2890 ) -> Self {
2891 self.ancestor_field = v.into();
2892 self
2893 }
2894
2895 /// Sets the value of [reverting][crate::model::field::IndexConfig::reverting].
2896 ///
2897 /// # Example
2898 /// ```ignore,no_run
2899 /// # use google_cloud_firestore_admin_v1::model::field::IndexConfig;
2900 /// let x = IndexConfig::new().set_reverting(true);
2901 /// ```
2902 pub fn set_reverting<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2903 self.reverting = v.into();
2904 self
2905 }
2906 }
2907
2908 impl wkt::message::Message for IndexConfig {
2909 fn typename() -> &'static str {
2910 "type.googleapis.com/google.firestore.admin.v1.Field.IndexConfig"
2911 }
2912 }
2913
2914 /// The TTL (time-to-live) configuration for documents that have this `Field`
2915 /// set.
2916 ///
2917 /// A timestamp stored in a TTL-enabled field will be used to determine the
2918 /// expiration time of the document. The expiration time is the sum
2919 /// of the timestamp value and the `expiration_offset`.
2920 ///
2921 /// For Enterprise edition databases, the timestamp value may alternatively be
2922 /// stored in an array value in the TTL-enabled field.
2923 ///
2924 /// An expiration time in the past indicates that the document is eligible for
2925 /// immediate expiration. Using any other data type or leaving the field absent
2926 /// will disable expiration for the individual document.
2927 #[derive(Clone, Default, PartialEq)]
2928 #[non_exhaustive]
2929 pub struct TtlConfig {
2930 /// Output only. The state of the TTL configuration.
2931 pub state: crate::model::field::ttl_config::State,
2932
2933 /// Optional. The offset, relative to the timestamp value from the
2934 /// TTL-enabled field, used to determine the document's expiration time.
2935 ///
2936 /// `expiration_offset.seconds` must be between 0 and 2,147,483,647
2937 /// inclusive. Values more precise than seconds are rejected.
2938 ///
2939 /// If unset, defaults to 0, in which case the expiration time is the same
2940 /// as the timestamp value from the TTL-enabled field.
2941 pub expiration_offset: std::option::Option<wkt::Duration>,
2942
2943 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2944 }
2945
2946 impl TtlConfig {
2947 /// Creates a new default instance.
2948 pub fn new() -> Self {
2949 std::default::Default::default()
2950 }
2951
2952 /// Sets the value of [state][crate::model::field::TtlConfig::state].
2953 ///
2954 /// # Example
2955 /// ```ignore,no_run
2956 /// # use google_cloud_firestore_admin_v1::model::field::TtlConfig;
2957 /// use google_cloud_firestore_admin_v1::model::field::ttl_config::State;
2958 /// let x0 = TtlConfig::new().set_state(State::Creating);
2959 /// let x1 = TtlConfig::new().set_state(State::Active);
2960 /// let x2 = TtlConfig::new().set_state(State::NeedsRepair);
2961 /// ```
2962 pub fn set_state<T: std::convert::Into<crate::model::field::ttl_config::State>>(
2963 mut self,
2964 v: T,
2965 ) -> Self {
2966 self.state = v.into();
2967 self
2968 }
2969
2970 /// Sets the value of [expiration_offset][crate::model::field::TtlConfig::expiration_offset].
2971 ///
2972 /// # Example
2973 /// ```ignore,no_run
2974 /// # use google_cloud_firestore_admin_v1::model::field::TtlConfig;
2975 /// use wkt::Duration;
2976 /// let x = TtlConfig::new().set_expiration_offset(Duration::default()/* use setters */);
2977 /// ```
2978 pub fn set_expiration_offset<T>(mut self, v: T) -> Self
2979 where
2980 T: std::convert::Into<wkt::Duration>,
2981 {
2982 self.expiration_offset = std::option::Option::Some(v.into());
2983 self
2984 }
2985
2986 /// Sets or clears the value of [expiration_offset][crate::model::field::TtlConfig::expiration_offset].
2987 ///
2988 /// # Example
2989 /// ```ignore,no_run
2990 /// # use google_cloud_firestore_admin_v1::model::field::TtlConfig;
2991 /// use wkt::Duration;
2992 /// let x = TtlConfig::new().set_or_clear_expiration_offset(Some(Duration::default()/* use setters */));
2993 /// let x = TtlConfig::new().set_or_clear_expiration_offset(None::<Duration>);
2994 /// ```
2995 pub fn set_or_clear_expiration_offset<T>(mut self, v: std::option::Option<T>) -> Self
2996 where
2997 T: std::convert::Into<wkt::Duration>,
2998 {
2999 self.expiration_offset = v.map(|x| x.into());
3000 self
3001 }
3002 }
3003
3004 impl wkt::message::Message for TtlConfig {
3005 fn typename() -> &'static str {
3006 "type.googleapis.com/google.firestore.admin.v1.Field.TtlConfig"
3007 }
3008 }
3009
3010 /// Defines additional types related to [TtlConfig].
3011 pub mod ttl_config {
3012 #[allow(unused_imports)]
3013 use super::*;
3014
3015 /// The state of applying the TTL configuration to all documents.
3016 ///
3017 /// # Working with unknown values
3018 ///
3019 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3020 /// additional enum variants at any time. Adding new variants is not considered
3021 /// a breaking change. Applications should write their code in anticipation of:
3022 ///
3023 /// - New values appearing in future releases of the client library, **and**
3024 /// - New values received dynamically, without application changes.
3025 ///
3026 /// Please consult the [Working with enums] section in the user guide for some
3027 /// guidelines.
3028 ///
3029 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3030 #[derive(Clone, Debug, PartialEq)]
3031 #[non_exhaustive]
3032 pub enum State {
3033 /// The state is unspecified or unknown.
3034 Unspecified,
3035 /// The TTL is being applied. There is an active long-running operation to
3036 /// track the change. Newly written documents will have TTLs applied as
3037 /// requested. Requested TTLs on existing documents are still being
3038 /// processed. When TTLs on all existing documents have been processed, the
3039 /// state will move to 'ACTIVE'.
3040 Creating,
3041 /// The TTL is active for all documents.
3042 Active,
3043 /// The TTL configuration could not be enabled for all existing documents.
3044 /// Newly written documents will continue to have their TTL applied.
3045 /// The LRO returned when last attempting to enable TTL for this `Field`
3046 /// has failed, and may have more details.
3047 NeedsRepair,
3048 /// If set, the enum was initialized with an unknown value.
3049 ///
3050 /// Applications can examine the value using [State::value] or
3051 /// [State::name].
3052 UnknownValue(state::UnknownValue),
3053 }
3054
3055 #[doc(hidden)]
3056 pub mod state {
3057 #[allow(unused_imports)]
3058 use super::*;
3059 #[derive(Clone, Debug, PartialEq)]
3060 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3061 }
3062
3063 impl State {
3064 /// Gets the enum value.
3065 ///
3066 /// Returns `None` if the enum contains an unknown value deserialized from
3067 /// the string representation of enums.
3068 pub fn value(&self) -> std::option::Option<i32> {
3069 match self {
3070 Self::Unspecified => std::option::Option::Some(0),
3071 Self::Creating => std::option::Option::Some(1),
3072 Self::Active => std::option::Option::Some(2),
3073 Self::NeedsRepair => std::option::Option::Some(3),
3074 Self::UnknownValue(u) => u.0.value(),
3075 }
3076 }
3077
3078 /// Gets the enum value as a string.
3079 ///
3080 /// Returns `None` if the enum contains an unknown value deserialized from
3081 /// the integer representation of enums.
3082 pub fn name(&self) -> std::option::Option<&str> {
3083 match self {
3084 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3085 Self::Creating => std::option::Option::Some("CREATING"),
3086 Self::Active => std::option::Option::Some("ACTIVE"),
3087 Self::NeedsRepair => std::option::Option::Some("NEEDS_REPAIR"),
3088 Self::UnknownValue(u) => u.0.name(),
3089 }
3090 }
3091 }
3092
3093 impl std::default::Default for State {
3094 fn default() -> Self {
3095 use std::convert::From;
3096 Self::from(0)
3097 }
3098 }
3099
3100 impl std::fmt::Display for State {
3101 fn fmt(
3102 &self,
3103 f: &mut std::fmt::Formatter<'_>,
3104 ) -> std::result::Result<(), std::fmt::Error> {
3105 wkt::internal::display_enum(f, self.name(), self.value())
3106 }
3107 }
3108
3109 impl std::convert::From<i32> for State {
3110 fn from(value: i32) -> Self {
3111 match value {
3112 0 => Self::Unspecified,
3113 1 => Self::Creating,
3114 2 => Self::Active,
3115 3 => Self::NeedsRepair,
3116 _ => Self::UnknownValue(state::UnknownValue(
3117 wkt::internal::UnknownEnumValue::Integer(value),
3118 )),
3119 }
3120 }
3121 }
3122
3123 impl std::convert::From<&str> for State {
3124 fn from(value: &str) -> Self {
3125 use std::string::ToString;
3126 match value {
3127 "STATE_UNSPECIFIED" => Self::Unspecified,
3128 "CREATING" => Self::Creating,
3129 "ACTIVE" => Self::Active,
3130 "NEEDS_REPAIR" => Self::NeedsRepair,
3131 _ => Self::UnknownValue(state::UnknownValue(
3132 wkt::internal::UnknownEnumValue::String(value.to_string()),
3133 )),
3134 }
3135 }
3136 }
3137
3138 impl serde::ser::Serialize for State {
3139 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3140 where
3141 S: serde::Serializer,
3142 {
3143 match self {
3144 Self::Unspecified => serializer.serialize_i32(0),
3145 Self::Creating => serializer.serialize_i32(1),
3146 Self::Active => serializer.serialize_i32(2),
3147 Self::NeedsRepair => serializer.serialize_i32(3),
3148 Self::UnknownValue(u) => u.0.serialize(serializer),
3149 }
3150 }
3151 }
3152
3153 impl<'de> serde::de::Deserialize<'de> for State {
3154 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3155 where
3156 D: serde::Deserializer<'de>,
3157 {
3158 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3159 ".google.firestore.admin.v1.Field.TtlConfig.State",
3160 ))
3161 }
3162 }
3163 }
3164}
3165
3166/// A request to list the Firestore Databases in all locations for a project.
3167#[derive(Clone, Default, PartialEq)]
3168#[non_exhaustive]
3169pub struct ListDatabasesRequest {
3170 /// Required. A parent name of the form
3171 /// `projects/{project_id}`
3172 pub parent: std::string::String,
3173
3174 /// If true, also returns deleted resources.
3175 pub show_deleted: bool,
3176
3177 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3178}
3179
3180impl ListDatabasesRequest {
3181 /// Creates a new default instance.
3182 pub fn new() -> Self {
3183 std::default::Default::default()
3184 }
3185
3186 /// Sets the value of [parent][crate::model::ListDatabasesRequest::parent].
3187 ///
3188 /// # Example
3189 /// ```ignore,no_run
3190 /// # use google_cloud_firestore_admin_v1::model::ListDatabasesRequest;
3191 /// let x = ListDatabasesRequest::new().set_parent("example");
3192 /// ```
3193 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3194 self.parent = v.into();
3195 self
3196 }
3197
3198 /// Sets the value of [show_deleted][crate::model::ListDatabasesRequest::show_deleted].
3199 ///
3200 /// # Example
3201 /// ```ignore,no_run
3202 /// # use google_cloud_firestore_admin_v1::model::ListDatabasesRequest;
3203 /// let x = ListDatabasesRequest::new().set_show_deleted(true);
3204 /// ```
3205 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3206 self.show_deleted = v.into();
3207 self
3208 }
3209}
3210
3211impl wkt::message::Message for ListDatabasesRequest {
3212 fn typename() -> &'static str {
3213 "type.googleapis.com/google.firestore.admin.v1.ListDatabasesRequest"
3214 }
3215}
3216
3217/// The request for
3218/// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase].
3219///
3220/// [google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]: crate::client::FirestoreAdmin::create_database
3221#[derive(Clone, Default, PartialEq)]
3222#[non_exhaustive]
3223pub struct CreateDatabaseRequest {
3224 /// Required. A parent name of the form
3225 /// `projects/{project_id}`
3226 pub parent: std::string::String,
3227
3228 /// Required. The Database to create.
3229 pub database: std::option::Option<crate::model::Database>,
3230
3231 /// Required. The ID to use for the database, which will become the final
3232 /// component of the database's resource name.
3233 ///
3234 /// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
3235 /// with first character a letter and the last a letter or a number. Must not
3236 /// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
3237 ///
3238 /// "(default)" database ID is also valid if the database is Standard edition.
3239 pub database_id: std::string::String,
3240
3241 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3242}
3243
3244impl CreateDatabaseRequest {
3245 /// Creates a new default instance.
3246 pub fn new() -> Self {
3247 std::default::Default::default()
3248 }
3249
3250 /// Sets the value of [parent][crate::model::CreateDatabaseRequest::parent].
3251 ///
3252 /// # Example
3253 /// ```ignore,no_run
3254 /// # use google_cloud_firestore_admin_v1::model::CreateDatabaseRequest;
3255 /// let x = CreateDatabaseRequest::new().set_parent("example");
3256 /// ```
3257 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3258 self.parent = v.into();
3259 self
3260 }
3261
3262 /// Sets the value of [database][crate::model::CreateDatabaseRequest::database].
3263 ///
3264 /// # Example
3265 /// ```ignore,no_run
3266 /// # use google_cloud_firestore_admin_v1::model::CreateDatabaseRequest;
3267 /// use google_cloud_firestore_admin_v1::model::Database;
3268 /// let x = CreateDatabaseRequest::new().set_database(Database::default()/* use setters */);
3269 /// ```
3270 pub fn set_database<T>(mut self, v: T) -> Self
3271 where
3272 T: std::convert::Into<crate::model::Database>,
3273 {
3274 self.database = std::option::Option::Some(v.into());
3275 self
3276 }
3277
3278 /// Sets or clears the value of [database][crate::model::CreateDatabaseRequest::database].
3279 ///
3280 /// # Example
3281 /// ```ignore,no_run
3282 /// # use google_cloud_firestore_admin_v1::model::CreateDatabaseRequest;
3283 /// use google_cloud_firestore_admin_v1::model::Database;
3284 /// let x = CreateDatabaseRequest::new().set_or_clear_database(Some(Database::default()/* use setters */));
3285 /// let x = CreateDatabaseRequest::new().set_or_clear_database(None::<Database>);
3286 /// ```
3287 pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
3288 where
3289 T: std::convert::Into<crate::model::Database>,
3290 {
3291 self.database = v.map(|x| x.into());
3292 self
3293 }
3294
3295 /// Sets the value of [database_id][crate::model::CreateDatabaseRequest::database_id].
3296 ///
3297 /// # Example
3298 /// ```ignore,no_run
3299 /// # use google_cloud_firestore_admin_v1::model::CreateDatabaseRequest;
3300 /// let x = CreateDatabaseRequest::new().set_database_id("example");
3301 /// ```
3302 pub fn set_database_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3303 self.database_id = v.into();
3304 self
3305 }
3306}
3307
3308impl wkt::message::Message for CreateDatabaseRequest {
3309 fn typename() -> &'static str {
3310 "type.googleapis.com/google.firestore.admin.v1.CreateDatabaseRequest"
3311 }
3312}
3313
3314/// Metadata related to the create database operation.
3315#[derive(Clone, Default, PartialEq)]
3316#[non_exhaustive]
3317pub struct CreateDatabaseMetadata {
3318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3319}
3320
3321impl CreateDatabaseMetadata {
3322 /// Creates a new default instance.
3323 pub fn new() -> Self {
3324 std::default::Default::default()
3325 }
3326}
3327
3328impl wkt::message::Message for CreateDatabaseMetadata {
3329 fn typename() -> &'static str {
3330 "type.googleapis.com/google.firestore.admin.v1.CreateDatabaseMetadata"
3331 }
3332}
3333
3334/// The list of databases for a project.
3335#[derive(Clone, Default, PartialEq)]
3336#[non_exhaustive]
3337pub struct ListDatabasesResponse {
3338 /// The databases in the project.
3339 pub databases: std::vec::Vec<crate::model::Database>,
3340
3341 /// In the event that data about individual databases cannot be listed they
3342 /// will be recorded here.
3343 ///
3344 /// An example entry might be: projects/some_project/locations/some_location
3345 /// This can happen if the Cloud Region that the Database resides in is
3346 /// currently unavailable. In this case we can't fetch all the details about
3347 /// the database. You may be able to get a more detailed error message
3348 /// (or possibly fetch the resource) by sending a 'Get' request for the
3349 /// resource or a 'List' request for the specific location.
3350 pub unreachable: std::vec::Vec<std::string::String>,
3351
3352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3353}
3354
3355impl ListDatabasesResponse {
3356 /// Creates a new default instance.
3357 pub fn new() -> Self {
3358 std::default::Default::default()
3359 }
3360
3361 /// Sets the value of [databases][crate::model::ListDatabasesResponse::databases].
3362 ///
3363 /// # Example
3364 /// ```ignore,no_run
3365 /// # use google_cloud_firestore_admin_v1::model::ListDatabasesResponse;
3366 /// use google_cloud_firestore_admin_v1::model::Database;
3367 /// let x = ListDatabasesResponse::new()
3368 /// .set_databases([
3369 /// Database::default()/* use setters */,
3370 /// Database::default()/* use (different) setters */,
3371 /// ]);
3372 /// ```
3373 pub fn set_databases<T, V>(mut self, v: T) -> Self
3374 where
3375 T: std::iter::IntoIterator<Item = V>,
3376 V: std::convert::Into<crate::model::Database>,
3377 {
3378 use std::iter::Iterator;
3379 self.databases = v.into_iter().map(|i| i.into()).collect();
3380 self
3381 }
3382
3383 /// Sets the value of [unreachable][crate::model::ListDatabasesResponse::unreachable].
3384 ///
3385 /// # Example
3386 /// ```ignore,no_run
3387 /// # use google_cloud_firestore_admin_v1::model::ListDatabasesResponse;
3388 /// let x = ListDatabasesResponse::new().set_unreachable(["a", "b", "c"]);
3389 /// ```
3390 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3391 where
3392 T: std::iter::IntoIterator<Item = V>,
3393 V: std::convert::Into<std::string::String>,
3394 {
3395 use std::iter::Iterator;
3396 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3397 self
3398 }
3399}
3400
3401impl wkt::message::Message for ListDatabasesResponse {
3402 fn typename() -> &'static str {
3403 "type.googleapis.com/google.firestore.admin.v1.ListDatabasesResponse"
3404 }
3405}
3406
3407/// The request for
3408/// [FirestoreAdmin.GetDatabase][google.firestore.admin.v1.FirestoreAdmin.GetDatabase].
3409///
3410/// [google.firestore.admin.v1.FirestoreAdmin.GetDatabase]: crate::client::FirestoreAdmin::get_database
3411#[derive(Clone, Default, PartialEq)]
3412#[non_exhaustive]
3413pub struct GetDatabaseRequest {
3414 /// Required. A name of the form
3415 /// `projects/{project_id}/databases/{database_id}`
3416 pub name: std::string::String,
3417
3418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3419}
3420
3421impl GetDatabaseRequest {
3422 /// Creates a new default instance.
3423 pub fn new() -> Self {
3424 std::default::Default::default()
3425 }
3426
3427 /// Sets the value of [name][crate::model::GetDatabaseRequest::name].
3428 ///
3429 /// # Example
3430 /// ```ignore,no_run
3431 /// # use google_cloud_firestore_admin_v1::model::GetDatabaseRequest;
3432 /// let x = GetDatabaseRequest::new().set_name("example");
3433 /// ```
3434 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3435 self.name = v.into();
3436 self
3437 }
3438}
3439
3440impl wkt::message::Message for GetDatabaseRequest {
3441 fn typename() -> &'static str {
3442 "type.googleapis.com/google.firestore.admin.v1.GetDatabaseRequest"
3443 }
3444}
3445
3446/// The request for
3447/// [FirestoreAdmin.UpdateDatabase][google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase].
3448///
3449/// [google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase]: crate::client::FirestoreAdmin::update_database
3450#[derive(Clone, Default, PartialEq)]
3451#[non_exhaustive]
3452pub struct UpdateDatabaseRequest {
3453 /// Required. The database to update.
3454 pub database: std::option::Option<crate::model::Database>,
3455
3456 /// The list of fields to be updated.
3457 pub update_mask: std::option::Option<wkt::FieldMask>,
3458
3459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3460}
3461
3462impl UpdateDatabaseRequest {
3463 /// Creates a new default instance.
3464 pub fn new() -> Self {
3465 std::default::Default::default()
3466 }
3467
3468 /// Sets the value of [database][crate::model::UpdateDatabaseRequest::database].
3469 ///
3470 /// # Example
3471 /// ```ignore,no_run
3472 /// # use google_cloud_firestore_admin_v1::model::UpdateDatabaseRequest;
3473 /// use google_cloud_firestore_admin_v1::model::Database;
3474 /// let x = UpdateDatabaseRequest::new().set_database(Database::default()/* use setters */);
3475 /// ```
3476 pub fn set_database<T>(mut self, v: T) -> Self
3477 where
3478 T: std::convert::Into<crate::model::Database>,
3479 {
3480 self.database = std::option::Option::Some(v.into());
3481 self
3482 }
3483
3484 /// Sets or clears the value of [database][crate::model::UpdateDatabaseRequest::database].
3485 ///
3486 /// # Example
3487 /// ```ignore,no_run
3488 /// # use google_cloud_firestore_admin_v1::model::UpdateDatabaseRequest;
3489 /// use google_cloud_firestore_admin_v1::model::Database;
3490 /// let x = UpdateDatabaseRequest::new().set_or_clear_database(Some(Database::default()/* use setters */));
3491 /// let x = UpdateDatabaseRequest::new().set_or_clear_database(None::<Database>);
3492 /// ```
3493 pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
3494 where
3495 T: std::convert::Into<crate::model::Database>,
3496 {
3497 self.database = v.map(|x| x.into());
3498 self
3499 }
3500
3501 /// Sets the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
3502 ///
3503 /// # Example
3504 /// ```ignore,no_run
3505 /// # use google_cloud_firestore_admin_v1::model::UpdateDatabaseRequest;
3506 /// use wkt::FieldMask;
3507 /// let x = UpdateDatabaseRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3508 /// ```
3509 pub fn set_update_mask<T>(mut self, v: T) -> Self
3510 where
3511 T: std::convert::Into<wkt::FieldMask>,
3512 {
3513 self.update_mask = std::option::Option::Some(v.into());
3514 self
3515 }
3516
3517 /// Sets or clears the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_firestore_admin_v1::model::UpdateDatabaseRequest;
3522 /// use wkt::FieldMask;
3523 /// let x = UpdateDatabaseRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3524 /// let x = UpdateDatabaseRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3525 /// ```
3526 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3527 where
3528 T: std::convert::Into<wkt::FieldMask>,
3529 {
3530 self.update_mask = v.map(|x| x.into());
3531 self
3532 }
3533}
3534
3535impl wkt::message::Message for UpdateDatabaseRequest {
3536 fn typename() -> &'static str {
3537 "type.googleapis.com/google.firestore.admin.v1.UpdateDatabaseRequest"
3538 }
3539}
3540
3541/// Metadata related to the update database operation.
3542#[derive(Clone, Default, PartialEq)]
3543#[non_exhaustive]
3544pub struct UpdateDatabaseMetadata {
3545 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3546}
3547
3548impl UpdateDatabaseMetadata {
3549 /// Creates a new default instance.
3550 pub fn new() -> Self {
3551 std::default::Default::default()
3552 }
3553}
3554
3555impl wkt::message::Message for UpdateDatabaseMetadata {
3556 fn typename() -> &'static str {
3557 "type.googleapis.com/google.firestore.admin.v1.UpdateDatabaseMetadata"
3558 }
3559}
3560
3561/// The request for
3562/// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase].
3563///
3564/// [google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase]: crate::client::FirestoreAdmin::delete_database
3565#[derive(Clone, Default, PartialEq)]
3566#[non_exhaustive]
3567pub struct DeleteDatabaseRequest {
3568 /// Required. A name of the form
3569 /// `projects/{project_id}/databases/{database_id}`
3570 pub name: std::string::String,
3571
3572 /// The current etag of the Database.
3573 /// If an etag is provided and does not match the current etag of the database,
3574 /// deletion will be blocked and a FAILED_PRECONDITION error will be returned.
3575 pub etag: std::string::String,
3576
3577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3578}
3579
3580impl DeleteDatabaseRequest {
3581 /// Creates a new default instance.
3582 pub fn new() -> Self {
3583 std::default::Default::default()
3584 }
3585
3586 /// Sets the value of [name][crate::model::DeleteDatabaseRequest::name].
3587 ///
3588 /// # Example
3589 /// ```ignore,no_run
3590 /// # use google_cloud_firestore_admin_v1::model::DeleteDatabaseRequest;
3591 /// let x = DeleteDatabaseRequest::new().set_name("example");
3592 /// ```
3593 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3594 self.name = v.into();
3595 self
3596 }
3597
3598 /// Sets the value of [etag][crate::model::DeleteDatabaseRequest::etag].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_firestore_admin_v1::model::DeleteDatabaseRequest;
3603 /// let x = DeleteDatabaseRequest::new().set_etag("example");
3604 /// ```
3605 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3606 self.etag = v.into();
3607 self
3608 }
3609}
3610
3611impl wkt::message::Message for DeleteDatabaseRequest {
3612 fn typename() -> &'static str {
3613 "type.googleapis.com/google.firestore.admin.v1.DeleteDatabaseRequest"
3614 }
3615}
3616
3617/// Metadata related to the delete database operation.
3618#[derive(Clone, Default, PartialEq)]
3619#[non_exhaustive]
3620pub struct DeleteDatabaseMetadata {
3621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3622}
3623
3624impl DeleteDatabaseMetadata {
3625 /// Creates a new default instance.
3626 pub fn new() -> Self {
3627 std::default::Default::default()
3628 }
3629}
3630
3631impl wkt::message::Message for DeleteDatabaseMetadata {
3632 fn typename() -> &'static str {
3633 "type.googleapis.com/google.firestore.admin.v1.DeleteDatabaseMetadata"
3634 }
3635}
3636
3637/// The request for
3638/// [FirestoreAdmin.CreateUserCreds][google.firestore.admin.v1.FirestoreAdmin.CreateUserCreds].
3639///
3640/// [google.firestore.admin.v1.FirestoreAdmin.CreateUserCreds]: crate::client::FirestoreAdmin::create_user_creds
3641#[derive(Clone, Default, PartialEq)]
3642#[non_exhaustive]
3643pub struct CreateUserCredsRequest {
3644 /// Required. A parent name of the form
3645 /// `projects/{project_id}/databases/{database_id}`
3646 pub parent: std::string::String,
3647
3648 /// Required. The user creds to create.
3649 pub user_creds: std::option::Option<crate::model::UserCreds>,
3650
3651 /// Required. The ID to use for the user creds, which will become the final
3652 /// component of the user creds's resource name.
3653 ///
3654 /// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
3655 /// with first character a letter and the last a letter or a number. Must not
3656 /// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
3657 pub user_creds_id: std::string::String,
3658
3659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3660}
3661
3662impl CreateUserCredsRequest {
3663 /// Creates a new default instance.
3664 pub fn new() -> Self {
3665 std::default::Default::default()
3666 }
3667
3668 /// Sets the value of [parent][crate::model::CreateUserCredsRequest::parent].
3669 ///
3670 /// # Example
3671 /// ```ignore,no_run
3672 /// # use google_cloud_firestore_admin_v1::model::CreateUserCredsRequest;
3673 /// let x = CreateUserCredsRequest::new().set_parent("example");
3674 /// ```
3675 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3676 self.parent = v.into();
3677 self
3678 }
3679
3680 /// Sets the value of [user_creds][crate::model::CreateUserCredsRequest::user_creds].
3681 ///
3682 /// # Example
3683 /// ```ignore,no_run
3684 /// # use google_cloud_firestore_admin_v1::model::CreateUserCredsRequest;
3685 /// use google_cloud_firestore_admin_v1::model::UserCreds;
3686 /// let x = CreateUserCredsRequest::new().set_user_creds(UserCreds::default()/* use setters */);
3687 /// ```
3688 pub fn set_user_creds<T>(mut self, v: T) -> Self
3689 where
3690 T: std::convert::Into<crate::model::UserCreds>,
3691 {
3692 self.user_creds = std::option::Option::Some(v.into());
3693 self
3694 }
3695
3696 /// Sets or clears the value of [user_creds][crate::model::CreateUserCredsRequest::user_creds].
3697 ///
3698 /// # Example
3699 /// ```ignore,no_run
3700 /// # use google_cloud_firestore_admin_v1::model::CreateUserCredsRequest;
3701 /// use google_cloud_firestore_admin_v1::model::UserCreds;
3702 /// let x = CreateUserCredsRequest::new().set_or_clear_user_creds(Some(UserCreds::default()/* use setters */));
3703 /// let x = CreateUserCredsRequest::new().set_or_clear_user_creds(None::<UserCreds>);
3704 /// ```
3705 pub fn set_or_clear_user_creds<T>(mut self, v: std::option::Option<T>) -> Self
3706 where
3707 T: std::convert::Into<crate::model::UserCreds>,
3708 {
3709 self.user_creds = v.map(|x| x.into());
3710 self
3711 }
3712
3713 /// Sets the value of [user_creds_id][crate::model::CreateUserCredsRequest::user_creds_id].
3714 ///
3715 /// # Example
3716 /// ```ignore,no_run
3717 /// # use google_cloud_firestore_admin_v1::model::CreateUserCredsRequest;
3718 /// let x = CreateUserCredsRequest::new().set_user_creds_id("example");
3719 /// ```
3720 pub fn set_user_creds_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3721 self.user_creds_id = v.into();
3722 self
3723 }
3724}
3725
3726impl wkt::message::Message for CreateUserCredsRequest {
3727 fn typename() -> &'static str {
3728 "type.googleapis.com/google.firestore.admin.v1.CreateUserCredsRequest"
3729 }
3730}
3731
3732/// The request for
3733/// [FirestoreAdmin.GetUserCreds][google.firestore.admin.v1.FirestoreAdmin.GetUserCreds].
3734///
3735/// [google.firestore.admin.v1.FirestoreAdmin.GetUserCreds]: crate::client::FirestoreAdmin::get_user_creds
3736#[derive(Clone, Default, PartialEq)]
3737#[non_exhaustive]
3738pub struct GetUserCredsRequest {
3739 /// Required. A name of the form
3740 /// `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}`
3741 pub name: std::string::String,
3742
3743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3744}
3745
3746impl GetUserCredsRequest {
3747 /// Creates a new default instance.
3748 pub fn new() -> Self {
3749 std::default::Default::default()
3750 }
3751
3752 /// Sets the value of [name][crate::model::GetUserCredsRequest::name].
3753 ///
3754 /// # Example
3755 /// ```ignore,no_run
3756 /// # use google_cloud_firestore_admin_v1::model::GetUserCredsRequest;
3757 /// let x = GetUserCredsRequest::new().set_name("example");
3758 /// ```
3759 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3760 self.name = v.into();
3761 self
3762 }
3763}
3764
3765impl wkt::message::Message for GetUserCredsRequest {
3766 fn typename() -> &'static str {
3767 "type.googleapis.com/google.firestore.admin.v1.GetUserCredsRequest"
3768 }
3769}
3770
3771/// The request for
3772/// [FirestoreAdmin.ListUserCreds][google.firestore.admin.v1.FirestoreAdmin.ListUserCreds].
3773///
3774/// [google.firestore.admin.v1.FirestoreAdmin.ListUserCreds]: crate::client::FirestoreAdmin::list_user_creds
3775#[derive(Clone, Default, PartialEq)]
3776#[non_exhaustive]
3777pub struct ListUserCredsRequest {
3778 /// Required. A parent database name of the form
3779 /// `projects/{project_id}/databases/{database_id}`
3780 pub parent: std::string::String,
3781
3782 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3783}
3784
3785impl ListUserCredsRequest {
3786 /// Creates a new default instance.
3787 pub fn new() -> Self {
3788 std::default::Default::default()
3789 }
3790
3791 /// Sets the value of [parent][crate::model::ListUserCredsRequest::parent].
3792 ///
3793 /// # Example
3794 /// ```ignore,no_run
3795 /// # use google_cloud_firestore_admin_v1::model::ListUserCredsRequest;
3796 /// let x = ListUserCredsRequest::new().set_parent("example");
3797 /// ```
3798 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3799 self.parent = v.into();
3800 self
3801 }
3802}
3803
3804impl wkt::message::Message for ListUserCredsRequest {
3805 fn typename() -> &'static str {
3806 "type.googleapis.com/google.firestore.admin.v1.ListUserCredsRequest"
3807 }
3808}
3809
3810/// The response for
3811/// [FirestoreAdmin.ListUserCreds][google.firestore.admin.v1.FirestoreAdmin.ListUserCreds].
3812///
3813/// [google.firestore.admin.v1.FirestoreAdmin.ListUserCreds]: crate::client::FirestoreAdmin::list_user_creds
3814#[derive(Clone, Default, PartialEq)]
3815#[non_exhaustive]
3816pub struct ListUserCredsResponse {
3817 /// The user creds for the database.
3818 pub user_creds: std::vec::Vec<crate::model::UserCreds>,
3819
3820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3821}
3822
3823impl ListUserCredsResponse {
3824 /// Creates a new default instance.
3825 pub fn new() -> Self {
3826 std::default::Default::default()
3827 }
3828
3829 /// Sets the value of [user_creds][crate::model::ListUserCredsResponse::user_creds].
3830 ///
3831 /// # Example
3832 /// ```ignore,no_run
3833 /// # use google_cloud_firestore_admin_v1::model::ListUserCredsResponse;
3834 /// use google_cloud_firestore_admin_v1::model::UserCreds;
3835 /// let x = ListUserCredsResponse::new()
3836 /// .set_user_creds([
3837 /// UserCreds::default()/* use setters */,
3838 /// UserCreds::default()/* use (different) setters */,
3839 /// ]);
3840 /// ```
3841 pub fn set_user_creds<T, V>(mut self, v: T) -> Self
3842 where
3843 T: std::iter::IntoIterator<Item = V>,
3844 V: std::convert::Into<crate::model::UserCreds>,
3845 {
3846 use std::iter::Iterator;
3847 self.user_creds = v.into_iter().map(|i| i.into()).collect();
3848 self
3849 }
3850}
3851
3852impl wkt::message::Message for ListUserCredsResponse {
3853 fn typename() -> &'static str {
3854 "type.googleapis.com/google.firestore.admin.v1.ListUserCredsResponse"
3855 }
3856}
3857
3858/// The request for
3859/// [FirestoreAdmin.EnableUserCreds][google.firestore.admin.v1.FirestoreAdmin.EnableUserCreds].
3860///
3861/// [google.firestore.admin.v1.FirestoreAdmin.EnableUserCreds]: crate::client::FirestoreAdmin::enable_user_creds
3862#[derive(Clone, Default, PartialEq)]
3863#[non_exhaustive]
3864pub struct EnableUserCredsRequest {
3865 /// Required. A name of the form
3866 /// `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}`
3867 pub name: std::string::String,
3868
3869 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3870}
3871
3872impl EnableUserCredsRequest {
3873 /// Creates a new default instance.
3874 pub fn new() -> Self {
3875 std::default::Default::default()
3876 }
3877
3878 /// Sets the value of [name][crate::model::EnableUserCredsRequest::name].
3879 ///
3880 /// # Example
3881 /// ```ignore,no_run
3882 /// # use google_cloud_firestore_admin_v1::model::EnableUserCredsRequest;
3883 /// let x = EnableUserCredsRequest::new().set_name("example");
3884 /// ```
3885 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3886 self.name = v.into();
3887 self
3888 }
3889}
3890
3891impl wkt::message::Message for EnableUserCredsRequest {
3892 fn typename() -> &'static str {
3893 "type.googleapis.com/google.firestore.admin.v1.EnableUserCredsRequest"
3894 }
3895}
3896
3897/// The request for
3898/// [FirestoreAdmin.DisableUserCreds][google.firestore.admin.v1.FirestoreAdmin.DisableUserCreds].
3899///
3900/// [google.firestore.admin.v1.FirestoreAdmin.DisableUserCreds]: crate::client::FirestoreAdmin::disable_user_creds
3901#[derive(Clone, Default, PartialEq)]
3902#[non_exhaustive]
3903pub struct DisableUserCredsRequest {
3904 /// Required. A name of the form
3905 /// `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}`
3906 pub name: std::string::String,
3907
3908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3909}
3910
3911impl DisableUserCredsRequest {
3912 /// Creates a new default instance.
3913 pub fn new() -> Self {
3914 std::default::Default::default()
3915 }
3916
3917 /// Sets the value of [name][crate::model::DisableUserCredsRequest::name].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_firestore_admin_v1::model::DisableUserCredsRequest;
3922 /// let x = DisableUserCredsRequest::new().set_name("example");
3923 /// ```
3924 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3925 self.name = v.into();
3926 self
3927 }
3928}
3929
3930impl wkt::message::Message for DisableUserCredsRequest {
3931 fn typename() -> &'static str {
3932 "type.googleapis.com/google.firestore.admin.v1.DisableUserCredsRequest"
3933 }
3934}
3935
3936/// The request for
3937/// [FirestoreAdmin.ResetUserPassword][google.firestore.admin.v1.FirestoreAdmin.ResetUserPassword].
3938///
3939/// [google.firestore.admin.v1.FirestoreAdmin.ResetUserPassword]: crate::client::FirestoreAdmin::reset_user_password
3940#[derive(Clone, Default, PartialEq)]
3941#[non_exhaustive]
3942pub struct ResetUserPasswordRequest {
3943 /// Required. A name of the form
3944 /// `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}`
3945 pub name: std::string::String,
3946
3947 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3948}
3949
3950impl ResetUserPasswordRequest {
3951 /// Creates a new default instance.
3952 pub fn new() -> Self {
3953 std::default::Default::default()
3954 }
3955
3956 /// Sets the value of [name][crate::model::ResetUserPasswordRequest::name].
3957 ///
3958 /// # Example
3959 /// ```ignore,no_run
3960 /// # use google_cloud_firestore_admin_v1::model::ResetUserPasswordRequest;
3961 /// let x = ResetUserPasswordRequest::new().set_name("example");
3962 /// ```
3963 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3964 self.name = v.into();
3965 self
3966 }
3967}
3968
3969impl wkt::message::Message for ResetUserPasswordRequest {
3970 fn typename() -> &'static str {
3971 "type.googleapis.com/google.firestore.admin.v1.ResetUserPasswordRequest"
3972 }
3973}
3974
3975/// The request for
3976/// [FirestoreAdmin.DeleteUserCreds][google.firestore.admin.v1.FirestoreAdmin.DeleteUserCreds].
3977///
3978/// [google.firestore.admin.v1.FirestoreAdmin.DeleteUserCreds]: crate::client::FirestoreAdmin::delete_user_creds
3979#[derive(Clone, Default, PartialEq)]
3980#[non_exhaustive]
3981pub struct DeleteUserCredsRequest {
3982 /// Required. A name of the form
3983 /// `projects/{project_id}/databases/{database_id}/userCreds/{user_creds_id}`
3984 pub name: std::string::String,
3985
3986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3987}
3988
3989impl DeleteUserCredsRequest {
3990 /// Creates a new default instance.
3991 pub fn new() -> Self {
3992 std::default::Default::default()
3993 }
3994
3995 /// Sets the value of [name][crate::model::DeleteUserCredsRequest::name].
3996 ///
3997 /// # Example
3998 /// ```ignore,no_run
3999 /// # use google_cloud_firestore_admin_v1::model::DeleteUserCredsRequest;
4000 /// let x = DeleteUserCredsRequest::new().set_name("example");
4001 /// ```
4002 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4003 self.name = v.into();
4004 self
4005 }
4006}
4007
4008impl wkt::message::Message for DeleteUserCredsRequest {
4009 fn typename() -> &'static str {
4010 "type.googleapis.com/google.firestore.admin.v1.DeleteUserCredsRequest"
4011 }
4012}
4013
4014/// The request for
4015/// [FirestoreAdmin.CreateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule].
4016///
4017/// [google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule]: crate::client::FirestoreAdmin::create_backup_schedule
4018#[derive(Clone, Default, PartialEq)]
4019#[non_exhaustive]
4020pub struct CreateBackupScheduleRequest {
4021 /// Required. The parent database.
4022 ///
4023 /// Format `projects/{project}/databases/{database}`
4024 pub parent: std::string::String,
4025
4026 /// Required. The backup schedule to create.
4027 pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
4028
4029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4030}
4031
4032impl CreateBackupScheduleRequest {
4033 /// Creates a new default instance.
4034 pub fn new() -> Self {
4035 std::default::Default::default()
4036 }
4037
4038 /// Sets the value of [parent][crate::model::CreateBackupScheduleRequest::parent].
4039 ///
4040 /// # Example
4041 /// ```ignore,no_run
4042 /// # use google_cloud_firestore_admin_v1::model::CreateBackupScheduleRequest;
4043 /// let x = CreateBackupScheduleRequest::new().set_parent("example");
4044 /// ```
4045 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4046 self.parent = v.into();
4047 self
4048 }
4049
4050 /// Sets the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
4051 ///
4052 /// # Example
4053 /// ```ignore,no_run
4054 /// # use google_cloud_firestore_admin_v1::model::CreateBackupScheduleRequest;
4055 /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
4056 /// let x = CreateBackupScheduleRequest::new().set_backup_schedule(BackupSchedule::default()/* use setters */);
4057 /// ```
4058 pub fn set_backup_schedule<T>(mut self, v: T) -> Self
4059 where
4060 T: std::convert::Into<crate::model::BackupSchedule>,
4061 {
4062 self.backup_schedule = std::option::Option::Some(v.into());
4063 self
4064 }
4065
4066 /// Sets or clears the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
4067 ///
4068 /// # Example
4069 /// ```ignore,no_run
4070 /// # use google_cloud_firestore_admin_v1::model::CreateBackupScheduleRequest;
4071 /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
4072 /// let x = CreateBackupScheduleRequest::new().set_or_clear_backup_schedule(Some(BackupSchedule::default()/* use setters */));
4073 /// let x = CreateBackupScheduleRequest::new().set_or_clear_backup_schedule(None::<BackupSchedule>);
4074 /// ```
4075 pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
4076 where
4077 T: std::convert::Into<crate::model::BackupSchedule>,
4078 {
4079 self.backup_schedule = v.map(|x| x.into());
4080 self
4081 }
4082}
4083
4084impl wkt::message::Message for CreateBackupScheduleRequest {
4085 fn typename() -> &'static str {
4086 "type.googleapis.com/google.firestore.admin.v1.CreateBackupScheduleRequest"
4087 }
4088}
4089
4090/// The request for
4091/// [FirestoreAdmin.GetBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule].
4092///
4093/// [google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule]: crate::client::FirestoreAdmin::get_backup_schedule
4094#[derive(Clone, Default, PartialEq)]
4095#[non_exhaustive]
4096pub struct GetBackupScheduleRequest {
4097 /// Required. The name of the backup schedule.
4098 ///
4099 /// Format
4100 /// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
4101 pub name: std::string::String,
4102
4103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4104}
4105
4106impl GetBackupScheduleRequest {
4107 /// Creates a new default instance.
4108 pub fn new() -> Self {
4109 std::default::Default::default()
4110 }
4111
4112 /// Sets the value of [name][crate::model::GetBackupScheduleRequest::name].
4113 ///
4114 /// # Example
4115 /// ```ignore,no_run
4116 /// # use google_cloud_firestore_admin_v1::model::GetBackupScheduleRequest;
4117 /// let x = GetBackupScheduleRequest::new().set_name("example");
4118 /// ```
4119 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4120 self.name = v.into();
4121 self
4122 }
4123}
4124
4125impl wkt::message::Message for GetBackupScheduleRequest {
4126 fn typename() -> &'static str {
4127 "type.googleapis.com/google.firestore.admin.v1.GetBackupScheduleRequest"
4128 }
4129}
4130
4131/// The request for
4132/// [FirestoreAdmin.UpdateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule].
4133///
4134/// [google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule]: crate::client::FirestoreAdmin::update_backup_schedule
4135#[derive(Clone, Default, PartialEq)]
4136#[non_exhaustive]
4137pub struct UpdateBackupScheduleRequest {
4138 /// Required. The backup schedule to update.
4139 pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
4140
4141 /// The list of fields to be updated.
4142 pub update_mask: std::option::Option<wkt::FieldMask>,
4143
4144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4145}
4146
4147impl UpdateBackupScheduleRequest {
4148 /// Creates a new default instance.
4149 pub fn new() -> Self {
4150 std::default::Default::default()
4151 }
4152
4153 /// Sets the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
4154 ///
4155 /// # Example
4156 /// ```ignore,no_run
4157 /// # use google_cloud_firestore_admin_v1::model::UpdateBackupScheduleRequest;
4158 /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
4159 /// let x = UpdateBackupScheduleRequest::new().set_backup_schedule(BackupSchedule::default()/* use setters */);
4160 /// ```
4161 pub fn set_backup_schedule<T>(mut self, v: T) -> Self
4162 where
4163 T: std::convert::Into<crate::model::BackupSchedule>,
4164 {
4165 self.backup_schedule = std::option::Option::Some(v.into());
4166 self
4167 }
4168
4169 /// Sets or clears the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
4170 ///
4171 /// # Example
4172 /// ```ignore,no_run
4173 /// # use google_cloud_firestore_admin_v1::model::UpdateBackupScheduleRequest;
4174 /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
4175 /// let x = UpdateBackupScheduleRequest::new().set_or_clear_backup_schedule(Some(BackupSchedule::default()/* use setters */));
4176 /// let x = UpdateBackupScheduleRequest::new().set_or_clear_backup_schedule(None::<BackupSchedule>);
4177 /// ```
4178 pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
4179 where
4180 T: std::convert::Into<crate::model::BackupSchedule>,
4181 {
4182 self.backup_schedule = v.map(|x| x.into());
4183 self
4184 }
4185
4186 /// Sets the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
4187 ///
4188 /// # Example
4189 /// ```ignore,no_run
4190 /// # use google_cloud_firestore_admin_v1::model::UpdateBackupScheduleRequest;
4191 /// use wkt::FieldMask;
4192 /// let x = UpdateBackupScheduleRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4193 /// ```
4194 pub fn set_update_mask<T>(mut self, v: T) -> Self
4195 where
4196 T: std::convert::Into<wkt::FieldMask>,
4197 {
4198 self.update_mask = std::option::Option::Some(v.into());
4199 self
4200 }
4201
4202 /// Sets or clears the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
4203 ///
4204 /// # Example
4205 /// ```ignore,no_run
4206 /// # use google_cloud_firestore_admin_v1::model::UpdateBackupScheduleRequest;
4207 /// use wkt::FieldMask;
4208 /// let x = UpdateBackupScheduleRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4209 /// let x = UpdateBackupScheduleRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4210 /// ```
4211 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4212 where
4213 T: std::convert::Into<wkt::FieldMask>,
4214 {
4215 self.update_mask = v.map(|x| x.into());
4216 self
4217 }
4218}
4219
4220impl wkt::message::Message for UpdateBackupScheduleRequest {
4221 fn typename() -> &'static str {
4222 "type.googleapis.com/google.firestore.admin.v1.UpdateBackupScheduleRequest"
4223 }
4224}
4225
4226/// The request for
4227/// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules].
4228///
4229/// [google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules]: crate::client::FirestoreAdmin::list_backup_schedules
4230#[derive(Clone, Default, PartialEq)]
4231#[non_exhaustive]
4232pub struct ListBackupSchedulesRequest {
4233 /// Required. The parent database.
4234 ///
4235 /// Format is `projects/{project}/databases/{database}`.
4236 pub parent: std::string::String,
4237
4238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4239}
4240
4241impl ListBackupSchedulesRequest {
4242 /// Creates a new default instance.
4243 pub fn new() -> Self {
4244 std::default::Default::default()
4245 }
4246
4247 /// Sets the value of [parent][crate::model::ListBackupSchedulesRequest::parent].
4248 ///
4249 /// # Example
4250 /// ```ignore,no_run
4251 /// # use google_cloud_firestore_admin_v1::model::ListBackupSchedulesRequest;
4252 /// let x = ListBackupSchedulesRequest::new().set_parent("example");
4253 /// ```
4254 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4255 self.parent = v.into();
4256 self
4257 }
4258}
4259
4260impl wkt::message::Message for ListBackupSchedulesRequest {
4261 fn typename() -> &'static str {
4262 "type.googleapis.com/google.firestore.admin.v1.ListBackupSchedulesRequest"
4263 }
4264}
4265
4266/// The response for
4267/// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules].
4268///
4269/// [google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules]: crate::client::FirestoreAdmin::list_backup_schedules
4270#[derive(Clone, Default, PartialEq)]
4271#[non_exhaustive]
4272pub struct ListBackupSchedulesResponse {
4273 /// List of all backup schedules.
4274 pub backup_schedules: std::vec::Vec<crate::model::BackupSchedule>,
4275
4276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4277}
4278
4279impl ListBackupSchedulesResponse {
4280 /// Creates a new default instance.
4281 pub fn new() -> Self {
4282 std::default::Default::default()
4283 }
4284
4285 /// Sets the value of [backup_schedules][crate::model::ListBackupSchedulesResponse::backup_schedules].
4286 ///
4287 /// # Example
4288 /// ```ignore,no_run
4289 /// # use google_cloud_firestore_admin_v1::model::ListBackupSchedulesResponse;
4290 /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
4291 /// let x = ListBackupSchedulesResponse::new()
4292 /// .set_backup_schedules([
4293 /// BackupSchedule::default()/* use setters */,
4294 /// BackupSchedule::default()/* use (different) setters */,
4295 /// ]);
4296 /// ```
4297 pub fn set_backup_schedules<T, V>(mut self, v: T) -> Self
4298 where
4299 T: std::iter::IntoIterator<Item = V>,
4300 V: std::convert::Into<crate::model::BackupSchedule>,
4301 {
4302 use std::iter::Iterator;
4303 self.backup_schedules = v.into_iter().map(|i| i.into()).collect();
4304 self
4305 }
4306}
4307
4308impl wkt::message::Message for ListBackupSchedulesResponse {
4309 fn typename() -> &'static str {
4310 "type.googleapis.com/google.firestore.admin.v1.ListBackupSchedulesResponse"
4311 }
4312}
4313
4314/// The request for [FirestoreAdmin.DeleteBackupSchedules][].
4315#[derive(Clone, Default, PartialEq)]
4316#[non_exhaustive]
4317pub struct DeleteBackupScheduleRequest {
4318 /// Required. The name of the backup schedule.
4319 ///
4320 /// Format
4321 /// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
4322 pub name: std::string::String,
4323
4324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4325}
4326
4327impl DeleteBackupScheduleRequest {
4328 /// Creates a new default instance.
4329 pub fn new() -> Self {
4330 std::default::Default::default()
4331 }
4332
4333 /// Sets the value of [name][crate::model::DeleteBackupScheduleRequest::name].
4334 ///
4335 /// # Example
4336 /// ```ignore,no_run
4337 /// # use google_cloud_firestore_admin_v1::model::DeleteBackupScheduleRequest;
4338 /// let x = DeleteBackupScheduleRequest::new().set_name("example");
4339 /// ```
4340 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4341 self.name = v.into();
4342 self
4343 }
4344}
4345
4346impl wkt::message::Message for DeleteBackupScheduleRequest {
4347 fn typename() -> &'static str {
4348 "type.googleapis.com/google.firestore.admin.v1.DeleteBackupScheduleRequest"
4349 }
4350}
4351
4352/// The request for
4353/// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
4354///
4355/// [google.firestore.admin.v1.FirestoreAdmin.CreateIndex]: crate::client::FirestoreAdmin::create_index
4356#[derive(Clone, Default, PartialEq)]
4357#[non_exhaustive]
4358pub struct CreateIndexRequest {
4359 /// Required. A parent name of the form
4360 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
4361 pub parent: std::string::String,
4362
4363 /// Required. The composite index to create.
4364 pub index: std::option::Option<crate::model::Index>,
4365
4366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4367}
4368
4369impl CreateIndexRequest {
4370 /// Creates a new default instance.
4371 pub fn new() -> Self {
4372 std::default::Default::default()
4373 }
4374
4375 /// Sets the value of [parent][crate::model::CreateIndexRequest::parent].
4376 ///
4377 /// # Example
4378 /// ```ignore,no_run
4379 /// # use google_cloud_firestore_admin_v1::model::CreateIndexRequest;
4380 /// let x = CreateIndexRequest::new().set_parent("example");
4381 /// ```
4382 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4383 self.parent = v.into();
4384 self
4385 }
4386
4387 /// Sets the value of [index][crate::model::CreateIndexRequest::index].
4388 ///
4389 /// # Example
4390 /// ```ignore,no_run
4391 /// # use google_cloud_firestore_admin_v1::model::CreateIndexRequest;
4392 /// use google_cloud_firestore_admin_v1::model::Index;
4393 /// let x = CreateIndexRequest::new().set_index(Index::default()/* use setters */);
4394 /// ```
4395 pub fn set_index<T>(mut self, v: T) -> Self
4396 where
4397 T: std::convert::Into<crate::model::Index>,
4398 {
4399 self.index = std::option::Option::Some(v.into());
4400 self
4401 }
4402
4403 /// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
4404 ///
4405 /// # Example
4406 /// ```ignore,no_run
4407 /// # use google_cloud_firestore_admin_v1::model::CreateIndexRequest;
4408 /// use google_cloud_firestore_admin_v1::model::Index;
4409 /// let x = CreateIndexRequest::new().set_or_clear_index(Some(Index::default()/* use setters */));
4410 /// let x = CreateIndexRequest::new().set_or_clear_index(None::<Index>);
4411 /// ```
4412 pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
4413 where
4414 T: std::convert::Into<crate::model::Index>,
4415 {
4416 self.index = v.map(|x| x.into());
4417 self
4418 }
4419}
4420
4421impl wkt::message::Message for CreateIndexRequest {
4422 fn typename() -> &'static str {
4423 "type.googleapis.com/google.firestore.admin.v1.CreateIndexRequest"
4424 }
4425}
4426
4427/// The request for
4428/// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
4429///
4430/// [google.firestore.admin.v1.FirestoreAdmin.ListIndexes]: crate::client::FirestoreAdmin::list_indexes
4431#[derive(Clone, Default, PartialEq)]
4432#[non_exhaustive]
4433pub struct ListIndexesRequest {
4434 /// Required. A parent name of the form
4435 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
4436 pub parent: std::string::String,
4437
4438 /// The filter to apply to list results.
4439 pub filter: std::string::String,
4440
4441 /// The number of results to return.
4442 pub page_size: i32,
4443
4444 /// A page token, returned from a previous call to
4445 /// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes],
4446 /// that may be used to get the next page of results.
4447 ///
4448 /// [google.firestore.admin.v1.FirestoreAdmin.ListIndexes]: crate::client::FirestoreAdmin::list_indexes
4449 pub page_token: std::string::String,
4450
4451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4452}
4453
4454impl ListIndexesRequest {
4455 /// Creates a new default instance.
4456 pub fn new() -> Self {
4457 std::default::Default::default()
4458 }
4459
4460 /// Sets the value of [parent][crate::model::ListIndexesRequest::parent].
4461 ///
4462 /// # Example
4463 /// ```ignore,no_run
4464 /// # use google_cloud_firestore_admin_v1::model::ListIndexesRequest;
4465 /// let x = ListIndexesRequest::new().set_parent("example");
4466 /// ```
4467 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4468 self.parent = v.into();
4469 self
4470 }
4471
4472 /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
4473 ///
4474 /// # Example
4475 /// ```ignore,no_run
4476 /// # use google_cloud_firestore_admin_v1::model::ListIndexesRequest;
4477 /// let x = ListIndexesRequest::new().set_filter("example");
4478 /// ```
4479 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4480 self.filter = v.into();
4481 self
4482 }
4483
4484 /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
4485 ///
4486 /// # Example
4487 /// ```ignore,no_run
4488 /// # use google_cloud_firestore_admin_v1::model::ListIndexesRequest;
4489 /// let x = ListIndexesRequest::new().set_page_size(42);
4490 /// ```
4491 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4492 self.page_size = v.into();
4493 self
4494 }
4495
4496 /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
4497 ///
4498 /// # Example
4499 /// ```ignore,no_run
4500 /// # use google_cloud_firestore_admin_v1::model::ListIndexesRequest;
4501 /// let x = ListIndexesRequest::new().set_page_token("example");
4502 /// ```
4503 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4504 self.page_token = v.into();
4505 self
4506 }
4507}
4508
4509impl wkt::message::Message for ListIndexesRequest {
4510 fn typename() -> &'static str {
4511 "type.googleapis.com/google.firestore.admin.v1.ListIndexesRequest"
4512 }
4513}
4514
4515/// The response for
4516/// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
4517///
4518/// [google.firestore.admin.v1.FirestoreAdmin.ListIndexes]: crate::client::FirestoreAdmin::list_indexes
4519#[derive(Clone, Default, PartialEq)]
4520#[non_exhaustive]
4521pub struct ListIndexesResponse {
4522 /// The requested indexes.
4523 pub indexes: std::vec::Vec<crate::model::Index>,
4524
4525 /// A page token that may be used to request another page of results. If blank,
4526 /// this is the last page.
4527 pub next_page_token: std::string::String,
4528
4529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4530}
4531
4532impl ListIndexesResponse {
4533 /// Creates a new default instance.
4534 pub fn new() -> Self {
4535 std::default::Default::default()
4536 }
4537
4538 /// Sets the value of [indexes][crate::model::ListIndexesResponse::indexes].
4539 ///
4540 /// # Example
4541 /// ```ignore,no_run
4542 /// # use google_cloud_firestore_admin_v1::model::ListIndexesResponse;
4543 /// use google_cloud_firestore_admin_v1::model::Index;
4544 /// let x = ListIndexesResponse::new()
4545 /// .set_indexes([
4546 /// Index::default()/* use setters */,
4547 /// Index::default()/* use (different) setters */,
4548 /// ]);
4549 /// ```
4550 pub fn set_indexes<T, V>(mut self, v: T) -> Self
4551 where
4552 T: std::iter::IntoIterator<Item = V>,
4553 V: std::convert::Into<crate::model::Index>,
4554 {
4555 use std::iter::Iterator;
4556 self.indexes = v.into_iter().map(|i| i.into()).collect();
4557 self
4558 }
4559
4560 /// Sets the value of [next_page_token][crate::model::ListIndexesResponse::next_page_token].
4561 ///
4562 /// # Example
4563 /// ```ignore,no_run
4564 /// # use google_cloud_firestore_admin_v1::model::ListIndexesResponse;
4565 /// let x = ListIndexesResponse::new().set_next_page_token("example");
4566 /// ```
4567 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4568 self.next_page_token = v.into();
4569 self
4570 }
4571}
4572
4573impl wkt::message::Message for ListIndexesResponse {
4574 fn typename() -> &'static str {
4575 "type.googleapis.com/google.firestore.admin.v1.ListIndexesResponse"
4576 }
4577}
4578
4579#[doc(hidden)]
4580impl google_cloud_gax::paginator::internal::PageableResponse for ListIndexesResponse {
4581 type PageItem = crate::model::Index;
4582
4583 fn items(self) -> std::vec::Vec<Self::PageItem> {
4584 self.indexes
4585 }
4586
4587 fn next_page_token(&self) -> std::string::String {
4588 use std::clone::Clone;
4589 self.next_page_token.clone()
4590 }
4591}
4592
4593/// The request for
4594/// [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex].
4595///
4596/// [google.firestore.admin.v1.FirestoreAdmin.GetIndex]: crate::client::FirestoreAdmin::get_index
4597#[derive(Clone, Default, PartialEq)]
4598#[non_exhaustive]
4599pub struct GetIndexRequest {
4600 /// Required. A name of the form
4601 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
4602 pub name: std::string::String,
4603
4604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4605}
4606
4607impl GetIndexRequest {
4608 /// Creates a new default instance.
4609 pub fn new() -> Self {
4610 std::default::Default::default()
4611 }
4612
4613 /// Sets the value of [name][crate::model::GetIndexRequest::name].
4614 ///
4615 /// # Example
4616 /// ```ignore,no_run
4617 /// # use google_cloud_firestore_admin_v1::model::GetIndexRequest;
4618 /// let x = GetIndexRequest::new().set_name("example");
4619 /// ```
4620 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4621 self.name = v.into();
4622 self
4623 }
4624}
4625
4626impl wkt::message::Message for GetIndexRequest {
4627 fn typename() -> &'static str {
4628 "type.googleapis.com/google.firestore.admin.v1.GetIndexRequest"
4629 }
4630}
4631
4632/// The request for
4633/// [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex].
4634///
4635/// [google.firestore.admin.v1.FirestoreAdmin.DeleteIndex]: crate::client::FirestoreAdmin::delete_index
4636#[derive(Clone, Default, PartialEq)]
4637#[non_exhaustive]
4638pub struct DeleteIndexRequest {
4639 /// Required. A name of the form
4640 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
4641 pub name: std::string::String,
4642
4643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4644}
4645
4646impl DeleteIndexRequest {
4647 /// Creates a new default instance.
4648 pub fn new() -> Self {
4649 std::default::Default::default()
4650 }
4651
4652 /// Sets the value of [name][crate::model::DeleteIndexRequest::name].
4653 ///
4654 /// # Example
4655 /// ```ignore,no_run
4656 /// # use google_cloud_firestore_admin_v1::model::DeleteIndexRequest;
4657 /// let x = DeleteIndexRequest::new().set_name("example");
4658 /// ```
4659 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4660 self.name = v.into();
4661 self
4662 }
4663}
4664
4665impl wkt::message::Message for DeleteIndexRequest {
4666 fn typename() -> &'static str {
4667 "type.googleapis.com/google.firestore.admin.v1.DeleteIndexRequest"
4668 }
4669}
4670
4671/// The request for
4672/// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
4673///
4674/// [google.firestore.admin.v1.FirestoreAdmin.UpdateField]: crate::client::FirestoreAdmin::update_field
4675#[derive(Clone, Default, PartialEq)]
4676#[non_exhaustive]
4677pub struct UpdateFieldRequest {
4678 /// Required. The field to be updated.
4679 pub field: std::option::Option<crate::model::Field>,
4680
4681 /// A mask, relative to the field. If specified, only configuration specified
4682 /// by this field_mask will be updated in the field.
4683 pub update_mask: std::option::Option<wkt::FieldMask>,
4684
4685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4686}
4687
4688impl UpdateFieldRequest {
4689 /// Creates a new default instance.
4690 pub fn new() -> Self {
4691 std::default::Default::default()
4692 }
4693
4694 /// Sets the value of [field][crate::model::UpdateFieldRequest::field].
4695 ///
4696 /// # Example
4697 /// ```ignore,no_run
4698 /// # use google_cloud_firestore_admin_v1::model::UpdateFieldRequest;
4699 /// use google_cloud_firestore_admin_v1::model::Field;
4700 /// let x = UpdateFieldRequest::new().set_field(Field::default()/* use setters */);
4701 /// ```
4702 pub fn set_field<T>(mut self, v: T) -> Self
4703 where
4704 T: std::convert::Into<crate::model::Field>,
4705 {
4706 self.field = std::option::Option::Some(v.into());
4707 self
4708 }
4709
4710 /// Sets or clears the value of [field][crate::model::UpdateFieldRequest::field].
4711 ///
4712 /// # Example
4713 /// ```ignore,no_run
4714 /// # use google_cloud_firestore_admin_v1::model::UpdateFieldRequest;
4715 /// use google_cloud_firestore_admin_v1::model::Field;
4716 /// let x = UpdateFieldRequest::new().set_or_clear_field(Some(Field::default()/* use setters */));
4717 /// let x = UpdateFieldRequest::new().set_or_clear_field(None::<Field>);
4718 /// ```
4719 pub fn set_or_clear_field<T>(mut self, v: std::option::Option<T>) -> Self
4720 where
4721 T: std::convert::Into<crate::model::Field>,
4722 {
4723 self.field = v.map(|x| x.into());
4724 self
4725 }
4726
4727 /// Sets the value of [update_mask][crate::model::UpdateFieldRequest::update_mask].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_firestore_admin_v1::model::UpdateFieldRequest;
4732 /// use wkt::FieldMask;
4733 /// let x = UpdateFieldRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4734 /// ```
4735 pub fn set_update_mask<T>(mut self, v: T) -> Self
4736 where
4737 T: std::convert::Into<wkt::FieldMask>,
4738 {
4739 self.update_mask = std::option::Option::Some(v.into());
4740 self
4741 }
4742
4743 /// Sets or clears the value of [update_mask][crate::model::UpdateFieldRequest::update_mask].
4744 ///
4745 /// # Example
4746 /// ```ignore,no_run
4747 /// # use google_cloud_firestore_admin_v1::model::UpdateFieldRequest;
4748 /// use wkt::FieldMask;
4749 /// let x = UpdateFieldRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4750 /// let x = UpdateFieldRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4751 /// ```
4752 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4753 where
4754 T: std::convert::Into<wkt::FieldMask>,
4755 {
4756 self.update_mask = v.map(|x| x.into());
4757 self
4758 }
4759}
4760
4761impl wkt::message::Message for UpdateFieldRequest {
4762 fn typename() -> &'static str {
4763 "type.googleapis.com/google.firestore.admin.v1.UpdateFieldRequest"
4764 }
4765}
4766
4767/// The request for
4768/// [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField].
4769///
4770/// [google.firestore.admin.v1.FirestoreAdmin.GetField]: crate::client::FirestoreAdmin::get_field
4771#[derive(Clone, Default, PartialEq)]
4772#[non_exhaustive]
4773pub struct GetFieldRequest {
4774 /// Required. A name of the form
4775 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
4776 pub name: std::string::String,
4777
4778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4779}
4780
4781impl GetFieldRequest {
4782 /// Creates a new default instance.
4783 pub fn new() -> Self {
4784 std::default::Default::default()
4785 }
4786
4787 /// Sets the value of [name][crate::model::GetFieldRequest::name].
4788 ///
4789 /// # Example
4790 /// ```ignore,no_run
4791 /// # use google_cloud_firestore_admin_v1::model::GetFieldRequest;
4792 /// let x = GetFieldRequest::new().set_name("example");
4793 /// ```
4794 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4795 self.name = v.into();
4796 self
4797 }
4798}
4799
4800impl wkt::message::Message for GetFieldRequest {
4801 fn typename() -> &'static str {
4802 "type.googleapis.com/google.firestore.admin.v1.GetFieldRequest"
4803 }
4804}
4805
4806/// The request for
4807/// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
4808///
4809/// [google.firestore.admin.v1.FirestoreAdmin.ListFields]: crate::client::FirestoreAdmin::list_fields
4810#[derive(Clone, Default, PartialEq)]
4811#[non_exhaustive]
4812pub struct ListFieldsRequest {
4813 /// Required. A parent name of the form
4814 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
4815 pub parent: std::string::String,
4816
4817 /// The filter to apply to list results. Currently,
4818 /// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
4819 /// only supports listing fields that have been explicitly overridden. To issue
4820 /// this query, call
4821 /// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
4822 /// with a filter that includes `indexConfig.usesAncestorConfig:false` or
4823 /// `ttlConfig:*`.
4824 ///
4825 /// [google.firestore.admin.v1.FirestoreAdmin.ListFields]: crate::client::FirestoreAdmin::list_fields
4826 pub filter: std::string::String,
4827
4828 /// The number of results to return.
4829 pub page_size: i32,
4830
4831 /// A page token, returned from a previous call to
4832 /// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields],
4833 /// that may be used to get the next page of results.
4834 ///
4835 /// [google.firestore.admin.v1.FirestoreAdmin.ListFields]: crate::client::FirestoreAdmin::list_fields
4836 pub page_token: std::string::String,
4837
4838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4839}
4840
4841impl ListFieldsRequest {
4842 /// Creates a new default instance.
4843 pub fn new() -> Self {
4844 std::default::Default::default()
4845 }
4846
4847 /// Sets the value of [parent][crate::model::ListFieldsRequest::parent].
4848 ///
4849 /// # Example
4850 /// ```ignore,no_run
4851 /// # use google_cloud_firestore_admin_v1::model::ListFieldsRequest;
4852 /// let x = ListFieldsRequest::new().set_parent("example");
4853 /// ```
4854 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4855 self.parent = v.into();
4856 self
4857 }
4858
4859 /// Sets the value of [filter][crate::model::ListFieldsRequest::filter].
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_firestore_admin_v1::model::ListFieldsRequest;
4864 /// let x = ListFieldsRequest::new().set_filter("example");
4865 /// ```
4866 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4867 self.filter = v.into();
4868 self
4869 }
4870
4871 /// Sets the value of [page_size][crate::model::ListFieldsRequest::page_size].
4872 ///
4873 /// # Example
4874 /// ```ignore,no_run
4875 /// # use google_cloud_firestore_admin_v1::model::ListFieldsRequest;
4876 /// let x = ListFieldsRequest::new().set_page_size(42);
4877 /// ```
4878 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4879 self.page_size = v.into();
4880 self
4881 }
4882
4883 /// Sets the value of [page_token][crate::model::ListFieldsRequest::page_token].
4884 ///
4885 /// # Example
4886 /// ```ignore,no_run
4887 /// # use google_cloud_firestore_admin_v1::model::ListFieldsRequest;
4888 /// let x = ListFieldsRequest::new().set_page_token("example");
4889 /// ```
4890 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4891 self.page_token = v.into();
4892 self
4893 }
4894}
4895
4896impl wkt::message::Message for ListFieldsRequest {
4897 fn typename() -> &'static str {
4898 "type.googleapis.com/google.firestore.admin.v1.ListFieldsRequest"
4899 }
4900}
4901
4902/// The response for
4903/// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
4904///
4905/// [google.firestore.admin.v1.FirestoreAdmin.ListFields]: crate::client::FirestoreAdmin::list_fields
4906#[derive(Clone, Default, PartialEq)]
4907#[non_exhaustive]
4908pub struct ListFieldsResponse {
4909 /// The requested fields.
4910 pub fields: std::vec::Vec<crate::model::Field>,
4911
4912 /// A page token that may be used to request another page of results. If blank,
4913 /// this is the last page.
4914 pub next_page_token: std::string::String,
4915
4916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4917}
4918
4919impl ListFieldsResponse {
4920 /// Creates a new default instance.
4921 pub fn new() -> Self {
4922 std::default::Default::default()
4923 }
4924
4925 /// Sets the value of [fields][crate::model::ListFieldsResponse::fields].
4926 ///
4927 /// # Example
4928 /// ```ignore,no_run
4929 /// # use google_cloud_firestore_admin_v1::model::ListFieldsResponse;
4930 /// use google_cloud_firestore_admin_v1::model::Field;
4931 /// let x = ListFieldsResponse::new()
4932 /// .set_fields([
4933 /// Field::default()/* use setters */,
4934 /// Field::default()/* use (different) setters */,
4935 /// ]);
4936 /// ```
4937 pub fn set_fields<T, V>(mut self, v: T) -> Self
4938 where
4939 T: std::iter::IntoIterator<Item = V>,
4940 V: std::convert::Into<crate::model::Field>,
4941 {
4942 use std::iter::Iterator;
4943 self.fields = v.into_iter().map(|i| i.into()).collect();
4944 self
4945 }
4946
4947 /// Sets the value of [next_page_token][crate::model::ListFieldsResponse::next_page_token].
4948 ///
4949 /// # Example
4950 /// ```ignore,no_run
4951 /// # use google_cloud_firestore_admin_v1::model::ListFieldsResponse;
4952 /// let x = ListFieldsResponse::new().set_next_page_token("example");
4953 /// ```
4954 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4955 self.next_page_token = v.into();
4956 self
4957 }
4958}
4959
4960impl wkt::message::Message for ListFieldsResponse {
4961 fn typename() -> &'static str {
4962 "type.googleapis.com/google.firestore.admin.v1.ListFieldsResponse"
4963 }
4964}
4965
4966#[doc(hidden)]
4967impl google_cloud_gax::paginator::internal::PageableResponse for ListFieldsResponse {
4968 type PageItem = crate::model::Field;
4969
4970 fn items(self) -> std::vec::Vec<Self::PageItem> {
4971 self.fields
4972 }
4973
4974 fn next_page_token(&self) -> std::string::String {
4975 use std::clone::Clone;
4976 self.next_page_token.clone()
4977 }
4978}
4979
4980/// The request for
4981/// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
4982///
4983/// [google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]: crate::client::FirestoreAdmin::export_documents
4984#[derive(Clone, Default, PartialEq)]
4985#[non_exhaustive]
4986pub struct ExportDocumentsRequest {
4987 /// Required. Database to export. Should be of the form:
4988 /// `projects/{project_id}/databases/{database_id}`.
4989 pub name: std::string::String,
4990
4991 /// IDs of the collection groups to export. Unspecified means all
4992 /// collection groups. Each collection group in this list must be unique.
4993 pub collection_ids: std::vec::Vec<std::string::String>,
4994
4995 /// The output URI. Currently only supports Google Cloud Storage URIs of the
4996 /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
4997 /// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
4998 /// Google Cloud Storage namespace path. When
4999 /// choosing a name, be sure to consider Google Cloud Storage naming
5000 /// guidelines: <https://cloud.google.com/storage/docs/naming>.
5001 /// If the URI is a bucket (without a namespace path), a prefix will be
5002 /// generated based on the start time.
5003 pub output_uri_prefix: std::string::String,
5004
5005 /// An empty list represents all namespaces. This is the preferred
5006 /// usage for databases that don't use namespaces.
5007 ///
5008 /// An empty string element represents the default namespace. This should be
5009 /// used if the database has data in non-default namespaces, but doesn't want
5010 /// to include them. Each namespace in this list must be unique.
5011 pub namespace_ids: std::vec::Vec<std::string::String>,
5012
5013 /// The timestamp that corresponds to the version of the database to be
5014 /// exported. The timestamp must be in the past, rounded to the minute and not
5015 /// older than
5016 /// [earliestVersionTime][google.firestore.admin.v1.Database.earliest_version_time].
5017 /// If specified, then the exported documents will represent a consistent view
5018 /// of the database at the provided time. Otherwise, there are no guarantees
5019 /// about the consistency of the exported documents.
5020 ///
5021 /// [google.firestore.admin.v1.Database.earliest_version_time]: crate::model::Database::earliest_version_time
5022 pub snapshot_time: std::option::Option<wkt::Timestamp>,
5023
5024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5025}
5026
5027impl ExportDocumentsRequest {
5028 /// Creates a new default instance.
5029 pub fn new() -> Self {
5030 std::default::Default::default()
5031 }
5032
5033 /// Sets the value of [name][crate::model::ExportDocumentsRequest::name].
5034 ///
5035 /// # Example
5036 /// ```ignore,no_run
5037 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5038 /// let x = ExportDocumentsRequest::new().set_name("example");
5039 /// ```
5040 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5041 self.name = v.into();
5042 self
5043 }
5044
5045 /// Sets the value of [collection_ids][crate::model::ExportDocumentsRequest::collection_ids].
5046 ///
5047 /// # Example
5048 /// ```ignore,no_run
5049 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5050 /// let x = ExportDocumentsRequest::new().set_collection_ids(["a", "b", "c"]);
5051 /// ```
5052 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
5053 where
5054 T: std::iter::IntoIterator<Item = V>,
5055 V: std::convert::Into<std::string::String>,
5056 {
5057 use std::iter::Iterator;
5058 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
5059 self
5060 }
5061
5062 /// Sets the value of [output_uri_prefix][crate::model::ExportDocumentsRequest::output_uri_prefix].
5063 ///
5064 /// # Example
5065 /// ```ignore,no_run
5066 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5067 /// let x = ExportDocumentsRequest::new().set_output_uri_prefix("example");
5068 /// ```
5069 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
5070 mut self,
5071 v: T,
5072 ) -> Self {
5073 self.output_uri_prefix = v.into();
5074 self
5075 }
5076
5077 /// Sets the value of [namespace_ids][crate::model::ExportDocumentsRequest::namespace_ids].
5078 ///
5079 /// # Example
5080 /// ```ignore,no_run
5081 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5082 /// let x = ExportDocumentsRequest::new().set_namespace_ids(["a", "b", "c"]);
5083 /// ```
5084 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
5085 where
5086 T: std::iter::IntoIterator<Item = V>,
5087 V: std::convert::Into<std::string::String>,
5088 {
5089 use std::iter::Iterator;
5090 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
5091 self
5092 }
5093
5094 /// Sets the value of [snapshot_time][crate::model::ExportDocumentsRequest::snapshot_time].
5095 ///
5096 /// # Example
5097 /// ```ignore,no_run
5098 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5099 /// use wkt::Timestamp;
5100 /// let x = ExportDocumentsRequest::new().set_snapshot_time(Timestamp::default()/* use setters */);
5101 /// ```
5102 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
5103 where
5104 T: std::convert::Into<wkt::Timestamp>,
5105 {
5106 self.snapshot_time = std::option::Option::Some(v.into());
5107 self
5108 }
5109
5110 /// Sets or clears the value of [snapshot_time][crate::model::ExportDocumentsRequest::snapshot_time].
5111 ///
5112 /// # Example
5113 /// ```ignore,no_run
5114 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsRequest;
5115 /// use wkt::Timestamp;
5116 /// let x = ExportDocumentsRequest::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
5117 /// let x = ExportDocumentsRequest::new().set_or_clear_snapshot_time(None::<Timestamp>);
5118 /// ```
5119 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
5120 where
5121 T: std::convert::Into<wkt::Timestamp>,
5122 {
5123 self.snapshot_time = v.map(|x| x.into());
5124 self
5125 }
5126}
5127
5128impl wkt::message::Message for ExportDocumentsRequest {
5129 fn typename() -> &'static str {
5130 "type.googleapis.com/google.firestore.admin.v1.ExportDocumentsRequest"
5131 }
5132}
5133
5134/// The request for
5135/// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
5136///
5137/// [google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]: crate::client::FirestoreAdmin::import_documents
5138#[derive(Clone, Default, PartialEq)]
5139#[non_exhaustive]
5140pub struct ImportDocumentsRequest {
5141 /// Required. Database to import into. Should be of the form:
5142 /// `projects/{project_id}/databases/{database_id}`.
5143 pub name: std::string::String,
5144
5145 /// IDs of the collection groups to import. Unspecified means all collection
5146 /// groups that were included in the export. Each collection group in this list
5147 /// must be unique.
5148 pub collection_ids: std::vec::Vec<std::string::String>,
5149
5150 /// Location of the exported files.
5151 /// This must match the output_uri_prefix of an ExportDocumentsResponse from
5152 /// an export that has completed successfully.
5153 /// See:
5154 /// [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix].
5155 ///
5156 /// [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix]: crate::model::ExportDocumentsResponse::output_uri_prefix
5157 pub input_uri_prefix: std::string::String,
5158
5159 /// An empty list represents all namespaces. This is the preferred
5160 /// usage for databases that don't use namespaces.
5161 ///
5162 /// An empty string element represents the default namespace. This should be
5163 /// used if the database has data in non-default namespaces, but doesn't want
5164 /// to include them. Each namespace in this list must be unique.
5165 pub namespace_ids: std::vec::Vec<std::string::String>,
5166
5167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5168}
5169
5170impl ImportDocumentsRequest {
5171 /// Creates a new default instance.
5172 pub fn new() -> Self {
5173 std::default::Default::default()
5174 }
5175
5176 /// Sets the value of [name][crate::model::ImportDocumentsRequest::name].
5177 ///
5178 /// # Example
5179 /// ```ignore,no_run
5180 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsRequest;
5181 /// let x = ImportDocumentsRequest::new().set_name("example");
5182 /// ```
5183 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5184 self.name = v.into();
5185 self
5186 }
5187
5188 /// Sets the value of [collection_ids][crate::model::ImportDocumentsRequest::collection_ids].
5189 ///
5190 /// # Example
5191 /// ```ignore,no_run
5192 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsRequest;
5193 /// let x = ImportDocumentsRequest::new().set_collection_ids(["a", "b", "c"]);
5194 /// ```
5195 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
5196 where
5197 T: std::iter::IntoIterator<Item = V>,
5198 V: std::convert::Into<std::string::String>,
5199 {
5200 use std::iter::Iterator;
5201 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
5202 self
5203 }
5204
5205 /// Sets the value of [input_uri_prefix][crate::model::ImportDocumentsRequest::input_uri_prefix].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsRequest;
5210 /// let x = ImportDocumentsRequest::new().set_input_uri_prefix("example");
5211 /// ```
5212 pub fn set_input_uri_prefix<T: std::convert::Into<std::string::String>>(
5213 mut self,
5214 v: T,
5215 ) -> Self {
5216 self.input_uri_prefix = v.into();
5217 self
5218 }
5219
5220 /// Sets the value of [namespace_ids][crate::model::ImportDocumentsRequest::namespace_ids].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsRequest;
5225 /// let x = ImportDocumentsRequest::new().set_namespace_ids(["a", "b", "c"]);
5226 /// ```
5227 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
5228 where
5229 T: std::iter::IntoIterator<Item = V>,
5230 V: std::convert::Into<std::string::String>,
5231 {
5232 use std::iter::Iterator;
5233 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
5234 self
5235 }
5236}
5237
5238impl wkt::message::Message for ImportDocumentsRequest {
5239 fn typename() -> &'static str {
5240 "type.googleapis.com/google.firestore.admin.v1.ImportDocumentsRequest"
5241 }
5242}
5243
5244/// The request for
5245/// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
5246///
5247/// When both collection_ids and namespace_ids are set, only documents satisfying
5248/// both conditions will be deleted.
5249///
5250/// Requests with namespace_ids and collection_ids both empty will be rejected.
5251/// Please use
5252/// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase]
5253/// instead.
5254///
5255/// [google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]: crate::client::FirestoreAdmin::bulk_delete_documents
5256/// [google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase]: crate::client::FirestoreAdmin::delete_database
5257#[derive(Clone, Default, PartialEq)]
5258#[non_exhaustive]
5259pub struct BulkDeleteDocumentsRequest {
5260 /// Required. Database to operate. Should be of the form:
5261 /// `projects/{project_id}/databases/{database_id}`.
5262 pub name: std::string::String,
5263
5264 /// Optional. IDs of the collection groups to delete. Unspecified means all
5265 /// collection groups.
5266 ///
5267 /// Each collection group in this list must be unique.
5268 pub collection_ids: std::vec::Vec<std::string::String>,
5269
5270 /// Optional. Namespaces to delete.
5271 ///
5272 /// An empty list means all namespaces. This is the recommended
5273 /// usage for databases that don't use namespaces.
5274 ///
5275 /// An empty string element represents the default namespace. This should be
5276 /// used if the database has data in non-default namespaces, but doesn't want
5277 /// to delete from them.
5278 ///
5279 /// Each namespace in this list must be unique.
5280 pub namespace_ids: std::vec::Vec<std::string::String>,
5281
5282 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5283}
5284
5285impl BulkDeleteDocumentsRequest {
5286 /// Creates a new default instance.
5287 pub fn new() -> Self {
5288 std::default::Default::default()
5289 }
5290
5291 /// Sets the value of [name][crate::model::BulkDeleteDocumentsRequest::name].
5292 ///
5293 /// # Example
5294 /// ```ignore,no_run
5295 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsRequest;
5296 /// let x = BulkDeleteDocumentsRequest::new().set_name("example");
5297 /// ```
5298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5299 self.name = v.into();
5300 self
5301 }
5302
5303 /// Sets the value of [collection_ids][crate::model::BulkDeleteDocumentsRequest::collection_ids].
5304 ///
5305 /// # Example
5306 /// ```ignore,no_run
5307 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsRequest;
5308 /// let x = BulkDeleteDocumentsRequest::new().set_collection_ids(["a", "b", "c"]);
5309 /// ```
5310 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
5311 where
5312 T: std::iter::IntoIterator<Item = V>,
5313 V: std::convert::Into<std::string::String>,
5314 {
5315 use std::iter::Iterator;
5316 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
5317 self
5318 }
5319
5320 /// Sets the value of [namespace_ids][crate::model::BulkDeleteDocumentsRequest::namespace_ids].
5321 ///
5322 /// # Example
5323 /// ```ignore,no_run
5324 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsRequest;
5325 /// let x = BulkDeleteDocumentsRequest::new().set_namespace_ids(["a", "b", "c"]);
5326 /// ```
5327 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
5328 where
5329 T: std::iter::IntoIterator<Item = V>,
5330 V: std::convert::Into<std::string::String>,
5331 {
5332 use std::iter::Iterator;
5333 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
5334 self
5335 }
5336}
5337
5338impl wkt::message::Message for BulkDeleteDocumentsRequest {
5339 fn typename() -> &'static str {
5340 "type.googleapis.com/google.firestore.admin.v1.BulkDeleteDocumentsRequest"
5341 }
5342}
5343
5344/// The response for
5345/// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
5346///
5347/// [google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]: crate::client::FirestoreAdmin::bulk_delete_documents
5348#[derive(Clone, Default, PartialEq)]
5349#[non_exhaustive]
5350pub struct BulkDeleteDocumentsResponse {
5351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5352}
5353
5354impl BulkDeleteDocumentsResponse {
5355 /// Creates a new default instance.
5356 pub fn new() -> Self {
5357 std::default::Default::default()
5358 }
5359}
5360
5361impl wkt::message::Message for BulkDeleteDocumentsResponse {
5362 fn typename() -> &'static str {
5363 "type.googleapis.com/google.firestore.admin.v1.BulkDeleteDocumentsResponse"
5364 }
5365}
5366
5367/// The request for
5368/// [FirestoreAdmin.GetBackup][google.firestore.admin.v1.FirestoreAdmin.GetBackup].
5369///
5370/// [google.firestore.admin.v1.FirestoreAdmin.GetBackup]: crate::client::FirestoreAdmin::get_backup
5371#[derive(Clone, Default, PartialEq)]
5372#[non_exhaustive]
5373pub struct GetBackupRequest {
5374 /// Required. Name of the backup to fetch.
5375 ///
5376 /// Format is `projects/{project}/locations/{location}/backups/{backup}`.
5377 pub name: std::string::String,
5378
5379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5380}
5381
5382impl GetBackupRequest {
5383 /// Creates a new default instance.
5384 pub fn new() -> Self {
5385 std::default::Default::default()
5386 }
5387
5388 /// Sets the value of [name][crate::model::GetBackupRequest::name].
5389 ///
5390 /// # Example
5391 /// ```ignore,no_run
5392 /// # use google_cloud_firestore_admin_v1::model::GetBackupRequest;
5393 /// let x = GetBackupRequest::new().set_name("example");
5394 /// ```
5395 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5396 self.name = v.into();
5397 self
5398 }
5399}
5400
5401impl wkt::message::Message for GetBackupRequest {
5402 fn typename() -> &'static str {
5403 "type.googleapis.com/google.firestore.admin.v1.GetBackupRequest"
5404 }
5405}
5406
5407/// The request for
5408/// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups].
5409///
5410/// [google.firestore.admin.v1.FirestoreAdmin.ListBackups]: crate::client::FirestoreAdmin::list_backups
5411#[derive(Clone, Default, PartialEq)]
5412#[non_exhaustive]
5413pub struct ListBackupsRequest {
5414 /// Required. The location to list backups from.
5415 ///
5416 /// Format is `projects/{project}/locations/{location}`.
5417 /// Use `{location} = '-'` to list backups from all locations for the given
5418 /// project. This allows listing backups from a single location or from all
5419 /// locations.
5420 pub parent: std::string::String,
5421
5422 /// An expression that filters the list of returned backups.
5423 ///
5424 /// A filter expression consists of a field name, a comparison operator, and a
5425 /// value for filtering.
5426 /// The value must be a string, a number, or a boolean. The comparison operator
5427 /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
5428 /// Colon `:` is the contains operator. Filter rules are not case sensitive.
5429 ///
5430 /// The following fields in the [Backup][google.firestore.admin.v1.Backup] are
5431 /// eligible for filtering:
5432 ///
5433 /// * `database_uid` (supports `=` only)
5434 ///
5435 /// [google.firestore.admin.v1.Backup]: crate::model::Backup
5436 pub filter: std::string::String,
5437
5438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5439}
5440
5441impl ListBackupsRequest {
5442 /// Creates a new default instance.
5443 pub fn new() -> Self {
5444 std::default::Default::default()
5445 }
5446
5447 /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
5448 ///
5449 /// # Example
5450 /// ```ignore,no_run
5451 /// # use google_cloud_firestore_admin_v1::model::ListBackupsRequest;
5452 /// let x = ListBackupsRequest::new().set_parent("example");
5453 /// ```
5454 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5455 self.parent = v.into();
5456 self
5457 }
5458
5459 /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
5460 ///
5461 /// # Example
5462 /// ```ignore,no_run
5463 /// # use google_cloud_firestore_admin_v1::model::ListBackupsRequest;
5464 /// let x = ListBackupsRequest::new().set_filter("example");
5465 /// ```
5466 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5467 self.filter = v.into();
5468 self
5469 }
5470}
5471
5472impl wkt::message::Message for ListBackupsRequest {
5473 fn typename() -> &'static str {
5474 "type.googleapis.com/google.firestore.admin.v1.ListBackupsRequest"
5475 }
5476}
5477
5478/// The response for
5479/// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups].
5480///
5481/// [google.firestore.admin.v1.FirestoreAdmin.ListBackups]: crate::client::FirestoreAdmin::list_backups
5482#[derive(Clone, Default, PartialEq)]
5483#[non_exhaustive]
5484pub struct ListBackupsResponse {
5485 /// List of all backups for the project.
5486 pub backups: std::vec::Vec<crate::model::Backup>,
5487
5488 /// List of locations that existing backups were not able to be fetched from.
5489 ///
5490 /// Instead of failing the entire requests when a single location is
5491 /// unreachable, this response returns a partial result set and list of
5492 /// locations unable to be reached here. The request can be retried against a
5493 /// single location to get a concrete error.
5494 pub unreachable: std::vec::Vec<std::string::String>,
5495
5496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5497}
5498
5499impl ListBackupsResponse {
5500 /// Creates a new default instance.
5501 pub fn new() -> Self {
5502 std::default::Default::default()
5503 }
5504
5505 /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
5506 ///
5507 /// # Example
5508 /// ```ignore,no_run
5509 /// # use google_cloud_firestore_admin_v1::model::ListBackupsResponse;
5510 /// use google_cloud_firestore_admin_v1::model::Backup;
5511 /// let x = ListBackupsResponse::new()
5512 /// .set_backups([
5513 /// Backup::default()/* use setters */,
5514 /// Backup::default()/* use (different) setters */,
5515 /// ]);
5516 /// ```
5517 pub fn set_backups<T, V>(mut self, v: T) -> Self
5518 where
5519 T: std::iter::IntoIterator<Item = V>,
5520 V: std::convert::Into<crate::model::Backup>,
5521 {
5522 use std::iter::Iterator;
5523 self.backups = v.into_iter().map(|i| i.into()).collect();
5524 self
5525 }
5526
5527 /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
5528 ///
5529 /// # Example
5530 /// ```ignore,no_run
5531 /// # use google_cloud_firestore_admin_v1::model::ListBackupsResponse;
5532 /// let x = ListBackupsResponse::new().set_unreachable(["a", "b", "c"]);
5533 /// ```
5534 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5535 where
5536 T: std::iter::IntoIterator<Item = V>,
5537 V: std::convert::Into<std::string::String>,
5538 {
5539 use std::iter::Iterator;
5540 self.unreachable = v.into_iter().map(|i| i.into()).collect();
5541 self
5542 }
5543}
5544
5545impl wkt::message::Message for ListBackupsResponse {
5546 fn typename() -> &'static str {
5547 "type.googleapis.com/google.firestore.admin.v1.ListBackupsResponse"
5548 }
5549}
5550
5551/// The request for
5552/// [FirestoreAdmin.DeleteBackup][google.firestore.admin.v1.FirestoreAdmin.DeleteBackup].
5553///
5554/// [google.firestore.admin.v1.FirestoreAdmin.DeleteBackup]: crate::client::FirestoreAdmin::delete_backup
5555#[derive(Clone, Default, PartialEq)]
5556#[non_exhaustive]
5557pub struct DeleteBackupRequest {
5558 /// Required. Name of the backup to delete.
5559 ///
5560 /// format is `projects/{project}/locations/{location}/backups/{backup}`.
5561 pub name: std::string::String,
5562
5563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5564}
5565
5566impl DeleteBackupRequest {
5567 /// Creates a new default instance.
5568 pub fn new() -> Self {
5569 std::default::Default::default()
5570 }
5571
5572 /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
5573 ///
5574 /// # Example
5575 /// ```ignore,no_run
5576 /// # use google_cloud_firestore_admin_v1::model::DeleteBackupRequest;
5577 /// let x = DeleteBackupRequest::new().set_name("example");
5578 /// ```
5579 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5580 self.name = v.into();
5581 self
5582 }
5583}
5584
5585impl wkt::message::Message for DeleteBackupRequest {
5586 fn typename() -> &'static str {
5587 "type.googleapis.com/google.firestore.admin.v1.DeleteBackupRequest"
5588 }
5589}
5590
5591/// The request message for
5592/// [FirestoreAdmin.RestoreDatabase][google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase].
5593///
5594/// [google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase]: crate::client::FirestoreAdmin::restore_database
5595#[derive(Clone, Default, PartialEq)]
5596#[non_exhaustive]
5597pub struct RestoreDatabaseRequest {
5598 /// Required. The project to restore the database in. Format is
5599 /// `projects/{project_id}`.
5600 pub parent: std::string::String,
5601
5602 /// Required. The ID to use for the database, which will become the final
5603 /// component of the database's resource name. This database ID must not be
5604 /// associated with an existing database.
5605 ///
5606 /// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
5607 /// with first character a letter and the last a letter or a number. Must not
5608 /// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
5609 ///
5610 /// "(default)" database ID is also valid if the database is Standard edition.
5611 pub database_id: std::string::String,
5612
5613 /// Required. Backup to restore from. Must be from the same project as the
5614 /// parent.
5615 ///
5616 /// The restored database will be created in the same location as the source
5617 /// backup.
5618 ///
5619 /// Format is: `projects/{project_id}/locations/{location}/backups/{backup}`
5620 pub backup: std::string::String,
5621
5622 /// Optional. Encryption configuration for the restored database.
5623 ///
5624 /// If this field is not specified, the restored database will use
5625 /// the same encryption configuration as the backup, namely
5626 /// [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption].
5627 ///
5628 /// [google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption]: crate::model::database::EncryptionConfig::encryption_type
5629 pub encryption_config: std::option::Option<crate::model::database::EncryptionConfig>,
5630
5631 /// Optional. Immutable. Tags to be bound to the restored database.
5632 ///
5633 /// The tags should be provided in the format of
5634 /// `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`.
5635 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
5636
5637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5638}
5639
5640impl RestoreDatabaseRequest {
5641 /// Creates a new default instance.
5642 pub fn new() -> Self {
5643 std::default::Default::default()
5644 }
5645
5646 /// Sets the value of [parent][crate::model::RestoreDatabaseRequest::parent].
5647 ///
5648 /// # Example
5649 /// ```ignore,no_run
5650 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5651 /// let x = RestoreDatabaseRequest::new().set_parent("example");
5652 /// ```
5653 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5654 self.parent = v.into();
5655 self
5656 }
5657
5658 /// Sets the value of [database_id][crate::model::RestoreDatabaseRequest::database_id].
5659 ///
5660 /// # Example
5661 /// ```ignore,no_run
5662 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5663 /// let x = RestoreDatabaseRequest::new().set_database_id("example");
5664 /// ```
5665 pub fn set_database_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5666 self.database_id = v.into();
5667 self
5668 }
5669
5670 /// Sets the value of [backup][crate::model::RestoreDatabaseRequest::backup].
5671 ///
5672 /// # Example
5673 /// ```ignore,no_run
5674 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5675 /// let x = RestoreDatabaseRequest::new().set_backup("example");
5676 /// ```
5677 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5678 self.backup = v.into();
5679 self
5680 }
5681
5682 /// Sets the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
5683 ///
5684 /// # Example
5685 /// ```ignore,no_run
5686 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5687 /// use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
5688 /// let x = RestoreDatabaseRequest::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
5689 /// ```
5690 pub fn set_encryption_config<T>(mut self, v: T) -> Self
5691 where
5692 T: std::convert::Into<crate::model::database::EncryptionConfig>,
5693 {
5694 self.encryption_config = std::option::Option::Some(v.into());
5695 self
5696 }
5697
5698 /// Sets or clears the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
5699 ///
5700 /// # Example
5701 /// ```ignore,no_run
5702 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5703 /// use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
5704 /// let x = RestoreDatabaseRequest::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
5705 /// let x = RestoreDatabaseRequest::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
5706 /// ```
5707 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
5708 where
5709 T: std::convert::Into<crate::model::database::EncryptionConfig>,
5710 {
5711 self.encryption_config = v.map(|x| x.into());
5712 self
5713 }
5714
5715 /// Sets the value of [tags][crate::model::RestoreDatabaseRequest::tags].
5716 ///
5717 /// # Example
5718 /// ```ignore,no_run
5719 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseRequest;
5720 /// let x = RestoreDatabaseRequest::new().set_tags([
5721 /// ("key0", "abc"),
5722 /// ("key1", "xyz"),
5723 /// ]);
5724 /// ```
5725 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
5726 where
5727 T: std::iter::IntoIterator<Item = (K, V)>,
5728 K: std::convert::Into<std::string::String>,
5729 V: std::convert::Into<std::string::String>,
5730 {
5731 use std::iter::Iterator;
5732 self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5733 self
5734 }
5735}
5736
5737impl wkt::message::Message for RestoreDatabaseRequest {
5738 fn typename() -> &'static str {
5739 "type.googleapis.com/google.firestore.admin.v1.RestoreDatabaseRequest"
5740 }
5741}
5742
5743/// The request message for
5744/// [FirestoreAdmin.CloneDatabase][google.firestore.admin.v1.FirestoreAdmin.CloneDatabase].
5745///
5746/// [google.firestore.admin.v1.FirestoreAdmin.CloneDatabase]: crate::client::FirestoreAdmin::clone_database
5747#[derive(Clone, Default, PartialEq)]
5748#[non_exhaustive]
5749pub struct CloneDatabaseRequest {
5750 /// Required. The project to clone the database in. Format is
5751 /// `projects/{project_id}`.
5752 pub parent: std::string::String,
5753
5754 /// Required. The ID to use for the database, which will become the final
5755 /// component of the database's resource name. This database ID must not be
5756 /// associated with an existing database.
5757 ///
5758 /// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
5759 /// with first character a letter and the last a letter or a number. Must not
5760 /// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
5761 ///
5762 /// "(default)" database ID is also valid if the database is Standard edition.
5763 pub database_id: std::string::String,
5764
5765 /// Required. Specification of the PITR data to clone from. The source database
5766 /// must exist.
5767 ///
5768 /// The cloned database will be created in the same location as the source
5769 /// database.
5770 pub pitr_snapshot: std::option::Option<crate::model::PitrSnapshot>,
5771
5772 /// Optional. Encryption configuration for the cloned database.
5773 ///
5774 /// If this field is not specified, the cloned database will use
5775 /// the same encryption configuration as the source database, namely
5776 /// [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption].
5777 ///
5778 /// [google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption]: crate::model::database::EncryptionConfig::encryption_type
5779 pub encryption_config: std::option::Option<crate::model::database::EncryptionConfig>,
5780
5781 /// Optional. Immutable. Tags to be bound to the cloned database.
5782 ///
5783 /// The tags should be provided in the format of
5784 /// `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`.
5785 pub tags: std::collections::HashMap<std::string::String, std::string::String>,
5786
5787 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5788}
5789
5790impl CloneDatabaseRequest {
5791 /// Creates a new default instance.
5792 pub fn new() -> Self {
5793 std::default::Default::default()
5794 }
5795
5796 /// Sets the value of [parent][crate::model::CloneDatabaseRequest::parent].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5801 /// let x = CloneDatabaseRequest::new().set_parent("example");
5802 /// ```
5803 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5804 self.parent = v.into();
5805 self
5806 }
5807
5808 /// Sets the value of [database_id][crate::model::CloneDatabaseRequest::database_id].
5809 ///
5810 /// # Example
5811 /// ```ignore,no_run
5812 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5813 /// let x = CloneDatabaseRequest::new().set_database_id("example");
5814 /// ```
5815 pub fn set_database_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5816 self.database_id = v.into();
5817 self
5818 }
5819
5820 /// Sets the value of [pitr_snapshot][crate::model::CloneDatabaseRequest::pitr_snapshot].
5821 ///
5822 /// # Example
5823 /// ```ignore,no_run
5824 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5825 /// use google_cloud_firestore_admin_v1::model::PitrSnapshot;
5826 /// let x = CloneDatabaseRequest::new().set_pitr_snapshot(PitrSnapshot::default()/* use setters */);
5827 /// ```
5828 pub fn set_pitr_snapshot<T>(mut self, v: T) -> Self
5829 where
5830 T: std::convert::Into<crate::model::PitrSnapshot>,
5831 {
5832 self.pitr_snapshot = std::option::Option::Some(v.into());
5833 self
5834 }
5835
5836 /// Sets or clears the value of [pitr_snapshot][crate::model::CloneDatabaseRequest::pitr_snapshot].
5837 ///
5838 /// # Example
5839 /// ```ignore,no_run
5840 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5841 /// use google_cloud_firestore_admin_v1::model::PitrSnapshot;
5842 /// let x = CloneDatabaseRequest::new().set_or_clear_pitr_snapshot(Some(PitrSnapshot::default()/* use setters */));
5843 /// let x = CloneDatabaseRequest::new().set_or_clear_pitr_snapshot(None::<PitrSnapshot>);
5844 /// ```
5845 pub fn set_or_clear_pitr_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
5846 where
5847 T: std::convert::Into<crate::model::PitrSnapshot>,
5848 {
5849 self.pitr_snapshot = v.map(|x| x.into());
5850 self
5851 }
5852
5853 /// Sets the value of [encryption_config][crate::model::CloneDatabaseRequest::encryption_config].
5854 ///
5855 /// # Example
5856 /// ```ignore,no_run
5857 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5858 /// use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
5859 /// let x = CloneDatabaseRequest::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
5860 /// ```
5861 pub fn set_encryption_config<T>(mut self, v: T) -> Self
5862 where
5863 T: std::convert::Into<crate::model::database::EncryptionConfig>,
5864 {
5865 self.encryption_config = std::option::Option::Some(v.into());
5866 self
5867 }
5868
5869 /// Sets or clears the value of [encryption_config][crate::model::CloneDatabaseRequest::encryption_config].
5870 ///
5871 /// # Example
5872 /// ```ignore,no_run
5873 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5874 /// use google_cloud_firestore_admin_v1::model::database::EncryptionConfig;
5875 /// let x = CloneDatabaseRequest::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
5876 /// let x = CloneDatabaseRequest::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
5877 /// ```
5878 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
5879 where
5880 T: std::convert::Into<crate::model::database::EncryptionConfig>,
5881 {
5882 self.encryption_config = v.map(|x| x.into());
5883 self
5884 }
5885
5886 /// Sets the value of [tags][crate::model::CloneDatabaseRequest::tags].
5887 ///
5888 /// # Example
5889 /// ```ignore,no_run
5890 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseRequest;
5891 /// let x = CloneDatabaseRequest::new().set_tags([
5892 /// ("key0", "abc"),
5893 /// ("key1", "xyz"),
5894 /// ]);
5895 /// ```
5896 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
5897 where
5898 T: std::iter::IntoIterator<Item = (K, V)>,
5899 K: std::convert::Into<std::string::String>,
5900 V: std::convert::Into<std::string::String>,
5901 {
5902 use std::iter::Iterator;
5903 self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5904 self
5905 }
5906}
5907
5908impl wkt::message::Message for CloneDatabaseRequest {
5909 fn typename() -> &'static str {
5910 "type.googleapis.com/google.firestore.admin.v1.CloneDatabaseRequest"
5911 }
5912}
5913
5914/// Cloud Firestore indexes enable simple and complex queries against
5915/// documents in a database.
5916#[derive(Clone, Default, PartialEq)]
5917#[non_exhaustive]
5918pub struct Index {
5919 /// Output only. A server defined name for this index.
5920 /// The form of this name for composite indexes will be:
5921 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`
5922 /// For single field indexes, this field will be empty.
5923 pub name: std::string::String,
5924
5925 /// Indexes with a collection query scope specified allow queries
5926 /// against a collection that is the child of a specific document, specified at
5927 /// query time, and that has the same collection ID.
5928 ///
5929 /// Indexes with a collection group query scope specified allow queries against
5930 /// all collections descended from a specific document, specified at query
5931 /// time, and that have the same collection ID as this index.
5932 pub query_scope: crate::model::index::QueryScope,
5933
5934 /// The API scope supported by this index.
5935 pub api_scope: crate::model::index::ApiScope,
5936
5937 /// The fields supported by this index.
5938 ///
5939 /// For composite indexes, this requires a minimum of 2 and a maximum of 100
5940 /// fields. The last field entry is always for the field path `__name__`. If,
5941 /// on creation, `__name__` was not specified as the last field, it will be
5942 /// added automatically with the same direction as that of the last field
5943 /// defined. If the final field in a composite index is not directional, the
5944 /// `__name__` will be ordered ASCENDING (unless explicitly specified).
5945 ///
5946 /// For single field indexes, this will always be exactly one entry with a
5947 /// field path equal to the field path of the associated field.
5948 pub fields: std::vec::Vec<crate::model::index::IndexField>,
5949
5950 /// Output only. The serving state of the index.
5951 pub state: crate::model::index::State,
5952
5953 /// Immutable. The density configuration of the index.
5954 pub density: crate::model::index::Density,
5955
5956 /// Optional. Whether the index is multikey. By default, the index is not
5957 /// multikey. For non-multikey indexes, none of the paths in the index
5958 /// definition reach or traverse an array, except via an explicit array index.
5959 /// For multikey indexes, at most one of the paths in the index definition
5960 /// reach or traverse an array, except via an explicit array index. Violations
5961 /// will result in errors.
5962 ///
5963 /// Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.
5964 pub multikey: bool,
5965
5966 /// Optional. The number of shards for the index.
5967 pub shard_count: i32,
5968
5969 /// Optional. Whether it is an unique index. Unique index ensures all values
5970 /// for the indexed field(s) are unique across documents.
5971 pub unique: bool,
5972
5973 /// Optional. Options for search indexes that are at the index definition
5974 /// level. This field is only currently supported for indexes with
5975 /// MONGODB_COMPATIBLE_API ApiScope.
5976 pub search_index_options: std::option::Option<crate::model::index::SearchIndexOptions>,
5977
5978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5979}
5980
5981impl Index {
5982 /// Creates a new default instance.
5983 pub fn new() -> Self {
5984 std::default::Default::default()
5985 }
5986
5987 /// Sets the value of [name][crate::model::Index::name].
5988 ///
5989 /// # Example
5990 /// ```ignore,no_run
5991 /// # use google_cloud_firestore_admin_v1::model::Index;
5992 /// let x = Index::new().set_name("example");
5993 /// ```
5994 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5995 self.name = v.into();
5996 self
5997 }
5998
5999 /// Sets the value of [query_scope][crate::model::Index::query_scope].
6000 ///
6001 /// # Example
6002 /// ```ignore,no_run
6003 /// # use google_cloud_firestore_admin_v1::model::Index;
6004 /// use google_cloud_firestore_admin_v1::model::index::QueryScope;
6005 /// let x0 = Index::new().set_query_scope(QueryScope::Collection);
6006 /// let x1 = Index::new().set_query_scope(QueryScope::CollectionGroup);
6007 /// let x2 = Index::new().set_query_scope(QueryScope::CollectionRecursive);
6008 /// ```
6009 pub fn set_query_scope<T: std::convert::Into<crate::model::index::QueryScope>>(
6010 mut self,
6011 v: T,
6012 ) -> Self {
6013 self.query_scope = v.into();
6014 self
6015 }
6016
6017 /// Sets the value of [api_scope][crate::model::Index::api_scope].
6018 ///
6019 /// # Example
6020 /// ```ignore,no_run
6021 /// # use google_cloud_firestore_admin_v1::model::Index;
6022 /// use google_cloud_firestore_admin_v1::model::index::ApiScope;
6023 /// let x0 = Index::new().set_api_scope(ApiScope::DatastoreModeApi);
6024 /// let x1 = Index::new().set_api_scope(ApiScope::MongodbCompatibleApi);
6025 /// ```
6026 pub fn set_api_scope<T: std::convert::Into<crate::model::index::ApiScope>>(
6027 mut self,
6028 v: T,
6029 ) -> Self {
6030 self.api_scope = v.into();
6031 self
6032 }
6033
6034 /// Sets the value of [fields][crate::model::Index::fields].
6035 ///
6036 /// # Example
6037 /// ```ignore,no_run
6038 /// # use google_cloud_firestore_admin_v1::model::Index;
6039 /// use google_cloud_firestore_admin_v1::model::index::IndexField;
6040 /// let x = Index::new()
6041 /// .set_fields([
6042 /// IndexField::default()/* use setters */,
6043 /// IndexField::default()/* use (different) setters */,
6044 /// ]);
6045 /// ```
6046 pub fn set_fields<T, V>(mut self, v: T) -> Self
6047 where
6048 T: std::iter::IntoIterator<Item = V>,
6049 V: std::convert::Into<crate::model::index::IndexField>,
6050 {
6051 use std::iter::Iterator;
6052 self.fields = v.into_iter().map(|i| i.into()).collect();
6053 self
6054 }
6055
6056 /// Sets the value of [state][crate::model::Index::state].
6057 ///
6058 /// # Example
6059 /// ```ignore,no_run
6060 /// # use google_cloud_firestore_admin_v1::model::Index;
6061 /// use google_cloud_firestore_admin_v1::model::index::State;
6062 /// let x0 = Index::new().set_state(State::Creating);
6063 /// let x1 = Index::new().set_state(State::Ready);
6064 /// let x2 = Index::new().set_state(State::NeedsRepair);
6065 /// ```
6066 pub fn set_state<T: std::convert::Into<crate::model::index::State>>(mut self, v: T) -> Self {
6067 self.state = v.into();
6068 self
6069 }
6070
6071 /// Sets the value of [density][crate::model::Index::density].
6072 ///
6073 /// # Example
6074 /// ```ignore,no_run
6075 /// # use google_cloud_firestore_admin_v1::model::Index;
6076 /// use google_cloud_firestore_admin_v1::model::index::Density;
6077 /// let x0 = Index::new().set_density(Density::SparseAll);
6078 /// let x1 = Index::new().set_density(Density::SparseAny);
6079 /// let x2 = Index::new().set_density(Density::Dense);
6080 /// ```
6081 pub fn set_density<T: std::convert::Into<crate::model::index::Density>>(
6082 mut self,
6083 v: T,
6084 ) -> Self {
6085 self.density = v.into();
6086 self
6087 }
6088
6089 /// Sets the value of [multikey][crate::model::Index::multikey].
6090 ///
6091 /// # Example
6092 /// ```ignore,no_run
6093 /// # use google_cloud_firestore_admin_v1::model::Index;
6094 /// let x = Index::new().set_multikey(true);
6095 /// ```
6096 pub fn set_multikey<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6097 self.multikey = v.into();
6098 self
6099 }
6100
6101 /// Sets the value of [shard_count][crate::model::Index::shard_count].
6102 ///
6103 /// # Example
6104 /// ```ignore,no_run
6105 /// # use google_cloud_firestore_admin_v1::model::Index;
6106 /// let x = Index::new().set_shard_count(42);
6107 /// ```
6108 pub fn set_shard_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6109 self.shard_count = v.into();
6110 self
6111 }
6112
6113 /// Sets the value of [unique][crate::model::Index::unique].
6114 ///
6115 /// # Example
6116 /// ```ignore,no_run
6117 /// # use google_cloud_firestore_admin_v1::model::Index;
6118 /// let x = Index::new().set_unique(true);
6119 /// ```
6120 pub fn set_unique<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6121 self.unique = v.into();
6122 self
6123 }
6124
6125 /// Sets the value of [search_index_options][crate::model::Index::search_index_options].
6126 ///
6127 /// # Example
6128 /// ```ignore,no_run
6129 /// # use google_cloud_firestore_admin_v1::model::Index;
6130 /// use google_cloud_firestore_admin_v1::model::index::SearchIndexOptions;
6131 /// let x = Index::new().set_search_index_options(SearchIndexOptions::default()/* use setters */);
6132 /// ```
6133 pub fn set_search_index_options<T>(mut self, v: T) -> Self
6134 where
6135 T: std::convert::Into<crate::model::index::SearchIndexOptions>,
6136 {
6137 self.search_index_options = std::option::Option::Some(v.into());
6138 self
6139 }
6140
6141 /// Sets or clears the value of [search_index_options][crate::model::Index::search_index_options].
6142 ///
6143 /// # Example
6144 /// ```ignore,no_run
6145 /// # use google_cloud_firestore_admin_v1::model::Index;
6146 /// use google_cloud_firestore_admin_v1::model::index::SearchIndexOptions;
6147 /// let x = Index::new().set_or_clear_search_index_options(Some(SearchIndexOptions::default()/* use setters */));
6148 /// let x = Index::new().set_or_clear_search_index_options(None::<SearchIndexOptions>);
6149 /// ```
6150 pub fn set_or_clear_search_index_options<T>(mut self, v: std::option::Option<T>) -> Self
6151 where
6152 T: std::convert::Into<crate::model::index::SearchIndexOptions>,
6153 {
6154 self.search_index_options = v.map(|x| x.into());
6155 self
6156 }
6157}
6158
6159impl wkt::message::Message for Index {
6160 fn typename() -> &'static str {
6161 "type.googleapis.com/google.firestore.admin.v1.Index"
6162 }
6163}
6164
6165/// Defines additional types related to [Index].
6166pub mod index {
6167 #[allow(unused_imports)]
6168 use super::*;
6169
6170 /// A field in an index.
6171 /// The field_path describes which field is indexed, the value_mode describes
6172 /// how the field value is indexed.
6173 #[derive(Clone, Default, PartialEq)]
6174 #[non_exhaustive]
6175 pub struct IndexField {
6176 /// Can be __name__.
6177 /// For single field indexes, this must match the name of the field or may
6178 /// be omitted.
6179 pub field_path: std::string::String,
6180
6181 /// How the field value is indexed.
6182 pub value_mode: std::option::Option<crate::model::index::index_field::ValueMode>,
6183
6184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6185 }
6186
6187 impl IndexField {
6188 /// Creates a new default instance.
6189 pub fn new() -> Self {
6190 std::default::Default::default()
6191 }
6192
6193 /// Sets the value of [field_path][crate::model::index::IndexField::field_path].
6194 ///
6195 /// # Example
6196 /// ```ignore,no_run
6197 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6198 /// let x = IndexField::new().set_field_path("example");
6199 /// ```
6200 pub fn set_field_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6201 self.field_path = v.into();
6202 self
6203 }
6204
6205 /// Sets the value of [value_mode][crate::model::index::IndexField::value_mode].
6206 ///
6207 /// Note that all the setters affecting `value_mode` are mutually
6208 /// exclusive.
6209 ///
6210 /// # Example
6211 /// ```ignore,no_run
6212 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6213 /// use google_cloud_firestore_admin_v1::model::index::index_field::Order;
6214 /// let x0 = IndexField::new().set_value_mode(Some(
6215 /// google_cloud_firestore_admin_v1::model::index::index_field::ValueMode::Order(Order::Ascending)));
6216 /// let x1 = IndexField::new().set_value_mode(Some(
6217 /// google_cloud_firestore_admin_v1::model::index::index_field::ValueMode::Order(Order::Descending)));
6218 /// ```
6219 pub fn set_value_mode<
6220 T: std::convert::Into<std::option::Option<crate::model::index::index_field::ValueMode>>,
6221 >(
6222 mut self,
6223 v: T,
6224 ) -> Self {
6225 self.value_mode = v.into();
6226 self
6227 }
6228
6229 /// The value of [value_mode][crate::model::index::IndexField::value_mode]
6230 /// if it holds a `Order`, `None` if the field is not set or
6231 /// holds a different branch.
6232 pub fn order(&self) -> std::option::Option<&crate::model::index::index_field::Order> {
6233 #[allow(unreachable_patterns)]
6234 self.value_mode.as_ref().and_then(|v| match v {
6235 crate::model::index::index_field::ValueMode::Order(v) => {
6236 std::option::Option::Some(v)
6237 }
6238 _ => std::option::Option::None,
6239 })
6240 }
6241
6242 /// Sets the value of [value_mode][crate::model::index::IndexField::value_mode]
6243 /// to hold a `Order`.
6244 ///
6245 /// Note that all the setters affecting `value_mode` are
6246 /// mutually exclusive.
6247 ///
6248 /// # Example
6249 /// ```ignore,no_run
6250 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6251 /// use google_cloud_firestore_admin_v1::model::index::index_field::Order;
6252 /// let x0 = IndexField::new().set_order(Order::Ascending);
6253 /// let x1 = IndexField::new().set_order(Order::Descending);
6254 /// assert!(x0.order().is_some());
6255 /// assert!(x0.array_config().is_none());
6256 /// assert!(x0.vector_config().is_none());
6257 /// assert!(x0.search_config().is_none());
6258 /// assert!(x1.order().is_some());
6259 /// assert!(x1.array_config().is_none());
6260 /// assert!(x1.vector_config().is_none());
6261 /// assert!(x1.search_config().is_none());
6262 /// ```
6263 pub fn set_order<T: std::convert::Into<crate::model::index::index_field::Order>>(
6264 mut self,
6265 v: T,
6266 ) -> Self {
6267 self.value_mode = std::option::Option::Some(
6268 crate::model::index::index_field::ValueMode::Order(v.into()),
6269 );
6270 self
6271 }
6272
6273 /// The value of [value_mode][crate::model::index::IndexField::value_mode]
6274 /// if it holds a `ArrayConfig`, `None` if the field is not set or
6275 /// holds a different branch.
6276 pub fn array_config(
6277 &self,
6278 ) -> std::option::Option<&crate::model::index::index_field::ArrayConfig> {
6279 #[allow(unreachable_patterns)]
6280 self.value_mode.as_ref().and_then(|v| match v {
6281 crate::model::index::index_field::ValueMode::ArrayConfig(v) => {
6282 std::option::Option::Some(v)
6283 }
6284 _ => std::option::Option::None,
6285 })
6286 }
6287
6288 /// Sets the value of [value_mode][crate::model::index::IndexField::value_mode]
6289 /// to hold a `ArrayConfig`.
6290 ///
6291 /// Note that all the setters affecting `value_mode` are
6292 /// mutually exclusive.
6293 ///
6294 /// # Example
6295 /// ```ignore,no_run
6296 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6297 /// use google_cloud_firestore_admin_v1::model::index::index_field::ArrayConfig;
6298 /// let x0 = IndexField::new().set_array_config(ArrayConfig::Contains);
6299 /// assert!(x0.array_config().is_some());
6300 /// assert!(x0.order().is_none());
6301 /// assert!(x0.vector_config().is_none());
6302 /// assert!(x0.search_config().is_none());
6303 /// ```
6304 pub fn set_array_config<
6305 T: std::convert::Into<crate::model::index::index_field::ArrayConfig>,
6306 >(
6307 mut self,
6308 v: T,
6309 ) -> Self {
6310 self.value_mode = std::option::Option::Some(
6311 crate::model::index::index_field::ValueMode::ArrayConfig(v.into()),
6312 );
6313 self
6314 }
6315
6316 /// The value of [value_mode][crate::model::index::IndexField::value_mode]
6317 /// if it holds a `VectorConfig`, `None` if the field is not set or
6318 /// holds a different branch.
6319 pub fn vector_config(
6320 &self,
6321 ) -> std::option::Option<&std::boxed::Box<crate::model::index::index_field::VectorConfig>>
6322 {
6323 #[allow(unreachable_patterns)]
6324 self.value_mode.as_ref().and_then(|v| match v {
6325 crate::model::index::index_field::ValueMode::VectorConfig(v) => {
6326 std::option::Option::Some(v)
6327 }
6328 _ => std::option::Option::None,
6329 })
6330 }
6331
6332 /// Sets the value of [value_mode][crate::model::index::IndexField::value_mode]
6333 /// to hold a `VectorConfig`.
6334 ///
6335 /// Note that all the setters affecting `value_mode` are
6336 /// mutually exclusive.
6337 ///
6338 /// # Example
6339 /// ```ignore,no_run
6340 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6341 /// use google_cloud_firestore_admin_v1::model::index::index_field::VectorConfig;
6342 /// let x = IndexField::new().set_vector_config(VectorConfig::default()/* use setters */);
6343 /// assert!(x.vector_config().is_some());
6344 /// assert!(x.order().is_none());
6345 /// assert!(x.array_config().is_none());
6346 /// assert!(x.search_config().is_none());
6347 /// ```
6348 pub fn set_vector_config<
6349 T: std::convert::Into<std::boxed::Box<crate::model::index::index_field::VectorConfig>>,
6350 >(
6351 mut self,
6352 v: T,
6353 ) -> Self {
6354 self.value_mode = std::option::Option::Some(
6355 crate::model::index::index_field::ValueMode::VectorConfig(v.into()),
6356 );
6357 self
6358 }
6359
6360 /// The value of [value_mode][crate::model::index::IndexField::value_mode]
6361 /// if it holds a `SearchConfig`, `None` if the field is not set or
6362 /// holds a different branch.
6363 pub fn search_config(
6364 &self,
6365 ) -> std::option::Option<&std::boxed::Box<crate::model::index::index_field::SearchConfig>>
6366 {
6367 #[allow(unreachable_patterns)]
6368 self.value_mode.as_ref().and_then(|v| match v {
6369 crate::model::index::index_field::ValueMode::SearchConfig(v) => {
6370 std::option::Option::Some(v)
6371 }
6372 _ => std::option::Option::None,
6373 })
6374 }
6375
6376 /// Sets the value of [value_mode][crate::model::index::IndexField::value_mode]
6377 /// to hold a `SearchConfig`.
6378 ///
6379 /// Note that all the setters affecting `value_mode` are
6380 /// mutually exclusive.
6381 ///
6382 /// # Example
6383 /// ```ignore,no_run
6384 /// # use google_cloud_firestore_admin_v1::model::index::IndexField;
6385 /// use google_cloud_firestore_admin_v1::model::index::index_field::SearchConfig;
6386 /// let x = IndexField::new().set_search_config(SearchConfig::default()/* use setters */);
6387 /// assert!(x.search_config().is_some());
6388 /// assert!(x.order().is_none());
6389 /// assert!(x.array_config().is_none());
6390 /// assert!(x.vector_config().is_none());
6391 /// ```
6392 pub fn set_search_config<
6393 T: std::convert::Into<std::boxed::Box<crate::model::index::index_field::SearchConfig>>,
6394 >(
6395 mut self,
6396 v: T,
6397 ) -> Self {
6398 self.value_mode = std::option::Option::Some(
6399 crate::model::index::index_field::ValueMode::SearchConfig(v.into()),
6400 );
6401 self
6402 }
6403 }
6404
6405 impl wkt::message::Message for IndexField {
6406 fn typename() -> &'static str {
6407 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField"
6408 }
6409 }
6410
6411 /// Defines additional types related to [IndexField].
6412 pub mod index_field {
6413 #[allow(unused_imports)]
6414 use super::*;
6415
6416 /// The index configuration to support vector search operations
6417 #[derive(Clone, Default, PartialEq)]
6418 #[non_exhaustive]
6419 pub struct VectorConfig {
6420 /// Required. The vector dimension this configuration applies to.
6421 ///
6422 /// The resulting index will only include vectors of this dimension, and
6423 /// can be used for vector search with the same dimension.
6424 pub dimension: i32,
6425
6426 /// The type of index used.
6427 pub r#type: std::option::Option<crate::model::index::index_field::vector_config::Type>,
6428
6429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6430 }
6431
6432 impl VectorConfig {
6433 /// Creates a new default instance.
6434 pub fn new() -> Self {
6435 std::default::Default::default()
6436 }
6437
6438 /// Sets the value of [dimension][crate::model::index::index_field::VectorConfig::dimension].
6439 ///
6440 /// # Example
6441 /// ```ignore,no_run
6442 /// # use google_cloud_firestore_admin_v1::model::index::index_field::VectorConfig;
6443 /// let x = VectorConfig::new().set_dimension(42);
6444 /// ```
6445 pub fn set_dimension<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6446 self.dimension = v.into();
6447 self
6448 }
6449
6450 /// Sets the value of [r#type][crate::model::index::index_field::VectorConfig::type].
6451 ///
6452 /// Note that all the setters affecting `r#type` are mutually
6453 /// exclusive.
6454 ///
6455 /// # Example
6456 /// ```ignore,no_run
6457 /// # use google_cloud_firestore_admin_v1::model::index::index_field::VectorConfig;
6458 /// use google_cloud_firestore_admin_v1::model::index::index_field::vector_config::FlatIndex;
6459 /// let x = VectorConfig::new().set_type(Some(
6460 /// google_cloud_firestore_admin_v1::model::index::index_field::vector_config::Type::Flat(FlatIndex::default().into())));
6461 /// ```
6462 pub fn set_type<
6463 T: std::convert::Into<
6464 std::option::Option<crate::model::index::index_field::vector_config::Type>,
6465 >,
6466 >(
6467 mut self,
6468 v: T,
6469 ) -> Self {
6470 self.r#type = v.into();
6471 self
6472 }
6473
6474 /// The value of [r#type][crate::model::index::index_field::VectorConfig::r#type]
6475 /// if it holds a `Flat`, `None` if the field is not set or
6476 /// holds a different branch.
6477 pub fn flat(
6478 &self,
6479 ) -> std::option::Option<
6480 &std::boxed::Box<crate::model::index::index_field::vector_config::FlatIndex>,
6481 > {
6482 #[allow(unreachable_patterns)]
6483 self.r#type.as_ref().and_then(|v| match v {
6484 crate::model::index::index_field::vector_config::Type::Flat(v) => {
6485 std::option::Option::Some(v)
6486 }
6487 _ => std::option::Option::None,
6488 })
6489 }
6490
6491 /// Sets the value of [r#type][crate::model::index::index_field::VectorConfig::r#type]
6492 /// to hold a `Flat`.
6493 ///
6494 /// Note that all the setters affecting `r#type` are
6495 /// mutually exclusive.
6496 ///
6497 /// # Example
6498 /// ```ignore,no_run
6499 /// # use google_cloud_firestore_admin_v1::model::index::index_field::VectorConfig;
6500 /// use google_cloud_firestore_admin_v1::model::index::index_field::vector_config::FlatIndex;
6501 /// let x = VectorConfig::new().set_flat(FlatIndex::default()/* use setters */);
6502 /// assert!(x.flat().is_some());
6503 /// ```
6504 pub fn set_flat<
6505 T: std::convert::Into<
6506 std::boxed::Box<crate::model::index::index_field::vector_config::FlatIndex>,
6507 >,
6508 >(
6509 mut self,
6510 v: T,
6511 ) -> Self {
6512 self.r#type = std::option::Option::Some(
6513 crate::model::index::index_field::vector_config::Type::Flat(v.into()),
6514 );
6515 self
6516 }
6517 }
6518
6519 impl wkt::message::Message for VectorConfig {
6520 fn typename() -> &'static str {
6521 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.VectorConfig"
6522 }
6523 }
6524
6525 /// Defines additional types related to [VectorConfig].
6526 pub mod vector_config {
6527 #[allow(unused_imports)]
6528 use super::*;
6529
6530 /// An index that stores vectors in a flat data structure, and supports
6531 /// exhaustive search.
6532 #[derive(Clone, Default, PartialEq)]
6533 #[non_exhaustive]
6534 pub struct FlatIndex {
6535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6536 }
6537
6538 impl FlatIndex {
6539 /// Creates a new default instance.
6540 pub fn new() -> Self {
6541 std::default::Default::default()
6542 }
6543 }
6544
6545 impl wkt::message::Message for FlatIndex {
6546 fn typename() -> &'static str {
6547 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.VectorConfig.FlatIndex"
6548 }
6549 }
6550
6551 /// The type of index used.
6552 #[derive(Clone, Debug, PartialEq)]
6553 #[non_exhaustive]
6554 pub enum Type {
6555 /// Indicates the vector index is a flat index.
6556 Flat(std::boxed::Box<crate::model::index::index_field::vector_config::FlatIndex>),
6557 }
6558 }
6559
6560 /// The configuration for how to index a field for search.
6561 #[derive(Clone, Default, PartialEq)]
6562 #[non_exhaustive]
6563 pub struct SearchConfig {
6564 /// Optional. The specification for building a text search index for a
6565 /// field.
6566 pub text_spec: std::option::Option<
6567 crate::model::index::index_field::search_config::SearchTextSpec,
6568 >,
6569
6570 /// Optional. The specification for building a geo search index for a
6571 /// field.
6572 pub geo_spec:
6573 std::option::Option<crate::model::index::index_field::search_config::SearchGeoSpec>,
6574
6575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6576 }
6577
6578 impl SearchConfig {
6579 /// Creates a new default instance.
6580 pub fn new() -> Self {
6581 std::default::Default::default()
6582 }
6583
6584 /// Sets the value of [text_spec][crate::model::index::index_field::SearchConfig::text_spec].
6585 ///
6586 /// # Example
6587 /// ```ignore,no_run
6588 /// # use google_cloud_firestore_admin_v1::model::index::index_field::SearchConfig;
6589 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextSpec;
6590 /// let x = SearchConfig::new().set_text_spec(SearchTextSpec::default()/* use setters */);
6591 /// ```
6592 pub fn set_text_spec<T>(mut self, v: T) -> Self
6593 where
6594 T: std::convert::Into<
6595 crate::model::index::index_field::search_config::SearchTextSpec,
6596 >,
6597 {
6598 self.text_spec = std::option::Option::Some(v.into());
6599 self
6600 }
6601
6602 /// Sets or clears the value of [text_spec][crate::model::index::index_field::SearchConfig::text_spec].
6603 ///
6604 /// # Example
6605 /// ```ignore,no_run
6606 /// # use google_cloud_firestore_admin_v1::model::index::index_field::SearchConfig;
6607 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextSpec;
6608 /// let x = SearchConfig::new().set_or_clear_text_spec(Some(SearchTextSpec::default()/* use setters */));
6609 /// let x = SearchConfig::new().set_or_clear_text_spec(None::<SearchTextSpec>);
6610 /// ```
6611 pub fn set_or_clear_text_spec<T>(mut self, v: std::option::Option<T>) -> Self
6612 where
6613 T: std::convert::Into<
6614 crate::model::index::index_field::search_config::SearchTextSpec,
6615 >,
6616 {
6617 self.text_spec = v.map(|x| x.into());
6618 self
6619 }
6620
6621 /// Sets the value of [geo_spec][crate::model::index::index_field::SearchConfig::geo_spec].
6622 ///
6623 /// # Example
6624 /// ```ignore,no_run
6625 /// # use google_cloud_firestore_admin_v1::model::index::index_field::SearchConfig;
6626 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchGeoSpec;
6627 /// let x = SearchConfig::new().set_geo_spec(SearchGeoSpec::default()/* use setters */);
6628 /// ```
6629 pub fn set_geo_spec<T>(mut self, v: T) -> Self
6630 where
6631 T: std::convert::Into<
6632 crate::model::index::index_field::search_config::SearchGeoSpec,
6633 >,
6634 {
6635 self.geo_spec = std::option::Option::Some(v.into());
6636 self
6637 }
6638
6639 /// Sets or clears the value of [geo_spec][crate::model::index::index_field::SearchConfig::geo_spec].
6640 ///
6641 /// # Example
6642 /// ```ignore,no_run
6643 /// # use google_cloud_firestore_admin_v1::model::index::index_field::SearchConfig;
6644 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchGeoSpec;
6645 /// let x = SearchConfig::new().set_or_clear_geo_spec(Some(SearchGeoSpec::default()/* use setters */));
6646 /// let x = SearchConfig::new().set_or_clear_geo_spec(None::<SearchGeoSpec>);
6647 /// ```
6648 pub fn set_or_clear_geo_spec<T>(mut self, v: std::option::Option<T>) -> Self
6649 where
6650 T: std::convert::Into<
6651 crate::model::index::index_field::search_config::SearchGeoSpec,
6652 >,
6653 {
6654 self.geo_spec = v.map(|x| x.into());
6655 self
6656 }
6657 }
6658
6659 impl wkt::message::Message for SearchConfig {
6660 fn typename() -> &'static str {
6661 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.SearchConfig"
6662 }
6663 }
6664
6665 /// Defines additional types related to [SearchConfig].
6666 pub mod search_config {
6667 #[allow(unused_imports)]
6668 use super::*;
6669
6670 /// Specification of how the field should be indexed for search text
6671 /// indexes.
6672 #[derive(Clone, Default, PartialEq)]
6673 #[non_exhaustive]
6674 pub struct SearchTextIndexSpec {
6675 /// Required. How to index the text field value.
6676 pub index_type: crate::model::index::index_field::search_config::TextIndexType,
6677
6678 /// Required. How to match the text field value.
6679 pub match_type: crate::model::index::index_field::search_config::TextMatchType,
6680
6681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6682 }
6683
6684 impl SearchTextIndexSpec {
6685 /// Creates a new default instance.
6686 pub fn new() -> Self {
6687 std::default::Default::default()
6688 }
6689
6690 /// Sets the value of [index_type][crate::model::index::index_field::search_config::SearchTextIndexSpec::index_type].
6691 ///
6692 /// # Example
6693 /// ```ignore,no_run
6694 /// # use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextIndexSpec;
6695 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::TextIndexType;
6696 /// let x0 = SearchTextIndexSpec::new().set_index_type(TextIndexType::Tokenized);
6697 /// ```
6698 pub fn set_index_type<
6699 T: std::convert::Into<
6700 crate::model::index::index_field::search_config::TextIndexType,
6701 >,
6702 >(
6703 mut self,
6704 v: T,
6705 ) -> Self {
6706 self.index_type = v.into();
6707 self
6708 }
6709
6710 /// Sets the value of [match_type][crate::model::index::index_field::search_config::SearchTextIndexSpec::match_type].
6711 ///
6712 /// # Example
6713 /// ```ignore,no_run
6714 /// # use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextIndexSpec;
6715 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::TextMatchType;
6716 /// let x0 = SearchTextIndexSpec::new().set_match_type(TextMatchType::MatchGlobally);
6717 /// ```
6718 pub fn set_match_type<
6719 T: std::convert::Into<
6720 crate::model::index::index_field::search_config::TextMatchType,
6721 >,
6722 >(
6723 mut self,
6724 v: T,
6725 ) -> Self {
6726 self.match_type = v.into();
6727 self
6728 }
6729 }
6730
6731 impl wkt::message::Message for SearchTextIndexSpec {
6732 fn typename() -> &'static str {
6733 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextIndexSpec"
6734 }
6735 }
6736
6737 /// The specification for how to build a text search index for a field.
6738 #[derive(Clone, Default, PartialEq)]
6739 #[non_exhaustive]
6740 pub struct SearchTextSpec {
6741 /// Required. Specifications for how the field should be indexed.
6742 /// Repeated so that the field can be indexed in multiple ways.
6743 pub index_specs: std::vec::Vec<
6744 crate::model::index::index_field::search_config::SearchTextIndexSpec,
6745 >,
6746
6747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6748 }
6749
6750 impl SearchTextSpec {
6751 /// Creates a new default instance.
6752 pub fn new() -> Self {
6753 std::default::Default::default()
6754 }
6755
6756 /// Sets the value of [index_specs][crate::model::index::index_field::search_config::SearchTextSpec::index_specs].
6757 ///
6758 /// # Example
6759 /// ```ignore,no_run
6760 /// # use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextSpec;
6761 /// use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchTextIndexSpec;
6762 /// let x = SearchTextSpec::new()
6763 /// .set_index_specs([
6764 /// SearchTextIndexSpec::default()/* use setters */,
6765 /// SearchTextIndexSpec::default()/* use (different) setters */,
6766 /// ]);
6767 /// ```
6768 pub fn set_index_specs<T, V>(mut self, v: T) -> Self
6769 where
6770 T: std::iter::IntoIterator<Item = V>,
6771 V: std::convert::Into<
6772 crate::model::index::index_field::search_config::SearchTextIndexSpec,
6773 >,
6774 {
6775 use std::iter::Iterator;
6776 self.index_specs = v.into_iter().map(|i| i.into()).collect();
6777 self
6778 }
6779 }
6780
6781 impl wkt::message::Message for SearchTextSpec {
6782 fn typename() -> &'static str {
6783 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchTextSpec"
6784 }
6785 }
6786
6787 /// The specification for how to build a geo search index for a field.
6788 #[derive(Clone, Default, PartialEq)]
6789 #[non_exhaustive]
6790 pub struct SearchGeoSpec {
6791 /// Optional. Disables geoJSON indexing for the field. By default,
6792 /// geoJSON points are indexed.
6793 pub geo_json_indexing_disabled: bool,
6794
6795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6796 }
6797
6798 impl SearchGeoSpec {
6799 /// Creates a new default instance.
6800 pub fn new() -> Self {
6801 std::default::Default::default()
6802 }
6803
6804 /// Sets the value of [geo_json_indexing_disabled][crate::model::index::index_field::search_config::SearchGeoSpec::geo_json_indexing_disabled].
6805 ///
6806 /// # Example
6807 /// ```ignore,no_run
6808 /// # use google_cloud_firestore_admin_v1::model::index::index_field::search_config::SearchGeoSpec;
6809 /// let x = SearchGeoSpec::new().set_geo_json_indexing_disabled(true);
6810 /// ```
6811 pub fn set_geo_json_indexing_disabled<T: std::convert::Into<bool>>(
6812 mut self,
6813 v: T,
6814 ) -> Self {
6815 self.geo_json_indexing_disabled = v.into();
6816 self
6817 }
6818 }
6819
6820 impl wkt::message::Message for SearchGeoSpec {
6821 fn typename() -> &'static str {
6822 "type.googleapis.com/google.firestore.admin.v1.Index.IndexField.SearchConfig.SearchGeoSpec"
6823 }
6824 }
6825
6826 /// Ways to index the text field value.
6827 ///
6828 /// # Working with unknown values
6829 ///
6830 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6831 /// additional enum variants at any time. Adding new variants is not considered
6832 /// a breaking change. Applications should write their code in anticipation of:
6833 ///
6834 /// - New values appearing in future releases of the client library, **and**
6835 /// - New values received dynamically, without application changes.
6836 ///
6837 /// Please consult the [Working with enums] section in the user guide for some
6838 /// guidelines.
6839 ///
6840 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6841 #[derive(Clone, Debug, PartialEq)]
6842 #[non_exhaustive]
6843 pub enum TextIndexType {
6844 /// The index type is unspecified. Not a valid option.
6845 Unspecified,
6846 /// Field values are tokenized. This is the only way currently supported
6847 /// for MONGODB_COMPATIBLE_API.
6848 Tokenized,
6849 /// If set, the enum was initialized with an unknown value.
6850 ///
6851 /// Applications can examine the value using [TextIndexType::value] or
6852 /// [TextIndexType::name].
6853 UnknownValue(text_index_type::UnknownValue),
6854 }
6855
6856 #[doc(hidden)]
6857 pub mod text_index_type {
6858 #[allow(unused_imports)]
6859 use super::*;
6860 #[derive(Clone, Debug, PartialEq)]
6861 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6862 }
6863
6864 impl TextIndexType {
6865 /// Gets the enum value.
6866 ///
6867 /// Returns `None` if the enum contains an unknown value deserialized from
6868 /// the string representation of enums.
6869 pub fn value(&self) -> std::option::Option<i32> {
6870 match self {
6871 Self::Unspecified => std::option::Option::Some(0),
6872 Self::Tokenized => std::option::Option::Some(1),
6873 Self::UnknownValue(u) => u.0.value(),
6874 }
6875 }
6876
6877 /// Gets the enum value as a string.
6878 ///
6879 /// Returns `None` if the enum contains an unknown value deserialized from
6880 /// the integer representation of enums.
6881 pub fn name(&self) -> std::option::Option<&str> {
6882 match self {
6883 Self::Unspecified => {
6884 std::option::Option::Some("TEXT_INDEX_TYPE_UNSPECIFIED")
6885 }
6886 Self::Tokenized => std::option::Option::Some("TOKENIZED"),
6887 Self::UnknownValue(u) => u.0.name(),
6888 }
6889 }
6890 }
6891
6892 impl std::default::Default for TextIndexType {
6893 fn default() -> Self {
6894 use std::convert::From;
6895 Self::from(0)
6896 }
6897 }
6898
6899 impl std::fmt::Display for TextIndexType {
6900 fn fmt(
6901 &self,
6902 f: &mut std::fmt::Formatter<'_>,
6903 ) -> std::result::Result<(), std::fmt::Error> {
6904 wkt::internal::display_enum(f, self.name(), self.value())
6905 }
6906 }
6907
6908 impl std::convert::From<i32> for TextIndexType {
6909 fn from(value: i32) -> Self {
6910 match value {
6911 0 => Self::Unspecified,
6912 1 => Self::Tokenized,
6913 _ => Self::UnknownValue(text_index_type::UnknownValue(
6914 wkt::internal::UnknownEnumValue::Integer(value),
6915 )),
6916 }
6917 }
6918 }
6919
6920 impl std::convert::From<&str> for TextIndexType {
6921 fn from(value: &str) -> Self {
6922 use std::string::ToString;
6923 match value {
6924 "TEXT_INDEX_TYPE_UNSPECIFIED" => Self::Unspecified,
6925 "TOKENIZED" => Self::Tokenized,
6926 _ => Self::UnknownValue(text_index_type::UnknownValue(
6927 wkt::internal::UnknownEnumValue::String(value.to_string()),
6928 )),
6929 }
6930 }
6931 }
6932
6933 impl serde::ser::Serialize for TextIndexType {
6934 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6935 where
6936 S: serde::Serializer,
6937 {
6938 match self {
6939 Self::Unspecified => serializer.serialize_i32(0),
6940 Self::Tokenized => serializer.serialize_i32(1),
6941 Self::UnknownValue(u) => u.0.serialize(serializer),
6942 }
6943 }
6944 }
6945
6946 impl<'de> serde::de::Deserialize<'de> for TextIndexType {
6947 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6948 where
6949 D: serde::Deserializer<'de>,
6950 {
6951 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TextIndexType>::new(
6952 ".google.firestore.admin.v1.Index.IndexField.SearchConfig.TextIndexType",
6953 ))
6954 }
6955 }
6956
6957 /// Types of text matches that are supported for the
6958 /// field.
6959 ///
6960 /// # Working with unknown values
6961 ///
6962 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6963 /// additional enum variants at any time. Adding new variants is not considered
6964 /// a breaking change. Applications should write their code in anticipation of:
6965 ///
6966 /// - New values appearing in future releases of the client library, **and**
6967 /// - New values received dynamically, without application changes.
6968 ///
6969 /// Please consult the [Working with enums] section in the user guide for some
6970 /// guidelines.
6971 ///
6972 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6973 #[derive(Clone, Debug, PartialEq)]
6974 #[non_exhaustive]
6975 pub enum TextMatchType {
6976 /// The match type is unspecified. Not a valid option.
6977 Unspecified,
6978 /// Match on any indexed field. This is the only way currently supported
6979 /// for MONGODB_COMPATIBLE_API.
6980 MatchGlobally,
6981 /// If set, the enum was initialized with an unknown value.
6982 ///
6983 /// Applications can examine the value using [TextMatchType::value] or
6984 /// [TextMatchType::name].
6985 UnknownValue(text_match_type::UnknownValue),
6986 }
6987
6988 #[doc(hidden)]
6989 pub mod text_match_type {
6990 #[allow(unused_imports)]
6991 use super::*;
6992 #[derive(Clone, Debug, PartialEq)]
6993 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6994 }
6995
6996 impl TextMatchType {
6997 /// Gets the enum value.
6998 ///
6999 /// Returns `None` if the enum contains an unknown value deserialized from
7000 /// the string representation of enums.
7001 pub fn value(&self) -> std::option::Option<i32> {
7002 match self {
7003 Self::Unspecified => std::option::Option::Some(0),
7004 Self::MatchGlobally => std::option::Option::Some(1),
7005 Self::UnknownValue(u) => u.0.value(),
7006 }
7007 }
7008
7009 /// Gets the enum value as a string.
7010 ///
7011 /// Returns `None` if the enum contains an unknown value deserialized from
7012 /// the integer representation of enums.
7013 pub fn name(&self) -> std::option::Option<&str> {
7014 match self {
7015 Self::Unspecified => {
7016 std::option::Option::Some("TEXT_MATCH_TYPE_UNSPECIFIED")
7017 }
7018 Self::MatchGlobally => std::option::Option::Some("MATCH_GLOBALLY"),
7019 Self::UnknownValue(u) => u.0.name(),
7020 }
7021 }
7022 }
7023
7024 impl std::default::Default for TextMatchType {
7025 fn default() -> Self {
7026 use std::convert::From;
7027 Self::from(0)
7028 }
7029 }
7030
7031 impl std::fmt::Display for TextMatchType {
7032 fn fmt(
7033 &self,
7034 f: &mut std::fmt::Formatter<'_>,
7035 ) -> std::result::Result<(), std::fmt::Error> {
7036 wkt::internal::display_enum(f, self.name(), self.value())
7037 }
7038 }
7039
7040 impl std::convert::From<i32> for TextMatchType {
7041 fn from(value: i32) -> Self {
7042 match value {
7043 0 => Self::Unspecified,
7044 1 => Self::MatchGlobally,
7045 _ => Self::UnknownValue(text_match_type::UnknownValue(
7046 wkt::internal::UnknownEnumValue::Integer(value),
7047 )),
7048 }
7049 }
7050 }
7051
7052 impl std::convert::From<&str> for TextMatchType {
7053 fn from(value: &str) -> Self {
7054 use std::string::ToString;
7055 match value {
7056 "TEXT_MATCH_TYPE_UNSPECIFIED" => Self::Unspecified,
7057 "MATCH_GLOBALLY" => Self::MatchGlobally,
7058 _ => Self::UnknownValue(text_match_type::UnknownValue(
7059 wkt::internal::UnknownEnumValue::String(value.to_string()),
7060 )),
7061 }
7062 }
7063 }
7064
7065 impl serde::ser::Serialize for TextMatchType {
7066 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7067 where
7068 S: serde::Serializer,
7069 {
7070 match self {
7071 Self::Unspecified => serializer.serialize_i32(0),
7072 Self::MatchGlobally => serializer.serialize_i32(1),
7073 Self::UnknownValue(u) => u.0.serialize(serializer),
7074 }
7075 }
7076 }
7077
7078 impl<'de> serde::de::Deserialize<'de> for TextMatchType {
7079 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7080 where
7081 D: serde::Deserializer<'de>,
7082 {
7083 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TextMatchType>::new(
7084 ".google.firestore.admin.v1.Index.IndexField.SearchConfig.TextMatchType",
7085 ))
7086 }
7087 }
7088 }
7089
7090 /// The supported orderings.
7091 ///
7092 /// # Working with unknown values
7093 ///
7094 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7095 /// additional enum variants at any time. Adding new variants is not considered
7096 /// a breaking change. Applications should write their code in anticipation of:
7097 ///
7098 /// - New values appearing in future releases of the client library, **and**
7099 /// - New values received dynamically, without application changes.
7100 ///
7101 /// Please consult the [Working with enums] section in the user guide for some
7102 /// guidelines.
7103 ///
7104 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7105 #[derive(Clone, Debug, PartialEq)]
7106 #[non_exhaustive]
7107 pub enum Order {
7108 /// The ordering is unspecified. Not a valid option.
7109 Unspecified,
7110 /// The field is ordered by ascending field value.
7111 Ascending,
7112 /// The field is ordered by descending field value.
7113 Descending,
7114 /// If set, the enum was initialized with an unknown value.
7115 ///
7116 /// Applications can examine the value using [Order::value] or
7117 /// [Order::name].
7118 UnknownValue(order::UnknownValue),
7119 }
7120
7121 #[doc(hidden)]
7122 pub mod order {
7123 #[allow(unused_imports)]
7124 use super::*;
7125 #[derive(Clone, Debug, PartialEq)]
7126 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7127 }
7128
7129 impl Order {
7130 /// Gets the enum value.
7131 ///
7132 /// Returns `None` if the enum contains an unknown value deserialized from
7133 /// the string representation of enums.
7134 pub fn value(&self) -> std::option::Option<i32> {
7135 match self {
7136 Self::Unspecified => std::option::Option::Some(0),
7137 Self::Ascending => std::option::Option::Some(1),
7138 Self::Descending => std::option::Option::Some(2),
7139 Self::UnknownValue(u) => u.0.value(),
7140 }
7141 }
7142
7143 /// Gets the enum value as a string.
7144 ///
7145 /// Returns `None` if the enum contains an unknown value deserialized from
7146 /// the integer representation of enums.
7147 pub fn name(&self) -> std::option::Option<&str> {
7148 match self {
7149 Self::Unspecified => std::option::Option::Some("ORDER_UNSPECIFIED"),
7150 Self::Ascending => std::option::Option::Some("ASCENDING"),
7151 Self::Descending => std::option::Option::Some("DESCENDING"),
7152 Self::UnknownValue(u) => u.0.name(),
7153 }
7154 }
7155 }
7156
7157 impl std::default::Default for Order {
7158 fn default() -> Self {
7159 use std::convert::From;
7160 Self::from(0)
7161 }
7162 }
7163
7164 impl std::fmt::Display for Order {
7165 fn fmt(
7166 &self,
7167 f: &mut std::fmt::Formatter<'_>,
7168 ) -> std::result::Result<(), std::fmt::Error> {
7169 wkt::internal::display_enum(f, self.name(), self.value())
7170 }
7171 }
7172
7173 impl std::convert::From<i32> for Order {
7174 fn from(value: i32) -> Self {
7175 match value {
7176 0 => Self::Unspecified,
7177 1 => Self::Ascending,
7178 2 => Self::Descending,
7179 _ => Self::UnknownValue(order::UnknownValue(
7180 wkt::internal::UnknownEnumValue::Integer(value),
7181 )),
7182 }
7183 }
7184 }
7185
7186 impl std::convert::From<&str> for Order {
7187 fn from(value: &str) -> Self {
7188 use std::string::ToString;
7189 match value {
7190 "ORDER_UNSPECIFIED" => Self::Unspecified,
7191 "ASCENDING" => Self::Ascending,
7192 "DESCENDING" => Self::Descending,
7193 _ => Self::UnknownValue(order::UnknownValue(
7194 wkt::internal::UnknownEnumValue::String(value.to_string()),
7195 )),
7196 }
7197 }
7198 }
7199
7200 impl serde::ser::Serialize for Order {
7201 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7202 where
7203 S: serde::Serializer,
7204 {
7205 match self {
7206 Self::Unspecified => serializer.serialize_i32(0),
7207 Self::Ascending => serializer.serialize_i32(1),
7208 Self::Descending => serializer.serialize_i32(2),
7209 Self::UnknownValue(u) => u.0.serialize(serializer),
7210 }
7211 }
7212 }
7213
7214 impl<'de> serde::de::Deserialize<'de> for Order {
7215 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7216 where
7217 D: serde::Deserializer<'de>,
7218 {
7219 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Order>::new(
7220 ".google.firestore.admin.v1.Index.IndexField.Order",
7221 ))
7222 }
7223 }
7224
7225 /// The supported array value configurations.
7226 ///
7227 /// # Working with unknown values
7228 ///
7229 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7230 /// additional enum variants at any time. Adding new variants is not considered
7231 /// a breaking change. Applications should write their code in anticipation of:
7232 ///
7233 /// - New values appearing in future releases of the client library, **and**
7234 /// - New values received dynamically, without application changes.
7235 ///
7236 /// Please consult the [Working with enums] section in the user guide for some
7237 /// guidelines.
7238 ///
7239 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7240 #[derive(Clone, Debug, PartialEq)]
7241 #[non_exhaustive]
7242 pub enum ArrayConfig {
7243 /// The index does not support additional array queries.
7244 Unspecified,
7245 /// The index supports array containment queries.
7246 Contains,
7247 /// If set, the enum was initialized with an unknown value.
7248 ///
7249 /// Applications can examine the value using [ArrayConfig::value] or
7250 /// [ArrayConfig::name].
7251 UnknownValue(array_config::UnknownValue),
7252 }
7253
7254 #[doc(hidden)]
7255 pub mod array_config {
7256 #[allow(unused_imports)]
7257 use super::*;
7258 #[derive(Clone, Debug, PartialEq)]
7259 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7260 }
7261
7262 impl ArrayConfig {
7263 /// Gets the enum value.
7264 ///
7265 /// Returns `None` if the enum contains an unknown value deserialized from
7266 /// the string representation of enums.
7267 pub fn value(&self) -> std::option::Option<i32> {
7268 match self {
7269 Self::Unspecified => std::option::Option::Some(0),
7270 Self::Contains => std::option::Option::Some(1),
7271 Self::UnknownValue(u) => u.0.value(),
7272 }
7273 }
7274
7275 /// Gets the enum value as a string.
7276 ///
7277 /// Returns `None` if the enum contains an unknown value deserialized from
7278 /// the integer representation of enums.
7279 pub fn name(&self) -> std::option::Option<&str> {
7280 match self {
7281 Self::Unspecified => std::option::Option::Some("ARRAY_CONFIG_UNSPECIFIED"),
7282 Self::Contains => std::option::Option::Some("CONTAINS"),
7283 Self::UnknownValue(u) => u.0.name(),
7284 }
7285 }
7286 }
7287
7288 impl std::default::Default for ArrayConfig {
7289 fn default() -> Self {
7290 use std::convert::From;
7291 Self::from(0)
7292 }
7293 }
7294
7295 impl std::fmt::Display for ArrayConfig {
7296 fn fmt(
7297 &self,
7298 f: &mut std::fmt::Formatter<'_>,
7299 ) -> std::result::Result<(), std::fmt::Error> {
7300 wkt::internal::display_enum(f, self.name(), self.value())
7301 }
7302 }
7303
7304 impl std::convert::From<i32> for ArrayConfig {
7305 fn from(value: i32) -> Self {
7306 match value {
7307 0 => Self::Unspecified,
7308 1 => Self::Contains,
7309 _ => Self::UnknownValue(array_config::UnknownValue(
7310 wkt::internal::UnknownEnumValue::Integer(value),
7311 )),
7312 }
7313 }
7314 }
7315
7316 impl std::convert::From<&str> for ArrayConfig {
7317 fn from(value: &str) -> Self {
7318 use std::string::ToString;
7319 match value {
7320 "ARRAY_CONFIG_UNSPECIFIED" => Self::Unspecified,
7321 "CONTAINS" => Self::Contains,
7322 _ => Self::UnknownValue(array_config::UnknownValue(
7323 wkt::internal::UnknownEnumValue::String(value.to_string()),
7324 )),
7325 }
7326 }
7327 }
7328
7329 impl serde::ser::Serialize for ArrayConfig {
7330 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7331 where
7332 S: serde::Serializer,
7333 {
7334 match self {
7335 Self::Unspecified => serializer.serialize_i32(0),
7336 Self::Contains => serializer.serialize_i32(1),
7337 Self::UnknownValue(u) => u.0.serialize(serializer),
7338 }
7339 }
7340 }
7341
7342 impl<'de> serde::de::Deserialize<'de> for ArrayConfig {
7343 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7344 where
7345 D: serde::Deserializer<'de>,
7346 {
7347 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ArrayConfig>::new(
7348 ".google.firestore.admin.v1.Index.IndexField.ArrayConfig",
7349 ))
7350 }
7351 }
7352
7353 /// How the field value is indexed.
7354 #[derive(Clone, Debug, PartialEq)]
7355 #[non_exhaustive]
7356 pub enum ValueMode {
7357 /// Indicates that this field supports ordering by the specified order or
7358 /// comparing using =, !=, <, <=, >, >=.
7359 Order(crate::model::index::index_field::Order),
7360 /// Indicates that this field supports operations on `array_value`s.
7361 ArrayConfig(crate::model::index::index_field::ArrayConfig),
7362 /// Indicates that this field supports nearest neighbor and distance
7363 /// operations on vector.
7364 VectorConfig(std::boxed::Box<crate::model::index::index_field::VectorConfig>),
7365 /// Indicates that this field supports search operations. This field
7366 /// is only currently supported for indexes with MONGODB_COMPATIBLE_API
7367 /// ApiScope.
7368 SearchConfig(std::boxed::Box<crate::model::index::index_field::SearchConfig>),
7369 }
7370 }
7371
7372 /// Options for search indexes at the definition level.
7373 #[derive(Clone, Default, PartialEq)]
7374 #[non_exhaustive]
7375 pub struct SearchIndexOptions {
7376 /// Optional. The language to use for text search indexes. Used as the
7377 /// default language if not overridden at the document level by specifying
7378 /// the `text_language_override_field`. The language is specified as a BCP 47
7379 /// language code.
7380 /// For indexes with MONGODB_COMPATIBLE_API ApiScope: If unspecified, the
7381 /// default language is English.
7382 /// For indexes with `ANY_API` ApiScope: If unspecified, the default behavior
7383 /// is autodetect.
7384 pub text_language: std::string::String,
7385
7386 /// Optional. The field in the document that specifies which language to use
7387 /// for that specific document. For indexes with MONGODB_COMPATIBLE_API
7388 /// ApiScope: if unspecified, the language is taken from the "language" field
7389 /// if it exists or from `text_language` if it does not.
7390 pub text_language_override_field_path: std::string::String,
7391
7392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7393 }
7394
7395 impl SearchIndexOptions {
7396 /// Creates a new default instance.
7397 pub fn new() -> Self {
7398 std::default::Default::default()
7399 }
7400
7401 /// Sets the value of [text_language][crate::model::index::SearchIndexOptions::text_language].
7402 ///
7403 /// # Example
7404 /// ```ignore,no_run
7405 /// # use google_cloud_firestore_admin_v1::model::index::SearchIndexOptions;
7406 /// let x = SearchIndexOptions::new().set_text_language("example");
7407 /// ```
7408 pub fn set_text_language<T: std::convert::Into<std::string::String>>(
7409 mut self,
7410 v: T,
7411 ) -> Self {
7412 self.text_language = v.into();
7413 self
7414 }
7415
7416 /// Sets the value of [text_language_override_field_path][crate::model::index::SearchIndexOptions::text_language_override_field_path].
7417 ///
7418 /// # Example
7419 /// ```ignore,no_run
7420 /// # use google_cloud_firestore_admin_v1::model::index::SearchIndexOptions;
7421 /// let x = SearchIndexOptions::new().set_text_language_override_field_path("example");
7422 /// ```
7423 pub fn set_text_language_override_field_path<T: std::convert::Into<std::string::String>>(
7424 mut self,
7425 v: T,
7426 ) -> Self {
7427 self.text_language_override_field_path = v.into();
7428 self
7429 }
7430 }
7431
7432 impl wkt::message::Message for SearchIndexOptions {
7433 fn typename() -> &'static str {
7434 "type.googleapis.com/google.firestore.admin.v1.Index.SearchIndexOptions"
7435 }
7436 }
7437
7438 /// Query Scope defines the scope at which a query is run. This is specified on
7439 /// a StructuredQuery's `from` field.
7440 ///
7441 /// # Working with unknown values
7442 ///
7443 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7444 /// additional enum variants at any time. Adding new variants is not considered
7445 /// a breaking change. Applications should write their code in anticipation of:
7446 ///
7447 /// - New values appearing in future releases of the client library, **and**
7448 /// - New values received dynamically, without application changes.
7449 ///
7450 /// Please consult the [Working with enums] section in the user guide for some
7451 /// guidelines.
7452 ///
7453 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7454 #[derive(Clone, Debug, PartialEq)]
7455 #[non_exhaustive]
7456 pub enum QueryScope {
7457 /// The query scope is unspecified. Not a valid option.
7458 Unspecified,
7459 /// Indexes with a collection query scope specified allow queries
7460 /// against a collection that is the child of a specific document, specified
7461 /// at query time, and that has the collection ID specified by the index.
7462 Collection,
7463 /// Indexes with a collection group query scope specified allow queries
7464 /// against all collections that has the collection ID specified by the
7465 /// index.
7466 CollectionGroup,
7467 /// Include all the collections's ancestor in the index. Only available for
7468 /// Datastore Mode databases.
7469 CollectionRecursive,
7470 /// If set, the enum was initialized with an unknown value.
7471 ///
7472 /// Applications can examine the value using [QueryScope::value] or
7473 /// [QueryScope::name].
7474 UnknownValue(query_scope::UnknownValue),
7475 }
7476
7477 #[doc(hidden)]
7478 pub mod query_scope {
7479 #[allow(unused_imports)]
7480 use super::*;
7481 #[derive(Clone, Debug, PartialEq)]
7482 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7483 }
7484
7485 impl QueryScope {
7486 /// Gets the enum value.
7487 ///
7488 /// Returns `None` if the enum contains an unknown value deserialized from
7489 /// the string representation of enums.
7490 pub fn value(&self) -> std::option::Option<i32> {
7491 match self {
7492 Self::Unspecified => std::option::Option::Some(0),
7493 Self::Collection => std::option::Option::Some(1),
7494 Self::CollectionGroup => std::option::Option::Some(2),
7495 Self::CollectionRecursive => std::option::Option::Some(3),
7496 Self::UnknownValue(u) => u.0.value(),
7497 }
7498 }
7499
7500 /// Gets the enum value as a string.
7501 ///
7502 /// Returns `None` if the enum contains an unknown value deserialized from
7503 /// the integer representation of enums.
7504 pub fn name(&self) -> std::option::Option<&str> {
7505 match self {
7506 Self::Unspecified => std::option::Option::Some("QUERY_SCOPE_UNSPECIFIED"),
7507 Self::Collection => std::option::Option::Some("COLLECTION"),
7508 Self::CollectionGroup => std::option::Option::Some("COLLECTION_GROUP"),
7509 Self::CollectionRecursive => std::option::Option::Some("COLLECTION_RECURSIVE"),
7510 Self::UnknownValue(u) => u.0.name(),
7511 }
7512 }
7513 }
7514
7515 impl std::default::Default for QueryScope {
7516 fn default() -> Self {
7517 use std::convert::From;
7518 Self::from(0)
7519 }
7520 }
7521
7522 impl std::fmt::Display for QueryScope {
7523 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7524 wkt::internal::display_enum(f, self.name(), self.value())
7525 }
7526 }
7527
7528 impl std::convert::From<i32> for QueryScope {
7529 fn from(value: i32) -> Self {
7530 match value {
7531 0 => Self::Unspecified,
7532 1 => Self::Collection,
7533 2 => Self::CollectionGroup,
7534 3 => Self::CollectionRecursive,
7535 _ => Self::UnknownValue(query_scope::UnknownValue(
7536 wkt::internal::UnknownEnumValue::Integer(value),
7537 )),
7538 }
7539 }
7540 }
7541
7542 impl std::convert::From<&str> for QueryScope {
7543 fn from(value: &str) -> Self {
7544 use std::string::ToString;
7545 match value {
7546 "QUERY_SCOPE_UNSPECIFIED" => Self::Unspecified,
7547 "COLLECTION" => Self::Collection,
7548 "COLLECTION_GROUP" => Self::CollectionGroup,
7549 "COLLECTION_RECURSIVE" => Self::CollectionRecursive,
7550 _ => Self::UnknownValue(query_scope::UnknownValue(
7551 wkt::internal::UnknownEnumValue::String(value.to_string()),
7552 )),
7553 }
7554 }
7555 }
7556
7557 impl serde::ser::Serialize for QueryScope {
7558 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7559 where
7560 S: serde::Serializer,
7561 {
7562 match self {
7563 Self::Unspecified => serializer.serialize_i32(0),
7564 Self::Collection => serializer.serialize_i32(1),
7565 Self::CollectionGroup => serializer.serialize_i32(2),
7566 Self::CollectionRecursive => serializer.serialize_i32(3),
7567 Self::UnknownValue(u) => u.0.serialize(serializer),
7568 }
7569 }
7570 }
7571
7572 impl<'de> serde::de::Deserialize<'de> for QueryScope {
7573 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7574 where
7575 D: serde::Deserializer<'de>,
7576 {
7577 deserializer.deserialize_any(wkt::internal::EnumVisitor::<QueryScope>::new(
7578 ".google.firestore.admin.v1.Index.QueryScope",
7579 ))
7580 }
7581 }
7582
7583 /// API Scope defines the APIs (Firestore Native, or Firestore in
7584 /// Datastore Mode) that are supported for queries.
7585 ///
7586 /// # Working with unknown values
7587 ///
7588 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7589 /// additional enum variants at any time. Adding new variants is not considered
7590 /// a breaking change. Applications should write their code in anticipation of:
7591 ///
7592 /// - New values appearing in future releases of the client library, **and**
7593 /// - New values received dynamically, without application changes.
7594 ///
7595 /// Please consult the [Working with enums] section in the user guide for some
7596 /// guidelines.
7597 ///
7598 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7599 #[derive(Clone, Debug, PartialEq)]
7600 #[non_exhaustive]
7601 pub enum ApiScope {
7602 /// The index can only be used by the Firestore Native query API.
7603 /// This is the default.
7604 AnyApi,
7605 /// The index can only be used by the Firestore in Datastore Mode query API.
7606 DatastoreModeApi,
7607 /// The index can only be used by the MONGODB_COMPATIBLE_API.
7608 MongodbCompatibleApi,
7609 /// If set, the enum was initialized with an unknown value.
7610 ///
7611 /// Applications can examine the value using [ApiScope::value] or
7612 /// [ApiScope::name].
7613 UnknownValue(api_scope::UnknownValue),
7614 }
7615
7616 #[doc(hidden)]
7617 pub mod api_scope {
7618 #[allow(unused_imports)]
7619 use super::*;
7620 #[derive(Clone, Debug, PartialEq)]
7621 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7622 }
7623
7624 impl ApiScope {
7625 /// Gets the enum value.
7626 ///
7627 /// Returns `None` if the enum contains an unknown value deserialized from
7628 /// the string representation of enums.
7629 pub fn value(&self) -> std::option::Option<i32> {
7630 match self {
7631 Self::AnyApi => std::option::Option::Some(0),
7632 Self::DatastoreModeApi => std::option::Option::Some(1),
7633 Self::MongodbCompatibleApi => std::option::Option::Some(2),
7634 Self::UnknownValue(u) => u.0.value(),
7635 }
7636 }
7637
7638 /// Gets the enum value as a string.
7639 ///
7640 /// Returns `None` if the enum contains an unknown value deserialized from
7641 /// the integer representation of enums.
7642 pub fn name(&self) -> std::option::Option<&str> {
7643 match self {
7644 Self::AnyApi => std::option::Option::Some("ANY_API"),
7645 Self::DatastoreModeApi => std::option::Option::Some("DATASTORE_MODE_API"),
7646 Self::MongodbCompatibleApi => std::option::Option::Some("MONGODB_COMPATIBLE_API"),
7647 Self::UnknownValue(u) => u.0.name(),
7648 }
7649 }
7650 }
7651
7652 impl std::default::Default for ApiScope {
7653 fn default() -> Self {
7654 use std::convert::From;
7655 Self::from(0)
7656 }
7657 }
7658
7659 impl std::fmt::Display for ApiScope {
7660 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7661 wkt::internal::display_enum(f, self.name(), self.value())
7662 }
7663 }
7664
7665 impl std::convert::From<i32> for ApiScope {
7666 fn from(value: i32) -> Self {
7667 match value {
7668 0 => Self::AnyApi,
7669 1 => Self::DatastoreModeApi,
7670 2 => Self::MongodbCompatibleApi,
7671 _ => Self::UnknownValue(api_scope::UnknownValue(
7672 wkt::internal::UnknownEnumValue::Integer(value),
7673 )),
7674 }
7675 }
7676 }
7677
7678 impl std::convert::From<&str> for ApiScope {
7679 fn from(value: &str) -> Self {
7680 use std::string::ToString;
7681 match value {
7682 "ANY_API" => Self::AnyApi,
7683 "DATASTORE_MODE_API" => Self::DatastoreModeApi,
7684 "MONGODB_COMPATIBLE_API" => Self::MongodbCompatibleApi,
7685 _ => Self::UnknownValue(api_scope::UnknownValue(
7686 wkt::internal::UnknownEnumValue::String(value.to_string()),
7687 )),
7688 }
7689 }
7690 }
7691
7692 impl serde::ser::Serialize for ApiScope {
7693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7694 where
7695 S: serde::Serializer,
7696 {
7697 match self {
7698 Self::AnyApi => serializer.serialize_i32(0),
7699 Self::DatastoreModeApi => serializer.serialize_i32(1),
7700 Self::MongodbCompatibleApi => serializer.serialize_i32(2),
7701 Self::UnknownValue(u) => u.0.serialize(serializer),
7702 }
7703 }
7704 }
7705
7706 impl<'de> serde::de::Deserialize<'de> for ApiScope {
7707 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7708 where
7709 D: serde::Deserializer<'de>,
7710 {
7711 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiScope>::new(
7712 ".google.firestore.admin.v1.Index.ApiScope",
7713 ))
7714 }
7715 }
7716
7717 /// The state of an index. During index creation, an index will be in the
7718 /// `CREATING` state. If the index is created successfully, it will transition
7719 /// to the `READY` state. If the index creation encounters a problem, the index
7720 /// will transition to the `NEEDS_REPAIR` state.
7721 ///
7722 /// # Working with unknown values
7723 ///
7724 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7725 /// additional enum variants at any time. Adding new variants is not considered
7726 /// a breaking change. Applications should write their code in anticipation of:
7727 ///
7728 /// - New values appearing in future releases of the client library, **and**
7729 /// - New values received dynamically, without application changes.
7730 ///
7731 /// Please consult the [Working with enums] section in the user guide for some
7732 /// guidelines.
7733 ///
7734 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7735 #[derive(Clone, Debug, PartialEq)]
7736 #[non_exhaustive]
7737 pub enum State {
7738 /// The state is unspecified.
7739 Unspecified,
7740 /// The index is being created.
7741 /// There is an active long-running operation for the index.
7742 /// The index is updated when writing a document.
7743 /// Some index data may exist.
7744 Creating,
7745 /// The index is ready to be used.
7746 /// The index is updated when writing a document.
7747 /// The index is fully populated from all stored documents it applies to.
7748 Ready,
7749 /// The index was being created, but something went wrong.
7750 /// There is no active long-running operation for the index,
7751 /// and the most recently finished long-running operation failed.
7752 /// The index is not updated when writing a document.
7753 /// Some index data may exist.
7754 /// Use the google.longrunning.Operations API to determine why the operation
7755 /// that last attempted to create this index failed, then re-create the
7756 /// index.
7757 NeedsRepair,
7758 /// If set, the enum was initialized with an unknown value.
7759 ///
7760 /// Applications can examine the value using [State::value] or
7761 /// [State::name].
7762 UnknownValue(state::UnknownValue),
7763 }
7764
7765 #[doc(hidden)]
7766 pub mod state {
7767 #[allow(unused_imports)]
7768 use super::*;
7769 #[derive(Clone, Debug, PartialEq)]
7770 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7771 }
7772
7773 impl State {
7774 /// Gets the enum value.
7775 ///
7776 /// Returns `None` if the enum contains an unknown value deserialized from
7777 /// the string representation of enums.
7778 pub fn value(&self) -> std::option::Option<i32> {
7779 match self {
7780 Self::Unspecified => std::option::Option::Some(0),
7781 Self::Creating => std::option::Option::Some(1),
7782 Self::Ready => std::option::Option::Some(2),
7783 Self::NeedsRepair => std::option::Option::Some(3),
7784 Self::UnknownValue(u) => u.0.value(),
7785 }
7786 }
7787
7788 /// Gets the enum value as a string.
7789 ///
7790 /// Returns `None` if the enum contains an unknown value deserialized from
7791 /// the integer representation of enums.
7792 pub fn name(&self) -> std::option::Option<&str> {
7793 match self {
7794 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7795 Self::Creating => std::option::Option::Some("CREATING"),
7796 Self::Ready => std::option::Option::Some("READY"),
7797 Self::NeedsRepair => std::option::Option::Some("NEEDS_REPAIR"),
7798 Self::UnknownValue(u) => u.0.name(),
7799 }
7800 }
7801 }
7802
7803 impl std::default::Default for State {
7804 fn default() -> Self {
7805 use std::convert::From;
7806 Self::from(0)
7807 }
7808 }
7809
7810 impl std::fmt::Display for State {
7811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7812 wkt::internal::display_enum(f, self.name(), self.value())
7813 }
7814 }
7815
7816 impl std::convert::From<i32> for State {
7817 fn from(value: i32) -> Self {
7818 match value {
7819 0 => Self::Unspecified,
7820 1 => Self::Creating,
7821 2 => Self::Ready,
7822 3 => Self::NeedsRepair,
7823 _ => Self::UnknownValue(state::UnknownValue(
7824 wkt::internal::UnknownEnumValue::Integer(value),
7825 )),
7826 }
7827 }
7828 }
7829
7830 impl std::convert::From<&str> for State {
7831 fn from(value: &str) -> Self {
7832 use std::string::ToString;
7833 match value {
7834 "STATE_UNSPECIFIED" => Self::Unspecified,
7835 "CREATING" => Self::Creating,
7836 "READY" => Self::Ready,
7837 "NEEDS_REPAIR" => Self::NeedsRepair,
7838 _ => Self::UnknownValue(state::UnknownValue(
7839 wkt::internal::UnknownEnumValue::String(value.to_string()),
7840 )),
7841 }
7842 }
7843 }
7844
7845 impl serde::ser::Serialize for State {
7846 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7847 where
7848 S: serde::Serializer,
7849 {
7850 match self {
7851 Self::Unspecified => serializer.serialize_i32(0),
7852 Self::Creating => serializer.serialize_i32(1),
7853 Self::Ready => serializer.serialize_i32(2),
7854 Self::NeedsRepair => serializer.serialize_i32(3),
7855 Self::UnknownValue(u) => u.0.serialize(serializer),
7856 }
7857 }
7858 }
7859
7860 impl<'de> serde::de::Deserialize<'de> for State {
7861 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7862 where
7863 D: serde::Deserializer<'de>,
7864 {
7865 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7866 ".google.firestore.admin.v1.Index.State",
7867 ))
7868 }
7869 }
7870
7871 /// The density configuration for the index.
7872 ///
7873 /// # Working with unknown values
7874 ///
7875 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7876 /// additional enum variants at any time. Adding new variants is not considered
7877 /// a breaking change. Applications should write their code in anticipation of:
7878 ///
7879 /// - New values appearing in future releases of the client library, **and**
7880 /// - New values received dynamically, without application changes.
7881 ///
7882 /// Please consult the [Working with enums] section in the user guide for some
7883 /// guidelines.
7884 ///
7885 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7886 #[derive(Clone, Debug, PartialEq)]
7887 #[non_exhaustive]
7888 pub enum Density {
7889 /// Unspecified. It will use database default setting. This value is input
7890 /// only.
7891 Unspecified,
7892 /// An index entry will only exist if ALL fields are present in the document.
7893 ///
7894 /// This is both the default and only allowed value for Standard Edition
7895 /// databases (for both Cloud Firestore `ANY_API` and Cloud Datastore
7896 /// `DATASTORE_MODE_API`).
7897 ///
7898 /// Take for example the following document:
7899 ///
7900 /// ```norust
7901 /// {
7902 /// "__name__": "...",
7903 /// "a": 1,
7904 /// "b": 2,
7905 /// "c": 3
7906 /// }
7907 /// ```
7908 ///
7909 /// an index on `(a ASC, b ASC, c ASC, __name__ ASC)` will generate an index
7910 /// entry for this document since `a`, 'b', `c`, and `__name__` are all
7911 /// present but an index of `(a ASC, d ASC, __name__ ASC)` will not generate
7912 /// an index entry for this document since `d` is missing.
7913 ///
7914 /// This means that such indexes can only be used to serve a query when the
7915 /// query has either implicit or explicit requirements that all fields from
7916 /// the index are present.
7917 SparseAll,
7918 /// An index entry will exist if ANY field are present in the document.
7919 ///
7920 /// This is used as the definition of a sparse index for Enterprise Edition
7921 /// databases.
7922 ///
7923 /// Take for example the following document:
7924 ///
7925 /// ```norust
7926 /// {
7927 /// "__name__": "...",
7928 /// "a": 1,
7929 /// "b": 2,
7930 /// "c": 3
7931 /// }
7932 /// ```
7933 ///
7934 /// an index on `(a ASC, d ASC)` will generate an index entry for this
7935 /// document since `a` is present, and will fill in an `unset` value for `d`.
7936 /// An index on `(d ASC, e ASC)` will not generate any index entry as neither
7937 /// `d` nor `e` are present.
7938 ///
7939 /// An index that contains `__name__` will generate an index entry for all
7940 /// documents since Firestore guarantees that all documents have a `__name__`
7941 /// field.
7942 SparseAny,
7943 /// An index entry will exist regardless of if the fields are present or not.
7944 ///
7945 /// This is the default density for an Enterprise Edition database.
7946 ///
7947 /// The index will store `unset` values for fields that are not present in
7948 /// the document.
7949 Dense,
7950 /// If set, the enum was initialized with an unknown value.
7951 ///
7952 /// Applications can examine the value using [Density::value] or
7953 /// [Density::name].
7954 UnknownValue(density::UnknownValue),
7955 }
7956
7957 #[doc(hidden)]
7958 pub mod density {
7959 #[allow(unused_imports)]
7960 use super::*;
7961 #[derive(Clone, Debug, PartialEq)]
7962 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7963 }
7964
7965 impl Density {
7966 /// Gets the enum value.
7967 ///
7968 /// Returns `None` if the enum contains an unknown value deserialized from
7969 /// the string representation of enums.
7970 pub fn value(&self) -> std::option::Option<i32> {
7971 match self {
7972 Self::Unspecified => std::option::Option::Some(0),
7973 Self::SparseAll => std::option::Option::Some(1),
7974 Self::SparseAny => std::option::Option::Some(2),
7975 Self::Dense => std::option::Option::Some(3),
7976 Self::UnknownValue(u) => u.0.value(),
7977 }
7978 }
7979
7980 /// Gets the enum value as a string.
7981 ///
7982 /// Returns `None` if the enum contains an unknown value deserialized from
7983 /// the integer representation of enums.
7984 pub fn name(&self) -> std::option::Option<&str> {
7985 match self {
7986 Self::Unspecified => std::option::Option::Some("DENSITY_UNSPECIFIED"),
7987 Self::SparseAll => std::option::Option::Some("SPARSE_ALL"),
7988 Self::SparseAny => std::option::Option::Some("SPARSE_ANY"),
7989 Self::Dense => std::option::Option::Some("DENSE"),
7990 Self::UnknownValue(u) => u.0.name(),
7991 }
7992 }
7993 }
7994
7995 impl std::default::Default for Density {
7996 fn default() -> Self {
7997 use std::convert::From;
7998 Self::from(0)
7999 }
8000 }
8001
8002 impl std::fmt::Display for Density {
8003 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8004 wkt::internal::display_enum(f, self.name(), self.value())
8005 }
8006 }
8007
8008 impl std::convert::From<i32> for Density {
8009 fn from(value: i32) -> Self {
8010 match value {
8011 0 => Self::Unspecified,
8012 1 => Self::SparseAll,
8013 2 => Self::SparseAny,
8014 3 => Self::Dense,
8015 _ => Self::UnknownValue(density::UnknownValue(
8016 wkt::internal::UnknownEnumValue::Integer(value),
8017 )),
8018 }
8019 }
8020 }
8021
8022 impl std::convert::From<&str> for Density {
8023 fn from(value: &str) -> Self {
8024 use std::string::ToString;
8025 match value {
8026 "DENSITY_UNSPECIFIED" => Self::Unspecified,
8027 "SPARSE_ALL" => Self::SparseAll,
8028 "SPARSE_ANY" => Self::SparseAny,
8029 "DENSE" => Self::Dense,
8030 _ => Self::UnknownValue(density::UnknownValue(
8031 wkt::internal::UnknownEnumValue::String(value.to_string()),
8032 )),
8033 }
8034 }
8035 }
8036
8037 impl serde::ser::Serialize for Density {
8038 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8039 where
8040 S: serde::Serializer,
8041 {
8042 match self {
8043 Self::Unspecified => serializer.serialize_i32(0),
8044 Self::SparseAll => serializer.serialize_i32(1),
8045 Self::SparseAny => serializer.serialize_i32(2),
8046 Self::Dense => serializer.serialize_i32(3),
8047 Self::UnknownValue(u) => u.0.serialize(serializer),
8048 }
8049 }
8050 }
8051
8052 impl<'de> serde::de::Deserialize<'de> for Density {
8053 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8054 where
8055 D: serde::Deserializer<'de>,
8056 {
8057 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Density>::new(
8058 ".google.firestore.admin.v1.Index.Density",
8059 ))
8060 }
8061 }
8062}
8063
8064/// The metadata message for
8065/// [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata].
8066///
8067/// [google.cloud.location.Location.metadata]: google_cloud_location::model::Location::metadata
8068#[derive(Clone, Default, PartialEq)]
8069#[non_exhaustive]
8070pub struct LocationMetadata {
8071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8072}
8073
8074impl LocationMetadata {
8075 /// Creates a new default instance.
8076 pub fn new() -> Self {
8077 std::default::Default::default()
8078 }
8079}
8080
8081impl wkt::message::Message for LocationMetadata {
8082 fn typename() -> &'static str {
8083 "type.googleapis.com/google.firestore.admin.v1.LocationMetadata"
8084 }
8085}
8086
8087/// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
8088/// results from
8089/// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
8090///
8091/// [google.firestore.admin.v1.FirestoreAdmin.CreateIndex]: crate::client::FirestoreAdmin::create_index
8092/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8093#[derive(Clone, Default, PartialEq)]
8094#[non_exhaustive]
8095pub struct IndexOperationMetadata {
8096 /// The time this operation started.
8097 pub start_time: std::option::Option<wkt::Timestamp>,
8098
8099 /// The time this operation completed. Will be unset if operation still in
8100 /// progress.
8101 pub end_time: std::option::Option<wkt::Timestamp>,
8102
8103 /// The index resource that this operation is acting on. For example:
8104 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
8105 pub index: std::string::String,
8106
8107 /// The state of the operation.
8108 pub state: crate::model::OperationState,
8109
8110 /// The progress, in documents, of this operation.
8111 pub progress_documents: std::option::Option<crate::model::Progress>,
8112
8113 /// The progress, in bytes, of this operation.
8114 pub progress_bytes: std::option::Option<crate::model::Progress>,
8115
8116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8117}
8118
8119impl IndexOperationMetadata {
8120 /// Creates a new default instance.
8121 pub fn new() -> Self {
8122 std::default::Default::default()
8123 }
8124
8125 /// Sets the value of [start_time][crate::model::IndexOperationMetadata::start_time].
8126 ///
8127 /// # Example
8128 /// ```ignore,no_run
8129 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8130 /// use wkt::Timestamp;
8131 /// let x = IndexOperationMetadata::new().set_start_time(Timestamp::default()/* use setters */);
8132 /// ```
8133 pub fn set_start_time<T>(mut self, v: T) -> Self
8134 where
8135 T: std::convert::Into<wkt::Timestamp>,
8136 {
8137 self.start_time = std::option::Option::Some(v.into());
8138 self
8139 }
8140
8141 /// Sets or clears the value of [start_time][crate::model::IndexOperationMetadata::start_time].
8142 ///
8143 /// # Example
8144 /// ```ignore,no_run
8145 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8146 /// use wkt::Timestamp;
8147 /// let x = IndexOperationMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
8148 /// let x = IndexOperationMetadata::new().set_or_clear_start_time(None::<Timestamp>);
8149 /// ```
8150 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8151 where
8152 T: std::convert::Into<wkt::Timestamp>,
8153 {
8154 self.start_time = v.map(|x| x.into());
8155 self
8156 }
8157
8158 /// Sets the value of [end_time][crate::model::IndexOperationMetadata::end_time].
8159 ///
8160 /// # Example
8161 /// ```ignore,no_run
8162 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8163 /// use wkt::Timestamp;
8164 /// let x = IndexOperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
8165 /// ```
8166 pub fn set_end_time<T>(mut self, v: T) -> Self
8167 where
8168 T: std::convert::Into<wkt::Timestamp>,
8169 {
8170 self.end_time = std::option::Option::Some(v.into());
8171 self
8172 }
8173
8174 /// Sets or clears the value of [end_time][crate::model::IndexOperationMetadata::end_time].
8175 ///
8176 /// # Example
8177 /// ```ignore,no_run
8178 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8179 /// use wkt::Timestamp;
8180 /// let x = IndexOperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
8181 /// let x = IndexOperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
8182 /// ```
8183 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8184 where
8185 T: std::convert::Into<wkt::Timestamp>,
8186 {
8187 self.end_time = v.map(|x| x.into());
8188 self
8189 }
8190
8191 /// Sets the value of [index][crate::model::IndexOperationMetadata::index].
8192 ///
8193 /// # Example
8194 /// ```ignore,no_run
8195 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8196 /// let x = IndexOperationMetadata::new().set_index("example");
8197 /// ```
8198 pub fn set_index<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8199 self.index = v.into();
8200 self
8201 }
8202
8203 /// Sets the value of [state][crate::model::IndexOperationMetadata::state].
8204 ///
8205 /// # Example
8206 /// ```ignore,no_run
8207 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8208 /// use google_cloud_firestore_admin_v1::model::OperationState;
8209 /// let x0 = IndexOperationMetadata::new().set_state(OperationState::Initializing);
8210 /// let x1 = IndexOperationMetadata::new().set_state(OperationState::Processing);
8211 /// let x2 = IndexOperationMetadata::new().set_state(OperationState::Cancelling);
8212 /// ```
8213 pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
8214 self.state = v.into();
8215 self
8216 }
8217
8218 /// Sets the value of [progress_documents][crate::model::IndexOperationMetadata::progress_documents].
8219 ///
8220 /// # Example
8221 /// ```ignore,no_run
8222 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8223 /// use google_cloud_firestore_admin_v1::model::Progress;
8224 /// let x = IndexOperationMetadata::new().set_progress_documents(Progress::default()/* use setters */);
8225 /// ```
8226 pub fn set_progress_documents<T>(mut self, v: T) -> Self
8227 where
8228 T: std::convert::Into<crate::model::Progress>,
8229 {
8230 self.progress_documents = std::option::Option::Some(v.into());
8231 self
8232 }
8233
8234 /// Sets or clears the value of [progress_documents][crate::model::IndexOperationMetadata::progress_documents].
8235 ///
8236 /// # Example
8237 /// ```ignore,no_run
8238 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8239 /// use google_cloud_firestore_admin_v1::model::Progress;
8240 /// let x = IndexOperationMetadata::new().set_or_clear_progress_documents(Some(Progress::default()/* use setters */));
8241 /// let x = IndexOperationMetadata::new().set_or_clear_progress_documents(None::<Progress>);
8242 /// ```
8243 pub fn set_or_clear_progress_documents<T>(mut self, v: std::option::Option<T>) -> Self
8244 where
8245 T: std::convert::Into<crate::model::Progress>,
8246 {
8247 self.progress_documents = v.map(|x| x.into());
8248 self
8249 }
8250
8251 /// Sets the value of [progress_bytes][crate::model::IndexOperationMetadata::progress_bytes].
8252 ///
8253 /// # Example
8254 /// ```ignore,no_run
8255 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8256 /// use google_cloud_firestore_admin_v1::model::Progress;
8257 /// let x = IndexOperationMetadata::new().set_progress_bytes(Progress::default()/* use setters */);
8258 /// ```
8259 pub fn set_progress_bytes<T>(mut self, v: T) -> Self
8260 where
8261 T: std::convert::Into<crate::model::Progress>,
8262 {
8263 self.progress_bytes = std::option::Option::Some(v.into());
8264 self
8265 }
8266
8267 /// Sets or clears the value of [progress_bytes][crate::model::IndexOperationMetadata::progress_bytes].
8268 ///
8269 /// # Example
8270 /// ```ignore,no_run
8271 /// # use google_cloud_firestore_admin_v1::model::IndexOperationMetadata;
8272 /// use google_cloud_firestore_admin_v1::model::Progress;
8273 /// let x = IndexOperationMetadata::new().set_or_clear_progress_bytes(Some(Progress::default()/* use setters */));
8274 /// let x = IndexOperationMetadata::new().set_or_clear_progress_bytes(None::<Progress>);
8275 /// ```
8276 pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
8277 where
8278 T: std::convert::Into<crate::model::Progress>,
8279 {
8280 self.progress_bytes = v.map(|x| x.into());
8281 self
8282 }
8283}
8284
8285impl wkt::message::Message for IndexOperationMetadata {
8286 fn typename() -> &'static str {
8287 "type.googleapis.com/google.firestore.admin.v1.IndexOperationMetadata"
8288 }
8289}
8290
8291/// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
8292/// results from
8293/// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
8294///
8295/// [google.firestore.admin.v1.FirestoreAdmin.UpdateField]: crate::client::FirestoreAdmin::update_field
8296/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8297#[derive(Clone, Default, PartialEq)]
8298#[non_exhaustive]
8299pub struct FieldOperationMetadata {
8300 /// The time this operation started.
8301 pub start_time: std::option::Option<wkt::Timestamp>,
8302
8303 /// The time this operation completed. Will be unset if operation still in
8304 /// progress.
8305 pub end_time: std::option::Option<wkt::Timestamp>,
8306
8307 /// The field resource that this operation is acting on. For example:
8308 /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
8309 pub field: std::string::String,
8310
8311 /// A list of
8312 /// [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta],
8313 /// which describe the intent of this operation.
8314 ///
8315 /// [google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta]: crate::model::field_operation_metadata::IndexConfigDelta
8316 pub index_config_deltas:
8317 std::vec::Vec<crate::model::field_operation_metadata::IndexConfigDelta>,
8318
8319 /// The state of the operation.
8320 pub state: crate::model::OperationState,
8321
8322 /// The progress, in documents, of this operation.
8323 pub progress_documents: std::option::Option<crate::model::Progress>,
8324
8325 /// The progress, in bytes, of this operation.
8326 pub progress_bytes: std::option::Option<crate::model::Progress>,
8327
8328 /// Describes the deltas of TTL configuration.
8329 pub ttl_config_delta:
8330 std::option::Option<crate::model::field_operation_metadata::TtlConfigDelta>,
8331
8332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8333}
8334
8335impl FieldOperationMetadata {
8336 /// Creates a new default instance.
8337 pub fn new() -> Self {
8338 std::default::Default::default()
8339 }
8340
8341 /// Sets the value of [start_time][crate::model::FieldOperationMetadata::start_time].
8342 ///
8343 /// # Example
8344 /// ```ignore,no_run
8345 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8346 /// use wkt::Timestamp;
8347 /// let x = FieldOperationMetadata::new().set_start_time(Timestamp::default()/* use setters */);
8348 /// ```
8349 pub fn set_start_time<T>(mut self, v: T) -> Self
8350 where
8351 T: std::convert::Into<wkt::Timestamp>,
8352 {
8353 self.start_time = std::option::Option::Some(v.into());
8354 self
8355 }
8356
8357 /// Sets or clears the value of [start_time][crate::model::FieldOperationMetadata::start_time].
8358 ///
8359 /// # Example
8360 /// ```ignore,no_run
8361 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8362 /// use wkt::Timestamp;
8363 /// let x = FieldOperationMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
8364 /// let x = FieldOperationMetadata::new().set_or_clear_start_time(None::<Timestamp>);
8365 /// ```
8366 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8367 where
8368 T: std::convert::Into<wkt::Timestamp>,
8369 {
8370 self.start_time = v.map(|x| x.into());
8371 self
8372 }
8373
8374 /// Sets the value of [end_time][crate::model::FieldOperationMetadata::end_time].
8375 ///
8376 /// # Example
8377 /// ```ignore,no_run
8378 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8379 /// use wkt::Timestamp;
8380 /// let x = FieldOperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
8381 /// ```
8382 pub fn set_end_time<T>(mut self, v: T) -> Self
8383 where
8384 T: std::convert::Into<wkt::Timestamp>,
8385 {
8386 self.end_time = std::option::Option::Some(v.into());
8387 self
8388 }
8389
8390 /// Sets or clears the value of [end_time][crate::model::FieldOperationMetadata::end_time].
8391 ///
8392 /// # Example
8393 /// ```ignore,no_run
8394 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8395 /// use wkt::Timestamp;
8396 /// let x = FieldOperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
8397 /// let x = FieldOperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
8398 /// ```
8399 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8400 where
8401 T: std::convert::Into<wkt::Timestamp>,
8402 {
8403 self.end_time = v.map(|x| x.into());
8404 self
8405 }
8406
8407 /// Sets the value of [field][crate::model::FieldOperationMetadata::field].
8408 ///
8409 /// # Example
8410 /// ```ignore,no_run
8411 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8412 /// let x = FieldOperationMetadata::new().set_field("example");
8413 /// ```
8414 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8415 self.field = v.into();
8416 self
8417 }
8418
8419 /// Sets the value of [index_config_deltas][crate::model::FieldOperationMetadata::index_config_deltas].
8420 ///
8421 /// # Example
8422 /// ```ignore,no_run
8423 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8424 /// use google_cloud_firestore_admin_v1::model::field_operation_metadata::IndexConfigDelta;
8425 /// let x = FieldOperationMetadata::new()
8426 /// .set_index_config_deltas([
8427 /// IndexConfigDelta::default()/* use setters */,
8428 /// IndexConfigDelta::default()/* use (different) setters */,
8429 /// ]);
8430 /// ```
8431 pub fn set_index_config_deltas<T, V>(mut self, v: T) -> Self
8432 where
8433 T: std::iter::IntoIterator<Item = V>,
8434 V: std::convert::Into<crate::model::field_operation_metadata::IndexConfigDelta>,
8435 {
8436 use std::iter::Iterator;
8437 self.index_config_deltas = v.into_iter().map(|i| i.into()).collect();
8438 self
8439 }
8440
8441 /// Sets the value of [state][crate::model::FieldOperationMetadata::state].
8442 ///
8443 /// # Example
8444 /// ```ignore,no_run
8445 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8446 /// use google_cloud_firestore_admin_v1::model::OperationState;
8447 /// let x0 = FieldOperationMetadata::new().set_state(OperationState::Initializing);
8448 /// let x1 = FieldOperationMetadata::new().set_state(OperationState::Processing);
8449 /// let x2 = FieldOperationMetadata::new().set_state(OperationState::Cancelling);
8450 /// ```
8451 pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
8452 self.state = v.into();
8453 self
8454 }
8455
8456 /// Sets the value of [progress_documents][crate::model::FieldOperationMetadata::progress_documents].
8457 ///
8458 /// # Example
8459 /// ```ignore,no_run
8460 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8461 /// use google_cloud_firestore_admin_v1::model::Progress;
8462 /// let x = FieldOperationMetadata::new().set_progress_documents(Progress::default()/* use setters */);
8463 /// ```
8464 pub fn set_progress_documents<T>(mut self, v: T) -> Self
8465 where
8466 T: std::convert::Into<crate::model::Progress>,
8467 {
8468 self.progress_documents = std::option::Option::Some(v.into());
8469 self
8470 }
8471
8472 /// Sets or clears the value of [progress_documents][crate::model::FieldOperationMetadata::progress_documents].
8473 ///
8474 /// # Example
8475 /// ```ignore,no_run
8476 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8477 /// use google_cloud_firestore_admin_v1::model::Progress;
8478 /// let x = FieldOperationMetadata::new().set_or_clear_progress_documents(Some(Progress::default()/* use setters */));
8479 /// let x = FieldOperationMetadata::new().set_or_clear_progress_documents(None::<Progress>);
8480 /// ```
8481 pub fn set_or_clear_progress_documents<T>(mut self, v: std::option::Option<T>) -> Self
8482 where
8483 T: std::convert::Into<crate::model::Progress>,
8484 {
8485 self.progress_documents = v.map(|x| x.into());
8486 self
8487 }
8488
8489 /// Sets the value of [progress_bytes][crate::model::FieldOperationMetadata::progress_bytes].
8490 ///
8491 /// # Example
8492 /// ```ignore,no_run
8493 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8494 /// use google_cloud_firestore_admin_v1::model::Progress;
8495 /// let x = FieldOperationMetadata::new().set_progress_bytes(Progress::default()/* use setters */);
8496 /// ```
8497 pub fn set_progress_bytes<T>(mut self, v: T) -> Self
8498 where
8499 T: std::convert::Into<crate::model::Progress>,
8500 {
8501 self.progress_bytes = std::option::Option::Some(v.into());
8502 self
8503 }
8504
8505 /// Sets or clears the value of [progress_bytes][crate::model::FieldOperationMetadata::progress_bytes].
8506 ///
8507 /// # Example
8508 /// ```ignore,no_run
8509 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8510 /// use google_cloud_firestore_admin_v1::model::Progress;
8511 /// let x = FieldOperationMetadata::new().set_or_clear_progress_bytes(Some(Progress::default()/* use setters */));
8512 /// let x = FieldOperationMetadata::new().set_or_clear_progress_bytes(None::<Progress>);
8513 /// ```
8514 pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
8515 where
8516 T: std::convert::Into<crate::model::Progress>,
8517 {
8518 self.progress_bytes = v.map(|x| x.into());
8519 self
8520 }
8521
8522 /// Sets the value of [ttl_config_delta][crate::model::FieldOperationMetadata::ttl_config_delta].
8523 ///
8524 /// # Example
8525 /// ```ignore,no_run
8526 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8527 /// use google_cloud_firestore_admin_v1::model::field_operation_metadata::TtlConfigDelta;
8528 /// let x = FieldOperationMetadata::new().set_ttl_config_delta(TtlConfigDelta::default()/* use setters */);
8529 /// ```
8530 pub fn set_ttl_config_delta<T>(mut self, v: T) -> Self
8531 where
8532 T: std::convert::Into<crate::model::field_operation_metadata::TtlConfigDelta>,
8533 {
8534 self.ttl_config_delta = std::option::Option::Some(v.into());
8535 self
8536 }
8537
8538 /// Sets or clears the value of [ttl_config_delta][crate::model::FieldOperationMetadata::ttl_config_delta].
8539 ///
8540 /// # Example
8541 /// ```ignore,no_run
8542 /// # use google_cloud_firestore_admin_v1::model::FieldOperationMetadata;
8543 /// use google_cloud_firestore_admin_v1::model::field_operation_metadata::TtlConfigDelta;
8544 /// let x = FieldOperationMetadata::new().set_or_clear_ttl_config_delta(Some(TtlConfigDelta::default()/* use setters */));
8545 /// let x = FieldOperationMetadata::new().set_or_clear_ttl_config_delta(None::<TtlConfigDelta>);
8546 /// ```
8547 pub fn set_or_clear_ttl_config_delta<T>(mut self, v: std::option::Option<T>) -> Self
8548 where
8549 T: std::convert::Into<crate::model::field_operation_metadata::TtlConfigDelta>,
8550 {
8551 self.ttl_config_delta = v.map(|x| x.into());
8552 self
8553 }
8554}
8555
8556impl wkt::message::Message for FieldOperationMetadata {
8557 fn typename() -> &'static str {
8558 "type.googleapis.com/google.firestore.admin.v1.FieldOperationMetadata"
8559 }
8560}
8561
8562/// Defines additional types related to [FieldOperationMetadata].
8563pub mod field_operation_metadata {
8564 #[allow(unused_imports)]
8565 use super::*;
8566
8567 /// Information about an index configuration change.
8568 #[derive(Clone, Default, PartialEq)]
8569 #[non_exhaustive]
8570 pub struct IndexConfigDelta {
8571 /// Specifies how the index is changing.
8572 pub change_type: crate::model::field_operation_metadata::index_config_delta::ChangeType,
8573
8574 /// The index being changed.
8575 pub index: std::option::Option<crate::model::Index>,
8576
8577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8578 }
8579
8580 impl IndexConfigDelta {
8581 /// Creates a new default instance.
8582 pub fn new() -> Self {
8583 std::default::Default::default()
8584 }
8585
8586 /// Sets the value of [change_type][crate::model::field_operation_metadata::IndexConfigDelta::change_type].
8587 ///
8588 /// # Example
8589 /// ```ignore,no_run
8590 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::IndexConfigDelta;
8591 /// use google_cloud_firestore_admin_v1::model::field_operation_metadata::index_config_delta::ChangeType;
8592 /// let x0 = IndexConfigDelta::new().set_change_type(ChangeType::Add);
8593 /// let x1 = IndexConfigDelta::new().set_change_type(ChangeType::Remove);
8594 /// ```
8595 pub fn set_change_type<
8596 T: std::convert::Into<
8597 crate::model::field_operation_metadata::index_config_delta::ChangeType,
8598 >,
8599 >(
8600 mut self,
8601 v: T,
8602 ) -> Self {
8603 self.change_type = v.into();
8604 self
8605 }
8606
8607 /// Sets the value of [index][crate::model::field_operation_metadata::IndexConfigDelta::index].
8608 ///
8609 /// # Example
8610 /// ```ignore,no_run
8611 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::IndexConfigDelta;
8612 /// use google_cloud_firestore_admin_v1::model::Index;
8613 /// let x = IndexConfigDelta::new().set_index(Index::default()/* use setters */);
8614 /// ```
8615 pub fn set_index<T>(mut self, v: T) -> Self
8616 where
8617 T: std::convert::Into<crate::model::Index>,
8618 {
8619 self.index = std::option::Option::Some(v.into());
8620 self
8621 }
8622
8623 /// Sets or clears the value of [index][crate::model::field_operation_metadata::IndexConfigDelta::index].
8624 ///
8625 /// # Example
8626 /// ```ignore,no_run
8627 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::IndexConfigDelta;
8628 /// use google_cloud_firestore_admin_v1::model::Index;
8629 /// let x = IndexConfigDelta::new().set_or_clear_index(Some(Index::default()/* use setters */));
8630 /// let x = IndexConfigDelta::new().set_or_clear_index(None::<Index>);
8631 /// ```
8632 pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
8633 where
8634 T: std::convert::Into<crate::model::Index>,
8635 {
8636 self.index = v.map(|x| x.into());
8637 self
8638 }
8639 }
8640
8641 impl wkt::message::Message for IndexConfigDelta {
8642 fn typename() -> &'static str {
8643 "type.googleapis.com/google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta"
8644 }
8645 }
8646
8647 /// Defines additional types related to [IndexConfigDelta].
8648 pub mod index_config_delta {
8649 #[allow(unused_imports)]
8650 use super::*;
8651
8652 /// Specifies how the index is changing.
8653 ///
8654 /// # Working with unknown values
8655 ///
8656 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8657 /// additional enum variants at any time. Adding new variants is not considered
8658 /// a breaking change. Applications should write their code in anticipation of:
8659 ///
8660 /// - New values appearing in future releases of the client library, **and**
8661 /// - New values received dynamically, without application changes.
8662 ///
8663 /// Please consult the [Working with enums] section in the user guide for some
8664 /// guidelines.
8665 ///
8666 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8667 #[derive(Clone, Debug, PartialEq)]
8668 #[non_exhaustive]
8669 pub enum ChangeType {
8670 /// The type of change is not specified or known.
8671 Unspecified,
8672 /// The single field index is being added.
8673 Add,
8674 /// The single field index is being removed.
8675 Remove,
8676 /// If set, the enum was initialized with an unknown value.
8677 ///
8678 /// Applications can examine the value using [ChangeType::value] or
8679 /// [ChangeType::name].
8680 UnknownValue(change_type::UnknownValue),
8681 }
8682
8683 #[doc(hidden)]
8684 pub mod change_type {
8685 #[allow(unused_imports)]
8686 use super::*;
8687 #[derive(Clone, Debug, PartialEq)]
8688 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8689 }
8690
8691 impl ChangeType {
8692 /// Gets the enum value.
8693 ///
8694 /// Returns `None` if the enum contains an unknown value deserialized from
8695 /// the string representation of enums.
8696 pub fn value(&self) -> std::option::Option<i32> {
8697 match self {
8698 Self::Unspecified => std::option::Option::Some(0),
8699 Self::Add => std::option::Option::Some(1),
8700 Self::Remove => std::option::Option::Some(2),
8701 Self::UnknownValue(u) => u.0.value(),
8702 }
8703 }
8704
8705 /// Gets the enum value as a string.
8706 ///
8707 /// Returns `None` if the enum contains an unknown value deserialized from
8708 /// the integer representation of enums.
8709 pub fn name(&self) -> std::option::Option<&str> {
8710 match self {
8711 Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
8712 Self::Add => std::option::Option::Some("ADD"),
8713 Self::Remove => std::option::Option::Some("REMOVE"),
8714 Self::UnknownValue(u) => u.0.name(),
8715 }
8716 }
8717 }
8718
8719 impl std::default::Default for ChangeType {
8720 fn default() -> Self {
8721 use std::convert::From;
8722 Self::from(0)
8723 }
8724 }
8725
8726 impl std::fmt::Display for ChangeType {
8727 fn fmt(
8728 &self,
8729 f: &mut std::fmt::Formatter<'_>,
8730 ) -> std::result::Result<(), std::fmt::Error> {
8731 wkt::internal::display_enum(f, self.name(), self.value())
8732 }
8733 }
8734
8735 impl std::convert::From<i32> for ChangeType {
8736 fn from(value: i32) -> Self {
8737 match value {
8738 0 => Self::Unspecified,
8739 1 => Self::Add,
8740 2 => Self::Remove,
8741 _ => Self::UnknownValue(change_type::UnknownValue(
8742 wkt::internal::UnknownEnumValue::Integer(value),
8743 )),
8744 }
8745 }
8746 }
8747
8748 impl std::convert::From<&str> for ChangeType {
8749 fn from(value: &str) -> Self {
8750 use std::string::ToString;
8751 match value {
8752 "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
8753 "ADD" => Self::Add,
8754 "REMOVE" => Self::Remove,
8755 _ => Self::UnknownValue(change_type::UnknownValue(
8756 wkt::internal::UnknownEnumValue::String(value.to_string()),
8757 )),
8758 }
8759 }
8760 }
8761
8762 impl serde::ser::Serialize for ChangeType {
8763 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8764 where
8765 S: serde::Serializer,
8766 {
8767 match self {
8768 Self::Unspecified => serializer.serialize_i32(0),
8769 Self::Add => serializer.serialize_i32(1),
8770 Self::Remove => serializer.serialize_i32(2),
8771 Self::UnknownValue(u) => u.0.serialize(serializer),
8772 }
8773 }
8774 }
8775
8776 impl<'de> serde::de::Deserialize<'de> for ChangeType {
8777 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8778 where
8779 D: serde::Deserializer<'de>,
8780 {
8781 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
8782 ".google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType",
8783 ))
8784 }
8785 }
8786 }
8787
8788 /// Information about a TTL configuration change.
8789 #[derive(Clone, Default, PartialEq)]
8790 #[non_exhaustive]
8791 pub struct TtlConfigDelta {
8792 /// Specifies how the TTL configuration is changing.
8793 pub change_type: crate::model::field_operation_metadata::ttl_config_delta::ChangeType,
8794
8795 /// The offset, relative to the timestamp value in the TTL-enabled field,
8796 /// used determine the document's expiration time.
8797 pub expiration_offset: std::option::Option<wkt::Duration>,
8798
8799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8800 }
8801
8802 impl TtlConfigDelta {
8803 /// Creates a new default instance.
8804 pub fn new() -> Self {
8805 std::default::Default::default()
8806 }
8807
8808 /// Sets the value of [change_type][crate::model::field_operation_metadata::TtlConfigDelta::change_type].
8809 ///
8810 /// # Example
8811 /// ```ignore,no_run
8812 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::TtlConfigDelta;
8813 /// use google_cloud_firestore_admin_v1::model::field_operation_metadata::ttl_config_delta::ChangeType;
8814 /// let x0 = TtlConfigDelta::new().set_change_type(ChangeType::Add);
8815 /// let x1 = TtlConfigDelta::new().set_change_type(ChangeType::Remove);
8816 /// ```
8817 pub fn set_change_type<
8818 T: std::convert::Into<
8819 crate::model::field_operation_metadata::ttl_config_delta::ChangeType,
8820 >,
8821 >(
8822 mut self,
8823 v: T,
8824 ) -> Self {
8825 self.change_type = v.into();
8826 self
8827 }
8828
8829 /// Sets the value of [expiration_offset][crate::model::field_operation_metadata::TtlConfigDelta::expiration_offset].
8830 ///
8831 /// # Example
8832 /// ```ignore,no_run
8833 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::TtlConfigDelta;
8834 /// use wkt::Duration;
8835 /// let x = TtlConfigDelta::new().set_expiration_offset(Duration::default()/* use setters */);
8836 /// ```
8837 pub fn set_expiration_offset<T>(mut self, v: T) -> Self
8838 where
8839 T: std::convert::Into<wkt::Duration>,
8840 {
8841 self.expiration_offset = std::option::Option::Some(v.into());
8842 self
8843 }
8844
8845 /// Sets or clears the value of [expiration_offset][crate::model::field_operation_metadata::TtlConfigDelta::expiration_offset].
8846 ///
8847 /// # Example
8848 /// ```ignore,no_run
8849 /// # use google_cloud_firestore_admin_v1::model::field_operation_metadata::TtlConfigDelta;
8850 /// use wkt::Duration;
8851 /// let x = TtlConfigDelta::new().set_or_clear_expiration_offset(Some(Duration::default()/* use setters */));
8852 /// let x = TtlConfigDelta::new().set_or_clear_expiration_offset(None::<Duration>);
8853 /// ```
8854 pub fn set_or_clear_expiration_offset<T>(mut self, v: std::option::Option<T>) -> Self
8855 where
8856 T: std::convert::Into<wkt::Duration>,
8857 {
8858 self.expiration_offset = v.map(|x| x.into());
8859 self
8860 }
8861 }
8862
8863 impl wkt::message::Message for TtlConfigDelta {
8864 fn typename() -> &'static str {
8865 "type.googleapis.com/google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta"
8866 }
8867 }
8868
8869 /// Defines additional types related to [TtlConfigDelta].
8870 pub mod ttl_config_delta {
8871 #[allow(unused_imports)]
8872 use super::*;
8873
8874 /// Specifies how the TTL config is changing.
8875 ///
8876 /// # Working with unknown values
8877 ///
8878 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8879 /// additional enum variants at any time. Adding new variants is not considered
8880 /// a breaking change. Applications should write their code in anticipation of:
8881 ///
8882 /// - New values appearing in future releases of the client library, **and**
8883 /// - New values received dynamically, without application changes.
8884 ///
8885 /// Please consult the [Working with enums] section in the user guide for some
8886 /// guidelines.
8887 ///
8888 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8889 #[derive(Clone, Debug, PartialEq)]
8890 #[non_exhaustive]
8891 pub enum ChangeType {
8892 /// The type of change is not specified or known.
8893 Unspecified,
8894 /// The TTL config is being added.
8895 Add,
8896 /// The TTL config is being removed.
8897 Remove,
8898 /// If set, the enum was initialized with an unknown value.
8899 ///
8900 /// Applications can examine the value using [ChangeType::value] or
8901 /// [ChangeType::name].
8902 UnknownValue(change_type::UnknownValue),
8903 }
8904
8905 #[doc(hidden)]
8906 pub mod change_type {
8907 #[allow(unused_imports)]
8908 use super::*;
8909 #[derive(Clone, Debug, PartialEq)]
8910 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8911 }
8912
8913 impl ChangeType {
8914 /// Gets the enum value.
8915 ///
8916 /// Returns `None` if the enum contains an unknown value deserialized from
8917 /// the string representation of enums.
8918 pub fn value(&self) -> std::option::Option<i32> {
8919 match self {
8920 Self::Unspecified => std::option::Option::Some(0),
8921 Self::Add => std::option::Option::Some(1),
8922 Self::Remove => std::option::Option::Some(2),
8923 Self::UnknownValue(u) => u.0.value(),
8924 }
8925 }
8926
8927 /// Gets the enum value as a string.
8928 ///
8929 /// Returns `None` if the enum contains an unknown value deserialized from
8930 /// the integer representation of enums.
8931 pub fn name(&self) -> std::option::Option<&str> {
8932 match self {
8933 Self::Unspecified => std::option::Option::Some("CHANGE_TYPE_UNSPECIFIED"),
8934 Self::Add => std::option::Option::Some("ADD"),
8935 Self::Remove => std::option::Option::Some("REMOVE"),
8936 Self::UnknownValue(u) => u.0.name(),
8937 }
8938 }
8939 }
8940
8941 impl std::default::Default for ChangeType {
8942 fn default() -> Self {
8943 use std::convert::From;
8944 Self::from(0)
8945 }
8946 }
8947
8948 impl std::fmt::Display for ChangeType {
8949 fn fmt(
8950 &self,
8951 f: &mut std::fmt::Formatter<'_>,
8952 ) -> std::result::Result<(), std::fmt::Error> {
8953 wkt::internal::display_enum(f, self.name(), self.value())
8954 }
8955 }
8956
8957 impl std::convert::From<i32> for ChangeType {
8958 fn from(value: i32) -> Self {
8959 match value {
8960 0 => Self::Unspecified,
8961 1 => Self::Add,
8962 2 => Self::Remove,
8963 _ => Self::UnknownValue(change_type::UnknownValue(
8964 wkt::internal::UnknownEnumValue::Integer(value),
8965 )),
8966 }
8967 }
8968 }
8969
8970 impl std::convert::From<&str> for ChangeType {
8971 fn from(value: &str) -> Self {
8972 use std::string::ToString;
8973 match value {
8974 "CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
8975 "ADD" => Self::Add,
8976 "REMOVE" => Self::Remove,
8977 _ => Self::UnknownValue(change_type::UnknownValue(
8978 wkt::internal::UnknownEnumValue::String(value.to_string()),
8979 )),
8980 }
8981 }
8982 }
8983
8984 impl serde::ser::Serialize for ChangeType {
8985 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8986 where
8987 S: serde::Serializer,
8988 {
8989 match self {
8990 Self::Unspecified => serializer.serialize_i32(0),
8991 Self::Add => serializer.serialize_i32(1),
8992 Self::Remove => serializer.serialize_i32(2),
8993 Self::UnknownValue(u) => u.0.serialize(serializer),
8994 }
8995 }
8996 }
8997
8998 impl<'de> serde::de::Deserialize<'de> for ChangeType {
8999 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9000 where
9001 D: serde::Deserializer<'de>,
9002 {
9003 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChangeType>::new(
9004 ".google.firestore.admin.v1.FieldOperationMetadata.TtlConfigDelta.ChangeType",
9005 ))
9006 }
9007 }
9008 }
9009}
9010
9011/// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
9012/// results from
9013/// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
9014///
9015/// [google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]: crate::client::FirestoreAdmin::export_documents
9016/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9017#[derive(Clone, Default, PartialEq)]
9018#[non_exhaustive]
9019pub struct ExportDocumentsMetadata {
9020 /// The time this operation started.
9021 pub start_time: std::option::Option<wkt::Timestamp>,
9022
9023 /// The time this operation completed. Will be unset if operation still in
9024 /// progress.
9025 pub end_time: std::option::Option<wkt::Timestamp>,
9026
9027 /// The state of the export operation.
9028 pub operation_state: crate::model::OperationState,
9029
9030 /// The progress, in documents, of this operation.
9031 pub progress_documents: std::option::Option<crate::model::Progress>,
9032
9033 /// The progress, in bytes, of this operation.
9034 pub progress_bytes: std::option::Option<crate::model::Progress>,
9035
9036 /// Which collection IDs are being exported.
9037 pub collection_ids: std::vec::Vec<std::string::String>,
9038
9039 /// Where the documents are being exported to.
9040 pub output_uri_prefix: std::string::String,
9041
9042 /// Which namespace IDs are being exported.
9043 pub namespace_ids: std::vec::Vec<std::string::String>,
9044
9045 /// The timestamp that corresponds to the version of the database that is being
9046 /// exported. If unspecified, there are no guarantees about the consistency of
9047 /// the documents being exported.
9048 pub snapshot_time: std::option::Option<wkt::Timestamp>,
9049
9050 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9051}
9052
9053impl ExportDocumentsMetadata {
9054 /// Creates a new default instance.
9055 pub fn new() -> Self {
9056 std::default::Default::default()
9057 }
9058
9059 /// Sets the value of [start_time][crate::model::ExportDocumentsMetadata::start_time].
9060 ///
9061 /// # Example
9062 /// ```ignore,no_run
9063 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9064 /// use wkt::Timestamp;
9065 /// let x = ExportDocumentsMetadata::new().set_start_time(Timestamp::default()/* use setters */);
9066 /// ```
9067 pub fn set_start_time<T>(mut self, v: T) -> Self
9068 where
9069 T: std::convert::Into<wkt::Timestamp>,
9070 {
9071 self.start_time = std::option::Option::Some(v.into());
9072 self
9073 }
9074
9075 /// Sets or clears the value of [start_time][crate::model::ExportDocumentsMetadata::start_time].
9076 ///
9077 /// # Example
9078 /// ```ignore,no_run
9079 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9080 /// use wkt::Timestamp;
9081 /// let x = ExportDocumentsMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9082 /// let x = ExportDocumentsMetadata::new().set_or_clear_start_time(None::<Timestamp>);
9083 /// ```
9084 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9085 where
9086 T: std::convert::Into<wkt::Timestamp>,
9087 {
9088 self.start_time = v.map(|x| x.into());
9089 self
9090 }
9091
9092 /// Sets the value of [end_time][crate::model::ExportDocumentsMetadata::end_time].
9093 ///
9094 /// # Example
9095 /// ```ignore,no_run
9096 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9097 /// use wkt::Timestamp;
9098 /// let x = ExportDocumentsMetadata::new().set_end_time(Timestamp::default()/* use setters */);
9099 /// ```
9100 pub fn set_end_time<T>(mut self, v: T) -> Self
9101 where
9102 T: std::convert::Into<wkt::Timestamp>,
9103 {
9104 self.end_time = std::option::Option::Some(v.into());
9105 self
9106 }
9107
9108 /// Sets or clears the value of [end_time][crate::model::ExportDocumentsMetadata::end_time].
9109 ///
9110 /// # Example
9111 /// ```ignore,no_run
9112 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9113 /// use wkt::Timestamp;
9114 /// let x = ExportDocumentsMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9115 /// let x = ExportDocumentsMetadata::new().set_or_clear_end_time(None::<Timestamp>);
9116 /// ```
9117 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9118 where
9119 T: std::convert::Into<wkt::Timestamp>,
9120 {
9121 self.end_time = v.map(|x| x.into());
9122 self
9123 }
9124
9125 /// Sets the value of [operation_state][crate::model::ExportDocumentsMetadata::operation_state].
9126 ///
9127 /// # Example
9128 /// ```ignore,no_run
9129 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9130 /// use google_cloud_firestore_admin_v1::model::OperationState;
9131 /// let x0 = ExportDocumentsMetadata::new().set_operation_state(OperationState::Initializing);
9132 /// let x1 = ExportDocumentsMetadata::new().set_operation_state(OperationState::Processing);
9133 /// let x2 = ExportDocumentsMetadata::new().set_operation_state(OperationState::Cancelling);
9134 /// ```
9135 pub fn set_operation_state<T: std::convert::Into<crate::model::OperationState>>(
9136 mut self,
9137 v: T,
9138 ) -> Self {
9139 self.operation_state = v.into();
9140 self
9141 }
9142
9143 /// Sets the value of [progress_documents][crate::model::ExportDocumentsMetadata::progress_documents].
9144 ///
9145 /// # Example
9146 /// ```ignore,no_run
9147 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9148 /// use google_cloud_firestore_admin_v1::model::Progress;
9149 /// let x = ExportDocumentsMetadata::new().set_progress_documents(Progress::default()/* use setters */);
9150 /// ```
9151 pub fn set_progress_documents<T>(mut self, v: T) -> Self
9152 where
9153 T: std::convert::Into<crate::model::Progress>,
9154 {
9155 self.progress_documents = std::option::Option::Some(v.into());
9156 self
9157 }
9158
9159 /// Sets or clears the value of [progress_documents][crate::model::ExportDocumentsMetadata::progress_documents].
9160 ///
9161 /// # Example
9162 /// ```ignore,no_run
9163 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9164 /// use google_cloud_firestore_admin_v1::model::Progress;
9165 /// let x = ExportDocumentsMetadata::new().set_or_clear_progress_documents(Some(Progress::default()/* use setters */));
9166 /// let x = ExportDocumentsMetadata::new().set_or_clear_progress_documents(None::<Progress>);
9167 /// ```
9168 pub fn set_or_clear_progress_documents<T>(mut self, v: std::option::Option<T>) -> Self
9169 where
9170 T: std::convert::Into<crate::model::Progress>,
9171 {
9172 self.progress_documents = v.map(|x| x.into());
9173 self
9174 }
9175
9176 /// Sets the value of [progress_bytes][crate::model::ExportDocumentsMetadata::progress_bytes].
9177 ///
9178 /// # Example
9179 /// ```ignore,no_run
9180 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9181 /// use google_cloud_firestore_admin_v1::model::Progress;
9182 /// let x = ExportDocumentsMetadata::new().set_progress_bytes(Progress::default()/* use setters */);
9183 /// ```
9184 pub fn set_progress_bytes<T>(mut self, v: T) -> Self
9185 where
9186 T: std::convert::Into<crate::model::Progress>,
9187 {
9188 self.progress_bytes = std::option::Option::Some(v.into());
9189 self
9190 }
9191
9192 /// Sets or clears the value of [progress_bytes][crate::model::ExportDocumentsMetadata::progress_bytes].
9193 ///
9194 /// # Example
9195 /// ```ignore,no_run
9196 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9197 /// use google_cloud_firestore_admin_v1::model::Progress;
9198 /// let x = ExportDocumentsMetadata::new().set_or_clear_progress_bytes(Some(Progress::default()/* use setters */));
9199 /// let x = ExportDocumentsMetadata::new().set_or_clear_progress_bytes(None::<Progress>);
9200 /// ```
9201 pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
9202 where
9203 T: std::convert::Into<crate::model::Progress>,
9204 {
9205 self.progress_bytes = v.map(|x| x.into());
9206 self
9207 }
9208
9209 /// Sets the value of [collection_ids][crate::model::ExportDocumentsMetadata::collection_ids].
9210 ///
9211 /// # Example
9212 /// ```ignore,no_run
9213 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9214 /// let x = ExportDocumentsMetadata::new().set_collection_ids(["a", "b", "c"]);
9215 /// ```
9216 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
9217 where
9218 T: std::iter::IntoIterator<Item = V>,
9219 V: std::convert::Into<std::string::String>,
9220 {
9221 use std::iter::Iterator;
9222 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
9223 self
9224 }
9225
9226 /// Sets the value of [output_uri_prefix][crate::model::ExportDocumentsMetadata::output_uri_prefix].
9227 ///
9228 /// # Example
9229 /// ```ignore,no_run
9230 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9231 /// let x = ExportDocumentsMetadata::new().set_output_uri_prefix("example");
9232 /// ```
9233 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9234 mut self,
9235 v: T,
9236 ) -> Self {
9237 self.output_uri_prefix = v.into();
9238 self
9239 }
9240
9241 /// Sets the value of [namespace_ids][crate::model::ExportDocumentsMetadata::namespace_ids].
9242 ///
9243 /// # Example
9244 /// ```ignore,no_run
9245 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9246 /// let x = ExportDocumentsMetadata::new().set_namespace_ids(["a", "b", "c"]);
9247 /// ```
9248 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
9249 where
9250 T: std::iter::IntoIterator<Item = V>,
9251 V: std::convert::Into<std::string::String>,
9252 {
9253 use std::iter::Iterator;
9254 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
9255 self
9256 }
9257
9258 /// Sets the value of [snapshot_time][crate::model::ExportDocumentsMetadata::snapshot_time].
9259 ///
9260 /// # Example
9261 /// ```ignore,no_run
9262 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9263 /// use wkt::Timestamp;
9264 /// let x = ExportDocumentsMetadata::new().set_snapshot_time(Timestamp::default()/* use setters */);
9265 /// ```
9266 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
9267 where
9268 T: std::convert::Into<wkt::Timestamp>,
9269 {
9270 self.snapshot_time = std::option::Option::Some(v.into());
9271 self
9272 }
9273
9274 /// Sets or clears the value of [snapshot_time][crate::model::ExportDocumentsMetadata::snapshot_time].
9275 ///
9276 /// # Example
9277 /// ```ignore,no_run
9278 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsMetadata;
9279 /// use wkt::Timestamp;
9280 /// let x = ExportDocumentsMetadata::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
9281 /// let x = ExportDocumentsMetadata::new().set_or_clear_snapshot_time(None::<Timestamp>);
9282 /// ```
9283 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
9284 where
9285 T: std::convert::Into<wkt::Timestamp>,
9286 {
9287 self.snapshot_time = v.map(|x| x.into());
9288 self
9289 }
9290}
9291
9292impl wkt::message::Message for ExportDocumentsMetadata {
9293 fn typename() -> &'static str {
9294 "type.googleapis.com/google.firestore.admin.v1.ExportDocumentsMetadata"
9295 }
9296}
9297
9298/// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
9299/// results from
9300/// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
9301///
9302/// [google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]: crate::client::FirestoreAdmin::import_documents
9303/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9304#[derive(Clone, Default, PartialEq)]
9305#[non_exhaustive]
9306pub struct ImportDocumentsMetadata {
9307 /// The time this operation started.
9308 pub start_time: std::option::Option<wkt::Timestamp>,
9309
9310 /// The time this operation completed. Will be unset if operation still in
9311 /// progress.
9312 pub end_time: std::option::Option<wkt::Timestamp>,
9313
9314 /// The state of the import operation.
9315 pub operation_state: crate::model::OperationState,
9316
9317 /// The progress, in documents, of this operation.
9318 pub progress_documents: std::option::Option<crate::model::Progress>,
9319
9320 /// The progress, in bytes, of this operation.
9321 pub progress_bytes: std::option::Option<crate::model::Progress>,
9322
9323 /// Which collection IDs are being imported.
9324 pub collection_ids: std::vec::Vec<std::string::String>,
9325
9326 /// The location of the documents being imported.
9327 pub input_uri_prefix: std::string::String,
9328
9329 /// Which namespace IDs are being imported.
9330 pub namespace_ids: std::vec::Vec<std::string::String>,
9331
9332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9333}
9334
9335impl ImportDocumentsMetadata {
9336 /// Creates a new default instance.
9337 pub fn new() -> Self {
9338 std::default::Default::default()
9339 }
9340
9341 /// Sets the value of [start_time][crate::model::ImportDocumentsMetadata::start_time].
9342 ///
9343 /// # Example
9344 /// ```ignore,no_run
9345 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9346 /// use wkt::Timestamp;
9347 /// let x = ImportDocumentsMetadata::new().set_start_time(Timestamp::default()/* use setters */);
9348 /// ```
9349 pub fn set_start_time<T>(mut self, v: T) -> Self
9350 where
9351 T: std::convert::Into<wkt::Timestamp>,
9352 {
9353 self.start_time = std::option::Option::Some(v.into());
9354 self
9355 }
9356
9357 /// Sets or clears the value of [start_time][crate::model::ImportDocumentsMetadata::start_time].
9358 ///
9359 /// # Example
9360 /// ```ignore,no_run
9361 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9362 /// use wkt::Timestamp;
9363 /// let x = ImportDocumentsMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9364 /// let x = ImportDocumentsMetadata::new().set_or_clear_start_time(None::<Timestamp>);
9365 /// ```
9366 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9367 where
9368 T: std::convert::Into<wkt::Timestamp>,
9369 {
9370 self.start_time = v.map(|x| x.into());
9371 self
9372 }
9373
9374 /// Sets the value of [end_time][crate::model::ImportDocumentsMetadata::end_time].
9375 ///
9376 /// # Example
9377 /// ```ignore,no_run
9378 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9379 /// use wkt::Timestamp;
9380 /// let x = ImportDocumentsMetadata::new().set_end_time(Timestamp::default()/* use setters */);
9381 /// ```
9382 pub fn set_end_time<T>(mut self, v: T) -> Self
9383 where
9384 T: std::convert::Into<wkt::Timestamp>,
9385 {
9386 self.end_time = std::option::Option::Some(v.into());
9387 self
9388 }
9389
9390 /// Sets or clears the value of [end_time][crate::model::ImportDocumentsMetadata::end_time].
9391 ///
9392 /// # Example
9393 /// ```ignore,no_run
9394 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9395 /// use wkt::Timestamp;
9396 /// let x = ImportDocumentsMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9397 /// let x = ImportDocumentsMetadata::new().set_or_clear_end_time(None::<Timestamp>);
9398 /// ```
9399 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9400 where
9401 T: std::convert::Into<wkt::Timestamp>,
9402 {
9403 self.end_time = v.map(|x| x.into());
9404 self
9405 }
9406
9407 /// Sets the value of [operation_state][crate::model::ImportDocumentsMetadata::operation_state].
9408 ///
9409 /// # Example
9410 /// ```ignore,no_run
9411 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9412 /// use google_cloud_firestore_admin_v1::model::OperationState;
9413 /// let x0 = ImportDocumentsMetadata::new().set_operation_state(OperationState::Initializing);
9414 /// let x1 = ImportDocumentsMetadata::new().set_operation_state(OperationState::Processing);
9415 /// let x2 = ImportDocumentsMetadata::new().set_operation_state(OperationState::Cancelling);
9416 /// ```
9417 pub fn set_operation_state<T: std::convert::Into<crate::model::OperationState>>(
9418 mut self,
9419 v: T,
9420 ) -> Self {
9421 self.operation_state = v.into();
9422 self
9423 }
9424
9425 /// Sets the value of [progress_documents][crate::model::ImportDocumentsMetadata::progress_documents].
9426 ///
9427 /// # Example
9428 /// ```ignore,no_run
9429 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9430 /// use google_cloud_firestore_admin_v1::model::Progress;
9431 /// let x = ImportDocumentsMetadata::new().set_progress_documents(Progress::default()/* use setters */);
9432 /// ```
9433 pub fn set_progress_documents<T>(mut self, v: T) -> Self
9434 where
9435 T: std::convert::Into<crate::model::Progress>,
9436 {
9437 self.progress_documents = std::option::Option::Some(v.into());
9438 self
9439 }
9440
9441 /// Sets or clears the value of [progress_documents][crate::model::ImportDocumentsMetadata::progress_documents].
9442 ///
9443 /// # Example
9444 /// ```ignore,no_run
9445 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9446 /// use google_cloud_firestore_admin_v1::model::Progress;
9447 /// let x = ImportDocumentsMetadata::new().set_or_clear_progress_documents(Some(Progress::default()/* use setters */));
9448 /// let x = ImportDocumentsMetadata::new().set_or_clear_progress_documents(None::<Progress>);
9449 /// ```
9450 pub fn set_or_clear_progress_documents<T>(mut self, v: std::option::Option<T>) -> Self
9451 where
9452 T: std::convert::Into<crate::model::Progress>,
9453 {
9454 self.progress_documents = v.map(|x| x.into());
9455 self
9456 }
9457
9458 /// Sets the value of [progress_bytes][crate::model::ImportDocumentsMetadata::progress_bytes].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9463 /// use google_cloud_firestore_admin_v1::model::Progress;
9464 /// let x = ImportDocumentsMetadata::new().set_progress_bytes(Progress::default()/* use setters */);
9465 /// ```
9466 pub fn set_progress_bytes<T>(mut self, v: T) -> Self
9467 where
9468 T: std::convert::Into<crate::model::Progress>,
9469 {
9470 self.progress_bytes = std::option::Option::Some(v.into());
9471 self
9472 }
9473
9474 /// Sets or clears the value of [progress_bytes][crate::model::ImportDocumentsMetadata::progress_bytes].
9475 ///
9476 /// # Example
9477 /// ```ignore,no_run
9478 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9479 /// use google_cloud_firestore_admin_v1::model::Progress;
9480 /// let x = ImportDocumentsMetadata::new().set_or_clear_progress_bytes(Some(Progress::default()/* use setters */));
9481 /// let x = ImportDocumentsMetadata::new().set_or_clear_progress_bytes(None::<Progress>);
9482 /// ```
9483 pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
9484 where
9485 T: std::convert::Into<crate::model::Progress>,
9486 {
9487 self.progress_bytes = v.map(|x| x.into());
9488 self
9489 }
9490
9491 /// Sets the value of [collection_ids][crate::model::ImportDocumentsMetadata::collection_ids].
9492 ///
9493 /// # Example
9494 /// ```ignore,no_run
9495 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9496 /// let x = ImportDocumentsMetadata::new().set_collection_ids(["a", "b", "c"]);
9497 /// ```
9498 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
9499 where
9500 T: std::iter::IntoIterator<Item = V>,
9501 V: std::convert::Into<std::string::String>,
9502 {
9503 use std::iter::Iterator;
9504 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
9505 self
9506 }
9507
9508 /// Sets the value of [input_uri_prefix][crate::model::ImportDocumentsMetadata::input_uri_prefix].
9509 ///
9510 /// # Example
9511 /// ```ignore,no_run
9512 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9513 /// let x = ImportDocumentsMetadata::new().set_input_uri_prefix("example");
9514 /// ```
9515 pub fn set_input_uri_prefix<T: std::convert::Into<std::string::String>>(
9516 mut self,
9517 v: T,
9518 ) -> Self {
9519 self.input_uri_prefix = v.into();
9520 self
9521 }
9522
9523 /// Sets the value of [namespace_ids][crate::model::ImportDocumentsMetadata::namespace_ids].
9524 ///
9525 /// # Example
9526 /// ```ignore,no_run
9527 /// # use google_cloud_firestore_admin_v1::model::ImportDocumentsMetadata;
9528 /// let x = ImportDocumentsMetadata::new().set_namespace_ids(["a", "b", "c"]);
9529 /// ```
9530 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
9531 where
9532 T: std::iter::IntoIterator<Item = V>,
9533 V: std::convert::Into<std::string::String>,
9534 {
9535 use std::iter::Iterator;
9536 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
9537 self
9538 }
9539}
9540
9541impl wkt::message::Message for ImportDocumentsMetadata {
9542 fn typename() -> &'static str {
9543 "type.googleapis.com/google.firestore.admin.v1.ImportDocumentsMetadata"
9544 }
9545}
9546
9547/// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
9548/// results from
9549/// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
9550///
9551/// [google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments]: crate::client::FirestoreAdmin::bulk_delete_documents
9552/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9553#[derive(Clone, Default, PartialEq)]
9554#[non_exhaustive]
9555pub struct BulkDeleteDocumentsMetadata {
9556 /// The time this operation started.
9557 pub start_time: std::option::Option<wkt::Timestamp>,
9558
9559 /// The time this operation completed. Will be unset if operation still in
9560 /// progress.
9561 pub end_time: std::option::Option<wkt::Timestamp>,
9562
9563 /// The state of the operation.
9564 pub operation_state: crate::model::OperationState,
9565
9566 /// The progress, in documents, of this operation.
9567 pub progress_documents: std::option::Option<crate::model::Progress>,
9568
9569 /// The progress, in bytes, of this operation.
9570 pub progress_bytes: std::option::Option<crate::model::Progress>,
9571
9572 /// The IDs of the collection groups that are being deleted.
9573 pub collection_ids: std::vec::Vec<std::string::String>,
9574
9575 /// Which namespace IDs are being deleted.
9576 pub namespace_ids: std::vec::Vec<std::string::String>,
9577
9578 /// The timestamp that corresponds to the version of the database that is being
9579 /// read to get the list of documents to delete. This time can also be used as
9580 /// the timestamp of PITR in case of disaster recovery (subject to PITR window
9581 /// limit).
9582 pub snapshot_time: std::option::Option<wkt::Timestamp>,
9583
9584 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9585}
9586
9587impl BulkDeleteDocumentsMetadata {
9588 /// Creates a new default instance.
9589 pub fn new() -> Self {
9590 std::default::Default::default()
9591 }
9592
9593 /// Sets the value of [start_time][crate::model::BulkDeleteDocumentsMetadata::start_time].
9594 ///
9595 /// # Example
9596 /// ```ignore,no_run
9597 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9598 /// use wkt::Timestamp;
9599 /// let x = BulkDeleteDocumentsMetadata::new().set_start_time(Timestamp::default()/* use setters */);
9600 /// ```
9601 pub fn set_start_time<T>(mut self, v: T) -> Self
9602 where
9603 T: std::convert::Into<wkt::Timestamp>,
9604 {
9605 self.start_time = std::option::Option::Some(v.into());
9606 self
9607 }
9608
9609 /// Sets or clears the value of [start_time][crate::model::BulkDeleteDocumentsMetadata::start_time].
9610 ///
9611 /// # Example
9612 /// ```ignore,no_run
9613 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9614 /// use wkt::Timestamp;
9615 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9616 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_start_time(None::<Timestamp>);
9617 /// ```
9618 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9619 where
9620 T: std::convert::Into<wkt::Timestamp>,
9621 {
9622 self.start_time = v.map(|x| x.into());
9623 self
9624 }
9625
9626 /// Sets the value of [end_time][crate::model::BulkDeleteDocumentsMetadata::end_time].
9627 ///
9628 /// # Example
9629 /// ```ignore,no_run
9630 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9631 /// use wkt::Timestamp;
9632 /// let x = BulkDeleteDocumentsMetadata::new().set_end_time(Timestamp::default()/* use setters */);
9633 /// ```
9634 pub fn set_end_time<T>(mut self, v: T) -> Self
9635 where
9636 T: std::convert::Into<wkt::Timestamp>,
9637 {
9638 self.end_time = std::option::Option::Some(v.into());
9639 self
9640 }
9641
9642 /// Sets or clears the value of [end_time][crate::model::BulkDeleteDocumentsMetadata::end_time].
9643 ///
9644 /// # Example
9645 /// ```ignore,no_run
9646 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9647 /// use wkt::Timestamp;
9648 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9649 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_end_time(None::<Timestamp>);
9650 /// ```
9651 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9652 where
9653 T: std::convert::Into<wkt::Timestamp>,
9654 {
9655 self.end_time = v.map(|x| x.into());
9656 self
9657 }
9658
9659 /// Sets the value of [operation_state][crate::model::BulkDeleteDocumentsMetadata::operation_state].
9660 ///
9661 /// # Example
9662 /// ```ignore,no_run
9663 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9664 /// use google_cloud_firestore_admin_v1::model::OperationState;
9665 /// let x0 = BulkDeleteDocumentsMetadata::new().set_operation_state(OperationState::Initializing);
9666 /// let x1 = BulkDeleteDocumentsMetadata::new().set_operation_state(OperationState::Processing);
9667 /// let x2 = BulkDeleteDocumentsMetadata::new().set_operation_state(OperationState::Cancelling);
9668 /// ```
9669 pub fn set_operation_state<T: std::convert::Into<crate::model::OperationState>>(
9670 mut self,
9671 v: T,
9672 ) -> Self {
9673 self.operation_state = v.into();
9674 self
9675 }
9676
9677 /// Sets the value of [progress_documents][crate::model::BulkDeleteDocumentsMetadata::progress_documents].
9678 ///
9679 /// # Example
9680 /// ```ignore,no_run
9681 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9682 /// use google_cloud_firestore_admin_v1::model::Progress;
9683 /// let x = BulkDeleteDocumentsMetadata::new().set_progress_documents(Progress::default()/* use setters */);
9684 /// ```
9685 pub fn set_progress_documents<T>(mut self, v: T) -> Self
9686 where
9687 T: std::convert::Into<crate::model::Progress>,
9688 {
9689 self.progress_documents = std::option::Option::Some(v.into());
9690 self
9691 }
9692
9693 /// Sets or clears the value of [progress_documents][crate::model::BulkDeleteDocumentsMetadata::progress_documents].
9694 ///
9695 /// # Example
9696 /// ```ignore,no_run
9697 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9698 /// use google_cloud_firestore_admin_v1::model::Progress;
9699 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_progress_documents(Some(Progress::default()/* use setters */));
9700 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_progress_documents(None::<Progress>);
9701 /// ```
9702 pub fn set_or_clear_progress_documents<T>(mut self, v: std::option::Option<T>) -> Self
9703 where
9704 T: std::convert::Into<crate::model::Progress>,
9705 {
9706 self.progress_documents = v.map(|x| x.into());
9707 self
9708 }
9709
9710 /// Sets the value of [progress_bytes][crate::model::BulkDeleteDocumentsMetadata::progress_bytes].
9711 ///
9712 /// # Example
9713 /// ```ignore,no_run
9714 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9715 /// use google_cloud_firestore_admin_v1::model::Progress;
9716 /// let x = BulkDeleteDocumentsMetadata::new().set_progress_bytes(Progress::default()/* use setters */);
9717 /// ```
9718 pub fn set_progress_bytes<T>(mut self, v: T) -> Self
9719 where
9720 T: std::convert::Into<crate::model::Progress>,
9721 {
9722 self.progress_bytes = std::option::Option::Some(v.into());
9723 self
9724 }
9725
9726 /// Sets or clears the value of [progress_bytes][crate::model::BulkDeleteDocumentsMetadata::progress_bytes].
9727 ///
9728 /// # Example
9729 /// ```ignore,no_run
9730 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9731 /// use google_cloud_firestore_admin_v1::model::Progress;
9732 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_progress_bytes(Some(Progress::default()/* use setters */));
9733 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_progress_bytes(None::<Progress>);
9734 /// ```
9735 pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
9736 where
9737 T: std::convert::Into<crate::model::Progress>,
9738 {
9739 self.progress_bytes = v.map(|x| x.into());
9740 self
9741 }
9742
9743 /// Sets the value of [collection_ids][crate::model::BulkDeleteDocumentsMetadata::collection_ids].
9744 ///
9745 /// # Example
9746 /// ```ignore,no_run
9747 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9748 /// let x = BulkDeleteDocumentsMetadata::new().set_collection_ids(["a", "b", "c"]);
9749 /// ```
9750 pub fn set_collection_ids<T, V>(mut self, v: T) -> Self
9751 where
9752 T: std::iter::IntoIterator<Item = V>,
9753 V: std::convert::Into<std::string::String>,
9754 {
9755 use std::iter::Iterator;
9756 self.collection_ids = v.into_iter().map(|i| i.into()).collect();
9757 self
9758 }
9759
9760 /// Sets the value of [namespace_ids][crate::model::BulkDeleteDocumentsMetadata::namespace_ids].
9761 ///
9762 /// # Example
9763 /// ```ignore,no_run
9764 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9765 /// let x = BulkDeleteDocumentsMetadata::new().set_namespace_ids(["a", "b", "c"]);
9766 /// ```
9767 pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
9768 where
9769 T: std::iter::IntoIterator<Item = V>,
9770 V: std::convert::Into<std::string::String>,
9771 {
9772 use std::iter::Iterator;
9773 self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
9774 self
9775 }
9776
9777 /// Sets the value of [snapshot_time][crate::model::BulkDeleteDocumentsMetadata::snapshot_time].
9778 ///
9779 /// # Example
9780 /// ```ignore,no_run
9781 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9782 /// use wkt::Timestamp;
9783 /// let x = BulkDeleteDocumentsMetadata::new().set_snapshot_time(Timestamp::default()/* use setters */);
9784 /// ```
9785 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
9786 where
9787 T: std::convert::Into<wkt::Timestamp>,
9788 {
9789 self.snapshot_time = std::option::Option::Some(v.into());
9790 self
9791 }
9792
9793 /// Sets or clears the value of [snapshot_time][crate::model::BulkDeleteDocumentsMetadata::snapshot_time].
9794 ///
9795 /// # Example
9796 /// ```ignore,no_run
9797 /// # use google_cloud_firestore_admin_v1::model::BulkDeleteDocumentsMetadata;
9798 /// use wkt::Timestamp;
9799 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
9800 /// let x = BulkDeleteDocumentsMetadata::new().set_or_clear_snapshot_time(None::<Timestamp>);
9801 /// ```
9802 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
9803 where
9804 T: std::convert::Into<wkt::Timestamp>,
9805 {
9806 self.snapshot_time = v.map(|x| x.into());
9807 self
9808 }
9809}
9810
9811impl wkt::message::Message for BulkDeleteDocumentsMetadata {
9812 fn typename() -> &'static str {
9813 "type.googleapis.com/google.firestore.admin.v1.BulkDeleteDocumentsMetadata"
9814 }
9815}
9816
9817/// Returned in the [google.longrunning.Operation][google.longrunning.Operation]
9818/// response field.
9819///
9820/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9821#[derive(Clone, Default, PartialEq)]
9822#[non_exhaustive]
9823pub struct ExportDocumentsResponse {
9824 /// Location of the output files. This can be used to begin an import
9825 /// into Cloud Firestore (this project or another project) after the operation
9826 /// completes successfully.
9827 pub output_uri_prefix: std::string::String,
9828
9829 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9830}
9831
9832impl ExportDocumentsResponse {
9833 /// Creates a new default instance.
9834 pub fn new() -> Self {
9835 std::default::Default::default()
9836 }
9837
9838 /// Sets the value of [output_uri_prefix][crate::model::ExportDocumentsResponse::output_uri_prefix].
9839 ///
9840 /// # Example
9841 /// ```ignore,no_run
9842 /// # use google_cloud_firestore_admin_v1::model::ExportDocumentsResponse;
9843 /// let x = ExportDocumentsResponse::new().set_output_uri_prefix("example");
9844 /// ```
9845 pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9846 mut self,
9847 v: T,
9848 ) -> Self {
9849 self.output_uri_prefix = v.into();
9850 self
9851 }
9852}
9853
9854impl wkt::message::Message for ExportDocumentsResponse {
9855 fn typename() -> &'static str {
9856 "type.googleapis.com/google.firestore.admin.v1.ExportDocumentsResponse"
9857 }
9858}
9859
9860/// Metadata for the [long-running operation][google.longrunning.Operation] from
9861/// the [RestoreDatabase][google.firestore.admin.v1.RestoreDatabase] request.
9862///
9863/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9864#[derive(Clone, Default, PartialEq)]
9865#[non_exhaustive]
9866pub struct RestoreDatabaseMetadata {
9867 /// The time the restore was started.
9868 pub start_time: std::option::Option<wkt::Timestamp>,
9869
9870 /// The time the restore finished, unset for ongoing restores.
9871 pub end_time: std::option::Option<wkt::Timestamp>,
9872
9873 /// The operation state of the restore.
9874 pub operation_state: crate::model::OperationState,
9875
9876 /// The name of the database being restored to.
9877 pub database: std::string::String,
9878
9879 /// The name of the backup restoring from.
9880 pub backup: std::string::String,
9881
9882 /// How far along the restore is as an estimated percentage of remaining time.
9883 pub progress_percentage: std::option::Option<crate::model::Progress>,
9884
9885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9886}
9887
9888impl RestoreDatabaseMetadata {
9889 /// Creates a new default instance.
9890 pub fn new() -> Self {
9891 std::default::Default::default()
9892 }
9893
9894 /// Sets the value of [start_time][crate::model::RestoreDatabaseMetadata::start_time].
9895 ///
9896 /// # Example
9897 /// ```ignore,no_run
9898 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9899 /// use wkt::Timestamp;
9900 /// let x = RestoreDatabaseMetadata::new().set_start_time(Timestamp::default()/* use setters */);
9901 /// ```
9902 pub fn set_start_time<T>(mut self, v: T) -> Self
9903 where
9904 T: std::convert::Into<wkt::Timestamp>,
9905 {
9906 self.start_time = std::option::Option::Some(v.into());
9907 self
9908 }
9909
9910 /// Sets or clears the value of [start_time][crate::model::RestoreDatabaseMetadata::start_time].
9911 ///
9912 /// # Example
9913 /// ```ignore,no_run
9914 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9915 /// use wkt::Timestamp;
9916 /// let x = RestoreDatabaseMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9917 /// let x = RestoreDatabaseMetadata::new().set_or_clear_start_time(None::<Timestamp>);
9918 /// ```
9919 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9920 where
9921 T: std::convert::Into<wkt::Timestamp>,
9922 {
9923 self.start_time = v.map(|x| x.into());
9924 self
9925 }
9926
9927 /// Sets the value of [end_time][crate::model::RestoreDatabaseMetadata::end_time].
9928 ///
9929 /// # Example
9930 /// ```ignore,no_run
9931 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9932 /// use wkt::Timestamp;
9933 /// let x = RestoreDatabaseMetadata::new().set_end_time(Timestamp::default()/* use setters */);
9934 /// ```
9935 pub fn set_end_time<T>(mut self, v: T) -> Self
9936 where
9937 T: std::convert::Into<wkt::Timestamp>,
9938 {
9939 self.end_time = std::option::Option::Some(v.into());
9940 self
9941 }
9942
9943 /// Sets or clears the value of [end_time][crate::model::RestoreDatabaseMetadata::end_time].
9944 ///
9945 /// # Example
9946 /// ```ignore,no_run
9947 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9948 /// use wkt::Timestamp;
9949 /// let x = RestoreDatabaseMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9950 /// let x = RestoreDatabaseMetadata::new().set_or_clear_end_time(None::<Timestamp>);
9951 /// ```
9952 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9953 where
9954 T: std::convert::Into<wkt::Timestamp>,
9955 {
9956 self.end_time = v.map(|x| x.into());
9957 self
9958 }
9959
9960 /// Sets the value of [operation_state][crate::model::RestoreDatabaseMetadata::operation_state].
9961 ///
9962 /// # Example
9963 /// ```ignore,no_run
9964 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9965 /// use google_cloud_firestore_admin_v1::model::OperationState;
9966 /// let x0 = RestoreDatabaseMetadata::new().set_operation_state(OperationState::Initializing);
9967 /// let x1 = RestoreDatabaseMetadata::new().set_operation_state(OperationState::Processing);
9968 /// let x2 = RestoreDatabaseMetadata::new().set_operation_state(OperationState::Cancelling);
9969 /// ```
9970 pub fn set_operation_state<T: std::convert::Into<crate::model::OperationState>>(
9971 mut self,
9972 v: T,
9973 ) -> Self {
9974 self.operation_state = v.into();
9975 self
9976 }
9977
9978 /// Sets the value of [database][crate::model::RestoreDatabaseMetadata::database].
9979 ///
9980 /// # Example
9981 /// ```ignore,no_run
9982 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9983 /// let x = RestoreDatabaseMetadata::new().set_database("example");
9984 /// ```
9985 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9986 self.database = v.into();
9987 self
9988 }
9989
9990 /// Sets the value of [backup][crate::model::RestoreDatabaseMetadata::backup].
9991 ///
9992 /// # Example
9993 /// ```ignore,no_run
9994 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
9995 /// let x = RestoreDatabaseMetadata::new().set_backup("example");
9996 /// ```
9997 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9998 self.backup = v.into();
9999 self
10000 }
10001
10002 /// Sets the value of [progress_percentage][crate::model::RestoreDatabaseMetadata::progress_percentage].
10003 ///
10004 /// # Example
10005 /// ```ignore,no_run
10006 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
10007 /// use google_cloud_firestore_admin_v1::model::Progress;
10008 /// let x = RestoreDatabaseMetadata::new().set_progress_percentage(Progress::default()/* use setters */);
10009 /// ```
10010 pub fn set_progress_percentage<T>(mut self, v: T) -> Self
10011 where
10012 T: std::convert::Into<crate::model::Progress>,
10013 {
10014 self.progress_percentage = std::option::Option::Some(v.into());
10015 self
10016 }
10017
10018 /// Sets or clears the value of [progress_percentage][crate::model::RestoreDatabaseMetadata::progress_percentage].
10019 ///
10020 /// # Example
10021 /// ```ignore,no_run
10022 /// # use google_cloud_firestore_admin_v1::model::RestoreDatabaseMetadata;
10023 /// use google_cloud_firestore_admin_v1::model::Progress;
10024 /// let x = RestoreDatabaseMetadata::new().set_or_clear_progress_percentage(Some(Progress::default()/* use setters */));
10025 /// let x = RestoreDatabaseMetadata::new().set_or_clear_progress_percentage(None::<Progress>);
10026 /// ```
10027 pub fn set_or_clear_progress_percentage<T>(mut self, v: std::option::Option<T>) -> Self
10028 where
10029 T: std::convert::Into<crate::model::Progress>,
10030 {
10031 self.progress_percentage = v.map(|x| x.into());
10032 self
10033 }
10034}
10035
10036impl wkt::message::Message for RestoreDatabaseMetadata {
10037 fn typename() -> &'static str {
10038 "type.googleapis.com/google.firestore.admin.v1.RestoreDatabaseMetadata"
10039 }
10040}
10041
10042/// Metadata for the [long-running operation][google.longrunning.Operation] from
10043/// the [CloneDatabase][google.firestore.admin.v1.CloneDatabase] request.
10044///
10045/// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
10046#[derive(Clone, Default, PartialEq)]
10047#[non_exhaustive]
10048pub struct CloneDatabaseMetadata {
10049 /// The time the clone was started.
10050 pub start_time: std::option::Option<wkt::Timestamp>,
10051
10052 /// The time the clone finished, unset for ongoing clones.
10053 pub end_time: std::option::Option<wkt::Timestamp>,
10054
10055 /// The operation state of the clone.
10056 pub operation_state: crate::model::OperationState,
10057
10058 /// The name of the database being cloned to.
10059 pub database: std::string::String,
10060
10061 /// The snapshot from which this database was cloned.
10062 pub pitr_snapshot: std::option::Option<crate::model::PitrSnapshot>,
10063
10064 /// How far along the clone is as an estimated percentage of remaining time.
10065 pub progress_percentage: std::option::Option<crate::model::Progress>,
10066
10067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10068}
10069
10070impl CloneDatabaseMetadata {
10071 /// Creates a new default instance.
10072 pub fn new() -> Self {
10073 std::default::Default::default()
10074 }
10075
10076 /// Sets the value of [start_time][crate::model::CloneDatabaseMetadata::start_time].
10077 ///
10078 /// # Example
10079 /// ```ignore,no_run
10080 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10081 /// use wkt::Timestamp;
10082 /// let x = CloneDatabaseMetadata::new().set_start_time(Timestamp::default()/* use setters */);
10083 /// ```
10084 pub fn set_start_time<T>(mut self, v: T) -> Self
10085 where
10086 T: std::convert::Into<wkt::Timestamp>,
10087 {
10088 self.start_time = std::option::Option::Some(v.into());
10089 self
10090 }
10091
10092 /// Sets or clears the value of [start_time][crate::model::CloneDatabaseMetadata::start_time].
10093 ///
10094 /// # Example
10095 /// ```ignore,no_run
10096 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10097 /// use wkt::Timestamp;
10098 /// let x = CloneDatabaseMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
10099 /// let x = CloneDatabaseMetadata::new().set_or_clear_start_time(None::<Timestamp>);
10100 /// ```
10101 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
10102 where
10103 T: std::convert::Into<wkt::Timestamp>,
10104 {
10105 self.start_time = v.map(|x| x.into());
10106 self
10107 }
10108
10109 /// Sets the value of [end_time][crate::model::CloneDatabaseMetadata::end_time].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10114 /// use wkt::Timestamp;
10115 /// let x = CloneDatabaseMetadata::new().set_end_time(Timestamp::default()/* use setters */);
10116 /// ```
10117 pub fn set_end_time<T>(mut self, v: T) -> Self
10118 where
10119 T: std::convert::Into<wkt::Timestamp>,
10120 {
10121 self.end_time = std::option::Option::Some(v.into());
10122 self
10123 }
10124
10125 /// Sets or clears the value of [end_time][crate::model::CloneDatabaseMetadata::end_time].
10126 ///
10127 /// # Example
10128 /// ```ignore,no_run
10129 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10130 /// use wkt::Timestamp;
10131 /// let x = CloneDatabaseMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
10132 /// let x = CloneDatabaseMetadata::new().set_or_clear_end_time(None::<Timestamp>);
10133 /// ```
10134 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
10135 where
10136 T: std::convert::Into<wkt::Timestamp>,
10137 {
10138 self.end_time = v.map(|x| x.into());
10139 self
10140 }
10141
10142 /// Sets the value of [operation_state][crate::model::CloneDatabaseMetadata::operation_state].
10143 ///
10144 /// # Example
10145 /// ```ignore,no_run
10146 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10147 /// use google_cloud_firestore_admin_v1::model::OperationState;
10148 /// let x0 = CloneDatabaseMetadata::new().set_operation_state(OperationState::Initializing);
10149 /// let x1 = CloneDatabaseMetadata::new().set_operation_state(OperationState::Processing);
10150 /// let x2 = CloneDatabaseMetadata::new().set_operation_state(OperationState::Cancelling);
10151 /// ```
10152 pub fn set_operation_state<T: std::convert::Into<crate::model::OperationState>>(
10153 mut self,
10154 v: T,
10155 ) -> Self {
10156 self.operation_state = v.into();
10157 self
10158 }
10159
10160 /// Sets the value of [database][crate::model::CloneDatabaseMetadata::database].
10161 ///
10162 /// # Example
10163 /// ```ignore,no_run
10164 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10165 /// let x = CloneDatabaseMetadata::new().set_database("example");
10166 /// ```
10167 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10168 self.database = v.into();
10169 self
10170 }
10171
10172 /// Sets the value of [pitr_snapshot][crate::model::CloneDatabaseMetadata::pitr_snapshot].
10173 ///
10174 /// # Example
10175 /// ```ignore,no_run
10176 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10177 /// use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10178 /// let x = CloneDatabaseMetadata::new().set_pitr_snapshot(PitrSnapshot::default()/* use setters */);
10179 /// ```
10180 pub fn set_pitr_snapshot<T>(mut self, v: T) -> Self
10181 where
10182 T: std::convert::Into<crate::model::PitrSnapshot>,
10183 {
10184 self.pitr_snapshot = std::option::Option::Some(v.into());
10185 self
10186 }
10187
10188 /// Sets or clears the value of [pitr_snapshot][crate::model::CloneDatabaseMetadata::pitr_snapshot].
10189 ///
10190 /// # Example
10191 /// ```ignore,no_run
10192 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10193 /// use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10194 /// let x = CloneDatabaseMetadata::new().set_or_clear_pitr_snapshot(Some(PitrSnapshot::default()/* use setters */));
10195 /// let x = CloneDatabaseMetadata::new().set_or_clear_pitr_snapshot(None::<PitrSnapshot>);
10196 /// ```
10197 pub fn set_or_clear_pitr_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
10198 where
10199 T: std::convert::Into<crate::model::PitrSnapshot>,
10200 {
10201 self.pitr_snapshot = v.map(|x| x.into());
10202 self
10203 }
10204
10205 /// Sets the value of [progress_percentage][crate::model::CloneDatabaseMetadata::progress_percentage].
10206 ///
10207 /// # Example
10208 /// ```ignore,no_run
10209 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10210 /// use google_cloud_firestore_admin_v1::model::Progress;
10211 /// let x = CloneDatabaseMetadata::new().set_progress_percentage(Progress::default()/* use setters */);
10212 /// ```
10213 pub fn set_progress_percentage<T>(mut self, v: T) -> Self
10214 where
10215 T: std::convert::Into<crate::model::Progress>,
10216 {
10217 self.progress_percentage = std::option::Option::Some(v.into());
10218 self
10219 }
10220
10221 /// Sets or clears the value of [progress_percentage][crate::model::CloneDatabaseMetadata::progress_percentage].
10222 ///
10223 /// # Example
10224 /// ```ignore,no_run
10225 /// # use google_cloud_firestore_admin_v1::model::CloneDatabaseMetadata;
10226 /// use google_cloud_firestore_admin_v1::model::Progress;
10227 /// let x = CloneDatabaseMetadata::new().set_or_clear_progress_percentage(Some(Progress::default()/* use setters */));
10228 /// let x = CloneDatabaseMetadata::new().set_or_clear_progress_percentage(None::<Progress>);
10229 /// ```
10230 pub fn set_or_clear_progress_percentage<T>(mut self, v: std::option::Option<T>) -> Self
10231 where
10232 T: std::convert::Into<crate::model::Progress>,
10233 {
10234 self.progress_percentage = v.map(|x| x.into());
10235 self
10236 }
10237}
10238
10239impl wkt::message::Message for CloneDatabaseMetadata {
10240 fn typename() -> &'static str {
10241 "type.googleapis.com/google.firestore.admin.v1.CloneDatabaseMetadata"
10242 }
10243}
10244
10245/// Describes the progress of the operation.
10246/// Unit of work is generic and must be interpreted based on where
10247/// [Progress][google.firestore.admin.v1.Progress] is used.
10248///
10249/// [google.firestore.admin.v1.Progress]: crate::model::Progress
10250#[derive(Clone, Default, PartialEq)]
10251#[non_exhaustive]
10252pub struct Progress {
10253 /// The amount of work estimated.
10254 pub estimated_work: i64,
10255
10256 /// The amount of work completed.
10257 pub completed_work: i64,
10258
10259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10260}
10261
10262impl Progress {
10263 /// Creates a new default instance.
10264 pub fn new() -> Self {
10265 std::default::Default::default()
10266 }
10267
10268 /// Sets the value of [estimated_work][crate::model::Progress::estimated_work].
10269 ///
10270 /// # Example
10271 /// ```ignore,no_run
10272 /// # use google_cloud_firestore_admin_v1::model::Progress;
10273 /// let x = Progress::new().set_estimated_work(42);
10274 /// ```
10275 pub fn set_estimated_work<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10276 self.estimated_work = v.into();
10277 self
10278 }
10279
10280 /// Sets the value of [completed_work][crate::model::Progress::completed_work].
10281 ///
10282 /// # Example
10283 /// ```ignore,no_run
10284 /// # use google_cloud_firestore_admin_v1::model::Progress;
10285 /// let x = Progress::new().set_completed_work(42);
10286 /// ```
10287 pub fn set_completed_work<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10288 self.completed_work = v.into();
10289 self
10290 }
10291}
10292
10293impl wkt::message::Message for Progress {
10294 fn typename() -> &'static str {
10295 "type.googleapis.com/google.firestore.admin.v1.Progress"
10296 }
10297}
10298
10299/// A backup schedule for a Cloud Firestore Database.
10300///
10301/// This resource is owned by the database it is backing up, and is deleted along
10302/// with the database. The actual backups are not though.
10303#[derive(Clone, Default, PartialEq)]
10304#[non_exhaustive]
10305pub struct BackupSchedule {
10306 /// Output only. The unique backup schedule identifier across all locations and
10307 /// databases for the given project.
10308 ///
10309 /// This will be auto-assigned.
10310 ///
10311 /// Format is
10312 /// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
10313 pub name: std::string::String,
10314
10315 /// Output only. The timestamp at which this backup schedule was created and
10316 /// effective since.
10317 ///
10318 /// No backups will be created for this schedule before this time.
10319 pub create_time: std::option::Option<wkt::Timestamp>,
10320
10321 /// Output only. The timestamp at which this backup schedule was most recently
10322 /// updated. When a backup schedule is first created, this is the same as
10323 /// create_time.
10324 pub update_time: std::option::Option<wkt::Timestamp>,
10325
10326 /// At what relative time in the future, compared to its creation time,
10327 /// the backup should be deleted, e.g. keep backups for 7 days.
10328 ///
10329 /// The maximum supported retention period is 14 weeks.
10330 pub retention: std::option::Option<wkt::Duration>,
10331
10332 /// A oneof field to represent when backups will be taken.
10333 pub recurrence: std::option::Option<crate::model::backup_schedule::Recurrence>,
10334
10335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10336}
10337
10338impl BackupSchedule {
10339 /// Creates a new default instance.
10340 pub fn new() -> Self {
10341 std::default::Default::default()
10342 }
10343
10344 /// Sets the value of [name][crate::model::BackupSchedule::name].
10345 ///
10346 /// # Example
10347 /// ```ignore,no_run
10348 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10349 /// let x = BackupSchedule::new().set_name("example");
10350 /// ```
10351 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10352 self.name = v.into();
10353 self
10354 }
10355
10356 /// Sets the value of [create_time][crate::model::BackupSchedule::create_time].
10357 ///
10358 /// # Example
10359 /// ```ignore,no_run
10360 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10361 /// use wkt::Timestamp;
10362 /// let x = BackupSchedule::new().set_create_time(Timestamp::default()/* use setters */);
10363 /// ```
10364 pub fn set_create_time<T>(mut self, v: T) -> Self
10365 where
10366 T: std::convert::Into<wkt::Timestamp>,
10367 {
10368 self.create_time = std::option::Option::Some(v.into());
10369 self
10370 }
10371
10372 /// Sets or clears the value of [create_time][crate::model::BackupSchedule::create_time].
10373 ///
10374 /// # Example
10375 /// ```ignore,no_run
10376 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10377 /// use wkt::Timestamp;
10378 /// let x = BackupSchedule::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10379 /// let x = BackupSchedule::new().set_or_clear_create_time(None::<Timestamp>);
10380 /// ```
10381 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10382 where
10383 T: std::convert::Into<wkt::Timestamp>,
10384 {
10385 self.create_time = v.map(|x| x.into());
10386 self
10387 }
10388
10389 /// Sets the value of [update_time][crate::model::BackupSchedule::update_time].
10390 ///
10391 /// # Example
10392 /// ```ignore,no_run
10393 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10394 /// use wkt::Timestamp;
10395 /// let x = BackupSchedule::new().set_update_time(Timestamp::default()/* use setters */);
10396 /// ```
10397 pub fn set_update_time<T>(mut self, v: T) -> Self
10398 where
10399 T: std::convert::Into<wkt::Timestamp>,
10400 {
10401 self.update_time = std::option::Option::Some(v.into());
10402 self
10403 }
10404
10405 /// Sets or clears the value of [update_time][crate::model::BackupSchedule::update_time].
10406 ///
10407 /// # Example
10408 /// ```ignore,no_run
10409 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10410 /// use wkt::Timestamp;
10411 /// let x = BackupSchedule::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10412 /// let x = BackupSchedule::new().set_or_clear_update_time(None::<Timestamp>);
10413 /// ```
10414 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10415 where
10416 T: std::convert::Into<wkt::Timestamp>,
10417 {
10418 self.update_time = v.map(|x| x.into());
10419 self
10420 }
10421
10422 /// Sets the value of [retention][crate::model::BackupSchedule::retention].
10423 ///
10424 /// # Example
10425 /// ```ignore,no_run
10426 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10427 /// use wkt::Duration;
10428 /// let x = BackupSchedule::new().set_retention(Duration::default()/* use setters */);
10429 /// ```
10430 pub fn set_retention<T>(mut self, v: T) -> Self
10431 where
10432 T: std::convert::Into<wkt::Duration>,
10433 {
10434 self.retention = std::option::Option::Some(v.into());
10435 self
10436 }
10437
10438 /// Sets or clears the value of [retention][crate::model::BackupSchedule::retention].
10439 ///
10440 /// # Example
10441 /// ```ignore,no_run
10442 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10443 /// use wkt::Duration;
10444 /// let x = BackupSchedule::new().set_or_clear_retention(Some(Duration::default()/* use setters */));
10445 /// let x = BackupSchedule::new().set_or_clear_retention(None::<Duration>);
10446 /// ```
10447 pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
10448 where
10449 T: std::convert::Into<wkt::Duration>,
10450 {
10451 self.retention = v.map(|x| x.into());
10452 self
10453 }
10454
10455 /// Sets the value of [recurrence][crate::model::BackupSchedule::recurrence].
10456 ///
10457 /// Note that all the setters affecting `recurrence` are mutually
10458 /// exclusive.
10459 ///
10460 /// # Example
10461 /// ```ignore,no_run
10462 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10463 /// use google_cloud_firestore_admin_v1::model::DailyRecurrence;
10464 /// let x = BackupSchedule::new().set_recurrence(Some(
10465 /// google_cloud_firestore_admin_v1::model::backup_schedule::Recurrence::DailyRecurrence(DailyRecurrence::default().into())));
10466 /// ```
10467 pub fn set_recurrence<
10468 T: std::convert::Into<std::option::Option<crate::model::backup_schedule::Recurrence>>,
10469 >(
10470 mut self,
10471 v: T,
10472 ) -> Self {
10473 self.recurrence = v.into();
10474 self
10475 }
10476
10477 /// The value of [recurrence][crate::model::BackupSchedule::recurrence]
10478 /// if it holds a `DailyRecurrence`, `None` if the field is not set or
10479 /// holds a different branch.
10480 pub fn daily_recurrence(
10481 &self,
10482 ) -> std::option::Option<&std::boxed::Box<crate::model::DailyRecurrence>> {
10483 #[allow(unreachable_patterns)]
10484 self.recurrence.as_ref().and_then(|v| match v {
10485 crate::model::backup_schedule::Recurrence::DailyRecurrence(v) => {
10486 std::option::Option::Some(v)
10487 }
10488 _ => std::option::Option::None,
10489 })
10490 }
10491
10492 /// Sets the value of [recurrence][crate::model::BackupSchedule::recurrence]
10493 /// to hold a `DailyRecurrence`.
10494 ///
10495 /// Note that all the setters affecting `recurrence` are
10496 /// mutually exclusive.
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10501 /// use google_cloud_firestore_admin_v1::model::DailyRecurrence;
10502 /// let x = BackupSchedule::new().set_daily_recurrence(DailyRecurrence::default()/* use setters */);
10503 /// assert!(x.daily_recurrence().is_some());
10504 /// assert!(x.weekly_recurrence().is_none());
10505 /// ```
10506 pub fn set_daily_recurrence<
10507 T: std::convert::Into<std::boxed::Box<crate::model::DailyRecurrence>>,
10508 >(
10509 mut self,
10510 v: T,
10511 ) -> Self {
10512 self.recurrence = std::option::Option::Some(
10513 crate::model::backup_schedule::Recurrence::DailyRecurrence(v.into()),
10514 );
10515 self
10516 }
10517
10518 /// The value of [recurrence][crate::model::BackupSchedule::recurrence]
10519 /// if it holds a `WeeklyRecurrence`, `None` if the field is not set or
10520 /// holds a different branch.
10521 pub fn weekly_recurrence(
10522 &self,
10523 ) -> std::option::Option<&std::boxed::Box<crate::model::WeeklyRecurrence>> {
10524 #[allow(unreachable_patterns)]
10525 self.recurrence.as_ref().and_then(|v| match v {
10526 crate::model::backup_schedule::Recurrence::WeeklyRecurrence(v) => {
10527 std::option::Option::Some(v)
10528 }
10529 _ => std::option::Option::None,
10530 })
10531 }
10532
10533 /// Sets the value of [recurrence][crate::model::BackupSchedule::recurrence]
10534 /// to hold a `WeeklyRecurrence`.
10535 ///
10536 /// Note that all the setters affecting `recurrence` are
10537 /// mutually exclusive.
10538 ///
10539 /// # Example
10540 /// ```ignore,no_run
10541 /// # use google_cloud_firestore_admin_v1::model::BackupSchedule;
10542 /// use google_cloud_firestore_admin_v1::model::WeeklyRecurrence;
10543 /// let x = BackupSchedule::new().set_weekly_recurrence(WeeklyRecurrence::default()/* use setters */);
10544 /// assert!(x.weekly_recurrence().is_some());
10545 /// assert!(x.daily_recurrence().is_none());
10546 /// ```
10547 pub fn set_weekly_recurrence<
10548 T: std::convert::Into<std::boxed::Box<crate::model::WeeklyRecurrence>>,
10549 >(
10550 mut self,
10551 v: T,
10552 ) -> Self {
10553 self.recurrence = std::option::Option::Some(
10554 crate::model::backup_schedule::Recurrence::WeeklyRecurrence(v.into()),
10555 );
10556 self
10557 }
10558}
10559
10560impl wkt::message::Message for BackupSchedule {
10561 fn typename() -> &'static str {
10562 "type.googleapis.com/google.firestore.admin.v1.BackupSchedule"
10563 }
10564}
10565
10566/// Defines additional types related to [BackupSchedule].
10567pub mod backup_schedule {
10568 #[allow(unused_imports)]
10569 use super::*;
10570
10571 /// A oneof field to represent when backups will be taken.
10572 #[derive(Clone, Debug, PartialEq)]
10573 #[non_exhaustive]
10574 pub enum Recurrence {
10575 /// For a schedule that runs daily.
10576 DailyRecurrence(std::boxed::Box<crate::model::DailyRecurrence>),
10577 /// For a schedule that runs weekly on a specific day.
10578 WeeklyRecurrence(std::boxed::Box<crate::model::WeeklyRecurrence>),
10579 }
10580}
10581
10582/// Represents a recurring schedule that runs every day.
10583///
10584/// The time zone is UTC.
10585#[derive(Clone, Default, PartialEq)]
10586#[non_exhaustive]
10587pub struct DailyRecurrence {
10588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10589}
10590
10591impl DailyRecurrence {
10592 /// Creates a new default instance.
10593 pub fn new() -> Self {
10594 std::default::Default::default()
10595 }
10596}
10597
10598impl wkt::message::Message for DailyRecurrence {
10599 fn typename() -> &'static str {
10600 "type.googleapis.com/google.firestore.admin.v1.DailyRecurrence"
10601 }
10602}
10603
10604/// Represents a recurring schedule that runs on a specified day of the week.
10605///
10606/// The time zone is UTC.
10607#[derive(Clone, Default, PartialEq)]
10608#[non_exhaustive]
10609pub struct WeeklyRecurrence {
10610 /// The day of week to run.
10611 ///
10612 /// DAY_OF_WEEK_UNSPECIFIED is not allowed.
10613 pub day: google_cloud_type::model::DayOfWeek,
10614
10615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10616}
10617
10618impl WeeklyRecurrence {
10619 /// Creates a new default instance.
10620 pub fn new() -> Self {
10621 std::default::Default::default()
10622 }
10623
10624 /// Sets the value of [day][crate::model::WeeklyRecurrence::day].
10625 ///
10626 /// # Example
10627 /// ```ignore,no_run
10628 /// # use google_cloud_firestore_admin_v1::model::WeeklyRecurrence;
10629 /// use google_cloud_type::model::DayOfWeek;
10630 /// let x0 = WeeklyRecurrence::new().set_day(DayOfWeek::Monday);
10631 /// let x1 = WeeklyRecurrence::new().set_day(DayOfWeek::Tuesday);
10632 /// let x2 = WeeklyRecurrence::new().set_day(DayOfWeek::Wednesday);
10633 /// ```
10634 pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
10635 mut self,
10636 v: T,
10637 ) -> Self {
10638 self.day = v.into();
10639 self
10640 }
10641}
10642
10643impl wkt::message::Message for WeeklyRecurrence {
10644 fn typename() -> &'static str {
10645 "type.googleapis.com/google.firestore.admin.v1.WeeklyRecurrence"
10646 }
10647}
10648
10649/// A consistent snapshot of a database at a specific point in time.
10650/// A PITR (Point-in-time recovery) snapshot with previous versions of a
10651/// database's data is available for every minute up to the associated database's
10652/// data retention period. If the PITR feature is enabled, the retention period
10653/// is 7 days; otherwise, it is one hour.
10654#[derive(Clone, Default, PartialEq)]
10655#[non_exhaustive]
10656pub struct PitrSnapshot {
10657 /// Required. The name of the database that this was a snapshot of. Format:
10658 /// `projects/{project}/databases/{database}`.
10659 pub database: std::string::String,
10660
10661 /// Output only. Public UUID of the database the snapshot was associated with.
10662 pub database_uid: ::bytes::Bytes,
10663
10664 /// Required. Snapshot time of the database.
10665 pub snapshot_time: std::option::Option<wkt::Timestamp>,
10666
10667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10668}
10669
10670impl PitrSnapshot {
10671 /// Creates a new default instance.
10672 pub fn new() -> Self {
10673 std::default::Default::default()
10674 }
10675
10676 /// Sets the value of [database][crate::model::PitrSnapshot::database].
10677 ///
10678 /// # Example
10679 /// ```ignore,no_run
10680 /// # use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10681 /// let x = PitrSnapshot::new().set_database("example");
10682 /// ```
10683 pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10684 self.database = v.into();
10685 self
10686 }
10687
10688 /// Sets the value of [database_uid][crate::model::PitrSnapshot::database_uid].
10689 ///
10690 /// # Example
10691 /// ```ignore,no_run
10692 /// # use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10693 /// let x = PitrSnapshot::new().set_database_uid(bytes::Bytes::from_static(b"example"));
10694 /// ```
10695 pub fn set_database_uid<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10696 self.database_uid = v.into();
10697 self
10698 }
10699
10700 /// Sets the value of [snapshot_time][crate::model::PitrSnapshot::snapshot_time].
10701 ///
10702 /// # Example
10703 /// ```ignore,no_run
10704 /// # use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10705 /// use wkt::Timestamp;
10706 /// let x = PitrSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
10707 /// ```
10708 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
10709 where
10710 T: std::convert::Into<wkt::Timestamp>,
10711 {
10712 self.snapshot_time = std::option::Option::Some(v.into());
10713 self
10714 }
10715
10716 /// Sets or clears the value of [snapshot_time][crate::model::PitrSnapshot::snapshot_time].
10717 ///
10718 /// # Example
10719 /// ```ignore,no_run
10720 /// # use google_cloud_firestore_admin_v1::model::PitrSnapshot;
10721 /// use wkt::Timestamp;
10722 /// let x = PitrSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
10723 /// let x = PitrSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
10724 /// ```
10725 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
10726 where
10727 T: std::convert::Into<wkt::Timestamp>,
10728 {
10729 self.snapshot_time = v.map(|x| x.into());
10730 self
10731 }
10732}
10733
10734impl wkt::message::Message for PitrSnapshot {
10735 fn typename() -> &'static str {
10736 "type.googleapis.com/google.firestore.admin.v1.PitrSnapshot"
10737 }
10738}
10739
10740/// A Cloud Firestore User Creds.
10741#[derive(Clone, Default, PartialEq)]
10742#[non_exhaustive]
10743pub struct UserCreds {
10744 /// Identifier. The resource name of the UserCreds.
10745 /// Format:
10746 /// `projects/{project}/databases/{database}/userCreds/{user_creds}`
10747 pub name: std::string::String,
10748
10749 /// Output only. The time the user creds were created.
10750 pub create_time: std::option::Option<wkt::Timestamp>,
10751
10752 /// Output only. The time the user creds were last updated.
10753 pub update_time: std::option::Option<wkt::Timestamp>,
10754
10755 /// Output only. Whether the user creds are enabled or disabled. Defaults to
10756 /// ENABLED on creation.
10757 pub state: crate::model::user_creds::State,
10758
10759 /// Output only. The plaintext server-generated password for the user creds.
10760 /// Only populated in responses for CreateUserCreds and ResetUserPassword.
10761 pub secure_password: std::string::String,
10762
10763 /// Identity associated with this User Creds.
10764 pub user_creds_identity: std::option::Option<crate::model::user_creds::UserCredsIdentity>,
10765
10766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10767}
10768
10769impl UserCreds {
10770 /// Creates a new default instance.
10771 pub fn new() -> Self {
10772 std::default::Default::default()
10773 }
10774
10775 /// Sets the value of [name][crate::model::UserCreds::name].
10776 ///
10777 /// # Example
10778 /// ```ignore,no_run
10779 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10780 /// let x = UserCreds::new().set_name("example");
10781 /// ```
10782 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10783 self.name = v.into();
10784 self
10785 }
10786
10787 /// Sets the value of [create_time][crate::model::UserCreds::create_time].
10788 ///
10789 /// # Example
10790 /// ```ignore,no_run
10791 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10792 /// use wkt::Timestamp;
10793 /// let x = UserCreds::new().set_create_time(Timestamp::default()/* use setters */);
10794 /// ```
10795 pub fn set_create_time<T>(mut self, v: T) -> Self
10796 where
10797 T: std::convert::Into<wkt::Timestamp>,
10798 {
10799 self.create_time = std::option::Option::Some(v.into());
10800 self
10801 }
10802
10803 /// Sets or clears the value of [create_time][crate::model::UserCreds::create_time].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10808 /// use wkt::Timestamp;
10809 /// let x = UserCreds::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10810 /// let x = UserCreds::new().set_or_clear_create_time(None::<Timestamp>);
10811 /// ```
10812 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10813 where
10814 T: std::convert::Into<wkt::Timestamp>,
10815 {
10816 self.create_time = v.map(|x| x.into());
10817 self
10818 }
10819
10820 /// Sets the value of [update_time][crate::model::UserCreds::update_time].
10821 ///
10822 /// # Example
10823 /// ```ignore,no_run
10824 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10825 /// use wkt::Timestamp;
10826 /// let x = UserCreds::new().set_update_time(Timestamp::default()/* use setters */);
10827 /// ```
10828 pub fn set_update_time<T>(mut self, v: T) -> Self
10829 where
10830 T: std::convert::Into<wkt::Timestamp>,
10831 {
10832 self.update_time = std::option::Option::Some(v.into());
10833 self
10834 }
10835
10836 /// Sets or clears the value of [update_time][crate::model::UserCreds::update_time].
10837 ///
10838 /// # Example
10839 /// ```ignore,no_run
10840 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10841 /// use wkt::Timestamp;
10842 /// let x = UserCreds::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10843 /// let x = UserCreds::new().set_or_clear_update_time(None::<Timestamp>);
10844 /// ```
10845 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10846 where
10847 T: std::convert::Into<wkt::Timestamp>,
10848 {
10849 self.update_time = v.map(|x| x.into());
10850 self
10851 }
10852
10853 /// Sets the value of [state][crate::model::UserCreds::state].
10854 ///
10855 /// # Example
10856 /// ```ignore,no_run
10857 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10858 /// use google_cloud_firestore_admin_v1::model::user_creds::State;
10859 /// let x0 = UserCreds::new().set_state(State::Enabled);
10860 /// let x1 = UserCreds::new().set_state(State::Disabled);
10861 /// ```
10862 pub fn set_state<T: std::convert::Into<crate::model::user_creds::State>>(
10863 mut self,
10864 v: T,
10865 ) -> Self {
10866 self.state = v.into();
10867 self
10868 }
10869
10870 /// Sets the value of [secure_password][crate::model::UserCreds::secure_password].
10871 ///
10872 /// # Example
10873 /// ```ignore,no_run
10874 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10875 /// let x = UserCreds::new().set_secure_password("example");
10876 /// ```
10877 pub fn set_secure_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10878 self.secure_password = v.into();
10879 self
10880 }
10881
10882 /// Sets the value of [user_creds_identity][crate::model::UserCreds::user_creds_identity].
10883 ///
10884 /// Note that all the setters affecting `user_creds_identity` are mutually
10885 /// exclusive.
10886 ///
10887 /// # Example
10888 /// ```ignore,no_run
10889 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10890 /// use google_cloud_firestore_admin_v1::model::user_creds::ResourceIdentity;
10891 /// let x = UserCreds::new().set_user_creds_identity(Some(
10892 /// google_cloud_firestore_admin_v1::model::user_creds::UserCredsIdentity::ResourceIdentity(ResourceIdentity::default().into())));
10893 /// ```
10894 pub fn set_user_creds_identity<
10895 T: std::convert::Into<std::option::Option<crate::model::user_creds::UserCredsIdentity>>,
10896 >(
10897 mut self,
10898 v: T,
10899 ) -> Self {
10900 self.user_creds_identity = v.into();
10901 self
10902 }
10903
10904 /// The value of [user_creds_identity][crate::model::UserCreds::user_creds_identity]
10905 /// if it holds a `ResourceIdentity`, `None` if the field is not set or
10906 /// holds a different branch.
10907 pub fn resource_identity(
10908 &self,
10909 ) -> std::option::Option<&std::boxed::Box<crate::model::user_creds::ResourceIdentity>> {
10910 #[allow(unreachable_patterns)]
10911 self.user_creds_identity.as_ref().and_then(|v| match v {
10912 crate::model::user_creds::UserCredsIdentity::ResourceIdentity(v) => {
10913 std::option::Option::Some(v)
10914 }
10915 _ => std::option::Option::None,
10916 })
10917 }
10918
10919 /// Sets the value of [user_creds_identity][crate::model::UserCreds::user_creds_identity]
10920 /// to hold a `ResourceIdentity`.
10921 ///
10922 /// Note that all the setters affecting `user_creds_identity` are
10923 /// mutually exclusive.
10924 ///
10925 /// # Example
10926 /// ```ignore,no_run
10927 /// # use google_cloud_firestore_admin_v1::model::UserCreds;
10928 /// use google_cloud_firestore_admin_v1::model::user_creds::ResourceIdentity;
10929 /// let x = UserCreds::new().set_resource_identity(ResourceIdentity::default()/* use setters */);
10930 /// assert!(x.resource_identity().is_some());
10931 /// ```
10932 pub fn set_resource_identity<
10933 T: std::convert::Into<std::boxed::Box<crate::model::user_creds::ResourceIdentity>>,
10934 >(
10935 mut self,
10936 v: T,
10937 ) -> Self {
10938 self.user_creds_identity = std::option::Option::Some(
10939 crate::model::user_creds::UserCredsIdentity::ResourceIdentity(v.into()),
10940 );
10941 self
10942 }
10943}
10944
10945impl wkt::message::Message for UserCreds {
10946 fn typename() -> &'static str {
10947 "type.googleapis.com/google.firestore.admin.v1.UserCreds"
10948 }
10949}
10950
10951/// Defines additional types related to [UserCreds].
10952pub mod user_creds {
10953 #[allow(unused_imports)]
10954 use super::*;
10955
10956 /// Describes a Resource Identity principal.
10957 #[derive(Clone, Default, PartialEq)]
10958 #[non_exhaustive]
10959 pub struct ResourceIdentity {
10960 /// Output only. Principal identifier string.
10961 /// See: <https://cloud.google.com/iam/docs/principal-identifiers>
10962 pub principal: std::string::String,
10963
10964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10965 }
10966
10967 impl ResourceIdentity {
10968 /// Creates a new default instance.
10969 pub fn new() -> Self {
10970 std::default::Default::default()
10971 }
10972
10973 /// Sets the value of [principal][crate::model::user_creds::ResourceIdentity::principal].
10974 ///
10975 /// # Example
10976 /// ```ignore,no_run
10977 /// # use google_cloud_firestore_admin_v1::model::user_creds::ResourceIdentity;
10978 /// let x = ResourceIdentity::new().set_principal("example");
10979 /// ```
10980 pub fn set_principal<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10981 self.principal = v.into();
10982 self
10983 }
10984 }
10985
10986 impl wkt::message::Message for ResourceIdentity {
10987 fn typename() -> &'static str {
10988 "type.googleapis.com/google.firestore.admin.v1.UserCreds.ResourceIdentity"
10989 }
10990 }
10991
10992 /// The state of the user creds (ENABLED or DISABLED).
10993 ///
10994 /// # Working with unknown values
10995 ///
10996 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10997 /// additional enum variants at any time. Adding new variants is not considered
10998 /// a breaking change. Applications should write their code in anticipation of:
10999 ///
11000 /// - New values appearing in future releases of the client library, **and**
11001 /// - New values received dynamically, without application changes.
11002 ///
11003 /// Please consult the [Working with enums] section in the user guide for some
11004 /// guidelines.
11005 ///
11006 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11007 #[derive(Clone, Debug, PartialEq)]
11008 #[non_exhaustive]
11009 pub enum State {
11010 /// The default value. Should not be used.
11011 Unspecified,
11012 /// The user creds are enabled.
11013 Enabled,
11014 /// The user creds are disabled.
11015 Disabled,
11016 /// If set, the enum was initialized with an unknown value.
11017 ///
11018 /// Applications can examine the value using [State::value] or
11019 /// [State::name].
11020 UnknownValue(state::UnknownValue),
11021 }
11022
11023 #[doc(hidden)]
11024 pub mod state {
11025 #[allow(unused_imports)]
11026 use super::*;
11027 #[derive(Clone, Debug, PartialEq)]
11028 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11029 }
11030
11031 impl State {
11032 /// Gets the enum value.
11033 ///
11034 /// Returns `None` if the enum contains an unknown value deserialized from
11035 /// the string representation of enums.
11036 pub fn value(&self) -> std::option::Option<i32> {
11037 match self {
11038 Self::Unspecified => std::option::Option::Some(0),
11039 Self::Enabled => std::option::Option::Some(1),
11040 Self::Disabled => std::option::Option::Some(2),
11041 Self::UnknownValue(u) => u.0.value(),
11042 }
11043 }
11044
11045 /// Gets the enum value as a string.
11046 ///
11047 /// Returns `None` if the enum contains an unknown value deserialized from
11048 /// the integer representation of enums.
11049 pub fn name(&self) -> std::option::Option<&str> {
11050 match self {
11051 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11052 Self::Enabled => std::option::Option::Some("ENABLED"),
11053 Self::Disabled => std::option::Option::Some("DISABLED"),
11054 Self::UnknownValue(u) => u.0.name(),
11055 }
11056 }
11057 }
11058
11059 impl std::default::Default for State {
11060 fn default() -> Self {
11061 use std::convert::From;
11062 Self::from(0)
11063 }
11064 }
11065
11066 impl std::fmt::Display for State {
11067 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11068 wkt::internal::display_enum(f, self.name(), self.value())
11069 }
11070 }
11071
11072 impl std::convert::From<i32> for State {
11073 fn from(value: i32) -> Self {
11074 match value {
11075 0 => Self::Unspecified,
11076 1 => Self::Enabled,
11077 2 => Self::Disabled,
11078 _ => Self::UnknownValue(state::UnknownValue(
11079 wkt::internal::UnknownEnumValue::Integer(value),
11080 )),
11081 }
11082 }
11083 }
11084
11085 impl std::convert::From<&str> for State {
11086 fn from(value: &str) -> Self {
11087 use std::string::ToString;
11088 match value {
11089 "STATE_UNSPECIFIED" => Self::Unspecified,
11090 "ENABLED" => Self::Enabled,
11091 "DISABLED" => Self::Disabled,
11092 _ => Self::UnknownValue(state::UnknownValue(
11093 wkt::internal::UnknownEnumValue::String(value.to_string()),
11094 )),
11095 }
11096 }
11097 }
11098
11099 impl serde::ser::Serialize for State {
11100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11101 where
11102 S: serde::Serializer,
11103 {
11104 match self {
11105 Self::Unspecified => serializer.serialize_i32(0),
11106 Self::Enabled => serializer.serialize_i32(1),
11107 Self::Disabled => serializer.serialize_i32(2),
11108 Self::UnknownValue(u) => u.0.serialize(serializer),
11109 }
11110 }
11111 }
11112
11113 impl<'de> serde::de::Deserialize<'de> for State {
11114 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11115 where
11116 D: serde::Deserializer<'de>,
11117 {
11118 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11119 ".google.firestore.admin.v1.UserCreds.State",
11120 ))
11121 }
11122 }
11123
11124 /// Identity associated with this User Creds.
11125 #[derive(Clone, Debug, PartialEq)]
11126 #[non_exhaustive]
11127 pub enum UserCredsIdentity {
11128 /// Resource Identity descriptor.
11129 ResourceIdentity(std::boxed::Box<crate::model::user_creds::ResourceIdentity>),
11130 }
11131}
11132
11133/// Describes the state of the operation.
11134///
11135/// # Working with unknown values
11136///
11137/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11138/// additional enum variants at any time. Adding new variants is not considered
11139/// a breaking change. Applications should write their code in anticipation of:
11140///
11141/// - New values appearing in future releases of the client library, **and**
11142/// - New values received dynamically, without application changes.
11143///
11144/// Please consult the [Working with enums] section in the user guide for some
11145/// guidelines.
11146///
11147/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11148#[derive(Clone, Debug, PartialEq)]
11149#[non_exhaustive]
11150pub enum OperationState {
11151 /// Unspecified.
11152 Unspecified,
11153 /// Request is being prepared for processing.
11154 Initializing,
11155 /// Request is actively being processed.
11156 Processing,
11157 /// Request is in the process of being cancelled after user called
11158 /// google.longrunning.Operations.CancelOperation on the operation.
11159 Cancelling,
11160 /// Request has been processed and is in its finalization stage.
11161 Finalizing,
11162 /// Request has completed successfully.
11163 Successful,
11164 /// Request has finished being processed, but encountered an error.
11165 Failed,
11166 /// Request has finished being cancelled after user called
11167 /// google.longrunning.Operations.CancelOperation.
11168 Cancelled,
11169 /// If set, the enum was initialized with an unknown value.
11170 ///
11171 /// Applications can examine the value using [OperationState::value] or
11172 /// [OperationState::name].
11173 UnknownValue(operation_state::UnknownValue),
11174}
11175
11176#[doc(hidden)]
11177pub mod operation_state {
11178 #[allow(unused_imports)]
11179 use super::*;
11180 #[derive(Clone, Debug, PartialEq)]
11181 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11182}
11183
11184impl OperationState {
11185 /// Gets the enum value.
11186 ///
11187 /// Returns `None` if the enum contains an unknown value deserialized from
11188 /// the string representation of enums.
11189 pub fn value(&self) -> std::option::Option<i32> {
11190 match self {
11191 Self::Unspecified => std::option::Option::Some(0),
11192 Self::Initializing => std::option::Option::Some(1),
11193 Self::Processing => std::option::Option::Some(2),
11194 Self::Cancelling => std::option::Option::Some(3),
11195 Self::Finalizing => std::option::Option::Some(4),
11196 Self::Successful => std::option::Option::Some(5),
11197 Self::Failed => std::option::Option::Some(6),
11198 Self::Cancelled => std::option::Option::Some(7),
11199 Self::UnknownValue(u) => u.0.value(),
11200 }
11201 }
11202
11203 /// Gets the enum value as a string.
11204 ///
11205 /// Returns `None` if the enum contains an unknown value deserialized from
11206 /// the integer representation of enums.
11207 pub fn name(&self) -> std::option::Option<&str> {
11208 match self {
11209 Self::Unspecified => std::option::Option::Some("OPERATION_STATE_UNSPECIFIED"),
11210 Self::Initializing => std::option::Option::Some("INITIALIZING"),
11211 Self::Processing => std::option::Option::Some("PROCESSING"),
11212 Self::Cancelling => std::option::Option::Some("CANCELLING"),
11213 Self::Finalizing => std::option::Option::Some("FINALIZING"),
11214 Self::Successful => std::option::Option::Some("SUCCESSFUL"),
11215 Self::Failed => std::option::Option::Some("FAILED"),
11216 Self::Cancelled => std::option::Option::Some("CANCELLED"),
11217 Self::UnknownValue(u) => u.0.name(),
11218 }
11219 }
11220}
11221
11222impl std::default::Default for OperationState {
11223 fn default() -> Self {
11224 use std::convert::From;
11225 Self::from(0)
11226 }
11227}
11228
11229impl std::fmt::Display for OperationState {
11230 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11231 wkt::internal::display_enum(f, self.name(), self.value())
11232 }
11233}
11234
11235impl std::convert::From<i32> for OperationState {
11236 fn from(value: i32) -> Self {
11237 match value {
11238 0 => Self::Unspecified,
11239 1 => Self::Initializing,
11240 2 => Self::Processing,
11241 3 => Self::Cancelling,
11242 4 => Self::Finalizing,
11243 5 => Self::Successful,
11244 6 => Self::Failed,
11245 7 => Self::Cancelled,
11246 _ => Self::UnknownValue(operation_state::UnknownValue(
11247 wkt::internal::UnknownEnumValue::Integer(value),
11248 )),
11249 }
11250 }
11251}
11252
11253impl std::convert::From<&str> for OperationState {
11254 fn from(value: &str) -> Self {
11255 use std::string::ToString;
11256 match value {
11257 "OPERATION_STATE_UNSPECIFIED" => Self::Unspecified,
11258 "INITIALIZING" => Self::Initializing,
11259 "PROCESSING" => Self::Processing,
11260 "CANCELLING" => Self::Cancelling,
11261 "FINALIZING" => Self::Finalizing,
11262 "SUCCESSFUL" => Self::Successful,
11263 "FAILED" => Self::Failed,
11264 "CANCELLED" => Self::Cancelled,
11265 _ => Self::UnknownValue(operation_state::UnknownValue(
11266 wkt::internal::UnknownEnumValue::String(value.to_string()),
11267 )),
11268 }
11269 }
11270}
11271
11272impl serde::ser::Serialize for OperationState {
11273 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11274 where
11275 S: serde::Serializer,
11276 {
11277 match self {
11278 Self::Unspecified => serializer.serialize_i32(0),
11279 Self::Initializing => serializer.serialize_i32(1),
11280 Self::Processing => serializer.serialize_i32(2),
11281 Self::Cancelling => serializer.serialize_i32(3),
11282 Self::Finalizing => serializer.serialize_i32(4),
11283 Self::Successful => serializer.serialize_i32(5),
11284 Self::Failed => serializer.serialize_i32(6),
11285 Self::Cancelled => serializer.serialize_i32(7),
11286 Self::UnknownValue(u) => u.0.serialize(serializer),
11287 }
11288 }
11289}
11290
11291impl<'de> serde::de::Deserialize<'de> for OperationState {
11292 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11293 where
11294 D: serde::Deserializer<'de>,
11295 {
11296 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationState>::new(
11297 ".google.firestore.admin.v1.OperationState",
11298 ))
11299 }
11300}
11301
11302/// The Realtime Updates mode.
11303///
11304/// # Working with unknown values
11305///
11306/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11307/// additional enum variants at any time. Adding new variants is not considered
11308/// a breaking change. Applications should write their code in anticipation of:
11309///
11310/// - New values appearing in future releases of the client library, **and**
11311/// - New values received dynamically, without application changes.
11312///
11313/// Please consult the [Working with enums] section in the user guide for some
11314/// guidelines.
11315///
11316/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11317#[derive(Clone, Debug, PartialEq)]
11318#[non_exhaustive]
11319pub enum RealtimeUpdatesMode {
11320 /// The Realtime Updates feature is not specified.
11321 Unspecified,
11322 /// The Realtime Updates feature is enabled by default.
11323 ///
11324 /// This could potentially degrade write performance for the database.
11325 Enabled,
11326 /// The Realtime Updates feature is disabled by default.
11327 Disabled,
11328 /// If set, the enum was initialized with an unknown value.
11329 ///
11330 /// Applications can examine the value using [RealtimeUpdatesMode::value] or
11331 /// [RealtimeUpdatesMode::name].
11332 UnknownValue(realtime_updates_mode::UnknownValue),
11333}
11334
11335#[doc(hidden)]
11336pub mod realtime_updates_mode {
11337 #[allow(unused_imports)]
11338 use super::*;
11339 #[derive(Clone, Debug, PartialEq)]
11340 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11341}
11342
11343impl RealtimeUpdatesMode {
11344 /// Gets the enum value.
11345 ///
11346 /// Returns `None` if the enum contains an unknown value deserialized from
11347 /// the string representation of enums.
11348 pub fn value(&self) -> std::option::Option<i32> {
11349 match self {
11350 Self::Unspecified => std::option::Option::Some(0),
11351 Self::Enabled => std::option::Option::Some(1),
11352 Self::Disabled => std::option::Option::Some(2),
11353 Self::UnknownValue(u) => u.0.value(),
11354 }
11355 }
11356
11357 /// Gets the enum value as a string.
11358 ///
11359 /// Returns `None` if the enum contains an unknown value deserialized from
11360 /// the integer representation of enums.
11361 pub fn name(&self) -> std::option::Option<&str> {
11362 match self {
11363 Self::Unspecified => std::option::Option::Some("REALTIME_UPDATES_MODE_UNSPECIFIED"),
11364 Self::Enabled => std::option::Option::Some("REALTIME_UPDATES_MODE_ENABLED"),
11365 Self::Disabled => std::option::Option::Some("REALTIME_UPDATES_MODE_DISABLED"),
11366 Self::UnknownValue(u) => u.0.name(),
11367 }
11368 }
11369}
11370
11371impl std::default::Default for RealtimeUpdatesMode {
11372 fn default() -> Self {
11373 use std::convert::From;
11374 Self::from(0)
11375 }
11376}
11377
11378impl std::fmt::Display for RealtimeUpdatesMode {
11379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11380 wkt::internal::display_enum(f, self.name(), self.value())
11381 }
11382}
11383
11384impl std::convert::From<i32> for RealtimeUpdatesMode {
11385 fn from(value: i32) -> Self {
11386 match value {
11387 0 => Self::Unspecified,
11388 1 => Self::Enabled,
11389 2 => Self::Disabled,
11390 _ => Self::UnknownValue(realtime_updates_mode::UnknownValue(
11391 wkt::internal::UnknownEnumValue::Integer(value),
11392 )),
11393 }
11394 }
11395}
11396
11397impl std::convert::From<&str> for RealtimeUpdatesMode {
11398 fn from(value: &str) -> Self {
11399 use std::string::ToString;
11400 match value {
11401 "REALTIME_UPDATES_MODE_UNSPECIFIED" => Self::Unspecified,
11402 "REALTIME_UPDATES_MODE_ENABLED" => Self::Enabled,
11403 "REALTIME_UPDATES_MODE_DISABLED" => Self::Disabled,
11404 _ => Self::UnknownValue(realtime_updates_mode::UnknownValue(
11405 wkt::internal::UnknownEnumValue::String(value.to_string()),
11406 )),
11407 }
11408 }
11409}
11410
11411impl serde::ser::Serialize for RealtimeUpdatesMode {
11412 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11413 where
11414 S: serde::Serializer,
11415 {
11416 match self {
11417 Self::Unspecified => serializer.serialize_i32(0),
11418 Self::Enabled => serializer.serialize_i32(1),
11419 Self::Disabled => serializer.serialize_i32(2),
11420 Self::UnknownValue(u) => u.0.serialize(serializer),
11421 }
11422 }
11423}
11424
11425impl<'de> serde::de::Deserialize<'de> for RealtimeUpdatesMode {
11426 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11427 where
11428 D: serde::Deserializer<'de>,
11429 {
11430 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RealtimeUpdatesMode>::new(
11431 ".google.firestore.admin.v1.RealtimeUpdatesMode",
11432 ))
11433 }
11434}