Skip to content

Commit 1d5522a

Browse files
Google APIscopybara-github
authored andcommitted
feat: Sync the servicecontrol API.
Most notably, this adds the HttpRequest struct. PiperOrigin-RevId: 327514630
1 parent 17de2b3 commit 1d5522a

File tree

10 files changed

+383
-42
lines changed

10 files changed

+383
-42
lines changed

google/api/servicecontrol/v1/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ proto_library(
1313
srcs = [
1414
"check_error.proto",
1515
"distribution.proto",
16+
"http_request.proto",
1617
"log_entry.proto",
1718
"metric_value.proto",
1819
"operation.proto",
@@ -25,6 +26,7 @@ proto_library(
2526
"//google/logging/type:type_proto",
2627
"//google/rpc:status_proto",
2728
"@com_google_protobuf//:any_proto",
29+
"@com_google_protobuf//:duration_proto",
2830
"@com_google_protobuf//:struct_proto",
2931
"@com_google_protobuf//:timestamp_proto",
3032
],
@@ -35,7 +37,6 @@ proto_library(
3537
##############################################################################
3638
# Put your C++ code here
3739
load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library")
38-
3940
cc_proto_library(
4041
name = "servicecontrol_cc_proto",
4142
deps = [

google/api/servicecontrol/v1/check_error.proto

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,14 @@ message CheckError {
3333
ERROR_CODE_UNSPECIFIED = 0;
3434

3535
// The consumer's project id, network container, or resource container was
36-
// not found. Same as
37-
// [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
36+
// not found. Same as [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
3837
NOT_FOUND = 5;
3938

4039
// The consumer doesn't have access to the specified resource.
41-
// Same as
42-
// [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
40+
// Same as [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
4341
PERMISSION_DENIED = 7;
4442

45-
// Quota check failed. Same as
46-
// [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
43+
// Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
4744
RESOURCE_EXHAUSTED = 8;
4845

4946
// The consumer hasn't activated the service.

google/api/servicecontrol/v1/distribution.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 Google Inc.
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright 2020 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+
15+
syntax = "proto3";
16+
17+
package google.api.servicecontrol.v1;
18+
19+
import "google/protobuf/duration.proto";
20+
21+
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "HttpRequestProto";
24+
option java_package = "com.google.api.servicecontrol.v1";
25+
26+
// A common proto for logging HTTP requests. Only contains semantics
27+
// defined by the HTTP specification. Product-specific logging
28+
// information MUST be defined in a separate message.
29+
message HttpRequest {
30+
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
31+
string request_method = 1;
32+
33+
// The scheme (http, https), the host name, the path, and the query
34+
// portion of the URL that was requested.
35+
// Example: `"http://example.com/some/info?color=red"`.
36+
string request_url = 2;
37+
38+
// The size of the HTTP request message in bytes, including the request
39+
// headers and the request body.
40+
int64 request_size = 3;
41+
42+
// The response code indicating the status of the response.
43+
// Examples: 200, 404.
44+
int32 status = 4;
45+
46+
// The size of the HTTP response message sent back to the client, in bytes,
47+
// including the response headers and the response body.
48+
int64 response_size = 5;
49+
50+
// The user agent sent by the client. Example:
51+
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
52+
// CLR 1.0.3705)"`.
53+
string user_agent = 6;
54+
55+
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
56+
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
57+
string remote_ip = 7;
58+
59+
// The IP address (IPv4 or IPv6) of the origin server that the request was
60+
// sent to.
61+
string server_ip = 13;
62+
63+
// The referer URL of the request, as defined in
64+
// [HTTP/1.1 Header Field
65+
// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
66+
string referer = 8;
67+
68+
// The request processing latency on the server, from the time the request was
69+
// received until the response was sent.
70+
google.protobuf.Duration latency = 14;
71+
72+
// Whether or not a cache lookup was attempted.
73+
bool cache_lookup = 11;
74+
75+
// Whether or not an entity was served from cache
76+
// (with or without validation).
77+
bool cache_hit = 9;
78+
79+
// Whether or not the response was validated with the origin server before
80+
// being served from cache. This field is only meaningful if `cache_hit` is
81+
// True.
82+
bool cache_validated_with_origin_server = 10;
83+
84+
// The number of HTTP response bytes inserted into cache. Set only when a
85+
// cache fill was attempted.
86+
int64 cache_fill_bytes = 12;
87+
88+
// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
89+
string protocol = 15;
90+
}

google/api/servicecontrol/v1/log_entry.proto

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 Google Inc.
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.api.servicecontrol.v1;
1818

19+
import "google/api/servicecontrol/v1/http_request.proto";
1920
import "google/logging/type/log_severity.proto";
2021
import "google/protobuf/any.proto";
2122
import "google/protobuf/struct.proto";
@@ -40,6 +41,16 @@ message LogEntry {
4041
// `LogSeverity.DEFAULT`.
4142
google.logging.type.LogSeverity severity = 12;
4243

44+
// Optional. Information about the HTTP request associated with this
45+
// log entry, if applicable.
46+
HttpRequest http_request = 14;
47+
48+
// Optional. Resource name of the trace associated with the log entry, if any.
49+
// If this field contains a relative resource name, you can assume the name is
50+
// relative to `//tracing.googleapis.com`. Example:
51+
// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
52+
string trace = 15;
53+
4354
// A unique ID for the log entry used for deduplication. If omitted,
4455
// the implementation will generate one based on operation_id.
4556
string insert_id = 4;
@@ -62,4 +73,51 @@ message LogEntry {
6273
// is expressed as a JSON object.
6374
google.protobuf.Struct struct_payload = 6;
6475
}
76+
77+
// Optional. Information about an operation associated with the log entry, if
78+
// applicable.
79+
LogEntryOperation operation = 16;
80+
81+
// Optional. Source code location information associated with the log entry,
82+
// if any.
83+
LogEntrySourceLocation source_location = 17;
84+
}
85+
86+
// Additional information about a potentially long-running operation with which
87+
// a log entry is associated.
88+
message LogEntryOperation {
89+
// Optional. An arbitrary operation identifier. Log entries with the
90+
// same identifier are assumed to be part of the same operation.
91+
string id = 1;
92+
93+
// Optional. An arbitrary producer identifier. The combination of
94+
// `id` and `producer` must be globally unique. Examples for `producer`:
95+
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
96+
string producer = 2;
97+
98+
// Optional. Set this to True if this is the first log entry in the operation.
99+
bool first = 3;
100+
101+
// Optional. Set this to True if this is the last log entry in the operation.
102+
bool last = 4;
103+
}
104+
105+
// Additional information about the source code location that produced the log
106+
// entry.
107+
message LogEntrySourceLocation {
108+
// Optional. Source file name. Depending on the runtime environment, this
109+
// might be a simple name or a fully-qualified name.
110+
string file = 1;
111+
112+
// Optional. Line within the source file. 1-based; 0 indicates no line number
113+
// available.
114+
int64 line = 2;
115+
116+
// Optional. Human-readable name of the function or method being invoked, with
117+
// optional context such as the class or package name. This information may be
118+
// used in contexts such as the logs viewer, where a file and line number are
119+
// less meaningful. The format can vary by language. For example:
120+
// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
121+
// (Python).
122+
string function = 3;
65123
}

google/api/servicecontrol/v1/metric_value.proto

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ option java_package = "com.google.api.servicecontrol.v1";
2828
// Represents a single metric value.
2929
message MetricValue {
3030
// The labels describing the metric value.
31-
// See comments on
32-
// [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels]
33-
// for the overriding relationship. Note that this map must not contain
34-
// monitored resource labels.
31+
// See comments on [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] for
32+
// the overriding relationship.
33+
// Note that this map must not contain monitored resource labels.
3534
map<string, string> labels = 1;
3635

3736
// The start of the time period over which this metric value's measurement

google/api/servicecontrol/v1/operation.proto

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package google.api.servicecontrol.v1;
1818

1919
import "google/api/servicecontrol/v1/log_entry.proto";
2020
import "google/api/servicecontrol/v1/metric_value.proto";
21+
import "google/protobuf/any.proto";
2122
import "google/protobuf/timestamp.proto";
2223

2324
option cc_enable_arenas = true;
@@ -72,10 +73,8 @@ message Operation {
7273
google.protobuf.Timestamp start_time = 4;
7374

7475
// End time of the operation.
75-
// Required when the operation is used in
76-
// [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report],
77-
// but optional when the operation is used in
78-
// [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check].
76+
// Required when the operation is used in [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report],
77+
// but optional when the operation is used in [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check].
7978
google.protobuf.Timestamp end_time = 5;
8079

8180
// Labels describing the operation. Only the following labels are allowed:
@@ -113,4 +112,7 @@ message Operation {
113112

114113
// DO NOT USE. This is an experimental field.
115114
Importance importance = 11;
115+
116+
// Unimplemented.
117+
repeated google.protobuf.Any extensions = 16;
116118
}

google/api/servicecontrol/v1/quota_controller.proto

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package google.api.servicecontrol.v1;
1818

1919
import "google/api/annotations.proto";
2020
import "google/api/servicecontrol/v1/metric_value.proto";
21+
import "google/api/client.proto";
2122

2223
option cc_enable_arenas = true;
2324
option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
@@ -30,6 +31,11 @@ option java_package = "com.google.api.servicecontrol.v1";
3031
// Allows clients to allocate and release quota against a [managed
3132
// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
3233
service QuotaController {
34+
option (google.api.default_host) = "servicecontrol.googleapis.com";
35+
option (google.api.oauth_scopes) =
36+
"https://www.googleapis.com/auth/cloud-platform,"
37+
"https://www.googleapis.com/auth/servicecontrol";
38+
3339
// Attempts to allocate quota for the specified consumer. It should be called
3440
// before the operation is executed.
3541
//
@@ -54,8 +60,7 @@ message AllocateQuotaRequest {
5460
// Name of the service as specified in the service configuration. For example,
5561
// `"pubsub.googleapis.com"`.
5662
//
57-
// See [google.api.Service][google.api.Service] for the definition of a
58-
// service name.
63+
// See [google.api.Service][google.api.Service] for the definition of a service name.
5964
string service_name = 1;
6065

6166
// Operation that describes the quota allocation.
@@ -96,6 +101,20 @@ message QuotaOperation {
96101
// available and does not change the available quota. No lock is placed on
97102
// the available quota either.
98103
CHECK_ONLY = 3;
104+
105+
// Unimplemented. When used in AllocateQuotaRequest, this returns the
106+
// effective quota limit(s) in the response, and no quota check will be
107+
// performed. Not supported for other requests, and even for
108+
// AllocateQuotaRequest, this is currently supported only for whitelisted
109+
// services.
110+
QUERY_ONLY = 4;
111+
112+
// The operation allocates quota for the amount specified in the service
113+
// configuration or specified using the quota metrics. If the requested
114+
// amount is higher than the available quota, request does not fail and
115+
// remaining quota would become negative (going over the limit)
116+
// Not supported for Rate Quota.
117+
ADJUST_ONLY = 5;
99118
}
100119

101120
// Identity of the operation. This is expected to be unique within the scope
@@ -175,8 +194,7 @@ message AllocateQuotaResponse {
175194
string service_config_id = 4;
176195
}
177196

178-
// Represents error information for
179-
// [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation].
197+
// Represents error information for [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation].
180198
message QuotaError {
181199
// Error codes related to project config validations are deprecated since the
182200
// quota controller methods do not perform these validations. Instead services
@@ -188,8 +206,7 @@ message QuotaError {
188206
UNSPECIFIED = 0;
189207

190208
// Quota allocation failed.
191-
// Same as
192-
// [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
209+
// Same as [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
193210
RESOURCE_EXHAUSTED = 8;
194211

195212
// Consumer cannot access the service because the service requires active

0 commit comments

Comments
 (0)