Skip to content

Commit bd9aa78

Browse files
Google APIscopybara-github
authored andcommitted
feat: added google.api.Service.publishing and client libraries settings
feat: added google.api.JwtLocation.cookie feat: new fields in enum google.api.ErrorReason fix: deprecate google.api.Endpoint.aliases fix: deprecate google.api.BackendRule.min_deadline docs: minor updates to comments PiperOrigin-RevId: 488484261
1 parent 5e5d500 commit bd9aa78

15 files changed

Lines changed: 522 additions & 86 deletions

google/api/BUILD.bazel

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ proto_library(
4040
name = "client_proto",
4141
srcs = ["client.proto"],
4242
deps = [
43+
":launch_stage_proto",
4344
"@com_google_protobuf//:descriptor_proto",
45+
"@com_google_protobuf//:duration_proto",
4446
],
4547
)
4648

@@ -197,6 +199,7 @@ proto_library(
197199
":auth_proto",
198200
":backend_proto",
199201
":billing_proto",
202+
":client_proto",
200203
":context_proto",
201204
":control_proto",
202205
":documentation_proto",
@@ -352,12 +355,14 @@ go_proto_library(
352355
":resource_proto",
353356
":routing_proto",
354357
],
358+
deps = [":api_go_proto"],
355359
)
356360

357361
go_proto_library(
358362
name = "client_go_proto",
359363
importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
360364
protos = [":client_proto"],
365+
deps = [":api_go_proto"],
361366
)
362367

363368
go_proto_library(
@@ -396,9 +401,6 @@ go_proto_library(
396401
protos = [
397402
":launch_stage_proto",
398403
],
399-
deps = [
400-
":annotations_go_proto",
401-
],
402404
)
403405

404406
go_proto_library(

google/api/auth.proto

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ message JwtLocation {
8484

8585
// Specifies URL query parameter name to extract JWT token.
8686
string query = 2;
87+
88+
// Specifies cookie name to extract JWT token.
89+
string cookie = 4;
8790
}
8891

8992
// The value prefix. The value format is "value_prefix{token}"
@@ -152,11 +155,12 @@ message AuthProvider {
152155
// Implement authorizationUrl of securityDefinitions in OpenAPI spec.
153156
string authorization_url = 5;
154157

155-
// Defines the locations to extract the JWT.
158+
// Defines the locations to extract the JWT. For now it is only used by the
159+
// Cloud Endpoints to store the OpenAPI extension [x-google-jwt-locations]
160+
// (https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#x-google-jwt-locations)
156161
//
157-
// JWT locations can be either from HTTP headers or URL query parameters.
158-
// The rule is that the first match wins. The checking order is: checking
159-
// all headers first, then URL query parameters.
162+
// JWT locations can be one of HTTP headers, URL query parameters or
163+
// cookies. The rule is that the first match wins.
160164
//
161165
// If not specified, default to use following 3 locations:
162166
// 1) Authorization: Bearer

google/api/backend.proto

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ message BackendRule {
120120
// varies based on the request protocol and deployment environment.
121121
double deadline = 3;
122122

123-
// Minimum deadline in seconds needed for this method. Calls having deadline
124-
// value lower than this will be rejected.
125-
double min_deadline = 4;
123+
// Deprecated, do not use.
124+
double min_deadline = 4 [deprecated = true];
126125

127126
// The number of seconds to wait for the completion of a long running
128127
// operation. The default is no deadline.

google/api/client.proto

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ syntax = "proto3";
1616

1717
package google.api;
1818

19+
import "google/api/launch_stage.proto";
1920
import "google/protobuf/descriptor.proto";
21+
import "google/protobuf/duration.proto";
2022

2123
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
2224
option java_multiple_files = true;
@@ -97,3 +99,251 @@ extend google.protobuf.ServiceOptions {
9799
// }
98100
string oauth_scopes = 1050;
99101
}
102+
103+
// Required information for every language.
104+
message 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;
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.
114+
message ClientLibrarySettings {
115+
// Version of the API to apply these settings to.
116+
string version = 1;
117+
118+
// Launch stage of this version of the API.
119+
LaunchStage launch_stage = 2;
120+
121+
// When using transport=rest, the client request will encode enums as
122+
// numbers rather than strings.
123+
bool rest_numeric_enums = 3;
124+
125+
// Settings for legacy Java features, supported in the Service YAML.
126+
JavaSettings java_settings = 21;
127+
128+
// Settings for C++ client libraries.
129+
CppSettings cpp_settings = 22;
130+
131+
// Settings for PHP client libraries.
132+
PhpSettings php_settings = 23;
133+
134+
// Settings for Python client libraries.
135+
PythonSettings python_settings = 24;
136+
137+
// Settings for Node client libraries.
138+
NodeSettings node_settings = 25;
139+
140+
// Settings for .NET client libraries.
141+
DotnetSettings dotnet_settings = 26;
142+
143+
// Settings for Ruby client libraries.
144+
RubySettings ruby_settings = 27;
145+
146+
// Settings for Go client libraries.
147+
GoSettings go_settings = 28;
148+
}
149+
150+
// This message configures the settings for publishing [Google Cloud Client
151+
// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
152+
// generated from the service config.
153+
message Publishing {
154+
// A list of API method settings, e.g. the behavior for methods that use the
155+
// long-running operation pattern.
156+
repeated MethodSettings method_settings = 2;
157+
158+
// Link to a place that API users can report issues. Example:
159+
// https://issuetracker.google.com/issues/new?component=190865&template=1161103
160+
string new_issue_uri = 101;
161+
162+
// Link to product home page. Example:
163+
// https://cloud.google.com/asset-inventory/docs/overview
164+
string documentation_uri = 102;
165+
166+
// Used as a tracking tag when collecting data about the APIs developer
167+
// relations artifacts like docs, packages delivered to package managers,
168+
// etc. Example: "speech".
169+
string api_short_name = 103;
170+
171+
// GitHub label to apply to issues and pull requests opened for this API.
172+
string github_label = 104;
173+
174+
// GitHub teams to be added to CODEOWNERS in the directory in GitHub
175+
// containing source code for the client libraries for this API.
176+
repeated string codeowner_github_teams = 105;
177+
178+
// A prefix used in sample code when demarking regions to be included in
179+
// documentation.
180+
string doc_tag_prefix = 106;
181+
182+
// For whom the client library is being published.
183+
ClientLibraryOrganization organization = 107;
184+
185+
// Client library settings. If the same version string appears multiple
186+
// times in this list, then the last one wins. Settings from earlier
187+
// settings with the same version string are discarded.
188+
repeated ClientLibrarySettings library_settings = 109;
189+
}
190+
191+
// Settings for Java client libraries.
192+
message JavaSettings {
193+
// The package name to use in Java. Clobbers the java_package option
194+
// set in the protobuf. This should be used **only** by APIs
195+
// who have already set the language_settings.java.package_name" field
196+
// in gapic.yaml. API teams should use the protobuf java_package option
197+
// where possible.
198+
//
199+
// Example of a YAML configuration::
200+
//
201+
// publishing:
202+
// java_settings:
203+
// library_package: com.google.cloud.pubsub.v1
204+
string library_package = 1;
205+
206+
// Configure the Java class name to use instead of the service's for its
207+
// corresponding generated GAPIC client. Keys are fully-qualified
208+
// service names as they appear in the protobuf (including the full
209+
// the language_settings.java.interface_names" field in gapic.yaml. API
210+
// teams should otherwise use the service name as it appears in the
211+
// protobuf.
212+
//
213+
// Example of a YAML configuration::
214+
//
215+
// publishing:
216+
// java_settings:
217+
// service_class_names:
218+
// - google.pubsub.v1.Publisher: TopicAdmin
219+
// - google.pubsub.v1.Subscriber: SubscriptionAdmin
220+
map<string, string> service_class_names = 2;
221+
222+
// Some settings.
223+
CommonLanguageSettings common = 3;
224+
}
225+
226+
// Settings for C++ client libraries.
227+
message CppSettings {
228+
// Some settings.
229+
CommonLanguageSettings common = 1;
230+
}
231+
232+
// Settings for Php client libraries.
233+
message PhpSettings {
234+
// Some settings.
235+
CommonLanguageSettings common = 1;
236+
}
237+
238+
// Settings for Python client libraries.
239+
message PythonSettings {
240+
// Some settings.
241+
CommonLanguageSettings common = 1;
242+
}
243+
244+
// Settings for Node client libraries.
245+
message NodeSettings {
246+
// Some settings.
247+
CommonLanguageSettings common = 1;
248+
}
249+
250+
// Settings for Dotnet client libraries.
251+
message DotnetSettings {
252+
// Some settings.
253+
CommonLanguageSettings common = 1;
254+
}
255+
256+
// Settings for Ruby client libraries.
257+
message RubySettings {
258+
// Some settings.
259+
CommonLanguageSettings common = 1;
260+
}
261+
262+
// Settings for Go client libraries.
263+
message GoSettings {
264+
// Some settings.
265+
CommonLanguageSettings common = 1;
266+
}
267+
268+
// Describes the generator configuration for a method.
269+
message MethodSettings {
270+
// Describes settings to use when generating API methods that use the
271+
// long-running operation pattern.
272+
// All default values below are from those used in the client library
273+
// generators (e.g.
274+
// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
275+
message LongRunning {
276+
// Initial delay after which the first poll request will be made.
277+
// Default value: 5 seconds.
278+
google.protobuf.Duration initial_poll_delay = 1;
279+
280+
// Multiplier to gradually increase delay between subsequent polls until it
281+
// reaches max_poll_delay.
282+
// Default value: 1.5.
283+
float poll_delay_multiplier = 2;
284+
285+
// Maximum time between two subsequent poll requests.
286+
// Default value: 45 seconds.
287+
google.protobuf.Duration max_poll_delay = 3;
288+
289+
// Total polling timeout.
290+
// Default value: 5 minutes.
291+
google.protobuf.Duration total_poll_timeout = 4;
292+
}
293+
294+
// The fully qualified name of the method, for which the options below apply.
295+
// This is used to find the method to apply the options.
296+
string selector = 1;
297+
298+
// Describes settings to use for long-running operations when generating
299+
// API methods for RPCs. Complements RPCs that use the annotations in
300+
// google/longrunning/operations.proto.
301+
//
302+
// Example of a YAML configuration::
303+
//
304+
// publishing:
305+
// method_behavior:
306+
// - selector: CreateAdDomain
307+
// long_running:
308+
// initial_poll_delay:
309+
// seconds: 60 # 1 minute
310+
// poll_delay_multiplier: 1.5
311+
// max_poll_delay:
312+
// seconds: 360 # 6 minutes
313+
// total_poll_timeout:
314+
// seconds: 54000 # 90 minutes
315+
LongRunning long_running = 2;
316+
}
317+
318+
// The organization for which the client libraries are being published.
319+
// Affects the url where generated docs are published, etc.
320+
enum ClientLibraryOrganization {
321+
// Not useful.
322+
CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
323+
324+
// Google Cloud Platform Org.
325+
CLOUD = 1;
326+
327+
// Ads (Advertising) Org.
328+
ADS = 2;
329+
330+
// Photos Org.
331+
PHOTOS = 3;
332+
333+
// Street View Org.
334+
STREET_VIEW = 4;
335+
}
336+
337+
// To where should client libraries be published?
338+
enum ClientLibraryDestination {
339+
// Client libraries will neither be generated nor published to package
340+
// managers.
341+
CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
342+
343+
// Generate the client library in a repo under github.com/googleapis,
344+
// but don't publish it to package managers.
345+
GITHUB = 10;
346+
347+
// Publish the library to package managers like nuget.org and npmjs.com.
348+
PACKAGE_MANAGER = 20;
349+
}

google/api/control.proto

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ option java_outer_classname = "ControlProto";
2222
option java_package = "com.google.api";
2323
option objc_class_prefix = "GAPI";
2424

25-
// Selects and configures the service controller used by the service. The
26-
// service controller handles features like abuse, quota, billing, logging,
27-
// monitoring, etc.
25+
// Selects and configures the service controller used by the service.
26+
//
27+
// Example:
28+
//
29+
// control:
30+
// environment: servicecontrol.googleapis.com
2831
message Control {
29-
// The service control environment to use. If empty, no control plane
30-
// feature (like quota and billing) will be enabled.
32+
// The service controller environment to use. If empty, no control plane
33+
// feature (like quota and billing) will be enabled. The recommended value for
34+
// most services is servicecontrol.googleapis.com
3135
string environment = 1;
3236
}

0 commit comments

Comments
 (0)