From 5e65534010285ac7c2600271c9a5c08d59386243 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 5 Jan 2021 17:50:36 +0000 Subject: [PATCH] CodeGen from PR 12289 in Azure/azure-rest-api-specs Get latest master (#12289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Hub Generated] Review request for Microsoft.AlertsManagement to add version stable/2019-06-01 (#11833) * Changing Swagger file * Changing examples * Fixing tags example * Fixing tags example * Fixing tags example * prettier fix for white spaces * Enable azure-sdk-for-net-track2 (#12169) * Updating existing CRR APIs with zone restore feature (#12157) * - Added change for support of cross zone restores. * - updating example json * - Fixing prettier * lastUpdatedDate for templates (#11900) * lastUpdatedDate for templates * fix * [Hub Generated] Review request for Microsoft.AppPlatform to add version preview/2020-11-01-preview (#11823) * Adds base for updating Microsoft.AppPlatform from version stable/2020-07-01 to version 2020-11-01-preview * Updates readme * Updates API version in new specs and examples * Introduce additional change to 2020-11-01-preview. * Additional properties to monitoringSettings. * Readonly properties to requiredTraffics. Signed-off-by: Pan Li * Make credscan happy. Signed-off-by: Pan Li * [Hub Generated] Review request for Microsoft.Consumption to add version stable/2019-10-01 (#12113) * Fix linter and swagger warnings * Fix errors * Removed unneeded change * [ASC.Automations] Add new data type "RegulatoryComplianceAssessment" (#12185) * Add SubAssessment event source type and add more automations examples * Change Location isReadOnlu to false * Test * Add new read/write location and add new type TrackedResourceLocation * Minor * minor * prettier fixes * Change variable name to TrackedResourceLocation * Change type name TrackedResourceLocation to AzureTrackedResourceLocation * Update automations example * Add SecureScores & SecureScoreControls as new supported datatypes in Automations resource * [ASC.Automations] add new data type RegulatoryComplianceAssessment * add datalake store track2 config (#12186) * cleanup old pipeline dependencies (#11889) * cleanup pipeline deps * add rest-api-specs-scripts * Extending recovery network input in replication intent API to support new network creation (#12191) * [Hub Generated] Review request for Microsoft.Maps to add version preview/2020-02-01-preview (#12172) * Adding operations for Maps Creator resource. * Fixing typo. * Adds suppression to readme * Adds suppression to readme * Adds suppression to readme * Adds suppression to readme * Resolving linter errors. * Minor update. * Updating all reference to v2 schema. * Marked private atlas as deprecated in description. * add operationsmanagement track2 config (#12141) * Update comment.yml (#12202) Add ARM traffic query link. When add breakingChangeReviewRequired * Adding new properties to response body (#12201) * adding new properties * updating examples * prettier fix * [Hub Generated] Review request for Microsoft.ContainerService to add version stable/2020-12-01 (#12064) * Add autorest.az configurations for azure monitor control service (#12090) * add AMCS config for codegen * reorganize command group * rename command group * Codegen modify try to rename DataCollectionRules create parameters * hide DataCollectionRules Create & Update commands and DataCollectionRuleAssociations Create command * use alias instand of rename in code-gen * use monitor-control-service as the extension name * Update readme.python.md * add logic track2 config (#12166) * add alertsmanagement track2 config (#11759) * Update comment.yml (#12213) * add mixedreality track2 confi (#12070) * add signalr track2 config (#11892) * add cognitiveservice track2 config (#11498) * add machinglearningservices track2 config (#12183) * add apimanagement track2 config (#12187) * add serialconsole track2 config (#12046) * Update TransparentDataEncryption Group Name (#12160) * update TransparentDataEncryption Group name * update reference of TransparentDataEncryption * Update readme.python.md (#12216) * Required changes for Azure HealthBot swagger (#12124) * Fixes for SDK generation files. * Fixes for SDK generation files. * Added GO. * Change Healthcare bot to Healthbot. * 1. Remove unused properties of SKU. 2. Removed unused CheckNameAvailability.json 3. Remove subgroup. * Sku is required. * [Hub Generated] Review request for Microsoft.IoTCentral to add version stable/2018-09-01 (#12224) * update to name * update * add api-version of guest configuration to go SDK (#12217) * add api-version for templatespecs (#12197) * Update specificationRepositoryConfiguration.json (#12218) * Adding new api version to devops RP (#11585) * Initial commit as per PR review * Actual changes to api spec for new version * Switching to multi-api build for python * Fix python spec to correct namespaces in multiapi mode * Revert changes to python generation * Add systemdata * Fix the path for sys data reference * Fix path once more * remove additional properties after including systemdata * Remove more addtional properties * Move system data to root * Fix wrong output-folder (#12229) * Remove swagger and examples because the controller will be used for private preview. (#12177) * Update pull_request_assignment.yml (#12230) * [Hub Generated] Review request for Microsoft.StorageCache to add version stable/2020-10-01 (#11407) * Init the next version so diffs can work better. * Updates readme * Updates API version in new specs and examples * Updates to StorageTargetProperties and added examples of cmk, mtu Add 202 to the storage cache and storage target create/update and update examples Fix ST no junction example's 202 response. add properties for nfs extended groups fix issues with extended groups properties found with autorest add properties and objects for Active Directory username download undo unintended change changes from comments in pull request AccessPolicy support. Example fixes for Access Policies. Fix attribute names to match latest RP. update to credential properties for LDAP and Active Directory marking password properties with x-ms-secret tag minor changes on extended groups and add examples Added blob NFS and some other validation fixes. Update required property for domainName from dnsName Updated blobNfs examples and some kpi fixes. Correct validation errors in examples. Added systemdata to resources. Remove x-ms-secret in keyvault reference due to linter error and common types not using it. Remove blobNfs from this version. Remove blobNfs from spec file. Remove x-ms-secret due to linter errors. Fix certificate spelling. Updating prettier and spell check errors. Used prettier on main spec file. Readded x-ms-secret that open api hub failed on but the PR pipeline allows. * Add prettier fix after rebase * Remove 202 bodies and add systemData to examples. * Update spec with prettier. * Address comments on spec for descriptions, readmes, and extendedGroupsEnabled. * Updating to address addition ldap and pattern comments. * Update version tag to include 01 * Restore changes that would be considered breaking changes matching 2020-03-01 * Address a few other comments. * Update netbios field names and some descriptions. * Fix s360 for missing debugInfo operation. * Fix credscan error in example file. * Update required fields, new validator failure on debugInfo return codes, and bindPassword example value. * Update debug info example with new return codes. * Update other credscan password errors. * Update Semantic-and-Model-Violations-Reference.md (#12199) Adding secret_property code, update some other codes. * ADP - add system metadata to dataPool (#12179) * Swagger Linting Fix (#12162) * Fix Linting Issuing * no message * fix description * add description and object back * test to resolve model validation test (cherry picked from commit ab273dfc0d5897683c128ee15da4babafa7a85ba) * [SQL][V20180601] Updating LocationCapabilities spec (#12032) * [SQL][V20180601] Updating LocationCapabilities spec * Fill 2020 versions * Rollback V2018 changes and bump LocationCapabilities in V4 to 2020-08-01-preview * update order for CI-FixRequiredOnFailure (#12227) * update rdbms track2 config (#12245) * ADT: refix path (#12161) * python track2 configure (#12150) * Add and remove owner for service principals (#12081) * [Hub Generated] Review request for Microsoft.MixedReality to add version stable/2020-05-01 (#11810) * fix spec * fix prettier * [Hub Generated] Review request for Microsoft.MixedReality to add version preview/2019-12-02-preview (#11769) * fix for swagger completeness * forgot curly brace * fix example * Api Management - make /tenant endpoints ARM compliant in 2020-06-01-preview version (#11549) * Adds base for updating Microsoft.ApiManagement from version stable/2019-12-01 to version 2020-06-01-preview * Updates readme * Updates API version in new specs and examples * Add support in API Management for Availability Zones (#10284) * apim in azs * fix prettier check * PATCH should return 200 OK (#10328) * add support for PATCH returning 200 OK * CI fixes prettier fix CI fixes part 2 * Password no longer a mandatory property when uploading Certificates * add missing x-ms-odata extension for filter support * +gatewayhostnameconfiguration protocol changes (#10292) * [2020-06-01-preview] Update Oauth Server secrets Contract (#10602) * Oauth server secrets contract * fix azureMonitor enum * API Management Service Deleted Services Resource (#10607) * API Management Service Deleted Services Resource * Path fix * Lint + custom-words fixes * Location URI parameter for deletedservices Resource * GET for deletedservices by service name * Remove resourceGroupName from resource path * fixes * schema for purge operation * perttier applied * 204 response code added Co-authored-by: REDMOND\glfeokti * OperationNameFormat property added to Diagnostic contract (#10641) * OperationNameFormat property added to Diagnostic contract * add azuremonitor to update contract Co-authored-by: REDMOND\glfeokti * [Microsoft.ApiManagement][2020-06-01-preview] Change Network Status response contract (#10331) * Change Network Status response contract * Update examples for network status contract * ApiManagement - tenant/settings endpoints * ApiManagement - tenant/settings endpoints fix * ApiManagement - tenant/settings endpoints fix prettier * ApiManagement - tenant/settings endpoints fix 3 * ApiManagement - tenant/settings endpoints fix 4 * ApiManagement - tenant/settings endpoints fix 5 Co-authored-by: Samir Solanki Co-authored-by: maksimkim Co-authored-by: promoisha Co-authored-by: REDMOND\glfeokti Co-authored-by: RupengLiu Co-authored-by: vfedonkin * Add "mail" parameter to UserUpdateParameters in graphrbac (#12127) This patch adds a single optional field "mail" to UserUpdateParameters schema. This makes it possible to update user's e-mail address using the (Go) Azure SDK. Currently this is not possible. I have curled the graphrbac API with the extra body parameter and it works as expected. Addition of the field will make it possible to support the mail property on the azuread_user resource in terraform-provider-azuread. Co-authored-by: David Čepelík * [Hub Generated] Review request for Microsoft.Advisor to add version stable/2020-01-01 (#12262) * add resourcegraph track2 config (#12122) * add reservations track2 config (#12027) * Removing a readonly tag from a property (#12254) * Fix swagger correctness errors (#12246) * Fix swagger correctness issues in Security for Iot service * changed int format from 32 to 64 * Add systemData to iotSecuritySolutions Co-authored-by: Liran Chen * [Hub Generated] Review request for Microsoft.Consumption to add version stable/2019-10-01 (#12196) * AAS - Swagger Linting and Correctness Fix (#12176) * Fix R4013 IntegerTypeMustHaveFormat * Fix R4010 RequiredDefaultResponse * Fix R4007 DefaultErrorResponseSchema * removed extra bracket * fix semantic issue * add type error * Fix linting issue * test to resolve model validation test * Revert "test to resolve model validation test" This reverts commit ab273dfc0d5897683c128ee15da4babafa7a85ba. * Resolve Model Validation Issue * Resolve Model Validation Issue v2 * test - add missing properties (cherry picked from commit 48ec27c51cc61f4b3c05b531618f40b7c2f77de6) * fix format * set default value * add x-ms-enum * fix nit * Add missing property * add missing properties * add missing bracket * change GatewayListStatusLive type * add missing "origin" property * fix model validation * Revert "change GatewayListStatusLive type" This reverts commit 4f3fa743d5ce91bea6bcf83474e6e3fc15bc3483. * Revert "fix model validation" This reverts commit 945bc233b9e623b2d90f7903b8b4dee94d873aa8. * add redhatopenshift track2 config (#12045) * [Hub Generated] Review request for Microsoft.CostManagement to add version stable/2019-10-01 (#12194) * Adding nextLink and previousLink to Tags endpoint properties * moving properties out * prettier check fix Co-authored-by: Jorge Chavez Nieto * add relay track2 config (#11495) * update healthbot t2 config (#12269) * update healthbot t2 config * fix readme * add automation track2 config (#11628) * add automation track2 config * update config * Azure Remote Rendering REST API swagger file - for review (#12015) * Azure Remote Rendering API specifcation * fix schema issue * fix examples * fix request bodies integer values, :stop path * pointing readme.md to open api spec for ARR * fix typo, add custom words * add msvc to custom words * fix readme.md * ran prettifier * fix reference to json * reference sts from file as well * fix readme.md * changes to readme.md * remove example from error to fix error * add 200 OK status for retried PUT for conversions and sessiosn * ran prettier * make autorest linter not crash * fix casing of nextLinkName paramter * factor out conversion list response * add examples for conversions * adding examples for sessions, prettify files * [Hub Generated] Review request for Microsoft.Maps/Microsoft.Maps to add version preview/2.0 (#12175) * microsoft.imagery 512 not supported Adding micorosft.imagery to 512 tile not supported list * Updating Raster Tilesets to Have Max Zoom 22 Certain raster tilesets now support up to zoom level 22. * minor changes to swagger (#12253) * minor changes to swagger * reverting sdk definitions file * Add addons to AVS 2020-07-17-preview (#12236) * found missing AVS/privateclouds/addons commit, moving it to 2020-07-17-preview API from PR repo * fixed prettier errors * Fixed vladation warnings for x-ms-enum and missing description/title, related to addons * fixed validation error for missing systemData for addons responses * fixed prettier errors * fixed validation error for missing systemData for addons responses * systemData for any Resource * make sure systemData is readOnly * systemData needs to go in a new api version * suppress systemData error Co-authored-by: Cameron Taggart * Azs api bug fix (#12133) * Old api version for ComputeOperationResult * Api Bugfix for Azure Stack Fabric Admin * Fix for typo in readme * Add default reponse * Fix example issue for default error * Update comment.yml (#12273) * [Hub Generated] Review request for Microsoft.CostManagement to add version stable/2019-11-01 (#12031) * fix dataSet typo * fix dimensions and tags typo * more dimensions and tags to fix * one more miss on dimensions and tags * Add the includeMonetaryCommitment missing field * fix spell check error * make property read only * remove the not operation from query filters * New backup service api version (#12171) * Initial commit: adding new api version * - new api 2020-12-01 * updating the readme.md package reference * - adding the zone information for new api * - updating api-version in examples - added 'zone' in Get recoverypoint api example json * Fixing prettier issue * Revert "- updating api-version in examples" This reverts commit 80baa9fcec1293bd3a51875d793f2178964fce52. * - adding api-version in examples * adding new api version in package mds * [IotHub] Introducing networkRuleSets in IotHubProperties [2020-08-31 : preview and stable ] (#10853) * Adds base for updating Microsoft.Devices from version preview/2020-07-10-preview to version 2020-08-31-preview * Updates readme * Updates API version in new specs and examples * Adds base for updating Microsoft.Devices from version stable/2020-08-01 to version 2020-08-31 * Updates readme * Updates API version in new specs and examples * Adding networkRuleSets support for iothub * Adding networkRuleSets Support in preview version * Adding Examples, correcting order in iothub.json * Updating Readme to have stable and previe versions * Modifying Tag to package-2020-08-31 * Adding Arm identity properties from 2020-07-010-preview version * Removing creds * minor fix * swagger correctness fix (#12101) * swagger correctness fix * update preview version too * Revert change and add defaults (#12243) * Remove gallery preview version 2020-09-30 from stable release (#12222) * add managementpartner track2 config (#12043) * [Hub Generated] Review request for Microsoft.Insights to add version stable/2019-03-01 (#12232) * Fixed swagger validations for api version 2019 * reverted error response change and suppress * removed redundant error details * renamed suppression rule * fixed suppression Co-authored-by: napolish <67951636+napolish@users.noreply.github.com> Co-authored-by: Phoenix He Co-authored-by: arpja <46751982+arpja@users.noreply.github.com> Co-authored-by: ShaniFelig <74960756+ShaniFelig@users.noreply.github.com> Co-authored-by: Pan Li Co-authored-by: Zach Rathbun Co-authored-by: surashed <55134940+surashed@users.noreply.github.com> Co-authored-by: Kaihui (Kerwin) Sun Co-authored-by: Zhenglai Zhang Co-authored-by: om-nishant <50401171+om-nishant@users.noreply.github.com> Co-authored-by: Ihar Voitka Co-authored-by: Ruoxuan Wang <52271048+ruowan@users.noreply.github.com> Co-authored-by: Ju Hee Lee Co-authored-by: xiazhan Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com> Co-authored-by: Ji Wang Co-authored-by: Andy Zhang Co-authored-by: guy-microsoft <50947884+guy-microsoft@users.noreply.github.com> Co-authored-by: PoAn (Baron) Chen Co-authored-by: Arcturus Co-authored-by: suyash691 Co-authored-by: nemijato <68876730+nemijato@users.noreply.github.com> Co-authored-by: brpanask <64860651+brpanask@users.noreply.github.com> Co-authored-by: Ray Chen Co-authored-by: Eli Arbel Co-authored-by: David Han <76010854+david-msft@users.noreply.github.com> Co-authored-by: Roman Khotsyn Co-authored-by: David R. Williamson Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Xinyi Joffre Co-authored-by: roytan-microsoft <73565668+roytan-microsoft@users.noreply.github.com> Co-authored-by: Vitaliy Fedonkin Co-authored-by: Samir Solanki Co-authored-by: maksimkim Co-authored-by: promoisha Co-authored-by: REDMOND\glfeokti Co-authored-by: RupengLiu Co-authored-by: vfedonkin Co-authored-by: David Čepelík Co-authored-by: David Čepelík Co-authored-by: mudit794 <42189950+mudit794@users.noreply.github.com> Co-authored-by: Dhawal Jain <41853104+dhawal777@users.noreply.github.com> Co-authored-by: MichalHel <51286657+MichalHel@users.noreply.github.com> Co-authored-by: Liran Chen Co-authored-by: jochav <75458295+jochav@users.noreply.github.com> Co-authored-by: Jorge Chavez Nieto Co-authored-by: rikogeln <40666347+rikogeln@users.noreply.github.com> Co-authored-by: chgennar <56695749+chgennar@users.noreply.github.com> Co-authored-by: hivyas <61890270+hivyas@users.noreply.github.com> Co-authored-by: Douglas Lee <65295939+leedouglas@users.noreply.github.com> Co-authored-by: Cameron Taggart Co-authored-by: LingyunSu <33764806+LingyunSu@users.noreply.github.com> Co-authored-by: elabicha <61994320+elabicha@users.noreply.github.com> Co-authored-by: Nikhil Kumar Mengani <62704762+nimengan@users.noreply.github.com> Co-authored-by: Junbo Wang Co-authored-by: Daniel Orozco <64658732+dagoroz@users.noreply.github.com> Co-authored-by: Adam Sandor Co-authored-by: yashmuel <63585146+yashmuel@users.noreply.github.com> --- .../costmanagement/_cost_management_client.py | 27 +- .../mgmt/costmanagement/models/__init__.py | 113 +- .../models/_cost_management_client_enums.py | 160 ++- .../mgmt/costmanagement/models/_models.py | 1150 ++++++++++++++-- .../mgmt/costmanagement/models/_models_py3.py | 1170 +++++++++++++++-- .../costmanagement/models/_paged_models.py | 13 + .../costmanagement/operations/__init__.py | 10 +- .../operations/_alerts_operations.py | 338 +++++ .../operations/_dimensions_operations.py | 106 +- .../operations/_exports_operations.py | 54 +- .../operations/_forecast_operations.py | 207 +++ .../costmanagement/operations/_operations.py | 4 +- .../operations/_query_operations.py | 78 +- .../operations/_views_operations.py | 594 +++++++++ 14 files changed, 3806 insertions(+), 218 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py index 526f8dda9266..71864191a97c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py @@ -13,10 +13,13 @@ from msrest import Serializer, Deserializer from ._configuration import CostManagementClientConfiguration +from .operations import ViewsOperations +from .operations import AlertsOperations +from .operations import ForecastOperations from .operations import DimensionsOperations from .operations import QueryOperations -from .operations import ExportsOperations from .operations import Operations +from .operations import ExportsOperations from . import models @@ -26,14 +29,20 @@ class CostManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: CostManagementClientConfiguration + :ivar views: Views operations + :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations + :ivar alerts: Alerts operations + :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations + :ivar forecast: Forecast operations + :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations :ivar dimensions: Dimensions operations :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations :ivar query: Query operations :vartype query: azure.mgmt.costmanagement.operations.QueryOperations - :ivar exports: Exports operations - :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.operations.Operations + :ivar exports: Exports operations + :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -50,15 +59,21 @@ def __init__( super(CostManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-11-01' + self.api_version = '2020-06-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.views = ViewsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.alerts = AlertsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.forecast = ForecastOperations( + self._client, self.config, self._serialize, self._deserialize) self.dimensions = DimensionsOperations( self._client, self.config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self.config, self._serialize, self._deserialize) - self.exports = ExportsOperations( - self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.exports = ExportsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index f9cce82b9bb8..4a333a7c4b89 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -10,11 +10,19 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import Alert + from ._models_py3 import AlertPropertiesDefinition + from ._models_py3 import AlertPropertiesDetails + from ._models_py3 import AlertsResult from ._models_py3 import CommonExportProperties from ._models_py3 import Dimension + from ._models_py3 import DismissAlertPayload from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Export + from ._models_py3 import ExportDataset + from ._models_py3 import ExportDatasetConfiguration + from ._models_py3 import ExportDefinition from ._models_py3 import ExportDeliveryDestination from ._models_py3 import ExportDeliveryInfo from ._models_py3 import ExportExecution @@ -22,8 +30,14 @@ from ._models_py3 import ExportListResult from ._models_py3 import ExportRecurrencePeriod from ._models_py3 import ExportSchedule + from ._models_py3 import ExportTimePeriod + from ._models_py3 import ForecastDataset + from ._models_py3 import ForecastDefinition + from ._models_py3 import KpiProperties from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import PivotProperties + from ._models_py3 import ProxyResource from ._models_py3 import QueryAggregation from ._models_py3 import QueryColumn from ._models_py3 import QueryComparisonExpression @@ -34,13 +48,30 @@ from ._models_py3 import QueryGrouping from ._models_py3 import QueryResult from ._models_py3 import QueryTimePeriod + from ._models_py3 import ReportConfigAggregation + from ._models_py3 import ReportConfigComparisonExpression + from ._models_py3 import ReportConfigDataset + from ._models_py3 import ReportConfigDatasetConfiguration + from ._models_py3 import ReportConfigFilter + from ._models_py3 import ReportConfigGrouping + from ._models_py3 import ReportConfigSorting + from ._models_py3 import ReportConfigTimePeriod from ._models_py3 import Resource + from ._models_py3 import View except (SyntaxError, ImportError): + from ._models import Alert + from ._models import AlertPropertiesDefinition + from ._models import AlertPropertiesDetails + from ._models import AlertsResult from ._models import CommonExportProperties from ._models import Dimension + from ._models import DismissAlertPayload from ._models import ErrorDetails from ._models import ErrorResponse, ErrorResponseException from ._models import Export + from ._models import ExportDataset + from ._models import ExportDatasetConfiguration + from ._models import ExportDefinition from ._models import ExportDeliveryDestination from ._models import ExportDeliveryInfo from ._models import ExportExecution @@ -48,8 +79,14 @@ from ._models import ExportListResult from ._models import ExportRecurrencePeriod from ._models import ExportSchedule + from ._models import ExportTimePeriod + from ._models import ForecastDataset + from ._models import ForecastDefinition + from ._models import KpiProperties from ._models import Operation from ._models import OperationDisplay + from ._models import PivotProperties + from ._models import ProxyResource from ._models import QueryAggregation from ._models import QueryColumn from ._models import QueryComparisonExpression @@ -60,27 +97,64 @@ from ._models import QueryGrouping from ._models import QueryResult from ._models import QueryTimePeriod + from ._models import ReportConfigAggregation + from ._models import ReportConfigComparisonExpression + from ._models import ReportConfigDataset + from ._models import ReportConfigDatasetConfiguration + from ._models import ReportConfigFilter + from ._models import ReportConfigGrouping + from ._models import ReportConfigSorting + from ._models import ReportConfigTimePeriod from ._models import Resource + from ._models import View from ._paged_models import DimensionPaged from ._paged_models import OperationPaged +from ._paged_models import ViewPaged from ._cost_management_client_enums import ( + ReportTimeframeType, + ReportGranularityType, + ReportConfigColumnType, + OperatorType, + ChartType, + AccumulatedType, + MetricType, + KpiTypeType, + PivotTypeType, + AlertType, + AlertCategory, + AlertCriteria, + AlertSource, + AlertTimeGrainType, + AlertOperator, + AlertStatus, + ForecastType, + ForecastTimeframeType, + GranularityType, ExportType, TimeframeType, - GranularityType, QueryColumnType, StatusType, RecurrenceType, FormatType, ExecutionType, ExecutionStatus, + ExternalCloudProviderType, ) __all__ = [ + 'Alert', + 'AlertPropertiesDefinition', + 'AlertPropertiesDetails', + 'AlertsResult', 'CommonExportProperties', 'Dimension', + 'DismissAlertPayload', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', 'Export', + 'ExportDataset', + 'ExportDatasetConfiguration', + 'ExportDefinition', 'ExportDeliveryDestination', 'ExportDeliveryInfo', 'ExportExecution', @@ -88,8 +162,14 @@ 'ExportListResult', 'ExportRecurrencePeriod', 'ExportSchedule', + 'ExportTimePeriod', + 'ForecastDataset', + 'ForecastDefinition', + 'KpiProperties', 'Operation', 'OperationDisplay', + 'PivotProperties', + 'ProxyResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', @@ -100,16 +180,45 @@ 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', + 'ReportConfigAggregation', + 'ReportConfigComparisonExpression', + 'ReportConfigDataset', + 'ReportConfigDatasetConfiguration', + 'ReportConfigFilter', + 'ReportConfigGrouping', + 'ReportConfigSorting', + 'ReportConfigTimePeriod', 'Resource', + 'View', + 'ViewPaged', 'DimensionPaged', 'OperationPaged', + 'ReportTimeframeType', + 'ReportGranularityType', + 'ReportConfigColumnType', + 'OperatorType', + 'ChartType', + 'AccumulatedType', + 'MetricType', + 'KpiTypeType', + 'PivotTypeType', + 'AlertType', + 'AlertCategory', + 'AlertCriteria', + 'AlertSource', + 'AlertTimeGrainType', + 'AlertOperator', + 'AlertStatus', + 'ForecastType', + 'ForecastTimeframeType', + 'GranularityType', 'ExportType', 'TimeframeType', - 'GranularityType', 'QueryColumnType', 'StatusType', 'RecurrenceType', 'FormatType', 'ExecutionType', 'ExecutionStatus', + 'ExternalCloudProviderType', ] diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index d447d8444908..a8381825a493 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -12,14 +12,147 @@ from enum import Enum -class ExportType(str, Enum): +class ReportTimeframeType(str, Enum): + + week_to_date = "WeekToDate" + month_to_date = "MonthToDate" + year_to_date = "YearToDate" + custom = "Custom" + + +class ReportGranularityType(str, Enum): + + daily = "Daily" + monthly = "Monthly" + + +class ReportConfigColumnType(str, Enum): + + tag = "Tag" + dimension = "Dimension" + + +class OperatorType(str, Enum): + + in_enum = "In" + contains = "Contains" + + +class ChartType(str, Enum): + + area = "Area" + line = "Line" + stacked_column = "StackedColumn" + grouped_column = "GroupedColumn" + table = "Table" + + +class AccumulatedType(str, Enum): + + true = "true" + false = "false" + + +class MetricType(str, Enum): + + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + ahub = "AHUB" + + +class KpiTypeType(str, Enum): + + forecast = "Forecast" + budget = "Budget" + + +class PivotTypeType(str, Enum): + + dimension = "Dimension" + tag_key = "TagKey" + + +class AlertType(str, Enum): + + budget = "Budget" + invoice = "Invoice" + credit = "Credit" + quota = "Quota" + general = "General" + x_cloud = "xCloud" + budget_forecast = "BudgetForecast" + + +class AlertCategory(str, Enum): + + cost = "Cost" + usage = "Usage" + billing = "Billing" + system = "System" + + +class AlertCriteria(str, Enum): + + cost_threshold_exceeded = "CostThresholdExceeded" + usage_threshold_exceeded = "UsageThresholdExceeded" + credit_threshold_approaching = "CreditThresholdApproaching" + credit_threshold_reached = "CreditThresholdReached" + quota_threshold_approaching = "QuotaThresholdApproaching" + quota_threshold_reached = "QuotaThresholdReached" + multi_currency = "MultiCurrency" + forecast_cost_threshold_exceeded = "ForecastCostThresholdExceeded" + forecast_usage_threshold_exceeded = "ForecastUsageThresholdExceeded" + invoice_due_date_approaching = "InvoiceDueDateApproaching" + invoice_due_date_reached = "InvoiceDueDateReached" + cross_cloud_new_data_available = "CrossCloudNewDataAvailable" + cross_cloud_collection_error = "CrossCloudCollectionError" + general_threshold_error = "GeneralThresholdError" + + +class AlertSource(str, Enum): + + preset = "Preset" + user = "User" + + +class AlertTimeGrainType(str, Enum): + + none = "None" + monthly = "Monthly" + quarterly = "Quarterly" + annually = "Annually" + billing_month = "BillingMonth" + billing_quarter = "BillingQuarter" + billing_annual = "BillingAnnual" + + +class AlertOperator(str, Enum): + + none = "None" + equal_to = "EqualTo" + greater_than = "GreaterThan" + greater_than_or_equal_to = "GreaterThanOrEqualTo" + less_than = "LessThan" + less_than_or_equal_to = "LessThanOrEqualTo" + + +class AlertStatus(str, Enum): + + none = "None" + active = "Active" + overridden = "Overridden" + resolved = "Resolved" + dismissed = "Dismissed" + + +class ForecastType(str, Enum): usage = "Usage" actual_cost = "ActualCost" amortized_cost = "AmortizedCost" -class TimeframeType(str, Enum): +class ForecastTimeframeType(str, Enum): month_to_date = "MonthToDate" billing_month_to_date = "BillingMonthToDate" @@ -34,6 +167,23 @@ class GranularityType(str, Enum): daily = "Daily" +class ExportType(str, Enum): + + usage = "Usage" + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + + +class TimeframeType(str, Enum): + + month_to_date = "MonthToDate" + billing_month_to_date = "BillingMonthToDate" + the_last_month = "TheLastMonth" + the_last_billing_month = "TheLastBillingMonth" + week_to_date = "WeekToDate" + custom = "Custom" + + class QueryColumnType(str, Enum): tag = "Tag" @@ -74,3 +224,9 @@ class ExecutionStatus(str, Enum): timeout = "Timeout" new_data_not_available = "NewDataNotAvailable" data_not_available = "DataNotAvailable" + + +class ExternalCloudProviderType(str, Enum): + + external_subscriptions = "externalSubscriptions" + external_billing_accounts = "externalBillingAccounts" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py index b06344b3295c..e0ac14606487 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py @@ -13,48 +13,46 @@ from msrest.exceptions import HttpOperationError -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonExportProperties(Model): - """The common properties of the export. +class Resource(Model): + """The Resource model definition. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param format: The format of the export being delivered. Possible values - include: 'Csv' - :type format: str or ~azure.mgmt.costmanagement.models.FormatType - :param delivery_info: Required. Has delivery information for the export. - :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _validation = { - 'delivery_info': {'required': True}, - 'definition': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, } _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__(self, **kwargs): - super(CommonExportProperties, self).__init__(**kwargs) - self.format = kwargs.get('format', None) - self.delivery_info = kwargs.get('delivery_info', None) - self.definition = kwargs.get('definition', None) + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None -class Resource(Model): - """The Resource model definition. +class Alert(Resource): + """An individual alert. Variables are only populated by the server, and will be ignored when sending a request. @@ -67,6 +65,31 @@ class Resource(Model): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str """ _validation = { @@ -81,14 +104,231 @@ class Resource(Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, } def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = None + super(Alert, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + +class AlertPropertiesDefinition(Model): + """defines the type of alert. + + :param type: type of alert. Possible values include: 'Budget', 'Invoice', + 'Credit', 'Quota', 'General', 'xCloud', 'BudgetForecast' + :type type: str or ~azure.mgmt.costmanagement.models.AlertType + :param category: Alert category. Possible values include: 'Cost', 'Usage', + 'Billing', 'System' + :type category: str or ~azure.mgmt.costmanagement.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + 'CostThresholdExceeded', 'UsageThresholdExceeded', + 'CreditThresholdApproaching', 'CreditThresholdReached', + 'QuotaThresholdApproaching', 'QuotaThresholdReached', 'MultiCurrency', + 'ForecastCostThresholdExceeded', 'ForecastUsageThresholdExceeded', + 'InvoiceDueDateApproaching', 'InvoiceDueDateReached', + 'CrossCloudNewDataAvailable', 'CrossCloudCollectionError', + 'GeneralThresholdError' + :type criteria: str or ~azure.mgmt.costmanagement.models.AlertCriteria + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.category = kwargs.get('category', None) + self.criteria = kwargs.get('criteria', None) + + +class AlertPropertiesDetails(Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. Possible values + include: 'None', 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + 'BillingQuarter', 'BillingAnnual' + :type time_grain_type: str or + ~azure.mgmt.costmanagement.models.AlertTimeGrainType + :param period_start_date: datetime of periodStartDate + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by + :type meter_filter: list[object] + :param tag_filter: tags to filter by + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which + activated this alert + :type threshold: decimal.Decimal + :param operator: operator used to compare currentSpend with amount. + Possible values include: 'None', 'EqualTo', 'GreaterThan', + 'GreaterThanOrEqualTo', 'LessThan', 'LessThanOrEqualTo' + :type operator: str or ~azure.mgmt.costmanagement.models.AlertOperator + :param amount: budget threshold amount + :type amount: decimal.Decimal + :param unit: unit of currency being used + :type unit: str + :param current_spend: current spend + :type current_spend: decimal.Decimal + :param contact_emails: list of emails to contact + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to + :type contact_groups: list[str] + :param contact_roles: list of contact roles + :type contact_roles: list[str] + :param overriding_alert: overriding alert + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'decimal'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'decimal'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'decimal'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = kwargs.get('time_grain_type', None) + self.period_start_date = kwargs.get('period_start_date', None) + self.triggered_by = kwargs.get('triggered_by', None) + self.resource_group_filter = kwargs.get('resource_group_filter', None) + self.resource_filter = kwargs.get('resource_filter', None) + self.meter_filter = kwargs.get('meter_filter', None) + self.tag_filter = kwargs.get('tag_filter', None) + self.threshold = kwargs.get('threshold', None) + self.operator = kwargs.get('operator', None) + self.amount = kwargs.get('amount', None) + self.unit = kwargs.get('unit', None) + self.current_spend = kwargs.get('current_spend', None) + self.contact_emails = kwargs.get('contact_emails', None) + self.contact_groups = kwargs.get('contact_groups', None) + self.contact_roles = kwargs.get('contact_roles', None) + self.overriding_alert = kwargs.get('overriding_alert', None) + + +class AlertsResult(Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are + any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CommonExportProperties(Model): + """The common properties of the export. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. Possible values include: 'Csv' + :type format: str or ~azure.mgmt.costmanagement.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime + """ + + _validation = { + 'delivery_info': {'required': True}, + 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(CommonExportProperties, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.delivery_info = kwargs.get('delivery_info', None) + self.definition = kwargs.get('definition', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None class Dimension(Resource): @@ -169,6 +409,65 @@ def __init__(self, **kwargs): self.next_link = None +class DismissAlertPayload(Model): + """The request payload to update an alert. + + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + class ErrorDetails(Model): """The details of the error. @@ -200,6 +499,12 @@ def __init__(self, **kwargs): class ErrorResponse(Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + Some Error responses: + * 429 TooManyRequests - Request is throttled. Retry after waiting for the + time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" + header. + * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after + waiting for the time specified in the "Retry-After" header. :param error: The details of the error. :type error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -226,8 +531,47 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): - """A export resource. +class ProxyResource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = kwargs.get('e_tag', None) + + +class Export(ProxyResource): + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -240,15 +584,24 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param format: The format of the export being delivered. Possible values - include: 'Csv' + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. Possible values include: 'Csv' :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -257,19 +610,21 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -278,9 +633,94 @@ def __init__(self, **kwargs): self.format = kwargs.get('format', None) self.delivery_info = kwargs.get('delivery_info', None) self.definition = kwargs.get('definition', None) + self.run_history = kwargs.get('run_history', None) + self.next_run_time_estimate = None self.schedule = kwargs.get('schedule', None) +class ExportDataset(Model): + """The definition for data in the export. + + :param granularity: The granularity of rows in the export. Currently only + 'Daily' is supported. Possible values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: + ~azure.mgmt.costmanagement.models.ExportDatasetConfiguration + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ExportDatasetConfiguration'}, + } + + def __init__(self, **kwargs): + super(ExportDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + + +class ExportDatasetConfiguration(Model): + """The export dataset configuration. Allows columns to be selected for the + export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not + provided then the export will include all available columns. The available + columns can vary by customer channel (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class ExportDefinition(Model): + """The definition of an export. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the export. Note that 'Usage' is + equivalent to 'ActualCost' and is applicable to exports that do not yet + provide data for charges or amortization for service reservations. + Possible values include: 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the + export. If custom, then a specific time period must be provided. Possible + values include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod + :param data_set: The definition for data in the export. + :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + } + + def __init__(self, **kwargs): + super(ExportDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.data_set = kwargs.get('data_set', None) + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -346,8 +786,8 @@ def __init__(self, **kwargs): self.destination = kwargs.get('destination', None) -class ExportExecution(Resource): - """A export execution. +class ExportExecution(ProxyResource): + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -358,46 +798,50 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str :param execution_type: The type of the export execution. Possible values include: 'OnDemand', 'Scheduled' :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType - :param status: The status of the export execution. Possible values - include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', + :param status: The last known status of the export execution. Possible + values include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable' :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus :param submitted_by: The identifier for the entity that executed the - export. For OnDemand executions, it is the email id. For Scheduled - executions, it is the constant value - System. + export. For OnDemand executions it is the user email. For scheduled + executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: + :param run_settings: The export settings that were in effect for this + execution. :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param error: The details of any error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -406,6 +850,7 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } def __init__(self, **kwargs): @@ -418,15 +863,16 @@ def __init__(self, **kwargs): self.processing_end_time = kwargs.get('processing_end_time', None) self.file_name = kwargs.get('file_name', None) self.run_settings = kwargs.get('run_settings', None) + self.error = kwargs.get('error', None) class ExportExecutionListResult(Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. + :ivar value: A list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -494,16 +940,13 @@ def __init__(self, **kwargs): class ExportSchedule(Model): - """The schedule associated with a export. - - All required parameters must be populated in order to send to Azure. + """The schedule associated with the export. - :param status: The status of the schedule. Whether active or not. If - inactive, the export's scheduled execution is paused. Possible values - include: 'Active', 'Inactive' + :param status: The status of the export's schedule. If 'Inactive', the + export's schedule is paused. Possible values include: 'Active', 'Inactive' :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: Required. The schedule recurrence. Possible values - include: 'Daily', 'Weekly', 'Monthly', 'Annually' + :param recurrence: The schedule recurrence. Possible values include: + 'Daily', 'Weekly', 'Monthly', 'Annually' :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType :param recurrence_period: Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater @@ -512,10 +955,6 @@ class ExportSchedule(Model): ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, @@ -529,25 +968,164 @@ def __init__(self, **kwargs): self.recurrence_period = kwargs.get('recurrence_period', None) -class Operation(Model): - """A Cost management REST API operation. +class ExportTimePeriod(Model): + """The date range for data in the export. This should only be specified with + timeFrame set to 'Custom'. The maximum date range is 3 months. - Variables are only populated by the server, and will be ignored when - sending a request. + All required parameters must be populated in order to send to Azure. - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + :param from_property: Required. The start date for export data. + :type from_property: datetime + :param to: Required. The end date for export data. + :type to: datetime """ _validation = { - 'name': {'readonly': True}, + 'from_property': {'required': True}, + 'to': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + +class ForecastDataset(Model): + """The definition of data present in the forecast. + + :param granularity: The granularity of rows in the forecast. Possible + values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: Has configuration information for the data in the + export. The configuration will be ignored if aggregation and grouping are + provided. + :type configuration: + ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :param aggregation: 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 aggregation: dict[str, + ~azure.mgmt.costmanagement.models.QueryAggregation] + :param filter: Has filter expression to use in the forecast. + :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'filter': {'key': 'filter', 'type': 'QueryFilter'}, + } + + def __init__(self, **kwargs): + super(ForecastDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.filter = kwargs.get('filter', None) + + +class ForecastDefinition(Model): + """The definition of a forecast. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the forecast. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the + forecast. If custom, then a specific time period must be provided. + Possible values include: 'MonthToDate', 'BillingMonthToDate', + 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param dataset: Has definition for data in this forecast. + :type dataset: ~azure.mgmt.costmanagement.models.ForecastDataset + :param include_actual_cost: a boolean determining if actualCost will be + included + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if + FreshPartialCost will be included + :type include_fresh_partial_cost: bool + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'ForecastDataset'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ForecastDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs.get('dataset', None) + self.include_actual_cost = kwargs.get('include_actual_cost', None) + self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', None) + + +class KpiProperties(Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: + 'Forecast', 'Budget' + :type type: str or ~azure.mgmt.costmanagement.models.KpiTypeType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI? + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(KpiProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.id = kwargs.get('id', None) + self.enabled = kwargs.get('enabled', None) + + +class Operation(Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, } def __init__(self, **kwargs): @@ -590,6 +1168,27 @@ def __init__(self, **kwargs): self.operation = None +class PivotProperties(Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: + 'Dimension', 'TagKey' + :type type: str or ~azure.mgmt.costmanagement.models.PivotTypeType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PivotProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + + class QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -921,3 +1520,388 @@ def __init__(self, **kwargs): super(QueryTimePeriod, self).__init__(**kwargs) self.from_property = kwargs.get('from_property', None) self.to = kwargs.get('to', None) + + +class ReportConfigAggregation(Model): + """The aggregation expression to be used in the report. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. + Default value: "Sum" . + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__(self, **kwargs): + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class ReportConfigComparisonExpression(Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible + values include: 'In', 'Contains' + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.operator = kwargs.get('operator', None) + self.values = kwargs.get('values', None) + + +class ReportConfigDataset(Model): + """The definition of data present in the report. + + :param granularity: The granularity of rows in the report. Possible values + include: 'Daily', 'Monthly' + :type granularity: str or + ~azure.mgmt.costmanagement.models.ReportGranularityType + :param configuration: Has configuration information for the data in the + report. The configuration will be ignored if aggregation and grouping are + provided. + :type configuration: + ~azure.mgmt.costmanagement.models.ReportConfigDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the + report. The key of each item in the dictionary is the alias for the + aggregated column. Report can have up to 2 aggregation clauses. + :type aggregation: dict[str, + ~azure.mgmt.costmanagement.models.ReportConfigAggregation] + :param grouping: Array of group by expression to use in the report. Report + can have up to 2 group by clauses. + :type grouping: + list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] + :param sorting: Array of order by expression to use in the report. + :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :param filter: Has filter expression to use in the report. + :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilter + """ + + _validation = { + 'grouping': {'max_items': 2}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ReportConfigDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{ReportConfigAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[ReportConfigGrouping]'}, + 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, + 'filter': {'key': 'filter', 'type': 'ReportConfigFilter'}, + } + + def __init__(self, **kwargs): + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.grouping = kwargs.get('grouping', None) + self.sorting = kwargs.get('sorting', None) + self.filter = kwargs.get('filter', None) + + +class ReportConfigDatasetConfiguration(Model): + """The configuration of dataset in the report. + + :param columns: Array of column names to be included in the report. Any + valid report column name is allowed. If not provided, then report includes + all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class ReportConfigFilter(Model): + """The filter expression to be used in the report. + + :param and_property: The logical "AND" expression. Must have at least 2 + items. + :type and_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 + items. + :type or_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension + :type dimension: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag + :type tag: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, + 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__(self, **kwargs): + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = kwargs.get('and_property', None) + self.or_property = kwargs.get('or_property', None) + self.not_property = kwargs.get('not_property', None) + self.dimension = kwargs.get('dimension', None) + self.tag = kwargs.get('tag', None) + + +class ReportConfigGrouping(Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values + include: 'Tag', 'Dimension' + :type type: str or + ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version + supports subscription lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + + +class ReportConfigSorting(Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: 'Ascending', + 'Descending' + :type direction: str or ~azure.mgmt.costmanagement.models.enum + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = kwargs.get('direction', None) + self.name = kwargs.get('name', None) + + +class ReportConfigTimePeriod(Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: datetime + :param to: Required. The end date to pull data to. + :type to: datetime + """ + + _validation = { + 'from_property': {'required': True}, + 'to': {'required': True}, + } + + _attribute_map = { + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: datetime + :ivar view_type: Required. The type of the report. Usage represents actual + usage, forecast represents forecasted data and UsageAndForecast represents + both usage and forecasted data. Actual usage and forecasted data can be + differentiated based on dates. Default value: "Usage" . + :vartype view_type: str + :param timeframe: Required. The time frame for pulling data for the + report. If custom, then a specific time period must be provided. Possible + values include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: + ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :param chart: Chart type of the main view in Cost Analysis. Required. + Possible values include: 'Area', 'Line', 'StackedColumn', 'GroupedColumn', + 'Table' + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values + include: 'true', 'false' + :type accumulated: str or + ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values + include: 'ActualCost', 'AmortizedCost', 'AHUB' + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + } + + view_type = "Usage" + + def __init__(self, **kwargs): + super(View, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.scope = kwargs.get('scope', None) + self.created_on = None + self.modified_on = None + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs.get('dataset', None) + self.chart = kwargs.get('chart', None) + self.accumulated = kwargs.get('accumulated', None) + self.metric = kwargs.get('metric', None) + self.kpis = kwargs.get('kpis', None) + self.pivots = kwargs.get('pivots', None) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index 01cef7145aec..ce339dc1bc97 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -13,48 +13,46 @@ from msrest.exceptions import HttpOperationError -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonExportProperties(Model): - """The common properties of the export. +class Resource(Model): + """The Resource model definition. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param format: The format of the export being delivered. Possible values - include: 'Csv' - :type format: str or ~azure.mgmt.costmanagement.models.FormatType - :param delivery_info: Required. Has delivery information for the export. - :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _validation = { - 'delivery_info': {'required': True}, - 'definition': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, } _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'definition', 'type': 'QueryDefinition'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, delivery_info, definition, format=None, **kwargs) -> None: - super(CommonExportProperties, self).__init__(**kwargs) - self.format = format - self.delivery_info = delivery_info - self.definition = definition + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None -class Resource(Model): - """The Resource model definition. +class Alert(Resource): + """An individual alert. Variables are only populated by the server, and will be ignored when sending a request. @@ -67,6 +65,31 @@ class Resource(Model): :vartype type: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str """ _validation = { @@ -81,14 +104,231 @@ class Resource(Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, *, definition=None, description: str=None, source=None, details=None, cost_entity_id: str=None, status=None, creation_time: str=None, close_time: str=None, modification_time: str=None, status_modification_user_name: str=None, status_modification_time: str=None, **kwargs) -> None: + super(Alert, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + +class AlertPropertiesDefinition(Model): + """defines the type of alert. + + :param type: type of alert. Possible values include: 'Budget', 'Invoice', + 'Credit', 'Quota', 'General', 'xCloud', 'BudgetForecast' + :type type: str or ~azure.mgmt.costmanagement.models.AlertType + :param category: Alert category. Possible values include: 'Cost', 'Usage', + 'Billing', 'System' + :type category: str or ~azure.mgmt.costmanagement.models.AlertCategory + :param criteria: Criteria that triggered alert. Possible values include: + 'CostThresholdExceeded', 'UsageThresholdExceeded', + 'CreditThresholdApproaching', 'CreditThresholdReached', + 'QuotaThresholdApproaching', 'QuotaThresholdReached', 'MultiCurrency', + 'ForecastCostThresholdExceeded', 'ForecastUsageThresholdExceeded', + 'InvoiceDueDateApproaching', 'InvoiceDueDateReached', + 'CrossCloudNewDataAvailable', 'CrossCloudCollectionError', + 'GeneralThresholdError' + :type criteria: str or ~azure.mgmt.costmanagement.models.AlertCriteria + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__(self, *, type=None, category=None, criteria=None, **kwargs) -> None: + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = type + self.category = category + self.criteria = criteria + + +class AlertPropertiesDetails(Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. Possible values + include: 'None', 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + 'BillingQuarter', 'BillingAnnual' + :type time_grain_type: str or + ~azure.mgmt.costmanagement.models.AlertTimeGrainType + :param period_start_date: datetime of periodStartDate + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by + :type meter_filter: list[object] + :param tag_filter: tags to filter by + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which + activated this alert + :type threshold: decimal.Decimal + :param operator: operator used to compare currentSpend with amount. + Possible values include: 'None', 'EqualTo', 'GreaterThan', + 'GreaterThanOrEqualTo', 'LessThan', 'LessThanOrEqualTo' + :type operator: str or ~azure.mgmt.costmanagement.models.AlertOperator + :param amount: budget threshold amount + :type amount: decimal.Decimal + :param unit: unit of currency being used + :type unit: str + :param current_spend: current spend + :type current_spend: decimal.Decimal + :param contact_emails: list of emails to contact + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to + :type contact_groups: list[str] + :param contact_roles: list of contact roles + :type contact_roles: list[str] + :param overriding_alert: overriding alert + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'decimal'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'decimal'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'decimal'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__(self, *, time_grain_type=None, period_start_date: str=None, triggered_by: str=None, resource_group_filter=None, resource_filter=None, meter_filter=None, tag_filter=None, threshold=None, operator=None, amount=None, unit: str=None, current_spend=None, contact_emails=None, contact_groups=None, contact_roles=None, overriding_alert: str=None, **kwargs) -> None: + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = time_grain_type + self.period_start_date = period_start_date + self.triggered_by = triggered_by + self.resource_group_filter = resource_group_filter + self.resource_filter = resource_filter + self.meter_filter = meter_filter + self.tag_filter = tag_filter + self.threshold = threshold + self.operator = operator + self.amount = amount + self.unit = unit + self.current_spend = current_spend + self.contact_emails = contact_emails + self.contact_groups = contact_groups + self.contact_roles = contact_roles + self.overriding_alert = overriding_alert + + +class AlertsResult(Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are + any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = None + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CommonExportProperties(Model): + """The common properties of the export. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. Possible values include: 'Csv' + :type format: str or ~azure.mgmt.costmanagement.models.FormatType + :param delivery_info: Required. Has delivery information for the export. + :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime + """ + + _validation = { + 'delivery_info': {'required': True}, + 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, + 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, + } + + def __init__(self, *, delivery_info, definition, format=None, run_history=None, **kwargs) -> None: + super(CommonExportProperties, self).__init__(**kwargs) + self.format = format + self.delivery_info = delivery_info + self.definition = definition + self.run_history = run_history + self.next_run_time_estimate = None class Dimension(Resource): @@ -169,6 +409,65 @@ def __init__(self, *, data=None, **kwargs) -> None: self.next_link = None +class DismissAlertPayload(Model): + """The request payload to update an alert. + + :param definition: defines the type of alert + :type definition: + ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description + :type description: str + :param source: Source of alert. Possible values include: 'Preset', 'User' + :type source: str or ~azure.mgmt.costmanagement.models.AlertSource + :param details: Alert details + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget + :type cost_entity_id: str + :param status: alert status. Possible values include: 'None', 'Active', + 'Overridden', 'Resolved', 'Dismissed' + :type status: str or ~azure.mgmt.costmanagement.models.AlertStatus + :param creation_time: dateTime in which alert was created + :type creation_time: str + :param close_time: dateTime in which alert was closed + :type close_time: str + :param modification_time: dateTime in which alert was last modified + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was + last modified + :type status_modification_time: str + """ + + _attribute_map = { + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__(self, *, definition=None, description: str=None, source=None, details=None, cost_entity_id: str=None, status=None, creation_time: str=None, close_time: str=None, modification_time: str=None, status_modification_user_name: str=None, status_modification_time: str=None, **kwargs) -> None: + super(DismissAlertPayload, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + class ErrorDetails(Model): """The details of the error. @@ -200,6 +499,12 @@ def __init__(self, **kwargs) -> None: class ErrorResponse(Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + Some Error responses: + * 429 TooManyRequests - Request is throttled. Retry after waiting for the + time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" + header. + * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after + waiting for the time specified in the "Retry-After" header. :param error: The details of the error. :type error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -226,8 +531,47 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) -class Export(Resource): - """A export resource. +class ProxyResource(Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__(self, *, e_tag: str=None, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = e_tag + + +class Export(ProxyResource): + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -240,15 +584,24 @@ class Export(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :param format: The format of the export being delivered. Possible values - include: 'Csv' + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param format: The format of the export being delivered. Currently only + 'Csv' is supported. Possible values include: 'Csv' :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has definition for the export. - :type definition: ~azure.mgmt.costmanagement.models.QueryDefinition + :param definition: Required. Has the definition for the export. + :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition + :param run_history: If requested, has the most recent execution history + for the export. + :type run_history: + ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :ivar next_run_time_estimate: If the export has an active schedule, + provides an estimate of the next execution time. + :vartype next_run_time_estimate: datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -257,30 +610,117 @@ class Export(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, 'delivery_info': {'required': True}, 'definition': {'required': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, - 'definition': {'key': 'properties.definition', 'type': 'QueryDefinition'}, + 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } - def __init__(self, *, delivery_info, definition, format=None, schedule=None, **kwargs) -> None: - super(Export, self).__init__(**kwargs) + def __init__(self, *, delivery_info, definition, e_tag: str=None, format=None, run_history=None, schedule=None, **kwargs) -> None: + super(Export, self).__init__(e_tag=e_tag, **kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition + self.run_history = run_history + self.next_run_time_estimate = None self.schedule = schedule +class ExportDataset(Model): + """The definition for data in the export. + + :param granularity: The granularity of rows in the export. Currently only + 'Daily' is supported. Possible values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: The export dataset configuration. + :type configuration: + ~azure.mgmt.costmanagement.models.ExportDatasetConfiguration + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ExportDatasetConfiguration'}, + } + + def __init__(self, *, granularity=None, configuration=None, **kwargs) -> None: + super(ExportDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + + +class ExportDatasetConfiguration(Model): + """The export dataset configuration. Allows columns to be selected for the + export. If not provided then the export will include all available columns. + + :param columns: Array of column names to be included in the export. If not + provided then the export will include all available columns. The available + columns can vary by customer channel (see examples). + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, *, columns=None, **kwargs) -> None: + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class ExportDefinition(Model): + """The definition of an export. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the export. Note that 'Usage' is + equivalent to 'ActualCost' and is applicable to exports that do not yet + provide data for charges or amortization for service reservations. + Possible values include: 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: Required. The time frame for pulling data for the + export. If custom, then a specific time period must be provided. Possible + values include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the export. + :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod + :param data_set: The definition for data in the export. + :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + } + + def __init__(self, *, type, timeframe, time_period=None, data_set=None, **kwargs) -> None: + super(ExportDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.data_set = data_set + + class ExportDeliveryDestination(Model): """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the @@ -346,8 +786,8 @@ def __init__(self, *, destination, **kwargs) -> None: self.destination = destination -class ExportExecution(Resource): - """A export execution. +class ExportExecution(ProxyResource): + """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -358,46 +798,50 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str :param execution_type: The type of the export execution. Possible values include: 'OnDemand', 'Scheduled' :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType - :param status: The status of the export execution. Possible values - include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', + :param status: The last known status of the export execution. Possible + values include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable' :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus :param submitted_by: The identifier for the entity that executed the - export. For OnDemand executions, it is the email id. For Scheduled - executions, it is the constant value - System. + export. For OnDemand executions it is the user email. For scheduled + executions it is 'System'. :type submitted_by: str :param submitted_time: The time when export was queued to be executed. :type submitted_time: datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: datetime - :param processing_end_time: The time when export execution finished. + :param processing_end_time: The time when the export execution finished. :type processing_end_time: datetime - :param file_name: The name of the file export got written to. + :param file_name: The name of the exported file. :type file_name: str - :param run_settings: + :param run_settings: The export settings that were in effect for this + execution. :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + :param error: The details of any error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -406,10 +850,11 @@ class ExportExecution(Resource): 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, 'file_name': {'key': 'properties.fileName', 'type': 'str'}, 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + 'error': {'key': 'properties.error', 'type': 'ErrorDetails'}, } - def __init__(self, *, execution_type=None, status=None, submitted_by: str=None, submitted_time=None, processing_start_time=None, processing_end_time=None, file_name: str=None, run_settings=None, **kwargs) -> None: - super(ExportExecution, self).__init__(**kwargs) + def __init__(self, *, e_tag: str=None, execution_type=None, status=None, submitted_by: str=None, submitted_time=None, processing_start_time=None, processing_end_time=None, file_name: str=None, run_settings=None, error=None, **kwargs) -> None: + super(ExportExecution, self).__init__(e_tag=e_tag, **kwargs) self.execution_type = execution_type self.status = status self.submitted_by = submitted_by @@ -418,15 +863,16 @@ def __init__(self, *, execution_type=None, status=None, submitted_by: str=None, self.processing_end_time = processing_end_time self.file_name = file_name self.run_settings = run_settings + self.error = error class ExportExecutionListResult(Model): - """Result of listing exports execution history of a export by name. + """Result of listing the execution history of an export. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of export executions. + :ivar value: A list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -494,16 +940,13 @@ def __init__(self, *, from_property, to=None, **kwargs) -> None: class ExportSchedule(Model): - """The schedule associated with a export. - - All required parameters must be populated in order to send to Azure. + """The schedule associated with the export. - :param status: The status of the schedule. Whether active or not. If - inactive, the export's scheduled execution is paused. Possible values - include: 'Active', 'Inactive' + :param status: The status of the export's schedule. If 'Inactive', the + export's schedule is paused. Possible values include: 'Active', 'Inactive' :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: Required. The schedule recurrence. Possible values - include: 'Daily', 'Weekly', 'Monthly', 'Annually' + :param recurrence: The schedule recurrence. Possible values include: + 'Daily', 'Weekly', 'Monthly', 'Annually' :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType :param recurrence_period: Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater @@ -512,48 +955,183 @@ class ExportSchedule(Model): ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, 'recurrence_period': {'key': 'recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, } - def __init__(self, *, recurrence, status=None, recurrence_period=None, **kwargs) -> None: + def __init__(self, *, status=None, recurrence=None, recurrence_period=None, **kwargs) -> None: super(ExportSchedule, self).__init__(**kwargs) self.status = status self.recurrence = recurrence self.recurrence_period = recurrence_period -class Operation(Model): - """A Cost management REST API operation. +class ExportTimePeriod(Model): + """The date range for data in the export. This should only be specified with + timeFrame set to 'Custom'. The maximum date range is 3 months. - Variables are only populated by the server, and will be ignored when - sending a request. + All required parameters must be populated in order to send to Azure. - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + :param from_property: Required. The start date for export data. + :type from_property: datetime + :param to: Required. The end date for export data. + :type to: datetime """ _validation = { - 'name': {'readonly': True}, + 'from_property': {'required': True}, + 'to': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, } - def __init__(self, *, display=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = display + def __init__(self, *, from_property, to, **kwargs) -> None: + super(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class ForecastDataset(Model): + """The definition of data present in the forecast. + + :param granularity: The granularity of rows in the forecast. Possible + values include: 'Daily' + :type granularity: str or + ~azure.mgmt.costmanagement.models.GranularityType + :param configuration: Has configuration information for the data in the + export. The configuration will be ignored if aggregation and grouping are + provided. + :type configuration: + ~azure.mgmt.costmanagement.models.QueryDatasetConfiguration + :param aggregation: 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 aggregation: dict[str, + ~azure.mgmt.costmanagement.models.QueryAggregation] + :param filter: Has filter expression to use in the forecast. + :type filter: ~azure.mgmt.costmanagement.models.QueryFilter + """ + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, + 'filter': {'key': 'filter', 'type': 'QueryFilter'}, + } + + def __init__(self, *, granularity=None, configuration=None, aggregation=None, filter=None, **kwargs) -> None: + super(ForecastDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.filter = filter + + +class ForecastDefinition(Model): + """The definition of a forecast. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of the forecast. Possible values include: + 'Usage', 'ActualCost', 'AmortizedCost' + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the + forecast. If custom, then a specific time period must be provided. + Possible values include: 'MonthToDate', 'BillingMonthToDate', + 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param dataset: Has definition for data in this forecast. + :type dataset: ~azure.mgmt.costmanagement.models.ForecastDataset + :param include_actual_cost: a boolean determining if actualCost will be + included + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if + FreshPartialCost will be included + :type include_fresh_partial_cost: bool + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'dataset': {'key': 'dataset', 'type': 'ForecastDataset'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, + } + + def __init__(self, *, type, timeframe, time_period=None, dataset=None, include_actual_cost: bool=None, include_fresh_partial_cost: bool=None, **kwargs) -> None: + super(ForecastDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.dataset = dataset + self.include_actual_cost = include_actual_cost + self.include_fresh_partial_cost = include_fresh_partial_cost + + +class KpiProperties(Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: + 'Forecast', 'Budget' + :type type: str or ~azure.mgmt.costmanagement.models.KpiTypeType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI? + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, *, type=None, id: str=None, enabled: bool=None, **kwargs) -> None: + super(KpiProperties, self).__init__(**kwargs) + self.type = type + self.id = id + self.enabled = enabled + + +class Operation(Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display class OperationDisplay(Model): @@ -590,6 +1168,27 @@ def __init__(self, **kwargs) -> None: self.operation = None +class PivotProperties(Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: + 'Dimension', 'TagKey' + :type type: str or ~azure.mgmt.costmanagement.models.PivotTypeType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, type=None, name: str=None, **kwargs) -> None: + super(PivotProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + class QueryAggregation(Model): """The aggregation expression to be used in the query. @@ -921,3 +1520,388 @@ def __init__(self, *, from_property, to, **kwargs) -> None: super(QueryTimePeriod, self).__init__(**kwargs) self.from_property = from_property self.to = to + + +class ReportConfigAggregation(Model): + """The aggregation expression to be used in the report. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. + Default value: "Sum" . + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__(self, *, name: str, **kwargs) -> None: + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = name + + +class ReportConfigComparisonExpression(Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible + values include: 'In', 'Contains' + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__(self, *, name: str, operator, values, **kwargs) -> None: + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class ReportConfigDataset(Model): + """The definition of data present in the report. + + :param granularity: The granularity of rows in the report. Possible values + include: 'Daily', 'Monthly' + :type granularity: str or + ~azure.mgmt.costmanagement.models.ReportGranularityType + :param configuration: Has configuration information for the data in the + report. The configuration will be ignored if aggregation and grouping are + provided. + :type configuration: + ~azure.mgmt.costmanagement.models.ReportConfigDatasetConfiguration + :param aggregation: Dictionary of aggregation expression to use in the + report. The key of each item in the dictionary is the alias for the + aggregated column. Report can have up to 2 aggregation clauses. + :type aggregation: dict[str, + ~azure.mgmt.costmanagement.models.ReportConfigAggregation] + :param grouping: Array of group by expression to use in the report. Report + can have up to 2 group by clauses. + :type grouping: + list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] + :param sorting: Array of order by expression to use in the report. + :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] + :param filter: Has filter expression to use in the report. + :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilter + """ + + _validation = { + 'grouping': {'max_items': 2}, + } + + _attribute_map = { + 'granularity': {'key': 'granularity', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'ReportConfigDatasetConfiguration'}, + 'aggregation': {'key': 'aggregation', 'type': '{ReportConfigAggregation}'}, + 'grouping': {'key': 'grouping', 'type': '[ReportConfigGrouping]'}, + 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, + 'filter': {'key': 'filter', 'type': 'ReportConfigFilter'}, + } + + def __init__(self, *, granularity=None, configuration=None, aggregation=None, grouping=None, sorting=None, filter=None, **kwargs) -> None: + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.sorting = sorting + self.filter = filter + + +class ReportConfigDatasetConfiguration(Model): + """The configuration of dataset in the report. + + :param columns: Array of column names to be included in the report. Any + valid report column name is allowed. If not provided, then report includes + all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__(self, *, columns=None, **kwargs) -> None: + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class ReportConfigFilter(Model): + """The filter expression to be used in the report. + + :param and_property: The logical "AND" expression. Must have at least 2 + items. + :type and_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 + items. + :type or_property: + list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension + :type dimension: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag + :type tag: + ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, + 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__(self, *, and_property=None, or_property=None, not_property=None, dimension=None, tag=None, **kwargs) -> None: + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = and_property + self.or_property = or_property + self.not_property = not_property + self.dimension = dimension + self.tag = tag + + +class ReportConfigGrouping(Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values + include: 'Tag', 'Dimension' + :type type: str or + ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version + supports subscription lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, type, name: str, **kwargs) -> None: + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = type + self.name = name + + +class ReportConfigSorting(Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: 'Ascending', + 'Descending' + :type direction: str or ~azure.mgmt.costmanagement.models.enum + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, direction=None, **kwargs) -> None: + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = direction + self.name = name + + +class ReportConfigTimePeriod(Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: datetime + :param to: Required. The end date to pull data to. + :type to: datetime + """ + + _validation = { + 'from_property': {'required': True}, + 'to': {'required': True}, + } + + _attribute_map = { + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__(self, *, from_property, to, **kwargs) -> None: + super(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, + this field will be used to determine whether the user is updating the + latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: datetime + :ivar view_type: Required. The type of the report. Usage represents actual + usage, forecast represents forecasted data and UsageAndForecast represents + both usage and forecasted data. Actual usage and forecasted data can be + differentiated based on dates. Default value: "Usage" . + :vartype view_type: str + :param timeframe: Required. The time frame for pulling data for the + report. If custom, then a specific time period must be provided. Possible + values include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom' + :type timeframe: str or + ~azure.mgmt.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: + ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :param chart: Chart type of the main view in Cost Analysis. Required. + Possible values include: 'Area', 'Line', 'StackedColumn', 'GroupedColumn', + 'Table' + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values + include: 'true', 'false' + :type accumulated: str or + ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values + include: 'ActualCost', 'AmortizedCost', 'AHUB' + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'view_type': {'required': True, 'constant': True}, + 'timeframe': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'view_type': {'key': 'properties.query.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + } + + view_type = "Usage" + + def __init__(self, *, timeframe, e_tag: str=None, display_name: str=None, scope: str=None, time_period=None, dataset=None, chart=None, accumulated=None, metric=None, kpis=None, pivots=None, **kwargs) -> None: + super(View, self).__init__(e_tag=e_tag, **kwargs) + self.display_name = display_name + self.scope = scope + self.created_on = None + self.modified_on = None + self.timeframe = timeframe + self.time_period = time_period + self.dataset = dataset + self.chart = chart + self.accumulated = accumulated + self.metric = metric + self.kpis = kpis + self.pivots = pivots diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py index 7f38fa645767..66bd6b250254 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_paged_models.py @@ -12,6 +12,19 @@ from msrest.paging import Paged +class ViewPaged(Paged): + """ + A paging container for iterating over a list of :class:`View ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[View]'} + } + + def __init__(self, *args, **kwargs): + + super(ViewPaged, self).__init__(*args, **kwargs) class DimensionPaged(Paged): """ A paging container for iterating over a list of :class:`Dimension ` object diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py index ed3adf92c621..9b84a0ecd473 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py @@ -9,14 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations +from ._forecast_operations import ForecastOperations from ._dimensions_operations import DimensionsOperations from ._query_operations import QueryOperations -from ._exports_operations import ExportsOperations from ._operations import Operations +from ._exports_operations import ExportsOperations __all__ = [ + 'ViewsOperations', + 'AlertsOperations', + 'ForecastOperations', 'DimensionsOperations', 'QueryOperations', - 'ExportsOperations', 'Operations', + 'ExportsOperations', ] diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py new file mode 100644 index 000000000000..bc155a8c57d9 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py @@ -0,0 +1,338 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AlertsOperations(object): + """AlertsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-06-01" + + self.config = config + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """Lists the alerts for scope defined. + + :param scope: The scope associated with alerts 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. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertsResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + + def get( + self, scope, alert_id, custom_headers=None, raw=False, **operation_config): + """Gets the alert for the scope by alert ID. + + :param scope: The scope associated with alerts 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. + :type scope: str + :param alert_id: Alert ID + :type alert_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} + + def dismiss( + self, scope, alert_id, parameters, custom_headers=None, raw=False, **operation_config): + """Dismisses the specified alert. + + :param scope: The scope associated with alerts 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. + :type scope: str + :param alert_id: Alert ID + :type alert_id: str + :param parameters: Parameters supplied to the Dismiss Alert operation. + :type parameters: + ~azure.mgmt.costmanagement.models.DismissAlertPayload + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Alert or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.Alert or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.dismiss.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'alertId': self._serialize.url("alert_id", alert_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'DismissAlertPayload') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Alert', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + dismiss.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}'} + + def list_external( + self, external_cloud_provider_type, external_cloud_provider_id, custom_headers=None, raw=False, **operation_config): + """Lists the Alerts for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AlertsResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_external.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_external.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py index a753fb553a79..49ffa497eb13 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py @@ -24,7 +24,7 @@ class DimensionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config @@ -145,3 +145,105 @@ def internal_paging(next_link=None): return deserialized list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + + def by_external_cloud_provider_type( + self, external_cloud_provider_type, external_cloud_provider_id, filter=None, expand=None, skiptoken=None, top=None, custom_headers=None, raw=False, **operation_config): + """Lists the dimensions by the external cloud provider type. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param filter: May be used to filter dimensions by + properties/category, properties/usageStart, properties/usageEnd. + Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :type filter: str + :param expand: May be used to expand the properties/data within a + dimension category. By default, data is not included when listing + dimensions. + :type expand: str + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + :param top: May be used to limit the number of results to the most + recent N dimension data. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Dimension + :rtype: + ~azure.mgmt.costmanagement.models.DimensionPaged[~azure.mgmt.costmanagement.models.Dimension] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DimensionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py index 73edeb506961..03ff569a5ac4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py @@ -24,7 +24,7 @@ class ExportsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". """ models = models @@ -34,17 +34,16 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config def list( - self, scope, custom_headers=None, raw=False, **operation_config): + self, scope, expand=None, custom_headers=None, raw=False, **operation_config): """The operation to list all exports at the given scope. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for @@ -62,6 +61,10 @@ def list( '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. :type scope: str + :param expand: May be used to expand the properties within an export. + Currently only 'runHistory' is supported and will return information + for the last execution of each export. + :type expand: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -83,6 +86,8 @@ def list( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} @@ -113,12 +118,11 @@ def list( list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} def get( - self, scope, export_name, custom_headers=None, raw=False, **operation_config): + self, scope, export_name, expand=None, custom_headers=None, raw=False, **operation_config): """The operation to get the export for the defined scope by export name. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for @@ -138,6 +142,10 @@ def get( :type scope: str :param export_name: Export Name. :type export_name: str + :param expand: May be used to expand the properties within an export. + Currently only 'runHistory' is supported and will return information + for the last 10 executions of the export. + :type expand: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -160,6 +168,8 @@ def get( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} @@ -195,9 +205,8 @@ def create_or_update( latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for @@ -281,9 +290,8 @@ def delete( self, scope, export_name, custom_headers=None, raw=False, **operation_config): """The operation to delete a export. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for @@ -348,11 +356,10 @@ def delete( def execute( self, scope, export_name, custom_headers=None, raw=False, **operation_config): - """The operation to execute a export. + """The operation to execute an export. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for @@ -418,11 +425,10 @@ def execute( def get_execution_history( self, scope, export_name, custom_headers=None, raw=False, **operation_config): """The operation to get the execution history of an export for the defined - scope by export name. + scope and export name. - :param scope: The scope associated with query and export operations. - This includes '/subscriptions/{subscriptionId}/' for subscription - scope, + :param scope: The scope associated with export operations. This + includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py new file mode 100644 index 000000000000..0ce8b67ba9b7 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py @@ -0,0 +1,207 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ForecastOperations(object): + """ForecastOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-06-01" + + self.config = config + + def usage( + self, scope, parameters, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the forecast charges for scope defined. + + :param scope: 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. + :type scope: str + :param parameters: Parameters supplied to the CreateOrUpdate Forecast + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition + :param filter: 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'. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ForecastDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + + def external_cloud_provider_usage( + self, external_cloud_provider_type, external_cloud_provider_id, parameters, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists the forecast charges for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param parameters: Parameters supplied to the CreateOrUpdate Forecast + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition + :param filter: 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'. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.external_cloud_provider_usage.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ForecastDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py index 9b8e7a21167b..5074c5a490b8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py index 00191d7f0ddf..fdc4919a741a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py @@ -24,7 +24,7 @@ class QueryOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. The current version is 2019-11-01. Constant value: "2019-11-01". + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-11-01" + self.api_version = "2020-06-01" self.config = config @@ -118,3 +118,77 @@ def usage( return deserialized usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} + + def usage_by_external_cloud_provider_type( + self, external_cloud_provider_type, external_cloud_provider_id, parameters, custom_headers=None, raw=False, **operation_config): + """Query the usage data for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type + associated with dimension/query operations. This includes + 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. Possible values + include: 'externalSubscriptions', 'externalBillingAccounts' + :type external_cloud_provider_type: str or + ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be + '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with + dimension/query operations. + :type external_cloud_provider_id: str + :param parameters: Parameters supplied to the CreateOrUpdate Query + Config operation. + :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QueryResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.usage_by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'QueryDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py new file mode 100644 index 000000000000..a198b18a3af1 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py @@ -0,0 +1,594 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ViewsOperations(object): + """ViewsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2020-06-01. Constant value: "2020-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-06-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all views by tenant and object. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of View + :rtype: + ~azure.mgmt.costmanagement.models.ViewPaged[~azure.mgmt.costmanagement.models.View] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ViewPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.CostManagement/views'} + + def list_by_scope( + self, scope, custom_headers=None, raw=False, **operation_config): + """Lists all views at the given scope. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of View + :rtype: + ~azure.mgmt.costmanagement.models.ViewPaged[~azure.mgmt.costmanagement.models.View] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ViewPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + + def get( + self, view_name, custom_headers=None, raw=False, **operation_config): + """Gets the view by view name. + + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update( + self, view_name, parameters, custom_headers=None, raw=False, **operation_config): + """The operation to create or update a view. Update operation requires + latest eTag to be set in the request. You may obtain the latest eTag by + performing a get operation. Create operation does not require eTag. + + :param view_name: View name + :type view_name: str + :param parameters: Parameters supplied to the CreateOrUpdate View + operation. + :type parameters: ~azure.mgmt.costmanagement.models.View + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'View') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + if response.status_code == 201: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete( + self, view_name, custom_headers=None, raw=False, **operation_config): + """The operation to delete a view. + + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def get_by_scope( + self, scope, view_name, custom_headers=None, raw=False, **operation_config): + """Gets the view for the defined scope by view name. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update_by_scope( + self, scope, view_name, parameters, custom_headers=None, raw=False, **operation_config): + """The operation to create or update a view. Update operation requires + latest eTag to be set in the request. You may obtain the latest eTag by + performing a get operation. Create operation does not require eTag. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_name: str + :param parameters: Parameters supplied to the CreateOrUpdate View + operation. + :type parameters: ~azure.mgmt.costmanagement.models.View + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: View or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.costmanagement.models.View or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'View') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', response) + if response.status_code == 201: + deserialized = self._deserialize('View', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete_by_scope( + self, scope, view_name, custom_headers=None, raw=False, **operation_config): + """The operation to delete a view. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, + 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + for External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + for External Subscription scope. + :type scope: str + :param view_name: View name + :type view_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'}