#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexField {
#[prost(string, tag = "1")]
pub field_path: ::prost::alloc::string::String,
#[prost(enumeration = "index_field::Mode", tag = "2")]
pub mode: i32,
}
pub mod index_field {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Mode {
Unspecified = 0,
Ascending = 2,
Descending = 3,
ArrayContains = 4,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Index {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub collection_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub fields: ::prost::alloc::vec::Vec<IndexField>,
#[prost(enumeration = "index::State", tag = "6")]
pub state: i32,
}
pub mod index {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Creating = 3,
Ready = 2,
Error = 5,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexOperationMetadata {
#[prost(message, optional, tag = "1")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "3")]
pub index: ::prost::alloc::string::String,
#[prost(enumeration = "index_operation_metadata::OperationType", tag = "4")]
pub operation_type: i32,
#[prost(bool, tag = "5")]
pub cancelled: bool,
#[prost(message, optional, tag = "6")]
pub document_progress: ::core::option::Option<Progress>,
}
pub mod index_operation_metadata {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationType {
Unspecified = 0,
CreatingIndex = 1,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Progress {
#[prost(int64, tag = "1")]
pub work_completed: i64,
#[prost(int64, tag = "2")]
pub work_estimated: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateIndexRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub index: ::core::option::Option<Index>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetIndexRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListIndexesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub page_size: i32,
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteIndexRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListIndexesResponse {
#[prost(message, repeated, tag = "1")]
pub indexes: ::prost::alloc::vec::Vec<Index>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportDocumentsRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "4")]
pub output_uri_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportDocumentsRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "4")]
pub input_uri_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportDocumentsResponse {
#[prost(string, tag = "1")]
pub output_uri_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportDocumentsMetadata {
#[prost(message, optional, tag = "1")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "OperationState", tag = "3")]
pub operation_state: i32,
#[prost(message, optional, tag = "4")]
pub progress_documents: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "5")]
pub progress_bytes: ::core::option::Option<Progress>,
#[prost(string, repeated, tag = "6")]
pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "7")]
pub output_uri_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportDocumentsMetadata {
#[prost(message, optional, tag = "1")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "OperationState", tag = "3")]
pub operation_state: i32,
#[prost(message, optional, tag = "4")]
pub progress_documents: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "5")]
pub progress_bytes: ::core::option::Option<Progress>,
#[prost(string, repeated, tag = "6")]
pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "7")]
pub input_uri_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationState {
StateUnspecified = 0,
Initializing = 1,
Processing = 2,
Cancelling = 3,
Finalizing = 4,
Successful = 5,
Failed = 6,
Cancelled = 7,
}
#[doc = r" Generated client implementations."]
pub mod firestore_admin_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " The Cloud Firestore Admin API."]
#[doc = ""]
#[doc = " This API provides several administrative services for Cloud Firestore."]
#[doc = ""]
#[doc = " # Concepts"]
#[doc = ""]
#[doc = " Project, Database, Namespace, Collection, and Document are used as defined in"]
#[doc = " the Google Cloud Firestore API."]
#[doc = ""]
#[doc = " Operation: An Operation represents work being performed in the background."]
#[doc = ""]
#[doc = ""]
#[doc = " # Services"]
#[doc = ""]
#[doc = " ## Index"]
#[doc = ""]
#[doc = " The index service manages Cloud Firestore indexes."]
#[doc = ""]
#[doc = " Index creation is performed asynchronously."]
#[doc = " An Operation resource is created for each such asynchronous operation."]
#[doc = " The state of the operation (including any errors encountered)"]
#[doc = " may be queried via the Operation resource."]
#[doc = ""]
#[doc = " ## Metadata"]
#[doc = ""]
#[doc = " Provides metadata and statistical information about data in Cloud Firestore."]
#[doc = " The data provided as part of this API may be stale."]
#[doc = ""]
#[doc = " ## Operation"]
#[doc = ""]
#[doc = " The Operations collection provides a record of actions performed for the"]
#[doc = " specified Project (including any Operations in progress). Operations are not"]
#[doc = " created directly but through calls on other collections or resources."]
#[doc = ""]
#[doc = " An Operation that is not yet done may be cancelled. The request to cancel is"]
#[doc = " asynchronous and the Operation may continue to run for some time after the"]
#[doc = " request to cancel is made."]
#[doc = ""]
#[doc = " An Operation that is done may be deleted so that it is no longer listed as"]
#[doc = " part of the Operation collection."]
#[doc = ""]
#[doc = " Operations are created by service `FirestoreAdmin`, but are accessed via"]
#[doc = " service `google.longrunning.Operations`."]
#[derive(Debug, Clone)]
pub struct FirestoreAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> FirestoreAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> FirestoreAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
FirestoreAdminClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates the specified index."]
#[doc = " A newly created index's initial state is `CREATING`. On completion of the"]
#[doc = " returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`."]
#[doc = " If the index already exists, the call will return an `ALREADY_EXISTS`"]
#[doc = " status."]
#[doc = ""]
#[doc = " During creation, the process could result in an error, in which case the"]
#[doc = " index will move to the `ERROR` state. The process can be recovered by"]
#[doc = " fixing the data that caused the error, removing the index with"]
#[doc = " [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with"]
#[doc = " [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex]."]
#[doc = ""]
#[doc = " Indexes with a single field cannot be created."]
pub async fn create_index(
&mut self,
request: impl tonic::IntoRequest<super::CreateIndexRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/CreateIndex",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the indexes that match the specified filters."]
pub async fn list_indexes(
&mut self,
request: impl tonic::IntoRequest<super::ListIndexesRequest>,
) -> Result<tonic::Response<super::ListIndexesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/ListIndexes",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets an index."]
pub async fn get_index(
&mut self,
request: impl tonic::IntoRequest<super::GetIndexRequest>,
) -> Result<tonic::Response<super::Index>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/GetIndex",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes an index."]
pub async fn delete_index(
&mut self,
request: impl tonic::IntoRequest<super::DeleteIndexRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/DeleteIndex",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Exports a copy of all or a subset of documents from Google Cloud Firestore"]
#[doc = " to another storage system, such as Google Cloud Storage. Recent updates to"]
#[doc = " documents may not be reflected in the export. The export occurs in the"]
#[doc = " background and its progress can be monitored and managed via the"]
#[doc = " Operation resource that is created. The output of an export may only be"]
#[doc = " used once the associated operation is done. If an export operation is"]
#[doc = " cancelled before completion it may leave partial data behind in Google"]
#[doc = " Cloud Storage."]
pub async fn export_documents(
&mut self,
request: impl tonic::IntoRequest<super::ExportDocumentsRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/ExportDocuments",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Imports documents into Google Cloud Firestore. Existing documents with the"]
#[doc = " same name are overwritten. The import occurs in the background and its"]
#[doc = " progress can be monitored and managed via the Operation resource that is"]
#[doc = " created. If an ImportDocuments operation is cancelled, it is possible"]
#[doc = " that a subset of the data has already been imported to Cloud Firestore."]
pub async fn import_documents(
&mut self,
request: impl tonic::IntoRequest<super::ImportDocumentsRequest>,
) -> Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.firestore.admin.v1beta1.FirestoreAdmin/ImportDocuments",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationMetadata {}