Skip to content

Commit 78428ff

Browse files
feat: Added support for hierarchical enrollment in Quota Adjuster consumer API (googleapis#13979)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 768948627 Source-Link: googleapis/googleapis@cc52046 Source-Link: https://github.com/googleapis/googleapis-gen/commit/51c1e543057f1abb115efcf3cef170f956581e37 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXF1b3Rhcy8uT3dsQm90LnlhbWwiLCJoIjoiNTFjMWU1NDMwNTdmMWFiYjExNWVmY2YzY2VmMTcwZjk1NjU4MWUzNyJ9 BEGIN_COMMIT_OVERRIDE feat: Added support for hierarchical enrollment in Quota Adjuster consumer API docs: Added 2 new fields in `.google.api.cloudquotas.v1beta.QuotaAdjusterSettings` docs: Added inherited and inherited_from in `.google.api.cloudquotas.v1beta.QuotaAdjusterSettings` docs: Added support for folder and organization level enrollment END_COMMIT_OVERRIDE PiperOrigin-RevId: 768053907 Source-Link: googleapis/googleapis@818eab1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/43986b3478cca83b11629cbc7045f2b7a05894e0 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXF1b3Rhcy8uT3dsQm90LnlhbWwiLCJoIjoiNDM5ODZiMzQ3OGNjYTgzYjExNjI5Y2JjNzA0NWYyYjdhMDU4OTRlMCJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 5e57d1c commit 78428ff

File tree

9 files changed

+122
-73
lines changed

9 files changed

+122
-73
lines changed

packages/google-cloud-quotas/google/cloud/cloudquotas_v1beta/services/quota_adjuster_settings_manager/async_client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,7 @@ async def sample_update_quota_adjuster_settings():
347347
client = cloudquotas_v1beta.QuotaAdjusterSettingsManagerAsyncClient()
348348
349349
# Initialize request argument(s)
350-
quota_adjuster_settings = cloudquotas_v1beta.QuotaAdjusterSettings()
351-
quota_adjuster_settings.enablement = "DISABLED"
352-
353350
request = cloudquotas_v1beta.UpdateQuotaAdjusterSettingsRequest(
354-
quota_adjuster_settings=quota_adjuster_settings,
355351
)
356352
357353
# Make the request

packages/google-cloud-quotas/google/cloud/cloudquotas_v1beta/services/quota_adjuster_settings_manager/client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,11 +769,7 @@ def sample_update_quota_adjuster_settings():
769769
client = cloudquotas_v1beta.QuotaAdjusterSettingsManagerClient()
770770
771771
# Initialize request argument(s)
772-
quota_adjuster_settings = cloudquotas_v1beta.QuotaAdjusterSettings()
773-
quota_adjuster_settings.enablement = "DISABLED"
774-
775772
request = cloudquotas_v1beta.UpdateQuotaAdjusterSettingsRequest(
776-
quota_adjuster_settings=quota_adjuster_settings,
777773
)
778774
779775
# Make the request

packages/google-cloud-quotas/google/cloud/cloudquotas_v1beta/services/quota_adjuster_settings_manager/transports/rest_base.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ def _get_http_options():
113113
"method": "get",
114114
"uri": "/v1beta/{name=projects/*/locations/*/quotaAdjusterSettings}",
115115
},
116+
{
117+
"method": "get",
118+
"uri": "/v1beta/{name=folders/*/locations/*/quotaAdjusterSettings}",
119+
},
120+
{
121+
"method": "get",
122+
"uri": "/v1beta/{name=organizations/*/locations/*/quotaAdjusterSettings}",
123+
},
116124
]
117125
return http_options
118126

@@ -163,6 +171,16 @@ def _get_http_options():
163171
"uri": "/v1beta/{quota_adjuster_settings.name=projects/*/locations/*/quotaAdjusterSettings}",
164172
"body": "quota_adjuster_settings",
165173
},
174+
{
175+
"method": "patch",
176+
"uri": "/v1beta/{quota_adjuster_settings.name=folders/*/locations/*/quotaAdjusterSettings}",
177+
"body": "quota_adjuster_settings",
178+
},
179+
{
180+
"method": "patch",
181+
"uri": "/v1beta/{quota_adjuster_settings.name=organizations/*/locations/*/quotaAdjusterSettings}",
182+
"body": "quota_adjuster_settings",
183+
},
166184
]
167185
return http_options
168186

