Обновите квоту (ограничения службы) этого ресурса до запрошенного значения.
• Чтобы получить сведения о квоте для определенного ресурса, отправьте запрос GET.
• Чтобы увеличить квоту, измените поле ограничения из ответа GET на новое значение.
• Чтобы обновить значение квоты, отправьте ответ JSON в API запроса квоты, чтобы обновить квоту.
• Обновление квоты. используйте операцию PATCH.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}?api-version=2020-10-25
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
location
|
path |
True
|
string
|
Регион Azure.
|
providerId
|
path |
True
|
string
|
Идентификатор поставщика ресурсов Azure.
|
resourceName
|
path |
True
|
string
|
Имя ресурса для поставщика ресурсов, например имя SKU для Microsoft.Compute, SKU или TotalLowPriorityCores для Microsoft.MachineLearningServices.
|
subscriptionId
|
path |
True
|
string
|
Идентификатор подписки Azure.
|
api-version
|
query |
True
|
string
|
Версия API.
|
Текст запроса
Ответы
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Quotas_Request_PatchForCompute
Sample Request
PATCH https://management.azure.com/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits/standardFSv2Family?api-version=2020-10-25
{
"properties": {
"limit": 200,
"unit": "Count",
"name": {
"value": "standardFSv2Family"
}
}
}
import com.azure.resourcemanager.reservations.models.CurrentQuotaLimitBase;
import com.azure.resourcemanager.reservations.models.QuotaProperties;
import com.azure.resourcemanager.reservations.models.ResourceName;
/** Samples for Quota Update. */
public final class Main {
/*
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
*/
/**
* Sample code: Quotas_Request_PatchForCompute.
*
* @param manager Entry point to ReservationsManager.
*/
public static void quotasRequestPatchForCompute(
com.azure.resourcemanager.reservations.ReservationsManager manager) {
CurrentQuotaLimitBase resource =
manager
.quotas()
.getWithResponse(
"D7EC67B3-7657-4966-BFFC-41EFD36BAAB3",
"Microsoft.Compute",
"eastus",
"standardFSv2Family",
com.azure.core.util.Context.NONE)
.getValue();
resource
.update()
.withProperties(
new QuotaProperties()
.withLimit(200)
.withUnit("Count")
.withName(new ResourceName().withValue("standardFSv2Family")))
.apply();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.reservations import AzureReservationAPI
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-reservations
# USAGE
python patch_compute_quota_request.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AzureReservationAPI(
credential=DefaultAzureCredential(),
)
response = client.quota.begin_update(
subscription_id="D7EC67B3-7657-4966-BFFC-41EFD36BAAB3",
provider_id="Microsoft.Compute",
location="eastus",
resource_name="standardFSv2Family",
create_quota_request={"properties": {"limit": 200, "name": {"value": "standardFSv2Family"}, "unit": "Count"}},
).result()
print(response)
# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armreservations_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
func ExampleQuotaClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armreservations.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewQuotaClient().BeginUpdate(ctx, "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.Compute", "eastus", "standardFSv2Family", armreservations.CurrentQuotaLimitBase{
Properties: &armreservations.QuotaProperties{
Name: &armreservations.ResourceName{
Value: to.Ptr("standardFSv2Family"),
},
Limit: to.Ptr[int32](200),
Unit: to.Ptr("Count"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.CurrentQuotaLimitBase = armreservations.CurrentQuotaLimitBase{
// Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"),
// Type: to.Ptr("Microsoft.Capacity/serviceLimits"),
// ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimitsRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"),
// Properties: &armreservations.QuotaProperties{
// Name: &armreservations.ResourceName{
// LocalizedValue: to.Ptr("Standard FSv2 Family vCPUs"),
// Value: to.Ptr("standardFSv2Family"),
// },
// CurrentValue: to.Ptr[int32](160),
// Limit: to.Ptr[int32](200),
// Properties: map[string]any{
// },
// QuotaPeriod: to.Ptr(""),
// Unit: to.Ptr("Count"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureReservationAPI } = require("@azure/arm-reservations");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Update the quota (service limits) of this resource to the requested value.
• To get the quota information for specific resource, send a GET request.
• To increase the quota, update the limit field from the GET response to a new value.
• To update the quota value, submit the JSON response to the quota request API to update the quota.
• To update the quota. use the PATCH operation.
*
* @summary Update the quota (service limits) of this resource to the requested value.
• To get the quota information for specific resource, send a GET request.
• To increase the quota, update the limit field from the GET response to a new value.
• To update the quota value, submit the JSON response to the quota request API to update the quota.
• To update the quota. use the PATCH operation.
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
*/
async function quotasRequestPatchForCompute() {
const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
const providerId = "Microsoft.Compute";
const location = "eastus";
const resourceName = "standardFSv2Family";
const createQuotaRequest = {
properties: {
name: { value: "standardFSv2Family" },
limit: 200,
unit: "Count",
},
};
const credential = new DefaultAzureCredential();
const client = new AzureReservationAPI(credential);
const result = await client.quota.beginUpdateAndWait(
subscriptionId,
providerId,
location,
resourceName,
createQuotaRequest
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Reservations;
using Azure.ResourceManager.Reservations.Models;
// Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json
// this example is just showing the usage of "Quota_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ReservationQuotaResource created on azure
// for more information of creating ReservationQuotaResource, please refer to the document of ReservationQuotaResource
string subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3";
string providerId = "Microsoft.Compute";
AzureLocation location = new AzureLocation("eastus");
string resourceName = "standardFSv2Family";
ResourceIdentifier reservationQuotaResourceId = ReservationQuotaResource.CreateResourceIdentifier(subscriptionId, providerId, location, resourceName);
ReservationQuotaResource reservationQuota = client.GetReservationQuotaResource(reservationQuotaResourceId);
// invoke the operation
ReservationQuotaData data = new ReservationQuotaData()
{
Properties = new QuotaProperties()
{
Limit = 200,
Unit = "Count",
ResourceName = new ReservationResourceName()
{
Value = "standardFSv2Family",
},
},
};
ArmOperation<ReservationQuotaResource> lro = await reservationQuota.UpdateAsync(WaitUntil.Completed, data);
ReservationQuotaResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ReservationQuotaData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimitsRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605",
"name": "2B5C8515-37D8-4B6A-879B-CD641A2CF605",
"type": "Microsoft.Capacity/ServiceLimits",
"properties": {
"provisioningState": "InProgress",
"message": ""
}
}
{
"id": "/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimitsRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605",
"name": "2B5C8515-37D8-4B6A-879B-CD641A2CF605",
"type": "Microsoft.Capacity/serviceLimits",
"properties": {
"limit": 200,
"unit": "Count",
"currentValue": 160,
"name": {
"value": "standardFSv2Family",
"localizedValue": "Standard FSv2 Family vCPUs"
},
"quotaPeriod": "",
"properties": {}
}
}
Определения
CurrentQuotaLimitBase
Свойства квоты.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор запроса квоты.
|
name
|
string
|
Имя запроса квоты.
|
properties
|
QuotaProperties
|
Свойства квоты для ресурса.
|
type
|
string
|
Тип ресурса. "Microsoft.Capacity/ServiceLimits"
|
ExceptionResponse
Ошибка API.
QuotaProperties
Свойства квоты для ресурса.
Имя |
Тип |
Описание |
currentValue
|
integer
|
Текущее значение использования ресурса.
|
limit
|
integer
|
Свойства квоты.
|
name
|
ResourceName
|
Имя ресурса, предоставленного поставщиком ресурсов. Используйте это свойство для операций с ресурсами quotaRequests.
|
properties
|
object
|
Дополнительные свойства для указанного поставщика ресурсов.
|
quotaPeriod
|
string
|
Период времени, за который суммируются значения использования квоты. Например, P1D (за один день), PT1M (за одну минуту) и PT1S (в секунду). Этот параметр является необязательным, так как для некоторых ресурсов, таких как вычисления, период времени не имеет значения.
|
resourceType
|
ResourceType
|
Имя типа ресурса.
|
unit
|
string
|
Единицы ограничения, такие как число и байты. Используйте поле единицы измерения, предоставленное в ответе на операцию получения квоты.
|
QuotaRequestState
Состояние запроса квоты.
Имя |
Тип |
Описание |
Accepted
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Invalid
|
string
|
|
Succeeded
|
string
|
|
QuotaRequestSubmitResponse201
Ответ с идентификатором запроса о том, что запрос квоты был принят.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор запроса квоты. Используйте параметр requestId, чтобы проверка состояние запроса.
|
name
|
string
|
Operation ID
|
properties.message
|
string
|
Понятное сообщение.
|
properties.provisioningState
|
QuotaRequestState
|
Сведения о состоянии запроса квоты.
|
type
|
string
|
Тип ресурса
|
ResourceName
Имя ресурса, предоставленное поставщиком ресурсов. Используйте это свойство для параметра quotaRequest.
Имя |
Тип |
Описание |
localizedValue
|
string
|
Отображение локализованного имени ресурса.
|
value
|
string
|
Имя ресурса.
|
ResourceType
Имя типа ресурса.
Имя |
Тип |
Описание |
dedicated
|
string
|
|
lowPriority
|
string
|
|
serviceSpecific
|
string
|
|
shared
|
string
|
|
standard
|
string
|
|
ServiceError
Сведения об ошибке API.
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки.
|
details
|
ServiceErrorDetail[]
|
Список сведений об ошибках.
|
message
|
string
|
Текст сообщения об ошибке.
|
ServiceErrorDetail
Сведения об ошибке.
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки.
|
message
|
string
|
Сообщение об ошибке.
|