Skip to main content

usage_aggregates

Creates, updates, deletes, gets or lists a usage_aggregates resource.

Overview

Nameusage_aggregates
TypeResource
Idazure_extras.commerce.usage_aggregates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique Id for the usage aggregate.
namestringName of the usage aggregate.
infoFieldsobjectKey-value pairs of instance details (legacy format).
instanceDatastringKey-value pairs of instance details represented as a string.
meterCategorystringCategory of the consumed resource.
meterIdstringUnique ID for the resource that was consumed (aka ResourceID).
meterNamestringFriendly name of the resource being consumed.
meterRegionstringRegion of the meterId used for billing purposes.
meterSubCategorystringSub-category of the consumed resource.
quantitynumberThe amount of the resource consumption that occurred in this time frame.
subscriptionIdstringThe subscription identifier for the Azure user.
typestringType of the resource being returned.
unitstringThe unit in which the usage for this resource is being counted, e.g. Hours, GB.
usageEndTimestring (date-time)UTC end time for the usage bucket to which this usage aggregate belongs.
usageStartTimestring (date-time)UTC start time for the usage bucket to which this usage aggregate belongs.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectsubscription_id, reportedStartTime, reportedEndTimeshowDetails, aggregationGranularity, continuationTokenQuery aggregated Azure subscription consumption data for a date range. .. seealso:: - https://docs.microsoft.com/rest/api/commerce/usageaggregates

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
reportedEndTimestring (date-time)The end of the time range to retrieve data for. Required.
reportedStartTimestring (date-time)The start of the time range to retrieve data for. Required.
subscription_idstring
aggregationGranularitystringDaily (default) returns the data in daily granularity, Hourly returns the data in hourly granularity. Known values are: "Daily" and "Hourly". Default value is "Daily".
continuationTokenstringUsed when a continuation token string is provided in the response body of the previous call, enabling paging through a large result set. If not present, the data is retrieved from the beginning of the day/hour (based on the granularity) passed in. Default value is None.
showDetailsbooleanTrue returns usage data in instance-level detail, false causes server-side aggregation with fewer details. For example, if you have 3 website instances, by default you will get 3 line items for website consumption. If you specify showDetails = false, the data will be aggregated as a single line item for website consumption within the time period (for the given subscriptionId, meterId, usageStartTime and usageEndTime). Default value is None.

SELECT examples

Query aggregated Azure subscription consumption data for a date range. .. seealso:: - https://docs.microsoft.com/rest/api/commerce/usageaggregates

SELECT
id,
name,
infoFields,
instanceData,
meterCategory,
meterId,
meterName,
meterRegion,
meterSubCategory,
quantity,
subscriptionId,
type,
unit,
usageEndTime,
usageStartTime
FROM azure_extras.commerce.usage_aggregates
WHERE subscription_id = '{{ subscription_id }}' -- required
AND reportedStartTime = '{{ reportedStartTime }}' -- required
AND reportedEndTime = '{{ reportedEndTime }}' -- required
AND showDetails = '{{ showDetails }}'
AND aggregationGranularity = '{{ aggregationGranularity }}'
AND continuationToken = '{{ continuationToken }}'
;