From 03c1d0e196168f1649fd9805f372a7ecdf1713e9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Oct 2021 04:11:15 +0000 Subject: [PATCH] CodeGen from PR 16596 in Azure/azure-rest-api-specs Merge 9b3d9cd9ed1c497632847588431c460ba4b2af63 into 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 --- .../azure-mgmt-costmanagement/_meta.json | 2 +- .../mgmt/costmanagement/_configuration.py | 2 +- .../costmanagement/_cost_management_client.py | 33 +- .../azure/mgmt/costmanagement/_metadata.json | 13 +- .../azure/mgmt/costmanagement/_version.py | 2 +- .../mgmt/costmanagement/aio/_configuration.py | 2 +- .../aio/_cost_management_client.py | 33 +- .../costmanagement/aio/operations/__init__.py | 14 +- .../aio/operations/_alerts_operations.py | 8 +- .../aio/operations/_dimensions_operations.py | 8 +- .../aio/operations/_exports_operations.py | 40 +- .../aio/operations/_forecast_operations.py | 16 +- ...ost_report_operation_results_operations.py | 114 +++ ...cost_report_operation_status_operations.py | 112 +++ ...enerate_detailed_cost_report_operations.py | 184 ++++ ...e_reservation_details_report_operations.py | 302 ------ .../aio/operations/_operations.py | 2 +- .../aio/operations/_query_operations.py | 16 +- .../aio/operations/_settings_operations.py | 273 ----- .../aio/operations/_views_operations.py | 24 +- .../mgmt/costmanagement/models/__init__.py | 54 +- .../models/_cost_management_client_enums.py | 45 +- .../mgmt/costmanagement/models/_models.py | 849 ++++++++-------- .../mgmt/costmanagement/models/_models_py3.py | 950 ++++++++++-------- .../costmanagement/operations/__init__.py | 14 +- .../operations/_alerts_operations.py | 8 +- .../operations/_dimensions_operations.py | 8 +- .../operations/_exports_operations.py | 40 +- .../operations/_forecast_operations.py | 16 +- ...ost_report_operation_results_operations.py | 119 +++ ...cost_report_operation_status_operations.py | 117 +++ ...enerate_detailed_cost_report_operations.py | 190 ++++ ...e_reservation_details_report_operations.py | 310 ------ .../costmanagement/operations/_operations.py | 2 +- .../operations/_query_operations.py | 16 +- .../operations/_settings_operations.py | 281 ------ .../operations/_views_operations.py | 24 +- 37 files changed, 2036 insertions(+), 2207 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py delete mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py delete mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_settings_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py delete mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py delete mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json index 8041e01d515b..bd0b23c67053 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "74efe54fbc55c91a1d9213afbb2723747acfddf9", + "commit": "db8c9032475ac28fae40f149f41c26e324c11e38", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/cost-management/resource-manager/readme.md" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py index 0cd20f8ef97a..c3676636d38d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py @@ -42,7 +42,7 @@ def __init__( super(CostManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2019-11-01" + self.api_version = "2021-10-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) self._configure(**kwargs) 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 521cb5222a88..e8a5abe3aba9 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 @@ -19,23 +19,30 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import CostManagementClientConfiguration -from .operations import SettingsOperations +from .operations import ExportsOperations +from .operations import GenerateDetailedCostReportOperations +from .operations import GenerateDetailedCostReportOperationResultsOperations +from .operations import GenerateDetailedCostReportOperationStatusOperations from .operations import ViewsOperations from .operations import AlertsOperations from .operations import ForecastOperations from .operations import DimensionsOperations from .operations import QueryOperations -from .operations import GenerateReservationDetailsReportOperations from .operations import Operations -from .operations import ExportsOperations from . import models class CostManagementClient(object): """CostManagementClient. - :ivar settings: SettingsOperations operations - :vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations + :ivar exports: ExportsOperations operations + :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations + :ivar generate_detailed_cost_report: GenerateDetailedCostReportOperations operations + :vartype generate_detailed_cost_report: azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperations + :ivar generate_detailed_cost_report_operation_results: GenerateDetailedCostReportOperationResultsOperations operations + :vartype generate_detailed_cost_report_operation_results: azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationResultsOperations + :ivar generate_detailed_cost_report_operation_status: GenerateDetailedCostReportOperationStatusOperations operations + :vartype generate_detailed_cost_report_operation_status: azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationStatusOperations :ivar views: ViewsOperations operations :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations :ivar alerts: AlertsOperations operations @@ -46,12 +53,8 @@ class CostManagementClient(object): :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations :ivar query: QueryOperations operations :vartype query: azure.mgmt.costmanagement.operations.QueryOperations - :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations operations - :vartype generate_reservation_details_report: azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.operations.Operations - :ivar exports: ExportsOperations operations - :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param str base_url: Service URL @@ -75,7 +78,13 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.settings = SettingsOperations( + self.exports = ExportsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report = GenerateDetailedCostReportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report_operation_results = GenerateDetailedCostReportOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations( self._client, self._config, self._serialize, self._deserialize) self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) @@ -87,12 +96,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self._config, self._serialize, self._deserialize) - self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( - 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) def _send_request(self, http_request, **kwargs): # type: (HttpRequest, Any) -> HttpResponse diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json index 1e323f28f6ac..4fefcd5778ae 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2019-11-01", - "total_api_version_list": ["2019-11-01"], + "chosen_version": "2021-10-01", + "total_api_version_list": ["2021-10-01"], "client": { "name": "CostManagementClient", "filename": "_cost_management_client", @@ -86,14 +86,15 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "settings": "SettingsOperations", + "exports": "ExportsOperations", + "generate_detailed_cost_report": "GenerateDetailedCostReportOperations", + "generate_detailed_cost_report_operation_results": "GenerateDetailedCostReportOperationResultsOperations", + "generate_detailed_cost_report_operation_status": "GenerateDetailedCostReportOperationStatusOperations", "views": "ViewsOperations", "alerts": "AlertsOperations", "forecast": "ForecastOperations", "dimensions": "DimensionsOperations", "query": "QueryOperations", - "generate_reservation_details_report": "GenerateReservationDetailsReportOperations", - "operations": "Operations", - "exports": "ExportsOperations" + "operations": "Operations" } } \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index cac9f5d10f8b..e5754a47ce68 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py index 22c0705a007a..cadd5e209281 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py @@ -39,7 +39,7 @@ def __init__( super(CostManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential - self.api_version = "2019-11-01" + self.api_version = "2021-10-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py index ab4f0f5bdab7..998802b18513 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py @@ -17,23 +17,30 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import CostManagementClientConfiguration -from .operations import SettingsOperations +from .operations import ExportsOperations +from .operations import GenerateDetailedCostReportOperations +from .operations import GenerateDetailedCostReportOperationResultsOperations +from .operations import GenerateDetailedCostReportOperationStatusOperations from .operations import ViewsOperations from .operations import AlertsOperations from .operations import ForecastOperations from .operations import DimensionsOperations from .operations import QueryOperations -from .operations import GenerateReservationDetailsReportOperations from .operations import Operations -from .operations import ExportsOperations from .. import models class CostManagementClient(object): """CostManagementClient. - :ivar settings: SettingsOperations operations - :vartype settings: azure.mgmt.costmanagement.aio.operations.SettingsOperations + :ivar exports: ExportsOperations operations + :vartype exports: azure.mgmt.costmanagement.aio.operations.ExportsOperations + :ivar generate_detailed_cost_report: GenerateDetailedCostReportOperations operations + :vartype generate_detailed_cost_report: azure.mgmt.costmanagement.aio.operations.GenerateDetailedCostReportOperations + :ivar generate_detailed_cost_report_operation_results: GenerateDetailedCostReportOperationResultsOperations operations + :vartype generate_detailed_cost_report_operation_results: azure.mgmt.costmanagement.aio.operations.GenerateDetailedCostReportOperationResultsOperations + :ivar generate_detailed_cost_report_operation_status: GenerateDetailedCostReportOperationStatusOperations operations + :vartype generate_detailed_cost_report_operation_status: azure.mgmt.costmanagement.aio.operations.GenerateDetailedCostReportOperationStatusOperations :ivar views: ViewsOperations operations :vartype views: azure.mgmt.costmanagement.aio.operations.ViewsOperations :ivar alerts: AlertsOperations operations @@ -44,12 +51,8 @@ class CostManagementClient(object): :vartype dimensions: azure.mgmt.costmanagement.aio.operations.DimensionsOperations :ivar query: QueryOperations operations :vartype query: azure.mgmt.costmanagement.aio.operations.QueryOperations - :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations operations - :vartype generate_reservation_details_report: azure.mgmt.costmanagement.aio.operations.GenerateReservationDetailsReportOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.aio.operations.Operations - :ivar exports: ExportsOperations operations - :vartype exports: azure.mgmt.costmanagement.aio.operations.ExportsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL @@ -72,7 +75,13 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.settings = SettingsOperations( + self.exports = ExportsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report = GenerateDetailedCostReportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report_operation_results = GenerateDetailedCostReportOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations( self._client, self._config, self._serialize, self._deserialize) self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) @@ -84,12 +93,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.query = QueryOperations( self._client, self._config, self._serialize, self._deserialize) - self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( - 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) async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py index c70a4cb564cb..4ee0774295e4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py @@ -6,24 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._settings_operations import SettingsOperations +from ._exports_operations import ExportsOperations +from ._generate_detailed_cost_report_operations import GenerateDetailedCostReportOperations +from ._generate_detailed_cost_report_operation_results_operations import GenerateDetailedCostReportOperationResultsOperations +from ._generate_detailed_cost_report_operation_status_operations import GenerateDetailedCostReportOperationStatusOperations 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 ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations from ._operations import Operations -from ._exports_operations import ExportsOperations __all__ = [ - 'SettingsOperations', + 'ExportsOperations', + 'GenerateDetailedCostReportOperations', + 'GenerateDetailedCostReportOperationResultsOperations', + 'GenerateDetailedCostReportOperationStatusOperations', 'ViewsOperations', 'AlertsOperations', 'ForecastOperations', 'DimensionsOperations', 'QueryOperations', - 'GenerateReservationDetailsReportOperations', 'Operations', - 'ExportsOperations', ] diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py index 216d5ebc7b21..44d4905e2ea7 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py @@ -74,7 +74,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -146,7 +146,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -222,7 +222,7 @@ async def dismiss( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -288,7 +288,7 @@ async def list_external( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py index 090f2e992e2d..7c02e30aa91f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py @@ -83,7 +83,7 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DimensionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResultor None] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DimensionsListResult"] @@ -91,7 +91,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -138,7 +138,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -191,7 +191,7 @@ def by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py index 2f3497eee08b..6d10b5dd8777 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py @@ -43,11 +43,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, scope: str, + expand: Optional[str] = None, **kwargs: Any ) -> "_models.ExportListResult": """The operation to list all exports at the given scope. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -64,6 +65,9 @@ async 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 :keyword callable cls: A custom type or function that will be passed the direct response :return: ExportListResult, or the result of cls(response) :rtype: ~azure.mgmt.costmanagement.models.ExportListResult @@ -74,7 +78,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -87,6 +91,8 @@ async def list( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -113,11 +119,12 @@ async def get( self, scope: str, export_name: str, + expand: Optional[str] = None, **kwargs: Any ) -> "_models.Export": """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 + :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 Billing Account scope and @@ -136,6 +143,9 @@ async 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 :keyword callable cls: A custom type or function that will be passed the direct response :return: Export, or the result of cls(response) :rtype: ~azure.mgmt.costmanagement.models.Export @@ -146,7 +156,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -160,6 +170,8 @@ async def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -193,7 +205,7 @@ async def create_or_update( 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 + :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 Billing Account scope and @@ -224,7 +236,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -277,7 +289,7 @@ async def delete( ) -> None: """The operation to delete a export. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -306,7 +318,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -345,9 +357,9 @@ async def execute( export_name: str, **kwargs: Any ) -> None: - """The operation to execute a export. + """The operation to execute an export. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -376,7 +388,7 @@ async def execute( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -415,9 +427,9 @@ async def get_execution_history( export_name: str, **kwargs: Any ) -> "_models.ExportExecutionListResult": - """The operation to get the execution history of an export for the defined scope by export name. + """The operation to get the execution history of an export for the defined scope and export name. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -446,7 +458,7 @@ async def get_execution_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py index 8524f06621a5..fe9d1610226c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py @@ -46,7 +46,7 @@ async def usage( parameters: "_models.ForecastDefinition", filter: Optional[str] = None, **kwargs: Any - ) -> Optional["_models.QueryResult"]: + ) -> "_models.QueryResult": """Lists the forecast charges for scope defined. :param scope: The scope associated with forecast operations. This includes @@ -74,15 +74,15 @@ async def usage( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryResult, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None + :rtype: ~azure.mgmt.costmanagement.models.QueryResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -111,14 +111,12 @@ async def usage( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -159,7 +157,7 @@ async def external_cloud_provider_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py new file mode 100644 index 000000000000..22db8b939342 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py @@ -0,0 +1,114 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperationResultsOperations: + """GenerateDetailedCostReportOperationResultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + operation_id: str, + scope: str, + **kwargs: Any + ) -> Optional["_models.GenerateDetailedCostReportOperationResult"]: + """Get the result of the specified operation. This link is provided in the + GenerateDetailedCostReport creation request response header. + + :param operation_id: The target operation Id. + :type operation_id: str + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateDetailedCostReportOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateDetailedCostReportOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py new file mode 100644 index 000000000000..7a1faa7d6dc8 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperationStatusOperations: + """GenerateDetailedCostReportOperationStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + operation_id: str, + scope: str, + **kwargs: Any + ) -> "_models.GenerateDetailedCostReportOperationStatuses": + """Get the status of the specified operation. This link is provided in the + GenerateDetailedCostReport creation request response header. + + :param operation_id: The target operation Id. + :type operation_id: str + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateDetailedCostReportOperationStatuses, or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationStatuses + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateDetailedCostReportOperationStatuses"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenerateDetailedCostReportOperationStatuses', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py new file mode 100644 index 000000000000..9272efa7519d --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py @@ -0,0 +1,184 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperations: + """GenerateDetailedCostReportOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_operation_initial( + self, + scope: str, + parameters: "_models.GenerateDetailedCostReportDefinition", + **kwargs: Any + ) -> Optional["_models.GenerateDetailedCostReportOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateDetailedCostReportOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_operation_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenerateDetailedCostReportDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.GenerateDetailedCostReportErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-Consumption-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-Consumption-AsyncOperation')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_operation_initial.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport'} # type: ignore + + async def begin_create_operation( + self, + scope: str, + parameters: "_models.GenerateDetailedCostReportDefinition", + **kwargs: Any + ) -> AsyncLROPoller["_models.GenerateDetailedCostReportOperationResult"]: + """Generates the detailed cost report for provided date range, billing period(Only enterprise + customers) or Invoice Id asynchronously at a certain scope. Call returns a 202 with header + Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the + operation will provide the status and if the operation is completed the blob file where + generated detailed cost report is being stored. + + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 Create detailed cost report operation. + :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GenerateDetailedCostReportOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateDetailedCostReportOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_operation_initial( + scope=scope, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_operation.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py deleted file mode 100644 index 04654269eb88..000000000000 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py +++ /dev/null @@ -1,302 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GenerateReservationDetailsReportOperations: - """GenerateReservationDetailsReportOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.costmanagement.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def _by_billing_account_id_initial( - self, - billing_account_id: str, - start_date: str, - end_date: str, - **kwargs: Any - ) -> Optional["_models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._by_billing_account_id_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _by_billing_account_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - async def begin_by_billing_account_id( - self, - billing_account_id: str, - start_date: str, - end_date: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatus"]: - """Generates the reservations details report for provided date range asynchronously based on - enrollment id. - - :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). - :type billing_account_id: str - :param start_date: Start Date. - :type start_date: str - :param end_date: End Date. - :type end_date: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.OperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._by_billing_account_id_initial( - billing_account_id=billing_account_id, - start_date=start_date, - end_date=end_date, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_by_billing_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - async def _by_billing_profile_id_initial( - self, - billing_account_id: str, - billing_profile_id: str, - start_date: str, - end_date: str, - **kwargs: Any - ) -> Optional["_models.OperationStatus"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._by_billing_profile_id_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _by_billing_profile_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - async def begin_by_billing_profile_id( - self, - billing_account_id: str, - billing_profile_id: str, - start_date: str, - end_date: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.OperationStatus"]: - """Generates the reservations details report for provided date range asynchronously by billing - profile. - - :param billing_account_id: BillingAccount ID. - :type billing_account_id: str - :param billing_profile_id: BillingProfile ID. - :type billing_profile_id: str - :param start_date: Start Date. - :type start_date: str - :param end_date: End Date. - :type end_date: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatus or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.OperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._by_billing_profile_id_initial( - billing_account_id=billing_account_id, - billing_profile_id=billing_profile_id, - start_date=start_date, - end_date=end_date, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_by_billing_profile_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py index e9b536504b06..7b6c315cb02e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py index 7a973c90e3c8..61cb4e5d5a20 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py @@ -45,7 +45,7 @@ async def usage( scope: str, parameters: "_models.QueryDefinition", **kwargs: Any - ) -> Optional["_models.QueryResult"]: + ) -> "_models.QueryResult": """Query the usage data for scope defined. :param scope: The scope associated with query and export operations. This includes @@ -69,15 +69,15 @@ async def usage( :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryResult, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None + :rtype: ~azure.mgmt.costmanagement.models.QueryResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -104,14 +104,12 @@ async def usage( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -147,7 +145,7 @@ async def usage_by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_settings_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_settings_operations.py deleted file mode 100644 index 2a0f8f9e272e..000000000000 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_settings_operations.py +++ /dev/null @@ -1,273 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class SettingsOperations: - """SettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.costmanagement.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SettingsListResult"]: - """Lists all of the settings that have been customized. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SettingsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.SettingsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SettingsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('SettingsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/settings'} # type: ignore - - async def get( - self, - setting_name: str, - **kwargs: Any - ) -> "_models.Setting": - """Retrieves the current value for a specific setting. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Setting, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Setting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Setting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Setting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore - - async def create_or_update( - self, - setting_name: str, - parameters: "_models.Setting", - **kwargs: Any - ) -> "_models.Setting": - """Sets a new value for a specific setting. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :param parameters: Body supplied to the CreateOrUpdate setting operation. - :type parameters: ~azure.mgmt.costmanagement.models.Setting - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Setting, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Setting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Setting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Setting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Setting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore - - async def delete( - self, - setting_name: str, - **kwargs: Any - ) -> None: - """Remove the current value for a specific setting and reverts back to the default value, if - applicable. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py index a82f547d6103..90a77a2a676f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ViewListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ViewListResult"] @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -92,7 +92,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -131,7 +131,7 @@ def list_by_scope( :type scope: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ViewListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ViewListResult"] @@ -139,7 +139,7 @@ def list_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -178,7 +178,7 @@ async def get_next(next_link=None): pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -209,7 +209,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -268,7 +268,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -331,7 +331,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -401,7 +401,7 @@ async def get_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -480,7 +480,7 @@ async def create_or_update_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -563,7 +563,7 @@ async def delete_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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 c55fa14a8390..1d500d574da3 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 @@ -11,7 +11,6 @@ from ._models_py3 import AlertPropertiesDefinition from ._models_py3 import AlertPropertiesDetails from ._models_py3 import AlertsResult - from ._models_py3 import CacheItem from ._models_py3 import CommonExportProperties from ._models_py3 import Dimension from ._models_py3 import DimensionsListResult @@ -19,6 +18,8 @@ from ._models_py3 import ErrorDetails from ._models_py3 import ErrorResponse 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 @@ -28,24 +29,27 @@ from ._models_py3 import ExportProperties 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 GenerateDetailedCostReportDefinition + from ._models_py3 import GenerateDetailedCostReportErrorResponse + from ._models_py3 import GenerateDetailedCostReportOperationResult + from ._models_py3 import GenerateDetailedCostReportOperationStatuses + from ._models_py3 import GenerateDetailedCostReportTimePeriod from ._models_py3 import KpiProperties from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult - from ._models_py3 import OperationStatus from ._models_py3 import PivotProperties from ._models_py3 import ProxyResource - from ._models_py3 import ProxySettingResource from ._models_py3 import QueryAggregation from ._models_py3 import QueryColumn from ._models_py3 import QueryComparisonExpression from ._models_py3 import QueryDataset - from ._models_py3 import QueryDatasetAutoGenerated from ._models_py3 import QueryDatasetConfiguration from ._models_py3 import QueryDefinition from ._models_py3 import QueryFilter - from ._models_py3 import QueryFilterAutoGenerated from ._models_py3 import QueryGrouping from ._models_py3 import QueryResult from ._models_py3 import QueryTimePeriod @@ -58,8 +62,6 @@ from ._models_py3 import ReportConfigSorting from ._models_py3 import ReportConfigTimePeriod from ._models_py3 import Resource - from ._models_py3 import Setting - from ._models_py3 import SettingsListResult from ._models_py3 import Status from ._models_py3 import View from ._models_py3 import ViewListResult @@ -68,7 +70,6 @@ from ._models import AlertPropertiesDefinition # type: ignore from ._models import AlertPropertiesDetails # type: ignore from ._models import AlertsResult # type: ignore - from ._models import CacheItem # type: ignore from ._models import CommonExportProperties # type: ignore from ._models import Dimension # type: ignore from ._models import DimensionsListResult # type: ignore @@ -76,6 +77,8 @@ from ._models import ErrorDetails # type: ignore from ._models import ErrorResponse # type: ignore from ._models import Export # type: ignore + from ._models import ExportDataset # type: ignore + from ._models import ExportDatasetConfiguration # type: ignore from ._models import ExportDefinition # type: ignore from ._models import ExportDeliveryDestination # type: ignore from ._models import ExportDeliveryInfo # type: ignore @@ -85,24 +88,27 @@ from ._models import ExportProperties # type: ignore from ._models import ExportRecurrencePeriod # type: ignore from ._models import ExportSchedule # type: ignore + from ._models import ExportTimePeriod # type: ignore + from ._models import ForecastDataset # type: ignore from ._models import ForecastDefinition # type: ignore + from ._models import GenerateDetailedCostReportDefinition # type: ignore + from ._models import GenerateDetailedCostReportErrorResponse # type: ignore + from ._models import GenerateDetailedCostReportOperationResult # type: ignore + from ._models import GenerateDetailedCostReportOperationStatuses # type: ignore + from ._models import GenerateDetailedCostReportTimePeriod # type: ignore from ._models import KpiProperties # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore - from ._models import OperationStatus # type: ignore from ._models import PivotProperties # type: ignore from ._models import ProxyResource # type: ignore - from ._models import ProxySettingResource # type: ignore from ._models import QueryAggregation # type: ignore from ._models import QueryColumn # type: ignore from ._models import QueryComparisonExpression # type: ignore from ._models import QueryDataset # type: ignore - from ._models import QueryDatasetAutoGenerated # type: ignore from ._models import QueryDatasetConfiguration # type: ignore from ._models import QueryDefinition # type: ignore from ._models import QueryFilter # type: ignore - from ._models import QueryFilterAutoGenerated # type: ignore from ._models import QueryGrouping # type: ignore from ._models import QueryResult # type: ignore from ._models import QueryTimePeriod # type: ignore @@ -115,8 +121,6 @@ from ._models import ReportConfigSorting # type: ignore from ._models import ReportConfigTimePeriod # type: ignore from ._models import Resource # type: ignore - from ._models import Setting # type: ignore - from ._models import SettingsListResult # type: ignore from ._models import Status # type: ignore from ._models import View # type: ignore from ._models import ViewListResult # type: ignore @@ -139,6 +143,7 @@ ForecastType, FormatType, FunctionType, + GenerateDetailedCostReportMetricType, GranularityType, KpiType, MetricType, @@ -146,13 +151,13 @@ OperatorType, PivotType, QueryColumnType, + QueryOperatorType, RecurrenceType, ReportConfigColumnType, ReportConfigSortingDirection, ReportGranularityType, ReportTimeframeType, ReportType, - SettingsPropertiesStartOn, StatusType, TimeframeType, ) @@ -162,7 +167,6 @@ 'AlertPropertiesDefinition', 'AlertPropertiesDetails', 'AlertsResult', - 'CacheItem', 'CommonExportProperties', 'Dimension', 'DimensionsListResult', @@ -170,6 +174,8 @@ 'ErrorDetails', 'ErrorResponse', 'Export', + 'ExportDataset', + 'ExportDatasetConfiguration', 'ExportDefinition', 'ExportDeliveryDestination', 'ExportDeliveryInfo', @@ -179,24 +185,27 @@ 'ExportProperties', 'ExportRecurrencePeriod', 'ExportSchedule', + 'ExportTimePeriod', + 'ForecastDataset', 'ForecastDefinition', + 'GenerateDetailedCostReportDefinition', + 'GenerateDetailedCostReportErrorResponse', + 'GenerateDetailedCostReportOperationResult', + 'GenerateDetailedCostReportOperationStatuses', + 'GenerateDetailedCostReportTimePeriod', 'KpiProperties', 'Operation', 'OperationDisplay', 'OperationListResult', - 'OperationStatus', 'PivotProperties', 'ProxyResource', - 'ProxySettingResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', 'QueryDataset', - 'QueryDatasetAutoGenerated', 'QueryDatasetConfiguration', 'QueryDefinition', 'QueryFilter', - 'QueryFilterAutoGenerated', 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', @@ -209,8 +218,6 @@ 'ReportConfigSorting', 'ReportConfigTimePeriod', 'Resource', - 'Setting', - 'SettingsListResult', 'Status', 'View', 'ViewListResult', @@ -231,6 +238,7 @@ 'ForecastType', 'FormatType', 'FunctionType', + 'GenerateDetailedCostReportMetricType', 'GranularityType', 'KpiType', 'MetricType', @@ -238,13 +246,13 @@ 'OperatorType', 'PivotType', 'QueryColumnType', + 'QueryOperatorType', 'RecurrenceType', 'ReportConfigColumnType', 'ReportConfigSortingDirection', 'ReportGranularityType', 'ReportTimeframeType', 'ReportType', - 'SettingsPropertiesStartOn', 'StatusType', 'TimeframeType', ] 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 eac0fd7748ff..4eb6000f0590 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 @@ -124,7 +124,7 @@ class ChartType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TABLE = "Table" class ExecutionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The status of the export execution. + """The last known status of the export execution. """ QUEUED = "Queued" @@ -143,7 +143,8 @@ class ExecutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SCHEDULED = "Scheduled" class ExportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of the query. + """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. """ USAGE = "Usage" @@ -176,7 +177,7 @@ class ForecastType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AMORTIZED_COST = "AmortizedCost" class FormatType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The format of the export being delivered. + """The format of the export being delivered. Currently only 'Csv' is supported. """ CSV = "Csv" @@ -185,13 +186,17 @@ class FunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The name of the aggregation function to use. """ - AVG = "Avg" - MAX = "Max" - MIN = "Min" SUM = "Sum" +class GenerateDetailedCostReportMetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the detailed report. By default ActualCost is provided + """ + + ACTUAL_COST = "ActualCost" + AMORTIZED_COST = "AmortizedCost" + class GranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The granularity of rows in the query. + """The granularity of rows in the export. Currently only 'Daily' is supported. """ DAILY = "Daily" @@ -215,9 +220,13 @@ class OperationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The status of the long running operation. """ - RUNNING = "Running" + IN_PROGRESS = "InProgress" COMPLETED = "Completed" FAILED = "Failed" + QUEUED = "Queued" + NO_DATA_FOUND = "NoDataFound" + READY_TO_DOWNLOAD = "ReadyToDownload" + TIMED_OUT = "TimedOut" class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The operator to use for comparison. @@ -240,6 +249,12 @@ class QueryColumnType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TAG = "Tag" DIMENSION = "Dimension" +class QueryOperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operator to use for comparison. + """ + + IN_ENUM = "In" + class RecurrenceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The schedule recurrence. """ @@ -288,25 +303,15 @@ class ReportType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USAGE = "Usage" -class SettingsPropertiesStartOn(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Indicates what scope Cost Management in the Azure portal should default to. Allowed values: - LastUsed. - """ - - LAST_USED = "LastUsed" - SCOPE_PICKER = "ScopePicker" - SPECIFIC_SCOPE = "SpecificScope" - class StatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The status of the schedule. Whether active or not. If inactive, the export's scheduled - execution is paused. + """The status of the export's schedule. If 'Inactive', the export's schedule is paused. """ ACTIVE = "Active" INACTIVE = "Inactive" class TimeframeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The time frame for pulling data for the query. If custom, then a specific time period must be + """The time frame for pulling data for the export. If custom, then a specific time period must be provided. """ 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 ffd3292fd2df..e52430ca9d4e 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 @@ -82,7 +82,7 @@ class Alert(Resource): :type close_time: str :param modification_time: dateTime in which alert was last modified. :type modification_time: str - :param status_modification_user_name: + :param status_modification_user_name: User who last modified the alert. :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: str @@ -275,80 +275,44 @@ def __init__( self.next_link = None -class CacheItem(msrest.serialization.Model): - """CacheItem. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Resource ID used by Resource Manager to uniquely identify the scope. - :type id: str - :param name: Required. Display name for the scope. - :type name: str - :param channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, - Internal, Unknown. - :type channel: str - :param subchannel: Required. Indicates the type of modern account. Allowed values include: - Individual, Enterprise, Partner, Indirect, NotApplicable. - :type subchannel: str - :param parent: Resource ID of the parent scope. For instance, subscription's resource ID for a - resource group or a management group resource ID for a subscription. - :type parent: str - :param status: Indicates the status of the scope. Status only applies to subscriptions and - billing accounts. - :type status: str - """ - - _validation = { - 'id': {'required': True}, - 'name': {'required': True}, - 'channel': {'required': True}, - 'subchannel': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'channel': {'key': 'channel', 'type': 'str'}, - 'subchannel': {'key': 'subchannel', 'type': 'str'}, - 'parent': {'key': 'parent', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CacheItem, self).__init__(**kwargs) - self.id = kwargs['id'] - self.name = kwargs['name'] - self.channel = kwargs['channel'] - self.subchannel = kwargs['subchannel'] - self.parent = kwargs.get('parent', None) - self.status = kwargs.get('status', None) - - class CommonExportProperties(msrest.serialization.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. Possible values include: "Csv". + :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. + :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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.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'}, + 'partition_data': {'key': 'partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } def __init__( @@ -359,10 +323,13 @@ def __init__( self.format = kwargs.get('format', None) self.delivery_info = kwargs['delivery_info'] self.definition = kwargs['definition'] + self.run_history = kwargs.get('run_history', None) + self.partition_data = kwargs.get('partition_data', None) + self.next_run_time_estimate = None class Dimension(Resource): - """Dimension. + """List of Dimension. Variables are only populated by the server, and will be ignored when sending a request. @@ -380,7 +347,7 @@ class Dimension(Resource): :vartype filter_enabled: bool :ivar grouping_enabled: Grouping enabled. :vartype grouping_enabled: bool - :param data: + :param data: Dimension data. :type data: list[str] :ivar total: Total number of data for the dimension. :vartype total: int @@ -488,7 +455,7 @@ class DismissAlertPayload(msrest.serialization.Model): :type close_time: str :param modification_time: dateTime in which alert was last modified. :type modification_time: str - :param status_modification_user_name: + :param status_modification_user_name: User who last modified the alert. :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: str @@ -625,7 +592,7 @@ def __init__( class Export(ProxyResource): - """A export resource. + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -638,12 +605,22 @@ class Export(ProxyResource): :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. Possible values include: "Csv". + :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: Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Has definition for the export. + :param definition: 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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -652,6 +629,7 @@ class Export(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -662,6 +640,9 @@ class Export(ProxyResource): 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'partition_data': {'key': 'properties.partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -673,25 +654,74 @@ def __init__( 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.partition_data = kwargs.get('partition_data', None) + self.next_run_time_estimate = None self.schedule = kwargs.get('schedule', None) +class ExportDataset(msrest.serialization.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(msrest.serialization.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(msrest.serialization.Model): - """The definition of a query. + """The definition of an export. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the query. Possible values include: "Usage", "ActualCost", - "AmortizedCost". + :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 query. If custom, then a + :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 query. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param data_set: Has definition for data in this query. - :type data_set: ~azure.mgmt.costmanagement.models.QueryDatasetAutoGenerated + :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 = { @@ -702,8 +732,8 @@ class ExportDefinition(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetAutoGenerated'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, } def __init__( @@ -718,21 +748,30 @@ def __init__( class ExportDeliveryDestination(msrest.serialization.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 Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . + """This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Azure Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ). All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The resource id of the storage account where exports will be - delivered. + :param resource_id: The resource id of the storage account where exports will be delivered. + This is not required if a sasToken and storageAccount are specified. :type resource_id: str - :param container: Required. The name of the container where exports will be uploaded. + :param container: Required. The name of the container where exports will be uploaded. If the + container does not exist it will be created. :type container: str :param root_folder_path: The name of the directory where exports will be uploaded. :type root_folder_path: str + :param sas_token: A SAS token for the storage account. For a restricted set of Azure customers + this together with storageAccount can be specified instead of resourceId. Note: the value + returned by the API for this property will always be obfuscated. Returning this same obfuscated + value will not result in the SAS token being updated. To update this value a new SAS token must + be specified. + :type sas_token: str + :param storage_account: The storage account where exports will be uploaded. For a restricted + set of Azure customers this together with sasToken can be specified instead of resourceId. + :type storage_account: str """ _validation = { - 'resource_id': {'required': True}, 'container': {'required': True}, } @@ -740,6 +779,8 @@ class ExportDeliveryDestination(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'container': {'key': 'container', 'type': 'str'}, 'root_folder_path': {'key': 'rootFolderPath', 'type': 'str'}, + 'sas_token': {'key': 'sasToken', 'type': 'str'}, + 'storage_account': {'key': 'storageAccount', 'type': 'str'}, } def __init__( @@ -747,9 +788,11 @@ def __init__( **kwargs ): super(ExportDeliveryDestination, self).__init__(**kwargs) - self.resource_id = kwargs['resource_id'] + self.resource_id = kwargs.get('resource_id', None) self.container = kwargs['container'] self.root_folder_path = kwargs.get('root_folder_path', None) + self.sas_token = kwargs.get('sas_token', None) + self.storage_account = kwargs.get('storage_account', None) class ExportDeliveryInfo(msrest.serialization.Model): @@ -777,8 +820,8 @@ def __init__( self.destination = kwargs['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. @@ -788,41 +831,44 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of 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", "NewDataNotAvailable", "DataNotAvailable". + :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. + 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.datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: ~datetime.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.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: The common properties of the export. + :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'}, @@ -831,6 +877,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__( @@ -846,14 +893,15 @@ def __init__( 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(msrest.serialization.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] """ @@ -901,14 +949,26 @@ def __init__( class ExportProperties(CommonExportProperties): """The 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. Possible values include: "Csv". + :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. + :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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -916,12 +976,16 @@ class ExportProperties(CommonExportProperties): _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'}, + 'partition_data': {'key': 'partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, } @@ -963,25 +1027,19 @@ def __init__( class ExportSchedule(msrest.serialization.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 than start date. :type recurrence_period: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, @@ -994,10 +1052,74 @@ def __init__( ): super(ExportSchedule, self).__init__(**kwargs) self.status = kwargs.get('status', None) - self.recurrence = kwargs['recurrence'] + self.recurrence = kwargs.get('recurrence', None) self.recurrence_period = kwargs.get('recurrence_period', None) +class ExportTimePeriod(msrest.serialization.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. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: ~datetime.datetime + :param to: Required. The end date for export data. + :type to: ~datetime.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(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs['from_property'] + self.to = kwargs['to'] + + +class ForecastDataset(msrest.serialization.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(msrest.serialization.Model): """The definition of a forecast. @@ -1013,7 +1135,7 @@ class ForecastDefinition(msrest.serialization.Model): :param time_period: Has time period for pulling data for the forecast. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod :param dataset: Required. Has definition for data in this forecast. - :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset + :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. @@ -1030,7 +1152,7 @@ class ForecastDefinition(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, + 'dataset': {'key': 'dataset', 'type': 'ForecastDataset'}, 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } @@ -1048,6 +1170,190 @@ def __init__( self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', None) +class GenerateDetailedCostReportDefinition(msrest.serialization.Model): + """The definition of a cost detailed report. + + :param metric: The type of the detailed report. By default ActualCost is provided. Possible + values include: "ActualCost", "AmortizedCost". + :type metric: str or ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportMetricType + :param time_period: Has time period for pulling data for the cost detailed report. Can only + have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided + current month cost is provided. + :type time_period: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportTimePeriod + :param billing_period: Billing Period in YearMonth(e.g. 202008) format. Only for legacy + enterprise customers can use this. Can only have one of either timePeriod or invoiceId or + billingPeriod parameters. If none provided current month cost is provided. + :type billing_period: str + :param invoice_id: Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can + only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided + current month cost is provided. + :type invoice_id: str + :param customer_id: Customer Id for Modern (Invoice Id and billing profile is also required for + this). + :type customer_id: str + """ + + _attribute_map = { + 'metric': {'key': 'metric', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'GenerateDetailedCostReportTimePeriod'}, + 'billing_period': {'key': 'billingPeriod', 'type': 'str'}, + 'invoice_id': {'key': 'invoiceId', 'type': 'str'}, + 'customer_id': {'key': 'customerId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateDetailedCostReportDefinition, self).__init__(**kwargs) + self.metric = kwargs.get('metric', None) + self.time_period = kwargs.get('time_period', None) + self.billing_period = kwargs.get('billing_period', None) + self.invoice_id = kwargs.get('invoice_id', None) + self.customer_id = kwargs.get('customer_id', None) + + +class GenerateDetailedCostReportErrorResponse(msrest.serialization.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: + + +* + 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead. + +* + 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 + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateDetailedCostReportErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class GenerateDetailedCostReportOperationResult(msrest.serialization.Model): + """The result of the long running operation for cost detailed report. + + :param id: The id of the long running operation. + :type id: str + :param name: The name of the long running operation. + :type name: str + :param type: The type of the long running operation. + :type type: str + :param download_url: The URL to download the generated report. + :type download_url: str + :param valid_till: The time at which report URL becomes invalid/expires in UTC e.g. + 2020-12-08T05:55:59.4394737Z. + :type valid_till: ~datetime.datetime + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'download_url': {'key': 'properties.downloadUrl', 'type': 'str'}, + 'valid_till': {'key': 'properties.validTill', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateDetailedCostReportOperationResult, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.download_url = kwargs.get('download_url', None) + self.valid_till = kwargs.get('valid_till', None) + + +class GenerateDetailedCostReportOperationStatuses(msrest.serialization.Model): + """The status of the long running operation for cost detailed report. + + :param id: The id of the long running operation. + :type id: str + :param name: The name of the long running operation. + :type name: str + :param status: The status of the long running operation. + :type status: ~azure.mgmt.costmanagement.models.Status + :param type: The type of the long running operation. + :type type: str + :param error: The details of the error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails + :param download_url: The URL to download the generated report. + :type download_url: str + :param valid_till: The time at which report URL becomes invalid/expires in UTC e.g. + 2020-12-08T05:55:59.4394737Z. + :type valid_till: ~datetime.datetime + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'Status'}, + 'type': {'key': 'type', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + 'download_url': {'key': 'properties.downloadUrl', 'type': 'str'}, + 'valid_till': {'key': 'properties.validTill', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateDetailedCostReportOperationStatuses, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.status = kwargs.get('status', None) + self.type = kwargs.get('type', None) + self.error = kwargs.get('error', None) + self.download_url = kwargs.get('download_url', None) + self.valid_till = kwargs.get('valid_till', None) + + +class GenerateDetailedCostReportTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the cost detailed report. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. The start date to pull data from. example format 2020-03-15. + :type start: str + :param end: Required. The end date to pull data to. example format 2020-03-15. + :type end: str + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'str'}, + 'end': {'key': 'end', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenerateDetailedCostReportTimePeriod, self).__init__(**kwargs) + self.start = kwargs['start'] + self.end = kwargs['end'] + + class KpiProperties(msrest.serialization.Model): """Each KPI must contain a 'type' and 'enabled' key. @@ -1170,33 +1476,6 @@ def __init__( self.next_link = None -class OperationStatus(msrest.serialization.Model): - """The status of the long running operation. - - :param status: The status of the long running operation. - :type status: ~azure.mgmt.costmanagement.models.Status - :param report_url: The URL to download the generated report. - :type report_url: str - :param valid_until: The time at which report URL becomes invalid. - :type valid_until: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'Status'}, - 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, - 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatus, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.report_url = kwargs.get('report_url', None) - self.valid_until = kwargs.get('valid_until', None) - - class PivotProperties(msrest.serialization.Model): """Each pivot must contain a 'type' and 'name'. @@ -1220,46 +1499,6 @@ def __init__( self.name = kwargs.get('name', None) -class ProxySettingResource(msrest.serialization.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 kind: Resource kind. - :vartype kind: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxySettingResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = None - self.type = None - - class QueryAggregation(msrest.serialization.Model): """The aggregation expression to be used in the query. @@ -1268,7 +1507,7 @@ class QueryAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Avg", "Max", "Min", "Sum". + include: "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -1292,7 +1531,7 @@ def __init__( class QueryColumn(msrest.serialization.Model): - """QueryColumn. + """QueryColumn properties. :param name: The name of column. :type name: str @@ -1321,9 +1560,8 @@ class QueryComparisonExpression(msrest.serialization.Model): :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 operator: Required. The operator to use for comparison. Possible values include: "In". + :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1394,50 +1632,6 @@ def __init__( self.filter = kwargs.get('filter', None) -class QueryDatasetAutoGenerated(msrest.serialization.Model): - """The definition of data present in the query. - - :param granularity: The granularity of rows in the query. 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 query. The key of each - item in the dictionary is the alias for the aggregated column. Query can have up to 2 - aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param grouping: Array of group by expression to use in the query. Query can have up to 2 group - by clauses. - :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: The filter expression to use in the query. Please reference our Query API REST - documentation for how to properly format the filter. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated - """ - - _validation = { - 'grouping': {'max_items': 2, 'min_items': 0}, - } - - _attribute_map = { - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, - 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, - 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, - 'filter': {'key': 'filter', 'type': 'QueryFilterAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryDatasetAutoGenerated, 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.filter = kwargs.get('filter', None) - - class QueryDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the query. @@ -1507,10 +1701,12 @@ class QueryFilter(msrest.serialization.Model): :type and_property: list[~azure.mgmt.costmanagement.models.QueryFilter] :param or_property: The logical "OR" expression. Must have at least 2 items. :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilter] - :param dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter + :param dimension: Has comparison expression for a dimension. + :type dimension: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param tag: Has comparison expression for a tag. + :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression """ _validation = { @@ -1521,8 +1717,9 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, + 'not_property': {'key': 'not', 'type': 'QueryFilter'}, + 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1532,44 +1729,9 @@ def __init__( super(QueryFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.dimensions = kwargs.get('dimensions', None) - self.tags = kwargs.get('tags', None) - - -class QueryFilterAutoGenerated(msrest.serialization.Model): - """The filter expression to be used in the export. - - :param and_property: The logical "AND" expression. Must have at least 2 items. - :type and_property: list[~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated] - :param or_property: The logical "OR" expression. Must have at least 2 items. - :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated] - :param dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - """ - - _validation = { - 'and_property': {'min_items': 2}, - 'or_property': {'min_items': 2}, - } - - _attribute_map = { - 'and_property': {'key': 'and', 'type': '[QueryFilterAutoGenerated]'}, - 'or_property': {'key': 'or', 'type': '[QueryFilterAutoGenerated]'}, - 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryFilterAutoGenerated, self).__init__(**kwargs) - self.and_property = kwargs.get('and_property', None) - self.or_property = kwargs.get('or_property', None) - self.dimensions = kwargs.get('dimensions', None) - self.tags = kwargs.get('tags', None) + self.not_property = kwargs.get('not_property', None) + self.dimension = kwargs.get('dimension', None) + self.tag = kwargs.get('tag', None) class QueryGrouping(msrest.serialization.Model): @@ -1616,13 +1778,6 @@ class QueryResult(Resource): :vartype type: str :ivar tags: A set of 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 - :ivar location: Resource location. - :vartype location: str - :ivar sku: Resource SKU. - :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns. @@ -1636,8 +1791,6 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, - 'location': {'readonly': True}, - 'sku': {'readonly': True}, } _attribute_map = { @@ -1645,9 +1798,6 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, @@ -1658,9 +1808,6 @@ def __init__( **kwargs ): super(QueryResult, self).__init__(**kwargs) - self.e_tag = kwargs.get('e_tag', None) - self.location = None - self.sku = None self.next_link = kwargs.get('next_link', None) self.columns = kwargs.get('columns', None) self.rows = kwargs.get('rows', None) @@ -1704,7 +1851,7 @@ class ReportConfigAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Avg", "Max", "Min", "Sum". + include: "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -1838,14 +1985,12 @@ class ReportConfigFilter(msrest.serialization.Model): :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 dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag_key: Has comparison expression for a tag key. - :type tag_key: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag_value: Has comparison expression for a tag value. - :type tag_value: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :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 = { @@ -1856,10 +2001,9 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, - 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, - 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -1869,10 +2013,9 @@ def __init__( super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.dimensions = kwargs.get('dimensions', None) - self.tags = kwargs.get('tags', None) - self.tag_key = kwargs.get('tag_key', None) - self.tag_value = kwargs.get('tag_value', None) + self.not_property = kwargs.get('not_property', None) + self.dimension = kwargs.get('dimension', None) + self.tag = kwargs.get('tag', None) class ReportConfigGrouping(msrest.serialization.Model): @@ -1966,92 +2109,11 @@ def __init__( self.to = kwargs['to'] -class Setting(ProxySettingResource): - """State of the myscope setting. - - 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 kind: Resource kind. - :vartype kind: str - :ivar type: Resource type. - :vartype type: str - :param scope: Sets the default scope the current user will see when they sign into Azure Cost - Management in the Azure portal. - :type scope: str - :param start_on: Indicates what scope Cost Management in the Azure portal should default to. - Allowed values: LastUsed. Possible values include: "LastUsed", "ScopePicker", "SpecificScope". - :type start_on: str or ~azure.mgmt.costmanagement.models.SettingsPropertiesStartOn - :param cache: Array of scopes with additional details used by Cost Management in the Azure - portal. - :type cache: list[~azure.mgmt.costmanagement.models.CacheItem] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'start_on': {'key': 'properties.startOn', 'type': 'str'}, - 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(Setting, self).__init__(**kwargs) - self.scope = kwargs.get('scope', None) - self.start_on = kwargs.get('start_on', None) - self.cache = kwargs.get('cache', None) - - -class SettingsListResult(msrest.serialization.Model): - """Result of listing settings. It contains a list of available settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of settings. - :vartype value: list[~azure.mgmt.costmanagement.models.Setting] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True, 'max_items': 10, 'min_items': 0}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Setting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class Status(msrest.serialization.Model): """The status of the long running operation. - :param status: The status of the long running operation. Possible values include: "Running", - "Completed", "Failed". + :param status: The status of the long running operation. Possible values include: "InProgress", + "Completed", "Failed", "Queued", "NoDataFound", "ReadyToDownload", "TimedOut". :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType """ @@ -2105,10 +2167,6 @@ class View(ProxyResource): :vartype created_on: ~datetime.datetime :ivar modified_on: Date when the user last modified this view. :vartype modified_on: ~datetime.datetime - :ivar date_range: Selected date range for viewing cost in. - :vartype date_range: str - :ivar currency: Selected currency. - :vartype currency: str :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 @@ -2132,10 +2190,8 @@ class View(ProxyResource): :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 data_set: Has definition for data in this report config. - :type data_set: ~azure.mgmt.costmanagement.models.ReportConfigDataset - :ivar include_monetary_commitment: Include monetary commitment. - :vartype include_monetary_commitment: bool + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset """ _validation = { @@ -2144,9 +2200,6 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'date_range': {'readonly': True}, - 'currency': {'readonly': True}, - 'include_monetary_commitment': {'readonly': True}, } _attribute_map = { @@ -2158,8 +2211,6 @@ class View(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'str'}, 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, - 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, - 'currency': {'key': 'properties.currency', 'type': 'str'}, 'chart': {'key': 'properties.chart', 'type': 'str'}, 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, 'metric': {'key': 'properties.metric', 'type': 'str'}, @@ -2168,8 +2219,7 @@ class View(ProxyResource): 'type_properties_query_type': {'key': 'properties.query.type', 'type': 'str'}, 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, - 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, } def __init__( @@ -2181,8 +2231,6 @@ def __init__( self.scope = kwargs.get('scope', None) self.created_on = None self.modified_on = None - self.date_range = None - self.currency = None self.chart = kwargs.get('chart', None) self.accumulated = kwargs.get('accumulated', None) self.metric = kwargs.get('metric', None) @@ -2191,8 +2239,7 @@ def __init__( self.type_properties_query_type = kwargs.get('type_properties_query_type', None) self.timeframe = kwargs.get('timeframe', None) self.time_period = kwargs.get('time_period', None) - self.data_set = kwargs.get('data_set', None) - self.include_monetary_commitment = None + self.dataset = kwargs.get('dataset', None) class ViewListResult(msrest.serialization.Model): 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 e3f7e70197dd..7a221670dfa2 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 @@ -87,7 +87,7 @@ class Alert(Resource): :type close_time: str :param modification_time: dateTime in which alert was last modified. :type modification_time: str - :param status_modification_user_name: + :param status_modification_user_name: User who last modified the alert. :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: str @@ -313,87 +313,44 @@ def __init__( self.next_link = None -class CacheItem(msrest.serialization.Model): - """CacheItem. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Resource ID used by Resource Manager to uniquely identify the scope. - :type id: str - :param name: Required. Display name for the scope. - :type name: str - :param channel: Required. Indicates the account type. Allowed values include: EA, PAYG, Modern, - Internal, Unknown. - :type channel: str - :param subchannel: Required. Indicates the type of modern account. Allowed values include: - Individual, Enterprise, Partner, Indirect, NotApplicable. - :type subchannel: str - :param parent: Resource ID of the parent scope. For instance, subscription's resource ID for a - resource group or a management group resource ID for a subscription. - :type parent: str - :param status: Indicates the status of the scope. Status only applies to subscriptions and - billing accounts. - :type status: str - """ - - _validation = { - 'id': {'required': True}, - 'name': {'required': True}, - 'channel': {'required': True}, - 'subchannel': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'channel': {'key': 'channel', 'type': 'str'}, - 'subchannel': {'key': 'subchannel', 'type': 'str'}, - 'parent': {'key': 'parent', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - name: str, - channel: str, - subchannel: str, - parent: Optional[str] = None, - status: Optional[str] = None, - **kwargs - ): - super(CacheItem, self).__init__(**kwargs) - self.id = id - self.name = name - self.channel = channel - self.subchannel = subchannel - self.parent = parent - self.status = status - - class CommonExportProperties(msrest.serialization.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. Possible values include: "Csv". + :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. + :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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.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'}, + 'partition_data': {'key': 'partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } def __init__( @@ -402,16 +359,21 @@ def __init__( delivery_info: "ExportDeliveryInfo", definition: "ExportDefinition", format: Optional[Union[str, "FormatType"]] = None, + run_history: Optional["ExportExecutionListResult"] = None, + partition_data: Optional[bool] = None, **kwargs ): super(CommonExportProperties, self).__init__(**kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition + self.run_history = run_history + self.partition_data = partition_data + self.next_run_time_estimate = None class Dimension(Resource): - """Dimension. + """List of Dimension. Variables are only populated by the server, and will be ignored when sending a request. @@ -429,7 +391,7 @@ class Dimension(Resource): :vartype filter_enabled: bool :ivar grouping_enabled: Grouping enabled. :vartype grouping_enabled: bool - :param data: + :param data: Dimension data. :type data: list[str] :ivar total: Total number of data for the dimension. :vartype total: int @@ -539,7 +501,7 @@ class DismissAlertPayload(msrest.serialization.Model): :type close_time: str :param modification_time: dateTime in which alert was last modified. :type modification_time: str - :param status_modification_user_name: + :param status_modification_user_name: User who last modified the alert. :type status_modification_user_name: str :param status_modification_time: dateTime in which the alert status was last modified. :type status_modification_time: str @@ -692,7 +654,7 @@ def __init__( class Export(ProxyResource): - """A export resource. + """An export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -705,12 +667,22 @@ class Export(ProxyResource): :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. Possible values include: "Csv". + :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: Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Has definition for the export. + :param definition: 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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -719,6 +691,7 @@ class Export(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -729,6 +702,9 @@ class Export(ProxyResource): 'format': {'key': 'properties.format', 'type': 'str'}, 'delivery_info': {'key': 'properties.deliveryInfo', 'type': 'ExportDeliveryInfo'}, 'definition': {'key': 'properties.definition', 'type': 'ExportDefinition'}, + 'run_history': {'key': 'properties.runHistory', 'type': 'ExportExecutionListResult'}, + 'partition_data': {'key': 'properties.partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -739,6 +715,8 @@ def __init__( format: Optional[Union[str, "FormatType"]] = None, delivery_info: Optional["ExportDeliveryInfo"] = None, definition: Optional["ExportDefinition"] = None, + run_history: Optional["ExportExecutionListResult"] = None, + partition_data: Optional[bool] = None, schedule: Optional["ExportSchedule"] = None, **kwargs ): @@ -746,25 +724,79 @@ def __init__( self.format = format self.delivery_info = delivery_info self.definition = definition + self.run_history = run_history + self.partition_data = partition_data + self.next_run_time_estimate = None self.schedule = schedule +class ExportDataset(msrest.serialization.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: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["ExportDatasetConfiguration"] = None, + **kwargs + ): + super(ExportDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + + +class ExportDatasetConfiguration(msrest.serialization.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: Optional[List[str]] = None, + **kwargs + ): + super(ExportDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + class ExportDefinition(msrest.serialization.Model): - """The definition of a query. + """The definition of an export. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the query. Possible values include: "Usage", "ActualCost", - "AmortizedCost". + :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 query. If custom, then a + :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 query. - :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param data_set: Has definition for data in this query. - :type data_set: ~azure.mgmt.costmanagement.models.QueryDatasetAutoGenerated + :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 = { @@ -775,8 +807,8 @@ class ExportDefinition(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetAutoGenerated'}, + 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, } def __init__( @@ -784,8 +816,8 @@ def __init__( *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], - time_period: Optional["QueryTimePeriod"] = None, - data_set: Optional["QueryDatasetAutoGenerated"] = None, + time_period: Optional["ExportTimePeriod"] = None, + data_set: Optional["ExportDataset"] = None, **kwargs ): super(ExportDefinition, self).__init__(**kwargs) @@ -796,21 +828,30 @@ def __init__( class ExportDeliveryDestination(msrest.serialization.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 Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . + """This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Azure Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ). All required parameters must be populated in order to send to Azure. - :param resource_id: Required. The resource id of the storage account where exports will be - delivered. + :param resource_id: The resource id of the storage account where exports will be delivered. + This is not required if a sasToken and storageAccount are specified. :type resource_id: str - :param container: Required. The name of the container where exports will be uploaded. + :param container: Required. The name of the container where exports will be uploaded. If the + container does not exist it will be created. :type container: str :param root_folder_path: The name of the directory where exports will be uploaded. :type root_folder_path: str + :param sas_token: A SAS token for the storage account. For a restricted set of Azure customers + this together with storageAccount can be specified instead of resourceId. Note: the value + returned by the API for this property will always be obfuscated. Returning this same obfuscated + value will not result in the SAS token being updated. To update this value a new SAS token must + be specified. + :type sas_token: str + :param storage_account: The storage account where exports will be uploaded. For a restricted + set of Azure customers this together with sasToken can be specified instead of resourceId. + :type storage_account: str """ _validation = { - 'resource_id': {'required': True}, 'container': {'required': True}, } @@ -818,20 +859,26 @@ class ExportDeliveryDestination(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'container': {'key': 'container', 'type': 'str'}, 'root_folder_path': {'key': 'rootFolderPath', 'type': 'str'}, + 'sas_token': {'key': 'sasToken', 'type': 'str'}, + 'storage_account': {'key': 'storageAccount', 'type': 'str'}, } def __init__( self, *, - resource_id: str, container: str, + resource_id: Optional[str] = None, root_folder_path: Optional[str] = None, + sas_token: Optional[str] = None, + storage_account: Optional[str] = None, **kwargs ): super(ExportDeliveryDestination, self).__init__(**kwargs) self.resource_id = resource_id self.container = container self.root_folder_path = root_folder_path + self.sas_token = sas_token + self.storage_account = storage_account class ExportDeliveryInfo(msrest.serialization.Model): @@ -861,8 +908,8 @@ def __init__( 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. @@ -872,41 +919,44 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of 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", "NewDataNotAvailable", "DataNotAvailable". + :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. + 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.datetime :param processing_start_time: The time when export was picked up to be executed. :type processing_start_time: ~datetime.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.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: The common properties of the export. + :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'}, @@ -915,11 +965,13 @@ 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, *, + e_tag: Optional[str] = None, execution_type: Optional[Union[str, "ExecutionType"]] = None, status: Optional[Union[str, "ExecutionStatus"]] = None, submitted_by: Optional[str] = None, @@ -928,9 +980,10 @@ def __init__( processing_end_time: Optional[datetime.datetime] = None, file_name: Optional[str] = None, run_settings: Optional["CommonExportProperties"] = None, + error: Optional["ErrorDetails"] = None, **kwargs ): - super(ExportExecution, self).__init__(**kwargs) + super(ExportExecution, self).__init__(e_tag=e_tag, **kwargs) self.execution_type = execution_type self.status = status self.submitted_by = submitted_by @@ -939,14 +992,15 @@ def __init__( self.processing_end_time = processing_end_time self.file_name = file_name self.run_settings = run_settings + self.error = error class ExportExecutionListResult(msrest.serialization.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] """ @@ -994,14 +1048,26 @@ def __init__( class ExportProperties(CommonExportProperties): """The 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. Possible values include: "Csv". + :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. + :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 + :param partition_data: If set to true, exported data will be partitioned by size and placed in + a blob directory together with a manifest file. Note: this option is currently available only + for modern commerce scopes. + :type partition_data: bool + :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.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -1009,12 +1075,16 @@ class ExportProperties(CommonExportProperties): _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'}, + 'partition_data': {'key': 'partitionData', 'type': 'bool'}, + 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, } @@ -1024,10 +1094,12 @@ def __init__( delivery_info: "ExportDeliveryInfo", definition: "ExportDefinition", format: Optional[Union[str, "FormatType"]] = None, + run_history: Optional["ExportExecutionListResult"] = None, + partition_data: Optional[bool] = None, schedule: Optional["ExportSchedule"] = None, **kwargs ): - super(ExportProperties, self).__init__(format=format, delivery_info=delivery_info, definition=definition, **kwargs) + super(ExportProperties, self).__init__(format=format, delivery_info=delivery_info, definition=definition, run_history=run_history, partition_data=partition_data, **kwargs) self.schedule = schedule @@ -1064,25 +1136,19 @@ def __init__( class ExportSchedule(msrest.serialization.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 than start date. :type recurrence_period: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, @@ -1092,8 +1158,8 @@ class ExportSchedule(msrest.serialization.Model): def __init__( self, *, - recurrence: Union[str, "RecurrenceType"], status: Optional[Union[str, "StatusType"]] = None, + recurrence: Optional[Union[str, "RecurrenceType"]] = None, recurrence_period: Optional["ExportRecurrencePeriod"] = None, **kwargs ): @@ -1103,6 +1169,78 @@ def __init__( self.recurrence_period = recurrence_period +class ExportTimePeriod(msrest.serialization.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. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date for export data. + :type from_property: ~datetime.datetime + :param to: Required. The end date for export data. + :type to: ~datetime.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: datetime.datetime, + to: datetime.datetime, + **kwargs + ): + super(ExportTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class ForecastDataset(msrest.serialization.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: Optional[Union[str, "GranularityType"]] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + filter: Optional["QueryFilter"] = None, + **kwargs + ): + super(ForecastDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.filter = filter + + class ForecastDefinition(msrest.serialization.Model): """The definition of a forecast. @@ -1118,7 +1256,7 @@ class ForecastDefinition(msrest.serialization.Model): :param time_period: Has time period for pulling data for the forecast. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod :param dataset: Required. Has definition for data in this forecast. - :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset + :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. @@ -1135,7 +1273,7 @@ class ForecastDefinition(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, - 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, + 'dataset': {'key': 'dataset', 'type': 'ForecastDataset'}, 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } @@ -1145,7 +1283,7 @@ def __init__( *, type: Union[str, "ForecastType"], timeframe: Union[str, "ForecastTimeframeType"], - dataset: "QueryDataset", + dataset: "ForecastDataset", time_period: Optional["QueryTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, @@ -1160,6 +1298,215 @@ def __init__( self.include_fresh_partial_cost = include_fresh_partial_cost +class GenerateDetailedCostReportDefinition(msrest.serialization.Model): + """The definition of a cost detailed report. + + :param metric: The type of the detailed report. By default ActualCost is provided. Possible + values include: "ActualCost", "AmortizedCost". + :type metric: str or ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportMetricType + :param time_period: Has time period for pulling data for the cost detailed report. Can only + have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided + current month cost is provided. + :type time_period: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportTimePeriod + :param billing_period: Billing Period in YearMonth(e.g. 202008) format. Only for legacy + enterprise customers can use this. Can only have one of either timePeriod or invoiceId or + billingPeriod parameters. If none provided current month cost is provided. + :type billing_period: str + :param invoice_id: Invoice Id for PayAsYouGo customers and Modern billing profile scope. Can + only have one of either timePeriod or invoiceId or billingPeriod parameters. If none provided + current month cost is provided. + :type invoice_id: str + :param customer_id: Customer Id for Modern (Invoice Id and billing profile is also required for + this). + :type customer_id: str + """ + + _attribute_map = { + 'metric': {'key': 'metric', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'GenerateDetailedCostReportTimePeriod'}, + 'billing_period': {'key': 'billingPeriod', 'type': 'str'}, + 'invoice_id': {'key': 'invoiceId', 'type': 'str'}, + 'customer_id': {'key': 'customerId', 'type': 'str'}, + } + + def __init__( + self, + *, + metric: Optional[Union[str, "GenerateDetailedCostReportMetricType"]] = None, + time_period: Optional["GenerateDetailedCostReportTimePeriod"] = None, + billing_period: Optional[str] = None, + invoice_id: Optional[str] = None, + customer_id: Optional[str] = None, + **kwargs + ): + super(GenerateDetailedCostReportDefinition, self).__init__(**kwargs) + self.metric = metric + self.time_period = time_period + self.billing_period = billing_period + self.invoice_id = invoice_id + self.customer_id = customer_id + + +class GenerateDetailedCostReportErrorResponse(msrest.serialization.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: + + +* + 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead. + +* + 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 + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetails"] = None, + **kwargs + ): + super(GenerateDetailedCostReportErrorResponse, self).__init__(**kwargs) + self.error = error + + +class GenerateDetailedCostReportOperationResult(msrest.serialization.Model): + """The result of the long running operation for cost detailed report. + + :param id: The id of the long running operation. + :type id: str + :param name: The name of the long running operation. + :type name: str + :param type: The type of the long running operation. + :type type: str + :param download_url: The URL to download the generated report. + :type download_url: str + :param valid_till: The time at which report URL becomes invalid/expires in UTC e.g. + 2020-12-08T05:55:59.4394737Z. + :type valid_till: ~datetime.datetime + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'download_url': {'key': 'properties.downloadUrl', 'type': 'str'}, + 'valid_till': {'key': 'properties.validTill', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + download_url: Optional[str] = None, + valid_till: Optional[datetime.datetime] = None, + **kwargs + ): + super(GenerateDetailedCostReportOperationResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.download_url = download_url + self.valid_till = valid_till + + +class GenerateDetailedCostReportOperationStatuses(msrest.serialization.Model): + """The status of the long running operation for cost detailed report. + + :param id: The id of the long running operation. + :type id: str + :param name: The name of the long running operation. + :type name: str + :param status: The status of the long running operation. + :type status: ~azure.mgmt.costmanagement.models.Status + :param type: The type of the long running operation. + :type type: str + :param error: The details of the error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails + :param download_url: The URL to download the generated report. + :type download_url: str + :param valid_till: The time at which report URL becomes invalid/expires in UTC e.g. + 2020-12-08T05:55:59.4394737Z. + :type valid_till: ~datetime.datetime + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'Status'}, + 'type': {'key': 'type', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + 'download_url': {'key': 'properties.downloadUrl', 'type': 'str'}, + 'valid_till': {'key': 'properties.validTill', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional["Status"] = None, + type: Optional[str] = None, + error: Optional["ErrorDetails"] = None, + download_url: Optional[str] = None, + valid_till: Optional[datetime.datetime] = None, + **kwargs + ): + super(GenerateDetailedCostReportOperationStatuses, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.type = type + self.error = error + self.download_url = download_url + self.valid_till = valid_till + + +class GenerateDetailedCostReportTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the cost detailed report. + + All required parameters must be populated in order to send to Azure. + + :param start: Required. The start date to pull data from. example format 2020-03-15. + :type start: str + :param end: Required. The end date to pull data to. example format 2020-03-15. + :type end: str + """ + + _validation = { + 'start': {'required': True}, + 'end': {'required': True}, + } + + _attribute_map = { + 'start': {'key': 'start', 'type': 'str'}, + 'end': {'key': 'end', 'type': 'str'}, + } + + def __init__( + self, + *, + start: str, + end: str, + **kwargs + ): + super(GenerateDetailedCostReportTimePeriod, self).__init__(**kwargs) + self.start = start + self.end = end + + class KpiProperties(msrest.serialization.Model): """Each KPI must contain a 'type' and 'enabled' key. @@ -1288,37 +1635,6 @@ def __init__( self.next_link = None -class OperationStatus(msrest.serialization.Model): - """The status of the long running operation. - - :param status: The status of the long running operation. - :type status: ~azure.mgmt.costmanagement.models.Status - :param report_url: The URL to download the generated report. - :type report_url: str - :param valid_until: The time at which report URL becomes invalid. - :type valid_until: ~datetime.datetime - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'Status'}, - 'report_url': {'key': 'properties.reportUrl', 'type': 'str'}, - 'valid_until': {'key': 'properties.validUntil', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - status: Optional["Status"] = None, - report_url: Optional[str] = None, - valid_until: Optional[datetime.datetime] = None, - **kwargs - ): - super(OperationStatus, self).__init__(**kwargs) - self.status = status - self.report_url = report_url - self.valid_until = valid_until - - class PivotProperties(msrest.serialization.Model): """Each pivot must contain a 'type' and 'name'. @@ -1345,46 +1661,6 @@ def __init__( self.name = name -class ProxySettingResource(msrest.serialization.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 kind: Resource kind. - :vartype kind: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxySettingResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.kind = None - self.type = None - - class QueryAggregation(msrest.serialization.Model): """The aggregation expression to be used in the query. @@ -1393,7 +1669,7 @@ class QueryAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Avg", "Max", "Min", "Sum". + include: "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -1420,7 +1696,7 @@ def __init__( class QueryColumn(msrest.serialization.Model): - """QueryColumn. + """QueryColumn properties. :param name: The name of column. :type name: str @@ -1452,9 +1728,8 @@ class QueryComparisonExpression(msrest.serialization.Model): :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 operator: Required. The operator to use for comparison. Possible values include: "In". + :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1475,7 +1750,7 @@ def __init__( self, *, name: str, - operator: Union[str, "OperatorType"], + operator: Union[str, "QueryOperatorType"], values: List[str], **kwargs ): @@ -1535,56 +1810,6 @@ def __init__( self.filter = filter -class QueryDatasetAutoGenerated(msrest.serialization.Model): - """The definition of data present in the query. - - :param granularity: The granularity of rows in the query. 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 query. The key of each - item in the dictionary is the alias for the aggregated column. Query can have up to 2 - aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.QueryAggregation] - :param grouping: Array of group by expression to use in the query. Query can have up to 2 group - by clauses. - :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: The filter expression to use in the query. Please reference our Query API REST - documentation for how to properly format the filter. - :type filter: ~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated - """ - - _validation = { - 'grouping': {'max_items': 2, 'min_items': 0}, - } - - _attribute_map = { - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'QueryDatasetConfiguration'}, - 'aggregation': {'key': 'aggregation', 'type': '{QueryAggregation}'}, - 'grouping': {'key': 'grouping', 'type': '[QueryGrouping]'}, - 'filter': {'key': 'filter', 'type': 'QueryFilterAutoGenerated'}, - } - - def __init__( - self, - *, - granularity: Optional[Union[str, "GranularityType"]] = None, - configuration: Optional["QueryDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "QueryAggregation"]] = None, - grouping: Optional[List["QueryGrouping"]] = None, - filter: Optional["QueryFilterAutoGenerated"] = None, - **kwargs - ): - super(QueryDatasetAutoGenerated, self).__init__(**kwargs) - self.granularity = granularity - self.configuration = configuration - self.aggregation = aggregation - self.grouping = grouping - self.filter = filter - - class QueryDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the query. @@ -1661,10 +1886,12 @@ class QueryFilter(msrest.serialization.Model): :type and_property: list[~azure.mgmt.costmanagement.models.QueryFilter] :param or_property: The logical "OR" expression. Must have at least 2 items. :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilter] - :param dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.QueryFilter + :param dimension: Has comparison expression for a dimension. + :type dimension: ~azure.mgmt.costmanagement.models.QueryComparisonExpression + :param tag: Has comparison expression for a tag. + :type tag: ~azure.mgmt.costmanagement.models.QueryComparisonExpression """ _validation = { @@ -1675,8 +1902,9 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, + 'not_property': {'key': 'not', 'type': 'QueryFilter'}, + 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1684,56 +1912,17 @@ def __init__( *, and_property: Optional[List["QueryFilter"]] = None, or_property: Optional[List["QueryFilter"]] = None, - dimensions: Optional["QueryComparisonExpression"] = None, - tags: Optional["QueryComparisonExpression"] = None, + not_property: Optional["QueryFilter"] = None, + dimension: Optional["QueryComparisonExpression"] = None, + tag: Optional["QueryComparisonExpression"] = None, **kwargs ): super(QueryFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.dimensions = dimensions - self.tags = tags - - -class QueryFilterAutoGenerated(msrest.serialization.Model): - """The filter expression to be used in the export. - - :param and_property: The logical "AND" expression. Must have at least 2 items. - :type and_property: list[~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated] - :param or_property: The logical "OR" expression. Must have at least 2 items. - :type or_property: list[~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated] - :param dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.QueryComparisonExpression - """ - - _validation = { - 'and_property': {'min_items': 2}, - 'or_property': {'min_items': 2}, - } - - _attribute_map = { - 'and_property': {'key': 'and', 'type': '[QueryFilterAutoGenerated]'}, - 'or_property': {'key': 'or', 'type': '[QueryFilterAutoGenerated]'}, - 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, - } - - def __init__( - self, - *, - and_property: Optional[List["QueryFilterAutoGenerated"]] = None, - or_property: Optional[List["QueryFilterAutoGenerated"]] = None, - dimensions: Optional["QueryComparisonExpression"] = None, - tags: Optional["QueryComparisonExpression"] = None, - **kwargs - ): - super(QueryFilterAutoGenerated, self).__init__(**kwargs) - self.and_property = and_property - self.or_property = or_property - self.dimensions = dimensions - self.tags = tags + self.not_property = not_property + self.dimension = dimension + self.tag = tag class QueryGrouping(msrest.serialization.Model): @@ -1783,13 +1972,6 @@ class QueryResult(Resource): :vartype type: str :ivar tags: A set of 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 - :ivar location: Resource location. - :vartype location: str - :ivar sku: Resource SKU. - :vartype sku: str :param next_link: The link (url) to the next page of results. :type next_link: str :param columns: Array of columns. @@ -1803,8 +1985,6 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, - 'location': {'readonly': True}, - 'sku': {'readonly': True}, } _attribute_map = { @@ -1812,9 +1992,6 @@ class QueryResult(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, @@ -1823,16 +2000,12 @@ class QueryResult(Resource): def __init__( self, *, - e_tag: Optional[str] = None, next_link: Optional[str] = None, columns: Optional[List["QueryColumn"]] = None, rows: Optional[List[List[Any]]] = None, **kwargs ): super(QueryResult, self).__init__(**kwargs) - self.e_tag = e_tag - self.location = None - self.sku = None self.next_link = next_link self.columns = columns self.rows = rows @@ -1879,7 +2052,7 @@ class ReportConfigAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Avg", "Max", "Min", "Sum". + include: "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -2029,14 +2202,12 @@ class ReportConfigFilter(msrest.serialization.Model): :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 dimensions: Has comparison expression for a dimension. - :type dimensions: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tags: A set of tags. Has comparison expression for a tag. - :type tags: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag_key: Has comparison expression for a tag key. - :type tag_key: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag_value: Has comparison expression for a tag value. - :type tag_value: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :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 = { @@ -2047,10 +2218,9 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, - 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, - 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, - 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -2058,19 +2228,17 @@ def __init__( *, and_property: Optional[List["ReportConfigFilter"]] = None, or_property: Optional[List["ReportConfigFilter"]] = None, - dimensions: Optional["ReportConfigComparisonExpression"] = None, - tags: Optional["ReportConfigComparisonExpression"] = None, - tag_key: Optional["ReportConfigComparisonExpression"] = None, - tag_value: Optional["ReportConfigComparisonExpression"] = None, + not_property: Optional["ReportConfigFilter"] = None, + dimension: Optional["ReportConfigComparisonExpression"] = None, + tag: Optional["ReportConfigComparisonExpression"] = None, **kwargs ): super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.dimensions = dimensions - self.tags = tags - self.tag_key = tag_key - self.tag_value = tag_value + self.not_property = not_property + self.dimension = dimension + self.tag = tag class ReportConfigGrouping(msrest.serialization.Model): @@ -2173,96 +2341,11 @@ def __init__( self.to = to -class Setting(ProxySettingResource): - """State of the myscope setting. - - 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 kind: Resource kind. - :vartype kind: str - :ivar type: Resource type. - :vartype type: str - :param scope: Sets the default scope the current user will see when they sign into Azure Cost - Management in the Azure portal. - :type scope: str - :param start_on: Indicates what scope Cost Management in the Azure portal should default to. - Allowed values: LastUsed. Possible values include: "LastUsed", "ScopePicker", "SpecificScope". - :type start_on: str or ~azure.mgmt.costmanagement.models.SettingsPropertiesStartOn - :param cache: Array of scopes with additional details used by Cost Management in the Azure - portal. - :type cache: list[~azure.mgmt.costmanagement.models.CacheItem] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'kind': {'readonly': True, 'max_length': 10, 'min_length': 0}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'start_on': {'key': 'properties.startOn', 'type': 'str'}, - 'cache': {'key': 'properties.cache', 'type': '[CacheItem]'}, - } - - def __init__( - self, - *, - scope: Optional[str] = None, - start_on: Optional[Union[str, "SettingsPropertiesStartOn"]] = None, - cache: Optional[List["CacheItem"]] = None, - **kwargs - ): - super(Setting, self).__init__(**kwargs) - self.scope = scope - self.start_on = start_on - self.cache = cache - - -class SettingsListResult(msrest.serialization.Model): - """Result of listing settings. It contains a list of available settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of settings. - :vartype value: list[~azure.mgmt.costmanagement.models.Setting] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True, 'max_items': 10, 'min_items': 0}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Setting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class Status(msrest.serialization.Model): """The status of the long running operation. - :param status: The status of the long running operation. Possible values include: "Running", - "Completed", "Failed". + :param status: The status of the long running operation. Possible values include: "InProgress", + "Completed", "Failed", "Queued", "NoDataFound", "ReadyToDownload", "TimedOut". :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType """ @@ -2318,10 +2401,6 @@ class View(ProxyResource): :vartype created_on: ~datetime.datetime :ivar modified_on: Date when the user last modified this view. :vartype modified_on: ~datetime.datetime - :ivar date_range: Selected date range for viewing cost in. - :vartype date_range: str - :ivar currency: Selected currency. - :vartype currency: str :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 @@ -2345,10 +2424,8 @@ class View(ProxyResource): :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 data_set: Has definition for data in this report config. - :type data_set: ~azure.mgmt.costmanagement.models.ReportConfigDataset - :ivar include_monetary_commitment: Include monetary commitment. - :vartype include_monetary_commitment: bool + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset """ _validation = { @@ -2357,9 +2434,6 @@ class View(ProxyResource): 'type': {'readonly': True}, 'created_on': {'readonly': True}, 'modified_on': {'readonly': True}, - 'date_range': {'readonly': True}, - 'currency': {'readonly': True}, - 'include_monetary_commitment': {'readonly': True}, } _attribute_map = { @@ -2371,8 +2445,6 @@ class View(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'str'}, 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, - 'date_range': {'key': 'properties.dateRange', 'type': 'str'}, - 'currency': {'key': 'properties.currency', 'type': 'str'}, 'chart': {'key': 'properties.chart', 'type': 'str'}, 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, 'metric': {'key': 'properties.metric', 'type': 'str'}, @@ -2381,8 +2453,7 @@ class View(ProxyResource): 'type_properties_query_type': {'key': 'properties.query.type', 'type': 'str'}, 'timeframe': {'key': 'properties.query.timeframe', 'type': 'str'}, 'time_period': {'key': 'properties.query.timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, - 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, + 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, } def __init__( @@ -2399,7 +2470,7 @@ def __init__( type_properties_query_type: Optional[Union[str, "ReportType"]] = None, timeframe: Optional[Union[str, "ReportTimeframeType"]] = None, time_period: Optional["ReportConfigTimePeriod"] = None, - data_set: Optional["ReportConfigDataset"] = None, + dataset: Optional["ReportConfigDataset"] = None, **kwargs ): super(View, self).__init__(e_tag=e_tag, **kwargs) @@ -2407,8 +2478,6 @@ def __init__( self.scope = scope self.created_on = None self.modified_on = None - self.date_range = None - self.currency = None self.chart = chart self.accumulated = accumulated self.metric = metric @@ -2417,8 +2486,7 @@ def __init__( self.type_properties_query_type = type_properties_query_type self.timeframe = timeframe self.time_period = time_period - self.data_set = data_set - self.include_monetary_commitment = None + self.dataset = dataset class ViewListResult(msrest.serialization.Model): 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 c70a4cb564cb..4ee0774295e4 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 @@ -6,24 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._settings_operations import SettingsOperations +from ._exports_operations import ExportsOperations +from ._generate_detailed_cost_report_operations import GenerateDetailedCostReportOperations +from ._generate_detailed_cost_report_operation_results_operations import GenerateDetailedCostReportOperationResultsOperations +from ._generate_detailed_cost_report_operation_status_operations import GenerateDetailedCostReportOperationStatusOperations 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 ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations from ._operations import Operations -from ._exports_operations import ExportsOperations __all__ = [ - 'SettingsOperations', + 'ExportsOperations', + 'GenerateDetailedCostReportOperations', + 'GenerateDetailedCostReportOperationResultsOperations', + 'GenerateDetailedCostReportOperationStatusOperations', 'ViewsOperations', 'AlertsOperations', 'ForecastOperations', 'DimensionsOperations', 'QueryOperations', - 'GenerateReservationDetailsReportOperations', '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 index 13969e75db88..29f7bb5887cc 100644 --- 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 @@ -79,7 +79,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -152,7 +152,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -229,7 +229,7 @@ def dismiss( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -296,7 +296,7 @@ def list_external( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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 ff843ebbf69e..8e62588185de 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 @@ -88,7 +88,7 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DimensionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResultor None] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DimensionsListResult"] @@ -96,7 +96,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -143,7 +143,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -197,7 +197,7 @@ def by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): 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 89eefe5166d4..0e8a0f2b945f 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 @@ -47,12 +47,13 @@ def __init__(self, client, config, serializer, deserializer): def list( self, scope, # type: str + expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.ExportListResult" """The operation to list all exports at the given scope. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -69,6 +70,9 @@ 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 :keyword callable cls: A custom type or function that will be passed the direct response :return: ExportListResult, or the result of cls(response) :rtype: ~azure.mgmt.costmanagement.models.ExportListResult @@ -79,7 +83,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -92,6 +96,8 @@ def list( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -118,12 +124,13 @@ def get( self, scope, # type: str export_name, # type: str + expand=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.Export" """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 + :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 Billing Account scope and @@ -142,6 +149,9 @@ 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 :keyword callable cls: A custom type or function that will be passed the direct response :return: Export, or the result of cls(response) :rtype: ~azure.mgmt.costmanagement.models.Export @@ -152,7 +162,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -166,6 +176,8 @@ def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] @@ -200,7 +212,7 @@ def create_or_update( 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 + :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 Billing Account scope and @@ -231,7 +243,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -285,7 +297,7 @@ def delete( # type: (...) -> None """The operation to delete a export. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -314,7 +326,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -354,9 +366,9 @@ def execute( **kwargs # type: Any ): # type: (...) -> None - """The operation to execute a export. + """The operation to execute an export. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -385,7 +397,7 @@ def execute( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -425,9 +437,9 @@ def get_execution_history( **kwargs # type: Any ): # type: (...) -> "_models.ExportExecutionListResult" - """The operation to get the execution history of an export for the defined scope by export name. + """The operation to get the execution history of an export for the defined scope and export name. - :param scope: The scope associated with query and export operations. This includes + :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 Billing Account scope and @@ -456,7 +468,7 @@ def get_execution_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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 index 71c2e338e1e5..8e35af7d8602 100644 --- 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 @@ -51,7 +51,7 @@ def usage( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Optional["_models.QueryResult"] + # type: (...) -> "_models.QueryResult" """Lists the forecast charges for scope defined. :param scope: The scope associated with forecast operations. This includes @@ -79,15 +79,15 @@ def usage( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryResult, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None + :rtype: ~azure.mgmt.costmanagement.models.QueryResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -116,14 +116,12 @@ def usage( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -165,7 +163,7 @@ def external_cloud_provider_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py new file mode 100644 index 000000000000..9e1c480805d6 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py @@ -0,0 +1,119 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperationResultsOperations(object): + """GenerateDetailedCostReportOperationResultsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + operation_id, # type: str + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenerateDetailedCostReportOperationResult"] + """Get the result of the specified operation. This link is provided in the + GenerateDetailedCostReport creation request response header. + + :param operation_id: The target operation Id. + :type operation_id: str + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateDetailedCostReportOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateDetailedCostReportOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py new file mode 100644 index 000000000000..d61dd54da874 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py @@ -0,0 +1,117 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperationStatusOperations(object): + """GenerateDetailedCostReportOperationStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + operation_id, # type: str + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GenerateDetailedCostReportOperationStatuses" + """Get the status of the specified operation. This link is provided in the + GenerateDetailedCostReport creation request response header. + + :param operation_id: The target operation Id. + :type operation_id: str + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenerateDetailedCostReportOperationStatuses, or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationStatuses + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateDetailedCostReportOperationStatuses"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenerateDetailedCostReportOperationStatuses', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py new file mode 100644 index 000000000000..a4c6fabba2aa --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py @@ -0,0 +1,190 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GenerateDetailedCostReportOperations(object): + """GenerateDetailedCostReportOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.costmanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_operation_initial( + self, + scope, # type: str + parameters, # type: "_models.GenerateDetailedCostReportDefinition" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenerateDetailedCostReportOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenerateDetailedCostReportOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_operation_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenerateDetailedCostReportDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.GenerateDetailedCostReportErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-Consumption-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-Consumption-AsyncOperation')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_operation_initial.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport'} # type: ignore + + def begin_create_operation( + self, + scope, # type: str + parameters, # type: "_models.GenerateDetailedCostReportDefinition" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenerateDetailedCostReportOperationResult"] + """Generates the detailed cost report for provided date range, billing period(Only enterprise + customers) or Invoice Id asynchronously at a certain scope. Call returns a 202 with header + Azure-Consumption-AsyncOperation providing a link to the operation created. A call on the + operation will provide the status and if the operation is completed the blob file where + generated detailed cost report is being stored. + + :param scope: The scope associated with usage details operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, + '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount + scope. Also, Modern Commerce Account scopes are + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount 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 Create detailed cost report operation. + :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenerateDetailedCostReportOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.GenerateDetailedCostReportOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenerateDetailedCostReportOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_operation_initial( + scope=scope, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenerateDetailedCostReportOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_operation.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport'} # type: ignore diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py deleted file mode 100644 index 4c93c64e8755..000000000000 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py +++ /dev/null @@ -1,310 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class GenerateReservationDetailsReportOperations(object): - """GenerateReservationDetailsReportOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.costmanagement.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def _by_billing_account_id_initial( - self, - billing_account_id, # type: str - start_date, # type: str - end_date, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._by_billing_account_id_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _by_billing_account_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - def begin_by_billing_account_id( - self, - billing_account_id, # type: str - start_date, # type: str - end_date, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatus"] - """Generates the reservations details report for provided date range asynchronously based on - enrollment id. - - :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). - :type billing_account_id: str - :param start_date: Start Date. - :type start_date: str - :param end_date: End Date. - :type end_date: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatus or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.OperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._by_billing_account_id_initial( - billing_account_id=billing_account_id, - start_date=start_date, - end_date=end_date, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_by_billing_account_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - def _by_billing_profile_id_initial( - self, - billing_account_id, # type: str - billing_profile_id, # type: str - start_date, # type: str - end_date, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationStatus"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationStatus"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._by_billing_profile_id_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['startDate'] = self._serialize.query("start_date", start_date, 'str') - query_parameters['endDate'] = self._serialize.query("end_date", end_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _by_billing_profile_id_initial.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore - - def begin_by_billing_profile_id( - self, - billing_account_id, # type: str - billing_profile_id, # type: str - start_date, # type: str - end_date, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationStatus"] - """Generates the reservations details report for provided date range asynchronously by billing - profile. - - :param billing_account_id: BillingAccount ID. - :type billing_account_id: str - :param billing_profile_id: BillingProfile ID. - :type billing_profile_id: str - :param start_date: Start Date. - :type start_date: str - :param end_date: End Date. - :type end_date: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatus or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.OperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._by_billing_profile_id_initial( - billing_account_id=billing_account_id, - billing_profile_id=billing_profile_id, - start_date=start_date, - end_date=end_date, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'billingAccountId': self._serialize.url("billing_account_id", billing_account_id, 'str'), - 'billingProfileId': self._serialize.url("billing_profile_id", billing_profile_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_by_billing_profile_id.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport'} # type: ignore 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 4a538a66f2c5..6ad6b276336f 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): 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 b5dd2dc857ec..77e237aaad5b 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 @@ -50,7 +50,7 @@ def usage( parameters, # type: "_models.QueryDefinition" **kwargs # type: Any ): - # type: (...) -> Optional["_models.QueryResult"] + # type: (...) -> "_models.QueryResult" """Query the usage data for scope defined. :param scope: The scope associated with query and export operations. This includes @@ -74,15 +74,15 @@ def usage( :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryResult, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None + :rtype: ~azure.mgmt.costmanagement.models.QueryResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -109,14 +109,12 @@ def usage( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -153,7 +151,7 @@ def usage_by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py deleted file mode 100644 index 3140937a8c4c..000000000000 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py +++ /dev/null @@ -1,281 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SettingsOperations(object): - """SettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.costmanagement.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SettingsListResult"] - """Lists all of the settings that have been customized. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SettingsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.SettingsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SettingsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SettingsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.CostManagement/settings'} # type: ignore - - def get( - self, - setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Setting" - """Retrieves the current value for a specific setting. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Setting, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Setting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Setting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Setting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore - - def create_or_update( - self, - setting_name, # type: str - parameters, # type: "_models.Setting" - **kwargs # type: Any - ): - # type: (...) -> "_models.Setting" - """Sets a new value for a specific setting. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :param parameters: Body supplied to the CreateOrUpdate setting operation. - :type parameters: ~azure.mgmt.costmanagement.models.Setting - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Setting, or the result of cls(response) - :rtype: ~azure.mgmt.costmanagement.models.Setting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Setting"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Setting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Setting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore - - def delete( - self, - setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Remove the current value for a specific setting and reverts back to the default value, if - applicable. - - :param setting_name: Name of the setting. Allowed values: myscope. - :type setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'settingName': self._serialize.url("setting_name", setting_name, 'str', max_length=32, min_length=0), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/providers/Microsoft.CostManagement/settings/{settingName}'} # type: ignore 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 index d7512a2a7003..91c76e3e9fa9 100644 --- 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 @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ViewListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ViewListResult"] @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -97,7 +97,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -137,7 +137,7 @@ def list_by_scope( :type scope: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ViewListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ViewListResult"] @@ -145,7 +145,7 @@ def list_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -184,7 +184,7 @@ def get_next(next_link=None): pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -216,7 +216,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -276,7 +276,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -340,7 +340,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -411,7 +411,7 @@ def get_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL @@ -491,7 +491,7 @@ def create_or_update_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -575,7 +575,7 @@ def delete_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" + api_version = "2021-10-01" accept = "application/json" # Construct URL