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