xref: /aosp_15_r20/external/googleapis/google/cloud/extended_operations.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2021 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 Worker// This file contains custom annotations that are used by GAPIC generators to
16*d5c09012SAndroid Build Coastguard Worker// handle Long Running Operation methods (LRO) that are NOT compliant with
17*d5c09012SAndroid Build Coastguard Worker// https://google.aip.dev/151. These annotations are public for technical
18*d5c09012SAndroid Build Coastguard Worker// reasons only. Please DO NOT USE them in your protos.
19*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
20*d5c09012SAndroid Build Coastguard Worker
21*d5c09012SAndroid Build Coastguard Workerpackage google.cloud;
22*d5c09012SAndroid Build Coastguard Worker
23*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/descriptor.proto";
24*d5c09012SAndroid Build Coastguard Worker
25*d5c09012SAndroid Build Coastguard Workeroption go_package = "google.golang.org/genproto/googleapis/cloud/extendedops;extendedops";
26*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
27*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "ExtendedOperationsProto";
28*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud";
29*d5c09012SAndroid Build Coastguard Workeroption objc_class_prefix = "GAPI";
30*d5c09012SAndroid Build Coastguard Worker
31*d5c09012SAndroid Build Coastguard Worker// FieldOptions to match corresponding fields in the initial request,
32*d5c09012SAndroid Build Coastguard Worker// polling request and operation response messages.
33*d5c09012SAndroid Build Coastguard Worker//
34*d5c09012SAndroid Build Coastguard Worker// Example:
35*d5c09012SAndroid Build Coastguard Worker//
36*d5c09012SAndroid Build Coastguard Worker// In an API-specific operation message:
37*d5c09012SAndroid Build Coastguard Worker//
38*d5c09012SAndroid Build Coastguard Worker//     message MyOperation {
39*d5c09012SAndroid Build Coastguard Worker//       string http_error_message = 1 [(operation_field) = ERROR_MESSAGE];
40*d5c09012SAndroid Build Coastguard Worker//       int32 http_error_status_code = 2 [(operation_field) = ERROR_CODE];
41*d5c09012SAndroid Build Coastguard Worker//       string id = 3 [(operation_field) = NAME];
42*d5c09012SAndroid Build Coastguard Worker//       Status status = 4 [(operation_field) = STATUS];
43*d5c09012SAndroid Build Coastguard Worker//     }
44*d5c09012SAndroid Build Coastguard Worker//
45*d5c09012SAndroid Build Coastguard Worker// In a polling request message (the one which is used to poll for an LRO
46*d5c09012SAndroid Build Coastguard Worker// status):
47*d5c09012SAndroid Build Coastguard Worker//
48*d5c09012SAndroid Build Coastguard Worker//     message MyPollingRequest {
49*d5c09012SAndroid Build Coastguard Worker//       string operation = 1 [(operation_response_field) = "id"];
50*d5c09012SAndroid Build Coastguard Worker//       string project = 2;
51*d5c09012SAndroid Build Coastguard Worker//       string region = 3;
52*d5c09012SAndroid Build Coastguard Worker//     }
53*d5c09012SAndroid Build Coastguard Worker//
54*d5c09012SAndroid Build Coastguard Worker// In an initial request message (the one which starts an LRO):
55*d5c09012SAndroid Build Coastguard Worker//
56*d5c09012SAndroid Build Coastguard Worker//    message MyInitialRequest {
57*d5c09012SAndroid Build Coastguard Worker//      string my_project = 2 [(operation_request_field) = "project"];
58*d5c09012SAndroid Build Coastguard Worker//      string my_region = 3 [(operation_request_field) = "region"];
59*d5c09012SAndroid Build Coastguard Worker//    }
60*d5c09012SAndroid Build Coastguard Worker//
61*d5c09012SAndroid Build Coastguard Workerextend google.protobuf.FieldOptions {
62*d5c09012SAndroid Build Coastguard Worker  // A field annotation that maps fields in an API-specific Operation object to
63*d5c09012SAndroid Build Coastguard Worker  // their standard counterparts in google.longrunning.Operation. See
64*d5c09012SAndroid Build Coastguard Worker  // OperationResponseMapping enum definition.
65*d5c09012SAndroid Build Coastguard Worker  OperationResponseMapping operation_field = 1149;
66*d5c09012SAndroid Build Coastguard Worker
67*d5c09012SAndroid Build Coastguard Worker  // A field annotation that maps fields in the initial request message
68*d5c09012SAndroid Build Coastguard Worker  // (the one which started the LRO) to their counterparts in the polling
69*d5c09012SAndroid Build Coastguard Worker  // request message. For non-standard LRO, the polling response may be missing
70*d5c09012SAndroid Build Coastguard Worker  // some of the information needed to make a subsequent polling request. The
71*d5c09012SAndroid Build Coastguard Worker  // missing information (for example, project or region ID) is contained in the
72*d5c09012SAndroid Build Coastguard Worker  // fields of the initial request message that this annotation must be applied
73*d5c09012SAndroid Build Coastguard Worker  // to. The string value of the annotation corresponds to the name of the
74*d5c09012SAndroid Build Coastguard Worker  // counterpart field in the polling request message that the annotated field's
75*d5c09012SAndroid Build Coastguard Worker  // value will be copied to.
76*d5c09012SAndroid Build Coastguard Worker  string operation_request_field = 1150;
77*d5c09012SAndroid Build Coastguard Worker
78*d5c09012SAndroid Build Coastguard Worker  // A field annotation that maps fields in the polling request message to their
79*d5c09012SAndroid Build Coastguard Worker  // counterparts in the initial and/or polling response message. The initial
80*d5c09012SAndroid Build Coastguard Worker  // and the polling methods return an API-specific Operation object. Some of
81*d5c09012SAndroid Build Coastguard Worker  // the fields from that response object must be reused in the subsequent
82*d5c09012SAndroid Build Coastguard Worker  // request (like operation name/ID) to fully identify the polled operation.
83*d5c09012SAndroid Build Coastguard Worker  // This annotation must be applied to the fields in the polling request
84*d5c09012SAndroid Build Coastguard Worker  // message, the string value of the annotation must correspond to the name of
85*d5c09012SAndroid Build Coastguard Worker  // the counterpart field in the Operation response object whose value will be
86*d5c09012SAndroid Build Coastguard Worker  // copied to the annotated field.
87*d5c09012SAndroid Build Coastguard Worker  string operation_response_field = 1151;
88*d5c09012SAndroid Build Coastguard Worker}
89*d5c09012SAndroid Build Coastguard Worker
90*d5c09012SAndroid Build Coastguard Worker// MethodOptions to identify the actual service and method used for operation
91*d5c09012SAndroid Build Coastguard Worker// status polling.
92*d5c09012SAndroid Build Coastguard Worker//
93*d5c09012SAndroid Build Coastguard Worker// Example:
94*d5c09012SAndroid Build Coastguard Worker//
95*d5c09012SAndroid Build Coastguard Worker// In a method, which starts an LRO:
96*d5c09012SAndroid Build Coastguard Worker//
97*d5c09012SAndroid Build Coastguard Worker//     service MyService {
98*d5c09012SAndroid Build Coastguard Worker//       rpc Foo(MyInitialRequest) returns (MyOperation) {
99*d5c09012SAndroid Build Coastguard Worker//         option (operation_service) = "MyPollingService";
100*d5c09012SAndroid Build Coastguard Worker//       }
101*d5c09012SAndroid Build Coastguard Worker//     }
102*d5c09012SAndroid Build Coastguard Worker//
103*d5c09012SAndroid Build Coastguard Worker// In a polling method:
104*d5c09012SAndroid Build Coastguard Worker//
105*d5c09012SAndroid Build Coastguard Worker//     service MyPollingService {
106*d5c09012SAndroid Build Coastguard Worker//       rpc Get(MyPollingRequest) returns (MyOperation) {
107*d5c09012SAndroid Build Coastguard Worker//         option (operation_polling_method) = true;
108*d5c09012SAndroid Build Coastguard Worker//       }
109*d5c09012SAndroid Build Coastguard Worker//     }
110*d5c09012SAndroid Build Coastguard Workerextend google.protobuf.MethodOptions {
111*d5c09012SAndroid Build Coastguard Worker  // A method annotation that maps an LRO method (the one which starts an LRO)
112*d5c09012SAndroid Build Coastguard Worker  // to the service, which will be used to poll for the operation status. The
113*d5c09012SAndroid Build Coastguard Worker  // annotation must be applied to the method which starts an LRO, the string
114*d5c09012SAndroid Build Coastguard Worker  // value of the annotation must correspond to the name of the service used to
115*d5c09012SAndroid Build Coastguard Worker  // poll for the operation status.
116*d5c09012SAndroid Build Coastguard Worker  string operation_service = 1249;
117*d5c09012SAndroid Build Coastguard Worker
118*d5c09012SAndroid Build Coastguard Worker  // A method annotation that marks methods that can be used for polling
119*d5c09012SAndroid Build Coastguard Worker  // operation status (e.g. the MyPollingService.Get(MyPollingRequest) method).
120*d5c09012SAndroid Build Coastguard Worker  bool operation_polling_method = 1250;
121*d5c09012SAndroid Build Coastguard Worker}
122*d5c09012SAndroid Build Coastguard Worker
123*d5c09012SAndroid Build Coastguard Worker// An enum to be used to mark the essential (for polling) fields in an
124*d5c09012SAndroid Build Coastguard Worker// API-specific Operation object. A custom Operation object may contain many
125*d5c09012SAndroid Build Coastguard Worker// different fields, but only few of them are essential to conduct a successful
126*d5c09012SAndroid Build Coastguard Worker// polling process.
127*d5c09012SAndroid Build Coastguard Workerenum OperationResponseMapping {
128*d5c09012SAndroid Build Coastguard Worker  // Do not use.
129*d5c09012SAndroid Build Coastguard Worker  UNDEFINED = 0;
130*d5c09012SAndroid Build Coastguard Worker
131*d5c09012SAndroid Build Coastguard Worker  // A field in an API-specific (custom) Operation object which carries the same
132*d5c09012SAndroid Build Coastguard Worker  // meaning as google.longrunning.Operation.name.
133*d5c09012SAndroid Build Coastguard Worker  NAME = 1;
134*d5c09012SAndroid Build Coastguard Worker
135*d5c09012SAndroid Build Coastguard Worker  // A field in an API-specific (custom) Operation object which carries the same
136*d5c09012SAndroid Build Coastguard Worker  // meaning as google.longrunning.Operation.done. If the annotated field is of
137*d5c09012SAndroid Build Coastguard Worker  // an enum type, `annotated_field_name == EnumType.DONE` semantics should be
138*d5c09012SAndroid Build Coastguard Worker  // equivalent to `Operation.done == true`. If the annotated field is of type
139*d5c09012SAndroid Build Coastguard Worker  // boolean, then it should follow the same semantics as Operation.done.
140*d5c09012SAndroid Build Coastguard Worker  // Otherwise, a non-empty value should be treated as `Operation.done == true`.
141*d5c09012SAndroid Build Coastguard Worker  STATUS = 2;
142*d5c09012SAndroid Build Coastguard Worker
143*d5c09012SAndroid Build Coastguard Worker  // A field in an API-specific (custom) Operation object which carries the same
144*d5c09012SAndroid Build Coastguard Worker  // meaning as google.longrunning.Operation.error.code.
145*d5c09012SAndroid Build Coastguard Worker  ERROR_CODE = 3;
146*d5c09012SAndroid Build Coastguard Worker
147*d5c09012SAndroid Build Coastguard Worker  // A field in an API-specific (custom) Operation object which carries the same
148*d5c09012SAndroid Build Coastguard Worker  // meaning as google.longrunning.Operation.error.message.
149*d5c09012SAndroid Build Coastguard Worker  ERROR_MESSAGE = 4;
150*d5c09012SAndroid Build Coastguard Worker}