Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2376683
Fix for Adding API Version 2022-06-01 for PriceSheets and Operations
prchalla1 Nov 15, 2022
8c8524f
Adding missed resource defination
prchalla1 Nov 15, 2022
910daff
Readme File change
prchalla1 Nov 16, 2022
61f4905
Fixing operations.json and readme file
prchalla1 Nov 16, 2022
18b4b52
Fixing consumption.json
prchalla1 Nov 16, 2022
77065c3
Removing spaces
prchalla1 Nov 16, 2022
85190db
Changes for consomption.json,readme.md
prchalla1 Nov 16, 2022
88ff294
consumption.json,readme.md changes
prchalla1 Nov 16, 2022
d4579a4
consumption.operations.pricesheet.json added
prchalla1 Nov 16, 2022
32032a6
Deleting consumption.json
prchalla1 Nov 16, 2022
c15ac27
Fixing validation errors in stagging swaggerlinter
prchalla1 Nov 17, 2022
d23d77e
Update consumption.operations.pricesheet.json
jayati-tehri Nov 17, 2022
383a345
Update consumption.operations.pricesheet.json
jayati-tehri Nov 17, 2022
82815bb
Update consumption.operations.pricesheet.json
jayati-tehri Nov 17, 2022
160ccbe
Update consumption.operations.pricesheet.json
jayati-tehri Nov 17, 2022
4d25d34
Update consumption.operations.pricesheet.json
jayati-tehri Nov 17, 2022
52757d0
Update OperationList.json
jayati-tehri Nov 17, 2022
8c8d304
Update OperationList.json
jayati-tehri Nov 17, 2022
aef6cf9
Update consumption.operations.pricesheet.json
jayati-tehri Dec 5, 2022
aa96406
Update consumption.operations.pricesheet.json
jayati-tehri Dec 5, 2022
fc6fd4b
Update consumption.operations.pricesheet.json
jayati-tehri Dec 5, 2022
f08b532
Update OperationList.json
jayati-tehri Dec 5, 2022
40df408
Update consumption.operations.pricesheet.json
jayati-tehri Dec 5, 2022
c2867b0
Update OperationList.json
jayati-tehri Dec 9, 2022
3b05b6c
Update consumption.operations.pricesheet.json
jayati-tehri Dec 9, 2022
b88638f
Update consumption.operations.pricesheet.json
jayati-tehri Dec 9, 2022
87473b3
Update consumption.operations.pricesheet.json
jayati-tehri Dec 9, 2022
f5bc5e1
Update consumption.operations.pricesheet.json
jayati-tehri Dec 9, 2022
719f392
Update consumption.operations.pricesheet.json
jayati-tehri Dec 12, 2022
d82db1d
Update consumption.operations.pricesheet.json
jayati-tehri Jan 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,383 @@
{
"swagger": "2.0",
"info": {
"version": "2022-06-01",
"title": "ConsumptionManagementClient",
"description": "Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions."
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow.",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default": {
"get": {
"tags": [
"PriceSheet"
],
"operationId": "PriceSheet_Get",
"description": "List the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/"
},
"x-ms-examples": {
"PriceSheet": {
"$ref": "./examples/PriceSheet.json"
}
},
"parameters": [
{
"name": "$expand",
"description": "May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "$skiptoken",
"description": "Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "$top",
"description": "May be used to limit the number of results to the top N results.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 1000
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/PriceSheetResult"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PriceSheetResult

This is listing API but the response is not in array form? Looks like in your example, the response is in array form

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The response property pricesheets items are array.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. When you implement a LIST api, ARM expects you to return an object with a 'value' property that holds the actual array of resources/objects.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... this isn't actually a LIST api, in the resource sense - in terms of the request path, its just a singleton get, i.e. fetching ONE pricesheet named default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that resource just happens to contain a list....

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unclear why its this way and its not a normal ARM LIST api, actually.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I can take it up with my team to understand more on this, but we cannot change a response model without letting clients know right? They will have dependency on existing model. What do you suggest?
This response model is same for all other versions of this API

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimLovellSmith Can you please help on how should we proceed forward with this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayati-tehri The answers to this depends on how you want to model this API overall :

For example the API
GET /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default

Currently this is modelled as a single point GET of a subscription level pricesheet resource called default. Which means it should return only one resource and should not have nextlink. If you want to model this as a list instead to list all the individual pricesheets in the subscription then the call needs to be like this :

GET /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/

and this returns the list of various pricesheets in the subscription in the array format with next link.

Also there is an issue with how you have created the response for a list operation , the nextlink should not be inside properties , check the output of the operationsList.json where you have modelled this correctly. This is explained in the microsoft REST guidelines here : https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#collections

You should also go over that document in entirety to model these apis correctly.

Please fix these APIs and let us know , if you need any further clarifications , please feel free to send me and the apireviews an email

}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/pricesheets/default": {
"get": {
"tags": [
"PriceSheet"
],
"operationId": "PriceSheet_GetByBillingPeriod",
"description": "Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/"
},
"x-ms-examples": {
"PriceSheetForBillingPeriod": {
"$ref": "./examples/PriceSheetForBillingPeriod.json"
},
"PriceSheetExpand": {
"$ref": "./examples/PriceSheetExpand.json"
}
},
"parameters": [
{
"name": "$expand",
"description": "May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "$skiptoken",
"description": "Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "$top",
"description": "May be used to limit the number of results to the top N results.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 1000
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingPeriodNameParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/PriceSheetResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Consumption/operations": {
"get": {
"tags": [
"Operations"
],
"operationId": "Operations_List",
"description": "Lists all of the available consumption REST API operations.",
"x-ms-examples": {
"OperationList": {
"$ref": "./examples/OperationList.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
}
},
"definitions": {
"PriceSheetResult": {
"description": "An pricesheet resource.",
"type": "object",
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource"
}
],
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/PriceSheetModel",
"title": "Price sheet properties"
}
}
},
"PriceSheetModel": {
"type": "object",
"description": "price sheet result. It contains the pricesheet associated with billing period",
"properties": {
"pricesheets": {
"description": "Price sheet",
"type": "array",
"readOnly": true,
"items": {
"$ref": "#/definitions/PriceSheetProperties"
},
"x-ms-identifiers": [
"meterId"
]
},
"nextLink": {
"description": "The link (url) to the next page of results.",
"type": "string",
"readOnly": true
},
"download": {
"description": "Pricesheet download details.",
"$ref": "#/definitions/MeterDetails",
"readOnly": true
}
}
},
"DownloadProperties": {
"type": "object",
"description": "The properties of the price sheet download.",
"properties": {
"downloadUrl": {
"description": "The link (url) to download the pricesheet.",
"type": "string",
"format": "uri",
"readOnly": true,
"x-ms-secret": true
},
"validTill": {
"description": "Download link validity.",
"type": "string",
"readOnly": true
}
}
},
"PriceSheetProperties": {
"type": "object",
"description": "The properties of the price sheet.",
"properties": {
"billingPeriodId": {
"description": "The id of the billing period resource that the usage belongs to.",
"type": "string",
"readOnly": true
},
"meterId": {
"description": "The meter id (GUID)",
"type": "string",
"format": "uuid",
"readOnly": true
},
"meterDetails": {
"description": "The details about the meter. By default this is not populated, unless it's specified in $expand.",
"$ref": "#/definitions/MeterDetails",
"readOnly": true
},
"unitOfMeasure": {
"description": "Unit of measure",
"type": "string",
"readOnly": true
},
"includedQuantity": {
"description": "Included quality for an offer",
"type": "number",
"readOnly": true
},
"partNumber": {
"description": "Part Number",
"type": "string",
"readOnly": true
},
"unitPrice": {
"description": "Unit Price",
"type": "number",
"readOnly": true
},
"currencyCode": {
"description": "Currency Code",
"type": "string",
"readOnly": true
},
"offerId": {
"description": "Offer Id",
"type": "string",
"readOnly": true
}
}
},
"MeterDetails": {
"type": "object",
"description": "The properties of the meter detail.",
"properties": {
"meterName": {
"description": "The name of the meter, within the given meter category",
"type": "string",
"readOnly": true
},
"meterCategory": {
"description": "The category of the meter, for example, 'Cloud services', 'Networking', etc..",
"type": "string",
"readOnly": true
},
"meterSubCategory": {
"description": "The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc..",
"type": "string",
"readOnly": true
},
"unit": {
"description": "The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc.",
"type": "string",
"readOnly": true
},
"meterLocation": {
"description": "The location in which the Azure service is available.",
"type": "string",
"readOnly": true
},
"totalIncludedQuantity": {
"description": "The total included quantity associated with the offer.",
"type": "number",
"readOnly": true
},
"pretaxStandardRate": {
"description": "The pretax listing price.",
"type": "number",
"readOnly": true
},
"serviceName": {
"description": "The name of the service.",
"type": "string",
"readOnly": true
},
"serviceTier": {
"description": "The service tier.",
"type": "string",
"readOnly": true
}
}
}
},
"parameters": {
"billingPeriodNameParameter": {
"pattern": "[0-9]+",
"name": "billingPeriodName",
"in": "path",
"description": "Billing Period Name.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
}
}
}
Loading