### Install Google Cloud Quotas library Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Use Composer to add the library to your project dependencies. ```bash composer require google/cloud-quotas ``` -------------------------------- ### Install Google Cloud Quotas via Composer Source: https://github.com/googleapis/google-cloud-php-quotas/blob/main/README.md Use this command to add the library as a dependency to your PHP project. ```shell $ composer require google/cloud-quotas ``` -------------------------------- ### List All Quota Preferences for a Project Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Lists all quota preferences for a project, returning a paginated list. You can optionally set the page size. This example iterates through the preferences, printing details and counting pending and granted ones. ```php setParent($formattedParent) ->setPageSize(100); // Optional: set page size try { /** @var PagedListResponse $response */ $response = $cloudQuotasClient->listQuotaPreferences($request); $pendingCount = 0; $grantedCount = 0; /** @var QuotaPreference $preference */ foreach ($response as $preference) { printf("Preference: %s\n", $preference->getName()); printf(" Service: %s\n", $preference->getService()); printf(" Quota ID: %s\n", $preference->getQuotaId()); if ($preference->hasQuotaConfig()) { $config = $preference->getQuotaConfig(); printf(" Preferred: %d\n", $config->getPreferredValue()); if ($config->hasGrantedValue()) { printf(" Granted: %d\n", $config->getGrantedValueUnwrapped()); $grantedCount++; } } if ($preference->getReconciling()) { printf(" Status: PENDING APPROVAL\n"); $pendingCount++; } else { printf(" Status: Applied\n"); } printf("---\n"); } printf("\nSummary: %d pending, %d granted\n", $pendingCount, $grantedCount); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } // List quota preferences for an organization $orgParent = CloudQuotasClient::organizationLocationName('123456789', 'global'); $orgRequest = (new ListQuotaPreferencesRequest())->setParent($orgParent); $orgResponse = $cloudQuotasClient->listQuotaPreferences($orgRequest); ``` -------------------------------- ### GET /v1/quotaPreferences Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Lists all quota preferences for a project, folder, or organization. Returns a paginated list of quota preference configurations. ```APIDOC ## GET /v1/quotaPreferences ### Description Lists all quota preferences for a project, folder, or organization. Returns a paginated list of quota preference configurations. ### Method GET ### Endpoint /v1/quotaPreferences ### Parameters #### Query Parameters - **parent** (string) - Required - The parent resource name. Format: `organizations/{organizationId}/locations/{locationId}` or `folders/{folderId}/locations/{locationId}` or `projects/{projectId}/locations/{locationId}`. - **page_size** (integer) - Optional - The maximum number of quota preferences to return. Defaults to 100. - **page_token** (string) - Optional - A page token received from a previous `ListQuotaPreferences` call. ### Request Example ```php // Example for listing quota preferences for a project $formattedParent = CloudQuotasClient::locationName('my-project-123', 'global'); $request = (new ListQuotaPreferencesRequest()) ->setParent($formattedParent) ->setPageSize(100); // Optional: set page size // Example for listing quota preferences for an organization $orgParent = CloudQuotasClient::organizationLocationName('123456789', 'global'); $orgRequest = (new ListQuotaPreferencesRequest())->setParent($orgParent); ``` ### Response #### Success Response (200) - **quota_preferences** (array) - A list of QuotaPreference resources. - **name** (string) - The resource name of the quota preference. - **service** (string) - The service associated with the quota preference. - **quota_id** (string) - The ID of the quota. - **justification** (string) - The justification for the quota preference. - **reconciling** (boolean) - Whether the quota preference is pending approval. - **etag** (string) - The ETag of the quota preference. - **create_time** (Timestamp) - The creation time of the quota preference. - **quota_config** (QuotaConfig) - The quota configuration details. - **preferred_value** (integer) - The preferred value for the quota. - **granted_value** (integer) - The granted value for the quota. - **state_detail** (string) - Details about the current state of the quota. - **dimensions** (map) - A map of dimension names to their values. - **next_page_token** (string) - A token to retrieve the next page of results. #### Response Example ```json { "quotaPreferences": [ { "name": "projects/my-project-123/locations/global/quotaPreferences/cpu-quota", "service": "compute.googleapis.com", "quotaId": "CPUS", "justification": "Need more CPU", "reconciling": false, "etag": "etag1", "createTime": "2023-10-26T10:00:00Z", "quotaConfig": { "preferredValue": 100, "grantedValue": 100, "stateDetail": "Applied" }, "dimensions": { "region": "us-central1" } }, { "name": "projects/my-project-123/locations/global/quotaPreferences/gpu-quota", "service": "compute.googleapis.com", "quotaId": "GPUS", "justification": "Need more GPU for ML", "reconciling": true, "etag": "etag2", "createTime": "2023-10-27T11:00:00Z", "quotaConfig": { "preferredValue": 10, "stateDetail": "Pending approval" }, "dimensions": { "region": "us-east1" } } ], "nextPageToken": "next-page-token-value" } ``` ``` -------------------------------- ### GET /projects/{project}/locations/global/services/{service}/quotaInfos/{quota_info} Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Retrieves detailed information about a specific quota, including current limits, eligibility for increases, and refresh intervals. ```APIDOC ## GET /projects/{project}/locations/global/services/{service}/quotaInfos/{quota_info} ### Description Retrieves detailed information about a specific quota for a project, folder, or organization. Returns quota metadata including current limits, eligibility for increases, dimensions, and refresh intervals. ### Method GET ### Endpoint projects/{project}/locations/global/services/{service}/quotaInfos/{quota_info} ### Parameters #### Path Parameters - **name** (string) - Required - The resource name of the quota info, formatted as projects/{project}/locations/global/services/{service}/quotaInfos/{quota_info} ### Response #### Success Response (200) - **QuotaInfo** (object) - The quota information object containing quotaId, service, metric, quotaDisplayName, metricUnit, isFixed, isPrecise, refreshInterval, and quotaIncreaseEligibility. ``` -------------------------------- ### GET /v1/quotaPreferences/{name} Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Retrieves details of a single quota preference, including its current state and whether it's pending approval. ```APIDOC ## GET /v1/quotaPreferences/{name} ### Description Gets details of a single quota preference, including its current state and whether it's pending approval. ### Method GET ### Endpoint /v1/quotaPreferences/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the quota preference to retrieve. Format: `organizations/{organizationId}/locations/{locationId}/quotaPreferences/{quotaPreferenceId}` or `folders/{folderId}/locations/{locationId}/quotaPreferences/{quotaPreferenceId}` or `projects/{projectId}/locations/{locationId}/quotaPreferences/{quotaPreferenceId}`. ### Request Example ```php // Example for constructing the request name $formattedName = CloudQuotasClient::quotaPreferenceName( 'my-project-123', 'global', 'my-cpu-quota-preference' ); $request = (new GetQuotaPreferenceRequest()) ->setName($formattedName); ``` ### Response #### Success Response (200) - **name** (string) - The resource name of the quota preference. - **service** (string) - The service associated with the quota preference. - **quota_id** (string) - The ID of the quota. - **justification** (string) - The justification for the quota preference. - **reconciling** (boolean) - Whether the quota preference is pending approval. - **etag** (string) - The ETag of the quota preference. - **create_time** (Timestamp) - The creation time of the quota preference. - **quota_config** (QuotaConfig) - The quota configuration details. - **preferred_value** (integer) - The preferred value for the quota. - **granted_value** (integer) - The granted value for the quota. - **state_detail** (string) - Details about the current state of the quota. - **dimensions** (map) - A map of dimension names to their values. #### Response Example ```json { "name": "projects/my-project-123/locations/global/quotaPreferences/my-cpu-quota-preference", "service": "compute.googleapis.com", "quotaId": "CPUS", "justification": "Need more CPU for development", "reconciling": true, "etag": "some-etag-value", "createTime": "2023-10-27T10:00:00Z", "quotaConfig": { "preferredValue": 100, "grantedValue": 50, "stateDetail": "Pending approval" }, "dimensions": { "region": "us-central1" } } ``` ``` -------------------------------- ### Retrieve Quota Preference Details Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Gets details of a single quota preference, including its current state and whether it's pending approval. Ensure the CloudQuotasClient is initialized and the quota preference name is correctly formatted. ```php setName($formattedName); try { /** @var QuotaPreference $response */ $response = $cloudQuotasClient->getQuotaPreference($request); printf("Quota Preference: %s\n", $response->getName()); printf("Service: %s\n", $response->getService()); printf("Quota ID: %s\n", $response->getQuotaId()); printf("Justification: %s\n", $response->getJustification()); printf("Reconciling (pending): %s\n", $response->getReconciling() ? 'Yes' : 'No'); printf("ETag: %s\n", $response->getEtag()); if ($response->hasCreateTime()) { printf("Created: %s\n", $response->getCreateTime()->toDateTime()->format('Y-m-d H:i:s')); } if ($response->hasQuotaConfig()) { $config = $response->getQuotaConfig(); printf("Preferred Value: %d\n", $config->getPreferredValue()); if ($config->hasGrantedValue()) { printf("Granted Value: %d\n", $config->getGrantedValueUnwrapped()); } printf("State Detail: %s\n", $config->getStateDetail()); } // Check dimensions foreach ($response->getDimensions() as $key => $value) { printf("Dimension %s: %s\n", $key, $value); } } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } ``` -------------------------------- ### Retrieve Quota Information Source: https://github.com/googleapis/google-cloud-php-quotas/blob/main/README.md Demonstrates initializing the client and fetching quota details using a request object. Ensure $formattedName is defined before execution. ```php use Google\ApiCore\ApiException; use Google\Cloud\CloudQuotas\V1\Client\CloudQuotasClient; use Google\Cloud\CloudQuotas\V1\GetQuotaInfoRequest; use Google\Cloud\CloudQuotas\V1\QuotaInfo; // Create a client. $cloudQuotasClient = new CloudQuotasClient(); // Prepare the request message. $request = (new GetQuotaInfoRequest()) ->setName($formattedName); // Call the API and handle any network failures. try { /** @var QuotaInfo $response */ $response = $cloudQuotasClient->getQuotaInfo($request); printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } ``` -------------------------------- ### Format Resource Names with CloudQuotasClient Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Use static helper methods to format project, organization, and folder-level resource names. These methods ensure correct naming conventions for services, quota information, and quota preferences. ```php 'my-project', 'location' => 'global', 'service' => 'compute.googleapis.com', 'quota_info' => 'CpusPerProjectPerRegion'] ``` -------------------------------- ### Initialize CloudQuotasClient Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt The CloudQuotasClient is the primary interface for API interactions. It supports default credentials, custom configuration, and explicit service account credentials. ```php '/path/to/service-account.json', 'transport' => 'grpc', // or 'rest' ]); // Create a client with explicit credentials use Google\Auth\Credentials\ServiceAccountCredentials; $scopes = ['https://www.googleapis.com/auth/cloud-platform']; $creds = new ServiceAccountCredentials($scopes, '/path/to/service-account.json'); $cloudQuotasClient = new CloudQuotasClient(['credentials' => $creds]); ``` -------------------------------- ### List Quota Infos Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Lists all quota information for a given service within a project, folder, or organization. Returns a paginated list of QuotaInfo objects. ```APIDOC ## GET /v1/cloudquotas/{parent=projects/*/locations/*/services/*}/quotaInfos ### Description Lists all quota information for a given service within a project, folder, or organization. Returns a paginated list of QuotaInfo objects. ### Method GET ### Endpoint /v1/cloudquotas/{parent=projects/*/locations/*/services/*}/quotaInfos ### Parameters #### Path Parameters - **parent** (string) - Required - The name of the service to list quota information for. Format: `projects/{project}/locations/{location}/services/{service}` or `folders/{folder}/locations/{location}/services/{service}` or `organizations/{organization}/locations/{location}/services/{service}`. #### Query Parameters - **page_size** (integer) - Optional - The maximum number of quota information to return. The service may return fewer than this value. - **page_token** (string) - Optional - A page token received from a previous `ListQuotaInfos` call. Provide this to retrieve the subsequent page. ### Response #### Success Response (200) - **quota_infos** (array) - A list of QuotaInfo objects. - **next_page_token** (string) - Token to retrieve the next page of results, or empty if there are no more pages. #### Response Example ```json { "quota_infos": [ { "quota_id": "CpusPerProjectPerRegion", "quota_display_name": "CPUs per project per region", "metric": "compute.googleapis.com/cpus", "is_fixed": false } ], "next_page_token": "" } ``` ``` -------------------------------- ### List Quota Information for a Service Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Lists all quota information for a given service within a project, folder, or organization. Returns a paginated list of QuotaInfo objects. Use this to understand available quotas and their current settings. ```php setParent($formattedParent) ->setPageSize(50); // Optional: limit results per page try { /** @var PagedListResponse $response */ $response = $cloudQuotasClient->listQuotaInfos($request); /** @var QuotaInfo $quotaInfo */ foreach ($response as $quotaInfo) { printf("Quota ID: %s\n", $quotaInfo->getQuotaId()); printf(" Display Name: %s\n", $quotaInfo->getQuotaDisplayName()); printf(" Metric: %s\n", $quotaInfo->getMetric()); printf(" Is Adjustable: %s\n", !$quotaInfo->getIsFixed() ? 'Yes' : 'No'); printf("---\n"); } // Alternative: iterate page by page foreach ($response->getPage()->getIterator() as $quotaInfo) { printf("Quota: %s\n", $quotaInfo->getQuotaId()); } } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } // List quotas for an organization $orgParent = CloudQuotasClient::organizationLocationServiceName( '123456789', // organization ID 'global', 'compute.googleapis.com' ); $orgRequest = (new ListQuotaInfosRequest())->setParent($orgParent); $orgResponse = $cloudQuotasClient->listQuotaInfos($orgRequest); // List quotas for a folder $folderParent = CloudQuotasClient::folderLocationServiceName( '987654321', // folder ID 'global', 'compute.googleapis.com' ); $folderRequest = (new ListQuotaInfosRequest())->setParent($folderParent); $folderResponse = $cloudQuotasClient->listQuotaInfos($folderRequest); ``` -------------------------------- ### Create Quota Preference Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Creates a new quota preference that declares the desired value for a quota. Use this to request quota increases or set preferred quota values. ```APIDOC ## POST /v1/cloudquotas/{parent=projects/*/locations/*}/quotaPreferences ### Description Creates a new quota preference that declares the desired value for a quota. Use this to request quota increases or set preferred quota values. ### Method POST ### Endpoint /v1/cloudquotas/{parent=projects/*/locations/*}/quotaPreferences ### Parameters #### Path Parameters - **parent** (string) - Required - The resource name of the location to create the quota preference in. Format: `projects/{project}/locations/{location}` or `folders/{folder}/locations/{location}` or `organizations/{organization}/locations/{location}`. #### Request Body - **quota_preference** (object) - Required - The quota preference to create. - **service** (string) - Required - The name of the service to which the quota belongs. Example: `compute.googleapis.com`. - **quota_id** (string) - Required - The ID of the quota to which the preference applies. Example: `CpusPerProjectPerRegion`. - **quota_config** (object) - Required - The configuration of the quota preference. - **preferred_value** (integer) - Required - The preferred value for the quota. Use -1 for unlimited. - **trace_id** (string) - Optional - Trace ID used for support inquiries. - **dimensions** (object) - Optional - The dimensions of the quota. Example: `{"region": "us-east1"}`. - **justification** (string) - Required - Justification for the quota increase or preference. - **contact_email** (string) - Required - Email address of the contact person for the quota request. - **quota_preference_id** (string) - Optional - The ID to use for the quota preference. If not specified, a server-generated ID will be used. ### Request Example ```json { "quota_preference": { "service": "compute.googleapis.com", "quota_id": "CpusPerProjectPerRegion", "quota_config": { "preferred_value": 100 }, "dimensions": { "region": "us-east1" }, "justification": "Need additional CPUs for production workload scaling", "contact_email": "admin@example.com" }, "quota_preference_id": "my-cpu-quota-preference" } ``` ### Response #### Success Response (200) - **name** (string) - The resource name of the quota preference. - **service** (string) - The name of the service. - **quota_id** (string) - The ID of the quota. - **quota_config** (object) - The configuration of the quota preference. - **preferred_value** (integer) - The preferred value for the quota. - **trace_id** (string) - Trace ID used for support inquiries. - **reconciling** (boolean) - Whether the quota preference is being reconciled. #### Response Example ```json { "name": "projects/my-project-123/locations/global/quotaPreferences/my-cpu-quota-preference", "service": "compute.googleapis.com", "quota_id": "CpusPerProjectPerRegion", "quota_config": { "preferred_value": 100, "trace_id": "" }, "reconciling": true } ``` ``` -------------------------------- ### Retrieve Quota Information Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Fetch metadata for a specific quota, including limits and eligibility for increases. Requires a properly formatted resource name. ```php setName($formattedName); try { /** @var QuotaInfo $response */ $response = $cloudQuotasClient->getQuotaInfo($request); // Access quota information printf("Quota ID: %s\n", $response->getQuotaId()); printf("Service: %s\n", $response->getService()); printf("Metric: %s\n", $response->getMetric()); printf("Display Name: %s\n", $response->getQuotaDisplayName()); printf("Metric Unit: %s\n", $response->getMetricUnit()); printf("Is Fixed: %s\n", $response->getIsFixed() ? 'Yes' : 'No'); printf("Is Precise: %s\n", $response->getIsPrecise() ? 'Yes' : 'No'); printf("Refresh Interval: %s\n", $response->getRefreshInterval()); // Check eligibility for quota increase if ($response->hasQuotaIncreaseEligibility()) { $eligibility = $response->getQuotaIncreaseEligibility(); printf("Eligible for increase: %s\n", $eligibility->getIsEligible() ? 'Yes' : 'No'); } // Get full JSON response printf("Full response: %s\n", $response->serializeToJsonString()); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } ``` -------------------------------- ### Perform Async Operations with CloudQuotasClient Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Utilize asynchronous methods for non-blocking API calls using Promises. This allows for concurrent operations and efficient handling of multiple requests. ```php setName(CloudQuotasClient::quotaInfoName('my-project', 'global', 'compute.googleapis.com', 'CpusPerProjectPerRegion')); $promise = $cloudQuotasClient->getQuotaInfoAsync($request); // Do other work while request is in flight... // Wait for result $response = $promise->wait(); printf("Quota ID: %s\n", $response->getQuotaId()); // Multiple concurrent async calls $computeRequest = (new ListQuotaInfosRequest()) ->setParent(CloudQuotasClient::serviceName('my-project', 'global', 'compute.googleapis.com')); $storageRequest = (new ListQuotaInfosRequest()) ->setParent(CloudQuotasClient::serviceName('my-project', 'global', 'storage.googleapis.com')); $promises = [ 'compute' => $cloudQuotasClient->listQuotaInfosAsync($computeRequest), 'storage' => $cloudQuotasClient->listQuotaInfosAsync($storageRequest), ]; // Wait for all promises to resolve $results = Utils::unwrap($promises); foreach ($results['compute'] as $quotaInfo) { printf("Compute quota: %s\n", $quotaInfo->getQuotaId()); } foreach ($results['storage'] as $quotaInfo) { printf("Storage quota: %s\n", $quotaInfo->getQuotaId()); } ``` -------------------------------- ### Update Quota Preference using CloudQuotasClient Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Use this snippet to update an existing quota preference. You can specify which fields to update using an `UpdateMask`. Ensure you have the CloudQuotasClient and necessary classes imported. Handle `ApiException` for potential errors. ```php setPreferredValue(200); // Update to request 200 units // Build the quota preference with updated values $quotaPreference = (new QuotaPreference()) ->setName('projects/my-project-123/locations/global/quotaPreferences/my-cpu-quota-preference') ->setQuotaConfig($quotaConfig) ->setService('compute.googleapis.com') ->setQuotaId('CpusPerProjectPerRegion') ->setJustification('Updated: Need 200 CPUs for expanded production workload') ->setContactEmail('admin@example.com'); // Optional: use update mask to specify which fields to update $updateMask = (new FieldMask()) ->setPaths(['quota_config.preferred_value', 'justification']); $request = (new UpdateQuotaPreferenceRequest()) ->setQuotaPreference($quotaPreference) ->setUpdateMask($updateMask); // Optional: limits which fields are updated // Optional: use etag for optimistic concurrency control // $request->setAllowMissing(false); try { /** @var QuotaPreference $response */ $response = $cloudQuotasClient->updateQuotaPreference($request); printf("Updated quota preference: %s\n", $response->getName()); printf("New preferred value: %d\n", $response->getQuotaConfig()->getPreferredValue()); printf("Updated justification: %s\n", $response->getJustification()); printf("Reconciling: %s\n", $response->getReconciling() ? 'Yes' : 'No'); if ($response->hasUpdateTime()) { printf("Updated at: %s\n", $response->getUpdateTime()->toDateTime()->format('Y-m-d H:i:s')); } } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } ``` -------------------------------- ### Request a Quota Increase Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt Creates a new quota preference to declare a desired value for a quota, effectively requesting an increase or setting a preferred value. Requires a justification and contact email for quota increases. Dimensions can be specified for region-specific quotas. ```php setPreferredValue(100); // Request 100 units (use -1 for unlimited) // Create the quota preference $quotaPreference = (new QuotaPreference()) ->setQuotaConfig($quotaConfig) ->setService('compute.googleapis.com') ->setQuotaId('CpusPerProjectPerRegion') ->setJustification('Need additional CPUs for production workload scaling') ->setContactEmail('admin@example.com'); // Required for quota increases // Optional: specify dimensions for region-specific quotas $quotaPreference->setDimensions(['region' => 'us-east1']); $request = (new CreateQuotaPreferenceRequest()) ->setParent($formattedParent) ->setQuotaPreference($quotaPreference) ->setQuotaPreferenceId('my-cpu-quota-preference'); // Optional custom ID try { /** @var QuotaPreference $response */ $response = $cloudQuotasClient->createQuotaPreference($request); printf("Created quota preference: %s\n", $response->getName()); printf("Service: %s\n", $response->getService()); printf("Quota ID: %s\n", $response->getQuotaId()); printf("Reconciling: %s\n", $response->getReconciling() ? 'Yes (pending approval)' : 'No'); if ($response->hasQuotaConfig()) { $config = $response->getQuotaConfig(); printf("Preferred Value: %d\n", $config->getPreferredValue()); printf("Trace ID: %s\n", $config->getTraceId()); // Use for support inquiries } printf("Full response: %s\n", $response->serializeToJsonString()); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } ``` -------------------------------- ### Update Quota Preference Source: https://context7.com/googleapis/google-cloud-php-quotas/llms.txt This snippet demonstrates how to update an existing quota preference. You can specify which fields to update using an `updateMask` and optionally use an `etag` for optimistic concurrency control. ```APIDOC ## POST /v1/quotaPreferences/{name} ### Description Updates the parameters of an existing quota preference. This operation can update the configuration in any state, not just pending approval. ### Method POST ### Endpoint /v1/quotaPreferences/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the quota preference to update. Format: `projects/{project_id}/locations/{location}/quotaPreferences/{quota_preference_id}`. #### Query Parameters None #### Request Body - **quotaPreference** (QuotaPreference) - Required - The quota preference object with updated values. - **name** (string) - Required - The resource name of the quota preference. - **service** (string) - Required - The name of the service this quota belongs to. - **quotaId** (string) - Required - The ID of the quota. - **quotaConfig** (QuotaConfig) - Optional - The quota configuration. - **preferredValue** (integer) - Optional - The preferred value for the quota. - **justification** (string) - Optional - The justification for the quota update. - **contactEmail** (string) - Optional - The email address of the contact person for this quota. - **updateMask** (FieldMask) - Optional - A field mask to specify which fields to update. If not set, all mutable fields will be updated. - **paths** (array of strings) - Optional - The paths to the fields to be updated. ### Request Example ```json { "quotaPreference": { "name": "projects/my-project-123/locations/global/quotaPreferences/my-cpu-quota-preference", "quotaConfig": { "preferredValue": 200 }, "service": "compute.googleapis.com", "quotaId": "CpusPerProjectPerRegion", "justification": "Updated: Need 200 CPUs for expanded production workload", "contactEmail": "admin@example.com" }, "updateMask": { "paths": [ "quota_config.preferred_value", "justification" ] } } ``` ### Response #### Success Response (200) - **name** (string) - The resource name of the quota preference. - **preferredValue** (integer) - The preferred value for the quota. - **justification** (string) - The justification for the quota update. - **reconciling** (boolean) - Whether the quota preference is currently reconciling. - **updateTime** (Timestamp) - The timestamp when the quota preference was last updated. #### Response Example ```json { "name": "projects/my-project-123/locations/global/quotaPreferences/my-cpu-quota-preference", "preferredValue": 200, "justification": "Updated: Need 200 CPUs for expanded production workload", "reconciling": false, "updateTime": "2023-10-27T10:00:00Z" } ``` ### Error Handling - **ApiException**: Thrown if the API call fails. The message will contain details about the error. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.