packages/google-cloud-quotas/google/cloud/cloudquotas_v1beta/types/quota_adjuster_settings.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ class QuotaAdjusterSettings(proto.Message):
8686
8787
Attributes:
8888
name (str):
89-
Identifier. Name of the configuration, in the following
90-
format:
91-
``projects/PROJECT_NUMBER/locations/global/quotaAdjusterSettings``.
92-
Replace PROJECT_NUMBER with the project number for your
93-
project.
89+
Identifier. Name of the config would be of the format:
90+
projects/PROJECT_NUMBER/locations/global/quotaAdjusterSettings
91+
folders/FOLDER_NUMBER/locations/global/quotaAdjusterSettings
92+
organizations/ORGANIZATION_NUMBER/locations/global/quotaAdjusterSettings
9493
enablement (google.cloud.cloudquotas_v1beta.types.QuotaAdjusterSettings.Enablement):
95-
Required. The configured value of the
94+
Optional. The configured value of the
9695
enablement at the given resource.
9796
update_time (google.protobuf.timestamp_pb2.Timestamp):
9897
Output only. The timestamp when the
@@ -105,6 +104,17 @@ class QuotaAdjusterSettings(proto.Message):
105104
is blocked and returns an ABORTED error. See
106105
https://google.aip.dev/134#etags for more
107106
details on ETags.
107+
inherited (bool):
108+
Optional. Indicates whether the setting is
109+
inherited or explicitly specified.
110+
inherited_from (str):
111+
Output only. The resource container from which the setting
112+
is inherited. This refers to the nearest ancestor with
113+
enablement set (either ENABLED or DISABLED). The value can
114+
be an organizations/{organization_id}, folders/{folder_id},
115+
or can be 'default' if no ancestor exists with enablement
116+
set. The value will be empty when enablement is directly set
117+
on this container.
108118
"""
109119

110120
class Enablement(proto.Enum):
@@ -140,6 +150,14 @@ class Enablement(proto.Enum):
140150
proto.STRING,
141151
number=6,
142152
)
153+
inherited: bool = proto.Field(
154+
proto.BOOL,
155+
number=7,
156+
)
157+
inherited_from: str = proto.Field(
158+
proto.STRING,
159+
number=8,
160+
)
143161

144162

145163
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-quotas/google/cloud/cloudquotas_v1beta/types/resources.py

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ class QuotaInfo(proto.Message):
6363
Attributes:
6464
name (str):
6565
Resource name of this QuotaInfo. The ID component following
66-
"locations/" must be "global". Example:
66+
"locations/" must be "global". For example,
6767
``projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion``
6868
quota_id (str):
69-
The id of the quota, which is unquie within the service.
70-
Example: ``CpusPerProjectPerRegion``
69+
The id of the quota, which is unquie within the service. For
70+
example, ``CpusPerProjectPerRegion``
7171
metric (str):
7272
The metric of the quota. It specifies the resources
73-
consumption the quota is defined for. Example:
73+
consumption the quota is defined for. For example,
7474
``compute.googleapis.com/cpus``
7575
service (str):
76-
The name of the service in which the quota is defined.
77-
Example: ``compute.googleapis.com``
76+
The name of the service in which the quota is defined. For
77+
example, ``compute.googleapis.com``
7878
is_precise (bool):
7979
Whether this is a precise quota. A precise
8080
quota is tracked with absolute precision. In
@@ -83,8 +83,8 @@ class QuotaInfo(proto.Message):
8383
refresh_interval (str):
8484
The reset time interval for the quota.
8585
Refresh interval applies to rate quota only.
86-
Example: "minute" for per minute, "day" for per
87-
day, or "10 seconds" for every 10 seconds.
86+
For example, "minute" for per minute, "day" for
87+
per day, or "10 seconds" for every 10 seconds.
8888
container_type (google.cloud.cloudquotas_v1beta.types.QuotaInfo.ContainerType):
8989
The container type of the QuotaInfo.
9090
dimensions (MutableSequence[str]):
@@ -263,26 +263,27 @@ class QuotaPreference(proto.Message):
263263
Attributes:
264264
name (str):
265265
Required except in the CREATE requests. The resource name of
266-
the quota preference. The ID component following
267-
"locations/" must be "global". Example:
266+
the quota preference. The path that follows ``/locations``
267+
must be ``/global``. For example:
268268
``projects/123/locations/global/quotaPreferences/my-config-for-us-east1``
269269
dimensions (MutableMapping[str, str]):
270270
Immutable. The dimensions that this quota preference applies
271271
to. The key of the map entry is the name of a dimension,
272-
such as "region", "zone", "network_id", and the value of the
273-
map entry is the dimension value.
272+
such as ``region``, ``zone``, ``network_id``, and the value
273+
of the map entry is the dimension value.
274274
275275
If a dimension is missing from the map of dimensions, the
276276
quota preference applies to all the dimension values except
277277
for those that have other quota preferences configured for
278278
the specific value.
279279
280-
NOTE: QuotaPreferences can only be applied across all values
281-
of "user" and "resource" dimension. Do not set values for
282-
"user" or "resource" in the dimension map.
280+
Note: QuotaPreferences can only be applied across all values
281+
of ``user`` and ``resource`` dimension. Do not set values
282+
for ``user`` or ``resource`` in the dimension map.
283283
284-
Example: {"provider", "Foo Inc"} where "provider" is a
285-
service specific dimension.
284+
For example: ``{"provider" : "Example Organization"}`` where
285+
``provider`` is a service-specific quota dimension and
286+
``Example Organization`` is the provider name.
286287
quota_config (google.cloud.cloudquotas_v1beta.types.QuotaConfig):
287288
Required. Preferred quota configuration.
288289
etag (str):
@@ -302,8 +303,8 @@ class QuotaPreference(proto.Message):
302303
the quota preference is applied.
303304
quota_id (str):
304305
Required. The id of the quota to which the quota preference
305-
is applied. A quota name is unique in the service. Example:
306-
``CpusPerProjectPerRegion``
306+
is applied. A quota name is unique in the service. For
307+
example, ``CpusPerProjectPerRegion``
307308
reconciling (bool):
308309
Output only. Is the quota preference pending
309310
Google Cloud approval and fulfillment.
@@ -312,8 +313,8 @@ class QuotaPreference(proto.Message):
312313
preference.
313314
contact_email (str):
314315
Input only. An email address that can be used to contact the
315-
the user, in case Google Cloud needs more information to
316-
make a decision before additional quota can be granted.
316+
user, in case Google Cloud needs more information to make a
317+
decision before additional quota can be granted.
317318
318319
When requesting a quota increase, the email address is
319320
required. When requesting a quota decrease, the email
@@ -454,25 +455,23 @@ class DimensionsInfo(proto.Message):
454455
455456
Attributes:
456457
dimensions (MutableMapping[str, str]):
457-
The map of dimensions for this dimensions
458-
info. The key of a map entry is "region", "zone"
459-
or the name of a service specific dimension, and
460-
the value of a map entry is the value of the
461-
dimension. If a dimension does not appear in
462-
the map of dimensions, the dimensions info
463-
applies to all the dimension values except for
464-
those that have another DimenisonInfo instance
465-
configured for the specific value.
466-
Example: {"provider" : "Foo Inc"} where
467-
"provider" is a service specific dimension of a
468-
quota.
458+
The map of dimensions in key-value pairs. The key of a map
459+
entry is "region", "zone", or the name of a service-specific
460+
dimension, and the value of a map entry is the value of the
461+
dimension. If a dimension does not appear in the map of
462+
dimensions, the dimensions info applies to all the dimension
463+
values except for those that have another DimensionInfo
464+
instance configured for the specific value. For example:
465+
``{"provider" : "Example Organization"}`` where ``provider``
466+
is a service-specific quota dimension and
467+
``Example Organization`` is the provider name.
469468
details (google.cloud.cloudquotas_v1beta.types.QuotaDetails):
470469
Quota details for the specified dimensions.
471470
applicable_locations (MutableSequence[str]):
472-
The applicable regions or zones of this dimensions info. The
473-
field will be set to ['global'] for quotas that are not per
474-
region or per zone. Otherwise, it will be set to the list of
475-
locations this dimension info is applicable to.
471+
The applicable regions or zones of this dimension. The field
472+
is set to ['global'] for quotas that are not per region or
473+
per zone. Otherwise, it will be set to the list of locations
474+
this dimension info is applicable to.
476475
"""
477476

