Skip to content

Commit

Permalink
Adding swagger for new api-version consumption 2018-05-31, introducin…
Browse files Browse the repository at this point in the history
…g new Forecast api swagger (#3114)

* Forecast Api swagger

* consumption readme file update for the new swagger version

* addressing review comment on adding nextLink

* fixing build error

* Addressed feedback on enum and fixed a typo
  • Loading branch information
ncalagar authored and anuchandy committed May 30, 2018
1 parent 5a7197f commit bb24e36
Show file tree
Hide file tree
Showing 5 changed files with 534 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,359 @@
{
"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
}
}
},
"/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": {
"description": "The granularity of forecast.",
"type": "string",
"enum": [
"Daily",
"Monthly",
"Yearly"
],
"x-ms-enum": {
"name": "Grain",
"modelAsString": 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": {
"description": "The type of the charge. Could be actual or forecast",
"type": "string",
"enum": [
"Actual",
"Forecast"
],
"x-ms-enum": {
"name": "ChargeType",
"modelAsString": 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": {
"description": "The boundary of the percentage, values could be 'Upper' or 'Lower'",
"type": "string",
"enum": [
"Upper",
"Lower"
],
"x-ms-enum": {
"name": "Bound",
"modelAsString": 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"
}
}
}
Loading

0 comments on commit bb24e36

Please sign in to comment.