Debian Codegraph @

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