client.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. syntax = "proto3";
  15. package google.api;
  16. import "google/api/launch_stage.proto";
  17. import "google/protobuf/descriptor.proto";
  18. import "google/protobuf/duration.proto";
  19. option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "ClientProto";
  22. option java_package = "com.google.api";
  23. option objc_class_prefix = "GAPI";
  24. extend google.protobuf.MethodOptions {
  25. // A definition of a client library method signature.
  26. //
  27. // In client libraries, each proto RPC corresponds to one or more methods
  28. // which the end user is able to call, and calls the underlying RPC.
  29. // Normally, this method receives a single argument (a struct or instance
  30. // corresponding to the RPC request object). Defining this field will
  31. // add one or more overloads providing flattened or simpler method signatures
  32. // in some languages.
  33. //
  34. // The fields on the method signature are provided as a comma-separated
  35. // string.
  36. //
  37. // For example, the proto RPC and annotation:
  38. //
  39. // rpc CreateSubscription(CreateSubscriptionRequest)
  40. // returns (Subscription) {
  41. // option (google.api.method_signature) = "name,topic";
  42. // }
  43. //
  44. // Would add the following Java overload (in addition to the method accepting
  45. // the request object):
  46. //
  47. // public final Subscription createSubscription(String name, String topic)
  48. //
  49. // The following backwards-compatibility guidelines apply:
  50. //
  51. // * Adding this annotation to an unannotated method is backwards
  52. // compatible.
  53. // * Adding this annotation to a method which already has existing
  54. // method signature annotations is backwards compatible if and only if
  55. // the new method signature annotation is last in the sequence.
  56. // * Modifying or removing an existing method signature annotation is
  57. // a breaking change.
  58. // * Re-ordering existing method signature annotations is a breaking
  59. // change.
  60. repeated string method_signature = 1051;
  61. }
  62. extend google.protobuf.ServiceOptions {
  63. // The hostname for this service.
  64. // This should be specified with no prefix or protocol.
  65. //
  66. // Example:
  67. //
  68. // service Foo {
  69. // option (google.api.default_host) = "foo.googleapi.com";
  70. // ...
  71. // }
  72. string default_host = 1049;
  73. // OAuth scopes needed for the client.
  74. //
  75. // Example:
  76. //
  77. // service Foo {
  78. // option (google.api.oauth_scopes) = \
  79. // "https://www.googleapis.com/auth/cloud-platform";
  80. // ...
  81. // }
  82. //
  83. // If there is more than one scope, use a comma-separated string:
  84. //
  85. // Example:
  86. //
  87. // service Foo {
  88. // option (google.api.oauth_scopes) = \
  89. // "https://www.googleapis.com/auth/cloud-platform,"
  90. // "https://www.googleapis.com/auth/monitoring";
  91. // ...
  92. // }
  93. string oauth_scopes = 1050;
  94. // The API version of this service, which should be sent by version-aware
  95. // clients to the service. This allows services to abide by the schema and
  96. // behavior of the service at the time this API version was deployed.
  97. // The format of the API version must be treated as opaque by clients.
  98. // Services may use a format with an apparent structure, but clients must
  99. // not rely on this to determine components within an API version, or attempt
  100. // to construct other valid API versions. Note that this is for upcoming
  101. // functionality and may not be implemented for all services.
  102. //
  103. // Example:
  104. //
  105. // service Foo {
  106. // option (google.api.api_version) = "v1_20230821_preview";
  107. // }
  108. string api_version = 525000001;
  109. }
  110. // Required information for every language.
  111. message CommonLanguageSettings {
  112. // Link to automatically generated reference documentation. Example:
  113. // https://cloud.google.com/nodejs/docs/reference/asset/latest
  114. string reference_docs_uri = 1 [deprecated = true];
  115. // The destination where API teams want this client library to be published.
  116. repeated ClientLibraryDestination destinations = 2;
  117. }
  118. // Details about how and where to publish client libraries.
  119. message ClientLibrarySettings {
  120. // Version of the API to apply these settings to. This is the full protobuf
  121. // package for the API, ending in the version element.
  122. // Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
  123. string version = 1;
  124. // Launch stage of this version of the API.
  125. LaunchStage launch_stage = 2;
  126. // When using transport=rest, the client request will encode enums as
  127. // numbers rather than strings.
  128. bool rest_numeric_enums = 3;
  129. // Settings for legacy Java features, supported in the Service YAML.
  130. JavaSettings java_settings = 21;
  131. // Settings for C++ client libraries.
  132. CppSettings cpp_settings = 22;
  133. // Settings for PHP client libraries.
  134. PhpSettings php_settings = 23;
  135. // Settings for Python client libraries.
  136. PythonSettings python_settings = 24;
  137. // Settings for Node client libraries.
  138. NodeSettings node_settings = 25;
  139. // Settings for .NET client libraries.
  140. DotnetSettings dotnet_settings = 26;
  141. // Settings for Ruby client libraries.
  142. RubySettings ruby_settings = 27;
  143. // Settings for Go client libraries.
  144. GoSettings go_settings = 28;
  145. }
  146. // This message configures the settings for publishing [Google Cloud Client
  147. // libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
  148. // generated from the service config.
  149. message Publishing {
  150. // A list of API method settings, e.g. the behavior for methods that use the
  151. // long-running operation pattern.
  152. repeated MethodSettings method_settings = 2;
  153. // Link to a *public* URI where users can report issues. Example:
  154. // https://issuetracker.google.com/issues/new?component=190865&template=1161103
  155. string new_issue_uri = 101;
  156. // Link to product home page. Example:
  157. // https://cloud.google.com/asset-inventory/docs/overview
  158. string documentation_uri = 102;
  159. // Used as a tracking tag when collecting data about the APIs developer
  160. // relations artifacts like docs, packages delivered to package managers,
  161. // etc. Example: "speech".
  162. string api_short_name = 103;
  163. // GitHub label to apply to issues and pull requests opened for this API.
  164. string github_label = 104;
  165. // GitHub teams to be added to CODEOWNERS in the directory in GitHub
  166. // containing source code for the client libraries for this API.
  167. repeated string codeowner_github_teams = 105;
  168. // A prefix used in sample code when demarking regions to be included in
  169. // documentation.
  170. string doc_tag_prefix = 106;
  171. // For whom the client library is being published.
  172. ClientLibraryOrganization organization = 107;
  173. // Client library settings. If the same version string appears multiple
  174. // times in this list, then the last one wins. Settings from earlier
  175. // settings with the same version string are discarded.
  176. repeated ClientLibrarySettings library_settings = 109;
  177. // Optional link to proto reference documentation. Example:
  178. // https://cloud.google.com/pubsub/lite/docs/reference/rpc
  179. string proto_reference_documentation_uri = 110;
  180. // Optional link to REST reference documentation. Example:
  181. // https://cloud.google.com/pubsub/lite/docs/reference/rest
  182. string rest_reference_documentation_uri = 111;
  183. }
  184. // Settings for Java client libraries.
  185. message JavaSettings {
  186. // The package name to use in Java. Clobbers the java_package option
  187. // set in the protobuf. This should be used **only** by APIs
  188. // who have already set the language_settings.java.package_name" field
  189. // in gapic.yaml. API teams should use the protobuf java_package option
  190. // where possible.
  191. //
  192. // Example of a YAML configuration::
  193. //
  194. // publishing:
  195. // java_settings:
  196. // library_package: com.google.cloud.pubsub.v1
  197. string library_package = 1;
  198. // Configure the Java class name to use instead of the service's for its
  199. // corresponding generated GAPIC client. Keys are fully-qualified
  200. // service names as they appear in the protobuf (including the full
  201. // the language_settings.java.interface_names" field in gapic.yaml. API
  202. // teams should otherwise use the service name as it appears in the
  203. // protobuf.
  204. //
  205. // Example of a YAML configuration::
  206. //
  207. // publishing:
  208. // java_settings:
  209. // service_class_names:
  210. // - google.pubsub.v1.Publisher: TopicAdmin
  211. // - google.pubsub.v1.Subscriber: SubscriptionAdmin
  212. map<string, string> service_class_names = 2;
  213. // Some settings.
  214. CommonLanguageSettings common = 3;
  215. }
  216. // Settings for C++ client libraries.
  217. message CppSettings {
  218. // Some settings.
  219. CommonLanguageSettings common = 1;
  220. }
  221. // Settings for Php client libraries.
  222. message PhpSettings {
  223. // Some settings.
  224. CommonLanguageSettings common = 1;
  225. }
  226. // Settings for Python client libraries.
  227. message PythonSettings {
  228. // Experimental features to be included during client library generation.
  229. // These fields will be deprecated once the feature graduates and is enabled
  230. // by default.
  231. message ExperimentalFeatures {
  232. // Enables generation of asynchronous REST clients if `rest` transport is
  233. // enabled. By default, asynchronous REST clients will not be generated.
  234. // This feature will be enabled by default 1 month after launching the
  235. // feature in preview packages.
  236. bool rest_async_io_enabled = 1;
  237. }
  238. // Some settings.
  239. CommonLanguageSettings common = 1;
  240. // Experimental features to be included during client library generation.
  241. ExperimentalFeatures experimental_features = 2;
  242. }
  243. // Settings for Node client libraries.
  244. message NodeSettings {
  245. // Some settings.
  246. CommonLanguageSettings common = 1;
  247. }
  248. // Settings for Dotnet client libraries.
  249. message DotnetSettings {
  250. // Some settings.
  251. CommonLanguageSettings common = 1;
  252. // Map from original service names to renamed versions.
  253. // This is used when the default generated types
  254. // would cause a naming conflict. (Neither name is
  255. // fully-qualified.)
  256. // Example: Subscriber to SubscriberServiceApi.
  257. map<string, string> renamed_services = 2;
  258. // Map from full resource types to the effective short name
  259. // for the resource. This is used when otherwise resource
  260. // named from different services would cause naming collisions.
  261. // Example entry:
  262. // "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
  263. map<string, string> renamed_resources = 3;
  264. // List of full resource types to ignore during generation.
  265. // This is typically used for API-specific Location resources,
  266. // which should be handled by the generator as if they were actually
  267. // the common Location resources.
  268. // Example entry: "documentai.googleapis.com/Location"
  269. repeated string ignored_resources = 4;
  270. // Namespaces which must be aliased in snippets due to
  271. // a known (but non-generator-predictable) naming collision
  272. repeated string forced_namespace_aliases = 5;
  273. // Method signatures (in the form "service.method(signature)")
  274. // which are provided separately, so shouldn't be generated.
  275. // Snippets *calling* these methods are still generated, however.
  276. repeated string handwritten_signatures = 6;
  277. }
  278. // Settings for Ruby client libraries.
  279. message RubySettings {
  280. // Some settings.
  281. CommonLanguageSettings common = 1;
  282. }
  283. // Settings for Go client libraries.
  284. message GoSettings {
  285. // Some settings.
  286. CommonLanguageSettings common = 1;
  287. }
  288. // Describes the generator configuration for a method.
  289. message MethodSettings {
  290. // Describes settings to use when generating API methods that use the
  291. // long-running operation pattern.
  292. // All default values below are from those used in the client library
  293. // generators (e.g.
  294. // [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
  295. message LongRunning {
  296. // Initial delay after which the first poll request will be made.
  297. // Default value: 5 seconds.
  298. google.protobuf.Duration initial_poll_delay = 1;
  299. // Multiplier to gradually increase delay between subsequent polls until it
  300. // reaches max_poll_delay.
  301. // Default value: 1.5.
  302. float poll_delay_multiplier = 2;
  303. // Maximum time between two subsequent poll requests.
  304. // Default value: 45 seconds.
  305. google.protobuf.Duration max_poll_delay = 3;
  306. // Total polling timeout.
  307. // Default value: 5 minutes.
  308. google.protobuf.Duration total_poll_timeout = 4;
  309. }
  310. // The fully qualified name of the method, for which the options below apply.
  311. // This is used to find the method to apply the options.
  312. //
  313. // Example:
  314. //
  315. // publishing:
  316. // method_settings:
  317. // - selector: google.storage.control.v2.StorageControl.CreateFolder
  318. // # method settings for CreateFolder...
  319. string selector = 1;
  320. // Describes settings to use for long-running operations when generating
  321. // API methods for RPCs. Complements RPCs that use the annotations in
  322. // google/longrunning/operations.proto.
  323. //
  324. // Example of a YAML configuration::
  325. //
  326. // publishing:
  327. // method_settings:
  328. // - selector: google.cloud.speech.v2.Speech.BatchRecognize
  329. // long_running:
  330. // initial_poll_delay: 60s # 1 minute
  331. // poll_delay_multiplier: 1.5
  332. // max_poll_delay: 360s # 6 minutes
  333. // total_poll_timeout: 54000s # 90 minutes
  334. LongRunning long_running = 2;
  335. // List of top-level fields of the request message, that should be
  336. // automatically populated by the client libraries based on their
  337. // (google.api.field_info).format. Currently supported format: UUID4.
  338. //
  339. // Example of a YAML configuration:
  340. //
  341. // publishing:
  342. // method_settings:
  343. // - selector: google.example.v1.ExampleService.CreateExample
  344. // auto_populated_fields:
  345. // - request_id
  346. repeated string auto_populated_fields = 3;
  347. }
  348. // The organization for which the client libraries are being published.
  349. // Affects the url where generated docs are published, etc.
  350. enum ClientLibraryOrganization {
  351. // Not useful.
  352. CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
  353. // Google Cloud Platform Org.
  354. CLOUD = 1;
  355. // Ads (Advertising) Org.
  356. ADS = 2;
  357. // Photos Org.
  358. PHOTOS = 3;
  359. // Street View Org.
  360. STREET_VIEW = 4;
  361. // Shopping Org.
  362. SHOPPING = 5;
  363. // Geo Org.
  364. GEO = 6;
  365. // Generative AI - https://developers.generativeai.google
  366. GENERATIVE_AI = 7;
  367. }
  368. // To where should client libraries be published?
  369. enum ClientLibraryDestination {
  370. // Client libraries will neither be generated nor published to package
  371. // managers.
  372. CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
  373. // Generate the client library in a repo under github.com/googleapis,
  374. // but don't publish it to package managers.
  375. GITHUB = 10;
  376. // Publish the library to package managers like nuget.org and npmjs.com.
  377. PACKAGE_MANAGER = 20;
  378. }