#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommonMetadata {
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub operation_type: crate::model::OperationType,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub state: crate::model::common_metadata::State,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CommonMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
mut self,
v: T,
) -> Self {
self.operation_type = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_state<T: std::convert::Into<crate::model::common_metadata::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for CommonMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.CommonMetadata"
}
}
pub mod common_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Initializing,
Processing,
Cancelling,
Finalizing,
Successful,
Failed,
Cancelled,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Initializing => std::option::Option::Some(1),
Self::Processing => std::option::Option::Some(2),
Self::Cancelling => std::option::Option::Some(3),
Self::Finalizing => std::option::Option::Some(4),
Self::Successful => std::option::Option::Some(5),
Self::Failed => std::option::Option::Some(6),
Self::Cancelled => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Initializing => std::option::Option::Some("INITIALIZING"),
Self::Processing => std::option::Option::Some("PROCESSING"),
Self::Cancelling => std::option::Option::Some("CANCELLING"),
Self::Finalizing => std::option::Option::Some("FINALIZING"),
Self::Successful => std::option::Option::Some("SUCCESSFUL"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Cancelled => std::option::Option::Some("CANCELLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Initializing,
2 => Self::Processing,
3 => Self::Cancelling,
4 => Self::Finalizing,
5 => Self::Successful,
6 => Self::Failed,
7 => Self::Cancelled,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"INITIALIZING" => Self::Initializing,
"PROCESSING" => Self::Processing,
"CANCELLING" => Self::Cancelling,
"FINALIZING" => Self::Finalizing,
"SUCCESSFUL" => Self::Successful,
"FAILED" => Self::Failed,
"CANCELLED" => Self::Cancelled,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Initializing => serializer.serialize_i32(1),
Self::Processing => serializer.serialize_i32(2),
Self::Cancelling => serializer.serialize_i32(3),
Self::Finalizing => serializer.serialize_i32(4),
Self::Successful => serializer.serialize_i32(5),
Self::Failed => serializer.serialize_i32(6),
Self::Cancelled => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.datastore.admin.v1.CommonMetadata.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Progress {
pub work_completed: i64,
pub work_estimated: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Progress {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_work_completed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.work_completed = v.into();
self
}
pub fn set_work_estimated<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.work_estimated = v.into();
self
}
}
impl wkt::message::Message for Progress {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.Progress"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportEntitiesRequest {
pub project_id: std::string::String,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub entity_filter: std::option::Option<crate::model::EntityFilter>,
pub output_url_prefix: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportEntitiesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_entity_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = v.map(|x| x.into());
self
}
pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_url_prefix = v.into();
self
}
}
impl wkt::message::Message for ExportEntitiesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ExportEntitiesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportEntitiesRequest {
pub project_id: std::string::String,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub input_url: std::string::String,
pub entity_filter: std::option::Option<crate::model::EntityFilter>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportEntitiesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.input_url = v.into();
self
}
pub fn set_entity_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ImportEntitiesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ImportEntitiesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportEntitiesResponse {
pub output_url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportEntitiesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_output_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.output_url = v.into();
self
}
}
impl wkt::message::Message for ExportEntitiesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ExportEntitiesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportEntitiesMetadata {
pub common: std::option::Option<crate::model::CommonMetadata>,
pub progress_entities: std::option::Option<crate::model::Progress>,
pub progress_bytes: std::option::Option<crate::model::Progress>,
pub entity_filter: std::option::Option<crate::model::EntityFilter>,
pub output_url_prefix: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExportEntitiesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_common<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = v.map(|x| x.into());
self
}
pub fn set_progress_entities<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = v.map(|x| x.into());
self
}
pub fn set_progress_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_bytes = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_bytes = v.map(|x| x.into());
self
}
pub fn set_entity_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = v.map(|x| x.into());
self
}
pub fn set_output_url_prefix<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_url_prefix = v.into();
self
}
}
impl wkt::message::Message for ExportEntitiesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportEntitiesMetadata {
pub common: std::option::Option<crate::model::CommonMetadata>,
pub progress_entities: std::option::Option<crate::model::Progress>,
pub progress_bytes: std::option::Option<crate::model::Progress>,
pub entity_filter: std::option::Option<crate::model::EntityFilter>,
pub input_url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImportEntitiesMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_common<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = v.map(|x| x.into());
self
}
pub fn set_progress_entities<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = v.map(|x| x.into());
self
}
pub fn set_progress_bytes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_bytes = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_progress_bytes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_bytes = v.map(|x| x.into());
self
}
pub fn set_entity_filter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityFilter>,
{
self.entity_filter = v.map(|x| x.into());
self
}
pub fn set_input_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.input_url = v.into();
self
}
}
impl wkt::message::Message for ImportEntitiesMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ImportEntitiesMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EntityFilter {
pub kinds: std::vec::Vec<std::string::String>,
pub namespace_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EntityFilter {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_kinds<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.kinds = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_namespace_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.namespace_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for EntityFilter {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.EntityFilter"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateIndexRequest {
pub project_id: std::string::String,
pub index: std::option::Option<crate::model::Index>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateIndexRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.index = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.index = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateIndexRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.CreateIndexRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteIndexRequest {
pub project_id: std::string::String,
pub index_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteIndexRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index_id = v.into();
self
}
}
impl wkt::message::Message for DeleteIndexRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.DeleteIndexRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetIndexRequest {
pub project_id: std::string::String,
pub index_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetIndexRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index_id = v.into();
self
}
}
impl wkt::message::Message for GetIndexRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.GetIndexRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListIndexesRequest {
pub project_id: std::string::String,
pub filter: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListIndexesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListIndexesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ListIndexesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListIndexesResponse {
pub indexes: std::vec::Vec<crate::model::Index>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListIndexesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_indexes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Index>,
{
use std::iter::Iterator;
self.indexes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListIndexesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.ListIndexesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListIndexesResponse {
type PageItem = crate::model::Index;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.indexes
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IndexOperationMetadata {
pub common: std::option::Option<crate::model::CommonMetadata>,
pub progress_entities: std::option::Option<crate::model::Progress>,
pub index_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IndexOperationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_common<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_common<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CommonMetadata>,
{
self.common = v.map(|x| x.into());
self
}
pub fn set_progress_entities<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_progress_entities<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Progress>,
{
self.progress_entities = v.map(|x| x.into());
self
}
pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index_id = v.into();
self
}
}
impl wkt::message::Message for IndexOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.IndexOperationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DatastoreFirestoreMigrationMetadata {
pub migration_state: crate::model::MigrationState,
pub migration_step: crate::model::MigrationStep,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DatastoreFirestoreMigrationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_migration_state<T: std::convert::Into<crate::model::MigrationState>>(
mut self,
v: T,
) -> Self {
self.migration_state = v.into();
self
}
pub fn set_migration_step<T: std::convert::Into<crate::model::MigrationStep>>(
mut self,
v: T,
) -> Self {
self.migration_step = v.into();
self
}
}
impl wkt::message::Message for DatastoreFirestoreMigrationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.DatastoreFirestoreMigrationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Index {
pub project_id: std::string::String,
pub index_id: std::string::String,
pub kind: std::string::String,
pub ancestor: crate::model::index::AncestorMode,
pub properties: std::vec::Vec<crate::model::index::IndexedProperty>,
pub state: crate::model::index::State,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Index {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.index_id = v.into();
self
}
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_ancestor<T: std::convert::Into<crate::model::index::AncestorMode>>(
mut self,
v: T,
) -> Self {
self.ancestor = v.into();
self
}
pub fn set_properties<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::index::IndexedProperty>,
{
use std::iter::Iterator;
self.properties = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_state<T: std::convert::Into<crate::model::index::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for Index {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.Index"
}
}
pub mod index {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IndexedProperty {
pub name: std::string::String,
pub direction: crate::model::index::Direction,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IndexedProperty {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_direction<T: std::convert::Into<crate::model::index::Direction>>(
mut self,
v: T,
) -> Self {
self.direction = v.into();
self
}
}
impl wkt::message::Message for IndexedProperty {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.Index.IndexedProperty"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AncestorMode {
Unspecified,
None,
AllAncestors,
UnknownValue(ancestor_mode::UnknownValue),
}
#[doc(hidden)]
pub mod ancestor_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AncestorMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::AllAncestors => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ANCESTOR_MODE_UNSPECIFIED"),
Self::None => std::option::Option::Some("NONE"),
Self::AllAncestors => std::option::Option::Some("ALL_ANCESTORS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AncestorMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AncestorMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AncestorMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::AllAncestors,
_ => Self::UnknownValue(ancestor_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AncestorMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ANCESTOR_MODE_UNSPECIFIED" => Self::Unspecified,
"NONE" => Self::None,
"ALL_ANCESTORS" => Self::AllAncestors,
_ => Self::UnknownValue(ancestor_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AncestorMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::None => serializer.serialize_i32(1),
Self::AllAncestors => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AncestorMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AncestorMode>::new(
".google.datastore.admin.v1.Index.AncestorMode",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Direction {
Unspecified,
Ascending,
Descending,
UnknownValue(direction::UnknownValue),
}
#[doc(hidden)]
pub mod direction {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Direction {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Ascending => std::option::Option::Some(1),
Self::Descending => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DIRECTION_UNSPECIFIED"),
Self::Ascending => std::option::Option::Some("ASCENDING"),
Self::Descending => std::option::Option::Some("DESCENDING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Direction {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Direction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Direction {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Ascending,
2 => Self::Descending,
_ => Self::UnknownValue(direction::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Direction {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DIRECTION_UNSPECIFIED" => Self::Unspecified,
"ASCENDING" => Self::Ascending,
"DESCENDING" => Self::Descending,
_ => Self::UnknownValue(direction::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Direction {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Ascending => serializer.serialize_i32(1),
Self::Descending => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Direction {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Direction>::new(
".google.datastore.admin.v1.Index.Direction",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Ready,
Deleting,
Error,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Creating => std::option::Option::Some(1),
Self::Ready => std::option::Option::Some(2),
Self::Deleting => std::option::Option::Some(3),
Self::Error => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Creating => std::option::Option::Some("CREATING"),
Self::Ready => std::option::Option::Some("READY"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Error => std::option::Option::Some("ERROR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Creating,
2 => Self::Ready,
3 => Self::Deleting,
4 => Self::Error,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CREATING" => Self::Creating,
"READY" => Self::Ready,
"DELETING" => Self::Deleting,
"ERROR" => Self::Error,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Creating => serializer.serialize_i32(1),
Self::Ready => serializer.serialize_i32(2),
Self::Deleting => serializer.serialize_i32(3),
Self::Error => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.datastore.admin.v1.Index.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MigrationStateEvent {
pub state: crate::model::MigrationState,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MigrationStateEvent {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_state<T: std::convert::Into<crate::model::MigrationState>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for MigrationStateEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.MigrationStateEvent"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MigrationProgressEvent {
pub step: crate::model::MigrationStep,
pub step_details: std::option::Option<crate::model::migration_progress_event::StepDetails>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MigrationProgressEvent {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_step<T: std::convert::Into<crate::model::MigrationStep>>(mut self, v: T) -> Self {
self.step = v.into();
self
}
pub fn set_step_details<
T: std::convert::Into<
std::option::Option<crate::model::migration_progress_event::StepDetails>,
>,
>(
mut self,
v: T,
) -> Self {
self.step_details = v.into();
self
}
pub fn prepare_step_details(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
> {
#[allow(unreachable_patterns)]
self.step_details.as_ref().and_then(|v| match v {
crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_prepare_step_details<
T: std::convert::Into<
std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
>,
>(
mut self,
v: T,
) -> Self {
self.step_details = std::option::Option::Some(
crate::model::migration_progress_event::StepDetails::PrepareStepDetails(v.into()),
);
self
}
pub fn redirect_writes_step_details(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
> {
#[allow(unreachable_patterns)]
self.step_details.as_ref().and_then(|v| match v {
crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_redirect_writes_step_details<
T: std::convert::Into<
std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
>,
>(
mut self,
v: T,
) -> Self {
self.step_details = std::option::Option::Some(
crate::model::migration_progress_event::StepDetails::RedirectWritesStepDetails(
v.into(),
),
);
self
}
}
impl wkt::message::Message for MigrationProgressEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent"
}
}
pub mod migration_progress_event {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrepareStepDetails {
pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PrepareStepDetails {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_concurrency_mode<
T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
>(
mut self,
v: T,
) -> Self {
self.concurrency_mode = v.into();
self
}
}
impl wkt::message::Message for PrepareStepDetails {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.PrepareStepDetails"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RedirectWritesStepDetails {
pub concurrency_mode: crate::model::migration_progress_event::ConcurrencyMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RedirectWritesStepDetails {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_concurrency_mode<
T: std::convert::Into<crate::model::migration_progress_event::ConcurrencyMode>,
>(
mut self,
v: T,
) -> Self {
self.concurrency_mode = v.into();
self
}
}
impl wkt::message::Message for RedirectWritesStepDetails {
fn typename() -> &'static str {
"type.googleapis.com/google.datastore.admin.v1.MigrationProgressEvent.RedirectWritesStepDetails"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConcurrencyMode {
Unspecified,
Pessimistic,
Optimistic,
OptimisticWithEntityGroups,
UnknownValue(concurrency_mode::UnknownValue),
}
#[doc(hidden)]
pub mod concurrency_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ConcurrencyMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pessimistic => std::option::Option::Some(1),
Self::Optimistic => std::option::Option::Some(2),
Self::OptimisticWithEntityGroups => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONCURRENCY_MODE_UNSPECIFIED"),
Self::Pessimistic => std::option::Option::Some("PESSIMISTIC"),
Self::Optimistic => std::option::Option::Some("OPTIMISTIC"),
Self::OptimisticWithEntityGroups => {
std::option::Option::Some("OPTIMISTIC_WITH_ENTITY_GROUPS")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ConcurrencyMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ConcurrencyMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ConcurrencyMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pessimistic,
2 => Self::Optimistic,
3 => Self::OptimisticWithEntityGroups,
_ => Self::UnknownValue(concurrency_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ConcurrencyMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONCURRENCY_MODE_UNSPECIFIED" => Self::Unspecified,
"PESSIMISTIC" => Self::Pessimistic,
"OPTIMISTIC" => Self::Optimistic,
"OPTIMISTIC_WITH_ENTITY_GROUPS" => Self::OptimisticWithEntityGroups,
_ => Self::UnknownValue(concurrency_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ConcurrencyMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Pessimistic => serializer.serialize_i32(1),
Self::Optimistic => serializer.serialize_i32(2),
Self::OptimisticWithEntityGroups => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ConcurrencyMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConcurrencyMode>::new(
".google.datastore.admin.v1.MigrationProgressEvent.ConcurrencyMode",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StepDetails {
PrepareStepDetails(
std::boxed::Box<crate::model::migration_progress_event::PrepareStepDetails>,
),
RedirectWritesStepDetails(
std::boxed::Box<crate::model::migration_progress_event::RedirectWritesStepDetails>,
),
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationType {
Unspecified,
ExportEntities,
ImportEntities,
CreateIndex,
DeleteIndex,
UnknownValue(operation_type::UnknownValue),
}
#[doc(hidden)]
pub mod operation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl OperationType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ExportEntities => std::option::Option::Some(1),
Self::ImportEntities => std::option::Option::Some(2),
Self::CreateIndex => std::option::Option::Some(3),
Self::DeleteIndex => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
Self::ExportEntities => std::option::Option::Some("EXPORT_ENTITIES"),
Self::ImportEntities => std::option::Option::Some("IMPORT_ENTITIES"),
Self::CreateIndex => std::option::Option::Some("CREATE_INDEX"),
Self::DeleteIndex => std::option::Option::Some("DELETE_INDEX"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for OperationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for OperationType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for OperationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ExportEntities,
2 => Self::ImportEntities,
3 => Self::CreateIndex,
4 => Self::DeleteIndex,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for OperationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"EXPORT_ENTITIES" => Self::ExportEntities,
"IMPORT_ENTITIES" => Self::ImportEntities,
"CREATE_INDEX" => Self::CreateIndex,
"DELETE_INDEX" => Self::DeleteIndex,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for OperationType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ExportEntities => serializer.serialize_i32(1),
Self::ImportEntities => serializer.serialize_i32(2),
Self::CreateIndex => serializer.serialize_i32(3),
Self::DeleteIndex => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for OperationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
".google.datastore.admin.v1.OperationType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MigrationState {
Unspecified,
Running,
Paused,
Complete,
UnknownValue(migration_state::UnknownValue),
}
#[doc(hidden)]
pub mod migration_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MigrationState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Running => std::option::Option::Some(1),
Self::Paused => std::option::Option::Some(2),
Self::Complete => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MIGRATION_STATE_UNSPECIFIED"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::Paused => std::option::Option::Some("PAUSED"),
Self::Complete => std::option::Option::Some("COMPLETE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MigrationState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MigrationState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MigrationState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Running,
2 => Self::Paused,
3 => Self::Complete,
_ => Self::UnknownValue(migration_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MigrationState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MIGRATION_STATE_UNSPECIFIED" => Self::Unspecified,
"RUNNING" => Self::Running,
"PAUSED" => Self::Paused,
"COMPLETE" => Self::Complete,
_ => Self::UnknownValue(migration_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MigrationState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Running => serializer.serialize_i32(1),
Self::Paused => serializer.serialize_i32(2),
Self::Complete => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MigrationState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationState>::new(
".google.datastore.admin.v1.MigrationState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MigrationStep {
Unspecified,
Prepare,
Start,
ApplyWritesSynchronously,
CopyAndVerify,
RedirectEventuallyConsistentReads,
RedirectStronglyConsistentReads,
RedirectWrites,
UnknownValue(migration_step::UnknownValue),
}
#[doc(hidden)]
pub mod migration_step {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MigrationStep {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Prepare => std::option::Option::Some(6),
Self::Start => std::option::Option::Some(1),
Self::ApplyWritesSynchronously => std::option::Option::Some(7),
Self::CopyAndVerify => std::option::Option::Some(2),
Self::RedirectEventuallyConsistentReads => std::option::Option::Some(3),
Self::RedirectStronglyConsistentReads => std::option::Option::Some(4),
Self::RedirectWrites => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MIGRATION_STEP_UNSPECIFIED"),
Self::Prepare => std::option::Option::Some("PREPARE"),
Self::Start => std::option::Option::Some("START"),
Self::ApplyWritesSynchronously => {
std::option::Option::Some("APPLY_WRITES_SYNCHRONOUSLY")
}
Self::CopyAndVerify => std::option::Option::Some("COPY_AND_VERIFY"),
Self::RedirectEventuallyConsistentReads => {
std::option::Option::Some("REDIRECT_EVENTUALLY_CONSISTENT_READS")
}
Self::RedirectStronglyConsistentReads => {
std::option::Option::Some("REDIRECT_STRONGLY_CONSISTENT_READS")
}
Self::RedirectWrites => std::option::Option::Some("REDIRECT_WRITES"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MigrationStep {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MigrationStep {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MigrationStep {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Start,
2 => Self::CopyAndVerify,
3 => Self::RedirectEventuallyConsistentReads,
4 => Self::RedirectStronglyConsistentReads,
5 => Self::RedirectWrites,
6 => Self::Prepare,
7 => Self::ApplyWritesSynchronously,
_ => Self::UnknownValue(migration_step::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MigrationStep {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MIGRATION_STEP_UNSPECIFIED" => Self::Unspecified,
"PREPARE" => Self::Prepare,
"START" => Self::Start,
"APPLY_WRITES_SYNCHRONOUSLY" => Self::ApplyWritesSynchronously,
"COPY_AND_VERIFY" => Self::CopyAndVerify,
"REDIRECT_EVENTUALLY_CONSISTENT_READS" => Self::RedirectEventuallyConsistentReads,
"REDIRECT_STRONGLY_CONSISTENT_READS" => Self::RedirectStronglyConsistentReads,
"REDIRECT_WRITES" => Self::RedirectWrites,
_ => Self::UnknownValue(migration_step::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MigrationStep {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Prepare => serializer.serialize_i32(6),
Self::Start => serializer.serialize_i32(1),
Self::ApplyWritesSynchronously => serializer.serialize_i32(7),
Self::CopyAndVerify => serializer.serialize_i32(2),
Self::RedirectEventuallyConsistentReads => serializer.serialize_i32(3),
Self::RedirectStronglyConsistentReads => serializer.serialize_i32(4),
Self::RedirectWrites => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MigrationStep {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationStep>::new(
".google.datastore.admin.v1.MigrationStep",
))
}
}