Debian Codegraph @

google/longrunning/operations_proto.proto

raw
1 // Copyright 2025 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 syntax = "proto3";
16
17 package google.longrunning;
18
19 import "google/api/annotations.proto";
20 import "google/api/client.proto";
21 import "google/protobuf/any.proto";
22 import "google/protobuf/descriptor.proto";
23 import "google/protobuf/duration.proto";
24 import "google/protobuf/empty.proto";
25 import "google/rpc/status.proto";
26
27 option cc_enable_arenas = true;
28 option csharp_namespace = "Google.LongRunning";
29 option go_package = "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb";
30 option java_multiple_files = true;
31 option java_outer_classname = "OperationsProto";
32 option java_package = "com.google.longrunning";
33 option objc_class_prefix = "GLRUN";
34 option php_namespace = "Google\\LongRunning";
35
36 extend google.protobuf.MethodOptions {
37 // Additional information regarding long-running operations.
38 // In particular, this specifies the types that are returned from
39 // long-running operations.
40 //
41 // Required for methods that return `google.longrunning.Operation`; invalid
42 // otherwise.
43 google.longrunning.OperationInfo operation_info = 1049;
44 }
45
46 // Manages long-running operations with an API service.
47 //
48 // When an API method normally takes long time to complete, it can be designed
49 // to return [Operation][google.longrunning.Operation] to the client, and the
50 // client can use this interface to receive the real response asynchronously by
51 // polling the operation resource, or pass the operation resource to another API
52 // (such as Pub/Sub API) to receive the response. Any API service that returns
53 // long-running operations should implement the `Operations` interface so
54 // developers can have a consistent client experience.
55 service Operations {
56 option (google.api.default_host) = "longrunning.googleapis.com";
57
58 // Lists operations that match the specified filter in the request. If the
59 // server doesn't support this method, it returns `UNIMPLEMENTED`.
60 rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) {
61 option (google.api.http) = {
62 get: "/v1/{name=operations}"
63 };
64 option (google.api.method_signature) = "name,filter";
65 }
66
67 // Gets the latest state of a long-running operation. Clients can use this
68 // method to poll the operation result at intervals as recommended by the API
69 // service.
70 rpc GetOperation(GetOperationRequest) returns (Operation) {
71 option (google.api.http) = {
72 get: "/v1/{name=operations/**}"
73 };
74 option (google.api.method_signature) = "name";
75 }
76
77 // Deletes a long-running operation. This method indicates that the client is
78 // no longer interested in the operation result. It does not cancel the
79 // operation. If the server doesn't support this method, it returns
80 // `google.rpc.Code.UNIMPLEMENTED`.
81 rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) {
82 option (google.api.http) = {
83 delete: "/v1/{name=operations/**}"
84 };
85 option (google.api.method_signature) = "name";
86 }
87
88 // Starts asynchronous cancellation on a long-running operation. The server
89 // makes a best effort to cancel the operation, but success is not
90 // guaranteed. If the server doesn't support this method, it returns
91 // `google.rpc.Code.UNIMPLEMENTED`. Clients can use
92 // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
93 // other methods to check whether the cancellation succeeded or whether the
94 // operation completed despite cancellation. On successful cancellation,
95 // the operation is not deleted; instead, it becomes an operation with
96 // an [Operation.error][google.longrunning.Operation.error] value with a
97 // [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
98 // `Code.CANCELLED`.
99 rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) {
100 option (google.api.http) = {
101 post: "/v1/{name=operations/**}:cancel"
102 body: "*"
103 };
104 option (google.api.method_signature) = "name";
105 }
106
107 // Waits until the specified long-running operation is done or reaches at most
108 // a specified timeout, returning the latest state. If the operation is
109 // already done, the latest state is immediately returned. If the timeout
110 // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
111 // timeout is used. If the server does not support this method, it returns
112 // `google.rpc.Code.UNIMPLEMENTED`.
113 // Note that this method is on a best-effort basis. It may return the latest
114 // state before the specified timeout (including immediately), meaning even an
115 // immediate response is no guarantee that the operation is done.
116 rpc WaitOperation(WaitOperationRequest) returns (Operation) {}
117 }
118
119 // This resource represents a long-running operation that is the result of a
120 // network API call.
121 message Operation {
122 // The server-assigned name, which is only unique within the same service that
123 // originally returns it. If you use the default HTTP mapping, the
124 // `name` should be a resource name ending with `operations/{unique_id}`.
125 string name = 1;
126
127 // Service-specific metadata associated with the operation. It typically
128 // contains progress information and common metadata such as create time.
129 // Some services might not provide such metadata. Any method that returns a
130 // long-running operation should document the metadata type, if any.
131 google.protobuf.Any metadata = 2;
132
133 // If the value is `false`, it means the operation is still in progress.
134 // If `true`, the operation is completed, and either `error` or `response` is
135 // available.
136 bool done = 3;
137
138 // The operation result, which can be either an `error` or a valid `response`.
139 // If `done` == `false`, neither `error` nor `response` is set.
140 // If `done` == `true`, exactly one of `error` or `response` can be set.
141 // Some services might not provide the result.
142 oneof result {
143 // The error result of the operation in case of failure or cancellation.
144 google.rpc.Status error = 4;
145
146 // The normal, successful response of the operation. If the original
147 // method returns no data on success, such as `Delete`, the response is
148 // `google.protobuf.Empty`. If the original method is standard
149 // `Get`/`Create`/`Update`, the response should be the resource. For other
150 // methods, the response should have the type `XxxResponse`, where `Xxx`
151 // is the original method name. For example, if the original method name
152 // is `TakeSnapshot()`, the inferred response type is
153 // `TakeSnapshotResponse`.
154 google.protobuf.Any response = 5;
155 }
156 }
157
158 // The request message for
159 // [Operations.GetOperation][google.longrunning.Operations.GetOperation].
160 message GetOperationRequest {
161 // The name of the operation resource.
162 string name = 1;
163 }
164
165 // The request message for
166 // [Operations.ListOperations][google.longrunning.Operations.ListOperations].
167 message ListOperationsRequest {
168 // The name of the operation's parent resource.
169 string name = 4;
170
171 // The standard list filter.
172 string filter = 1;
173
174 // The standard list page size.
175 int32 page_size = 2;
176
177 // The standard list page token.
178 string page_token = 3;
179 }
180
181 // The response message for
182 // [Operations.ListOperations][google.longrunning.Operations.ListOperations].
183 message ListOperationsResponse {
184 // A list of operations that matches the specified filter in the request.
185 repeated Operation operations = 1;
186
187 // The standard List next-page token.
188 string next_page_token = 2;
189 }
190
191 // The request message for
192 // [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
193 message CancelOperationRequest {
194 // The name of the operation resource to be cancelled.
195 string name = 1;
196 }
197
198 // The request message for
199 // [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
200 message DeleteOperationRequest {
201 // The name of the operation resource to be deleted.
202 string name = 1;
203 }
204
205 // The request message for
206 // [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
207 message WaitOperationRequest {
208 // The name of the operation resource to wait on.
209 string name = 1;
210
211 // The maximum duration to wait before timing out. If left blank, the wait
212 // will be at most the time permitted by the underlying HTTP/RPC protocol.
213 // If RPC context deadline is also specified, the shorter one will be used.
214 google.protobuf.Duration timeout = 2;
215 }
216
217 // A message representing the message types used by a long-running operation.
218 //
219 // Example:
220 //
221 // rpc Export(ExportRequest) returns (google.longrunning.Operation) {
222 // option (google.longrunning.operation_info) = {
223 // response_type: "ExportResponse"
224 // metadata_type: "ExportMetadata"
225 // };
226 // }
227 message OperationInfo {
228 // Required. The message name of the primary return type for this
229 // long-running operation.
230 // This type will be used to deserialize the LRO's response.
231 //
232 // If the response is in a different package from the rpc, a fully-qualified
233 // message name must be used (e.g. `google.protobuf.Struct`).
234 //
235 // Note: Altering this value constitutes a breaking change.
236 string response_type = 1;
237
238 // Required. The message name of the metadata type for this long-running
239 // operation.
240 //
241 // If the response is in a different package from the rpc, a fully-qualified
242 // message name must be used (e.g. `google.protobuf.Struct`).
243 //
244 // Note: Altering this value constitutes a breaking change.
245 string metadata_type = 2;
246 }