From f4a8283cee876594678bcf3b6eef8a7d3515977a Mon Sep 17 00:00:00 2001 From: Jayati Tehri <72947097+jayati-tehri@users.noreply.github.com> Date: Mon, 31 Oct 2022 21:37:25 -0700 Subject: [PATCH] Jatehr/cost management pricesheets (#20958) * Create costmanagement.pricesheets.json * Create PricesheetDownload.json * Create PricesheetDownloadByBillingProfile.json * Create OperationList.json * Update readme.md * Update readme.md * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update PricesheetDownload.json * Update PricesheetDownloadByBillingProfile.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Delete OperationList.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update PricesheetDownload.json * Update PricesheetDownloadByBillingProfile.json * Update PricesheetDownload.json * Update PricesheetDownloadByBillingProfile.json * Update PricesheetDownloadByBillingProfile.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * resolve Go SDK stuttering issue * Update costmanagement.pricesheets.json * Update readme.md * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update PricesheetDownload.json * Update PricesheetDownloadByBillingProfile.json * Delete BenefitRecommendationsByRecommendationId.json * Update costmanagement.benefits.json * Update costmanagement.pricesheets.json * Update costmanagement.pricesheets.json * Update common-types.json * Update costmanagement.pricesheets.json * Update costmanagement.generatedetailedcostreport.json * Update common-types.json * Update common-types.json * Update common-types.json * Update common-types.json * Update common-types.json * resolve Go SDK naming collision Co-authored-by: Chenjie Shi --- .../stable/2022-10-01/common-types.json | 21 ++ .../2022-10-01/costmanagement.benefits.json | 48 ----- ...management.generatedetailedcostreport.json | 18 +- .../costmanagement.pricesheets.json | 189 ++++++++++++++++++ ...efitRecommendationsByRecommendationId.json | 92 --------- .../examples/PricesheetDownload.json | 23 +++ .../PricesheetDownloadByBillingProfile.json | 22 ++ .../resource-manager/readme.go.md | 24 ++- .../resource-manager/readme.md | 1 + 9 files changed, 281 insertions(+), 157 deletions(-) create mode 100644 specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.pricesheets.json delete mode 100644 specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByRecommendationId.json create mode 100644 specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json create mode 100644 specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/common-types.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/common-types.json index e56d1e9708da..b077ad731711 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/common-types.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/common-types.json @@ -157,6 +157,27 @@ } }, "x-ms-azure-resource": true + }, + "DownloadURL": { + "description": "The URL to download the generated report.", + "type": "object", + "properties": { + "expiryTime": { + "description": "The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.", + "type": "string", + "format": "date-time", + "readOnly": true + }, + "validTill": { + "description": "The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.", + "type": "string", + "format": "date-time" + }, + "downloadUrl": { + "description": "The URL to download the generated report.", + "type": "string" + } + } } }, "parameters": { diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.benefits.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.benefits.json index b8de4146860c..50e31435732f 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.benefits.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.benefits.json @@ -99,54 +99,6 @@ } } }, - "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations/{recommendationId}": { - "get": { - "tags": [ - "BenefitRecommendations" - ], - "description": "Details of a benefit plan recommendation for what-if analysis.", - "externalDocs": { - "url": "https://docs.microsoft.com/en-us/rest/api/CostManagement/" - }, - "x-ms-examples": { - "BenefitRecommendationById": { - "$ref": "./examples/BenefitRecommendationsByRecommendationId.json" - } - }, - "operationId": "BenefitRecommendation_Get", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/billingScopeBenefitRecommendationParameter" - }, - { - "name": "recommendationId", - "in": "path", - "description": "The ID of the recommendation.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": true - } - ], - "responses": { - "200": { - "description": "OK. The request has succeeded.", - "schema": { - "$ref": "#/definitions/benefitRecommendationModel" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "common-types.json#/definitions/ErrorResponse" - } - } - } - } - }, "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries": { "get": { "tags": [ diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.generatedetailedcostreport.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.generatedetailedcostreport.json index 88700f2cf925..9639a4010c44 100644 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.generatedetailedcostreport.json +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.generatedetailedcostreport.json @@ -297,7 +297,7 @@ "properties": { "x-ms-client-flatten": true, "description": "The properties of the usage file generated.", - "$ref": "#/definitions/DownloadURL" + "$ref": "common-types.json#/definitions/DownloadURL" } } }, @@ -319,21 +319,7 @@ "properties": { "x-ms-client-flatten": true, "description": "The properties of the resource generated.", - "$ref": "#/definitions/DownloadURL" - } - } - }, - "DownloadURL": { - "description": "The URL to download the generated report.", - "properties": { - "downloadUrl": { - "description": "The URL to download the generated report.", - "type": "string" - }, - "validTill": { - "description": "The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z.", - "type": "string", - "format": "date-time" + "$ref": "common-types.json#/definitions/DownloadURL" } } }, diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.pricesheets.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.pricesheets.json new file mode 100644 index 000000000000..4961846f02c4 --- /dev/null +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/costmanagement.pricesheets.json @@ -0,0 +1,189 @@ +{ + "swagger": "2.0", + "info": { + "version": "2022-10-01", + "title": "CostManagementClient" + }, + "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": { + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download": { + "post": { + "tags": [ + "PriceSheets" + ], + "x-ms-examples": { + "PricesheetDownload": { + "$ref": "./examples/PricesheetDownload.json" + } + }, + "operationId": "PriceSheet_Download", + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "description": "Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/billingAccountNameParameter" + }, + { + "$ref": "#/parameters/billingProfileNameParameter" + }, + { + "$ref": "#/parameters/invoiceNameParameter" + } + ], + "responses": { + "202": { + "description": "Accepted.", + "headers": { + "Location": { + "description": "GET this URL to retrieve the status of the asynchronous operation.", + "type": "string" + }, + "Retry-After": { + "description": "The amount of delay to use while the status of the operation is checked. The value is expressed in seconds.", + "type": "string" + }, + "OData-EntityId": { + "description": "The operation entity Id GUID.", + "type": "string" + } + } + }, + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "common-types.json#/definitions/DownloadURL" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common-types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download": { + "post": { + "tags": [ + "PriceSheets" + ], + "x-ms-examples": { + "PricesheetDownloadByBillingProfile": { + "$ref": "./examples/PricesheetDownloadByBillingProfile.json" + } + }, + "operationId": "PriceSheet_DownloadByBillingProfile", + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "description": "Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/billingAccountNameParameter" + }, + { + "$ref": "#/parameters/billingProfileNameParameter" + } + ], + "responses": { + "202": { + "description": "Accepted.", + "headers": { + "Location": { + "description": "GET this URL to retrieve the status of the asynchronous operation.", + "type": "string" + }, + "Retry-After": { + "description": "The amount of delay to use while the status of the operation is checked. The value is expressed in seconds.", + "type": "string" + }, + "OData-EntityId": { + "description": "The operation entity Id GUID.", + "type": "string" + } + } + }, + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "common-types.json#/definitions/DownloadURL" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common-types.json#/definitions/ErrorResponse" + } + } + } + } + } + }, + "parameters": { + "billingAccountNameParameter": { + "name": "billingAccountName", + "in": "path", + "description": "The ID that uniquely identifies a billing account.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "([A-Za-z0-9]+(-[A-Za-z0-9]+)+):([A-Za-z0-9]+(-[A-Za-z0-9]+)+)_[0-9]{4}-[0-9]{2}-[0-9]{2}" + }, + "billingProfileNameParameter": { + "name": "billingProfileName", + "in": "path", + "description": "The ID that uniquely identifies a billing profile.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "([A-Za-z0-9]+(-[A-Za-z0-9]+)+)" + }, + "invoiceNameParameter": { + "name": "invoiceName", + "in": "path", + "description": "The ID that uniquely identifies an invoice.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "[A-Za-z0-9]+" + } + } +} diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByRecommendationId.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByRecommendationId.json deleted file mode 100644 index 66f9f3df38af..000000000000 --- a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByRecommendationId.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "parameters": { - "api-version": "2022-10-01", - "billingScope": "providers/Microsoft.Billing/billingAccounts/123456", - "recommendationId": "billingAccount/123456/providers/Microsoft.CostManagement/benefitRecommendations/00000000-0000-0000-0000-000000000000" - }, - "responses": { - "200": { - "body": { - "id": "billingAccount/123456/providers/Microsoft.CostManagement/benefitRecommendations/00000000-0000-0000-0000-000000000000", - "name": "00000000-0000-0000-0000-000000000000", - "type": "Microsoft.Consumption/benefitRecommendations", - "kind": "SavingsPlan", - "properties": { - "firstConsumptionDate": "2022-01-24T00:00:00Z", - "lastConsumptionDate": "2022-01-31T00:00:00Z", - "lookBackPeriod": "Last7Days", - "totalHours": 168, - "usage": { - "usageGrain": "Hourly", - "charges": [ - 1.0, - 1.0, - 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 2.0, - 2.0, - 2.0 - ] - }, - "armSkuName": "Compute_Savings_Plan", - "term": "P1Y", - "commitmentGranularity": "Hourly", - "currencyCode": "USD", - "costWithoutBenefit": 218.267, - "scope": "Shared", - "recommendationDetails": { - "averageUtilizationPercentage": 99.330, - "coveragePercentage": 54.609, - "commitmentAmount": 0.164, - "overageCost": 144.841, - "benefitCost": 52.002, - "savingsAmount": 21.424, - "savingsPercentage": 9.815, - "totalCost": 196.843, - "wastageCost": 0.035 - }, - "allRecommendationDetails": { - "value": [ - { - "averageUtilizationPercentage": 99.330, - "coveragePercentage": 54.609, - "commitmentAmount": 0.164, - "overageCost": 144.841, - "benefitCost": 52.002, - "savingsAmount": 21.424, - "savingsPercentage": 9.815, - "totalCost": 196.843, - "wastageCost": 0.035 - }, - { - "averageUtilizationPercentage": 81.474, - "coveragePercentage": 56.748, - "commitmentAmount": 0.161, - "overageCost": 120.389, - "benefitCost": 83.754, - "savingsAmount": 14.124, - "savingsPercentage": 6.470, - "totalCost": 204.143, - "wastageCost": 0.100 - } - ] - } - } - } - } - } -} diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json new file mode 100644 index 000000000000..4d63d5702aee --- /dev/null +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json @@ -0,0 +1,23 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "billingAccountName": "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "billingProfileName": "2USN-TPCD-BG7-TGB", + "invoiceName": "T000940677" + }, + "responses": { + "202": { + "headers": { + "Location": "https://management.azure.com:443/providers/Microsoft.Billing/billingAccounts/7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31/billingProfiles/2USN-TPCD-BG7-TGB/providers/Microsoft.CostManagement/operationResults/45000000-0000-0000-0000-000000000000?sessiontoken=0:000000&api-version=2022-10-01&OperationType=PriceSheet", + "Retry-After": "60", + "OData-EntityId": "45000000-0000-0000-0000-000000000000" + } + }, + "200": { + "body": { + "downloadUrl": "https://myaccount.blob.core.windows.net/?restype=service&comp=properties&sv=2015-04-05&ss=bf&srt=s&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&spr=https&sig=G%2TEST%4B", + "expiryTime": "2022-09-30T17:32:28Z" + } + } + } +} diff --git a/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json new file mode 100644 index 000000000000..e547ccd9c0aa --- /dev/null +++ b/specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "billingAccountName": "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31", + "billingProfileName": "2USN-TPCD-BG7-TGB" + }, + "responses": { + "202": { + "headers": { + "Location": "https://management.azure.com:443/providers/Microsoft.Billing/billingAccounts/7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31/billingProfiles/2USN-TPCD-BG7-TGB/providers/Microsoft.CostManagement/operationResults/45000000-0000-0000-0000-000000000000?sessiontoken=0:000000&api-version=2022-10-01&OperationType=PriceSheet", + "Retry-After": "60", + "OData-EntityId": "45000000-0000-0000-0000-000000000000" + } + }, + "200": { + "body": { + "downloadUrl": "https://myaccount.blob.core.windows.net/?restype=service&comp=properties&sv=2015-04-05&ss=bf&srt=s&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&spr=https&sig=G%2TEST%4B", + "expiryTime": "2018-07-21T17:32:28Z" + } + } + } +} diff --git a/specification/cost-management/resource-manager/readme.go.md b/specification/cost-management/resource-manager/readme.go.md index 9b1a4efa8b7c..9080ee0734fd 100644 --- a/specification/cost-management/resource-manager/readme.go.md +++ b/specification/cost-management/resource-manager/readme.go.md @@ -17,6 +17,28 @@ output-folder: $(go-sdk-folder)/$(module-name) azure-arm: true modelerfour: lenient-model-deduplication: true +directive: +- rename-model: + from: 'CostManagementOperation' + to: 'OperationForCostManagement' +- rename-model: + from: 'CostManagementProxyResource' + to: 'ProxyResourceForCostManagement' +- from: costmanagement.json + where: + - $.definitions.View.allOf[0] + - $.definitions.Alert.allOf[0] + transform: > + $['$ref'] = "common-types.json#/definitions/ProxyResourceForCostManagement"; +- from: costmanagement.exports.json + where: + - $.definitions.Export.allOf[0] + - $.definitions.ExportRun.allOf[0] + transform: > + $['$ref'] = "common-types.json#/definitions/ProxyResourceForCostManagement"; +- rename-model: + from: 'CostManagementResource' + to: 'ResourceForCostManagement' ``` ### Go multi-api @@ -94,4 +116,4 @@ Please also specify `--go-sdk-folder=