-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Adding swagger for new api-version consumption 2018-05-31, introducing new Forecast api swagger #3114
Adding swagger for new api-version consumption 2018-05-31, introducing new Forecast api swagger #3114
Changes from 5 commits
25b0d14
b837fe7
8ee660a
75834e9
a407660
3663051
eadf281
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,337 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"version": "2018-05-31", | ||
"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/forecasts": { | ||
"get": { | ||
"tags": [ | ||
"Forecasts" | ||
], | ||
"x-ms-odata": "#/definitions/Forecast", | ||
"operationId": "Forecasts_List", | ||
"description": "Lists the forecast charges by subscriptionId.", | ||
"externalDocs": { | ||
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/" | ||
}, | ||
"x-ms-examples": { | ||
"ForecastsList": { | ||
"$ref": "./examples/ForecastsList.json" | ||
}, | ||
"ForecastsListFilterByGrain": { | ||
"$ref": "./examples/ForecastsListFilterByGrain.json" | ||
}, | ||
"ForecastsListFilterByDates": { | ||
"$ref": "./examples/ForecastsListFilterByDates.json" | ||
} | ||
}, | ||
"parameters": [ | ||
{ | ||
"name": "$filter", | ||
"description": "May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.", | ||
"in": "query", | ||
"required": false, | ||
"type": "string" | ||
}, | ||
{ | ||
"$ref": "#/parameters/apiVersionParameter" | ||
}, | ||
{ | ||
"$ref": "#/parameters/subscriptionIdParameter" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK. The request has succeeded.", | ||
"schema": { | ||
"$ref": "#/definitions/ForecastsListResult" | ||
} | ||
}, | ||
"default": { | ||
"description": "Error response describing why the operation failed.", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
} | ||
}, | ||
"x-ms-pageable": { | ||
"nextLinkName": null | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. even though this is not a pagable operation, adding following annotation
will ensure the generator flatten the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, applied the change |
||
}, | ||
"/providers/Microsoft.Consumption/operations": { | ||
"get": { | ||
"tags": [ | ||
"Operations" | ||
], | ||
"operationId": "Operations_List", | ||
"description": "Lists all of the available consumption REST API operations.", | ||
"parameters": [ | ||
{ | ||
"$ref": "#/parameters/apiVersionParameter" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK. The request has succeeded.", | ||
"schema": { | ||
"$ref": "#/definitions/OperationListResult" | ||
} | ||
}, | ||
"default": { | ||
"description": "Error response describing why the operation failed.", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
} | ||
}, | ||
"x-ms-pageable": { | ||
"nextLinkName": "nextLink" | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"ErrorDetails": { | ||
"description": "The details of the error.", | ||
"properties": { | ||
"code": { | ||
"description": "Error code.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"message": { | ||
"description": "Error message indicating why the operation failed.", | ||
"type": "string", | ||
"readOnly": true | ||
} | ||
} | ||
}, | ||
"ErrorResponse": { | ||
"description": "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.", | ||
"type": "object", | ||
"properties": { | ||
"error": { | ||
"description": "The details of the error.", | ||
"$ref": "#/definitions/ErrorDetails" | ||
} | ||
} | ||
}, | ||
"Operation": { | ||
"description": "A Consumption REST API operation.", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "Operation name: {provider}/{resource}/{operation}.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"display": { | ||
"description": "The object that represents the operation.", | ||
"properties": { | ||
"provider": { | ||
"description": "Service provider: Microsoft.Consumption.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"resource": { | ||
"description": "Resource on which the operation is performed: UsageDetail, etc.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"operation": { | ||
"description": "Operation type: Read, write, delete, etc.", | ||
"type": "string", | ||
"readOnly": true | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"OperationListResult": { | ||
"description": "Result of listing consumption operations. It contains a list of operations and a URL link to get the next set of results.", | ||
"properties": { | ||
"value": { | ||
"description": "List of consumption operations supported by the Microsoft.Consumption resource provider.", | ||
"type": "array", | ||
"readOnly": true, | ||
"items": { | ||
"$ref": "#/definitions/Operation" | ||
} | ||
}, | ||
"nextLink": { | ||
"description": "URL to get the next set of operation list results if there are any.", | ||
"type": "string", | ||
"readOnly": true | ||
} | ||
} | ||
}, | ||
"Resource": { | ||
"description": "The Resource model definition.", | ||
"properties": { | ||
"id": { | ||
"readOnly": true, | ||
"type": "string", | ||
"description": "Resource Id." | ||
}, | ||
"name": { | ||
"readOnly": true, | ||
"type": "string", | ||
"description": "Resource name." | ||
}, | ||
"type": { | ||
"readOnly": true, | ||
"type": "string", | ||
"description": "Resource type." | ||
}, | ||
"tags": { | ||
"readOnly": true, | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"description": "Resource tags." | ||
} | ||
}, | ||
"x-ms-azure-resource": true | ||
}, | ||
|
||
"Forecast": { | ||
"description": "A forecast resource.", | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/Resource" | ||
} | ||
], | ||
"properties": { | ||
"properties": { | ||
"x-ms-client-flatten": true, | ||
"$ref": "#/definitions/ForecastProperties", | ||
"title": "Forecast properties" | ||
} | ||
} | ||
}, | ||
"ForecastsListResult": { | ||
"description": "Result of listing forecasts. It contains a list of available forecasts.", | ||
"type": "object", | ||
"properties": { | ||
"value": { | ||
"description": "The list of forecasts.", | ||
"type": "array", | ||
"readOnly": true, | ||
"items": { | ||
"$ref": "#/definitions/Forecast" | ||
} | ||
} | ||
} | ||
}, | ||
"ForecastProperties": { | ||
"description": "The properties of the forecast charge.", | ||
"type": "object", | ||
"properties": { | ||
"usageDate": { | ||
"description": "The usage date of the forecast.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"grain": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we please make this as an enum. would be easier to write code against There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks for suggestion |
||
"description": "The granularity of forecast. i.e. Daily, Monthly", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"charge": { | ||
"description": "The amount of charge", | ||
"type": "number", | ||
"format": "decimal", | ||
"readOnly": true | ||
}, | ||
"currency": { | ||
"description": "The ISO currency in which the meter is charged, for example, USD.", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"chargeType": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enum There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, done |
||
"description": "The type of the charge. Could be actual or forecast", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"confidenceLevels": { | ||
"description": "The details about the forecast confidence levels. This is populated only when chargeType is Forecast.", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"percentage": { | ||
"description": "The percentage level of the confidence", | ||
"type": "number", | ||
"format": "decimal", | ||
"readOnly": true | ||
}, | ||
"bound": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. enum There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. Thanks |
||
"description": "The boundary of the percentage, values could be 'Upper' or 'Lower'", | ||
"type": "string", | ||
"readOnly": true | ||
}, | ||
"value": { | ||
"description": "The amount of forecast within the percentage level", | ||
"type": "number", | ||
"format": "decimal", | ||
"readOnly": true | ||
} | ||
} | ||
}, | ||
|
||
"readOnly": true | ||
} | ||
} | ||
} | ||
}, | ||
"parameters": { | ||
"apiVersionParameter": { | ||
"name": "api-version", | ||
"in": "query", | ||
"required": true, | ||
"type": "string", | ||
"description": "Version of the API to be used with the client request. The current version is 2018-05-31." | ||
}, | ||
"subscriptionIdParameter": { | ||
"name": "subscriptionId", | ||
"in": "path", | ||
"description": "Azure Subscription ID.", | ||
"required": true, | ||
"type": "string" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"parameters": { | ||
"api-version": "2018-05-31", | ||
"subscriptionId": "00000000-0000-0000-0000-000000000000" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"id": "/subscriptions/subid/providers/Microsoft.Consumption/forecasts/forecastId1", | ||
"name": "forecastId1", | ||
"type": "Microsoft.Consumption/forecasts", | ||
"properties": { | ||
"usageDate": "2018-04-01", | ||
"grain": "Daily", | ||
"charge": 752.000000, | ||
"currency": "USD", | ||
"chargeType": "Actuall", | ||
"confidenceLevels": null | ||
} | ||
}, | ||
{ | ||
"id": "/subscriptions/subid/providers/Microsoft.Consumption/forecasts/forecastId2", | ||
"name": "forecastId2", | ||
"type": "Microsoft.Consumption/forecasts", | ||
"properties": { | ||
"usageDate": "2018-04-02", | ||
"grain": "Daily", | ||
"charge": 753.809074, | ||
"currency": "USD", | ||
"chargeType": "Forecast", | ||
"confidenceLevels": [ | ||
{ | ||
"percentage": 95, | ||
"bound": "Upper", | ||
"value": 1165.951737 | ||
}, | ||
{ | ||
"percentage": 95, | ||
"bound": "Lower", | ||
"value": 340.753404 | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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.
why we don't have other operations described in this api version such as usageDetails (those are supported in the previous api version)?
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.
@anuchandy We are not releasing new version for usageDetails and other APIs yet... A new version for those APIs will come in later.
Simply put the call to new api-version for other APIs will fail as they do not exist. So there is no need to have them in new version of swagger, unless we actually have a new version for those APIs.
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.
@ms-premp - you can add new APis to existing api-version also. I am not sure if i understand spinning up a new api-version for this api unless you are thinking this is in preview (in which case the api-version should be marked preview)
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.
Thanks @ravbhatnagar ... We decided to use the new version for this API since, we do have some additional changes coming to few existing APIs and therefore we will need a new version anyway.
By first week of June, we will hopefully have changes to this swagger with updates to existing APIs.