#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Index {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub index_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub kind: ::prost::alloc::string::String,
#[prost(enumeration = "index::AncestorMode", tag = "5")]
pub ancestor: i32,
#[prost(message, repeated, tag = "6")]
pub properties: ::prost::alloc::vec::Vec<index::IndexedProperty>,
#[prost(enumeration = "index::State", tag = "7")]
pub state: i32,
}
pub mod index {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexedProperty {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "Direction", tag = "2")]
pub direction: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AncestorMode {
Unspecified = 0,
None = 1,
AllAncestors = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Direction {
Unspecified = 0,
Ascending = 1,
Descending = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Creating = 1,
Ready = 2,
Deleting = 3,
Error = 4,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommonMetadata {
#[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 = "OperationType", tag = "3")]
pub operation_type: i32,
#[prost(map = "string, string", tag = "4")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(enumeration = "common_metadata::State", tag = "5")]
pub state: i32,
}
pub mod common_metadata {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Initializing = 1,
Processing = 2,
Cancelling = 3,
Finalizing = 4,
Successful = 5,
Failed = 6,
Cancelled = 7,
}
}
#[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 ExportEntitiesRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(message, optional, tag = "3")]
pub entity_filter: ::core::option::Option<EntityFilter>,
#[prost(string, tag = "4")]
pub output_url_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportEntitiesRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub input_url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub entity_filter: ::core::option::Option<EntityFilter>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportEntitiesResponse {
#[prost(string, tag = "1")]
pub output_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportEntitiesMetadata {
#[prost(message, optional, tag = "1")]
pub common: ::core::option::Option<CommonMetadata>,
#[prost(message, optional, tag = "2")]
pub progress_entities: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "3")]
pub progress_bytes: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "4")]
pub entity_filter: ::core::option::Option<EntityFilter>,
#[prost(string, tag = "5")]
pub output_url_prefix: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportEntitiesMetadata {
#[prost(message, optional, tag = "1")]
pub common: ::core::option::Option<CommonMetadata>,
#[prost(message, optional, tag = "2")]
pub progress_entities: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "3")]
pub progress_bytes: ::core::option::Option<Progress>,
#[prost(message, optional, tag = "4")]
pub entity_filter: ::core::option::Option<EntityFilter>,
#[prost(string, tag = "5")]
pub input_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityFilter {
#[prost(string, repeated, tag = "1")]
pub kinds: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "2")]
pub namespace_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateIndexRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub index: ::core::option::Option<Index>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteIndexRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub index_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetIndexRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub index_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListIndexesRequest {
#[prost(string, tag = "1")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub page_size: i32,
#[prost(string, tag = "5")]
pub page_token: ::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 IndexOperationMetadata {
#[prost(message, optional, tag = "1")]
pub common: ::core::option::Option<CommonMetadata>,
#[prost(message, optional, tag = "2")]
pub progress_entities: ::core::option::Option<Progress>,
#[prost(string, tag = "3")]
pub index_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationType {
Unspecified = 0,
ExportEntities = 1,
ImportEntities = 2,
CreateIndex = 3,
DeleteIndex = 4,
}
#[doc = r" Generated client implementations."]
pub mod datastore_admin_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Google Cloud Datastore Admin API"]
#[doc = ""]
#[doc = ""]
#[doc = " The Datastore Admin API provides several admin services for Cloud Datastore."]
#[doc = ""]
#[doc = " -----------------------------------------------------------------------------"]
#[doc = " ## Concepts"]
#[doc = ""]
#[doc = " Project, namespace, kind, and entity as defined in the Google Cloud Datastore"]
#[doc = " API."]
#[doc = ""]
#[doc = " Operation: An Operation represents work being performed in the background."]
#[doc = ""]
#[doc = " EntityFilter: Allows specifying a subset of entities in a project. This is"]
#[doc = " specified as a combination of kinds and namespaces (either or both of which"]
#[doc = " may be all)."]
#[doc = ""]
#[doc = " -----------------------------------------------------------------------------"]
#[doc = " ## Services"]
#[doc = ""]
#[doc = " # Export/Import"]
#[doc = ""]
#[doc = " The Export/Import service provides the ability to copy all or a subset of"]
#[doc = " entities to/from Google Cloud Storage."]
#[doc = ""]
#[doc = " Exported data may be imported into Cloud Datastore for any Google Cloud"]
#[doc = " Platform project. It is not restricted to the export source project. It is"]
#[doc = " possible to export from one project and then import into another."]
#[doc = ""]
#[doc = " Exported data can also be loaded into Google BigQuery for analysis."]
#[doc = ""]
#[doc = " Exports and imports are performed asynchronously. An Operation resource is"]
#[doc = " created for each export/import. The state (including any errors encountered)"]
#[doc = " of the export/import may be queried via the Operation resource."]
#[doc = ""]
#[doc = " # Index"]
#[doc = ""]
#[doc = " The index service manages Cloud Datastore composite indexes."]
#[doc = ""]
#[doc = " Index creation and deletion are 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 = " # 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 = " ListOperations returns all pending operations, but not completed operations."]
#[doc = ""]
#[doc = " Operations are created by service DatastoreAdmin,"]
#[doc = " but are accessed via service google.longrunning.Operations."]
#[derive(Debug, Clone)]
pub struct DatastoreAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> DatastoreAdminClient<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,
) -> DatastoreAdminClient<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,
{
DatastoreAdminClient::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 = " Exports a copy of all or a subset of entities from Google Cloud Datastore"]
#[doc = " to another storage system, such as Google Cloud Storage. Recent updates to"]
#[doc = " entities 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_entities(
&mut self,
request: impl tonic::IntoRequest<super::ExportEntitiesRequest>,
) -> 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.datastore.admin.v1.DatastoreAdmin/ExportEntities",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Imports entities into Google Cloud Datastore. Existing entities with the"]
#[doc = " same key 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 ImportEntities operation is cancelled, it is possible"]
#[doc = " that a subset of the data has already been imported to Cloud Datastore."]
pub async fn import_entities(
&mut self,
request: impl tonic::IntoRequest<super::ImportEntitiesRequest>,
) -> 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.datastore.admin.v1.DatastoreAdmin/ImportEntities",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[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 index creation, the process could result in an error, in which"]
#[doc = " case the index will move to the `ERROR` state. The process can be recovered"]
#[doc = " by fixing the data that caused the error, removing the index with"]
#[doc = " [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then"]
#[doc = " re-creating the index with [create]"]
#[doc = " [google.datastore.admin.v1.DatastoreAdmin.CreateIndex]."]
#[doc = ""]
#[doc = " Indexes with a single property 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.datastore.admin.v1.DatastoreAdmin/CreateIndex",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes an existing index."]
#[doc = " An index can only be deleted if it is in a `READY` or `ERROR` state. On"]
#[doc = " successful execution of the request, the index will be in a `DELETING`"]
#[doc = " [state][google.datastore.admin.v1.Index.State]. And on completion of the"]
#[doc = " returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed."]
#[doc = ""]
#[doc = " During index deletion, the process could result in an error, in which"]
#[doc = " case the index will move to the `ERROR` state. The process can be recovered"]
#[doc = " by fixing the data that caused the error, followed by calling"]
#[doc = " [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again."]
pub async fn delete_index(
&mut self,
request: impl tonic::IntoRequest<super::DeleteIndexRequest>,
) -> 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.datastore.admin.v1.DatastoreAdmin/DeleteIndex",
);
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.datastore.admin.v1.DatastoreAdmin/GetIndex",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists the indexes that match the specified filters. Datastore uses an"]
#[doc = " eventually consistent query to fetch the list of indexes and may"]
#[doc = " occasionally return stale results."]
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.datastore.admin.v1.DatastoreAdmin/ListIndexes",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MigrationStateEvent {
#[prost(enumeration = "MigrationState", tag = "1")]
pub state: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MigrationProgressEvent {
#[prost(enumeration = "MigrationStep", tag = "1")]
pub step: i32,
#[prost(oneof = "migration_progress_event::StepDetails", tags = "2, 3")]
pub step_details: ::core::option::Option<migration_progress_event::StepDetails>,
}
pub mod migration_progress_event {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareStepDetails {
#[prost(enumeration = "ConcurrencyMode", tag = "1")]
pub concurrency_mode: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RedirectWritesStepDetails {
#[prost(enumeration = "ConcurrencyMode", tag = "1")]
pub concurrency_mode: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ConcurrencyMode {
Unspecified = 0,
Pessimistic = 1,
Optimistic = 2,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum StepDetails {
#[prost(message, tag = "2")]
PrepareStepDetails(PrepareStepDetails),
#[prost(message, tag = "3")]
RedirectWritesStepDetails(RedirectWritesStepDetails),
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MigrationState {
Unspecified = 0,
Running = 1,
Paused = 2,
Complete = 3,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MigrationStep {
Unspecified = 0,
Prepare = 6,
Start = 1,
ApplyWritesSynchronously = 7,
CopyAndVerify = 2,
RedirectEventuallyConsistentReads = 3,
RedirectStronglyConsistentReads = 4,
RedirectWrites = 5,
}