-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix for Adding API Version 2022-06-01 for PriceSheets and Operations #21560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
prchalla1
wants to merge
30
commits into
Azure:main
from
prchalla1:dev-consumption-Microsoft.Consumption-2022-06-01
Closed
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 8c8524f
Adding missed resource defination
prchalla1 910daff
Readme File change
prchalla1 61f4905
Fixing operations.json and readme file
prchalla1 18b4b52
Fixing consumption.json
prchalla1 77065c3
Removing spaces
prchalla1 85190db
Changes for consomption.json,readme.md
prchalla1 88ff294
consumption.json,readme.md changes
prchalla1 d4579a4
consumption.operations.pricesheet.json added
prchalla1 32032a6
Deleting consumption.json
prchalla1 c15ac27
Fixing validation errors in stagging swaggerlinter
prchalla1 d23d77e
Update consumption.operations.pricesheet.json
jayati-tehri 383a345
Update consumption.operations.pricesheet.json
jayati-tehri 82815bb
Update consumption.operations.pricesheet.json
jayati-tehri 160ccbe
Update consumption.operations.pricesheet.json
jayati-tehri 4d25d34
Update consumption.operations.pricesheet.json
jayati-tehri 52757d0
Update OperationList.json
jayati-tehri 8c8d304
Update OperationList.json
jayati-tehri aef6cf9
Update consumption.operations.pricesheet.json
jayati-tehri aa96406
Update consumption.operations.pricesheet.json
jayati-tehri fc6fd4b
Update consumption.operations.pricesheet.json
jayati-tehri f08b532
Update OperationList.json
jayati-tehri 40df408
Update consumption.operations.pricesheet.json
jayati-tehri c2867b0
Update OperationList.json
jayati-tehri 3b05b6c
Update consumption.operations.pricesheet.json
jayati-tehri b88638f
Update consumption.operations.pricesheet.json
jayati-tehri 87473b3
Update consumption.operations.pricesheet.json
jayati-tehri f5bc5e1
Update consumption.operations.pricesheet.json
jayati-tehri 719f392
Update consumption.operations.pricesheet.json
jayati-tehri d82db1d
Update consumption.operations.pricesheet.json
jayati-tehri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
383 changes: 383 additions & 0 deletions
383
...ce-manager/Microsoft.Consumption/stable/2022-06-01/consumption.operations.pricesheet.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| }, | ||
| "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": { | ||
jayati-tehri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "The link (url) to download the pricesheet.", | ||
| "type": "string", | ||
jayati-tehri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "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 | ||
| } | ||
| } | ||
| } | ||
jayati-tehri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| "parameters": { | ||
| "billingPeriodNameParameter": { | ||
| "pattern": "[0-9]+", | ||
| "name": "billingPeriodName", | ||
| "in": "path", | ||
| "description": "Billing Period Name.", | ||
| "required": true, | ||
| "type": "string", | ||
| "x-ms-parameter-location": "method" | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is listing API but the response is not in array form? Looks like in your example, the response is in array form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response property pricesheets items are array.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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....
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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