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