478477
dimensions: MutableMapping[str, str] = proto.MapField(

packages/google-cloud-quotas/samples/generated_samples/cloudquotas_v1beta_generated_quota_adjuster_settings_manager_update_quota_adjuster_settings_async.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ async def sample_update_quota_adjuster_settings():
3939
client = cloudquotas_v1beta.QuotaAdjusterSettingsManagerAsyncClient()
4040

4141
# Initialize request argument(s)
42-
quota_adjuster_settings = cloudquotas_v1beta.QuotaAdjusterSettings()
43-
quota_adjuster_settings.enablement = "DISABLED"
44-
4542
request = cloudquotas_v1beta.UpdateQuotaAdjusterSettingsRequest(
46-
quota_adjuster_settings=quota_adjuster_settings,
4743
)
4844

4945
# Make the request

packages/google-cloud-quotas/samples/generated_samples/cloudquotas_v1beta_generated_quota_adjuster_settings_manager_update_quota_adjuster_settings_sync.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ def sample_update_quota_adjuster_settings():
3939
client = cloudquotas_v1beta.QuotaAdjusterSettingsManagerClient()
4040

4141
# Initialize request argument(s)
42-
quota_adjuster_settings = cloudquotas_v1beta.QuotaAdjusterSettings()
43-
quota_adjuster_settings.enablement = "DISABLED"
44-
4542
request = cloudquotas_v1beta.UpdateQuotaAdjusterSettingsRequest(
46-
quota_adjuster_settings=quota_adjuster_settings,
4743
)
4844

4945
# Make the request

packages/google-cloud-quotas/samples/generated_samples/snippet_metadata_google.api.cloudquotas.v1beta.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,12 +1215,12 @@
12151215
"regionTag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_async",
12161216
"segments": [
12171217
{
1218-
"end": 54,
1218+
"end": 50,
12191219
"start": 27,
12201220
"type": "FULL"
12211221
},
12221222
{
1223-
"end": 54,
1223+
"end": 50,
12241224
"start": 27,
12251225
"type": "SHORT"
12261226
},
@@ -1230,18 +1230,18 @@
12301230
"type": "CLIENT_INITIALIZATION"
12311231
},
12321232
{
1233-
"end": 48,
1233+
"end": 44,
12341234
"start": 41,
12351235
"type": "REQUEST_INITIALIZATION"
12361236
},
12371237
{
1238-
"end": 51,
1239-
"start": 49,
1238+
"end": 47,
1239+
"start": 45,
12401240
"type": "REQUEST_EXECUTION"
12411241
},
12421242
{
1243-
"end": 55,
1244-
"start": 52,
1243+
"end": 51,
1244+
"start": 48,
12451245
"type": "RESPONSE_HANDLING"
12461246
}
12471247
],
@@ -1299,12 +1299,12 @@
12991299
"regionTag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_sync",
13001300
"segments": [
13011301
{
1302-
"end": 54,
1302+
"end": 50,
13031303
"start": 27,
13041304
"type": "FULL"
13051305
},
13061306
{
1307-
"end": 54,
1307+
"end": 50,
13081308
"start": 27,
13091309
"type": "SHORT"
13101310
},
@@ -1314,18 +1314,18 @@
13141314
"type": "CLIENT_INITIALIZATION"
13151315
},
13161316
{
1317-
"end": 48,
1317+
"end": 44,
13181318
"start": 41,
13191319
"type": "REQUEST_INITIALIZATION"
13201320
},
13211321
{
1322-
"end": 51,
1323-
"start": 49,
1322+
"end": 47,
1323+
"start": 45,
13241324
"type": "REQUEST_EXECUTION"
13251325
},
13261326
{
1327-
"end": 55,
1328-
"start": 52,
1327+
"end": 51,
1328+
"start": 48,
13291329
"type": "RESPONSE_HANDLING"
13301330
}
13311331
],

0 commit comments

Comments
 (0)