diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/costmanagement.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/costmanagement.json index 5b4e808ef880..c0715358c833 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/costmanagement.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/costmanagement.json @@ -639,7 +639,7 @@ "200": { "description": "OK. The request has succeeded.", "schema": { - "$ref": "#/definitions/QueryResult" + "$ref": "#/definitions/ForecastResult" } }, "204": { @@ -703,7 +703,7 @@ "200": { "description": "OK. The request has succeeded.", "schema": { - "$ref": "#/definitions/QueryResult" + "$ref": "#/definitions/ForecastResult" } }, "default": { @@ -2184,6 +2184,66 @@ } } }, + "ForecastResult": { + "description": "Result of forecast. It contains all columns listed under groupings and aggregation.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ], + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/ForecastProperties", + "title": "Forecast properties" + } + } + }, + "ForecastProperties": { + "description": "Forecast properties", + "type": "object", + "properties": { + "nextLink": { + "description": "The link (url) to the next page of results.", + "type": "string" + }, + "columns": { + "description": "Array of columns", + "type": "array", + "items": { + "$ref": "#/definitions/ForecastColumn" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "rows": { + "description": "Array of rows", + "type": "array", + "items": { + "type": "array", + "items": {}, + "x-ms-identifiers": [] + }, + "x-ms-identifiers": [] + } + } + }, + "ForecastColumn": { + "description": "Forecast column properties", + "type": "object", + "properties": { + "name": { + "description": "The name of column.", + "type": "string" + }, + "type": { + "description": "The type of column.", + "type": "string" + } + } + }, "QueryResult": { "description": "Result of query. It contains all columns listed under groupings and aggregation.", "type": "object", @@ -2312,46 +2372,29 @@ "type": { "description": "The type of the forecast.", "type": "string", - "enum": [ - "Usage", - "ActualCost", - "AmortizedCost" - ], - "x-ms-enum": { - "name": "ForecastType", - "modelAsString": true - } + "$ref": "#/definitions/ForecastType" }, "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": "ForecastTimeframeType", - "modelAsString": true - } + "$ref": "#/definitions/ForecastTimeframe" }, "timePeriod": { "description": "Has time period for pulling data for the forecast.", - "$ref": "#/definitions/QueryTimePeriod" + "type": "object", + "$ref": "#/definitions/ForecastTimePeriod" }, "dataset": { "description": "Has definition for data in this forecast.", + "type": "object", "$ref": "#/definitions/ForecastDataset" }, "includeActualCost": { - "description": "a boolean determining if actualCost will be included", + "description": "A boolean determining if actualCost will be included.", "type": "boolean" }, "includeFreshPartialCost": { - "description": "a boolean determining if FreshPartialCost will be included", + "description": "A boolean determining if FreshPartialCost will be included.", "type": "boolean" } }, @@ -2361,6 +2404,50 @@ "dataset" ] }, + "ForecastType": { + "description": "The type of the forecast.", + "type": "string", + "enum": [ + "Usage", + "ActualCost", + "AmortizedCost" + ], + "x-ms-enum": { + "name": "ForecastType", + "modelAsString": true + } + }, + "ForecastTimeframe": { + "description": "The time frame for pulling data for the forecast.", + "type": "string", + "enum": [ + "Custom" + ], + "x-ms-enum": { + "name": "ForecastTimeframe", + "modelAsString": true + } + }, + "ForecastTimePeriod": { + "description": "Has time period for pulling data for the forecast.", + "type": "object", + "properties": { + "from": { + "description": "The start date to pull data from.", + "type": "string", + "format": "date-time" + }, + "to": { + "description": "The end date to pull data to.", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "from", + "to" + ] + }, "ForecastDataset": { "description": "The definition of data present in the forecast.", "type": "object", @@ -2368,34 +2455,156 @@ "granularity": { "description": "The granularity of rows in the forecast.", "type": "string", - "enum": [ - "Daily" - ], - "x-ms-enum": { - "name": "GranularityType", - "modelAsString": true - } + "$ref": "#/definitions/GranularityType" }, "configuration": { "description": "Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.", - "$ref": "#/definitions/QueryDatasetConfiguration" + "$ref": "#/definitions/ForecastDatasetConfiguration" }, "aggregation": { - "type": "object", "description": "Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses.", + "type": "object", "additionalProperties": { "type": "object", - "$ref": "#/definitions/QueryAggregation" + "$ref": "#/definitions/ForecastAggregation" }, "maxItems": 2 }, "filter": { - "type": "object", "description": "Has filter expression to use in the forecast.", - "$ref": "#/definitions/QueryFilter" + "type": "object", + "$ref": "#/definitions/ForecastFilter" + } + }, + "required": [ + "aggregation" + ] + }, + "GranularityType": { + "description": "The granularity of rows in the forecast.", + "type": "string", + "enum": [ + "Daily" + ], + "x-ms-enum": { + "name": "GranularityType", + "modelAsString": true + } + }, + "ForecastDatasetConfiguration": { + "description": "The configuration of dataset in the forecast.", + "type": "object", + "properties": { + "columns": { + "description": "Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns.", + "type": "array", + "items": { + "type": "string" + } } } }, + "ForecastAggregation": { + "description": "The aggregation expression to be used in the forecast.", + "type": "object", + "properties": { + "name": { + "description": "The name of the column to aggregate.", + "type": "string", + "enum": [ + "PreTaxCostUSD", + "Cost", + "CostUSD", + "PreTaxCost" + ], + "x-ms-enum": { + "name": "FunctionName", + "modelAsString": true + } + }, + "function": { + "description": "The name of the aggregation function to use.", + "type": "string", + "enum": [ + "Sum" + ], + "x-ms-enum": { + "name": "FunctionType", + "modelAsString": true + } + } + }, + "required": [ + "name", + "function" + ] + }, + "ForecastFilter": { + "description": "The filter expression to be used in the export.", + "type": "object", + "properties": { + "and": { + "description": "The logical \"AND\" expression. Must have at least 2 items.", + "type": "array", + "items": { + "$ref": "#/definitions/ForecastFilter" + }, + "x-ms-identifiers": [], + "minItems": 2 + }, + "or": { + "description": "The logical \"OR\" expression. Must have at least 2 items.", + "type": "array", + "items": { + "$ref": "#/definitions/ForecastFilter" + }, + "x-ms-identifiers": [], + "minItems": 2 + }, + "dimensions": { + "description": "Has comparison expression for a dimension", + "$ref": "#/definitions/ForecastComparisonExpression" + }, + "tags": { + "description": "Has comparison expression for a tag", + "$ref": "#/definitions/ForecastComparisonExpression" + } + } + }, + "ForecastComparisonExpression": { + "description": "The comparison expression to be used in the forecast.", + "type": "object", + "properties": { + "name": { + "description": "The name of the column to use in comparison.", + "type": "string" + }, + "operator": { + "description": "The operator to use for comparison.", + "type": "string", + "enum": [ + "In" + ], + "x-ms-enum": { + "name": "ForecastOperatorType", + "modelAsString": true + } + }, + "values": { + "description": "Array of values to use for comparison", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "required": [ + "name", + "operator", + "values" + ] + }, "QueryDefinition": { "description": "The definition of a query.", "type": "object", diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json index c930b012cc6c..74b927c8f9f8 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingAccountForecast.json @@ -5,9 +5,19 @@ "scope": "providers/Microsoft.Billing/billingAccounts/12345:6789", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -55,7 +65,7 @@ "body": { "id": "providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd", "name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/providers/Microsoft.CostManagement/Forecast?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D", "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json index 967338b46cd4..e2d7f70d0b0d 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/BillingProfileForecast.json @@ -6,9 +6,19 @@ "scope": "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -56,7 +66,7 @@ "body": { "id": "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd", "name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/providers/Microsoft.CostManagement/Forecast?api-version=2019-10-01&$skiptoken=AQAAAA%3D%3D", "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json index 23c5074f3e0c..ae9958656167 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/DepartmentForecast.json @@ -6,9 +6,19 @@ "scope": "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -56,7 +66,7 @@ "body": { "id": "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd", "name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123/providers/Microsoft.CostManagement/Forecast?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D", "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json index 093ec2218244..6d14db0dedef 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/EnrollmentAccountForecast.json @@ -6,9 +6,19 @@ "scope": "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -56,7 +66,7 @@ "body": { "id": "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd", "name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456/providers/Microsoft.CostManagement/Forecast?api-version=2021-10-01&$skiptoken=AQAAAA%3D%3D", "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json index 167367d188ab..41840ee7d022 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalBillingAccountForecast.json @@ -5,9 +5,19 @@ "externalCloudProviderType": "externalBillingAccounts", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json index f651e5cec87a..90177d816e10 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ExternalSubscriptionForecast.json @@ -5,9 +5,19 @@ "externalCloudProviderType": "externalSubscriptions", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json index 2b2bf5ee04c8..bbb6d54fc64c 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/InvoiceSectionForecast.json @@ -7,9 +7,19 @@ "scope": "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -57,7 +67,7 @@ "body": { "id": "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/query/ad67fd91-c131-4bda-9ba9-7187ecb1cebd", "name": "ad67fd91-c131-4bda-9ba9-7187ecb1cebd", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876/providers/Microsoft.CostManagement/Forecast?api-version=2019-10-01&$skiptoken=AQAAAA%3D%3D", "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json index 20fd7ba2f22e..5118cefc5126 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/ResourceGroupForecast.json @@ -6,9 +6,19 @@ "scope": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -56,7 +66,7 @@ "body": { "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000", "name": "55312978-ba1b-415c-9304-cfd9c43c0481", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": null, "columns": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json index 47679e6bcdf7..94fd2e3fc230 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2021-10-01/examples/SubscriptionForecast.json @@ -5,9 +5,19 @@ "scope": "subscriptions/00000000-0000-0000-0000-000000000000", "parameters": { "type": "Usage", - "timeframe": "MonthToDate", + "timeframe": "Custom", + "timePeriod": { + "from": "2022-08-01T00:00:00+00:00", + "to": "2022-08-31T23:59:59+00:00" + }, "dataset": { "granularity": "Daily", + "aggregation": { + "totalCost": { + "name": "Cost", + "function": "Sum" + } + }, "filter": { "and": [ { @@ -55,7 +65,7 @@ "body": { "id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/query/00000000-0000-0000-0000-000000000000", "name": "55312978-ba1b-415c-9304-cfd9c43c0481", - "type": "microsoft.costmanagement/Query", + "type": "Microsoft.CostManagement/query", "properties": { "nextLink": null, "columns": [