xref: /aosp_15_r20/external/googleapis/google/api/cloudquotas/v1/cloudquotas.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.cloudquotas.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/cloudquotas/v1/resources.proto";
22import "google/api/field_behavior.proto";
23import "google/api/resource.proto";
24import "google/protobuf/field_mask.proto";
25
26option csharp_namespace = "Google.Cloud.CloudQuotas.V1";
27option go_package = "cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb;cloudquotaspb";
28option java_multiple_files = true;
29option java_outer_classname = "CloudquotasProto";
30option java_package = "com.google.api.cloudquotas.v1";
31option php_namespace = "Google\\Cloud\\CloudQuotas\\V1";
32option ruby_package = "Google::Cloud::CloudQuotas::V1";
33option (google.api.resource_definition) = {
34  type: "cloudquotas.googleapis.com/Service"
35  pattern: "projects/{project}/locations/{location}/services/{service}"
36  pattern: "folders/{folder}/locations/{location}/services/{service}"
37  pattern: "organizations/{organization}/locations/{location}/services/{service}"
38};
39option (google.api.resource_definition) = {
40  type: "cloudquotas.googleapis.com/Location"
41  pattern: "projects/{project}/locations/{location}"
42  pattern: "folders/{folder}/locations/{location}"
43  pattern: "organizations/{organization}/locations/{location}"
44};
45
46// The Cloud Quotas API is an infrastructure service for Google Cloud that lets
47// service consumers list and manage their resource usage limits.
48//
49// - List/Get the metadata and current status of the quotas for a service.
50// - Create/Update quota preferencess that declare the preferred quota values.
51// - Check the status of a quota preference request.
52// - List/Get pending and historical quota preference.
53service CloudQuotas {
54  option (google.api.default_host) = "cloudquotas.googleapis.com";
55  option (google.api.oauth_scopes) =
56      "https://www.googleapis.com/auth/cloud-platform";
57
58  // Lists QuotaInfos of all quotas for a given project, folder or organization.
59  rpc ListQuotaInfos(ListQuotaInfosRequest) returns (ListQuotaInfosResponse) {
60    option (google.api.http) = {
61      get: "/v1/{parent=projects/*/locations/*/services/*}/quotaInfos"
62      additional_bindings {
63        get: "/v1/{parent=organizations/*/locations/*/services/*}/quotaInfos"
64      }
65      additional_bindings {
66        get: "/v1/{parent=folders/*/locations/*/services/*}/quotaInfos"
67      }
68    };
69    option (google.api.method_signature) = "parent";
70  }
71
72  // Retrieve the QuotaInfo of a quota for a project, folder or organization.
73  rpc GetQuotaInfo(GetQuotaInfoRequest) returns (QuotaInfo) {
74    option (google.api.http) = {
75      get: "/v1/{name=projects/*/locations/*/services/*/quotaInfos/*}"
76      additional_bindings {
77        get: "/v1/{name=organizations/*/locations/*/services/*/quotaInfos/*}"
78      }
79      additional_bindings {
80        get: "/v1/{name=folders/*/locations/*/services/*/quotaInfos/*}"
81      }
82    };
83    option (google.api.method_signature) = "name";
84  }
85
86  // Lists QuotaPreferences in a given project, folder or organization.
87  rpc ListQuotaPreferences(ListQuotaPreferencesRequest)
88      returns (ListQuotaPreferencesResponse) {
89    option (google.api.http) = {
90      get: "/v1/{parent=projects/*/locations/*}/quotaPreferences"
91      additional_bindings {
92        get: "/v1/{parent=folders/*/locations/*}/quotaPreferences"
93      }
94      additional_bindings {
95        get: "/v1/{parent=organizations/*/locations/*}/quotaPreferences"
96      }
97    };
98    option (google.api.method_signature) = "parent";
99  }
100
101  // Gets details of a single QuotaPreference.
102  rpc GetQuotaPreference(GetQuotaPreferenceRequest) returns (QuotaPreference) {
103    option (google.api.http) = {
104      get: "/v1/{name=projects/*/locations/*/quotaPreferences/*}"
105      additional_bindings {
106        get: "/v1/{name=organizations/*/locations/*/quotaPreferences/*}"
107      }
108      additional_bindings {
109        get: "/v1/{name=folders/*/locations/*/quotaPreferences/*}"
110      }
111    };
112    option (google.api.method_signature) = "name";
113  }
114
115  // Creates a new QuotaPreference that declares the desired value for a quota.
116  rpc CreateQuotaPreference(CreateQuotaPreferenceRequest)
117      returns (QuotaPreference) {
118    option (google.api.http) = {
119      post: "/v1/{parent=projects/*/locations/*}/quotaPreferences"
120      body: "quota_preference"
121      additional_bindings {
122        post: "/v1/{parent=folders/*/locations/*}/quotaPreferences"
123        body: "quota_preference"
124      }
125      additional_bindings {
126        post: "/v1/{parent=organizations/*/locations/*}/quotaPreferences"
127        body: "quota_preference"
128      }
129    };
130    option (google.api.method_signature) =
131        "parent,quota_preference,quota_preference_id";
132    option (google.api.method_signature) = "parent,quota_preference";
133  }
134
135  // Updates the parameters of a single QuotaPreference. It can updates the
136  // config in any states, not just the ones pending approval.
137  rpc UpdateQuotaPreference(UpdateQuotaPreferenceRequest)
138      returns (QuotaPreference) {
139    option (google.api.http) = {
140      patch: "/v1/{quota_preference.name=projects/*/locations/*/quotaPreferences/*}"
141      body: "quota_preference"
142      additional_bindings {
143        patch: "/v1/{quota_preference.name=folders/*/locations/*/quotaPreferences/*}"
144        body: "quota_preference"
145      }
146      additional_bindings {
147        patch: "/v1/{quota_preference.name=organizations/*/locations/*/quotaPreferences/*}"
148        body: "quota_preference"
149      }
150    };
151    option (google.api.method_signature) = "quota_preference,update_mask";
152  }
153}
154
155// Message for requesting list of QuotaInfos
156message ListQuotaInfosRequest {
157  // Required. Parent value of QuotaInfo resources.
158  // Listing across different resource containers (such as 'projects/-') is not
159  // allowed.
160  //
161  // Example names:
162  // `projects/123/locations/global/services/compute.googleapis.com`
163  // `folders/234/locations/global/services/compute.googleapis.com`
164  // `organizations/345/locations/global/services/compute.googleapis.com`
165  string parent = 1 [
166    (google.api.field_behavior) = REQUIRED,
167    (google.api.resource_reference) = {
168      child_type: "cloudquotas.googleapis.com/QuotaInfo"
169    }
170  ];
171
172  // Optional. Requested page size. Server may return fewer items than
173  // requested. If unspecified, server will pick an appropriate default.
174  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
175
176  // Optional. A token identifying a page of results the server should return.
177  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
178}
179
180// Message for response to listing QuotaInfos
181message ListQuotaInfosResponse {
182  // The list of QuotaInfo
183  repeated QuotaInfo quota_infos = 1;
184
185  // A token, which can be sent as `page_token` to retrieve the next page.
186  // If this field is omitted, there are no subsequent pages.
187  string next_page_token = 2;
188}
189
190// Message for getting a QuotaInfo
191message GetQuotaInfoRequest {
192  // Required. The resource name of the quota info.
193  //
194  // An example name:
195  // `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion`
196  string name = 1 [
197    (google.api.field_behavior) = REQUIRED,
198    (google.api.resource_reference) = {
199      type: "cloudquotas.googleapis.com/QuotaInfo"
200    }
201  ];
202}
203
204// Message for requesting list of QuotaPreferences
205message ListQuotaPreferencesRequest {
206  // Required. Parent value of QuotaPreference resources.
207  // Listing across different resource containers (such as 'projects/-') is not
208  // allowed.
209  //
210  // When the value starts with 'folders' or 'organizations', it lists the
211  // QuotaPreferences for org quotas in the container. It does not list the
212  // QuotaPreferences in the descendant projects of the container.
213  //
214  // Example parents:
215  // `projects/123/locations/global`
216  string parent = 1 [
217    (google.api.field_behavior) = REQUIRED,
218    (google.api.resource_reference) = {
219      child_type: "cloudquotas.googleapis.com/QuotaPreference"
220    }
221  ];
222
223  // Optional. Requested page size. Server may return fewer items than
224  // requested. If unspecified, server will pick an appropriate default.
225  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
226
227  // Optional. A token identifying a page of results the server should return.
228  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
229
230  // Optional. Filter result QuotaPreferences by their state, type,
231  // create/update time range.
232  //
233  // Example filters:
234  // `reconciling=true AND request_type=CLOUD_CONSOLE`,
235  // `reconciling=true OR creation_time>2022-12-03T10:30:00`
236  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
237
238  // Optional. How to order of the results. By default, the results are ordered
239  // by create time.
240  //
241  // Example orders:
242  // `quota_id`,
243  // `service, create_time`
244  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
245}
246
247// Message for response to listing QuotaPreferences
248message ListQuotaPreferencesResponse {
249  // The list of QuotaPreference
250  repeated QuotaPreference quota_preferences = 1;
251
252  // A token, which can be sent as `page_token` to retrieve the next page.
253  // If this field is omitted, there are no subsequent pages.
254  string next_page_token = 2;
255
256  // Locations that could not be reached.
257  repeated string unreachable = 3;
258}
259
260// Message for getting a QuotaPreference
261message GetQuotaPreferenceRequest {
262  // Required. Name of the resource
263  //
264  // Example name:
265  // `projects/123/locations/global/quota_preferences/my-config-for-us-east1`
266  string name = 1 [
267    (google.api.field_behavior) = REQUIRED,
268    (google.api.resource_reference) = {
269      type: "cloudquotas.googleapis.com/QuotaPreference"
270    }
271  ];
272}
273
274// Message for creating a QuotaPreference
275message CreateQuotaPreferenceRequest {
276  // Required. Value for parent.
277  //
278  // Example:
279  // `projects/123/locations/global`
280  string parent = 1 [
281    (google.api.field_behavior) = REQUIRED,
282    (google.api.resource_reference) = {
283      child_type: "cloudquotas.googleapis.com/QuotaPreference"
284    }
285  ];
286
287  // Optional. Id of the requesting object, must be unique under its parent.
288  // If client does not set this field, the service will generate one.
289  string quota_preference_id = 2 [(google.api.field_behavior) = OPTIONAL];
290
291  // Required. The resource being created
292  QuotaPreference quota_preference = 3 [(google.api.field_behavior) = REQUIRED];
293
294  // The list of quota safety checks to be ignored.
295  repeated QuotaSafetyCheck ignore_safety_checks = 4;
296}
297
298// Message for updating a QuotaPreference
299message UpdateQuotaPreferenceRequest {
300  // Optional. Field mask is used to specify the fields to be overwritten in the
301  // QuotaPreference resource by the update.
302  // The fields specified in the update_mask are relative to the resource, not
303  // the full request. A field will be overwritten if it is in the mask. If the
304  // user does not provide a mask then all fields will be overwritten.
305  google.protobuf.FieldMask update_mask = 1
306      [(google.api.field_behavior) = OPTIONAL];
307
308  // Required. The resource being updated
309  QuotaPreference quota_preference = 2 [(google.api.field_behavior) = REQUIRED];
310
311  // Optional. If set to true, and the quota preference is not found, a new one
312  // will be created. In this situation, `update_mask` is ignored.
313  bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
314
315  // Optional. If set to true, validate the request, but do not actually update.
316  // Note that a request being valid does not mean that the request is
317  // guaranteed to be fulfilled.
318  bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
319
320  // The list of quota safety checks to be ignored.
321  repeated QuotaSafetyCheck ignore_safety_checks = 5;
322}
323