Skip to content

Commit 4e7f9ef

Browse files
feat: [serviceusage] introduce resource class serviceusage.googleapis.com/Service (#4669)
* feat: introduce resource class serviceusage.googleapis.com/Service feat: added ConsumerQuotaLimit.supported_locations feat: added ProducerQuotaPolicy message and QuotaBucket.producer_quota_policy field chore: reformatted protos PiperOrigin-RevId: 565811363 Source-Link: googleapis/googleapis@57d9a31 Source-Link: googleapis/googleapis-gen@f6678e2 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwaS1zZXJ2aWNldXNhZ2UvLk93bEJvdC55YW1sIiwiaCI6ImY2Njc4ZTJiZmFhZDFkZWRhZjFjNjc5NDNkMWY2NzhhODc5ODk5YzIifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 53d2755 commit 4e7f9ef

13 files changed

Lines changed: 14702 additions & 11454 deletions

packages/google-api-serviceusage/protos/google/api/serviceusage/v1/resources.proto

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2023 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.
@@ -22,6 +22,7 @@ import "google/api/endpoint.proto";
2222
import "google/api/monitored_resource.proto";
2323
import "google/api/monitoring.proto";
2424
import "google/api/quota.proto";
25+
import "google/api/resource.proto";
2526
import "google/api/usage.proto";
2627
import "google/protobuf/api.proto";
2728

@@ -35,6 +36,13 @@ option ruby_package = "Google::Cloud::ServiceUsage::V1";
3536

3637
// A service that is available for use by the consumer.
3738
message Service {
39+
option (google.api.resource) = {
40+
type: "serviceusage.googleapis.com/Service"
41+
pattern: "projects/{project}/services/{service}"
42+
pattern: "folders/{folder}/services/{service}"
43+
pattern: "organizations/{organization}/services/{service}"
44+
};
45+
3846
// The resource name of the consumer and service.
3947
//
4048
// A valid name would be:
@@ -105,7 +113,8 @@ message ServiceConfig {
105113
repeated google.api.Endpoint endpoints = 18;
106114

107115
// Defines the monitored resources used by this service. This is required
108-
// by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations.
116+
// by the [Service.monitoring][google.api.Service.monitoring] and
117+
// [Service.logging][google.api.Service.logging] configurations.
109118
repeated google.api.MonitoredResourceDescriptor monitored_resources = 25;
110119

111120
// Monitoring configuration.

packages/google-api-serviceusage/protos/google/api/serviceusage/v1/serviceusage.proto

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2023 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.
@@ -17,9 +17,9 @@ syntax = "proto3";
1717
package google.api.serviceusage.v1;
1818

1919
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
2021
import "google/api/serviceusage/v1/resources.proto";
2122
import "google/longrunning/operations.proto";
22-
import "google/api/client.proto";
2323

2424
option csharp_namespace = "Google.Cloud.ServiceUsage.V1";
2525
option go_package = "cloud.google.com/go/serviceusage/apiv1/serviceusagepb;serviceusagepb";
@@ -42,7 +42,8 @@ service ServiceUsage {
4242
"https://www.googleapis.com/auth/service.management";
4343

4444
// Enable a service so that it can be used with a project.
45-
rpc EnableService(EnableServiceRequest) returns (google.longrunning.Operation) {
45+
rpc EnableService(EnableServiceRequest)
46+
returns (google.longrunning.Operation) {
4647
option (google.api.http) = {
4748
post: "/v1/{name=*/*/services/*}:enable"
4849
body: "*"
@@ -60,7 +61,8 @@ service ServiceUsage {
6061
// It is not valid to call the disable method on a service that is not
6162
// currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
6263
// the target service is not currently enabled.
63-
rpc DisableService(DisableServiceRequest) returns (google.longrunning.Operation) {
64+
rpc DisableService(DisableServiceRequest)
65+
returns (google.longrunning.Operation) {
6466
option (google.api.http) = {
6567
post: "/v1/{name=*/*/services/*}:disable"
6668
body: "*"
@@ -100,7 +102,8 @@ service ServiceUsage {
100102
// Enable multiple services on a project. The operation is atomic: if enabling
101103
// any service fails, then the entire batch fails, and no state changes occur.
102104
// To enable a single service, use the `EnableService` method instead.
103-
rpc BatchEnableServices(BatchEnableServicesRequest) returns (google.longrunning.Operation) {
105+
rpc BatchEnableServices(BatchEnableServicesRequest)
106+
returns (google.longrunning.Operation) {
104107
option (google.api.http) = {
105108
post: "/v1/{parent=*/*}/services:batchEnable"
106109
body: "*"
@@ -113,7 +116,8 @@ service ServiceUsage {
113116

114117
// Returns the service configurations and enabled states for a given list of
115118
// services.
116-
rpc BatchGetServices(BatchGetServicesRequest) returns (BatchGetServicesResponse) {
119+
rpc BatchGetServices(BatchGetServicesRequest)
120+
returns (BatchGetServicesResponse) {
117121
option (google.api.http) = {
118122
get: "/v1/{parent=*/*}/services:batchGet"
119123
};

packages/google-api-serviceusage/protos/google/api/serviceusage/v1beta1/resources.proto

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2023 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.
@@ -105,7 +105,8 @@ message ServiceConfig {
105105
repeated google.api.Endpoint endpoints = 18;
106106

107107
// Defines the monitored resources used by this service. This is required
108-
// by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations.
108+
// by the [Service.monitoring][google.api.Service.monitoring] and
109+
// [Service.logging][google.api.Service.logging] configurations.
109110
repeated google.api.MonitoredResourceDescriptor monitored_resources = 25;
110111

111112
// Monitoring configuration.
@@ -196,6 +197,10 @@ message ConsumerQuotaLimit {
196197
// ordered from least specific to most specific (for example, the global
197198
// default bucket, with no quota dimensions, will always appear first).
198199
repeated QuotaBucket quota_buckets = 9;
200+
201+
// List of all supported locations.
202+
// This field is present only if the limit has a {region} or {zone} dimension.
203+
repeated string supported_locations = 11;
199204
}
200205

201206
// Selected view of quota. Can be used to request more detailed quota
@@ -236,6 +241,9 @@ message QuotaBucket {
236241
// Admin override on this quota bucket.
237242
QuotaOverride admin_override = 5;
238243

244+
// Producer policy inherited from the closet ancestor of the current consumer.
245+
ProducerQuotaPolicy producer_quota_policy = 7;
246+
239247
// The dimensions of this quota bucket.
240248
//
241249
// If this map is empty, this is the global bucket, which is the default quota
@@ -334,6 +342,62 @@ enum QuotaSafetyCheck {
334342
LIMIT_DECREASE_PERCENTAGE_TOO_HIGH = 2;
335343
}
336344

345+
// Quota policy created by service producer.
346+
message ProducerQuotaPolicy {
347+
// The resource name of the policy.
348+
// This name is generated by the server when the policy is created.
349+
//
350+
// Example names would be:
351+
// `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/producerQuotaPolicies/4a3f2c1d`
352+
string name = 1;
353+
354+
// The quota policy value.
355+
// Can be any nonnegative integer, or -1 (unlimited quota).
356+
int64 policy_value = 2;
357+
358+
//
359+
// If this map is nonempty, then this policy applies only to specific values
360+
// for dimensions defined in the limit unit.
361+
//
362+
// For example, a policy on a limit with the unit `1/{project}/{region}`
363+
// could contain an entry with the key `region` and the value `us-east-1`;
364+
// the policy is only applied to quota consumed in that region.
365+
//
366+
// This map has the following restrictions:
367+
//
368+
// * Keys that are not defined in the limit's unit are not valid keys.
369+
// Any string appearing in {brackets} in the unit (besides {project} or
370+
// {user}) is a defined key.
371+
// * `project` is not a valid key; the project is already specified in
372+
// the parent resource name.
373+
// * `user` is not a valid key; the API does not support quota policies
374+
// that apply only to a specific user.
375+
// * If `region` appears as a key, its value must be a valid Cloud region.
376+
// * If `zone` appears as a key, its value must be a valid Cloud zone.
377+
// * If any valid key other than `region` or `zone` appears in the map, then
378+
// all valid keys other than `region` or `zone` must also appear in the
379+
// map.
380+
map<string, string> dimensions = 3;
381+
382+
// The name of the metric to which this policy applies.
383+
//
384+
// An example name would be:
385+
// `compute.googleapis.com/cpus`
386+
string metric = 4;
387+
388+
// The limit unit of the limit to which this policy applies.
389+
//
390+
// An example unit would be:
391+
// `1/{project}/{region}`
392+
// Note that `{project}` and `{region}` are not placeholders in this example;
393+
// the literal characters `{` and `}` occur in the string.
394+
string unit = 5;
395+
396+
// The cloud resource container at which the quota policy is created. The
397+
// format is `{container_type}/{container_number}`
398+
string container = 6;
399+
}
400+
337401
// Quota policy created by quota administrator.
338402
message AdminQuotaPolicy {
339403
// The resource name of the policy.
@@ -351,7 +415,7 @@ message AdminQuotaPolicy {
351415
// If this map is nonempty, then this policy applies only to specific values
352416
// for dimensions defined in the limit unit.
353417
//
354-
// For example, an policy on a limit with the unit `1/{project}/{region}`
418+
// For example, a policy on a limit with the unit `1/{project}/{region}`
355419
// could contain an entry with the key `region` and the value `us-east-1`;
356420
// the policy is only applied to quota consumed in that region.
357421
//

0 commit comments

Comments
 (0)