diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/back-compatible.tsp b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/back-compatible.tsp new file mode 100644 index 000000000000..10049221f300 --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/back-compatible.tsp @@ -0,0 +1,11 @@ +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Microsoft.Commerce; + +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@@Legacy.flattenProperty(UsageAggregation.properties); + +@@clientLocation(UsageAggregatesOperationGroup.list, "UsageAggregates"); + +@@clientLocation(RateCardOperationGroup.get, "RateCard"); diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/client.tsp b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/client.tsp new file mode 100644 index 000000000000..dcc506c0e169 --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/client.tsp @@ -0,0 +1,7 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Microsoft.Commerce; + +@@clientName(Microsoft.Commerce, "UsageManagementClient", "python, javascript"); diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetRateCard.json b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetRateCard.json new file mode 100644 index 000000000000..5741330362fe --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetRateCard.json @@ -0,0 +1,35 @@ +{ + "parameters": { + "$filter": "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'", + "api-version": "2015-06-01-preview", + "subscriptionId": "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27" + }, + "title": "GetRateCard", + "responses": { + "200": { + "body": { + "Meters": [ + { + "EffectiveDate": "2017-09-01T00:00:00Z", + "IncludedQuantity": 0, + "MeterCategory": "Test Category", + "MeterId": "1d7518e5-bc2f-4a93-9057-1b3047856645", + "MeterName": "Test Meter", + "MeterRates": { + "0": 1.99, + "100": 0.99 + }, + "MeterRegion": "US West", + "MeterSubCategory": "Test Subcategory", + "MeterTags": [ + "Third Party" + ], + "Unit": "Hours" + } + ], + "OfferTerms": [] + } + } + }, + "operationId": "RateCard_Get" +} diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetUsageAggregatesList.json b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetUsageAggregatesList.json new file mode 100644 index 000000000000..76de35281fca --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/examples/2015-06-01-preview/GetUsageAggregatesList.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "aggregationGranularity": "Daily", + "api-version": "2015-06-01-preview", + "reportedEndTime": "2015-06-01T00:00:00+00:00", + "reportedStartTime": "2014-05-01T00:00:00+00:00", + "showDetails": "true", + "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b" + }, + "title": "GetUsageAggregatesList", + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Daily_BRSDT_20140501_0000", + "type": "Microsoft.Commerce/UsageAggregate", + "id": "/subscriptions/f68815e6-3c41-45ef-bbd8-5f83303c396b/providers/Microsoft.Commerce/UsageAggregates/Daily_BRSDT_20140501_0000", + "properties": { + "infoFields": {}, + "meterCategory": "Storage", + "meterId": "0e9d0c9b-ab6d-4312-9c7e-3794e22af9c4", + "meterName": "Standard IO – Page Blob/Disk (GB)", + "meterSubCategory": "Geo Redundant", + "quantity": 0.057865, + "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b", + "unit": "GB", + "usageEndTime": "2015-03-04T00:00:00+00:00", + "usageStartTime": "2015-03-03T00:00:00+00:00" + } + } + ] + } + }, + "202": { + "body": { + "error": { + "code": "aaaaaaaaaaaaaaaaaaaaaa", + "message": "aaaaaaaaaaaaaaaaaaaa" + } + } + } + }, + "operationId": "UsageAggregates_List" +} diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/main.tsp b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/main.tsp new file mode 100644 index 000000000000..90e36b6fe221 --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/main.tsp @@ -0,0 +1,41 @@ +/** + * PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS + * Generated by package: @autorest/openapi-to-typespec + * Parameters used: + * isFullCompatible: true + * guessResourceKey: false + * Version: 0.11.12 + * Date: 2025-12-12T02:06:35.769Z + */ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "./models.tsp"; +import "./back-compatible.tsp"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager.Foundations; +using Azure.Core; +using Azure.ResourceManager; +using TypeSpec.Versioning; + +#suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +@armProviderNamespace +@service(#{ title: "UsageManagementClient" }) +@versioned(Versions) +// FIXME: Common type version not set. Set to v3. +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) +namespace Microsoft.Commerce; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2015-06-01-preview API version. + */ + v2015_06_01_preview: "2015-06-01-preview", +} diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/models.tsp b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/models.tsp new file mode 100644 index 000000000000..ababf7878004 --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/models.tsp @@ -0,0 +1,385 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; + +namespace Microsoft.Commerce; + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum AggregationGranularity { + /** + * Daily + */ + Daily, + + /** + * Hourly + */ + Hourly, +} + +/** + * Name of the offer term + */ +#suppress "@azure-tools/typespec-azure-core/no-enum" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +enum OfferTermInfoName { + /** + * Recurring Charge + */ + RecurringCharge: "Recurring Charge", + + /** + * Monetary Commitment + */ + MonetaryCommitment: "Monetary Commitment", + + /** + * Monetary Credit + */ + MonetaryCredit: "Monetary Credit", +} + +/** + * Describes the usageAggregation. + */ +model UsageAggregation { + /** + * Unique Id for the usage aggregate. + */ + id?: string; + + /** + * Name of the usage aggregate. + */ + name?: string; + + /** + * Type of the resource being returned. + */ + type?: string; + + /** + * Usage data. + */ + properties?: UsageSample; +} + +/** + * Describes a sample of the usageAggregation. + */ +model UsageSample { + /** + * The subscription identifier for the Azure user. + */ + subscriptionId?: Azure.Core.uuid; + + /** + * Unique ID for the resource that was consumed (aka ResourceID). + */ + meterId?: string; + + /** + * UTC start time for the usage bucket to which this usage aggregate belongs. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + usageStartTime?: utcDateTime; + + /** + * UTC end time for the usage bucket to which this usage aggregate belongs. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + usageEndTime?: utcDateTime; + + /** + * The amount of the resource consumption that occurred in this time frame. + */ + quantity?: float32; + + /** + * The unit in which the usage for this resource is being counted, e.g. Hours, GB. + */ + unit?: string; + + /** + * Friendly name of the resource being consumed. + */ + meterName?: string; + + /** + * Category of the consumed resource. + */ + meterCategory?: string; + + /** + * Sub-category of the consumed resource. + */ + meterSubCategory?: string; + + /** + * Region of the meterId used for billing purposes + */ + meterRegion?: string; + + /** + * Key-value pairs of instance details (legacy format). + */ + #suppress "@azure-tools/typespec-azure-core/no-unknown" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + infoFields?: unknown; + + /** + * Key-value pairs of instance details represented as a string. + */ + instanceData?: string; +} + +/** + * Describes the format of Error response with a wrapper object + */ +@error +model ErrorObjectResponse { + /** + * Wrapper object for error information + */ + error?: ErrorResponse; +} + +/** + * Describes the format of Error response. + */ +@error +model ErrorResponse { + /** + * Error code + */ + code?: string; + + /** + * Error message indicating why the operation failed. + */ + message?: string; +} + +/** + * Price and Metadata information for resources + */ +model ResourceRateCardInfo { + /** + * The currency in which the rates are provided. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Currency?: string; + + /** + * The culture in which the resource information is localized. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Locale?: string; + + /** + * All rates are pretax, so this will always be returned as 'false'. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + IsTaxIncluded?: boolean; + + /** + * A list of offer terms. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @identifiers(#["Name"]) + OfferTerms?: OfferTermInfo[]; + + /** + * A list of meters. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @identifiers(#["MeterId"]) + Meters?: MeterInfo[]; +} + +/** + * Describes the offer term. + */ +@discriminator("Name") +model OfferTermInfo { + /** + * Name of the offer term + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/no-string-discriminator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Name: OfferTermInfoName; + + /** + * Indicates the date from which the offer term is effective. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + EffectiveDate?: utcDateTime; +} + +/** + * Detailed information about the meter. + */ +model MeterInfo { + /** + * The unique identifier of the resource. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterId?: Azure.Core.uuid; + + /** + * The name of the meter, within the given meter category + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterName?: string; + + /** + * The category of the meter, e.g., 'Cloud services', 'Networking', etc.. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterCategory?: string; + + /** + * The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterSubCategory?: string; + + /** + * The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Unit?: string; + + /** + * Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterTags?: string[]; + + /** + * The region in which the Azure service is available. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterRegion?: string; + + /** + * The list of key/value pairs for the meter rates, in the format 'key':'value' where key = the meter quantity, and value = the corresponding price + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + MeterRates?: Record; + + /** + * Indicates the date from which the meter rate is effective. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + EffectiveDate?: utcDateTime; + + /** + * The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be charged. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + IncludedQuantity?: float32; +} + +/** + * Parameters that are used in the odata $filter query parameter for providing RateCard information. + */ +model RateCardQueryParameters { + /** + * The Offer ID parameter consists of the 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See https://azure.microsoft.com/en-us/support/legal/offer-details/ for more information on the list of available Offer IDs, country/region availability, and billing currency. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @pattern("^MS-AZR-\\d{4}P(-\\d{4}P)*$") + OfferDurableId: string; + + /** + * The currency in which the rates need to be provided. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Currency: string; + + /** + * The culture in which the resource metadata needs to be localized. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Locale: string; + + /** + * 2 letter ISO code where the offer was purchased. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + RegionInfo: string; +} + +/** + * Indicates that this is a monetary credit offer. + */ +model MonetaryCredit extends OfferTermInfo { + /** + * The amount of credit provided under the terms of the given offer level. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/no-generic-numeric" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Credit?: decimal; + + /** + * An array of meter ids that are excluded from the given offer terms. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ExcludedMeterIds?: Azure.Core.uuid[]; + + /** + * Name of the offer term + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Name: OfferTermInfoName.MonetaryCredit; +} + +/** + * Indicates that a monetary commitment is required for this offer + */ +model MonetaryCommitment extends OfferTermInfo { + /** + * The list of key/value pairs for the tiered meter rates, in the format 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by offer terms of type 'Monetary Commitment'. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TieredDiscount?: Record; + + /** + * An array of meter ids that are excluded from the given offer terms. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ExcludedMeterIds?: Azure.Core.uuid[]; + + /** + * Name of the offer term + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Name: OfferTermInfoName.MonetaryCommitment; +} + +/** + * Indicates a recurring charge is present for this offer. + */ +model RecurringCharge extends OfferTermInfo { + /** + * The amount of recurring charge as per the offer term. + */ + #suppress "@azure-tools/typespec-client-generator-core/property-name-conflict" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + RecurringCharge?: int32; + + /** + * Name of the offer term + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Name: OfferTermInfoName.RecurringCharge; +} diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/commerce.json b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/commerce.json index 7080a52dae90..24cda41fbe60 100644 --- a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/commerce.json +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/commerce.json @@ -2,514 +2,602 @@ "swagger": "2.0", "info": { "title": "UsageManagementClient", - "version": "2015-06-01-preview" + "version": "2015-06-01-preview", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] }, - "host": "management.azure.com", "schemes": [ "https" ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], "consumes": [ - "application/json", - "text/json" + "application/json" ], - "produces": [ - "application/json", - "text/json" + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "UsageAggregates" + }, + { + "name": "RateCard" + } ], "paths": { - "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates": { + "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/rateCard": { "get": { + "operationId": "RateCard_Get", "tags": [ - "UsageAggregates" + "RateCard" ], - "operationId": "UsageAggregates_List", - "description": "Query aggregated Azure subscription consumption data for a date range.", + "description": "Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change.", "externalDocs": { - "url": "https://docs.microsoft.com/rest/api/commerce/usageaggregates" + "url": "https://docs.microsoft.com/rest/api/commerce/ratecard" + }, + "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "name": "$filter", + "in": "query", + "description": "The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part of the $filter.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/ResourceRateCardInfo" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } }, "x-ms-examples": { - "GetUsageAggregatesList": { - "$ref": "./examples/GetUsageAggregatesList.json" + "GetRateCard": { + "$ref": "./examples/GetRateCard.json" } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/usageAggregates": { + "get": { + "operationId": "UsageAggregates_List", + "tags": [ + "UsageAggregates" + ], + "description": "Query aggregated Azure subscription consumption data for a date range.", + "externalDocs": { + "url": "https://docs.microsoft.com/rest/api/commerce/usageaggregates" }, "parameters": [ + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, { "name": "reportedStartTime", "in": "query", + "description": "The start of the time range to retrieve data for.", "required": true, "type": "string", - "format": "date-time", - "description": "The start of the time range to retrieve data for." + "format": "date-time" }, { "name": "reportedEndTime", "in": "query", + "description": "The end of the time range to retrieve data for.", "required": true, "type": "string", - "format": "date-time", - "description": "The end of the time range to retrieve data for." + "format": "date-time" }, { "name": "showDetails", "in": "query", + "description": "`True` 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).", "required": false, - "type": "boolean", - "description": "`True` 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)." + "type": "boolean" }, { "name": "aggregationGranularity", "in": "query", + "description": "`Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity.", "required": false, "type": "string", "default": "Daily", - "description": "`Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity.", "enum": [ "Daily", "Hourly" ], "x-ms-enum": { "name": "AggregationGranularity", - "modelAsString": false + "modelAsString": false, + "values": [ + { + "name": "Daily", + "value": "Daily", + "description": "Daily" + }, + { + "name": "Hourly", + "value": "Hourly", + "description": "Hourly" + } + ] } }, { "name": "continuationToken", "in": "query", + "description": "Used 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.", "required": false, - "type": "string", - "description": "Used 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. " - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" + "type": "string" } ], "responses": { "200": { - "description": "Normal response for a successful query. The response body will contain the data that matches the filters specified in the query parameters.", + "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/UsageAggregationListResult" } }, "202": { - "description": "Response indicating that a request has been accepted for processing. However, the processing has not been completed.", + "description": "The request has been accepted for processing, but processing has not yet completed.", "schema": { "$ref": "#/definitions/ErrorObjectResponse" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { - "description": "Error response describing why the operation failed.", + "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/ErrorObjectResponse" } } }, + "x-ms-examples": { + "GetUsageAggregatesList": { + "$ref": "./examples/GetUsageAggregatesList.json" + } + }, "x-ms-pageable": { "nextLinkName": "nextLink" } } - }, - "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard": { - "get": { - "tags": [ - "RateCard" - ], - "operationId": "RateCard_Get", - "description": "Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. ", - "externalDocs": { - "url": "https://docs.microsoft.com/rest/api/commerce/ratecard" - }, - "x-ms-examples": { - "GetRateCard": { - "$ref": "./examples/GetRateCard.json" - } - }, - "parameters": [ - { - "name": "$filter", - "in": "query", - "required": true, - "type": "string", - "description": "The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part of the $filter." - }, + } + }, + "definitions": { + "AggregationGranularity": { + "type": "string", + "enum": [ + "Daily", + "Hourly" + ], + "x-ms-enum": { + "name": "AggregationGranularity", + "modelAsString": false, + "values": [ { - "$ref": "#/parameters/ApiVersionParameter" + "name": "Daily", + "value": "Daily", + "description": "Daily" }, { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "Normal response for a successful query. The response body will contain the data that matches the filters specified in the query parameters.", - "schema": { - "$ref": "#/definitions/ResourceRateCardInfo" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } + "name": "Hourly", + "value": "Hourly", + "description": "Hourly" } - }, - "x-ms-odata": "#/definitions/RateCardQueryParameters" + ] } - } - }, - "definitions": { - "InfoField": { - "description": "Key-value pairs of instance details in the legacy format." }, - "UsageSample": { + "Azure.Core.uuid": { + "type": "string", + "format": "uuid", + "description": "Universally Unique Identifier" + }, + "ErrorObjectResponse": { + "type": "object", + "description": "Describes the format of Error response with a wrapper object", "properties": { - "subscriptionId": { - "type": "string", - "format": "uuid", - "description": "The subscription identifier for the Azure user." - }, - "meterId": { + "error": { + "$ref": "#/definitions/ErrorResponse", + "description": "Wrapper object for error information" + } + } + }, + "ErrorResponse": { + "type": "object", + "description": "Describes the format of Error response.", + "properties": { + "code": { "type": "string", - "description": "Unique ID for the resource that was consumed (aka ResourceID)." + "description": "Error code" }, - "usageStartTime": { + "message": { "type": "string", - "format": "date-time", - "description": "UTC start time for the usage bucket to which this usage aggregate belongs." + "description": "Error message indicating why the operation failed." + } + } + }, + "MeterInfo": { + "type": "object", + "description": "Detailed information about the meter.", + "properties": { + "MeterId": { + "$ref": "#/definitions/Azure.Core.uuid", + "description": "The unique identifier of the resource." }, - "usageEndTime": { + "MeterName": { "type": "string", - "format": "date-time", - "description": "UTC end time for the usage bucket to which this usage aggregate belongs." + "description": "The name of the meter, within the given meter category" }, - "quantity": { - "type": "number", - "format": "float", - "description": "The amount of the resource consumption that occurred in this time frame." - }, - "unit": { + "MeterCategory": { "type": "string", - "description": "The unit in which the usage for this resource is being counted, e.g. Hours, GB." + "description": "The category of the meter, e.g., 'Cloud services', 'Networking', etc.." }, - "meterName": { + "MeterSubCategory": { "type": "string", - "description": "Friendly name of the resource being consumed." + "description": "The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc.." }, - "meterCategory": { + "Unit": { "type": "string", - "description": "Category of the consumed resource." + "description": "The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc." }, - "meterSubCategory": { - "type": "string", - "description": "Sub-category of the consumed resource." + "MeterTags": { + "type": "array", + "description": "Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party.", + "items": { + "type": "string" + } }, - "meterRegion": { + "MeterRegion": { "type": "string", - "description": "Region of the meterId used for billing purposes" + "description": "The region in which the Azure service is available." }, - "infoFields": { - "$ref": "#/definitions/InfoField", - "description": "Key-value pairs of instance details (legacy format)." + "MeterRates": { + "type": "object", + "description": "The list of key/value pairs for the meter rates, in the format 'key':'value' where key = the meter quantity, and value = the corresponding price", + "additionalProperties": { + "format": "float", + "type": "number" + } }, - "instanceData": { + "EffectiveDate": { "type": "string", - "description": "Key-value pairs of instance details represented as a string." + "format": "date-time", + "description": "Indicates the date from which the meter rate is effective." + }, + "IncludedQuantity": { + "type": "number", + "format": "float", + "description": "The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be charged." } - }, - "description": "Describes a sample of the usageAggregation." + } }, - "UsageAggregation": { + "MonetaryCommitment": { + "type": "object", + "description": "Indicates that a monetary commitment is required for this offer", "properties": { - "id": { - "type": "string", - "description": "Unique Id for the usage aggregate." - }, - "name": { - "type": "string", - "description": "Name of the usage aggregate." - }, - "type": { - "type": "string", - "description": "Type of the resource being returned." + "TieredDiscount": { + "type": "object", + "description": "The list of key/value pairs for the tiered meter rates, in the format 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by offer terms of type 'Monetary Commitment'.", + "additionalProperties": { + "format": "decimal", + "type": "number" + } }, - "properties": { - "$ref": "#/definitions/UsageSample", - "x-ms-client-flatten": true, - "description": "Usage data." + "ExcludedMeterIds": { + "type": "array", + "description": "An array of meter ids that are excluded from the given offer terms.", + "items": { + "$ref": "#/definitions/Azure.Core.uuid" + } } }, - "description": "Describes the usageAggregation." + "allOf": [ + { + "$ref": "#/definitions/OfferTermInfo" + } + ], + "x-ms-discriminator-value": "Monetary Commitment" }, - "UsageAggregationListResult": { + "MonetaryCredit": { + "type": "object", + "description": "Indicates that this is a monetary credit offer.", "properties": { - "value": { + "Credit": { + "type": "number", + "format": "decimal", + "description": "The amount of credit provided under the terms of the given offer level." + }, + "ExcludedMeterIds": { "type": "array", + "description": "An array of meter ids that are excluded from the given offer terms.", "items": { - "$ref": "#/definitions/UsageAggregation" - }, - "description": "Gets or sets details for the requested aggregation." + "$ref": "#/definitions/Azure.Core.uuid" + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/OfferTermInfo" + } + ], + "x-ms-discriminator-value": "Monetary Credit" + }, + "OfferTermInfo": { + "type": "object", + "description": "Describes the offer term.", + "properties": { + "Name": { + "$ref": "#/definitions/OfferTermInfoName", + "description": "Name of the offer term" }, - "nextLink": { + "EffectiveDate": { "type": "string", - "description": "Gets or sets the link to the next set of results." + "format": "date-time", + "description": "Indicates the date from which the offer term is effective." } }, - "description": "The Get UsageAggregates operation response." + "discriminator": "Name", + "required": [ + "Name" + ] + }, + "OfferTermInfoName": { + "type": "string", + "description": "Name of the offer term", + "enum": [ + "Recurring Charge", + "Monetary Commitment", + "Monetary Credit" + ], + "x-ms-enum": { + "name": "OfferTermInfoName", + "modelAsString": false, + "values": [ + { + "name": "RecurringCharge", + "value": "Recurring Charge", + "description": "Recurring Charge" + }, + { + "name": "MonetaryCommitment", + "value": "Monetary Commitment", + "description": "Monetary Commitment" + }, + { + "name": "MonetaryCredit", + "value": "Monetary Credit", + "description": "Monetary Credit" + } + ] + } }, "RateCardQueryParameters": { + "type": "object", "description": "Parameters that are used in the odata $filter query parameter for providing RateCard information.", - "required": [ - "OfferDurableId", - "Currency", - "Locale", - "RegionInfo" - ], "properties": { "OfferDurableId": { - "description": "The Offer ID parameter consists of the 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See https://azure.microsoft.com/en-us/support/legal/offer-details/ for more information on the list of available Offer IDs, country/region availability, and billing currency.", "type": "string", + "description": "The Offer ID parameter consists of the 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See https://azure.microsoft.com/en-us/support/legal/offer-details/ for more information on the list of available Offer IDs, country/region availability, and billing currency.", "pattern": "^MS-AZR-\\d{4}P(-\\d{4}P)*$" }, "Currency": { - "description": "The currency in which the rates need to be provided.", - "type": "string" + "type": "string", + "description": "The currency in which the rates need to be provided." }, "Locale": { - "description": "The culture in which the resource metadata needs to be localized.", - "type": "string" + "type": "string", + "description": "The culture in which the resource metadata needs to be localized." }, "RegionInfo": { - "description": "2 letter ISO code where the offer was purchased.", - "type": "string" + "type": "string", + "description": "2 letter ISO code where the offer was purchased." } - } + }, + "required": [ + "OfferDurableId", + "Currency", + "Locale", + "RegionInfo" + ] + }, + "RecurringCharge": { + "type": "object", + "description": "Indicates a recurring charge is present for this offer.", + "properties": { + "RecurringCharge": { + "type": "integer", + "format": "int32", + "description": "The amount of recurring charge as per the offer term." + } + }, + "allOf": [ + { + "$ref": "#/definitions/OfferTermInfo" + } + ], + "x-ms-discriminator-value": "Recurring Charge" }, "ResourceRateCardInfo": { + "type": "object", "description": "Price and Metadata information for resources", "properties": { "Currency": { - "description": "The currency in which the rates are provided.", - "type": "string" + "type": "string", + "description": "The currency in which the rates are provided." }, "Locale": { - "description": "The culture in which the resource information is localized.", - "type": "string" + "type": "string", + "description": "The culture in which the resource information is localized." }, "IsTaxIncluded": { - "description": "All rates are pretax, so this will always be returned as 'false'.", - "type": "boolean" + "type": "boolean", + "description": "All rates are pretax, so this will always be returned as 'false'." }, "OfferTerms": { "type": "array", + "description": "A list of offer terms.", "items": { "$ref": "#/definitions/OfferTermInfo" }, "x-ms-identifiers": [ "Name" - ], - "description": "A list of offer terms." + ] }, "Meters": { "type": "array", + "description": "A list of meters.", "items": { "$ref": "#/definitions/MeterInfo" }, "x-ms-identifiers": [ "MeterId" - ], - "description": "A list of meters." + ] } } }, - "MeterInfo": { - "description": "Detailed information about the meter.", + "UsageAggregation": { + "type": "object", + "description": "Describes the usageAggregation.", "properties": { - "MeterId": { - "description": "The unique identifier of the resource.", + "id": { "type": "string", - "format": "uuid" - }, - "MeterName": { - "description": "The name of the meter, within the given meter category", - "type": "string" - }, - "MeterCategory": { - "description": "The category of the meter, e.g., 'Cloud services', 'Networking', etc..", - "type": "string" - }, - "MeterSubCategory": { - "description": "The subcategory of the meter, e.g., 'A6 Cloud services', 'ExpressRoute (IXP)', etc..", - "type": "string" - }, - "Unit": { - "description": "The unit in which the meter consumption is charged, e.g., 'Hours', 'GB', etc.", - "type": "string" - }, - "MeterTags": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Provides additional meter data. 'Third Party' indicates a meter with no discount. Blanks indicate First Party." - }, - "MeterRegion": { - "description": "The region in which the Azure service is available.", - "type": "string" - }, - "MeterRates": { - "description": "The list of key/value pairs for the meter rates, in the format 'key':'value' where key = the meter quantity, and value = the corresponding price", - "type": "object", - "additionalProperties": { - "type": "number", - "format": "float" - } + "description": "Unique Id for the usage aggregate." }, - "EffectiveDate": { - "description": "Indicates the date from which the meter rate is effective.", + "name": { "type": "string", - "format": "date-time" + "description": "Name of the usage aggregate." }, - "IncludedQuantity": { - "description": "The resource quantity that is included in the offer at no cost. Consumption beyond this quantity will be charged.", - "type": "number", - "format": "float" - } - } - }, - "OfferTermInfo": { - "description": "Describes the offer term.", - "discriminator": "Name", - "required": [ - "Name" - ], - "properties": { - "Name": { - "description": "Name of the offer term", + "type": { "type": "string", - "enum": [ - "Recurring Charge", - "Monetary Commitment", - "Monetary Credit" - ], - "x-ms-enum": { - "name": "OfferTermInfo", - "modelAsString": false - } + "description": "Type of the resource being returned." }, - "EffectiveDate": { - "description": "Indicates the date from which the offer term is effective.", - "type": "string", - "format": "date-time" + "properties": { + "$ref": "#/definitions/UsageSample", + "description": "Usage data.", + "x-ms-client-flatten": true } } }, - "MonetaryCredit": { - "x-ms-discriminator-value": "Monetary Credit", - "description": "Indicates that this is a monetary credit offer.", - "allOf": [ - { - "$ref": "#/definitions/OfferTermInfo" - } - ], + "UsageAggregationListResult": { + "type": "object", + "description": "The response of a UsageAggregation list operation.", "properties": { - "Credit": { - "description": "The amount of credit provided under the terms of the given offer level.", - "type": "number", - "format": "decimal" - }, - "ExcludedMeterIds": { - "description": "An array of meter ids that are excluded from the given offer terms.", + "value": { "type": "array", + "description": "The UsageAggregation items on this page", "items": { - "type": "string", - "format": "uuid" - } - } - } - }, - "MonetaryCommitment": { - "x-ms-discriminator-value": "Monetary Commitment", - "description": "Indicates that a monetary commitment is required for this offer", - "allOf": [ - { - "$ref": "#/definitions/OfferTermInfo" - } - ], - "properties": { - "TieredDiscount": { - "description": "The list of key/value pairs for the tiered meter rates, in the format 'key':'value' where key = price, and value = the corresponding discount percentage. This field is used only by offer terms of type 'Monetary Commitment'.", - "type": "object", - "additionalProperties": { - "type": "number", - "format": "decimal" + "$ref": "#/definitions/UsageAggregation" } }, - "ExcludedMeterIds": { - "description": "An array of meter ids that are excluded from the given offer terms.", - "type": "array", - "items": { - "type": "string", - "format": "uuid" - } - } - } - }, - "RecurringCharge": { - "x-ms-discriminator-value": "Recurring Charge", - "description": "Indicates a recurring charge is present for this offer.", - "allOf": [ - { - "$ref": "#/definitions/OfferTermInfo" - } - ], - "properties": { - "RecurringCharge": { - "description": "The amount of recurring charge as per the offer term.", - "type": "integer" + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" } - } + }, + "required": [ + "value" + ] }, - "ErrorResponse": { - "description": "Describes the format of Error response.", + "UsageSample": { "type": "object", + "description": "Describes a sample of the usageAggregation.", "properties": { - "code": { - "description": "Error code", - "type": "string" + "subscriptionId": { + "$ref": "#/definitions/Azure.Core.uuid", + "description": "The subscription identifier for the Azure user." }, - "message": { - "description": "Error message indicating why the operation failed.", - "type": "string" - } - } - }, - "ErrorObjectResponse": { - "description": "Describes the format of Error response with a wrapper object", - "type": "object", - "properties": { - "error": { - "description": "Wrapper object for error information", - "$ref": "#/definitions/ErrorResponse" + "meterId": { + "type": "string", + "description": "Unique ID for the resource that was consumed (aka ResourceID)." + }, + "usageStartTime": { + "type": "string", + "format": "date-time", + "description": "UTC start time for the usage bucket to which this usage aggregate belongs." + }, + "usageEndTime": { + "type": "string", + "format": "date-time", + "description": "UTC end time for the usage bucket to which this usage aggregate belongs." + }, + "quantity": { + "type": "number", + "format": "float", + "description": "The amount of the resource consumption that occurred in this time frame." + }, + "unit": { + "type": "string", + "description": "The unit in which the usage for this resource is being counted, e.g. Hours, GB." + }, + "meterName": { + "type": "string", + "description": "Friendly name of the resource being consumed." + }, + "meterCategory": { + "type": "string", + "description": "Category of the consumed resource." + }, + "meterSubCategory": { + "type": "string", + "description": "Sub-category of the consumed resource." + }, + "meterRegion": { + "type": "string", + "description": "Region of the meterId used for billing purposes" + }, + "infoFields": { + "description": "Key-value pairs of instance details (legacy format)." + }, + "instanceData": { + "type": "string", + "description": "Key-value pairs of instance details represented as a string." } } } }, - "parameters": { - "SubscriptionIdParameter": { - "name": "subscriptionId", - "in": "path", - "required": true, - "type": "string", - "description": "It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service call." - }, - "ApiVersionParameter": { - "name": "api-version", - "in": "query", - "required": true, - "type": "string", - "description": "Client Api Version." - } - } + "parameters": {} } diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetRateCard.json b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetRateCard.json index f3c546fb603e..5741330362fe 100644 --- a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetRateCard.json +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetRateCard.json @@ -1,14 +1,13 @@ { - "title": "Get RateCard", "parameters": { - "subscriptionId": "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27", + "$filter": "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'", "api-version": "2015-06-01-preview", - "$filter": "OfferDurableId eq 'MS-AZR-0003P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'" + "subscriptionId": "6d61cc05-8f8f-4916-b1b9-f1d9c25aae27" }, + "title": "GetRateCard", "responses": { "200": { "body": { - "OfferTerms": [], "Meters": [ { "EffectiveDate": "2017-09-01T00:00:00Z", @@ -27,8 +26,10 @@ ], "Unit": "Hours" } - ] + ], + "OfferTerms": [] } } - } + }, + "operationId": "RateCard_Get" } diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetUsageAggregatesList.json b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetUsageAggregatesList.json index 3c94bd98b02a..76de35281fca 100644 --- a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetUsageAggregatesList.json +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/preview/2015-06-01-preview/examples/GetUsageAggregatesList.json @@ -1,32 +1,32 @@ { - "title": "Get UsageAggregatesList", "parameters": { - "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b", + "aggregationGranularity": "Daily", "api-version": "2015-06-01-preview", - "reportedStartTime": "2014-05-01T00:00:00+00:00", "reportedEndTime": "2015-06-01T00:00:00+00:00", - "aggregationGranularity": "Daily", - "showDetails": "true" + "reportedStartTime": "2014-05-01T00:00:00+00:00", + "showDetails": "true", + "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b" }, + "title": "GetUsageAggregatesList", "responses": { "200": { "body": { "value": [ { - "id": "/subscriptions/f68815e6-3c41-45ef-bbd8-5f83303c396b/providers/Microsoft.Commerce/UsageAggregates/Daily_BRSDT_20140501_0000", "name": "Daily_BRSDT_20140501_0000", "type": "Microsoft.Commerce/UsageAggregate", + "id": "/subscriptions/f68815e6-3c41-45ef-bbd8-5f83303c396b/providers/Microsoft.Commerce/UsageAggregates/Daily_BRSDT_20140501_0000", "properties": { - "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b", - "usageStartTime": "2015-03-03T00:00:00+00:00", - "usageEndTime": "2015-03-04T00:00:00+00:00", - "meterName": "Standard IO – Page Blob/Disk (GB)", + "infoFields": {}, "meterCategory": "Storage", + "meterId": "0e9d0c9b-ab6d-4312-9c7e-3794e22af9c4", + "meterName": "Standard IO – Page Blob/Disk (GB)", "meterSubCategory": "Geo Redundant", + "quantity": 0.057865, + "subscriptionId": "f68815e6-3c41-45ef-bbd8-5f83303c396b", "unit": "GB", - "meterId": "0e9d0c9b-ab6d-4312-9c7e-3794e22af9c4", - "infoFields": {}, - "quantity": 0.057865 + "usageEndTime": "2015-03-04T00:00:00+00:00", + "usageStartTime": "2015-03-03T00:00:00+00:00" } } ] @@ -40,5 +40,6 @@ } } } - } + }, + "operationId": "UsageAggregates_List" } diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/routes.tsp b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/routes.tsp new file mode 100644 index 000000000000..e674bfc6d0bc --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/routes.tsp @@ -0,0 +1,92 @@ +// FIXME: Operations in this file are not detected as a resource operation, please confirm the conversion result manually + +import "@azure-tools/typespec-azure-core"; +import "@typespec/rest"; +import "./models.tsp"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using TypeSpec.OpenAPI; + +namespace Microsoft.Commerce; + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface UsageAggregatesOperationGroup { + /** + * Query aggregated Azure subscription consumption data for a date range. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @OpenAPI.externalDocs("https://docs.microsoft.com/rest/api/commerce/usageaggregates") + @autoRoute + @get + @list + @tag("UsageAggregates") + @action("UsageAggregates") + list is ArmProviderActionSync< + Response = ResourceListResult | (ArmAcceptedResponse & + ErrorObjectResponse), + Scope = SubscriptionActionScope, + Parameters = { + /** + * The start of the time range to retrieve data for. + */ + @query("reportedStartTime") + reportedStartTime: utcDateTime; + + /** + * The end of the time range to retrieve data for. + */ + @query("reportedEndTime") + reportedEndTime: utcDateTime; + + /** + * `True` 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). + */ + @query("showDetails") + showDetails?: boolean; + + /** + * `Daily` (default) returns the data in daily granularity, `Hourly` returns the data in hourly granularity. + */ + @query("aggregationGranularity") + aggregationGranularity?: AggregationGranularity = AggregationGranularity.Daily; + + /** + * Used 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. + */ + @query("continuationToken") + continuationToken?: string; + }, + Error = ErrorObjectResponse + >; +} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +interface RateCardOperationGroup { + /** + * Enables you to query for the resource/meter metadata and related prices used in a given subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including but not limited to service names, types, resources, units of measure, and regions, is subject to change at any time and without notice. If you intend to use this billing data in an automated fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the change. + */ + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @autoRoute + @get + @tag("RateCard") + @action("RateCard") + @OpenAPI.externalDocs("https://docs.microsoft.com/rest/api/commerce/ratecard") + get is ArmProviderActionSync< + Response = ResourceRateCardInfo, + Scope = SubscriptionActionScope, + Parameters = { + /** + * The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part of the $filter. + */ + @query + $filter: string; + }, + Error = ErrorResponse + >; +} diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/suppressions.yaml b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/suppressions.yaml deleted file mode 100644 index fada9776f3ed..000000000000 --- a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/suppressions.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- tool: TypeSpecRequirement - path: ./preview/2015-06-01-preview/*.json - reason: Brownfield service not ready to migrate diff --git a/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml new file mode 100644 index 000000000000..9d30d1aa62a1 --- /dev/null +++ b/specification/commerce/resource-manager/Microsoft.Commerce/Commerce/tspconfig.yaml @@ -0,0 +1,44 @@ +parameters: + "service-dir": + default: "sdk/commerce" +emit: + - "@azure-tools/typespec-autorest" +options: + "@azure-tools/typespec-autorest": + omit-unreachable-types: false + emitter-output-dir: "{project-root}" + azure-resource-provider-folder: "resource-manager" + output-file: "{version-status}/{version}/commerce.json" + arm-types-dir: "{project-root}/../../../../common-types/resource-management" + emit-lro-options: "all" + examples-dir: "{project-root}/examples" + "@azure-tools/typespec-python": + emitter-output-dir: "{output-dir}/{service-dir}/azure-mgmt-commerce" + namespace: "azure.mgmt.commerce" + generate-test: true + generate-sample: true + flavor: "azure" + "@azure-tools/typespec-java": + emitter-output-dir: "{output-dir}/{service-dir}/azure-resourcemanager-commerce" + namespace: "com.azure.resourcemanager.commerce" + service-name: "Commerce" # human-readable service name, whitespace allowed + flavor: azure + "@azure-tools/typespec-ts": + emitter-output-dir: "{output-dir}/{service-dir}/arm-commerce" + flavor: "azure" + experimental-extensible-enums: true + package-details: + name: "@azure/arm-commerce" + "@azure-tools/typespec-go": + service-dir: "sdk/resourcemanager/commerce" + emitter-output-dir: "{output-dir}/{service-dir}/armcommerce" + module: "github.com/Azure/azure-sdk-for-go/{service-dir}/armcommerce" + fix-const-stuttering: true + flavor: "azure" + generate-samples: true + generate-fakes: true + head-as-boolean: true + inject-spans: true +linter: + extends: + - "@azure-tools/typespec-azure-rulesets/resource-manager"