Skip to content

Commit a1bc16e

Browse files
feat: [Quotas] Added support for hierarchical enrollment in Quota Adjuster consumer API (#8362)
* 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 PiperOrigin-RevId: 768053907 Source-Link: googleapis/googleapis@818eab1 Source-Link: googleapis/googleapis-gen@43986b3 Copy-Tag: eyJwIjoiUXVvdGFzLy5Pd2xCb3QueWFtbCIsImgiOiI0Mzk4NmIzNDc4Y2NhODNiMTE2MjljYmM3MDQ1ZjJiN2EwNTg5NGUwIn0= * 🦉 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 c17d2c3 commit a1bc16e

12 files changed

Lines changed: 329 additions & 147 deletions
548 Bytes
Binary file not shown.

Quotas/samples/V1beta/CloudQuotasClient/create_quota_preference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* to -1, it means the value is "unlimited".
4242
* @param string $quotaPreferenceService The name of the service to which the quota preference is applied.
4343
* @param string $quotaPreferenceQuotaId The id of the quota to which the quota preference is applied. A
44-
* quota name is unique in the service. Example: `CpusPerProjectPerRegion`
44+
* quota name is unique in the service. For example, `CpusPerProjectPerRegion`
4545
*/
4646
function create_quota_preference_sample(
4747
string $formattedParent,

Quotas/samples/V1beta/CloudQuotasClient/update_quota_preference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* to -1, it means the value is "unlimited".
3838
* @param string $quotaPreferenceService The name of the service to which the quota preference is applied.
3939
* @param string $quotaPreferenceQuotaId The id of the quota to which the quota preference is applied. A
40-
* quota name is unique in the service. Example: `CpusPerProjectPerRegion`
40+
* quota name is unique in the service. For example, `CpusPerProjectPerRegion`
4141
*/
4242
function update_quota_preference_sample(
4343
int $quotaPreferenceQuotaConfigPreferredValue,

Quotas/samples/V1beta/QuotaAdjusterSettingsManagerClient/update_quota_adjuster_settings.php

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@
2626
use Google\ApiCore\ApiException;
2727
use Google\Cloud\CloudQuotas\V1beta\Client\QuotaAdjusterSettingsManagerClient;
2828
use Google\Cloud\CloudQuotas\V1beta\QuotaAdjusterSettings;
29-
use Google\Cloud\CloudQuotas\V1beta\QuotaAdjusterSettings\Enablement;
3029
use Google\Cloud\CloudQuotas\V1beta\UpdateQuotaAdjusterSettingsRequest;
3130

3231
/**
3332
* RPC Method for updating QuotaAdjusterSettings based on the request
3433
*
35-
* @param int $quotaAdjusterSettingsEnablement The configured value of the enablement at the given resource.
34+
* This sample has been automatically generated and should be regarded as a code
35+
* template only. It will require modifications to work:
36+
* - It may require correct/in-range values for request initialization.
37+
* - It may require specifying regional endpoints when creating the service client,
38+
* please see the apiEndpoint client configuration option for more details.
3639
*/
37-
function update_quota_adjuster_settings_sample(int $quotaAdjusterSettingsEnablement): void
40+
function update_quota_adjuster_settings_sample(): void
3841
{
3942
// Create a client.
4043
$quotaAdjusterSettingsManagerClient = new QuotaAdjusterSettingsManagerClient();
4144

4245
// Prepare the request message.
43-
$quotaAdjusterSettings = (new QuotaAdjusterSettings())
44-
->setEnablement($quotaAdjusterSettingsEnablement);
46+
$quotaAdjusterSettings = new QuotaAdjusterSettings();
4547
$request = (new UpdateQuotaAdjusterSettingsRequest())
4648
->setQuotaAdjusterSettings($quotaAdjusterSettings);
4749

@@ -54,20 +56,4 @@ function update_quota_adjuster_settings_sample(int $quotaAdjusterSettingsEnablem
5456
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
5557
}
5658
}
57-
58-
/**
59-
* Helper to execute the sample.
60-
*
61-
* This sample has been automatically generated and should be regarded as a code
62-
* template only. It will require modifications to work:
63-
* - It may require correct/in-range values for request initialization.
64-
* - It may require specifying regional endpoints when creating the service client,
65-
* please see the apiEndpoint client configuration option for more details.
66-
*/
67-
function callSample(): void
68-
{
69-
$quotaAdjusterSettingsEnablement = Enablement::ENABLEMENT_UNSPECIFIED;
70-
71-
update_quota_adjuster_settings_sample($quotaAdjusterSettingsEnablement);
72-
}
7359
// [END cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_sync]

Quotas/src/V1beta/Client/QuotaAdjusterSettingsManagerClient.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,63 @@ private static function getClientDefaults()
108108
];
109109
}
110110

111+
/**
112+
* Formats a string containing the fully-qualified path to represent a
113+
* folder_location_quotaAdjusterSettings resource.
114+
*
115+
* @param string $folder
116+
* @param string $location
117+
*
118+
* @return string The formatted folder_location_quotaAdjusterSettings resource.
119+
*
120+
* @experimental
121+
*/
122+
public static function folderLocationQuotaAdjusterSettingsName(string $folder, string $location): string
123+
{
124+
return self::getPathTemplate('folderLocationQuotaAdjusterSettings')->render([
125+
'folder' => $folder,
126+
'location' => $location,
127+
]);
128+
}
129+
130+
/**
131+
* Formats a string containing the fully-qualified path to represent a
132+
* organization_location_quotaAdjusterSettings resource.
133+
*
134+
* @param string $organization
135+
* @param string $location
136+
*
137+
* @return string The formatted organization_location_quotaAdjusterSettings resource.
138+
*
139+
* @experimental
140+
*/
141+
public static function organizationLocationQuotaAdjusterSettingsName(string $organization, string $location): string
142+
{
143+
return self::getPathTemplate('organizationLocationQuotaAdjusterSettings')->render([
144+
'organization' => $organization,
145+
'location' => $location,
146+
]);
147+
}
148+
149+
/**
150+
* Formats a string containing the fully-qualified path to represent a
151+
* project_location_quotaAdjusterSettings resource.
152+
*
153+
* @param string $project
154+
* @param string $location
155+
*
156+
* @return string The formatted project_location_quotaAdjusterSettings resource.
157+
*
158+
* @experimental
159+
*/
160+
public static function projectLocationQuotaAdjusterSettingsName(string $project, string $location): string
161+
{
162+
return self::getPathTemplate('projectLocationQuotaAdjusterSettings')->render([
163+
'project' => $project,
164+
'location' => $location,
165+
]);
166+
}
167+
111168
/**
112169
* Formats a string containing the fully-qualified path to represent a
113170
* quota_adjuster_settings resource.
@@ -131,6 +188,9 @@ public static function quotaAdjusterSettingsName(string $project, string $locati
131188
* Parses a formatted name string and returns an associative array of the components in the name.
132189
* The following name formats are supported:
133190
* Template: Pattern
191+
* - folderLocationQuotaAdjusterSettings: folders/{folder}/locations/{location}/quotaAdjusterSettings
192+
* - organizationLocationQuotaAdjusterSettings: organizations/{organization}/locations/{location}/quotaAdjusterSettings
193+
* - projectLocationQuotaAdjusterSettings: projects/{project}/locations/{location}/quotaAdjusterSettings
134194
* - quotaAdjusterSettings: projects/{project}/locations/{location}/quotaAdjusterSettings
135195
*
136196
* The optional $template argument can be supplied to specify a particular pattern,

Quotas/src/V1beta/DimensionsInfo.php

Lines changed: 32 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)