googleapis_tonic_google_longrunning/vec_u8_hash_map/google.longrunning.rs
1// This file is @generated by prost-build.
2/// This resource represents a long-running operation that is the result of a
3/// network API call.
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Operation {
6 /// The server-assigned name, which is only unique within the same service that
7 /// originally returns it. If you use the default HTTP mapping, the
8 /// `name` should be a resource name ending with `operations/{unique_id}`.
9 #[prost(string, tag = "1")]
10 pub name: ::prost::alloc::string::String,
11 /// Service-specific metadata associated with the operation. It typically
12 /// contains progress information and common metadata such as create time.
13 /// Some services might not provide such metadata. Any method that returns a
14 /// long-running operation should document the metadata type, if any.
15 #[prost(message, optional, tag = "2")]
16 pub metadata: ::core::option::Option<::prost_types::Any>,
17 /// If the value is `false`, it means the operation is still in progress.
18 /// If `true`, the operation is completed, and either `error` or `response` is
19 /// available.
20 #[prost(bool, tag = "3")]
21 pub done: bool,
22 /// The operation result, which can be either an `error` or a valid `response`.
23 /// If `done` == `false`, neither `error` nor `response` is set.
24 /// If `done` == `true`, exactly one of `error` or `response` can be set.
25 /// Some services might not provide the result.
26 #[prost(oneof = "operation::Result", tags = "4, 5")]
27 pub result: ::core::option::Option<operation::Result>,
28}
29/// Nested message and enum types in `Operation`.
30pub mod operation {
31 /// The operation result, which can be either an `error` or a valid `response`.
32 /// If `done` == `false`, neither `error` nor `response` is set.
33 /// If `done` == `true`, exactly one of `error` or `response` can be set.
34 /// Some services might not provide the result.
35 #[derive(Clone, PartialEq, ::prost::Oneof)]
36 pub enum Result {
37 /// The error result of the operation in case of failure or cancellation.
38 #[prost(message, tag = "4")]
39 Error(super::super::rpc::Status),
40 /// The normal, successful response of the operation. If the original
41 /// method returns no data on success, such as `Delete`, the response is
42 /// `google.protobuf.Empty`. If the original method is standard
43 /// `Get`/`Create`/`Update`, the response should be the resource. For other
44 /// methods, the response should have the type `XxxResponse`, where `Xxx`
45 /// is the original method name. For example, if the original method name
46 /// is `TakeSnapshot()`, the inferred response type is
47 /// `TakeSnapshotResponse`.
48 #[prost(message, tag = "5")]
49 Response(::prost_types::Any),
50 }
51}
52/// The request message for
53/// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct GetOperationRequest {
56 /// The name of the operation resource.
57 #[prost(string, tag = "1")]
58 pub name: ::prost::alloc::string::String,
59}
60/// The request message for
61/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct ListOperationsRequest {
64 /// The name of the operation's parent resource.
65 #[prost(string, tag = "4")]
66 pub name: ::prost::alloc::string::String,
67 /// The standard list filter.
68 #[prost(string, tag = "1")]
69 pub filter: ::prost::alloc::string::String,
70 /// The standard list page size.
71 #[prost(int32, tag = "2")]
72 pub page_size: i32,
73 /// The standard list page token.
74 #[prost(string, tag = "3")]
75 pub page_token: ::prost::alloc::string::String,
76}
77/// The response message for
78/// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct ListOperationsResponse {
81 /// A list of operations that matches the specified filter in the request.
82 #[prost(message, repeated, tag = "1")]
83 pub operations: ::prost::alloc::vec::Vec<Operation>,
84 /// The standard List next-page token.
85 #[prost(string, tag = "2")]
86 pub next_page_token: ::prost::alloc::string::String,
87}
88/// The request message for
89/// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
90#[derive(Clone, PartialEq, ::prost::Message)]
91pub struct CancelOperationRequest {
92 /// The name of the operation resource to be cancelled.
93 #[prost(string, tag = "1")]
94 pub name: ::prost::alloc::string::String,
95}
96/// The request message for
97/// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct DeleteOperationRequest {
100 /// The name of the operation resource to be deleted.
101 #[prost(string, tag = "1")]
102 pub name: ::prost::alloc::string::String,
103}
104/// The request message for
105/// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct WaitOperationRequest {
108 /// The name of the operation resource to wait on.
109 #[prost(string, tag = "1")]
110 pub name: ::prost::alloc::string::String,
111 /// The maximum duration to wait before timing out. If left blank, the wait
112 /// will be at most the time permitted by the underlying HTTP/RPC protocol.
113 /// If RPC context deadline is also specified, the shorter one will be used.
114 #[prost(message, optional, tag = "2")]
115 pub timeout: ::core::option::Option<::prost_types::Duration>,
116}
117/// A message representing the message types used by a long-running operation.
118///
119/// Example:
120///
121/// rpc Export(ExportRequest) returns (google.longrunning.Operation) {
122/// option (google.longrunning.operation_info) = {
123/// response_type: "ExportResponse"
124/// metadata_type: "ExportMetadata"
125/// };
126/// }
127#[derive(Clone, PartialEq, ::prost::Message)]
128pub struct OperationInfo {
129 /// Required. The message name of the primary return type for this
130 /// long-running operation.
131 /// This type will be used to deserialize the LRO's response.
132 ///
133 /// If the response is in a different package from the rpc, a fully-qualified
134 /// message name must be used (e.g. `google.protobuf.Struct`).
135 ///
136 /// Note: Altering this value constitutes a breaking change.
137 #[prost(string, tag = "1")]
138 pub response_type: ::prost::alloc::string::String,
139 /// Required. The message name of the metadata type for this long-running
140 /// operation.
141 ///
142 /// If the response is in a different package from the rpc, a fully-qualified
143 /// message name must be used (e.g. `google.protobuf.Struct`).
144 ///
145 /// Note: Altering this value constitutes a breaking change.
146 #[prost(string, tag = "2")]
147 pub metadata_type: ::prost::alloc::string::String,
148}
149/// Generated client implementations.
150pub mod operations_client {
151 #![allow(
152 unused_variables,
153 dead_code,
154 missing_docs,
155 clippy::wildcard_imports,
156 clippy::let_unit_value,
157 )]
158 use tonic::codegen::*;
159 use tonic::codegen::http::Uri;
160 /// Manages long-running operations with an API service.
161 ///
162 /// When an API method normally takes long time to complete, it can be designed
163 /// to return [Operation][google.longrunning.Operation] to the client, and the
164 /// client can use this interface to receive the real response asynchronously by
165 /// polling the operation resource, or pass the operation resource to another API
166 /// (such as Pub/Sub API) to receive the response. Any API service that returns
167 /// long-running operations should implement the `Operations` interface so
168 /// developers can have a consistent client experience.
169 #[derive(Debug, Clone)]
170 pub struct OperationsClient<T> {
171 inner: tonic::client::Grpc<T>,
172 }
173 impl<T> OperationsClient<T>
174 where
175 T: tonic::client::GrpcService<tonic::body::Body>,
176 T::Error: Into<StdError>,
177 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
178 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
179 {
180 pub fn new(inner: T) -> Self {
181 let inner = tonic::client::Grpc::new(inner);
182 Self { inner }
183 }
184 pub fn with_origin(inner: T, origin: Uri) -> Self {
185 let inner = tonic::client::Grpc::with_origin(inner, origin);
186 Self { inner }
187 }
188 pub fn with_interceptor<F>(
189 inner: T,
190 interceptor: F,
191 ) -> OperationsClient<InterceptedService<T, F>>
192 where
193 F: tonic::service::Interceptor,
194 T::ResponseBody: Default,
195 T: tonic::codegen::Service<
196 http::Request<tonic::body::Body>,
197 Response = http::Response<
198 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
199 >,
200 >,
201 <T as tonic::codegen::Service<
202 http::Request<tonic::body::Body>,
203 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
204 {
205 OperationsClient::new(InterceptedService::new(inner, interceptor))
206 }
207 /// Compress requests with the given encoding.
208 ///
209 /// This requires the server to support it otherwise it might respond with an
210 /// error.
211 #[must_use]
212 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
213 self.inner = self.inner.send_compressed(encoding);
214 self
215 }
216 /// Enable decompressing responses.
217 #[must_use]
218 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
219 self.inner = self.inner.accept_compressed(encoding);
220 self
221 }
222 /// Limits the maximum size of a decoded message.
223 ///
224 /// Default: `4MB`
225 #[must_use]
226 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
227 self.inner = self.inner.max_decoding_message_size(limit);
228 self
229 }
230 /// Limits the maximum size of an encoded message.
231 ///
232 /// Default: `usize::MAX`
233 #[must_use]
234 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
235 self.inner = self.inner.max_encoding_message_size(limit);
236 self
237 }
238 /// Lists operations that match the specified filter in the request. If the
239 /// server doesn't support this method, it returns `UNIMPLEMENTED`.
240 pub async fn list_operations(
241 &mut self,
242 request: impl tonic::IntoRequest<super::ListOperationsRequest>,
243 ) -> std::result::Result<
244 tonic::Response<super::ListOperationsResponse>,
245 tonic::Status,
246 > {
247 self.inner
248 .ready()
249 .await
250 .map_err(|e| {
251 tonic::Status::unknown(
252 format!("Service was not ready: {}", e.into()),
253 )
254 })?;
255 let codec = tonic::codec::ProstCodec::default();
256 let path = http::uri::PathAndQuery::from_static(
257 "/google.longrunning.Operations/ListOperations",
258 );
259 let mut req = request.into_request();
260 req.extensions_mut()
261 .insert(
262 GrpcMethod::new("google.longrunning.Operations", "ListOperations"),
263 );
264 self.inner.unary(req, path, codec).await
265 }
266 /// Gets the latest state of a long-running operation. Clients can use this
267 /// method to poll the operation result at intervals as recommended by the API
268 /// service.
269 pub async fn get_operation(
270 &mut self,
271 request: impl tonic::IntoRequest<super::GetOperationRequest>,
272 ) -> std::result::Result<tonic::Response<super::Operation>, tonic::Status> {
273 self.inner
274 .ready()
275 .await
276 .map_err(|e| {
277 tonic::Status::unknown(
278 format!("Service was not ready: {}", e.into()),
279 )
280 })?;
281 let codec = tonic::codec::ProstCodec::default();
282 let path = http::uri::PathAndQuery::from_static(
283 "/google.longrunning.Operations/GetOperation",
284 );
285 let mut req = request.into_request();
286 req.extensions_mut()
287 .insert(
288 GrpcMethod::new("google.longrunning.Operations", "GetOperation"),
289 );
290 self.inner.unary(req, path, codec).await
291 }
292 /// Deletes a long-running operation. This method indicates that the client is
293 /// no longer interested in the operation result. It does not cancel the
294 /// operation. If the server doesn't support this method, it returns
295 /// `google.rpc.Code.UNIMPLEMENTED`.
296 pub async fn delete_operation(
297 &mut self,
298 request: impl tonic::IntoRequest<super::DeleteOperationRequest>,
299 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
300 self.inner
301 .ready()
302 .await
303 .map_err(|e| {
304 tonic::Status::unknown(
305 format!("Service was not ready: {}", e.into()),
306 )
307 })?;
308 let codec = tonic::codec::ProstCodec::default();
309 let path = http::uri::PathAndQuery::from_static(
310 "/google.longrunning.Operations/DeleteOperation",
311 );
312 let mut req = request.into_request();
313 req.extensions_mut()
314 .insert(
315 GrpcMethod::new("google.longrunning.Operations", "DeleteOperation"),
316 );
317 self.inner.unary(req, path, codec).await
318 }
319 /// Starts asynchronous cancellation on a long-running operation. The server
320 /// makes a best effort to cancel the operation, but success is not
321 /// guaranteed. If the server doesn't support this method, it returns
322 /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use
323 /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
324 /// other methods to check whether the cancellation succeeded or whether the
325 /// operation completed despite cancellation. On successful cancellation,
326 /// the operation is not deleted; instead, it becomes an operation with
327 /// an [Operation.error][google.longrunning.Operation.error] value with a
328 /// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
329 /// `Code.CANCELLED`.
330 pub async fn cancel_operation(
331 &mut self,
332 request: impl tonic::IntoRequest<super::CancelOperationRequest>,
333 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
334 self.inner
335 .ready()
336 .await
337 .map_err(|e| {
338 tonic::Status::unknown(
339 format!("Service was not ready: {}", e.into()),
340 )
341 })?;
342 let codec = tonic::codec::ProstCodec::default();
343 let path = http::uri::PathAndQuery::from_static(
344 "/google.longrunning.Operations/CancelOperation",
345 );
346 let mut req = request.into_request();
347 req.extensions_mut()
348 .insert(
349 GrpcMethod::new("google.longrunning.Operations", "CancelOperation"),
350 );
351 self.inner.unary(req, path, codec).await
352 }
353 /// Waits until the specified long-running operation is done or reaches at most
354 /// a specified timeout, returning the latest state. If the operation is
355 /// already done, the latest state is immediately returned. If the timeout
356 /// specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
357 /// timeout is used. If the server does not support this method, it returns
358 /// `google.rpc.Code.UNIMPLEMENTED`.
359 /// Note that this method is on a best-effort basis. It may return the latest
360 /// state before the specified timeout (including immediately), meaning even an
361 /// immediate response is no guarantee that the operation is done.
362 pub async fn wait_operation(
363 &mut self,
364 request: impl tonic::IntoRequest<super::WaitOperationRequest>,
365 ) -> std::result::Result<tonic::Response<super::Operation>, tonic::Status> {
366 self.inner
367 .ready()
368 .await
369 .map_err(|e| {
370 tonic::Status::unknown(
371 format!("Service was not ready: {}", e.into()),
372 )
373 })?;
374 let codec = tonic::codec::ProstCodec::default();
375 let path = http::uri::PathAndQuery::from_static(
376 "/google.longrunning.Operations/WaitOperation",
377 );
378 let mut req = request.into_request();
379 req.extensions_mut()
380 .insert(
381 GrpcMethod::new("google.longrunning.Operations", "WaitOperation"),
382 );
383 self.inner.unary(req, path, codec).await
384 }
385 }
386}