#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Operation {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<::prost_types::Any>,
#[prost(bool, tag = "3")]
pub done: bool,
#[prost(oneof = "operation::Result", tags = "4, 5")]
pub result: ::core::option::Option<operation::Result>,
}
pub mod operation {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
#[prost(message, tag = "4")]
Error(super::super::rpc::Status),
#[prost(message, tag = "5")]
Response(::prost_types::Any),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOperationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOperationsRequest {
#[prost(string, tag = "4")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "1")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOperationsResponse {
#[prost(message, repeated, tag = "1")]
pub operations: ::prost::alloc::vec::Vec<Operation>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOperationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteOperationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WaitOperationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub timeout: ::core::option::Option<::prost_types::Duration>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationInfo {
#[prost(string, tag = "1")]
pub response_type: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub metadata_type: ::prost::alloc::string::String,
}
#[doc = r" Generated client implementations."]
pub mod operations_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Manages long-running operations with an API service."]
#[doc = ""]
#[doc = " When an API method normally takes long time to complete, it can be designed"]
#[doc = " to return [Operation][google.longrunning.Operation] to the client, and the client can use this"]
#[doc = " interface to receive the real response asynchronously by polling the"]
#[doc = " operation resource, or pass the operation resource to another API (such as"]
#[doc = " Google Cloud Pub/Sub API) to receive the response. Any API service that"]
#[doc = " returns long-running operations should implement the `Operations` interface"]
#[doc = " so developers can have a consistent client experience."]
#[derive(Debug, Clone)]
pub struct OperationsClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> OperationsClient<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,
) -> OperationsClient<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,
{
OperationsClient::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 = " Lists operations that match the specified filter in the request. If the"]
#[doc = " server doesn't support this method, it returns `UNIMPLEMENTED`."]
#[doc = ""]
#[doc = " NOTE: the `name` binding allows API services to override the binding"]
#[doc = " to use different resource name schemes, such as `users/*/operations`. To"]
#[doc = " override the binding, API services can add a binding such as"]
#[doc = " `\"/v1/{name=users/*}/operations\"` to their service configuration."]
#[doc = " For backwards compatibility, the default name includes the operations"]
#[doc = " collection id, however overriding users must ensure the name binding"]
#[doc = " is the parent resource, without the operations collection id."]
pub async fn list_operations(
&mut self,
request: impl tonic::IntoRequest<super::ListOperationsRequest>,
) -> Result<tonic::Response<super::ListOperationsResponse>, 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.longrunning.Operations/ListOperations",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the latest state of a long-running operation. Clients can use this"]
#[doc = " method to poll the operation result at intervals as recommended by the API"]
#[doc = " service."]
pub async fn get_operation(
&mut self,
request: impl tonic::IntoRequest<super::GetOperationRequest>,
) -> Result<tonic::Response<super::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.longrunning.Operations/GetOperation");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a long-running operation. This method indicates that the client is"]
#[doc = " no longer interested in the operation result. It does not cancel the"]
#[doc = " operation. If the server doesn't support this method, it returns"]
#[doc = " `google.rpc.Code.UNIMPLEMENTED`."]
pub async fn delete_operation(
&mut self,
request: impl tonic::IntoRequest<super::DeleteOperationRequest>,
) -> 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.longrunning.Operations/DeleteOperation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Starts asynchronous cancellation on a long-running operation. The server"]
#[doc = " makes a best effort to cancel the operation, but success is not"]
#[doc = " guaranteed. If the server doesn't support this method, it returns"]
#[doc = " `google.rpc.Code.UNIMPLEMENTED`. Clients can use"]
#[doc = " [Operations.GetOperation][google.longrunning.Operations.GetOperation] or"]
#[doc = " other methods to check whether the cancellation succeeded or whether the"]
#[doc = " operation completed despite cancellation. On successful cancellation,"]
#[doc = " the operation is not deleted; instead, it becomes an operation with"]
#[doc = " an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,"]
#[doc = " corresponding to `Code.CANCELLED`."]
pub async fn cancel_operation(
&mut self,
request: impl tonic::IntoRequest<super::CancelOperationRequest>,
) -> 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.longrunning.Operations/CancelOperation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Waits until the specified long-running operation is done or reaches at most"]
#[doc = " a specified timeout, returning the latest state. If the operation is"]
#[doc = " already done, the latest state is immediately returned. If the timeout"]
#[doc = " specified is greater than the default HTTP/RPC timeout, the HTTP/RPC"]
#[doc = " timeout is used. If the server does not support this method, it returns"]
#[doc = " `google.rpc.Code.UNIMPLEMENTED`."]
#[doc = " Note that this method is on a best-effort basis. It may return the latest"]
#[doc = " state before the specified timeout (including immediately), meaning even an"]
#[doc = " immediate response is no guarantee that the operation is done."]
pub async fn wait_operation(
&mut self,
request: impl tonic::IntoRequest<super::WaitOperationRequest>,
) -> Result<tonic::Response<super::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.longrunning.Operations/WaitOperation",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}