Pobierz bieżący limit przydziału (limit usługi) i użycie zasobu. Możesz użyć odpowiedzi z operacji GET, aby przesłać żądanie aktualizacji przydziału.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}?api-version=2020-10-25
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
location
|
path |
True
|
string
|
Region świadczenia usługi Azure.
|
providerId
|
path |
True
|
string
|
Identyfikator dostawcy zasobów platformy Azure.
|
resourceName
|
path |
True
|
string
|
Nazwa zasobu dostawcy zasobów, taka jak nazwa jednostki SKU Microsoft.Compute, Sku lub TotalLowPriorityCores dla microsoft.MachineLearningServices
|
subscriptionId
|
path |
True
|
string
|
Identyfikator subskrypcji platformy Azure.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API.
|
Odpowiedzi
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nazwa |
Opis |
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
Quotas_Request_ForCompute
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits/standardNDSFamily?api-version=2020-10-25
/** Samples for Quota Get. */
public final class Main {
/*
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
*/
/**
* Sample code: Quotas_Request_ForCompute.
*
* @param manager Entry point to ReservationsManager.
*/
public static void quotasRequestForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) {
manager
.quotas()
.getWithResponse(
"00000000-0000-0000-0000-000000000000",
"Microsoft.Compute",
"eastus",
"standardNDSFamily",
com.azure.core.util.Context.NONE);
}
}
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 get_compute_one_sku_usages.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.get(
subscription_id="00000000-0000-0000-0000-000000000000",
provider_id="Microsoft.Compute",
location="eastus",
resource_name="standardNDSFamily",
)
print(response)
# x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.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/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/getComputeOneSkuUsages.json
func ExampleQuotaClient_Get() {
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)
}
res, err := clientFactory.NewQuotaClient().Get(ctx, "00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", "standardNDSFamily", nil)
if err != nil {
log.Fatalf("failed to finish the request: %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{
// Properties: &armreservations.QuotaProperties{
// Name: &armreservations.ResourceName{
// LocalizedValue: to.Ptr("Standard NDS Family vCPUs"),
// Value: to.Ptr("standardNDSFamily"),
// },
// CurrentValue: to.Ptr[int32](0),
// Limit: to.Ptr[int32](10),
// 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 Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
*
* @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request.
* x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
*/
async function quotasRequestForCompute() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const providerId = "Microsoft.Compute";
const location = "eastus";
const resourceName = "standardNDSFamily";
const credential = new DefaultAzureCredential();
const client = new AzureReservationAPI(credential);
const result = await client.quota.get(subscriptionId, providerId, location, resourceName);
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;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json
// this example is just showing the usage of "Quota_Get" 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 SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// get the collection of this ReservationQuotaResource
string providerId = "Microsoft.Compute";
AzureLocation location = new AzureLocation("eastus");
ReservationQuotaCollection collection = subscriptionResource.GetAllReservationQuota(providerId, location);
// invoke the operation
string resourceName = "standardNDSFamily";
NullableResponse<ReservationQuotaResource> response = await collection.GetIfExistsAsync(resourceName);
ReservationQuotaResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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/00000000-0000-0000-0000-000000000000/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/eastus/serviceLimits/standardNDSFamily",
"name": "standardNDSFamily",
"type": "Microsoft.Capacity/ServiceLimits",
"properties": {
"limit": 10,
"unit": "Count",
"currentValue": 0,
"name": {
"value": "standardNDSFamily",
"localizedValue": "Standard NDS Family vCPUs"
}
}
}
Definicje
CurrentQuotaLimitBase
Właściwości limitu przydziału.
Nazwa |
Typ |
Opis |
id
|
string
|
Identyfikator żądania przydziału.
|
name
|
string
|
Nazwa żądania przydziału.
|
properties
|
QuotaProperties
|
Właściwości limitu przydziału zasobu.
|
type
|
string
|
Typ zasobu. "Microsoft.Capacity/ServiceLimits"
|
ExceptionResponse
Błąd interfejsu API.
Nazwa |
Typ |
Opis |
error
|
ServiceError
|
Szczegóły błędu interfejsu API.
|
QuotaProperties
Właściwości limitu przydziału zasobu.
Nazwa |
Typ |
Opis |
currentValue
|
integer
|
Bieżąca wartość użycia zasobu.
|
limit
|
integer
|
Właściwości limitu przydziału.
|
name
|
ResourceName
|
Nazwa zasobu podanego przez dostawcę zasobów. Użyj tej właściwości dla operacji zasobów quotaRequests.
|
properties
|
object
|
Dodatkowe właściwości określonego dostawcy zasobów.
|
quotaPeriod
|
string
|
Okres, w którym podsumowano wartości użycia przydziału. Na przykład P1D (na jeden dzień), PT1M (na minutę) i PT1S (na jedną sekundę). Ten parametr jest opcjonalny, ponieważ w przypadku niektórych zasobów, takich jak obliczenia, okres jest nieistotny.
|
resourceType
|
ResourceType
|
Nazwa typu zasobu.
|
unit
|
string
|
Jednostki limitu, takie jak liczba i bajty. Użyj pola jednostki podanego w odpowiedzi operacji przydziału GET.
|
ResourceName
Nazwa zasobu podana przez dostawcę zasobów. Użyj tej właściwości dla parametru quotaRequest.
Nazwa |
Typ |
Opis |
localizedValue
|
string
|
Nazwa wyświetlana zasobu jest zlokalizowana.
|
value
|
string
|
Nazwa zasobu.
|
ResourceType
Nazwa typu zasobu.
Nazwa |
Typ |
Opis |
dedicated
|
string
|
|
lowPriority
|
string
|
|
serviceSpecific
|
string
|
|
shared
|
string
|
|
standard
|
string
|
|
ServiceError
Szczegóły błędu interfejsu API.
Nazwa |
Typ |
Opis |
code
|
string
|
Kod błędu.
|
details
|
ServiceErrorDetail[]
|
Lista szczegółów błędu.
|
message
|
string
|
Tekst komunikatu o błędzie.
|
ServiceErrorDetail
Szczegóły błędu.
Nazwa |
Typ |
Opis |
code
|
string
|
Kod błędu.
|
message
|
string
|
Komunikat o błędzie.
|