extended_operations.proto 6.2 KB

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