Skip to content

Commit

Permalink
added forecast api and all of it's scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
sashahdo committed Apr 28, 2020
1 parent 328f273 commit 6de98db
Show file tree
Hide file tree
Showing 10 changed files with 1,196 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,146 @@
}
}
},
"/{scope}/providers/Microsoft.CostManagement/forecast": {
"post": {
"tags": [
"Forecast"
],
"operationId": "Forecast_List",
"description": "Lists the forecast charges for scope defined.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/costmanagement/"
},
"x-ms-examples": {
"BillingAccountForecast": {
"$ref": "./examples/BillingAccountForecast.json"
},
"BillingProfileForecast": {
"$ref": "./examples/BillingProfileForecast.json"
},
"InvoiceSectionForecast": {
"$ref": "./examples/InvoiceSectionForecast.json"
},
"EnrollmentAccountForecast": {
"$ref": "./examples/EnrollmentAccountForecast.json"
},
"DepartmentForecast": {
"$ref": "./examples/DepartmentForecast.json"
},
"SubscriptionForecast": {
"$ref": "./examples/SubscriptionForecast.json"
},
"ResourceGroupForecast": {
"$ref": "./examples/ResourceGroupForecast.json"
},
"ExternalSubscriptionForecast": {
"$ref": "./examples/ExternalSubscriptionForecast.json"
},
"ExternalresourceGroupForecast": {
"$ref": "./examples/ExternalBillingAccountForecast.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/scopeForecastParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/ForecastDefinition"
},
"description": "Parameters supplied to the CreateOrUpdate Forecast Config operation."
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/QueryResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast": {
"post": {
"tags": [
"Forecast"
],
"operationId": "Forecast_ListExternal",
"description": "Lists the forecast charges for external cloud provider type defined.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/costmanagement/"
},
"x-ms-examples": {
"ExternalBillingAccountForecast": {
"$ref": "./examples/ExternalBillingAccountForecast.json"
},
"ExternalSubscriptionForecast": {
"$ref": "./examples/ExternalSubscriptionForecast.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/externalCloudProviderTypeParameter"
},
{
"$ref": "#/parameters/externalCloudProviderIdParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/ForecastDefinition"
},
"description": "Parameters supplied to the CreateOrUpdate Forecast Config operation."
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/QueryResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/{scope}/providers/Microsoft.CostManagement/query": {
"post": {
"tags": [
Expand Down Expand Up @@ -1037,6 +1177,60 @@
}
}
},
"ForecastDefinition": {
"description": "The definition of a forecast.",
"properties": {
"type": {
"description": "The type of the forecast.",
"type": "string",
"enum": [
"Usage",
"ActualCost",
"AmortizedCost"
],
"x-ms-enum": {
"name": "ExportType",
"modelAsString": true
}
},
"timeframe": {
"description": "The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.",
"type": "string",
"enum": [
"MonthToDate",
"BillingMonthToDate",
"TheLastMonth",
"TheLastBillingMonth",
"WeekToDate",
"Custom"
],
"x-ms-enum": {
"name": "TimeframeType",
"modelAsString": true
}
},
"timePeriod": {
"description": "Has time period for pulling data for the forecast.",
"$ref": "#/definitions/QueryTimePeriod"
},
"dataset": {
"description": "Has definition for data in this forecast.",
"$ref": "#/definitions/QueryDataset"
},
"includeActualCost":{
"description": "a boolean determining if actualCost will be included",
"type": "boolean"
},
"includeFreshPartialCost":{
"description": "a boolean determining if FreshPartialCost will be included",
"type": "boolean"
}
},
"required": [
"type",
"timeframe"
]
},
"QueryDefinition": {
"description": "The definition of a query.",
"properties": {
Expand Down Expand Up @@ -1536,6 +1730,15 @@
"x-ms-parameter-location": "method",
"x-ms-skip-url-encoding": true
},
"scopeForecastParameter": {
"name": "scope",
"in": "path",
"required": true,
"type": "string",
"description": "The scope associated with Forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.",
"x-ms-parameter-location": "method",
"x-ms-skip-url-encoding": true
},
"scopeQueryParameter": {
"name": "scope",
"in": "path",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"parameters": {
"api-version": "2019-11-01",
"billingAccountId": "12345:6789",
"scope": "providers/Microsoft.Billing/billingAccounts/12345:6789",
"parameters": {
"type": "Usage",
"timeframe": "MonthToDate",
"dataset": {
"granularity": "Daily",
"filter": {
"and": [
{
"or": [
{
"dimension": {
"name": "ResourceLocation",
"operator": "In",
"values": [
"East US",
"West Europe"
]
}
},
{
"tag": {
"name": "Environment",
"operator": "In",
"values": [
"UAT",
"Prod"
]
}
}
]
},
{
"dimension": {
"name": "ResourceGroup",
"operator": "In",
"values": [
"API"
]
}
}
]
}
},
"includeActualCost": false,
"includeFreshPartialCost": false
}
},
"responses": {
"200": {
"body": {
"id": "providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Forecast/ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd",
"type": "microsoft.costmanagement/Query",
"properties": {
"nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Forecast?api-version=2019-10-01&$skiptoken=AQAAAA%3D%3D",
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "ResourceGroup",
"type": "String"
},
{
"name": "UsageDate",
"type": "Number"
},
{
"name": "CostStatus",
"type": "String"
},
{
"name": "Currency",
"type": "String"
}
],
"rows": [
[
2.10333307059661,
"JapanUnifia-Trial",
20180331,
"Forecast",
"USD"
],
[
218.68795741935486,
"RVIIOT-TRIAL",
20180331,
"Forecast",
"USD"
],
[
0.14384913581657052,
"VSTSHOL-1595322048000",
20180401,
"Forecast",
"USD"
],
[
0.009865586851323632,
"gs-stms-dev",
20180429,
"Forecast",
"USD"
]
]
}
}
}
}
}

Loading

0 comments on commit 6de98db

Please sign in to comment.