Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}?api-version=2021-08-01
URI Parameters
Name
In
Required
Type
Description
quotaCounterKey
path
True
string
Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/quotas/ba?api-version=2021-08-01
import com.azure.core.util.Context;
/** Samples for QuotaByCounterKeys ListByService. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json
*/
/**
* Sample code: ApiManagementGetQuotaCounterKeys.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementGetQuotaCounterKeys(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager.quotaByCounterKeys().listByServiceWithResponse("rg1", "apimService1", "ba", Context.NONE);
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
python api_management_get_quota_counter_keys.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 = ApiManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.quota_by_counter_keys.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
quota_counter_key="ba",
)
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json
if __name__ == "__main__":
main()
const { ApiManagementClient } = require("@azure/arm-apimanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet.
*
* @summary Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json
*/
async function apiManagementGetQuotaCounterKeys() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const serviceName = "apimService1";
const quotaCounterKey = "ba";
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.quotaByCounterKeys.listByService(
resourceGroupName,
serviceName,
quotaCounterKey
);
console.log(result);
}
apiManagementGetQuotaCounterKeys().catch(console.error);
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.ApiManagement;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetQuotaCounterKeys.json
// this example is just showing the usage of "QuotaByCounterKeys_ListByService" 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 ApiManagementServiceResource created on azure
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string serviceName = "apimService1";
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
// invoke the operation and iterate over the result
string quotaCounterKey = "ba";
await foreach (QuotaCounterContract item in apiManagementService.GetQuotaByCounterKeysAsync(quotaCounterKey))
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine($"Succeeded");