client.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. // Configuration for which RPCs should be generated in the GAPIC client.
  118. SelectiveGapicGeneration selective_gapic_generation = 3;
  119. }
  120. // Details about how and where to publish client libraries.
  121. message ClientLibrarySettings {
  122. // Version of the API to apply these settings to. This is the full protobuf
  123. // package for the API, ending in the version element.
  124. // Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
  125. string version = 1;
  126. // Launch stage of this version of the API.
  127. LaunchStage launch_stage = 2;
  128. // When using transport=rest, the client request will encode enums as
  129. // numbers rather than strings.
  130. bool rest_numeric_enums = 3;
  131. // Settings for legacy Java features, supported in the Service YAML.
  132. JavaSettings java_settings = 21;
  133. // Settings for C++ client libraries.
  134. CppSettings cpp_settings = 22;
  135. // Settings for PHP client libraries.
  136. PhpSettings php_settings = 23;
  137. // Settings for Python client libraries.
  138. PythonSettings python_settings = 24;
  139. // Settings for Node client libraries.
  140. NodeSettings node_settings = 25;
  141. // Settings for .NET client libraries.
  142. DotnetSettings dotnet_settings = 26;
  143. // Settings for Ruby client libraries.
  144. RubySettings ruby_settings = 27;
  145. // Settings for Go client libraries.
  146. GoSettings go_settings = 28;
  147. }
  148. // This message configures the settings for publishing [Google Cloud Client
  149. // libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
  150. // generated from the service config.
  151. message Publishing {
  152. // A list of API method settings, e.g. the behavior for methods that use the
  153. // long-running operation pattern.
  154. repeated MethodSettings method_settings = 2;
  155. // Link to a *public* URI where users can report issues. Example:
  156. // https://issuetracker.google.com/issues/new?component=190865&template=1161103
  157. string new_issue_uri = 101;
  158. // Link to product home page. Example:
  159. // https://cloud.google.com/asset-inventory/docs/overview
  160. string documentation_uri = 102;
  161. // Used as a tracking tag when collecting data about the APIs developer
  162. // relations artifacts like docs, packages delivered to package managers,
  163. // etc. Example: "speech".
  164. string api_short_name = 103;
  165. // GitHub label to apply to issues and pull requests opened for this API.
  166. string github_label = 104;
  167. // GitHub teams to be added to CODEOWNERS in the directory in GitHub
  168. // containing source code for the client libraries for this API.
  169. repeated string codeowner_github_teams = 105;
  170. // A prefix used in sample code when demarking regions to be included in
  171. // documentation.
  172. string doc_tag_prefix = 106;
  173. // For whom the client library is being published.
  174. ClientLibraryOrganization organization = 107;
  175. // Client library settings. If the same version string appears multiple
  176. // times in this list, then the last one wins. Settings from earlier
  177. // settings with the same version string are discarded.
  178. repeated ClientLibrarySettings library_settings = 109;
  179. // Optional link to proto reference documentation. Example:
  180. // https://cloud.google.com/pubsub/lite/docs/reference/rpc
  181. string proto_reference_documentation_uri = 110;
  182. // Optional link to REST reference documentation. Example:
  183. // https://cloud.google.com/pubsub/lite/docs/reference/rest
  184. string rest_reference_documentation_uri = 111;
  185. }
  186. // Settings for Java client libraries.
  187. message JavaSettings {
  188. // The package name to use in Java. Clobbers the java_package option
  189. // set in the protobuf. This should be used **only** by APIs
  190. // who have already set the language_settings.java.package_name" field
  191. // in gapic.yaml. API teams should use the protobuf java_package option
  192. // where possible.
  193. //
  194. // Example of a YAML configuration::
  195. //
  196. // publishing:
  197. // java_settings:
  198. // library_package: com.google.cloud.pubsub.v1
  199. string library_package = 1;
  200. // Configure the Java class name to use instead of the service's for its
  201. // corresponding generated GAPIC client. Keys are fully-qualified
  202. // service names as they appear in the protobuf (including the full
  203. // the language_settings.java.interface_names" field in gapic.yaml. API
  204. // teams should otherwise use the service name as it appears in the
  205. // protobuf.
  206. //
  207. // Example of a YAML configuration::
  208. //
  209. // publishing:
  210. // java_settings:
  211. // service_class_names:
  212. // - google.pubsub.v1.Publisher: TopicAdmin
  213. // - google.pubsub.v1.Subscriber: SubscriptionAdmin
  214. map<string, string> service_class_names = 2;
  215. // Some settings.
  216. CommonLanguageSettings common = 3;
  217. }
  218. // Settings for C++ client libraries.
  219. message CppSettings {
  220. // Some settings.
  221. CommonLanguageSettings common = 1;
  222. }
  223. // Settings for Php client libraries.
  224. message PhpSettings {
  225. // Some settings.
  226. CommonLanguageSettings common = 1;
  227. }
  228. // Settings for Python client libraries.
  229. message PythonSettings {
  230. // Experimental features to be included during client library generation.
  231. // These fields will be deprecated once the feature graduates and is enabled
  232. // by default.
  233. message ExperimentalFeatures {
  234. // Enables generation of asynchronous REST clients if `rest` transport is
  235. // enabled. By default, asynchronous REST clients will not be generated.
  236. // This feature will be enabled by default 1 month after launching the
  237. // feature in preview packages.
  238. bool rest_async_io_enabled = 1;
  239. // Enables generation of protobuf code using new types that are more
  240. // Pythonic which are included in `protobuf>=5.29.x`. This feature will be
  241. // enabled by default 1 month after launching the feature in preview
  242. // packages.
  243. bool protobuf_pythonic_types_enabled = 2;
  244. }
  245. // Some settings.
  246. CommonLanguageSettings common = 1;
  247. // Experimental features to be included during client library generation.
  248. ExperimentalFeatures experimental_features = 2;
  249. }
  250. // Settings for Node client libraries.
  251. message NodeSettings {
  252. // Some settings.
  253. CommonLanguageSettings common = 1;
  254. }
  255. // Settings for Dotnet client libraries.
  256. message DotnetSettings {
  257. // Some settings.
  258. CommonLanguageSettings common = 1;
  259. // Map from original service names to renamed versions.
  260. // This is used when the default generated types
  261. // would cause a naming conflict. (Neither name is
  262. // fully-qualified.)
  263. // Example: Subscriber to SubscriberServiceApi.
  264. map<string, string> renamed_services = 2;
  265. // Map from full resource types to the effective short name
  266. // for the resource. This is used when otherwise resource
  267. // named from different services would cause naming collisions.
  268. // Example entry:
  269. // "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
  270. map<string, string> renamed_resources = 3;
  271. // List of full resource types to ignore during generation.
  272. // This is typically used for API-specific Location resources,
  273. // which should be handled by the generator as if they were actually
  274. // the common Location resources.
  275. // Example entry: "documentai.googleapis.com/Location"
  276. repeated string ignored_resources = 4;
  277. // Namespaces which must be aliased in snippets due to
  278. // a known (but non-generator-predictable) naming collision
  279. repeated string forced_namespace_aliases = 5;
  280. // Method signatures (in the form "service.method(signature)")
  281. // which are provided separately, so shouldn't be generated.
  282. // Snippets *calling* these methods are still generated, however.
  283. repeated string handwritten_signatures = 6;
  284. }
  285. // Settings for Ruby client libraries.
  286. message RubySettings {
  287. // Some settings.
  288. CommonLanguageSettings common = 1;
  289. }
  290. // Settings for Go client libraries.
  291. message GoSettings {
  292. // Some settings.
  293. CommonLanguageSettings common = 1;
  294. }
  295. // Describes the generator configuration for a method.
  296. message MethodSettings {
  297. // Describes settings to use when generating API methods that use the
  298. // long-running operation pattern.
  299. // All default values below are from those used in the client library
  300. // generators (e.g.
  301. // [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
  302. message LongRunning {
  303. // Initial delay after which the first poll request will be made.
  304. // Default value: 5 seconds.
  305. google.protobuf.Duration initial_poll_delay = 1;
  306. // Multiplier to gradually increase delay between subsequent polls until it
  307. // reaches max_poll_delay.
  308. // Default value: 1.5.
  309. float poll_delay_multiplier = 2;
  310. // Maximum time between two subsequent poll requests.
  311. // Default value: 45 seconds.
  312. google.protobuf.Duration max_poll_delay = 3;
  313. // Total polling timeout.
  314. // Default value: 5 minutes.
  315. google.protobuf.Duration total_poll_timeout = 4;
  316. }
  317. // The fully qualified name of the method, for which the options below apply.
  318. // This is used to find the method to apply the options.
  319. //
  320. // Example:
  321. //
  322. // publishing:
  323. // method_settings:
  324. // - selector: google.storage.control.v2.StorageControl.CreateFolder
  325. // # method settings for CreateFolder...
  326. string selector = 1;
  327. // Describes settings to use for long-running operations when generating
  328. // API methods for RPCs. Complements RPCs that use the annotations in
  329. // google/longrunning/operations.proto.
  330. //
  331. // Example of a YAML configuration::
  332. //
  333. // publishing:
  334. // method_settings:
  335. // - selector: google.cloud.speech.v2.Speech.BatchRecognize
  336. // long_running:
  337. // initial_poll_delay: 60s # 1 minute
  338. // poll_delay_multiplier: 1.5
  339. // max_poll_delay: 360s # 6 minutes
  340. // total_poll_timeout: 54000s # 90 minutes
  341. LongRunning long_running = 2;
  342. // List of top-level fields of the request message, that should be
  343. // automatically populated by the client libraries based on their
  344. // (google.api.field_info).format. Currently supported format: UUID4.
  345. //
  346. // Example of a YAML configuration:
  347. //
  348. // publishing:
  349. // method_settings:
  350. // - selector: google.example.v1.ExampleService.CreateExample
  351. // auto_populated_fields:
  352. // - request_id
  353. repeated string auto_populated_fields = 3;
  354. }
  355. // The organization for which the client libraries are being published.
  356. // Affects the url where generated docs are published, etc.
  357. enum ClientLibraryOrganization {
  358. // Not useful.
  359. CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
  360. // Google Cloud Platform Org.
  361. CLOUD = 1;
  362. // Ads (Advertising) Org.
  363. ADS = 2;
  364. // Photos Org.
  365. PHOTOS = 3;
  366. // Street View Org.
  367. STREET_VIEW = 4;
  368. // Shopping Org.
  369. SHOPPING = 5;
  370. // Geo Org.
  371. GEO = 6;
  372. // Generative AI - https://developers.generativeai.google
  373. GENERATIVE_AI = 7;
  374. }
  375. // To where should client libraries be published?
  376. enum ClientLibraryDestination {
  377. // Client libraries will neither be generated nor published to package
  378. // managers.
  379. CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
  380. // Generate the client library in a repo under github.com/googleapis,
  381. // but don't publish it to package managers.
  382. GITHUB = 10;
  383. // Publish the library to package managers like nuget.org and npmjs.com.
  384. PACKAGE_MANAGER = 20;
  385. }
  386. // This message is used to configure the generation of a subset of the RPCs in
  387. // a service for client libraries.
  388. message SelectiveGapicGeneration {
  389. // An allowlist of the fully qualified names of RPCs that should be included
  390. // on public client surfaces.
  391. repeated string methods = 1;
  392. }