From dd112423c6f094468633e6224ddd53ed76de5724 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Tue, 8 Jun 2021 13:50:33 +0800 Subject: [PATCH] [AutoRelease] t2-costmanagement-2021-06-08-65205 (#19144) * CodeGen from PR 14584 in Azure/azure-rest-api-specs Create readme.md (#14584) * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines --- .../azure-mgmt-costmanagement/CHANGELOG.md | 32 + .../azure-mgmt-costmanagement/MANIFEST.in | 1 + .../azure-mgmt-costmanagement/_meta.json | 11 + .../mgmt/costmanagement/_configuration.py | 2 +- .../costmanagement/_cost_management_client.py | 28 + .../azure/mgmt/costmanagement/_metadata.json | 68 +- .../azure/mgmt/costmanagement/_version.py | 2 +- .../mgmt/costmanagement/aio/_configuration.py | 2 +- .../aio/_cost_management_client.py | 27 + .../costmanagement/aio/operations/__init__.py | 4 + .../aio/operations/_alerts_operations.py | 24 +- .../aio/operations/_dimensions_operations.py | 16 +- .../aio/operations/_exports_operations.py | 64 +- .../aio/operations/_forecast_operations.py | 24 +- ...e_reservation_details_report_operations.py | 302 ++++++ .../aio/operations/_operations.py | 6 +- .../aio/operations/_query_operations.py | 24 +- .../aio/operations/_settings_operations.py | 273 ++++++ .../aio/operations/_views_operations.py | 56 +- .../mgmt/costmanagement/models/__init__.py | 51 +- .../models/_cost_management_client_enums.py | 32 +- .../mgmt/costmanagement/models/_models.py | 765 ++++++++------- .../mgmt/costmanagement/models/_models_py3.py | 868 +++++++++--------- .../costmanagement/operations/__init__.py | 4 + .../operations/_alerts_operations.py | 16 +- .../operations/_dimensions_operations.py | 12 +- .../operations/_exports_operations.py | 52 +- .../operations/_forecast_operations.py | 20 +- ...e_reservation_details_report_operations.py | 310 +++++++ .../costmanagement/operations/_operations.py | 4 +- .../operations/_query_operations.py | 20 +- .../operations/_settings_operations.py | 281 ++++++ .../operations/_views_operations.py | 40 +- .../azure-mgmt-costmanagement/setup.py | 2 +- shared_requirements.txt | 1 + 35 files changed, 2433 insertions(+), 1011 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/_meta.json create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py create 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_reservation_details_report_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md index 9884b9bdcbf3..e96b3fc3f47e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md @@ -1,5 +1,37 @@ # Release History +## 2.0.0 (2021-06-08) + +**Features** + + - Model QueryResult has a new parameter sku + - Model QueryResult has a new parameter e_tag + - Model QueryResult has a new parameter location + - Model View has a new parameter date_range + - Model View has a new parameter data_set + - Model View has a new parameter include_monetary_commitment + - Model View has a new parameter currency + - Model ExportExecution has a new parameter tags + - Added operation group GenerateReservationDetailsReportOperations + - Added operation group SettingsOperations + +**Breaking changes** + + - Parameter recurrence of model ExportSchedule is now required + - Operation ExportsOperations.list has a new signature + - Operation ExportsOperations.get has a new signature + - Model Export no longer has parameter run_history + - Model Export no longer has parameter next_run_time_estimate + - Model View no longer has parameter dataset + - Model ExportExecution no longer has parameter e_tag + - Model ExportExecution no longer has parameter error + - Model CommonExportProperties no longer has parameter run_history + - Model CommonExportProperties no longer has parameter next_run_time_estimate + - Model ExportProperties no longer has parameter run_history + - Model ExportProperties no longer has parameter next_run_time_estimate + - Model QueryFilter has a new signature + - Model ReportConfigFilter has a new signature + ## 1.0.0 (2021-02-04) **Features** diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in b/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in +++ b/sdk/costmanagement/azure-mgmt-costmanagement/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json new file mode 100644 index 000000000000..03051a9b4540 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.0", + "@autorest/modelerfour@4.19.2" + ], + "commit": "67528b3e539b96ccaaf82c360f5715184e467e21", + "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.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "readme": "specification/cost-management/resource-manager/readme.md" +} \ No newline at end of file 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 de6672ba6aea..0cd20f8ef97a 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 = "2020-06-01" + self.api_version = "2019-11-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 b723c5bf5563..521cb5222a88 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 @@ -16,13 +16,16 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import CostManagementClientConfiguration +from .operations import SettingsOperations 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 @@ -31,6 +34,8 @@ class CostManagementClient(object): """CostManagementClient. + :ivar settings: SettingsOperations operations + :vartype settings: azure.mgmt.costmanagement.operations.SettingsOperations :ivar views: ViewsOperations operations :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations :ivar alerts: AlertsOperations operations @@ -41,6 +46,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 @@ -48,6 +55,7 @@ class CostManagementClient(object): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -64,8 +72,11 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self.settings = SettingsOperations( + self._client, self._config, self._serialize, self._deserialize) self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) self.alerts = AlertsOperations( @@ -76,11 +87,28 @@ 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 + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() 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 4af5173a5c26..1e323f28f6ac 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": "2020-06-01", - "total_api_version_list": ["2020-06-01"], + "chosen_version": "2019-11-01", + "total_api_version_list": ["2019-11-01"], "client": { "name": "CostManagementClient", "filename": "_cost_management_client", @@ -8,8 +8,10 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": true + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CostManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -22,7 +24,7 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -30,26 +32,68 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_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\": [\"TokenCredential\"]}}}", + "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", "views": "ViewsOperations", "alerts": "AlertsOperations", "forecast": "ForecastOperations", "dimensions": "DimensionsOperations", "query": "QueryOperations", + "generate_reservation_details_report": "GenerateReservationDetailsReportOperations", "operations": "Operations", "exports": "ExportsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ 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 c47f66669f1b..48944bf3938a 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 = "1.0.0" +VERSION = "2.0.0" 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 c87b423ec0ec..22c0705a007a 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 = "2020-06-01" + self.api_version = "2019-11-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 06db2b2dd471..ab4f0f5bdab7 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -16,11 +17,13 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import CostManagementClientConfiguration +from .operations import SettingsOperations 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 @@ -29,6 +32,8 @@ class CostManagementClient(object): """CostManagementClient. + :ivar settings: SettingsOperations operations + :vartype settings: azure.mgmt.costmanagement.aio.operations.SettingsOperations :ivar views: ViewsOperations operations :vartype views: azure.mgmt.costmanagement.aio.operations.ViewsOperations :ivar alerts: AlertsOperations operations @@ -39,6 +44,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 @@ -46,6 +53,7 @@ class CostManagementClient(object): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -61,8 +69,11 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self.settings = SettingsOperations( + self._client, self._config, self._serialize, self._deserialize) self.views = ViewsOperations( self._client, self._config, self._serialize, self._deserialize) self.alerts = AlertsOperations( @@ -73,11 +84,27 @@ 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. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() 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 6065b201f9cc..c70a4cb564cb 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,20 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._settings_operations import SettingsOperations 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', '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 3b5600ee9a15..216d5ebc7b21 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, scope: str, - **kwargs + **kwargs: Any ) -> "_models.AlertsResult": """Lists the alerts for scope defined. @@ -74,7 +74,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -98,7 +98,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertsResult', pipeline_response) @@ -113,7 +113,7 @@ async def get( self, scope: str, alert_id: str, - **kwargs + **kwargs: Any ) -> "_models.Alert": """Gets the alert for the scope by alert ID. @@ -146,7 +146,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -171,7 +171,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Alert', pipeline_response) @@ -187,7 +187,7 @@ async def dismiss( scope: str, alert_id: str, parameters: "_models.DismissAlertPayload", - **kwargs + **kwargs: Any ) -> "_models.Alert": """Dismisses the specified alert. @@ -222,7 +222,7 @@ async def dismiss( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -252,7 +252,7 @@ async def dismiss( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Alert', pipeline_response) @@ -267,7 +267,7 @@ async def list_external( self, external_cloud_provider_type: Union[str, "_models.ExternalCloudProviderType"], external_cloud_provider_id: str, - **kwargs + **kwargs: Any ) -> "_models.AlertsResult": """Lists the Alerts for external cloud provider type defined. @@ -288,7 +288,7 @@ async def list_external( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -313,7 +313,7 @@ async def list_external( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertsResult', pipeline_response) 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 ebf70792063a..090f2e992e2d 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 @@ -48,7 +48,7 @@ def list( expand: Optional[str] = None, skiptoken: Optional[str] = None, top: Optional[int] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DimensionsListResult"]: """Lists the dimensions by the defined scope. @@ -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.DimensionsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -138,8 +138,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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) @@ -158,7 +158,7 @@ def by_external_cloud_provider_type( expand: Optional[str] = None, skiptoken: Optional[str] = None, top: Optional[int] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DimensionsListResult"]: """Lists the dimensions by the external cloud provider type. @@ -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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -240,7 +240,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + 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) 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 94d03e9a0ec9..2f3497eee08b 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,12 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, scope: str, - expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.ExportListResult": """The operation to list all exports at the given scope. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -65,9 +64,6 @@ 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 @@ -78,7 +74,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -91,8 +87,6 @@ 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] @@ -104,7 +98,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExportListResult', pipeline_response) @@ -119,12 +113,11 @@ async def get( self, scope: str, export_name: str, - expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.Export": """The operation to get the export for the defined scope by export name. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -143,9 +136,6 @@ 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 @@ -156,7 +146,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -170,8 +160,6 @@ 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] @@ -183,7 +171,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Export', pipeline_response) @@ -199,13 +187,13 @@ async def create_or_update( scope: str, export_name: str, parameters: "_models.Export", - **kwargs + **kwargs: Any ) -> "_models.Export": """The operation to create or update a export. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -236,7 +224,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -266,7 +254,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -285,11 +273,11 @@ async def delete( self, scope: str, export_name: str, - **kwargs + **kwargs: Any ) -> None: """The operation to delete a export. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -318,7 +306,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -343,7 +331,7 @@ async def delete( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,11 +343,11 @@ async def execute( self, scope: str, export_name: str, - **kwargs + **kwargs: Any ) -> None: - """The operation to execute an export. + """The operation to execute a export. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -388,7 +376,7 @@ async def execute( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -413,7 +401,7 @@ async def execute( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -425,11 +413,11 @@ async def get_execution_history( self, scope: str, export_name: str, - **kwargs + **kwargs: Any ) -> "_models.ExportExecutionListResult": - """The operation to get the execution history of an export for the defined scope and export name. + """The operation to get the execution history of an export for the defined scope by export name. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -458,7 +446,7 @@ async def get_execution_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -483,7 +471,7 @@ async def get_execution_history( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) 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 e2cdbb517b10..8524f06621a5 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 @@ -45,8 +45,8 @@ async def usage( scope: str, parameters: "_models.ForecastDefinition", filter: Optional[str] = None, - **kwargs - ) -> "_models.QueryResult": + **kwargs: Any + ) -> Optional["_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 + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -111,12 +111,14 @@ 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]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -130,7 +132,7 @@ async def external_cloud_provider_usage( external_cloud_provider_id: str, parameters: "_models.ForecastDefinition", filter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.QueryResult": """Lists the forecast charges for external cloud provider type defined. @@ -157,7 +159,7 @@ async def external_cloud_provider_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -189,7 +191,7 @@ async def external_cloud_provider_usage( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueryResult', pipeline_response) 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 new file mode 100644 index 000000000000..04654269eb88 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py @@ -0,0 +1,302 @@ +# 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 d649b92092dc..e9b536504b06 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available cost management REST API operations. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + 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) 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 da0ded40f99b..7a973c90e3c8 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 @@ -44,8 +44,8 @@ async def usage( self, scope: str, parameters: "_models.QueryDefinition", - **kwargs - ) -> "_models.QueryResult": + **kwargs: Any + ) -> Optional["_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 + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -104,12 +104,14 @@ 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]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -122,7 +124,7 @@ async def usage_by_external_cloud_provider_type( external_cloud_provider_type: Union[str, "_models.ExternalCloudProviderType"], external_cloud_provider_id: str, parameters: "_models.QueryDefinition", - **kwargs + **kwargs: Any ) -> "_models.QueryResult": """Query the usage data for external cloud provider type defined. @@ -145,7 +147,7 @@ async def usage_by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -175,7 +177,7 @@ async def usage_by_external_cloud_provider_type( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueryResult', pipeline_response) 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 new file mode 100644 index 000000000000..2a0f8f9e272e --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_settings_operations.py @@ -0,0 +1,273 @@ +# 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 0cda2068311a..a82f547d6103 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 @@ -43,13 +43,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ViewListResult"]: """Lists all views by tenant and object. :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.ViewListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -92,8 +92,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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) @@ -107,7 +107,7 @@ async def get_next(next_link=None): def list_by_scope( self, scope: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ViewListResult"]: """Lists all views at the given scope. @@ -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.ViewListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -178,8 +178,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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) @@ -193,7 +193,7 @@ async def get_next(next_link=None): async def get( self, view_name: str, - **kwargs + **kwargs: Any ) -> "_models.View": """Gets the view by view name. @@ -209,7 +209,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -233,7 +233,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('View', pipeline_response) @@ -248,7 +248,7 @@ async def create_or_update( self, view_name: str, parameters: "_models.View", - **kwargs + **kwargs: Any ) -> "_models.View": """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation @@ -268,7 +268,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -297,7 +297,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ async def create_or_update( async def delete( self, view_name: str, - **kwargs + **kwargs: Any ) -> None: """The operation to delete a view. @@ -331,7 +331,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -355,7 +355,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -367,7 +367,7 @@ async def get_by_scope( self, scope: str, view_name: str, - **kwargs + **kwargs: Any ) -> "_models.View": """Gets the view for the defined scope by view name. @@ -401,7 +401,7 @@ async def get_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -426,7 +426,7 @@ async def get_by_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('View', pipeline_response) @@ -442,7 +442,7 @@ async def create_or_update_by_scope( scope: str, view_name: str, parameters: "_models.View", - **kwargs + **kwargs: Any ) -> "_models.View": """The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation @@ -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 = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -510,7 +510,7 @@ async def create_or_update_by_scope( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -529,7 +529,7 @@ async def delete_by_scope( self, scope: str, view_name: str, - **kwargs + **kwargs: Any ) -> None: """The operation to delete a view. @@ -563,7 +563,7 @@ async def delete_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -588,7 +588,7 @@ async def delete_by_scope( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: 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 2afdd595d689..c55fa14a8390 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,6 +11,7 @@ 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 @@ -18,8 +19,6 @@ 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 @@ -29,37 +28,39 @@ 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 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 from ._models_py3 import ReportConfigAggregation from ._models_py3 import ReportConfigComparisonExpression from ._models_py3 import ReportConfigDataset - from ._models_py3 import ReportConfigDatasetAutoGenerated from ._models_py3 import ReportConfigDatasetConfiguration - from ._models_py3 import ReportConfigDefinition from ._models_py3 import ReportConfigFilter - from ._models_py3 import ReportConfigFilterAutoGenerated from ._models_py3 import ReportConfigGrouping 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 except (SyntaxError, ImportError): @@ -67,6 +68,7 @@ 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 @@ -74,8 +76,6 @@ 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,37 +85,39 @@ 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 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 from ._models import ReportConfigAggregation # type: ignore from ._models import ReportConfigComparisonExpression # type: ignore from ._models import ReportConfigDataset # type: ignore - from ._models import ReportConfigDatasetAutoGenerated # type: ignore from ._models import ReportConfigDatasetConfiguration # type: ignore - from ._models import ReportConfigDefinition # type: ignore from ._models import ReportConfigFilter # type: ignore - from ._models import ReportConfigFilterAutoGenerated # type: ignore from ._models import ReportConfigGrouping # type: ignore 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 @@ -140,16 +142,17 @@ GranularityType, KpiType, MetricType, + OperationStatusType, OperatorType, PivotType, QueryColumnType, - QueryOperatorType, RecurrenceType, ReportConfigColumnType, ReportConfigSortingDirection, ReportGranularityType, ReportTimeframeType, ReportType, + SettingsPropertiesStartOn, StatusType, TimeframeType, ) @@ -159,6 +162,7 @@ 'AlertPropertiesDefinition', 'AlertPropertiesDetails', 'AlertsResult', + 'CacheItem', 'CommonExportProperties', 'Dimension', 'DimensionsListResult', @@ -166,8 +170,6 @@ 'ErrorDetails', 'ErrorResponse', 'Export', - 'ExportDataset', - 'ExportDatasetConfiguration', 'ExportDefinition', 'ExportDeliveryDestination', 'ExportDeliveryInfo', @@ -177,37 +179,39 @@ 'ExportProperties', 'ExportRecurrencePeriod', 'ExportSchedule', - 'ExportTimePeriod', - 'ForecastDataset', 'ForecastDefinition', 'KpiProperties', 'Operation', 'OperationDisplay', 'OperationListResult', + 'OperationStatus', 'PivotProperties', 'ProxyResource', + 'ProxySettingResource', 'QueryAggregation', 'QueryColumn', 'QueryComparisonExpression', 'QueryDataset', + 'QueryDatasetAutoGenerated', 'QueryDatasetConfiguration', 'QueryDefinition', 'QueryFilter', + 'QueryFilterAutoGenerated', 'QueryGrouping', 'QueryResult', 'QueryTimePeriod', 'ReportConfigAggregation', 'ReportConfigComparisonExpression', 'ReportConfigDataset', - 'ReportConfigDatasetAutoGenerated', 'ReportConfigDatasetConfiguration', - 'ReportConfigDefinition', 'ReportConfigFilter', - 'ReportConfigFilterAutoGenerated', 'ReportConfigGrouping', 'ReportConfigSorting', 'ReportConfigTimePeriod', 'Resource', + 'Setting', + 'SettingsListResult', + 'Status', 'View', 'ViewListResult', 'AccumulatedType', @@ -230,16 +234,17 @@ 'GranularityType', 'KpiType', 'MetricType', + 'OperationStatusType', '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 884450e0a1ce..16087446457c 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 last known status of the export execution. + """The status of the export execution. """ QUEUED = "Queued" @@ -176,7 +176,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. Currently only 'Csv' is supported. + """The format of the export being delivered. """ CSV = "Csv" @@ -188,7 +188,7 @@ class FunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUM = "Sum" class GranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The granularity of rows in the forecast. + """The granularity of rows in the query. """ DAILY = "Daily" @@ -208,6 +208,14 @@ class MetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AMORTIZED_COST = "AmortizedCost" AHUB = "AHUB" +class OperationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the long running operation. + """ + + RUNNING = "Running" + COMPLETED = "Completed" + FAILED = "Failed" + class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The operator to use for comparison. """ @@ -229,12 +237,6 @@ 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. """ @@ -283,8 +285,18 @@ 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 export's schedule. If 'Inactive', the export's schedule is paused. + """The status of the schedule. Whether active or not. If inactive, the export's scheduled + execution is paused. """ ACTIVE = "Active" 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 85527af7c2de..2c2ba531e35b 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 @@ -175,13 +175,13 @@ class AlertPropertiesDetails(msrest.serialization.Model): :param triggered_by: notificationId that triggered this alert. :type triggered_by: str :param resource_group_filter: array of resourceGroups to filter by. - :type resource_group_filter: list[object] + :type resource_group_filter: list[any] :param resource_filter: array of resources to filter by. - :type resource_filter: list[object] + :type resource_filter: list[any] :param meter_filter: array of meters to filter by. - :type meter_filter: list[object] + :type meter_filter: list[any] :param tag_filter: tags to filter by. - :type tag_filter: object + :type tag_filter: any :param threshold: notification threshold percentage as a decimal which activated this alert. :type threshold: float :param operator: operator used to compare currentSpend with amount. Possible values include: @@ -275,39 +275,80 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has the definition for the export. + :param definition: Required. Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime """ _validation = { 'delivery_info': {'required': True}, 'definition': {'required': True}, - 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, - 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, - 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } def __init__( @@ -318,8 +359,6 @@ 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.next_run_time_estimate = None class Dimension(Resource): @@ -586,7 +625,7 @@ def __init__( class Export(ProxyResource): - """An export resource. + """A export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -599,18 +638,12 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Has the definition for the export. + :param definition: Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -619,7 +652,6 @@ class Export(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -630,8 +662,6 @@ 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'}, - 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -643,73 +673,25 @@ 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.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 an export. + """The definition of a query. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' - and is applicable to exports that do not yet provide data for charges or amortization for - service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :param type: Required. The type of the query. Possible values include: "Usage", "ActualCost", + "AmortizedCost". :type type: str or ~azure.mgmt.costmanagement.models.ExportType - :param timeframe: Required. The time frame for pulling data for the export. If custom, then a + :param timeframe: Required. The time frame for pulling data for the query. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the export. - :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod - :param data_set: The definition for data in the export. - :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + :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 """ _validation = { @@ -720,8 +702,8 @@ class ExportDefinition(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, - 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetAutoGenerated'}, } def __init__( @@ -795,8 +777,8 @@ def __init__( self.destination = kwargs['destination'] -class ExportExecution(ProxyResource): - """An export execution. +class ExportExecution(Resource): + """A export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -806,44 +788,41 @@ class ExportExecution(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be - used to determine whether the user is updating the latest version or not. - :type e_tag: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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 last known status of the export execution. Possible values include: - "Queued", "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", - "DataNotAvailable". + :param status: The 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 user email. For scheduled executions it is 'System'. + executions, it is the email id. For Scheduled executions, it is the constant value - 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 the export execution finished. + :param processing_end_time: The time when export execution finished. :type processing_end_time: ~datetime.datetime - :param file_name: The name of the exported file. + :param file_name: The name of the file export got written to. :type file_name: str - :param run_settings: The export settings that were in effect for this execution. + :param run_settings: The common properties of the export. :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'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -852,7 +831,6 @@ class ExportExecution(ProxyResource): '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__( @@ -868,15 +846,14 @@ 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 the execution history of an export. + """Result of listing exports execution history of a export by name. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of export executions. + :ivar value: The list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -924,22 +901,14 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has the definition for the export. + :param definition: Required. Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -947,15 +916,12 @@ 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'}, - 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, } @@ -997,19 +963,25 @@ def __init__( class ExportSchedule(msrest.serialization.Model): - """The schedule associated with the export. + """The schedule associated with a export. + + All required parameters must be populated in order to send to Azure. - :param status: The status of the export's schedule. If 'Inactive', the export's schedule is - paused. Possible values include: "Active", "Inactive". + :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". :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", - "Monthly", "Annually". + :param recurrence: Required. 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'}, @@ -1022,74 +994,10 @@ def __init__( ): super(ExportSchedule, self).__init__(**kwargs) self.status = kwargs.get('status', None) - self.recurrence = kwargs.get('recurrence', None) + self.recurrence = kwargs['recurrence'] 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. @@ -1105,7 +1013,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: Has definition for data in this forecast. - :type dataset: ~azure.mgmt.costmanagement.models.ForecastDataset + :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset :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. @@ -1121,7 +1029,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': 'ForecastDataset'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } @@ -1261,6 +1169,33 @@ 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'. @@ -1284,6 +1219,46 @@ 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. @@ -1345,8 +1320,9 @@ 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". - :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1416,6 +1392,49 @@ 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: Has filter expression to use in the query. + :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. @@ -1484,12 +1503,10 @@ 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 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 + :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 = { @@ -1500,9 +1517,8 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1512,9 +1528,44 @@ def __init__( super(QueryFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) + 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) class QueryGrouping(msrest.serialization.Model): @@ -1561,12 +1612,19 @@ 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. :type columns: list[~azure.mgmt.costmanagement.models.QueryColumn] :param rows: Array of rows. - :type rows: list[list[object]] + :type rows: list[list[any]] """ _validation = { @@ -1574,6 +1632,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -1581,6 +1641,9 @@ 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]]'}, @@ -1591,6 +1654,9 @@ 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) @@ -1741,54 +1807,6 @@ def __init__( self.filter = kwargs.get('filter', None) -class ReportConfigDatasetAutoGenerated(msrest.serialization.Model): - """The definition of data present in the report. - - :param granularity: The granularity of rows in the report. Possible values include: "Daily", - "Monthly". - :type granularity: str or ~azure.mgmt.costmanagement.models.ReportGranularityType - :param configuration: Has configuration information for the data in the report. The - configuration will be ignored if aggregation and grouping are provided. - :type configuration: ~azure.mgmt.costmanagement.models.ReportConfigDatasetConfiguration - :param aggregation: Dictionary of aggregation expression to use in the report. The key of each - item in the dictionary is the alias for the aggregated column. Report can have up to 2 - aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.ReportConfigAggregation] - :param grouping: Array of group by expression to use in the report. Report can have up to 2 - group by clauses. - :type grouping: list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] - :param sorting: Array of order by expression to use in the report. - :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] - :param filter: Has filter expression to use in the report. - :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated - """ - - _validation = { - 'grouping': {'max_items': 2, 'min_items': 0}, - } - - _attribute_map = { - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'ReportConfigDatasetConfiguration'}, - 'aggregation': {'key': 'aggregation', 'type': '{ReportConfigAggregation}'}, - 'grouping': {'key': 'grouping', 'type': '[ReportConfigGrouping]'}, - 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, - 'filter': {'key': 'filter', 'type': 'ReportConfigFilterAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(ReportConfigDatasetAutoGenerated, self).__init__(**kwargs) - self.granularity = kwargs.get('granularity', None) - self.configuration = kwargs.get('configuration', None) - self.aggregation = kwargs.get('aggregation', None) - self.grouping = kwargs.get('grouping', None) - self.sorting = kwargs.get('sorting', None) - self.filter = kwargs.get('filter', None) - - class ReportConfigDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the report. @@ -1809,49 +1827,6 @@ def __init__( self.columns = kwargs.get('columns', None) -class ReportConfigDefinition(msrest.serialization.Model): - """The definition of a report config. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the report. Usage represents actual usage, forecast - represents forecasted data and UsageAndForecast represents both usage and forecasted data. - Actual usage and forecasted data can be differentiated based on dates. Possible values include: - "Usage". - :type type: str or ~azure.mgmt.costmanagement.models.ReportType - :param timeframe: Required. The time frame for pulling data for the report. If custom, then a - specific time period must be provided. Possible values include: "WeekToDate", "MonthToDate", - "YearToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.ReportTimeframeType - :param time_period: Has time period for pulling data for the report. - :type time_period: ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod - :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDatasetAutoGenerated - """ - - _validation = { - 'type': {'required': True}, - 'timeframe': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'dataset': {'key': 'dataset', 'type': 'ReportConfigDatasetAutoGenerated'}, - } - - def __init__( - self, - **kwargs - ): - super(ReportConfigDefinition, self).__init__(**kwargs) - self.type = kwargs['type'] - self.timeframe = kwargs['timeframe'] - self.time_period = kwargs.get('time_period', None) - self.dataset = kwargs.get('dataset', None) - - class ReportConfigFilter(msrest.serialization.Model): """The filter expression to be used in the report. @@ -1859,12 +1834,14 @@ 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 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 + :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 """ _validation = { @@ -1875,9 +1852,10 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -1887,49 +1865,10 @@ def __init__( super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = kwargs.get('and_property', None) self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) - - -class ReportConfigFilterAutoGenerated(msrest.serialization.Model): - """The filter expression to be used in the report. - - :param and_property: The logical "AND" expression. Must have at least 2 items. - :type and_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated] - :param or_property: The logical "OR" expression. Must have at least 2 items. - :type or_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated] - :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated - :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - """ - - _validation = { - 'and_property': {'min_items': 2}, - 'or_property': {'min_items': 2}, - } - - _attribute_map = { - 'and_property': {'key': 'and', 'type': '[ReportConfigFilterAutoGenerated]'}, - 'or_property': {'key': 'or', 'type': '[ReportConfigFilterAutoGenerated]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilterAutoGenerated'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, - } - - def __init__( - self, - **kwargs - ): - super(ReportConfigFilterAutoGenerated, self).__init__(**kwargs) - self.and_property = kwargs.get('and_property', None) - self.or_property = kwargs.get('or_property', None) - self.not_property = kwargs.get('not_property', None) - self.dimension = kwargs.get('dimension', None) - self.tag = kwargs.get('tag', None) + 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) class ReportConfigGrouping(msrest.serialization.Model): @@ -2023,6 +1962,107 @@ 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". + :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + + class View(ProxyResource): """States and configurations of Cost Analysis. @@ -2061,6 +2101,10 @@ 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 @@ -2084,8 +2128,10 @@ 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 dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :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 """ _validation = { @@ -2094,6 +2140,9 @@ 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 = { @@ -2105,6 +2154,8 @@ 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'}, @@ -2113,7 +2164,8 @@ 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'}, - 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, } def __init__( @@ -2125,6 +2177,8 @@ 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) @@ -2133,7 +2187,8 @@ 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.dataset = kwargs.get('dataset', None) + self.data_set = kwargs.get('data_set', None) + self.include_monetary_commitment = 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 ce1d68ae6c23..699d4b63d817 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 @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -196,13 +196,13 @@ class AlertPropertiesDetails(msrest.serialization.Model): :param triggered_by: notificationId that triggered this alert. :type triggered_by: str :param resource_group_filter: array of resourceGroups to filter by. - :type resource_group_filter: list[object] + :type resource_group_filter: list[any] :param resource_filter: array of resources to filter by. - :type resource_filter: list[object] + :type resource_filter: list[any] :param meter_filter: array of meters to filter by. - :type meter_filter: list[object] + :type meter_filter: list[any] :param tag_filter: tags to filter by. - :type tag_filter: object + :type tag_filter: any :param threshold: notification threshold percentage as a decimal which activated this alert. :type threshold: float :param operator: operator used to compare currentSpend with amount. Possible values include: @@ -249,10 +249,10 @@ def __init__( time_grain_type: Optional[Union[str, "AlertTimeGrainType"]] = None, period_start_date: Optional[str] = None, triggered_by: Optional[str] = None, - resource_group_filter: Optional[List[object]] = None, - resource_filter: Optional[List[object]] = None, - meter_filter: Optional[List[object]] = None, - tag_filter: Optional[object] = None, + resource_group_filter: Optional[List[Any]] = None, + resource_filter: Optional[List[Any]] = None, + meter_filter: Optional[List[Any]] = None, + tag_filter: Optional[Any] = None, threshold: Optional[float] = None, operator: Optional[Union[str, "AlertOperator"]] = None, amount: Optional[float] = None, @@ -313,39 +313,87 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has the definition for the export. + :param definition: Required. Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime """ _validation = { 'delivery_info': {'required': True}, 'definition': {'required': True}, - 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { 'format': {'key': 'format', 'type': 'str'}, 'delivery_info': {'key': 'deliveryInfo', 'type': 'ExportDeliveryInfo'}, 'definition': {'key': 'definition', 'type': 'ExportDefinition'}, - 'run_history': {'key': 'runHistory', 'type': 'ExportExecutionListResult'}, - 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, } def __init__( @@ -354,15 +402,12 @@ def __init__( delivery_info: "ExportDeliveryInfo", definition: "ExportDefinition", format: Optional[Union[str, "FormatType"]] = None, - run_history: Optional["ExportExecutionListResult"] = None, **kwargs ): super(CommonExportProperties, self).__init__(**kwargs) self.format = format self.delivery_info = delivery_info self.definition = definition - self.run_history = run_history - self.next_run_time_estimate = None class Dimension(Resource): @@ -647,7 +692,7 @@ def __init__( class Export(ProxyResource): - """An export resource. + """A export resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -660,18 +705,12 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Has the definition for the export. + :param definition: Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -680,7 +719,6 @@ class Export(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'next_run_time_estimate': {'readonly': True}, } _attribute_map = { @@ -691,8 +729,6 @@ 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'}, - 'next_run_time_estimate': {'key': 'properties.nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'properties.schedule', 'type': 'ExportSchedule'}, } @@ -703,7 +739,6 @@ def __init__( format: Optional[Union[str, "FormatType"]] = None, delivery_info: Optional["ExportDeliveryInfo"] = None, definition: Optional["ExportDefinition"] = None, - run_history: Optional["ExportExecutionListResult"] = None, schedule: Optional["ExportSchedule"] = None, **kwargs ): @@ -711,78 +746,25 @@ def __init__( self.format = format self.delivery_info = delivery_info self.definition = definition - self.run_history = run_history - self.next_run_time_estimate = None self.schedule = schedule -class ExportDataset(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 an export. + """The definition of a query. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the export. Note that 'Usage' is equivalent to 'ActualCost' - and is applicable to exports that do not yet provide data for charges or amortization for - service reservations. Possible values include: "Usage", "ActualCost", "AmortizedCost". + :param type: Required. The type of the query. Possible values include: "Usage", "ActualCost", + "AmortizedCost". :type type: str or ~azure.mgmt.costmanagement.models.ExportType - :param timeframe: Required. The time frame for pulling data for the export. If custom, then a + :param timeframe: Required. The time frame for pulling data for the query. If custom, then a specific time period must be provided. Possible values include: "MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType - :param time_period: Has time period for pulling data for the export. - :type time_period: ~azure.mgmt.costmanagement.models.ExportTimePeriod - :param data_set: The definition for data in the export. - :type data_set: ~azure.mgmt.costmanagement.models.ExportDataset + :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 """ _validation = { @@ -793,8 +775,8 @@ class ExportDefinition(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'ExportTimePeriod'}, - 'data_set': {'key': 'dataSet', 'type': 'ExportDataset'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'data_set': {'key': 'dataSet', 'type': 'QueryDatasetAutoGenerated'}, } def __init__( @@ -802,8 +784,8 @@ def __init__( *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], - time_period: Optional["ExportTimePeriod"] = None, - data_set: Optional["ExportDataset"] = None, + time_period: Optional["QueryTimePeriod"] = None, + data_set: Optional["QueryDatasetAutoGenerated"] = None, **kwargs ): super(ExportDefinition, self).__init__(**kwargs) @@ -879,8 +861,8 @@ def __init__( self.destination = destination -class ExportExecution(ProxyResource): - """An export execution. +class ExportExecution(Resource): + """A export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -890,44 +872,41 @@ class ExportExecution(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be - used to determine whether the user is updating the latest version or not. - :type e_tag: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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 last known status of the export execution. Possible values include: - "Queued", "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", - "DataNotAvailable". + :param status: The 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 user email. For scheduled executions it is 'System'. + executions, it is the email id. For Scheduled executions, it is the constant value - 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 the export execution finished. + :param processing_end_time: The time when export execution finished. :type processing_end_time: ~datetime.datetime - :param file_name: The name of the exported file. + :param file_name: The name of the file export got written to. :type file_name: str - :param run_settings: The export settings that were in effect for this execution. + :param run_settings: The common properties of the export. :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'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -936,13 +915,11 @@ class ExportExecution(ProxyResource): '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, @@ -951,10 +928,9 @@ 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__(e_tag=e_tag, **kwargs) + super(ExportExecution, self).__init__(**kwargs) self.execution_type = execution_type self.status = status self.submitted_by = submitted_by @@ -963,15 +939,14 @@ 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 the execution history of an export. + """Result of listing exports execution history of a export by name. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of export executions. + :ivar value: The list of export executions. :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] """ @@ -1019,22 +994,14 @@ 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. Currently only 'Csv' is supported. - Possible values include: "Csv". + :param format: The format of the export being delivered. Possible values include: "Csv". :type format: str or ~azure.mgmt.costmanagement.models.FormatType :param delivery_info: Required. Has delivery information for the export. :type delivery_info: ~azure.mgmt.costmanagement.models.ExportDeliveryInfo - :param definition: Required. Has the definition for the export. + :param definition: Required. Has definition for the export. :type definition: ~azure.mgmt.costmanagement.models.ExportDefinition - :param run_history: If requested, has the most recent execution history for the export. - :type run_history: ~azure.mgmt.costmanagement.models.ExportExecutionListResult - :ivar next_run_time_estimate: If the export has an active schedule, provides an estimate of the - next execution time. - :vartype next_run_time_estimate: ~datetime.datetime :param schedule: Has schedule information for the export. :type schedule: ~azure.mgmt.costmanagement.models.ExportSchedule """ @@ -1042,15 +1009,12 @@ 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'}, - 'next_run_time_estimate': {'key': 'nextRunTimeEstimate', 'type': 'iso-8601'}, 'schedule': {'key': 'schedule', 'type': 'ExportSchedule'}, } @@ -1060,11 +1024,10 @@ def __init__( delivery_info: "ExportDeliveryInfo", definition: "ExportDefinition", format: Optional[Union[str, "FormatType"]] = None, - run_history: Optional["ExportExecutionListResult"] = None, schedule: Optional["ExportSchedule"] = None, **kwargs ): - super(ExportProperties, self).__init__(format=format, delivery_info=delivery_info, definition=definition, run_history=run_history, **kwargs) + super(ExportProperties, self).__init__(format=format, delivery_info=delivery_info, definition=definition, **kwargs) self.schedule = schedule @@ -1101,19 +1064,25 @@ def __init__( class ExportSchedule(msrest.serialization.Model): - """The schedule associated with the export. + """The schedule associated with a export. - :param status: The status of the export's schedule. If 'Inactive', the export's schedule is - paused. Possible values include: "Active", "Inactive". + All required parameters must be populated in order to send to Azure. + + :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". :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", - "Monthly", "Annually". + :param recurrence: Required. 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'}, @@ -1123,8 +1092,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 ): @@ -1134,78 +1103,6 @@ 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. @@ -1221,7 +1118,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: Has definition for data in this forecast. - :type dataset: ~azure.mgmt.costmanagement.models.ForecastDataset + :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset :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. @@ -1237,7 +1134,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': 'ForecastDataset'}, + 'dataset': {'key': 'dataset', 'type': 'QueryDataset'}, 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, } @@ -1248,7 +1145,7 @@ def __init__( type: Union[str, "ForecastType"], timeframe: Union[str, "ForecastTimeframeType"], time_period: Optional["QueryTimePeriod"] = None, - dataset: Optional["ForecastDataset"] = None, + dataset: Optional["QueryDataset"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, **kwargs @@ -1390,6 +1287,37 @@ 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'. @@ -1416,6 +1344,46 @@ 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. @@ -1483,8 +1451,9 @@ 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". - :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1505,7 +1474,7 @@ def __init__( self, *, name: str, - operator: Union[str, "QueryOperatorType"], + operator: Union[str, "OperatorType"], values: List[str], **kwargs ): @@ -1564,6 +1533,55 @@ 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: Has filter expression to use in the query. + :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. @@ -1639,12 +1657,10 @@ 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 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 + :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 = { @@ -1655,9 +1671,8 @@ class QueryFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[QueryFilter]'}, 'or_property': {'key': 'or', 'type': '[QueryFilter]'}, - 'not_property': {'key': 'not', 'type': 'QueryFilter'}, - 'dimension': {'key': 'dimension', 'type': 'QueryComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'QueryComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'QueryComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'QueryComparisonExpression'}, } def __init__( @@ -1665,17 +1680,56 @@ def __init__( *, and_property: Optional[List["QueryFilter"]] = None, or_property: Optional[List["QueryFilter"]] = None, - not_property: Optional["QueryFilter"] = None, - dimension: Optional["QueryComparisonExpression"] = None, - tag: Optional["QueryComparisonExpression"] = None, + dimensions: Optional["QueryComparisonExpression"] = None, + tags: Optional["QueryComparisonExpression"] = None, **kwargs ): super(QueryFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag + 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 class QueryGrouping(msrest.serialization.Model): @@ -1725,12 +1779,19 @@ 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. :type columns: list[~azure.mgmt.costmanagement.models.QueryColumn] :param rows: Array of rows. - :type rows: list[list[object]] + :type rows: list[list[any]] """ _validation = { @@ -1738,6 +1799,8 @@ class QueryResult(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'tags': {'readonly': True}, + 'location': {'readonly': True}, + 'sku': {'readonly': True}, } _attribute_map = { @@ -1745,6 +1808,9 @@ 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]]'}, @@ -1753,12 +1819,16 @@ 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[object]]] = 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 @@ -1926,61 +1996,6 @@ def __init__( self.filter = filter -class ReportConfigDatasetAutoGenerated(msrest.serialization.Model): - """The definition of data present in the report. - - :param granularity: The granularity of rows in the report. Possible values include: "Daily", - "Monthly". - :type granularity: str or ~azure.mgmt.costmanagement.models.ReportGranularityType - :param configuration: Has configuration information for the data in the report. The - configuration will be ignored if aggregation and grouping are provided. - :type configuration: ~azure.mgmt.costmanagement.models.ReportConfigDatasetConfiguration - :param aggregation: Dictionary of aggregation expression to use in the report. The key of each - item in the dictionary is the alias for the aggregated column. Report can have up to 2 - aggregation clauses. - :type aggregation: dict[str, ~azure.mgmt.costmanagement.models.ReportConfigAggregation] - :param grouping: Array of group by expression to use in the report. Report can have up to 2 - group by clauses. - :type grouping: list[~azure.mgmt.costmanagement.models.ReportConfigGrouping] - :param sorting: Array of order by expression to use in the report. - :type sorting: list[~azure.mgmt.costmanagement.models.ReportConfigSorting] - :param filter: Has filter expression to use in the report. - :type filter: ~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated - """ - - _validation = { - 'grouping': {'max_items': 2, 'min_items': 0}, - } - - _attribute_map = { - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'ReportConfigDatasetConfiguration'}, - 'aggregation': {'key': 'aggregation', 'type': '{ReportConfigAggregation}'}, - 'grouping': {'key': 'grouping', 'type': '[ReportConfigGrouping]'}, - 'sorting': {'key': 'sorting', 'type': '[ReportConfigSorting]'}, - 'filter': {'key': 'filter', 'type': 'ReportConfigFilterAutoGenerated'}, - } - - def __init__( - self, - *, - granularity: Optional[Union[str, "ReportGranularityType"]] = None, - configuration: Optional["ReportConfigDatasetConfiguration"] = None, - aggregation: Optional[Dict[str, "ReportConfigAggregation"]] = None, - grouping: Optional[List["ReportConfigGrouping"]] = None, - sorting: Optional[List["ReportConfigSorting"]] = None, - filter: Optional["ReportConfigFilterAutoGenerated"] = None, - **kwargs - ): - super(ReportConfigDatasetAutoGenerated, self).__init__(**kwargs) - self.granularity = granularity - self.configuration = configuration - self.aggregation = aggregation - self.grouping = grouping - self.sorting = sorting - self.filter = filter - - class ReportConfigDatasetConfiguration(msrest.serialization.Model): """The configuration of dataset in the report. @@ -2003,54 +2018,6 @@ def __init__( self.columns = columns -class ReportConfigDefinition(msrest.serialization.Model): - """The definition of a report config. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the report. Usage represents actual usage, forecast - represents forecasted data and UsageAndForecast represents both usage and forecasted data. - Actual usage and forecasted data can be differentiated based on dates. Possible values include: - "Usage". - :type type: str or ~azure.mgmt.costmanagement.models.ReportType - :param timeframe: Required. The time frame for pulling data for the report. If custom, then a - specific time period must be provided. Possible values include: "WeekToDate", "MonthToDate", - "YearToDate", "Custom". - :type timeframe: str or ~azure.mgmt.costmanagement.models.ReportTimeframeType - :param time_period: Has time period for pulling data for the report. - :type time_period: ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod - :param dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDatasetAutoGenerated - """ - - _validation = { - 'type': {'required': True}, - 'timeframe': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'timeframe': {'key': 'timeframe', 'type': 'str'}, - 'time_period': {'key': 'timePeriod', 'type': 'ReportConfigTimePeriod'}, - 'dataset': {'key': 'dataset', 'type': 'ReportConfigDatasetAutoGenerated'}, - } - - def __init__( - self, - *, - type: Union[str, "ReportType"], - timeframe: Union[str, "ReportTimeframeType"], - time_period: Optional["ReportConfigTimePeriod"] = None, - dataset: Optional["ReportConfigDatasetAutoGenerated"] = None, - **kwargs - ): - super(ReportConfigDefinition, self).__init__(**kwargs) - self.type = type - self.timeframe = timeframe - self.time_period = time_period - self.dataset = dataset - - class ReportConfigFilter(msrest.serialization.Model): """The filter expression to be used in the report. @@ -2058,12 +2025,14 @@ 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 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 + :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 """ _validation = { @@ -2074,9 +2043,10 @@ class ReportConfigFilter(msrest.serialization.Model): _attribute_map = { 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + 'dimensions': {'key': 'dimensions', 'type': 'ReportConfigComparisonExpression'}, + 'tags': {'key': 'tags', 'type': 'ReportConfigComparisonExpression'}, + 'tag_key': {'key': 'tagKey', 'type': 'ReportConfigComparisonExpression'}, + 'tag_value': {'key': 'tagValue', 'type': 'ReportConfigComparisonExpression'}, } def __init__( @@ -2084,63 +2054,19 @@ def __init__( *, and_property: Optional[List["ReportConfigFilter"]] = None, or_property: Optional[List["ReportConfigFilter"]] = None, - not_property: Optional["ReportConfigFilter"] = None, - dimension: Optional["ReportConfigComparisonExpression"] = None, - tag: Optional["ReportConfigComparisonExpression"] = None, + dimensions: Optional["ReportConfigComparisonExpression"] = None, + tags: Optional["ReportConfigComparisonExpression"] = None, + tag_key: Optional["ReportConfigComparisonExpression"] = None, + tag_value: Optional["ReportConfigComparisonExpression"] = None, **kwargs ): super(ReportConfigFilter, self).__init__(**kwargs) self.and_property = and_property self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag - - -class ReportConfigFilterAutoGenerated(msrest.serialization.Model): - """The filter expression to be used in the report. - - :param and_property: The logical "AND" expression. Must have at least 2 items. - :type and_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated] - :param or_property: The logical "OR" expression. Must have at least 2 items. - :type or_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated] - :param not_property: The logical "NOT" expression. - :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilterAutoGenerated - :param dimension: Has comparison expression for a dimension. - :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - :param tag: Has comparison expression for a tag. - :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression - """ - - _validation = { - 'and_property': {'min_items': 2}, - 'or_property': {'min_items': 2}, - } - - _attribute_map = { - 'and_property': {'key': 'and', 'type': '[ReportConfigFilterAutoGenerated]'}, - 'or_property': {'key': 'or', 'type': '[ReportConfigFilterAutoGenerated]'}, - 'not_property': {'key': 'not', 'type': 'ReportConfigFilterAutoGenerated'}, - 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, - 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, - } - - def __init__( - self, - *, - and_property: Optional[List["ReportConfigFilterAutoGenerated"]] = None, - or_property: Optional[List["ReportConfigFilterAutoGenerated"]] = None, - not_property: Optional["ReportConfigFilterAutoGenerated"] = None, - dimension: Optional["ReportConfigComparisonExpression"] = None, - tag: Optional["ReportConfigComparisonExpression"] = None, - **kwargs - ): - super(ReportConfigFilterAutoGenerated, self).__init__(**kwargs) - self.and_property = and_property - self.or_property = or_property - self.not_property = not_property - self.dimension = dimension - self.tag = tag + self.dimensions = dimensions + self.tags = tags + self.tag_key = tag_key + self.tag_value = tag_value class ReportConfigGrouping(msrest.serialization.Model): @@ -2243,6 +2169,113 @@ 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". + :type status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "OperationStatusType"]] = None, + **kwargs + ): + super(Status, self).__init__(**kwargs) + self.status = status + + class View(ProxyResource): """States and configurations of Cost Analysis. @@ -2281,6 +2314,10 @@ 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 @@ -2304,8 +2341,10 @@ 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 dataset: Has definition for data in this report config. - :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + :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 """ _validation = { @@ -2314,6 +2353,9 @@ 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 = { @@ -2325,6 +2367,8 @@ 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'}, @@ -2333,7 +2377,8 @@ 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'}, - 'dataset': {'key': 'properties.query.dataset', 'type': 'ReportConfigDataset'}, + 'data_set': {'key': 'properties.query.dataSet', 'type': 'ReportConfigDataset'}, + 'include_monetary_commitment': {'key': 'properties.query.includeMonetaryCommitment', 'type': 'bool'}, } def __init__( @@ -2350,7 +2395,7 @@ def __init__( type_properties_query_type: Optional[Union[str, "ReportType"]] = None, timeframe: Optional[Union[str, "ReportTimeframeType"]] = None, time_period: Optional["ReportConfigTimePeriod"] = None, - dataset: Optional["ReportConfigDataset"] = None, + data_set: Optional["ReportConfigDataset"] = None, **kwargs ): super(View, self).__init__(e_tag=e_tag, **kwargs) @@ -2358,6 +2403,8 @@ 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 @@ -2366,7 +2413,8 @@ def __init__( self.type_properties_query_type = type_properties_query_type self.timeframe = timeframe self.time_period = time_period - self.dataset = dataset + self.data_set = data_set + self.include_monetary_commitment = None 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 6065b201f9cc..c70a4cb564cb 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,20 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._settings_operations import SettingsOperations 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', '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 b8cc35f9adaf..13969e75db88 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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -103,7 +103,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertsResult', pipeline_response) @@ -152,7 +152,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -177,7 +177,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Alert', pipeline_response) @@ -229,7 +229,7 @@ def dismiss( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -259,7 +259,7 @@ def dismiss( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Alert', pipeline_response) @@ -296,7 +296,7 @@ def list_external( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -321,7 +321,7 @@ def list_external( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AlertsResult', pipeline_response) 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 5df5e8c3fb75..ff843ebbf69e 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.DimensionsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.DimensionsListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -143,8 +143,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -246,7 +246,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + 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) 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 d33a18c37972..89eefe5166d4 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,13 +47,12 @@ 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 export operations. This includes + :param scope: The scope associated with query and 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 @@ -70,9 +69,6 @@ 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 @@ -83,7 +79,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -96,8 +92,6 @@ 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] @@ -109,7 +103,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExportListResult', pipeline_response) @@ -124,13 +118,12 @@ 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 export operations. This includes + :param scope: The scope associated with query and 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 @@ -149,9 +142,6 @@ 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 @@ -162,7 +152,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -176,8 +166,6 @@ 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] @@ -189,7 +177,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Export', pipeline_response) @@ -212,7 +200,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 export operations. This includes + :param scope: The scope associated with query and 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 @@ -243,7 +231,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -273,7 +261,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -297,7 +285,7 @@ def delete( # type: (...) -> None """The operation to delete a export. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -326,7 +314,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -351,7 +339,7 @@ def delete( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -366,9 +354,9 @@ def execute( **kwargs # type: Any ): # type: (...) -> None - """The operation to execute an export. + """The operation to execute a export. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -397,7 +385,7 @@ def execute( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -422,7 +410,7 @@ def execute( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -437,9 +425,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 and export name. + """The operation to get the execution history of an export for the defined scope by export name. - :param scope: The scope associated with export operations. This includes + :param scope: The scope associated with query and 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 @@ -468,7 +456,7 @@ def get_execution_history( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -493,7 +481,7 @@ def get_execution_history( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) 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 8635dccb8163..71c2e338e1e5 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: (...) -> "_models.QueryResult" + # type: (...) -> Optional["_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 + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -116,12 +116,14 @@ def usage( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -163,7 +165,7 @@ def external_cloud_provider_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -195,7 +197,7 @@ def external_cloud_provider_usage( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueryResult', pipeline_response) 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 new file mode 100644 index 000000000000..4c93c64e8755 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py @@ -0,0 +1,310 @@ +# 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 bafaeb72a7f3..4a538a66f2c5 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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + 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) 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 ea080caa0284..b5dd2dc857ec 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: (...) -> "_models.QueryResult" + # type: (...) -> Optional["_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 + :rtype: ~azure.mgmt.costmanagement.models.QueryResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.QueryResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -109,12 +109,14 @@ def usage( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('QueryResult', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QueryResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -151,7 +153,7 @@ def usage_by_external_cloud_provider_type( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -181,7 +183,7 @@ def usage_by_external_cloud_provider_type( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QueryResult', pipeline_response) 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 new file mode 100644 index 000000000000..3140937a8c4c --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_settings_operations.py @@ -0,0 +1,281 @@ +# 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 c9139a34df75..d7512a2a7003 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.ViewListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -97,8 +97,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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.ViewListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.ViewListResultor None] :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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" def prepare_request(next_link=None): @@ -184,8 +184,8 @@ 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]: - error = self._deserialize(_models.ErrorResponse, response) + if response.status_code not in [200, 204]: + 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 = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -240,7 +240,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('View', pipeline_response) @@ -276,7 +276,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -305,7 +305,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -340,7 +340,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -364,7 +364,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -411,7 +411,7 @@ def get_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -436,7 +436,7 @@ def get_by_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('View', pipeline_response) @@ -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 = "2020-06-01" + api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -521,7 +521,7 @@ def create_or_update_by_scope( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -575,7 +575,7 @@ def delete_by_scope( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01" + api_version = "2019-11-01" accept = "application/json" # Construct URL @@ -600,7 +600,7 @@ def delete_by_scope( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/setup.py b/sdk/costmanagement/azure-mgmt-costmanagement/setup.py index 0d43f4a1e9eb..d4511bb480fb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/setup.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/setup.py @@ -78,7 +78,7 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', + 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.2.0,<2.0.0', ], diff --git a/shared_requirements.txt b/shared_requirements.txt index 6f037e62ef6e..d4815079d10b 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -308,3 +308,4 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-cognitiveservices msrest>=0.6.21 #override azure-mgmt-hdinsight msrest>=0.6.21 #override azure-mgmt-batchai msrest>=0.6.21 +#override azure-mgmt-costmanagement msrest>=0.6.21