Skip to content

Commit

Permalink
feat: [serviceusage] introduce resource class serviceusage.googleapis…
Browse files Browse the repository at this point in the history
….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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 19, 2023
1 parent 53d2755 commit 4e7f9ef
Show file tree
Hide file tree
Showing 13 changed files with 14,702 additions and 11,454 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,7 @@ import "google/api/endpoint.proto";
import "google/api/monitored_resource.proto";
import "google/api/monitoring.proto";
import "google/api/quota.proto";
import "google/api/resource.proto";
import "google/api/usage.proto";
import "google/protobuf/api.proto";

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

// A service that is available for use by the consumer.
message Service {
option (google.api.resource) = {
type: "serviceusage.googleapis.com/Service"
pattern: "projects/{project}/services/{service}"
pattern: "folders/{folder}/services/{service}"
pattern: "organizations/{organization}/services/{service}"
};

// The resource name of the consumer and service.
//
// A valid name would be:
Expand Down Expand Up @@ -105,7 +113,8 @@ message ServiceConfig {
repeated google.api.Endpoint endpoints = 18;

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

// Monitoring configuration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,9 +17,9 @@ syntax = "proto3";
package google.api.serviceusage.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/serviceusage/v1/resources.proto";
import "google/longrunning/operations.proto";
import "google/api/client.proto";

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

// Enable a service so that it can be used with a project.
rpc EnableService(EnableServiceRequest) returns (google.longrunning.Operation) {
rpc EnableService(EnableServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=*/*/services/*}:enable"
body: "*"
Expand All @@ -60,7 +61,8 @@ service ServiceUsage {
// It is not valid to call the disable method on a service that is not
// currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
// the target service is not currently enabled.
rpc DisableService(DisableServiceRequest) returns (google.longrunning.Operation) {
rpc DisableService(DisableServiceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=*/*/services/*}:disable"
body: "*"
Expand Down Expand Up @@ -100,7 +102,8 @@ service ServiceUsage {
// Enable multiple services on a project. The operation is atomic: if enabling
// any service fails, then the entire batch fails, and no state changes occur.
// To enable a single service, use the `EnableService` method instead.
rpc BatchEnableServices(BatchEnableServicesRequest) returns (google.longrunning.Operation) {
rpc BatchEnableServices(BatchEnableServicesRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=*/*}/services:batchEnable"
body: "*"
Expand All @@ -113,7 +116,8 @@ service ServiceUsage {

// Returns the service configurations and enabled states for a given list of
// services.
rpc BatchGetServices(BatchGetServicesRequest) returns (BatchGetServicesResponse) {
rpc BatchGetServices(BatchGetServicesRequest)
returns (BatchGetServicesResponse) {
option (google.api.http) = {
get: "/v1/{parent=*/*}/services:batchGet"
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -105,7 +105,8 @@ message ServiceConfig {
repeated google.api.Endpoint endpoints = 18;

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

// Monitoring configuration.
Expand Down Expand Up @@ -196,6 +197,10 @@ message ConsumerQuotaLimit {
// ordered from least specific to most specific (for example, the global
// default bucket, with no quota dimensions, will always appear first).
repeated QuotaBucket quota_buckets = 9;

// List of all supported locations.
// This field is present only if the limit has a {region} or {zone} dimension.
repeated string supported_locations = 11;
}

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

// Producer policy inherited from the closet ancestor of the current consumer.
ProducerQuotaPolicy producer_quota_policy = 7;

// The dimensions of this quota bucket.
//
// If this map is empty, this is the global bucket, which is the default quota
Expand Down Expand Up @@ -334,6 +342,62 @@ enum QuotaSafetyCheck {
LIMIT_DECREASE_PERCENTAGE_TOO_HIGH = 2;
}

// Quota policy created by service producer.
message ProducerQuotaPolicy {
// The resource name of the policy.
// This name is generated by the server when the policy is created.
//
// Example names would be:
// `organizations/123/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%2Fcpus/limits/%2Fproject%2Fregion/producerQuotaPolicies/4a3f2c1d`
string name = 1;

// The quota policy value.
// Can be any nonnegative integer, or -1 (unlimited quota).
int64 policy_value = 2;

//
// If this map is nonempty, then this policy applies only to specific values
// for dimensions defined in the limit unit.
//
// For example, a policy on a limit with the unit `1/{project}/{region}`
// could contain an entry with the key `region` and the value `us-east-1`;
// the policy is only applied to quota consumed in that region.
//
// This map has the following restrictions:
//
// * Keys that are not defined in the limit's unit are not valid keys.
// Any string appearing in {brackets} in the unit (besides {project} or
// {user}) is a defined key.
// * `project` is not a valid key; the project is already specified in
// the parent resource name.
// * `user` is not a valid key; the API does not support quota policies
// that apply only to a specific user.
// * If `region` appears as a key, its value must be a valid Cloud region.
// * If `zone` appears as a key, its value must be a valid Cloud zone.
// * If any valid key other than `region` or `zone` appears in the map, then
// all valid keys other than `region` or `zone` must also appear in the
// map.
map<string, string> dimensions = 3;

// The name of the metric to which this policy applies.
//
// An example name would be:
// `compute.googleapis.com/cpus`
string metric = 4;

// The limit unit of the limit to which this policy applies.
//
// An example unit would be:
// `1/{project}/{region}`
// Note that `{project}` and `{region}` are not placeholders in this example;
// the literal characters `{` and `}` occur in the string.
string unit = 5;

// The cloud resource container at which the quota policy is created. The
// format is `{container_type}/{container_number}`
string container = 6;
}

// Quota policy created by quota administrator.
message AdminQuotaPolicy {
// The resource name of the policy.
Expand All @@ -351,7 +415,7 @@ message AdminQuotaPolicy {
// If this map is nonempty, then this policy applies only to specific values
// for dimensions defined in the limit unit.
//
// For example, an policy on a limit with the unit `1/{project}/{region}`
// For example, a policy on a limit with the unit `1/{project}/{region}`
// could contain an entry with the key `region` and the value `us-east-1`;
// the policy is only applied to quota consumed in that region.
//
Expand Down
Loading

0 comments on commit 4e7f9ef

Please sign in to comment.