From 64681715b52d5ef9c414cd77dbe30ae68bea7bd6 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 15 May 2020 02:57:05 +0000 Subject: [PATCH] Generated from d422c30312f83b5bc7b90dedd9a4bb256b4d357b remove useless file --- src/costmanagement/HISTORY.rst | 8 + src/costmanagement/README.md | 5 + .../azext_costmanagement/__init__.py | 46 + .../azext_costmanagement/action.py | 17 + .../azext_costmanagement/azext_metadata.json | 4 + .../azext_costmanagement/custom.py | 17 + .../generated/__init__.py | 12 + .../generated/_client_factory.py | 39 + .../azext_costmanagement/generated/_help.py | 782 +++++++ .../azext_costmanagement/generated/_params.py | 462 ++++ .../generated/_validators.py | 23 + .../azext_costmanagement/generated/action.py | 216 ++ .../generated/commands.py | 82 + .../azext_costmanagement/generated/custom.py | 324 +++ .../azext_costmanagement/manual/__init__.py | 12 + .../azext_costmanagement/tests/__init__.py | 49 + .../tests/latest/__init__.py | 12 + .../tests/latest/preparers.py | 116 + .../latest/test_costmanagement_scenario.py | 1469 ++++++++++++ .../vendored_sdks/__init__.py | 12 + .../vendored_sdks/costmanagement/__init__.py | 19 + .../costmanagement/_configuration.py | 63 + .../costmanagement/_cost_management_client.py | 93 + .../vendored_sdks/costmanagement/_version.py | 9 + .../costmanagement/aio/__init__.py | 10 + .../aio/_configuration_async.py | 59 + .../aio/_cost_management_client_async.py | 85 + .../aio/operations_async/__init__.py | 25 + .../_alert_operations_async.py | 165 ++ .../_dimension_operations_async.py | 244 ++ .../_export_operations_async.py | 502 ++++ .../_forecast_operations_async.py | 259 +++ .../_operation_operations_async.py | 101 + .../_query_operations_async.py | 233 ++ .../_view_operations_async.py | 669 ++++++ .../costmanagement/models/__init__.py | 185 ++ .../models/_cost_management_client_enums.py | 174 ++ .../costmanagement/models/_models.py | 1874 +++++++++++++++ .../costmanagement/models/_models_py3.py | 2061 +++++++++++++++++ .../costmanagement/operations/__init__.py | 25 + .../operations/_alert_operations.py | 171 ++ .../operations/_dimension_operations.py | 250 ++ .../operations/_export_operations.py | 512 ++++ .../operations/_forecast_operations.py | 265 +++ .../operations/_operation_operations.py | 106 + .../operations/_query_operations.py | 239 ++ .../operations/_view_operations.py | 681 ++++++ .../vendored_sdks/costmanagement/py.typed | 1 + .../vendored_sdks/costmanagement/setup.py | 37 + src/costmanagement/report.md | 216 ++ src/costmanagement/setup.cfg | 1 + src/costmanagement/setup.py | 53 + 52 files changed, 13094 insertions(+) create mode 100644 src/costmanagement/HISTORY.rst create mode 100644 src/costmanagement/README.md create mode 100644 src/costmanagement/azext_costmanagement/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/action.py create mode 100644 src/costmanagement/azext_costmanagement/azext_metadata.json create mode 100644 src/costmanagement/azext_costmanagement/custom.py create mode 100644 src/costmanagement/azext_costmanagement/generated/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/generated/_client_factory.py create mode 100644 src/costmanagement/azext_costmanagement/generated/_help.py create mode 100644 src/costmanagement/azext_costmanagement/generated/_params.py create mode 100644 src/costmanagement/azext_costmanagement/generated/_validators.py create mode 100644 src/costmanagement/azext_costmanagement/generated/action.py create mode 100644 src/costmanagement/azext_costmanagement/generated/commands.py create mode 100644 src/costmanagement/azext_costmanagement/generated/custom.py create mode 100644 src/costmanagement/azext_costmanagement/manual/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/tests/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/tests/latest/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/tests/latest/preparers.py create mode 100644 src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_dimension_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_export_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_forecast_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_cost_management_client_enums.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/py.typed create mode 100644 src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py create mode 100644 src/costmanagement/report.md create mode 100644 src/costmanagement/setup.cfg create mode 100644 src/costmanagement/setup.py diff --git a/src/costmanagement/HISTORY.rst b/src/costmanagement/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/costmanagement/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/costmanagement/README.md b/src/costmanagement/README.md new file mode 100644 index 00000000000..cb4eea58d74 --- /dev/null +++ b/src/costmanagement/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'costmanagement' Extension +========================================== + +This package is for the 'costmanagement' extension. +i.e. 'az costmanagement' diff --git a/src/costmanagement/azext_costmanagement/__init__.py b/src/costmanagement/azext_costmanagement/__init__.py new file mode 100644 index 00000000000..0dea69d2cb9 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core import AzCommandsLoader +from azext_costmanagement.generated._help import helps # pylint: disable=unused-import + + +class CostManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_costmanagement.generated._client_factory import cf_costmanagement + costmanagement_custom = CliCommandType( + operations_tmpl='azext_costmanagement.custom#{}', + client_factory=cf_costmanagement) + super(CostManagementClientCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=costmanagement_custom) + + def load_command_table(self, args): + from azext_costmanagement.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_costmanagement.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_costmanagement.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_costmanagement.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = CostManagementClientCommandsLoader diff --git a/src/costmanagement/azext_costmanagement/action.py b/src/costmanagement/azext_costmanagement/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/costmanagement/azext_costmanagement/azext_metadata.json b/src/costmanagement/azext_costmanagement/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/costmanagement/azext_costmanagement/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/costmanagement/azext_costmanagement/custom.py b/src/costmanagement/azext_costmanagement/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/costmanagement/azext_costmanagement/generated/__init__.py b/src/costmanagement/azext_costmanagement/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/costmanagement/azext_costmanagement/generated/_client_factory.py b/src/costmanagement/azext_costmanagement/generated/_client_factory.py new file mode 100644 index 00000000000..7a27bc92e85 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/_client_factory.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_costmanagement(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.costmanagement import CostManagementClient + return get_mgmt_service_client(cli_ctx, CostManagementClient) + + +def cf_view(cli_ctx, *_): + return cf_costmanagement(cli_ctx).view + + +def cf_alert(cli_ctx, *_): + return cf_costmanagement(cli_ctx).alert + + +def cf_forecast(cli_ctx, *_): + return cf_costmanagement(cli_ctx).forecast + + +def cf_dimension(cli_ctx, *_): + return cf_costmanagement(cli_ctx).dimension + + +def cf_query(cli_ctx, *_): + return cf_costmanagement(cli_ctx).query + + +def cf_export(cli_ctx, *_): + return cf_costmanagement(cli_ctx).export diff --git a/src/costmanagement/azext_costmanagement/generated/_help.py b/src/costmanagement/azext_costmanagement/generated/_help.py new file mode 100644 index 00000000000..d6838fe55cb --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/_help.py @@ -0,0 +1,782 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['costmanagement view'] = """ + type: group + short-summary: costmanagement view +""" + +helps['costmanagement view list'] = """ + type: command + short-summary: Lists all views by tenant and object. + examples: + - name: ResourceGroupViewList + text: |- + az costmanagement view list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/M\ +YDEVTESTRG" +""" + +helps['costmanagement view show'] = """ + type: command + short-summary: Gets the view by view name. + examples: + - name: ResourceGroupView + text: |- + az costmanagement view show --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/M\ +YDEVTESTRG" --view-name "swaggerExample" +""" + +helps['costmanagement view create'] = """ + type: command + short-summary: The operation to create or update a view. Update operation requires latest eTag to be set in the req\ +uest. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + examples: + - name: ResourceGroupCreateOrUpdateView + text: |- + az costmanagement view create --e-tag "\\"1d4ff9fe66f1d10\\"" --accumulated "true" --chart "Table" --dis\ +play-name "swagger Example" --kpis type="Forecast" enabled=true id=null --kpis type="Budget" enabled=true id="/subscrip\ +tions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDe\ +mo" --metric "ActualCost" --pivots name="ServiceName" type="Dimension" --pivots name="MeterCategory" type="Dimension" -\ +-pivots name="swaggerTagKey" type="TagKey" --query-dataset "{\\"aggregation\\":{\\"totalCost\\":{\\"name\\":\\"PreTaxCo\ +st\\",\\"function\\":\\"Sum\\"}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{\\"name\\":\\"UsageDat\ +e\\",\\"direction\\":\\"Ascending\\"}]}" --query-timeframe "MonthToDate" --properties-scope "subscriptions/00000000-000\ +0-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" --view-name "swaggerExample" +""" + +helps['costmanagement view delete'] = """ + type: command + short-summary: The operation to delete a view. + examples: + - name: ResourceGroupDeleteView + text: |- + az costmanagement view delete --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups\ +/MYDEVTESTRG" --view-name "TestView" +""" + +helps['costmanagement alert'] = """ + type: group + short-summary: costmanagement alert +""" + +helps['costmanagement alert list'] = """ + type: command + short-summary: Lists the alerts for scope defined. + examples: + - name: BillingAccountAlerts + text: |- + az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileAlerts + text: |- + az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProf\ +iles/13579" + - name: DepartmentAlerts + text: |- + az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments\ +/123" + - name: EnrollmentAccountAlerts + text: |- + az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentA\ +ccounts/456" + - name: InvoiceSectionAlerts + text: |- + az costmanagement alert list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProf\ +iles/13579/invoiceSections/9876" + - name: ResourceGroupAlerts + text: |- + az costmanagement alert list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/\ +ScreenSharingTest-peer" + - name: SubscriptionAlerts + text: |- + az costmanagement alert list --scope "subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement alert list-external'] = """ + type: command + short-summary: Lists the Alerts for external cloud provider type defined. + examples: + - name: ExternalBillingAccountAlerts + text: |- + az costmanagement alert list-external --external-cloud-provider-id "100" --external-cloud-provider-type \ +"externalBillingAccounts" + - name: ExternalSubscriptionAlerts + text: |- + az costmanagement alert list-external --external-cloud-provider-id "100" --external-cloud-provider-type \ +"externalSubscriptions" +""" + +helps['costmanagement forecast'] = """ + type: group + short-summary: costmanagement forecast +""" + +helps['costmanagement forecast external-cloud-provider-usage'] = """ + type: command + short-summary: Lists the forecast charges for external cloud provider type defined. + examples: + - name: ExternalBillingAccountForecast + text: |- + az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" --external-c\ +loud-provider-type "externalBillingAccounts" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" + - name: ExternalSubscriptionForecast + text: |- + az costmanagement forecast external-cloud-provider-usage --external-cloud-provider-id "100" --external-c\ +loud-provider-type "externalSubscriptions" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\\ +"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\\ +"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\"\ +:\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" +""" + +helps['costmanagement forecast usage'] = """ + type: command + short-summary: Lists the forecast charges for scope defined. + examples: + - name: BillingAccountForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billi\ +ngProfiles/13579" + - name: DepartmentForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/depar\ +tments/123" + - name: EnrollmentAccountForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrol\ +lmentAccounts/456" + - name: InvoiceSectionForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billi\ +ngProfiles/13579/invoiceSections/9876" + - name: ResourceGroupForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceG\ +roups/ScreenSharingTest-peer" + - name: SubscriptionForecast + text: |- + az costmanagement forecast usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --include-actual-cost false --include-f\ +resh-partial-cost false --timeframe "MonthToDate" --scope "subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement dimension'] = """ + type: group + short-summary: costmanagement dimension +""" + +helps['costmanagement dimension list'] = """ + type: command + short-summary: Lists the dimensions by the defined scope. + examples: + - name: BillingAccountDimensionsList-Legacy + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100" + - name: BillingAccountDimensionsList-Modern + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingAccountDimensionsListExpandAndTop-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/100" + - name: BillingAccountDimensionsListExpandAndTop-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/12345:6789" + - name: BillingAccountDimensionsListWithFilter-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/100" + - name: BillingAccountDimensionsListWithFilter-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileDimensionsList-Modern + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billing\ +Profiles/13579" + - name: BillingProfileDimensionsListExpandAndTop-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/12345:6789/billingProfiles/13579" + - name: BillingProfileDimensionsListWithFilter-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" + - name: CustomerDimensionsList-Modern + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/custome\ +rs/5678" + - name: CustomerDimensionsListExpandAndTop-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/12345:6789/customers/5678" + - name: CustomerDimensionsListWithFilter-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" + - name: DepartmentDimensionsList-Legacy + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100/departments/12\ +3" + - name: DepartmentDimensionsListExpandAndTop-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/100/departments/123" + - name: DepartmentDimensionsListWithFilter-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/100/departments/123" + - name: EnrollmentAccountDimensionsList-Legacy + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAcco\ +unts/456" + - name: EnrollmentAccountDimensionsListExpandAndTop-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/100/enrollmentAccounts/456" + - name: EnrollmentAccountDimensionsListWithFilter-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: InvoiceSectionDimensionsList-Modern + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billing\ +Profiles/13579/invoiceSections/9876" + - name: InvoiceSectionDimensionsListExpandAndTop-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Billing\ +/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" + - name: InvoiceSectionDimensionsListWithFilter-Modern + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876\ +" + - name: ManagementGroupDimensionsList-Legacy + text: |- + az costmanagement dimension list --scope "providers/Microsoft.Management/managementGroups/MyMgId" + - name: ManagementGroupDimensionsListExpandAndTop-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "providers/Microsoft.Managem\ +ent/managementGroups/MyMgId" + - name: ManagementGroupDimensionsListWithFilter-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --filter "properties/category eq \'resourceI\ +d\'" --top 5 --scope "providers/Microsoft.Management/managementGroups/MyMgId" + - name: ResourceGroupDimensionsList-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "subscriptions/00000000-0000\ +-0000-0000-000000000000/resourceGroups/system.orlando" + - name: SubscriptionDimensionsList-Legacy + text: |- + az costmanagement dimension list --expand "properties/data" --top 5 --scope "subscriptions/00000000-0000\ +-0000-0000-000000000000" +""" + +helps['costmanagement dimension by-external-cloud-provider-type'] = """ + type: command + short-summary: Lists the dimensions by the external cloud provider type. + examples: + - name: ExternalBillingAccountDimensionList + text: |- + az costmanagement dimension by-external-cloud-provider-type --external-cloud-provider-id "100" --externa\ +l-cloud-provider-type "externalBillingAccounts" + - name: ExternalSubscriptionDimensionList + text: |- + az costmanagement dimension by-external-cloud-provider-type --external-cloud-provider-id "100" --externa\ +l-cloud-provider-type "externalSubscriptions" +""" + +helps['costmanagement query'] = """ + type: group + short-summary: costmanagement query +""" + +helps['costmanagement query usage'] = """ + type: command + short-summary: Query the usage data for scope defined. + examples: + - name: BillingAccountQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/70664866" + - name: BillingAccountQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingAccountQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/70664866" + - name: BillingAccountQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789" + - name: BillingProfileQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" + - name: BillingProfileQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579" + - name: CustomerQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" + - name: CustomerQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678" + - name: DepartmentQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/100/departments/123" + - name: DepartmentQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/100/departments/123" + - name: EnrollmentAccountQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: EnrollmentAccountQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456" + - name: InvoiceSectionQuery-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" + - name: InvoiceSectionQueryGrouping-Modern + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/9876" + - name: ManagementGroupQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "provid\ +ers/Microsoft.Management/managementGroups/MyMgId" + - name: ManagementGroupQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "providers/Microsoft.Management/managementGroups/MyMgId" + - name: ResourceGroupQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "subscr\ +iptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" + - name: ResourceGroupQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceType" type="Dimension" --timeframe "TheLastMonth\ +" --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer" + - name: SubscriptionQuery-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\ +\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\ +\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\ +\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" --scope "subscr\ +iptions/00000000-0000-0000-0000-000000000000" + - name: SubscriptionQueryGrouping-Legacy + text: |- + az costmanagement query usage --type "Usage" --dataset-aggregation "{\\"totalCost\\":{\\"name\\":\\"PreT\ +axCost\\",\\"function\\":\\"Sum\\"}}" --dataset-grouping name="ResourceGroup" type="Dimension" --timeframe "TheLastMont\ +h" --scope "subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement query usage-by-external-cloud-provider-type'] = """ + type: command + short-summary: Query the usage data for external cloud provider type defined. + examples: + - name: ExternalBillingAccountQueryList + text: |- + az costmanagement query usage-by-external-cloud-provider-type --external-cloud-provider-id "100" --exter\ +nal-cloud-provider-type "externalBillingAccounts" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\ +\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\ +\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"\ +name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" + - name: ExternalSubscriptionsQuery + text: |- + az costmanagement query usage-by-external-cloud-provider-type --external-cloud-provider-id "100" --exter\ +nal-cloud-provider-type "externalSubscriptions" --type "Usage" --dataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\\ +":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\\ +":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"na\ +me\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}]}" --timeframe "MonthToDate" +""" + +helps['costmanagement export'] = """ + type: group + short-summary: costmanagement export +""" + +helps['costmanagement export list'] = """ + type: command + short-summary: The operation to list all exports at the given scope. + examples: + - name: BillingAccountExportList + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/123456" + - name: DepartmentExportList + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/12/departments/123" + - name: EnrollmentAccountExportList + text: |- + az costmanagement export list --scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccount\ +s/456" + - name: ManagementGroupExportList + text: |- + az costmanagement export list --scope "providers/Microsoft.Management/managementGroups/TestMG" + - name: ResourceGroupExportList + text: |- + az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups\ +/MYDEVTESTRG" + - name: SubscriptionExportList + text: |- + az costmanagement export list --scope "subscriptions/00000000-0000-0000-0000-000000000000" +""" + +helps['costmanagement export show'] = """ + type: command + short-summary: The operation to get the execution history of an export for the defined scope by export name. + examples: + - name: BillingAccountExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/123456" + - name: DepartmentExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/12/departments/1234" + - name: EnrollmentAccountExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "providers/Microsoft.Billing/billingAcc\ +ounts/100/enrollmentAccounts/456" + - name: ManagementGroupExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "providers/Microsoft.Management/managem\ +entGroups/TestMG" + - name: ResourceGroupExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-\ +000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionExport + text: |- + az costmanagement export show --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-0000-\ +000000000000" +""" + +helps['costmanagement export create'] = """ + type: command + short-summary: The operation to create or update a export. Update operation requires latest eTag to be set in the r\ +equest. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + examples: + - name: BillingAccountCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/123456" + - name: DepartmentCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/12/departments/1234" + - name: EnrollmentAccountCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/100/enrollmentAccounts/456" + - name: ManagementGroupCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Management/ma\ +nagementGroups/TestMG" + - name: ResourceGroupCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-\ +0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionCreateOrUpdateExport + text: |- + az costmanagement export create --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-\ +0000-000000000000" +""" + +helps['costmanagement export update'] = """ + type: command + short-summary: The operation to create or update a export. Update operation requires latest eTag to be set in the r\ +equest. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + examples: + - name: BillingAccountCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/123456" + - name: DepartmentCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/12/departments/1234" + - name: EnrollmentAccountCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Billing/billi\ +ngAccounts/100/enrollmentAccounts/456" + - name: ManagementGroupCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "providers/Microsoft.Management/ma\ +nagementGroups/TestMG" + - name: ResourceGroupCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-\ +0000-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionCreateOrUpdateExport + text: |- + az costmanagement export update --export-name "TestExport" --definition-type "Usage" --definition-datase\ +t-aggregation "{\\"costSum\\":{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}" --definition-dataset-configurati\ +on columns="Date" columns="MeterId" columns="InstanceId" columns="ResourceLocation" columns="PreTaxCost" --definition-d\ +ataset-filter "{\\"and\\":[{\\"or\\":[{\\"dimension\\":{\\"name\\":\\"ResourceLocation\\",\\"operator\\":\\"In\\",\\"va\ +lues\\":[\\"East US\\",\\"West Europe\\"]}},{\\"tag\\":{\\"name\\":\\"Environment\\",\\"operator\\":\\"In\\",\\"values\ +\\":[\\"UAT\\",\\"Prod\\"]}}]},{\\"dimension\\":{\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\ +\\"API\\"]}}]}" --definition-dataset-grouping name="SubscriptionName" type="Dimension" --definition-dataset-grouping na\ +me="Environment" type="Tag" --definition-timeframe "MonthToDate" --delivery-info-destination container="exports" resour\ +ce-id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/stora\ +geAccounts/ccmeastusdiag182" root-folder-path="ad-hoc" --schedule-recurrence "Weekly" --schedule-recurrence-period from\ +="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" --schedule-status "Active" --scope "subscriptions/00000000-0000-0000-\ +0000-000000000000" +""" + +helps['costmanagement export delete'] = """ + type: command + short-summary: The operation to delete a export. + examples: + - name: BillingAccountDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "providers/Microsoft.Billing/billingA\ +ccounts/123456" + - name: DepartmentDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "providers/Microsoft.Billing/billingA\ +ccounts/12/departments/1234" + - name: EnrollmentAccountDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "providers/Microsoft.Billing/billingA\ +ccounts/100/enrollmentAccounts/456" + - name: ManagementGroupDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "providers/Microsoft.Management/manag\ +ementGroups/TestMG" + - name: ResourceGroupDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-000\ +0-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionDeleteExport + text: |- + az costmanagement export delete --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-000\ +0-000000000000" +""" + +helps['costmanagement export execute'] = """ + type: command + short-summary: The operation to execute a export. + examples: + - name: BillingAccountExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "providers/Microsoft.Billing/billing\ +Accounts/123456" + - name: DepartmentExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "providers/Microsoft.Billing/billing\ +Accounts/12/departments/1234" + - name: EnrollmentAccountExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "providers/Microsoft.Billing/billing\ +Accounts/100/enrollmentAccounts/456" + - name: ManagementGroupExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "providers/Microsoft.Management/mana\ +gementGroups/TestMG" + - name: ResourceGroupExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-00\ +00-000000000000/resourceGroups/MYDEVTESTRG" + - name: SubscriptionExecuteExport + text: |- + az costmanagement export execute --export-name "TestExport" --scope "subscriptions/00000000-0000-0000-00\ +00-000000000000" +""" diff --git a/src/costmanagement/azext_costmanagement/generated/_params.py b/src/costmanagement/azext_costmanagement/generated/_params.py new file mode 100644 index 00000000000..206e1cc28b1 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/_params.py @@ -0,0 +1,462 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + get_three_state_flag, + get_enum_type +) +from azext_costmanagement.action import ( + AddKpis, + AddPivots, + AddQueryTimePeriod, + AddTimePeriod, + AddDatasetConfiguration, + AddDatasetGrouping, + AddDeliveryInfoDestination, + AddScheduleRecurrencePeriod +) + + +def load_arguments(self, _): + + with self.argument_context('costmanagement view list') as c: + c.argument('scope', help='The scope associated with view operations. This includes \'subscriptions/{subscriptio' + 'nId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + '\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}\' for ' + 'Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments' + '/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'providers/Microsoft' + '.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for BillingProfile' + ' scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSe' + 'ctionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/managementGroups/{managementG' + 'roupId}\' for Management Group scope, \'providers/Microsoft.CostManagement/externalBillingAccounts/' + '{externalBillingAccountName}\' for External Billing Account scope and \'providers/Microsoft.CostMan' + 'agement/externalSubscriptions/{externalSubscriptionName}\' for External Subscription scope.') + + with self.argument_context('costmanagement view show') as c: + c.argument('scope', help='The scope associated with view operations. This includes \'subscriptions/{subscriptio' + 'nId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + '\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}\' for ' + 'Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments' + '/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'providers/Microsoft' + '.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for BillingProfile' + ' scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSe' + 'ctionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/managementGroups/{managementG' + 'roupId}\' for Management Group scope, \'providers/Microsoft.CostManagement/externalBillingAccounts/' + '{externalBillingAccountName}\' for External Billing Account scope and \'providers/Microsoft.CostMan' + 'agement/externalSubscriptions/{externalSubscriptionName}\' for External Subscription scope.') + c.argument('view_name', help='View name') + + with self.argument_context('costmanagement view create') as c: + c.argument('scope', help='The scope associated with view operations. This includes \'subscriptions/{subscriptio' + 'nId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + '\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}\' for ' + 'Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments' + '/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'providers/Microsoft' + '.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for BillingProfile' + ' scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSe' + 'ctionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/managementGroups/{managementG' + 'roupId}\' for Management Group scope, \'providers/Microsoft.CostManagement/externalBillingAccounts/' + '{externalBillingAccountName}\' for External Billing Account scope and \'providers/Microsoft.CostMan' + 'agement/externalSubscriptions/{externalSubscriptionName}\' for External Subscription scope.') + c.argument('view_name', help='View name') + c.argument('e_tag', help='eTag of the resource. To handle concurrent update scenario, this field will be used t' + 'o determine whether the user is updating the latest version or not.') + c.argument('display_name', help='User input name of the view. Required.') + c.argument('properties_scope', help='Cost Management scope to save the view on. This includes \'subscriptions/{' + 'subscriptionId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourceGroups/{resource' + 'GroupName}\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccount' + 'Id}\' for Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/d' + 'epartments/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'providers' + '/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for Bill' + 'ingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/' + '{invoiceSectionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/managementGroups/{m' + 'anagementGroupId}\' for Management Group scope, \'/providers/Microsoft.CostManagement/externalBilli' + 'ngAccounts/{externalBillingAccountName}\' for ExternalBillingAccount scope, and \'/providers/Micros' + 'oft.CostManagement/externalSubscriptions/{externalSubscriptionName}\' for ExternalSubscription scop' + 'e.') + c.argument('chart', arg_type=get_enum_type(['Area', 'Line', 'StackedColumn', 'GroupedColumn', 'Table']), help= + 'Chart type of the main view in Cost Analysis. Required.') + c.argument('accumulated', arg_type=get_enum_type(['true', 'false']), help='Show costs accumulated over time.') + c.argument('metric', arg_type=get_enum_type(['ActualCost', 'AmortizedCost', 'AHUB']), help='Metric to use when ' + 'displaying costs.') + c.argument('kpis', action=AddKpis, nargs='+', help='List of KPIs to show in Cost Analysis UI. Expect value: KEY' + '1=VALUE1 KEY2=VALUE2 ... , available KEYs are: type, id, enabled.') + c.argument('pivots', action=AddPivots, nargs='+', help='Configuration of 3 sub-views in the Cost Analysis UI. E' + 'xpect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: type, name.') + c.argument('query_timeframe', arg_type=get_enum_type(['WeekToDate', 'MonthToDate', 'YearToDate', 'Custom']), + help='The time frame for pulling data for the report. If custom, then a specific time period must be' + ' provided.') + c.argument('query_time_period', action=AddQueryTimePeriod, nargs='+', help='Has time period for pulling data fo' + 'r the report. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('query_dataset', arg_type=CLIArgumentType(options_list=['--query-dataset'], help='Has definition for' + ' data in this report config. Expected value: json-string/@json-file.')) + + with self.argument_context('costmanagement view delete') as c: + c.argument('scope', help='The scope associated with view operations. This includes \'subscriptions/{subscriptio' + 'nId}\' for subscription scope, \'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + '\' for resourceGroup scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}\' for ' + 'Billing Account scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments' + '/{departmentId}\' for Department scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccou' + 'ntId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'providers/Microsoft' + '.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for BillingProfile' + ' scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSe' + 'ctionId}\' for InvoiceSection scope, \'providers/Microsoft.Management/managementGroups/{managementG' + 'roupId}\' for Management Group scope, \'providers/Microsoft.CostManagement/externalBillingAccounts/' + '{externalBillingAccountName}\' for External Billing Account scope and \'providers/Microsoft.CostMan' + 'agement/externalSubscriptions/{externalSubscriptionName}\' for External Subscription scope.') + c.argument('view_name', help='View name') + + with self.argument_context('costmanagement alert list') as c: + c.argument('scope', help='The scope associated with alerts operations. This includes \'/subscriptions/{subscrip' + 'tionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupN' + 'ame}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}\'' + ' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/de' + 'partments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'/provider' + 's/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, \'/provider' + 's/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for bil' + 'lingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfile' + 's/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and \'/provider' + 's/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific for partne' + 'rs.') + + with self.argument_context('costmanagement alert list-external') as c: + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', 'externalBillingAcc' + 'ounts']), help='The external cloud provider type associated with dimension/query operations. This i' + 'ncludes \'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidat' + 'ed account.') + c.argument('external_cloud_provider_id', help='This can be \'{externalSubscriptionId}\' for linked account or ' + '\'{externalBillingAccountId}\' for consolidated account used with dimension/query operations.') + + with self.argument_context('costmanagement forecast external-cloud-provider-usage') as c: + c.argument('filter', help='May be used to filter forecasts by properties/usageDate (Utc time), properties/charg' + 'eType or properties/grain. The filter supports \'eq\', \'lt\', \'gt\', \'le\', \'ge\', and \'and\'.' + ' It does not currently support \'ne\', \'or\', or \'not\'.') + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', 'externalBillingAcc' + 'ounts']), help='The external cloud provider type associated with dimension/query operations. This i' + 'ncludes \'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidat' + 'ed account.') + c.argument('external_cloud_provider_id', help='This can be \'{externalSubscriptionId}\' for linked account or ' + '\'{externalBillingAccountId}\' for consolidated account used with dimension/query operations.') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the forecast.') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', 'TheLastBi' + 'llingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the forecast. If c' + 'ustom, then a specific time period must be provided.') + c.argument('time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data for the forec' + 'ast. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('include_actual_cost', arg_type=get_three_state_flag(), help='a boolean determining if actualCost wi' + 'll be included') + c.argument('include_fresh_partial_cost', arg_type=get_three_state_flag(), help='a boolean determining if FreshP' + 'artialCost will be included') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configuration informat' + 'ion for the data in the export. The configuration will be ignored if aggregation and grouping are p' + 'rovided. Expect value: columns=xx.') + c.argument('dataset_aggregation', arg_type=CLIArgumentType(options_list=['--dataset-aggregation'], help='Dictio' + 'nary of aggregation expression to use in the query. The key of each item in the dictionary is the a' + 'lias for the aggregated column. Query can have up to 2 aggregation clauses. Expected value: json-st' + 'ring/@json-file.')) + c.argument('dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by expression to use ' + 'in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , ' + 'available KEYs are: type, name.') + c.argument('dataset_filter', arg_type=CLIArgumentType(options_list=['--dataset-filter'], help='Has filter expre' + 'ssion to use in the query. Expected value: json-string/@json-file.')) + + with self.argument_context('costmanagement forecast usage') as c: + c.argument('filter', help='May be used to filter forecasts by properties/usageDate (Utc time), properties/charg' + 'eType or properties/grain. The filter supports \'eq\', \'lt\', \'gt\', \'le\', \'ge\', and \'and\'.' + ' It does not currently support \'ne\', \'or\', or \'not\'.') + c.argument('scope', help='The scope associated with forecast operations. This includes \'/subscriptions/{subscr' + 'iptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{resourceGrou' + 'pName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + '\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/' + 'departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAccounts/{' + 'billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'/provid' + 'ers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, \'/provid' + 'ers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for b' + 'illingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfi' + 'les/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and \'/provid' + 'ers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific for part' + 'ners.') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the forecast.') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', 'TheLastBi' + 'llingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the forecast. If c' + 'ustom, then a specific time period must be provided.') + c.argument('time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data for the forec' + 'ast. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('include_actual_cost', arg_type=get_three_state_flag(), help='a boolean determining if actualCost wi' + 'll be included') + c.argument('include_fresh_partial_cost', arg_type=get_three_state_flag(), help='a boolean determining if FreshP' + 'artialCost will be included') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configuration informat' + 'ion for the data in the export. The configuration will be ignored if aggregation and grouping are p' + 'rovided. Expect value: columns=xx.') + c.argument('dataset_aggregation', arg_type=CLIArgumentType(options_list=['--dataset-aggregation'], help='Dictio' + 'nary of aggregation expression to use in the query. The key of each item in the dictionary is the a' + 'lias for the aggregated column. Query can have up to 2 aggregation clauses. Expected value: json-st' + 'ring/@json-file.')) + c.argument('dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by expression to use ' + 'in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , ' + 'available KEYs are: type, name.') + c.argument('dataset_filter', arg_type=CLIArgumentType(options_list=['--dataset-filter'], help='Has filter expre' + 'ssion to use in the query. Expected value: json-string/@json-file.')) + + with self.argument_context('costmanagement dimension list') as c: + c.argument('scope', help='The scope associated with dimension operations. This includes \'/subscriptions/{subsc' + 'riptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{resourceGro' + 'upName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId' + '}\' for Billing Account scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/de' + 'partments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAccounts/{bi' + 'llingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, \'/provider' + 's/Microsoft.Management/managementGroups/{managementGroupId}\' for Management Group scope, \'/provid' + 'ers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}\' for b' + 'illingProfile scope, \'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfil' + 'es/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and \'provider' + 's/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific for partne' + 'rs.') + c.argument('filter', help='May be used to filter dimensions by properties/category, properties/usageStart, prop' + 'erties/usageEnd. Supported operators are \'eq\',\'lt\', \'gt\', \'le\', \'ge\'.') + c.argument('expand', help='May be used to expand the properties/data within a dimension category. By default, d' + 'ata is not included when listing dimensions.') + c.argument('skiptoken', help='Skiptoken is only used if a previous operation returned a partial result. If a pr' + 'evious response contains a nextLink element, the value of the nextLink element will include a skipt' + 'oken parameter that specifies a starting point to use for subsequent calls.') + c.argument('top', help='May be used to limit the number of results to the most recent N dimension data.') + + with self.argument_context('costmanagement dimension by-external-cloud-provider-type') as c: + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', 'externalBillingAcc' + 'ounts']), help='The external cloud provider type associated with dimension/query operations. This i' + 'ncludes \'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidat' + 'ed account.') + c.argument('external_cloud_provider_id', help='This can be \'{externalSubscriptionId}\' for linked account or ' + '\'{externalBillingAccountId}\' for consolidated account used with dimension/query operations.') + c.argument('filter', help='May be used to filter dimensions by properties/category, properties/usageStart, prop' + 'erties/usageEnd. Supported operators are \'eq\',\'lt\', \'gt\', \'le\', \'ge\'.') + c.argument('expand', help='May be used to expand the properties/data within a dimension category. By default, d' + 'ata is not included when listing dimensions.') + c.argument('skiptoken', help='Skiptoken is only used if a previous operation returned a partial result. If a pr' + 'evious response contains a nextLink element, the value of the nextLink element will include a skipt' + 'oken parameter that specifies a starting point to use for subsequent calls.') + c.argument('top', help='May be used to limit the number of results to the most recent N dimension data.') + + with self.argument_context('costmanagement query usage') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the query.') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', 'TheLastBi' + 'llingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the query. If cust' + 'om, then a specific time period must be provided.') + c.argument('time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data for the query' + '. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configuration informat' + 'ion for the data in the export. The configuration will be ignored if aggregation and grouping are p' + 'rovided. Expect value: columns=xx.') + c.argument('dataset_aggregation', arg_type=CLIArgumentType(options_list=['--dataset-aggregation'], help='Dictio' + 'nary of aggregation expression to use in the query. The key of each item in the dictionary is the a' + 'lias for the aggregated column. Query can have up to 2 aggregation clauses. Expected value: json-st' + 'ring/@json-file.')) + c.argument('dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by expression to use ' + 'in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , ' + 'available KEYs are: type, name.') + c.argument('dataset_filter', arg_type=CLIArgumentType(options_list=['--dataset-filter'], help='Has filter expre' + 'ssion to use in the query. Expected value: json-string/@json-file.')) + + with self.argument_context('costmanagement query usage-by-external-cloud-provider-type') as c: + c.argument('external_cloud_provider_type', arg_type=get_enum_type(['externalSubscriptions', 'externalBillingAcc' + 'ounts']), help='The external cloud provider type associated with dimension/query operations. This i' + 'ncludes \'externalSubscriptions\' for linked account and \'externalBillingAccounts\' for consolidat' + 'ed account.') + c.argument('external_cloud_provider_id', help='This can be \'{externalSubscriptionId}\' for linked account or ' + '\'{externalBillingAccountId}\' for consolidated account used with dimension/query operations.') + c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), + help='The type of the query.') + c.argument('timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', 'TheLastBi' + 'llingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the query. If cust' + 'om, then a specific time period must be provided.') + c.argument('time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data for the query' + '. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configuration informat' + 'ion for the data in the export. The configuration will be ignored if aggregation and grouping are p' + 'rovided. Expect value: columns=xx.') + c.argument('dataset_aggregation', arg_type=CLIArgumentType(options_list=['--dataset-aggregation'], help='Dictio' + 'nary of aggregation expression to use in the query. The key of each item in the dictionary is the a' + 'lias for the aggregated column. Query can have up to 2 aggregation clauses. Expected value: json-st' + 'ring/@json-file.')) + c.argument('dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by expression to use ' + 'in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , ' + 'available KEYs are: type, name.') + c.argument('dataset_filter', arg_type=CLIArgumentType(options_list=['--dataset-filter'], help='Has filter expre' + 'ssion to use in the query. Expected value: json-string/@json-file.')) + + with self.argument_context('costmanagement export list') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + + with self.argument_context('costmanagement export show') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('export_name', help='Export Name.') + + with self.argument_context('costmanagement export create') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('export_name', help='Export Name.') + c.argument('definition_type', arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), help='The type ' + 'of the query.') + c.argument('definition_timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the quer' + 'y. If custom, then a specific time period must be provided.') + c.argument('definition_time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data fo' + 'r the query. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('definition_dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configurati' + 'on information for the data in the export. The configuration will be ignored if aggregation and gro' + 'uping are provided. Expect value: columns=xx.') + c.argument('definition_dataset_aggregation', arg_type=CLIArgumentType(options_list=['--definition-dataset-aggre' + 'gation'], help='Dictionary of aggregation expression to use in the query. The key of each item in t' + 'he dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses. E' + 'xpected value: json-string/@json-file.')) + c.argument('definition_dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by express' + 'ion to use in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VA' + 'LUE2 ... , available KEYs are: type, name.') + c.argument('definition_dataset_filter', arg_type=CLIArgumentType(options_list=['--definition-dataset-filter'], + help='Has filter expression to use in the query. Expected value: json-string/@json-file.')) + c.argument('delivery_info_destination', action=AddDeliveryInfoDestination, nargs='+', help='Has destination for' + ' the export being delivered. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: resour' + 'ce-id, container, root-folder-path.') + c.argument('schedule_status', arg_type=get_enum_type(['Active', 'Inactive']), help='The status of the schedule.' + ' Whether active or not. If inactive, the export\'s scheduled execution is paused.') + c.argument('schedule_recurrence', arg_type=get_enum_type(['Daily', 'Weekly', 'Monthly', 'Annually']), help='The' + ' schedule recurrence.') + c.argument('schedule_recurrence_period', action=AddScheduleRecurrencePeriod, nargs='+', help='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. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + + with self.argument_context('costmanagement export update') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('export_name', help='Export Name.') + c.argument('definition_type', arg_type=get_enum_type(['Usage', 'ActualCost', 'AmortizedCost']), help='The type ' + 'of the query.') + c.argument('definition_timeframe', arg_type=get_enum_type(['MonthToDate', 'BillingMonthToDate', 'TheLastMonth', + 'TheLastBillingMonth', 'WeekToDate', 'Custom']), help='The time frame for pulling data for the quer' + 'y. If custom, then a specific time period must be provided.') + c.argument('definition_time_period', action=AddTimePeriod, nargs='+', help='Has time period for pulling data fo' + 'r the query. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + c.argument('definition_dataset_configuration', action=AddDatasetConfiguration, nargs='+', help='Has configurati' + 'on information for the data in the export. The configuration will be ignored if aggregation and gro' + 'uping are provided. Expect value: columns=xx.') + c.argument('definition_dataset_aggregation', arg_type=CLIArgumentType(options_list=['--definition-dataset-aggre' + 'gation'], help='Dictionary of aggregation expression to use in the query. The key of each item in t' + 'he dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses. E' + 'xpected value: json-string/@json-file.')) + c.argument('definition_dataset_grouping', action=AddDatasetGrouping, nargs='+', help='Array of group by express' + 'ion to use in the query. Query can have up to 2 group by clauses. Expect value: KEY1=VALUE1 KEY2=VA' + 'LUE2 ... , available KEYs are: type, name.') + c.argument('definition_dataset_filter', arg_type=CLIArgumentType(options_list=['--definition-dataset-filter'], + help='Has filter expression to use in the query. Expected value: json-string/@json-file.')) + c.argument('delivery_info_destination', action=AddDeliveryInfoDestination, nargs='+', help='Has destination for' + ' the export being delivered. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: resour' + 'ce-id, container, root-folder-path.') + c.argument('schedule_status', arg_type=get_enum_type(['Active', 'Inactive']), help='The status of the schedule.' + ' Whether active or not. If inactive, the export\'s scheduled execution is paused.') + c.argument('schedule_recurrence', arg_type=get_enum_type(['Daily', 'Weekly', 'Monthly', 'Annually']), help='The' + ' schedule recurrence.') + c.argument('schedule_recurrence_period', action=AddScheduleRecurrencePeriod, nargs='+', help='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. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: from, to.') + + with self.argument_context('costmanagement export delete') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('export_name', help='Export Name.') + + with self.argument_context('costmanagement export execute') as c: + c.argument('scope', help='The scope associated with query and export operations. This includes \'/subscriptions' + '/{subscriptionId}/\' for subscription scope, \'/subscriptions/{subscriptionId}/resourceGroups/{reso' + 'urceGroupName}\' for resourceGroup scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAc' + 'countId}\' for Billing Account scope and \'/providers/Microsoft.Billing/billingAccounts/{billingAcc' + 'ountId}/departments/{departmentId}\' for Department scope, \'/providers/Microsoft.Billing/billingAc' + 'counts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}\' for EnrollmentAccount scope, ' + '\'/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId' + '}\' for billingProfile scope, \'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/bil' + 'lingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}\' for invoiceSection scope, and ' + '\'/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}\' specific' + ' for partners.') + c.argument('export_name', help='Export Name.') diff --git a/src/costmanagement/azext_costmanagement/generated/_validators.py b/src/costmanagement/azext_costmanagement/generated/_validators.py new file mode 100644 index 00000000000..7536d0531ea --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/costmanagement/azext_costmanagement/generated/action.py b/src/costmanagement/azext_costmanagement/generated/action.py new file mode 100644 index 00000000000..28f4b3acc05 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/action.py @@ -0,0 +1,216 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +class AddKpis(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddKpis, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'type': + d['type'] = v[0] + elif kl == 'id': + d['id'] = v[0] + elif kl == 'enabled': + d['enabled'] = v[0] + return d + + +class AddPivots(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddPivots, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'type': + d['type'] = v[0] + elif kl == 'name': + d['name'] = v[0] + return d + + +class AddQueryTimePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.query_time_period = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'from': + d['from_property'] = v[0] + elif kl == 'to': + d['to'] = v[0] + return d + + +class AddTimePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.time_period = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'from': + d['from_property'] = v[0] + elif kl == 'to': + d['to'] = v[0] + return d + + +class AddDatasetConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.dataset_configuration = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'columns': + d['columns'] = v + return d + + +class AddDatasetGrouping(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddDatasetGrouping, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'type': + d['type'] = v[0] + elif kl == 'name': + d['name'] = v[0] + return d + + +class AddDeliveryInfoDestination(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.delivery_info_destination = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'resource-id': + d['resource_id'] = v[0] + elif kl == 'container': + d['container'] = v[0] + elif kl == 'root-folder-path': + d['root_folder_path'] = v[0] + return d + + +class AddScheduleRecurrencePeriod(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.schedule_recurrence_period = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'from': + d['from_property'] = v[0] + elif kl == 'to': + d['to'] = v[0] + return d diff --git a/src/costmanagement/azext_costmanagement/generated/commands.py b/src/costmanagement/azext_costmanagement/generated/commands.py new file mode 100644 index 00000000000..fd8bd1fef9d --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/commands.py @@ -0,0 +1,82 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_costmanagement.generated._client_factory import cf_view + costmanagement_view = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._view_operations#ViewOperations.{' + '}', + client_factory=cf_view) + with self.command_group('costmanagement view', costmanagement_view, client_factory=cf_view, + is_experimental=True) as g: + g.custom_command('list', 'costmanagement_view_list') + g.custom_show_command('show', 'costmanagement_view_show') + g.custom_command('create', 'costmanagement_view_create') + g.custom_command('delete', 'costmanagement_view_delete') + + from azext_costmanagement.generated._client_factory import cf_alert + costmanagement_alert = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._alert_operations#AlertOperations' + '.{}', + client_factory=cf_alert) + with self.command_group('costmanagement alert', costmanagement_alert, client_factory=cf_alert, + is_experimental=True) as g: + g.custom_command('list', 'costmanagement_alert_list') + g.custom_command('list-external', 'costmanagement_alert_list_external') + + from azext_costmanagement.generated._client_factory import cf_forecast + costmanagement_forecast = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._forecast_operations#ForecastOper' + 'ations.{}', + client_factory=cf_forecast) + with self.command_group('costmanagement forecast', costmanagement_forecast, client_factory=cf_forecast, + is_experimental=True) as g: + g.custom_command('external-cloud-provider-usage', 'costmanagement_forecast_external_cloud_provider_usage') + g.custom_command('usage', 'costmanagement_forecast_usage') + + from azext_costmanagement.generated._client_factory import cf_dimension + costmanagement_dimension = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._dimension_operations#DimensionOp' + 'erations.{}', + client_factory=cf_dimension) + with self.command_group('costmanagement dimension', costmanagement_dimension, client_factory=cf_dimension, + is_experimental=True) as g: + g.custom_command('list', 'costmanagement_dimension_list') + g.custom_command('by-external-cloud-provider-type', + 'costmanagement_dimension_by_external_cloud_provider_type') + + from azext_costmanagement.generated._client_factory import cf_query + costmanagement_query = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._query_operations#QueryOperations' + '.{}', + client_factory=cf_query) + with self.command_group('costmanagement query', costmanagement_query, client_factory=cf_query, + is_experimental=True) as g: + g.custom_command('usage', 'costmanagement_query_usage') + g.custom_command('usage-by-external-cloud-provider-type', 'costmanagement_query_usage_by_external_cloud_provide' + 'r_type') + + from azext_costmanagement.generated._client_factory import cf_export + costmanagement_export = CliCommandType( + operations_tmpl='azext_costmanagement.vendored_sdks.costmanagement.operations._export_operations#ExportOperatio' + 'ns.{}', + client_factory=cf_export) + with self.command_group('costmanagement export', costmanagement_export, client_factory=cf_export, + is_experimental=True) as g: + g.custom_command('list', 'costmanagement_export_list') + g.custom_show_command('show', 'costmanagement_export_show') + g.custom_command('create', 'costmanagement_export_create') + g.custom_command('update', 'costmanagement_export_update') + g.custom_command('delete', 'costmanagement_export_delete') + g.custom_command('execute', 'costmanagement_export_execute') diff --git a/src/costmanagement/azext_costmanagement/generated/custom.py b/src/costmanagement/azext_costmanagement/generated/custom.py new file mode 100644 index 00000000000..9d6a6e3804c --- /dev/null +++ b/src/costmanagement/azext_costmanagement/generated/custom.py @@ -0,0 +1,324 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +import json + + +def costmanagement_view_list(cmd, client, + scope=None): + if scope is not None: + return client.list_by_scope(scope=scope) + return client.list() + + +def costmanagement_view_show(cmd, client, + view_name, + scope=None): + if scope is not None and view_name is not None: + return client.get_by_scope(scope=scope, + view_name=view_name) + return client.get(view_name=view_name) + + +def costmanagement_view_create(cmd, client, + view_name, + scope=None, + e_tag=None, + display_name=None, + properties_scope=None, + chart=None, + accumulated=None, + metric=None, + kpis=None, + pivots=None, + query_timeframe=None, + query_time_period=None, + query_dataset=None): + if isinstance(query_dataset, str): + query_dataset = json.loads(query_dataset) + if scope is not None and view_name is not None and _parameters is not None: + return client.create_or_update_by_scope(scope=scope, + view_name=view_name, + e_tag=e_tag, + display_name=display_name, + view_properties_scope=properties_scope, + chart=chart, + accumulated=accumulated, + metric=metric, + kpis=kpis, + pivots=pivots, + timeframe=query_timeframe, + time_period=query_time_period, + dataset=query_dataset) + return client.create_or_update(view_name=view_name, + e_tag=e_tag, + display_name=display_name, + scope=scope, + chart=chart, + accumulated=accumulated, + metric=metric, + kpis=kpis, + pivots=pivots, + timeframe=query_timeframe, + time_period=query_time_period, + dataset=query_dataset) + + +def costmanagement_view_delete(cmd, client, + view_name, + scope=None): + if scope is not None and view_name is not None: + return client.delete_by_scope(scope=scope, + view_name=view_name) + return client.delete(view_name=view_name) + + +def costmanagement_alert_list(cmd, client, + scope): + return client.list(scope=scope) + + +def costmanagement_alert_list_external(cmd, client, + external_cloud_provider_type, + external_cloud_provider_id): + return client.list_external(external_cloud_provider_type=external_cloud_provider_type, + external_cloud_provider_id=external_cloud_provider_id) + + +def costmanagement_forecast_external_cloud_provider_usage(cmd, client, + external_cloud_provider_type, + external_cloud_provider_id, + type_, + timeframe, + filter=None, + time_period=None, + include_actual_cost=None, + include_fresh_partial_cost=None, + dataset_configuration=None, + dataset_aggregation=None, + dataset_grouping=None, + dataset_filter=None): + if isinstance(dataset_aggregation, str): + dataset_aggregation = json.loads(dataset_aggregation) + if isinstance(dataset_filter, str): + dataset_filter = json.loads(dataset_filter) + return client.external_cloud_provider_usage(filter=filter, + external_cloud_provider_type=external_cloud_provider_type, + external_cloud_provider_id=external_cloud_provider_id, + type=type_, + timeframe=timeframe, + time_period=time_period, + include_actual_cost=include_actual_cost, + include_fresh_partial_cost=include_fresh_partial_cost, + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + query_filter=dataset_filter) + + +def costmanagement_forecast_usage(cmd, client, + scope, + type_, + timeframe, + filter=None, + time_period=None, + include_actual_cost=None, + include_fresh_partial_cost=None, + dataset_configuration=None, + dataset_aggregation=None, + dataset_grouping=None, + dataset_filter=None): + if isinstance(dataset_aggregation, str): + dataset_aggregation = json.loads(dataset_aggregation) + if isinstance(dataset_filter, str): + dataset_filter = json.loads(dataset_filter) + return client.usage(filter=filter, + scope=scope, + type=type_, + timeframe=timeframe, + time_period=time_period, + include_actual_cost=include_actual_cost, + include_fresh_partial_cost=include_fresh_partial_cost, + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + query_filter=dataset_filter) + + +def costmanagement_dimension_list(cmd, client, + scope, + filter=None, + expand=None, + skiptoken=None, + top=None): + return client.list(scope=scope, + filter=filter, + expand=expand, + skiptoken=skiptoken, + top=top) + + +def costmanagement_dimension_by_external_cloud_provider_type(cmd, client, + external_cloud_provider_type, + external_cloud_provider_id, + filter=None, + expand=None, + skiptoken=None, + top=None): + return client.by_external_cloud_provider_type(external_cloud_provider_type=external_cloud_provider_type, + external_cloud_provider_id=external_cloud_provider_id, + filter=filter, + expand=expand, + skiptoken=skiptoken, + top=top) + + +def costmanagement_query_usage(cmd, client, + scope, + type_, + timeframe, + time_period=None, + dataset_configuration=None, + dataset_aggregation=None, + dataset_grouping=None, + dataset_filter=None): + if isinstance(dataset_aggregation, str): + dataset_aggregation = json.loads(dataset_aggregation) + if isinstance(dataset_filter, str): + dataset_filter = json.loads(dataset_filter) + return client.usage(scope=scope, + type=type_, + timeframe=timeframe, + time_period=time_period, + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + filter=dataset_filter) + + +def costmanagement_query_usage_by_external_cloud_provider_type(cmd, client, + external_cloud_provider_type, + external_cloud_provider_id, + type_, + timeframe, + time_period=None, + dataset_configuration=None, + dataset_aggregation=None, + dataset_grouping=None, + dataset_filter=None): + if isinstance(dataset_aggregation, str): + dataset_aggregation = json.loads(dataset_aggregation) + if isinstance(dataset_filter, str): + dataset_filter = json.loads(dataset_filter) + return client.usage_by_external_cloud_provider_type(external_cloud_provider_type=external_cloud_provider_type, + external_cloud_provider_id=external_cloud_provider_id, + type=type_, + timeframe=timeframe, + time_period=time_period, + configuration=dataset_configuration, + aggregation=dataset_aggregation, + grouping=dataset_grouping, + filter=dataset_filter) + + +def costmanagement_export_list(cmd, client, + scope): + return client.list(scope=scope) + + +def costmanagement_export_show(cmd, client, + scope, + export_name): + if scope is not None and export_name is not None: + return client.get(scope=scope, + export_name=export_name) + return client.get_execution_history(scope=scope, + export_name=export_name) + + +def costmanagement_export_create(cmd, client, + scope, + export_name, + definition_type=None, + definition_timeframe=None, + definition_time_period=None, + definition_dataset_configuration=None, + definition_dataset_aggregation=None, + definition_dataset_grouping=None, + definition_dataset_filter=None, + delivery_info_destination=None, + schedule_status=None, + schedule_recurrence=None, + schedule_recurrence_period=None): + if isinstance(definition_dataset_aggregation, str): + definition_dataset_aggregation = json.loads(definition_dataset_aggregation) + if isinstance(definition_dataset_filter, str): + definition_dataset_filter = json.loads(definition_dataset_filter) + return client.create_or_update(scope=scope, + export_name=export_name, + type=definition_type, + timeframe=definition_timeframe, + time_period=definition_time_period, + configuration=definition_dataset_configuration, + aggregation=definition_dataset_aggregation, + grouping=definition_dataset_grouping, + filter=definition_dataset_filter, + destination=delivery_info_destination, + status=schedule_status, + recurrence=schedule_recurrence, + recurrence_period=schedule_recurrence_period) + + +def costmanagement_export_update(cmd, client, + scope, + export_name, + definition_type=None, + definition_timeframe=None, + definition_time_period=None, + definition_dataset_configuration=None, + definition_dataset_aggregation=None, + definition_dataset_grouping=None, + definition_dataset_filter=None, + delivery_info_destination=None, + schedule_status=None, + schedule_recurrence=None, + schedule_recurrence_period=None): + if isinstance(definition_dataset_aggregation, str): + definition_dataset_aggregation = json.loads(definition_dataset_aggregation) + if isinstance(definition_dataset_filter, str): + definition_dataset_filter = json.loads(definition_dataset_filter) + return client.create_or_update(scope=scope, + export_name=export_name, + type=definition_type, + timeframe=definition_timeframe, + time_period=definition_time_period, + configuration=definition_dataset_configuration, + aggregation=definition_dataset_aggregation, + grouping=definition_dataset_grouping, + filter=definition_dataset_filter, + destination=delivery_info_destination, + status=schedule_status, + recurrence=schedule_recurrence, + recurrence_period=schedule_recurrence_period) + + +def costmanagement_export_delete(cmd, client, + scope, + export_name): + return client.delete(scope=scope, + export_name=export_name) + + +def costmanagement_export_execute(cmd, client, + scope, + export_name): + return client.execute(scope=scope, + export_name=export_name) diff --git a/src/costmanagement/azext_costmanagement/manual/__init__.py b/src/costmanagement/azext_costmanagement/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/manual/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/costmanagement/azext_costmanagement/tests/__init__.py b/src/costmanagement/azext_costmanagement/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/tests/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper diff --git a/src/costmanagement/azext_costmanagement/tests/latest/__init__.py b/src/costmanagement/azext_costmanagement/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/costmanagement/azext_costmanagement/tests/latest/preparers.py b/src/costmanagement/azext_costmanagement/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/costmanagement/azext_costmanagement/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py new file mode 100644 index 00000000000..545a87d3b46 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py @@ -0,0 +1,1469 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer +from azure.cli.testsdk import StorageAccountPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /Alerts/get/BillingAccountAlerts +@try_manual +def step__alerts_get_billingaccountalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Alerts/get/BillingProfileAlerts +@try_manual +def step__alerts_get_billingprofilealerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Alerts/get/DepartmentAlerts +@try_manual +def step__alerts_get_departmentalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"', + checks=[]) + + +# EXAMPLE: /Alerts/get/EnrollmentAccountAlerts +@try_manual +def step__alerts_get_enrollmentaccountalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ExternalBillingAccountAlerts +@try_manual +def step__alerts_get_externalbillingaccountalerts(test, rg): + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ExternalSubscriptionAlerts +@try_manual +def step__alerts_get_externalsubscriptionalerts(test, rg): + test.cmd('az costmanagement alert list-external ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions"', + checks=[]) + + +# EXAMPLE: /Alerts/get/InvoiceSectionAlerts +@try_manual +def step__alerts_get_invoicesectionalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Alerts/get/ResourceGroupAlerts +@try_manual +def step__alerts_get_resourcegroupalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Alerts/get/SubscriptionAlerts +@try_manual +def step__alerts_get_subscriptionalerts(test, rg): + test.cmd('az costmanagement alert list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsList-Legacy +@try_manual +def step__dimensions_get_billingaccountdimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsList-Modern +@try_manual +def step__dimensions_get_billingaccountdimensionslist_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListExpandAndTop-Legacy +@try_manual +def step__dimensions_get_billingaccountdimensionslistexpandandtop_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListExpandAndTop-Modern +@try_manual +def step__dimensions_get_billingaccountdimensionslistexpandandtop_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListWithFilter-Legacy +@try_manual +def step__dimensions_get_billingaccountdimensionslistwithfilter_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingAccountDimensionsListWithFilter-Modern +@try_manual +def step__dimensions_get_billingaccountdimensionslistwithfilter_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsList-Modern +@try_manual +def step__dimensions_get_billingprofiledimensionslist_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsListExpandAndTop-Modern +@try_manual +def step__dimensions_get_billingprofiledimensionslistexpandandtop_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/BillingProfileDimensionsListWithFilter-Modern +@try_manual +def step__dimensions_get_billingprofiledimensionslistwithfilter_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsList-Modern +@try_manual +def step__dimensions_get_customerdimensionslist_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsListExpandAndTop-Modern +@try_manual +def step__dimensions_get_customerdimensionslistexpandandtop_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/CustomerDimensionsListWithFilter-Modern +@try_manual +def step__dimensions_get_customerdimensionslistwithfilter_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsList-Legacy +@try_manual +def step__dimensions_get_departmentdimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsListExpandAndTop-Legacy +@try_manual +def step__dimensions_get_departmentdimensionslistexpandandtop_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/DepartmentDimensionsListWithFilter-Legacy +@try_manual +def step__dimensions_get_departmentdimensionslistwithfilter_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsList-Legacy +@try_manual +def step__dimensions_get_enrollmentaccountdimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsListExpandAndTop-Legacy +@try_manual +def step__dimensions_get_enrollmentaccountdimensionslistexpandandtop_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/EnrollmentAccountDimensionsListWithFilter-Legacy +@try_manual +def step__dimensions_get_enrollmentaccountdimensionslistwithfilter_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ExternalBillingAccountDimensionList +@try_manual +def step__dimensions_get_externalbillingaccountdimensionlist(test, rg): + test.cmd('az costmanagement dimension by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ExternalSubscriptionDimensionList +@try_manual +def step__dimensions_get_externalsubscriptiondimensionlist(test, rg): + test.cmd('az costmanagement dimension by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsList-Modern +@try_manual +def step__dimensions_get_invoicesectiondimensionslist_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsListExpandAndTop-Modern +@try_manual +def step__dimensions_get_invoicesectiondimensionslistexpandandtop_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/InvoiceSectionDimensionsListWithFilter-Modern +@try_manual +def step__dimensions_get_invoicesectiondimensionslistwithfilter_modern(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsList-Legacy +@try_manual +def step__dimensions_get_managementgroupdimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsListExpandAndTop-Legacy +@try_manual +def step__dimensions_get_managementgroupdimensionslistexpandandtop_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ManagementGroupDimensionsListWithFilter-Legacy +@try_manual +def step__dimensions_get_managementgroupdimensionslistwithfilter_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--filter "properties/category eq \'resourceId\'" ' + '--top 5 ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/ResourceGroupDimensionsList-Legacy +@try_manual +def step__dimensions_get_resourcegroupdimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/system.orlando"', + checks=[]) + + +# EXAMPLE: /Dimensions/get/SubscriptionDimensionsList-Legacy +@try_manual +def step__dimensions_get_subscriptiondimensionslist_legacy(test, rg): + test.cmd('az costmanagement dimension list ' + '--expand "properties/data" ' + '--top 5 ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/put/BillingAccountCreateOrUpdateExport +@try_manual +def step__exports_put_billingaccountcreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/put/DepartmentCreateOrUpdateExport +@try_manual +def step__exports_put_departmentcreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/put/EnrollmentAccountCreateOrUpdateExport +@try_manual +def step__exports_put_enrollmentaccountcreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/put/ManagementGroupCreateOrUpdateExport +@try_manual +def step__exports_put_managementgroupcreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/put/ResourceGroupCreateOrUpdateExport +@try_manual +def step__exports_put_resourcegroupcreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/put/SubscriptionCreateOrUpdateExport +@try_manual +def step__exports_put_subscriptioncreateorupdateexport(test, rg): + test.cmd('az costmanagement export create ' + '--export-name "{TestExport}" ' + '--definition-type "Usage" ' + '--definition-dataset-aggregation "{{\\"costSum\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}' + '}}}" ' + '--definition-dataset-configuration columns="Date" columns="MeterId" columns="InstanceId" columns="Resourc' + 'eLocation" columns="PreTaxCost" ' + '--definition-dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation' + '\\",\\"operator\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":' + '\\"Environment\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{' + '\\"name\\":\\"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--definition-dataset-grouping name="SubscriptionName" type="Dimension" ' + '--definition-dataset-grouping name="Environment" type="Tag" ' + '--definition-timeframe "MonthToDate" ' + '--delivery-info-destination container="exports" resource-id="/subscriptions/{subscription_id}/resourceGro' + 'ups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}" root-folder-path="ad-hoc" ' + '--schedule-recurrence "Weekly" ' + '--schedule-recurrence-period from="2018-06-01T00:00:00Z" to="2018-10-31T00:00:00Z" ' + '--schedule-status "Active" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/get/BillingAccountExecutionHistoryExport +@try_manual +def step__exports_get_billingaccountexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/get/BillingAccountExport +@try_manual +def step__exports_get_billingaccountexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/get/BillingAccountExportList +@try_manual +def step__exports_get_billingaccountexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/get/DepartmentExecutionHistoryExport +@try_manual +def step__exports_get_departmentexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/get/DepartmentExport +@try_manual +def step__exports_get_departmentexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/get/DepartmentExportList +@try_manual +def step__exports_get_departmentexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/123"', + checks=[]) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExecutionHistoryExport +@try_manual +def step__exports_get_enrollmentaccountexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExport +@try_manual +def step__exports_get_enrollmentaccountexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/get/EnrollmentAccountExportList +@try_manual +def step__exports_get_enrollmentaccountexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/get/ManagementGroupExecutionHistoryExport +@try_manual +def step__exports_get_managementgroupexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ManagementGroupExport +@try_manual +def step__exports_get_managementgroupexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ManagementGroupExportList +@try_manual +def step__exports_get_managementgroupexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ResourceGroupExecutionHistoryExport +@try_manual +def step__exports_get_resourcegroupexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ResourceGroupExport +@try_manual +def step__exports_get_resourcegroupexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/get/ResourceGroupExportList +@try_manual +def step__exports_get_resourcegroupexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/get/SubscriptionExecutionHistoryExport +@try_manual +def step__exports_get_subscriptionexecutionhistoryexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/get/SubscriptionExport +@try_manual +def step__exports_get_subscriptionexport(test, rg): + test.cmd('az costmanagement export show ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/get/SubscriptionExportList +@try_manual +def step__exports_get_subscriptionexportlist(test, rg): + test.cmd('az costmanagement export list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/post/BillingAccountExecuteExport +@try_manual +def step__exports_post_billingaccountexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Exports/post/DepartmentExecuteExport +@try_manual +def step__exports_post_departmentexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/post/EnrollmentAccountExecuteExport +@try_manual +def step__exports_post_enrollmentaccountexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/post/ManagementGroupExecuteExport +@try_manual +def step__exports_post_managementgroupexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/post/ResourceGroupExecuteExport +@try_manual +def step__exports_post_resourcegroupexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/post/SubscriptionExecuteExport +@try_manual +def step__exports_post_subscriptionexecuteexport(test, rg): + test.cmd('az costmanagement export execute ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Forecast/post/BillingAccountForecast +@try_manual +def step__forecast_post_billingaccountforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Forecast/post/BillingProfileForecast +@try_manual +def step__forecast_post_billingprofileforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Forecast/post/DepartmentForecast +@try_manual +def step__forecast_post_departmentforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/departments/123"', + checks=[]) + + +# EXAMPLE: /Forecast/post/EnrollmentAccountForecast +@try_manual +def step__forecast_post_enrollmentaccountforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Forecast/post/ExternalBillingAccountForecast +@try_manual +def step__forecast_post_externalbillingaccountforecast(test, rg): + test.cmd('az costmanagement forecast external-cloud-provider-usage ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts" ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=[]) + + +# EXAMPLE: /Forecast/post/ExternalSubscriptionForecast +@try_manual +def step__forecast_post_externalsubscriptionforecast(test, rg): + test.cmd('az costmanagement forecast external-cloud-provider-usage ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions" ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=[]) + + +# EXAMPLE: /Forecast/post/InvoiceSectionForecast +@try_manual +def step__forecast_post_invoicesectionforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Forecast/post/ResourceGroupForecast +@try_manual +def step__forecast_post_resourcegroupforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Forecast/post/SubscriptionForecast +@try_manual +def step__forecast_post_subscriptionforecast(test, rg): + test.cmd('az costmanagement forecast usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--include-actual-cost false ' + '--include-fresh-partial-cost false ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingAccountQuery-Legacy +@try_manual +def step__query_post_billingaccountquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/70664866"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingAccountQuery-Modern +@try_manual +def step__query_post_billingaccountquery_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingAccountQueryGrouping-Legacy +@try_manual +def step__query_post_billingaccountquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/70664866"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingAccountQueryGrouping-Modern +@try_manual +def step__query_post_billingaccountquerygrouping_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingProfileQuery-Modern +@try_manual +def step__query_post_billingprofilequery_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Query/post/BillingProfileQueryGrouping-Modern +@try_manual +def step__query_post_billingprofilequerygrouping_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"', + checks=[]) + + +# EXAMPLE: /Query/post/CustomerQuery-Modern +@try_manual +def step__query_post_customerquery_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=[]) + + +# EXAMPLE: /Query/post/CustomerQueryGrouping-Modern +@try_manual +def step__query_post_customerquerygrouping_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/customers/5678"', + checks=[]) + + +# EXAMPLE: /Query/post/DepartmentQuery-Legacy +@try_manual +def step__query_post_departmentquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=[]) + + +# EXAMPLE: /Query/post/DepartmentQueryGrouping-Legacy +@try_manual +def step__query_post_departmentquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/departments/123"', + checks=[]) + + +# EXAMPLE: /Query/post/EnrollmentAccountQuery-Legacy +@try_manual +def step__query_post_enrollmentaccountquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Query/post/EnrollmentAccountQueryGrouping-Legacy +@try_manual +def step__query_post_enrollmentaccountquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Query/post/ExternalBillingAccountQueryList +@try_manual +def step__query_post_externalbillingaccountquerylist(test, rg): + test.cmd('az costmanagement query usage-by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalBillingAccounts" ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=[]) + + +# EXAMPLE: /Query/post/ExternalSubscriptionsQuery +@try_manual +def step__query_post_externalsubscriptionsquery(test, rg): + test.cmd('az costmanagement query usage-by-external-cloud-provider-type ' + '--external-cloud-provider-id "100" ' + '--external-cloud-provider-type "externalSubscriptions" ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate"', + checks=[]) + + +# EXAMPLE: /Query/post/InvoiceSectionQuery-Modern +@try_manual +def step__query_post_invoicesectionquery_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Query/post/InvoiceSectionQueryGrouping-Modern +@try_manual +def step__query_post_invoicesectionquerygrouping_modern(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579/invoiceSections/987' + '6"', + checks=[]) + + +# EXAMPLE: /Query/post/ManagementGroupQuery-Legacy +@try_manual +def step__query_post_managementgroupquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Query/post/ManagementGroupQueryGrouping-Legacy +@try_manual +def step__query_post_managementgroupquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "providers/Microsoft.Management/managementGroups/MyMgId"', + checks=[]) + + +# EXAMPLE: /Query/post/ResourceGroupQuery-Legacy +@try_manual +def step__query_post_resourcegroupquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Query/post/ResourceGroupQueryGrouping-Legacy +@try_manual +def step__query_post_resourcegroupquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceType" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer"', + checks=[]) + + +# EXAMPLE: /Query/post/SubscriptionQuery-Legacy +@try_manual +def step__query_post_subscriptionquery_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-filter "{{\\"and\\":[{{\\"or\\":[{{\\"dimension\\":{{\\"name\\":\\"ResourceLocation\\",\\"opera' + 'tor\\":\\"In\\",\\"values\\":[\\"East US\\",\\"West Europe\\"]}}}},{{\\"tag\\":{{\\"name\\":\\"Environmen' + 't\\",\\"operator\\":\\"In\\",\\"values\\":[\\"UAT\\",\\"Prod\\"]}}}}]}},{{\\"dimension\\":{{\\"name\\":\\' + '"ResourceGroup\\",\\"operator\\":\\"In\\",\\"values\\":[\\"API\\"]}}}}]}}" ' + '--timeframe "MonthToDate" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Query/post/SubscriptionQueryGrouping-Legacy +@try_manual +def step__query_post_subscriptionquerygrouping_legacy(test, rg): + test.cmd('az costmanagement query usage ' + '--type "Usage" ' + '--dataset-aggregation "{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Sum\\"}}}}" ' + '--dataset-grouping name="ResourceGroup" type="Dimension" ' + '--timeframe "TheLastMonth" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Views/put/CreateOrUpdatePrivateView +@try_manual +def step__views_put_createorupdateprivateview(test, rg): + test.cmd('az costmanagement view create ' + '--e-tag "\\"1d4ff9fe66f1d10\\"" ' + '--accumulated "true" ' + '--chart "Table" ' + '--display-name "swagger Example" ' + '--kpis type="Forecast" enabled=true id=null ' + '--kpis type="Budget" enabled=true id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micr' + 'osoft.Consumption/budgets/swaggerDemo" ' + '--metric "ActualCost" ' + '--pivots name="ServiceName" type="Dimension" ' + '--pivots name="MeterCategory" type="Dimension" ' + '--pivots name="swaggerTagKey" type="TagKey" ' + '--query-dataset "{{\\"aggregation\\":{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Su' + 'm\\"}}}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{{\\"name\\":\\"UsageDate\\",\\"d' + 'irection\\":\\"Ascending\\"}}]}}" ' + '--query-timeframe "MonthToDate" ' + '--view-name "{swaggerExample}"', + checks=[]) + + +# EXAMPLE: /Views/put/ResourceGroupCreateOrUpdateView +@try_manual +def step__views_put_resourcegroupcreateorupdateview(test, rg): + test.cmd('az costmanagement view create ' + '--e-tag "\\"1d4ff9fe66f1d10\\"" ' + '--accumulated "true" ' + '--chart "Table" ' + '--display-name "swagger Example" ' + '--kpis type="Forecast" enabled=true id=null ' + '--kpis type="Budget" enabled=true id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Micr' + 'osoft.Consumption/budgets/swaggerDemo" ' + '--metric "ActualCost" ' + '--pivots name="ServiceName" type="Dimension" ' + '--pivots name="MeterCategory" type="Dimension" ' + '--pivots name="swaggerTagKey" type="TagKey" ' + '--query-dataset "{{\\"aggregation\\":{{\\"totalCost\\":{{\\"name\\":\\"PreTaxCost\\",\\"function\\":\\"Su' + 'm\\"}}}},\\"granularity\\":\\"Daily\\",\\"grouping\\":[],\\"sorting\\":[{{\\"name\\":\\"UsageDate\\",\\"d' + 'irection\\":\\"Ascending\\"}}]}}" ' + '--query-timeframe "MonthToDate" ' + '--properties-scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--view-name "{swaggerExample}"', + checks=[]) + + +# EXAMPLE: /Views/get/PrivateView +@try_manual +def step__views_get_privateview(test, rg): + test.cmd('az costmanagement view show ' + '--view-name "{swaggerExample}"', + checks=[]) + + +# EXAMPLE: /Views/get/PrivateViewList +@try_manual +def step__views_get_privateviewlist(test, rg): + test.cmd('az costmanagement view list', + checks=[]) + + +# EXAMPLE: /Views/get/ResourceGroupView +@try_manual +def step__views_get_resourcegroupview(test, rg): + test.cmd('az costmanagement view show ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--view-name "{swaggerExample}"', + checks=[]) + + +# EXAMPLE: /Views/get/ResourceGroupViewList +@try_manual +def step__views_get_resourcegroupviewlist(test, rg): + test.cmd('az costmanagement view list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/delete/SubscriptionDeleteExport +@try_manual +def step__exports_delete_subscriptiondeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ResourceGroupDeleteExport +@try_manual +def step__exports_delete_resourcegroupdeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"', + checks=[]) + + +# EXAMPLE: /Exports/delete/ManagementGroupDeleteExport +@try_manual +def step__exports_delete_managementgroupdeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Management/managementGroups/TestMG"', + checks=[]) + + +# EXAMPLE: /Exports/delete/EnrollmentAccountDeleteExport +@try_manual +def step__exports_delete_enrollmentaccountdeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456"', + checks=[]) + + +# EXAMPLE: /Exports/delete/DepartmentDeleteExport +@try_manual +def step__exports_delete_departmentdeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/12/departments/1234"', + checks=[]) + + +# EXAMPLE: /Exports/delete/BillingAccountDeleteExport +@try_manual +def step__exports_delete_billingaccountdeleteexport(test, rg): + test.cmd('az costmanagement export delete ' + '--export-name "{TestExport}" ' + '--scope "providers/Microsoft.Billing/billingAccounts/123456"', + checks=[]) + + +# EXAMPLE: /Views/delete/ResourceGroupDeleteView +@try_manual +def step__views_delete_resourcegroupdeleteview(test, rg): + test.cmd('az costmanagement view delete ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG" ' + '--view-name "{Views_2}"', + checks=[]) + + +# EXAMPLE: /Views/delete/DeletePrivateView +@try_manual +def step__views_delete_deleteprivateview(test, rg): + test.cmd('az costmanagement view delete ' + '--view-name "{Views_2}"', + checks=[]) + + +@try_manual +def cleanup(test, rg): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__alerts_get_billingaccountalerts(test, rg) + step__alerts_get_billingprofilealerts(test, rg) + step__alerts_get_departmentalerts(test, rg) + step__alerts_get_enrollmentaccountalerts(test, rg) + step__alerts_get_externalbillingaccountalerts(test, rg) + step__alerts_get_externalsubscriptionalerts(test, rg) + step__alerts_get_invoicesectionalerts(test, rg) + step__alerts_get_resourcegroupalerts(test, rg) + step__alerts_get_subscriptionalerts(test, rg) + step__dimensions_get_billingaccountdimensionslist_legacy(test, rg) + step__dimensions_get_billingaccountdimensionslist_modern(test, rg) + step__dimensions_get_billingaccountdimensionslistexpandandtop_legacy(test, rg) + step__dimensions_get_billingaccountdimensionslistexpandandtop_modern(test, rg) + step__dimensions_get_billingaccountdimensionslistwithfilter_legacy(test, rg) + step__dimensions_get_billingaccountdimensionslistwithfilter_modern(test, rg) + step__dimensions_get_billingprofiledimensionslist_modern(test, rg) + step__dimensions_get_billingprofiledimensionslistexpandandtop_modern(test, rg) + step__dimensions_get_billingprofiledimensionslistwithfilter_modern(test, rg) + step__dimensions_get_customerdimensionslist_modern(test, rg) + step__dimensions_get_customerdimensionslistexpandandtop_modern(test, rg) + step__dimensions_get_customerdimensionslistwithfilter_modern(test, rg) + step__dimensions_get_departmentdimensionslist_legacy(test, rg) + step__dimensions_get_departmentdimensionslistexpandandtop_legacy(test, rg) + step__dimensions_get_departmentdimensionslistwithfilter_legacy(test, rg) + step__dimensions_get_enrollmentaccountdimensionslist_legacy(test, rg) + step__dimensions_get_enrollmentaccountdimensionslistexpandandtop_legacy(test, rg) + step__dimensions_get_enrollmentaccountdimensionslistwithfilter_legacy(test, rg) + step__dimensions_get_externalbillingaccountdimensionlist(test, rg) + step__dimensions_get_externalsubscriptiondimensionlist(test, rg) + step__dimensions_get_invoicesectiondimensionslist_modern(test, rg) + step__dimensions_get_invoicesectiondimensionslistexpandandtop_modern(test, rg) + step__dimensions_get_invoicesectiondimensionslistwithfilter_modern(test, rg) + step__dimensions_get_managementgroupdimensionslist_legacy(test, rg) + step__dimensions_get_managementgroupdimensionslistexpandandtop_legacy(test, rg) + step__dimensions_get_managementgroupdimensionslistwithfilter_legacy(test, rg) + step__dimensions_get_resourcegroupdimensionslist_legacy(test, rg) + step__dimensions_get_subscriptiondimensionslist_legacy(test, rg) + step__exports_put_billingaccountcreateorupdateexport(test, rg) + step__exports_put_departmentcreateorupdateexport(test, rg) + step__exports_put_enrollmentaccountcreateorupdateexport(test, rg) + step__exports_put_managementgroupcreateorupdateexport(test, rg) + step__exports_put_resourcegroupcreateorupdateexport(test, rg) + step__exports_put_subscriptioncreateorupdateexport(test, rg) + step__exports_get_billingaccountexecutionhistoryexport(test, rg) + step__exports_get_billingaccountexport(test, rg) + step__exports_get_billingaccountexportlist(test, rg) + step__exports_get_departmentexecutionhistoryexport(test, rg) + step__exports_get_departmentexport(test, rg) + step__exports_get_departmentexportlist(test, rg) + step__exports_get_enrollmentaccountexecutionhistoryexport(test, rg) + step__exports_get_enrollmentaccountexport(test, rg) + step__exports_get_enrollmentaccountexportlist(test, rg) + step__exports_get_managementgroupexecutionhistoryexport(test, rg) + step__exports_get_managementgroupexport(test, rg) + step__exports_get_managementgroupexportlist(test, rg) + step__exports_get_resourcegroupexecutionhistoryexport(test, rg) + step__exports_get_resourcegroupexport(test, rg) + step__exports_get_resourcegroupexportlist(test, rg) + step__exports_get_subscriptionexecutionhistoryexport(test, rg) + step__exports_get_subscriptionexport(test, rg) + step__exports_get_subscriptionexportlist(test, rg) + step__exports_post_billingaccountexecuteexport(test, rg) + step__exports_post_departmentexecuteexport(test, rg) + step__exports_post_enrollmentaccountexecuteexport(test, rg) + step__exports_post_managementgroupexecuteexport(test, rg) + step__exports_post_resourcegroupexecuteexport(test, rg) + step__exports_post_subscriptionexecuteexport(test, rg) + step__forecast_post_billingaccountforecast(test, rg) + step__forecast_post_billingprofileforecast(test, rg) + step__forecast_post_departmentforecast(test, rg) + step__forecast_post_enrollmentaccountforecast(test, rg) + step__forecast_post_externalbillingaccountforecast(test, rg) + step__forecast_post_externalsubscriptionforecast(test, rg) + step__forecast_post_invoicesectionforecast(test, rg) + step__forecast_post_resourcegroupforecast(test, rg) + step__forecast_post_subscriptionforecast(test, rg) + step__query_post_billingaccountquery_legacy(test, rg) + step__query_post_billingaccountquery_modern(test, rg) + step__query_post_billingaccountquerygrouping_legacy(test, rg) + step__query_post_billingaccountquerygrouping_modern(test, rg) + step__query_post_billingprofilequery_modern(test, rg) + step__query_post_billingprofilequerygrouping_modern(test, rg) + step__query_post_customerquery_modern(test, rg) + step__query_post_customerquerygrouping_modern(test, rg) + step__query_post_departmentquery_legacy(test, rg) + step__query_post_departmentquerygrouping_legacy(test, rg) + step__query_post_enrollmentaccountquery_legacy(test, rg) + step__query_post_enrollmentaccountquerygrouping_legacy(test, rg) + step__query_post_externalbillingaccountquerylist(test, rg) + step__query_post_externalsubscriptionsquery(test, rg) + step__query_post_invoicesectionquery_modern(test, rg) + step__query_post_invoicesectionquerygrouping_modern(test, rg) + step__query_post_managementgroupquery_legacy(test, rg) + step__query_post_managementgroupquerygrouping_legacy(test, rg) + step__query_post_resourcegroupquery_legacy(test, rg) + step__query_post_resourcegroupquerygrouping_legacy(test, rg) + step__query_post_subscriptionquery_legacy(test, rg) + step__query_post_subscriptionquerygrouping_legacy(test, rg) + step__views_put_createorupdateprivateview(test, rg) + step__views_put_resourcegroupcreateorupdateview(test, rg) + step__views_get_privateview(test, rg) + step__views_get_privateviewlist(test, rg) + step__views_get_resourcegroupview(test, rg) + step__views_get_resourcegroupviewlist(test, rg) + step__exports_delete_subscriptiondeleteexport(test, rg) + step__exports_delete_resourcegroupdeleteexport(test, rg) + step__exports_delete_managementgroupdeleteexport(test, rg) + step__exports_delete_enrollmentaccountdeleteexport(test, rg) + step__exports_delete_departmentdeleteexport(test, rg) + step__exports_delete_billingaccountdeleteexport(test, rg) + step__views_delete_resourcegroupdeleteview(test, rg) + step__views_delete_deleteprivateview(test, rg) + cleanup(test, rg) + + +@try_manual +class CostManagementClientScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestcostmanagement_MYDEVTESTRG'[:7], key='rg', parameter_name='rg') + @StorageAccountPreparer(name_prefix='clitestcostmanagement_ccmeastusdiag182'[:7], key='sa', + resource_group_parameter_name='rg') + def test_costmanagement(self, rg): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'swaggerExample': 'swaggerExample', + 'Views_2': 'Views_2', + 'TestExport': 'TestExport', + }) + + call_scenario(self, rg) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py new file mode 100644 index 00000000000..80154bae521 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/__init__.py @@ -0,0 +1,19 @@ +# 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 ._cost_management_client import CostManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['CostManagementClient'] + +try: + from .patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py new file mode 100644 index 00000000000..8625677aaa9 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_configuration.py @@ -0,0 +1,63 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class CostManagementClientConfiguration(Configuration): + """Configuration for CostManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(CostManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2019-11-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py new file mode 100644 index 00000000000..0cdba0c257e --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_cost_management_client.py @@ -0,0 +1,93 @@ +# 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 + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +from ._configuration import CostManagementClientConfiguration +from .operations import ViewOperations +from .operations import AlertOperations +from .operations import ForecastOperations +from .operations import DimensionOperations +from .operations import QueryOperations +from .operations import ExportOperations +from .operations import OperationOperations +from . import models + + +class CostManagementClient(object): + """CostManagementClient. + + :ivar view: ViewOperations operations + :vartype view: azure.mgmt.costmanagement.operations.ViewOperations + :ivar alert: AlertOperations operations + :vartype alert: azure.mgmt.costmanagement.operations.AlertOperations + :ivar forecast: ForecastOperations operations + :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations + :ivar dimension: DimensionOperations operations + :vartype dimension: azure.mgmt.costmanagement.operations.DimensionOperations + :ivar query: QueryOperations operations + :vartype query: azure.mgmt.costmanagement.operations.QueryOperations + :ivar export: ExportOperations operations + :vartype export: azure.mgmt.costmanagement.operations.ExportOperations + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.costmanagement.operations.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = CostManagementClientConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.view = ViewOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert = AlertOperations( + self._client, self._config, self._serialize, self._deserialize) + self.forecast = ForecastOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dimension = DimensionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.query = QueryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.export = ExportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> CostManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py new file mode 100644 index 00000000000..dbf4c577231 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.2.0" diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py new file mode 100644 index 00000000000..5e5f35e29c0 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._cost_management_client_async import CostManagementClient +__all__ = ['CostManagementClient'] diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py new file mode 100644 index 00000000000..15d87f41cbf --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_configuration_async.py @@ -0,0 +1,59 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class CostManagementClientConfiguration(Configuration): + """Configuration for CostManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(CostManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2019-11-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-costmanagement/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client_async.py new file mode 100644 index 00000000000..0f81334bb70 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/_cost_management_client_async.py @@ -0,0 +1,85 @@ +# 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, Optional + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import CostManagementClientConfiguration +from .operations_async import ViewOperations +from .operations_async import AlertOperations +from .operations_async import ForecastOperations +from .operations_async import DimensionOperations +from .operations_async import QueryOperations +from .operations_async import ExportOperations +from .operations_async import OperationOperations +from .. import models + + +class CostManagementClient(object): + """CostManagementClient. + + :ivar view: ViewOperations operations + :vartype view: azure.mgmt.costmanagement.aio.operations_async.ViewOperations + :ivar alert: AlertOperations operations + :vartype alert: azure.mgmt.costmanagement.aio.operations_async.AlertOperations + :ivar forecast: ForecastOperations operations + :vartype forecast: azure.mgmt.costmanagement.aio.operations_async.ForecastOperations + :ivar dimension: DimensionOperations operations + :vartype dimension: azure.mgmt.costmanagement.aio.operations_async.DimensionOperations + :ivar query: QueryOperations operations + :vartype query: azure.mgmt.costmanagement.aio.operations_async.QueryOperations + :ivar export: ExportOperations operations + :vartype export: azure.mgmt.costmanagement.aio.operations_async.ExportOperations + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.costmanagement.aio.operations_async.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = CostManagementClientConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.view = ViewOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert = AlertOperations( + self._client, self._config, self._serialize, self._deserialize) + self.forecast = ForecastOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dimension = DimensionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.query = QueryOperations( + self._client, self._config, self._serialize, self._deserialize) + self.export = ExportOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "CostManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/__init__.py new file mode 100644 index 00000000000..e2738b1b3eb --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/__init__.py @@ -0,0 +1,25 @@ +# 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 ._view_operations_async import ViewOperations +from ._alert_operations_async import AlertOperations +from ._forecast_operations_async import ForecastOperations +from ._dimension_operations_async import DimensionOperations +from ._query_operations_async import QueryOperations +from ._export_operations_async import ExportOperations +from ._operation_operations_async import OperationOperations + +__all__ = [ + 'ViewOperations', + 'AlertOperations', + 'ForecastOperations', + 'DimensionOperations', + 'QueryOperations', + 'ExportOperations', + 'OperationOperations', +] diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py new file mode 100644 index 00000000000..db9ca7b4425 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_alert_operations_async.py @@ -0,0 +1,165 @@ +# 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 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertOperations: + """AlertOperations 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 list( + self, + scope: str, + **kwargs + ) -> "models.AlertsResult": + """Lists the alerts for scope defined. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertsResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + + async def list_external( + self, + external_cloud_provider_type: Union[str, "models.ExternalCloudProviderType"], + external_cloud_provider_id: str, + **kwargs + ) -> "models.AlertsResult": + """Lists the Alerts for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertsResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list_external.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_external.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_dimension_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_dimension_operations_async.py new file mode 100644 index 00000000000..9e7580d0894 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_dimension_operations_async.py @@ -0,0 +1,244 @@ +# 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.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DimensionOperations: + """DimensionOperations 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, + scope: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + skiptoken: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> "models.DimensionsListResult": + """Lists the dimensions by the defined scope. + + :param scope: The scope associated with dimension operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param filter: May be used to filter dimensions by properties/category, properties/usageStart, + properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :type filter: str + :param expand: May be used to expand the properties/data within a dimension category. By + default, data is not included when listing dimensions. + :type expand: str + :param skiptoken: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + :param top: May be used to limit the number of results to the most recent N dimension data. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DimensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.DimensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DimensionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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(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': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + + def by_external_cloud_provider_type( + self, + external_cloud_provider_type: Union[str, "models.ExternalCloudProviderType"], + external_cloud_provider_id: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + skiptoken: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> "models.DimensionsListResult": + """Lists the dimensions by the external cloud provider type. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param filter: May be used to filter dimensions by properties/category, properties/usageStart, + properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :type filter: str + :param expand: May be used to expand the properties/data within a dimension category. By + default, data is not included when listing dimensions. + :type expand: str + :param skiptoken: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + :param top: May be used to limit the number of results to the most recent N dimension data. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DimensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.DimensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DimensionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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(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 + ) + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_export_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_export_operations_async.py new file mode 100644 index 00000000000..20d718aea16 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_export_operations_async.py @@ -0,0 +1,502 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExportOperations: + """ExportOperations 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 list( + self, + scope: str, + **kwargs + ) -> "models.ExportListResult": + """The operation to list all exports at the given scope. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ExportListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} + + async def get( + self, + scope: str, + export_name: str, + **kwargs + ) -> "models.Export": + """The operation to get the export for the defined scope by export name. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Export"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Export', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + async def create_or_update( + self, + scope: str, + export_name: str, + type: Optional[Union[str, "models.ExportType"]] = None, + timeframe: Optional[Union[str, "models.TimeframeType"]] = None, + time_period: Optional["models.QueryTimePeriod"] = None, + configuration: Optional["models.QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["models.QueryFilter"] = None, + destination: Optional["models.ExportDeliveryDestination"] = None, + status: Optional[Union[str, "models.StatusType"]] = None, + recurrence: Optional[Union[str, "models.RecurrenceType"]] = None, + recurrence_period: Optional["models.ExportRecurrencePeriod"] = None, + **kwargs + ) -> "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 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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :param destination: Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :param status: The status of the schedule. Whether active or not. If inactive, the export's + scheduled execution is paused. + :type status: str or ~azure.mgmt.costmanagement.models.StatusType + :param recurrence: The schedule recurrence. + :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 + :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 or ~azure.mgmt.costmanagement.models.Export + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Export"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.Export(type_properties_definition_type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter, destination=destination, status=status, recurrence=recurrence, recurrence_period=recurrence_period) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'Export') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Export', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Export', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + async def delete( + self, + scope: str, + export_name: str, + **kwargs + ) -> None: + """The operation to delete a export. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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] + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + async def execute( + self, + scope: str, + export_name: str, + **kwargs + ) -> None: + """The operation to execute a export. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.execute.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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] + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} + + async def get_execution_history( + self, + scope: str, + export_name: str, + **kwargs + ) -> "models.ExportExecutionListResult": + """The operation to get the execution history of an export for the defined scope by export name. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportExecutionListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ExportExecutionListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get_execution_history.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_forecast_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_forecast_operations_async.py new file mode 100644 index 00000000000..50b4a7cf64c --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_forecast_operations_async.py @@ -0,0 +1,259 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ForecastOperations: + """ForecastOperations 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 usage( + self, + scope: str, + type: Union[str, "models.ForecastType"], + timeframe: Union[str, "models.ForecastTimeframeType"], + filter: Optional[str] = None, + time_period: Optional["models.QueryTimePeriod"] = None, + include_actual_cost: Optional[bool] = None, + include_fresh_partial_cost: Optional[bool] = None, + configuration: Optional["models.QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + query_filter: Optional["models.QueryFilter"] = None, + **kwargs + ) -> "models.QueryResult": + """Lists the forecast charges for scope defined. + + :param scope: The scope associated with forecast operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param type: The type of the forecast. + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: The time frame for pulling data for the forecast. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param filter: May be used to filter forecasts by properties/usageDate (Utc time), + properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', + and 'and'. It does not currently support 'ne', 'or', or 'not'. + :type filter: str + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :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 query_filter: Has filter expression to use in the query. + :type query_filter: ~azure.mgmt.costmanagement.models.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ForecastDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + + async def external_cloud_provider_usage( + self, + external_cloud_provider_type: Union[str, "models.ExternalCloudProviderType"], + external_cloud_provider_id: str, + type: Union[str, "models.ForecastType"], + timeframe: Union[str, "models.ForecastTimeframeType"], + filter: Optional[str] = None, + time_period: Optional["models.QueryTimePeriod"] = None, + include_actual_cost: Optional[bool] = None, + include_fresh_partial_cost: Optional[bool] = None, + configuration: Optional["models.QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + query_filter: Optional["models.QueryFilter"] = None, + **kwargs + ) -> "models.QueryResult": + """Lists the forecast charges for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param type: The type of the forecast. + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: The time frame for pulling data for the forecast. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param filter: May be used to filter forecasts by properties/usageDate (Utc time), + properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', + and 'and'. It does not currently support 'ne', 'or', or 'not'. + :type filter: str + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :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 query_filter: Has filter expression to use in the query. + :type query_filter: ~azure.mgmt.costmanagement.models.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.external_cloud_provider_usage.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ForecastDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..3100d06cf5b --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations 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 + ) -> "models.OperationListResult": + """Lists all of the available cost management REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(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/operations'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py new file mode 100644 index 00000000000..994fc5fa69f --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_query_operations_async.py @@ -0,0 +1,233 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueryOperations: + """QueryOperations 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 usage( + self, + scope: str, + type: Union[str, "models.ExportType"], + timeframe: Union[str, "models.TimeframeType"], + time_period: Optional["models.QueryTimePeriod"] = None, + configuration: Optional["models.QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["models.QueryFilter"] = None, + **kwargs + ) -> "models.QueryResult": + """Query the usage data for scope defined. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'QueryDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} + + async def usage_by_external_cloud_provider_type( + self, + external_cloud_provider_type: Union[str, "models.ExternalCloudProviderType"], + external_cloud_provider_id: str, + type: Union[str, "models.ExportType"], + timeframe: Union[str, "models.TimeframeType"], + time_period: Optional["models.QueryTimePeriod"] = None, + configuration: Optional["models.QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["models.QueryFilter"] = None, + **kwargs + ) -> "models.QueryResult": + """Query the usage data for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage_by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'QueryDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py new file mode 100644 index 00000000000..c606c6c32da --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/aio/operations_async/_view_operations_async.py @@ -0,0 +1,669 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ViewOperations: + """ViewOperations 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 + ) -> "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: ViewListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ViewListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ViewListResult', 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(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/views'} + + def list_by_scope( + self, + scope: str, + **kwargs + ) -> "models.ViewListResult": + """Lists all views at the given scope. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ViewListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ViewListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ViewListResult', 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(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_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + + async def get( + self, + view_name: str, + **kwargs + ) -> "models.View": + """Gets the view by view name. + + :param view_name: View name. + :type view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + async def create_or_update( + self, + view_name: str, + e_tag: Optional[str] = None, + display_name: Optional[str] = None, + scope: Optional[str] = None, + chart: Optional[Union[str, "models.ChartType"]] = None, + accumulated: Optional[Union[str, "models.AccumulatedType"]] = None, + metric: Optional[Union[str, "models.MetricType"]] = None, + kpis: Optional[List["KpiProperties"]] = None, + pivots: Optional[List["PivotProperties"]] = None, + timeframe: Optional[Union[str, "models.ReportTimeframeType"]] = None, + time_period: Optional["models.ReportConfigTimePeriod"] = None, + dataset: Optional["models.ReportConfigDataset"] = None, + **kwargs + ) -> "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 does not require eTag. + + :param view_name: View name. + :type view_name: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type scope: str + :param chart: Chart type of the main view in Cost Analysis. Required. + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'View') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + async def delete( + self, + view_name: str, + **kwargs + ) -> None: + """The operation to delete a view. + + :param view_name: View name. + :type view_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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(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/views/{viewName}'} + + async def get_by_scope( + self, + scope: str, + view_name: str, + **kwargs + ) -> "models.View": + """Gets the view for the defined scope by view name. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + async def create_or_update_by_scope( + self, + scope: str, + view_name: str, + e_tag: Optional[str] = None, + display_name: Optional[str] = None, + view_properties_scope: Optional[str] = None, + chart: Optional[Union[str, "models.ChartType"]] = None, + accumulated: Optional[Union[str, "models.AccumulatedType"]] = None, + metric: Optional[Union[str, "models.MetricType"]] = None, + kpis: Optional[List["KpiProperties"]] = None, + pivots: Optional[List["PivotProperties"]] = None, + timeframe: Optional[Union[str, "models.ReportTimeframeType"]] = None, + time_period: Optional["models.ReportConfigTimePeriod"] = None, + dataset: Optional["models.ReportConfigDataset"] = None, + **kwargs + ) -> "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 does not require eTag. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param view_properties_scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type view_properties_scope: str + :param chart: Chart type of the main view in Cost Analysis. Required. + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=view_properties_scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'View') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + async def delete_by_scope( + self, + scope: str, + view_name: str, + **kwargs + ) -> None: + """The operation to delete a view. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py new file mode 100644 index 00000000000..86b6667b5a5 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/__init__.py @@ -0,0 +1,185 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Alert + from ._models_py3 import AlertPropertiesDefinition + from ._models_py3 import AlertPropertiesDetails + from ._models_py3 import AlertsResult + from ._models_py3 import CommonExportProperties + from ._models_py3 import Dimension + from ._models_py3 import DimensionsListResult + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse + from ._models_py3 import Export + from ._models_py3 import ExportDeliveryDestination + from ._models_py3 import ExportExecution + from ._models_py3 import ExportExecutionListResult + from ._models_py3 import ExportListResult + from ._models_py3 import ExportProperties + from ._models_py3 import ExportRecurrencePeriod + 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 PivotProperties + from ._models_py3 import ProxyResource + from ._models_py3 import QueryAggregation + from ._models_py3 import QueryColumn + from ._models_py3 import QueryComparisonExpression + from ._models_py3 import QueryDatasetConfiguration + from ._models_py3 import QueryDefinition + from ._models_py3 import QueryFilter + from ._models_py3 import QueryGrouping + from ._models_py3 import QueryResult + from ._models_py3 import QueryTimePeriod + from ._models_py3 import ReportConfigAggregation + from ._models_py3 import ReportConfigComparisonExpression + from ._models_py3 import ReportConfigDataset + from ._models_py3 import ReportConfigDatasetConfiguration + from ._models_py3 import ReportConfigFilter + from ._models_py3 import ReportConfigGrouping + from ._models_py3 import ReportConfigSorting + from ._models_py3 import ReportConfigTimePeriod + from ._models_py3 import Resource + from ._models_py3 import View + from ._models_py3 import ViewListResult +except (SyntaxError, ImportError): + from ._models import Alert # type: ignore + from ._models import AlertPropertiesDefinition # type: ignore + from ._models import AlertPropertiesDetails # type: ignore + from ._models import AlertsResult # type: ignore + from ._models import CommonExportProperties # type: ignore + from ._models import Dimension # type: ignore + from ._models import DimensionsListResult # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Export # type: ignore + from ._models import ExportDeliveryDestination # type: ignore + from ._models import ExportExecution # type: ignore + from ._models import ExportExecutionListResult # type: ignore + from ._models import ExportListResult # type: ignore + from ._models import ExportProperties # type: ignore + from ._models import ExportRecurrencePeriod # 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 PivotProperties # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import QueryAggregation # type: ignore + from ._models import QueryColumn # type: ignore + from ._models import QueryComparisonExpression # type: ignore + from ._models import QueryDatasetConfiguration # type: ignore + from ._models import QueryDefinition # type: ignore + from ._models import QueryFilter # 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 ReportConfigDatasetConfiguration # type: ignore + from ._models import ReportConfigFilter # 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 View # type: ignore + from ._models import ViewListResult # type: ignore + +from ._cost_management_client_enums import ( + AccumulatedType, + ChartType, + ExecutionStatus, + ExecutionType, + ExportType, + ExternalCloudProviderType, + ForecastTimeframeType, + ForecastType, + KpiType, + MetricType, + OperatorType, + PivotType, + QueryColumnType, + RecurrenceType, + ReportConfigColumnType, + ReportConfigSortingDirection, + ReportGranularityType, + ReportTimeframeType, + StatusType, + TimeframeType, +) + +__all__ = [ + 'Alert', + 'AlertPropertiesDefinition', + 'AlertPropertiesDetails', + 'AlertsResult', + 'CommonExportProperties', + 'Dimension', + 'DimensionsListResult', + 'ErrorDetails', + 'ErrorResponse', + 'Export', + 'ExportDeliveryDestination', + 'ExportExecution', + 'ExportExecutionListResult', + 'ExportListResult', + 'ExportProperties', + 'ExportRecurrencePeriod', + 'ForecastDefinition', + 'KpiProperties', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PivotProperties', + 'ProxyResource', + 'QueryAggregation', + 'QueryColumn', + 'QueryComparisonExpression', + 'QueryDatasetConfiguration', + 'QueryDefinition', + 'QueryFilter', + 'QueryGrouping', + 'QueryResult', + 'QueryTimePeriod', + 'ReportConfigAggregation', + 'ReportConfigComparisonExpression', + 'ReportConfigDataset', + 'ReportConfigDatasetConfiguration', + 'ReportConfigFilter', + 'ReportConfigGrouping', + 'ReportConfigSorting', + 'ReportConfigTimePeriod', + 'Resource', + 'View', + 'ViewListResult', + 'AccumulatedType', + 'ChartType', + 'ExecutionStatus', + 'ExecutionType', + 'ExportType', + 'ExternalCloudProviderType', + 'ForecastTimeframeType', + 'ForecastType', + 'KpiType', + 'MetricType', + 'OperatorType', + 'PivotType', + 'QueryColumnType', + 'RecurrenceType', + 'ReportConfigColumnType', + 'ReportConfigSortingDirection', + 'ReportGranularityType', + 'ReportTimeframeType', + 'StatusType', + 'TimeframeType', +] diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_cost_management_client_enums.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_cost_management_client_enums.py new file mode 100644 index 00000000000..833645db5a5 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_cost_management_client_enums.py @@ -0,0 +1,174 @@ +# 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 enum import Enum + +class AccumulatedType(str, Enum): + """Show costs accumulated over time. + """ + + true = "true" + false = "false" + +class ChartType(str, Enum): + """Chart type of the main view in Cost Analysis. Required. + """ + + area = "Area" + line = "Line" + stacked_column = "StackedColumn" + grouped_column = "GroupedColumn" + table = "Table" + +class ExecutionStatus(str, Enum): + """The status of the export execution. + """ + + queued = "Queued" + in_progress = "InProgress" + completed = "Completed" + failed = "Failed" + timeout = "Timeout" + new_data_not_available = "NewDataNotAvailable" + data_not_available = "DataNotAvailable" + +class ExecutionType(str, Enum): + """The type of the export execution. + """ + + on_demand = "OnDemand" + scheduled = "Scheduled" + +class ExportType(str, Enum): + """The type of the query. + """ + + usage = "Usage" + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + +class ExternalCloudProviderType(str, Enum): + + external_subscriptions = "externalSubscriptions" + external_billing_accounts = "externalBillingAccounts" + +class ForecastTimeframeType(str, Enum): + """The time frame for pulling data for the forecast. If custom, then a specific time period must + be provided. + """ + + month_to_date = "MonthToDate" + billing_month_to_date = "BillingMonthToDate" + the_last_month = "TheLastMonth" + the_last_billing_month = "TheLastBillingMonth" + week_to_date = "WeekToDate" + custom = "Custom" + +class ForecastType(str, Enum): + """The type of the forecast. + """ + + usage = "Usage" + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + +class KpiType(str, Enum): + """KPI type (Forecast, Budget). + """ + + forecast = "Forecast" + budget = "Budget" + +class MetricType(str, Enum): + """Metric to use when displaying costs. + """ + + actual_cost = "ActualCost" + amortized_cost = "AmortizedCost" + ahub = "AHUB" + +class OperatorType(str, Enum): + """The operator to use for comparison. + """ + + in_enum = "In" + contains = "Contains" + +class PivotType(str, Enum): + """Data type to show in view. + """ + + dimension = "Dimension" + tag_key = "TagKey" + +class QueryColumnType(str, Enum): + """The type of the column in the export. + """ + + tag = "Tag" + dimension = "Dimension" + +class RecurrenceType(str, Enum): + """The schedule recurrence. + """ + + daily = "Daily" + weekly = "Weekly" + monthly = "Monthly" + annually = "Annually" + +class ReportConfigColumnType(str, Enum): + """The type of the column in the report. + """ + + tag = "Tag" + dimension = "Dimension" + +class ReportConfigSortingDirection(str, Enum): + """Direction of sort. + """ + + ascending = "Ascending" + descending = "Descending" + +class ReportGranularityType(str, Enum): + """The granularity of rows in the report. + """ + + daily = "Daily" + monthly = "Monthly" + +class ReportTimeframeType(str, Enum): + """The time frame for pulling data for the report. If custom, then a specific time period must be + provided. + """ + + week_to_date = "WeekToDate" + month_to_date = "MonthToDate" + year_to_date = "YearToDate" + custom = "Custom" + +class StatusType(str, Enum): + """The status of the schedule. Whether active or not. If inactive, the export's scheduled + execution is paused. + """ + + active = "Active" + inactive = "Inactive" + +class TimeframeType(str, Enum): + """The time frame for pulling data for the query. If custom, then a specific time period must be + provided. + """ + + month_to_date = "MonthToDate" + billing_month_to_date = "BillingMonthToDate" + the_last_month = "TheLastMonth" + the_last_billing_month = "TheLastBillingMonth" + week_to_date = "WeekToDate" + custom = "Custom" diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py new file mode 100644 index 00000000000..de061aa403e --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models.py @@ -0,0 +1,1874 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Resource(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 type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None + + +class Alert(Resource): + """An individual alert. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param definition: defines the type of alert. + :type definition: ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description. + :type description: str + :param source: Source of alert. + :type source: str + :param details: Alert details. + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. + :type status: str + :param creation_time: dateTime in which alert was created. + :type creation_time: str + :param close_time: dateTime in which alert was closed. + :type close_time: str + :param modification_time: dateTime in which alert was last modified. + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was last modified. + :type status_modification_time: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Alert, self).__init__(**kwargs) + self.definition = kwargs.get('definition', None) + self.description = kwargs.get('description', None) + self.source = kwargs.get('source', None) + self.details = kwargs.get('details', None) + self.cost_entity_id = kwargs.get('cost_entity_id', None) + self.status = kwargs.get('status', None) + self.creation_time = kwargs.get('creation_time', None) + self.close_time = kwargs.get('close_time', None) + self.modification_time = kwargs.get('modification_time', None) + self.status_modification_user_name = kwargs.get('status_modification_user_name', None) + self.status_modification_time = kwargs.get('status_modification_time', None) + + +class AlertPropertiesDefinition(msrest.serialization.Model): + """defines the type of alert. + + :param type: type of alert. + :type type: str + :param category: Alert category. + :type category: str + :param criteria: Criteria that triggered alert. + :type criteria: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.category = kwargs.get('category', None) + self.criteria = kwargs.get('criteria', None) + + +class AlertPropertiesDetails(msrest.serialization.Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. + :type time_grain_type: str + :param period_start_date: datetime of periodStartDate. + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. + :type operator: str + :param amount: budget threshold amount. + :type amount: float + :param unit: unit of currency being used. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = kwargs.get('time_grain_type', None) + self.period_start_date = kwargs.get('period_start_date', None) + self.triggered_by = kwargs.get('triggered_by', None) + self.resource_group_filter = kwargs.get('resource_group_filter', None) + self.resource_filter = kwargs.get('resource_filter', None) + self.meter_filter = kwargs.get('meter_filter', None) + self.tag_filter = kwargs.get('tag_filter', None) + self.threshold = kwargs.get('threshold', None) + self.operator = kwargs.get('operator', None) + self.amount = kwargs.get('amount', None) + self.unit = kwargs.get('unit', None) + self.current_spend = kwargs.get('current_spend', None) + self.contact_emails = kwargs.get('contact_emails', None) + self.contact_groups = kwargs.get('contact_groups', None) + self.contact_roles = kwargs.get('contact_roles', None) + self.overriding_alert = kwargs.get('overriding_alert', None) + + +class AlertsResult(msrest.serialization.Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class 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. + + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Required. Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + """ + + _validation = { + 'format': {'constant': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'type': {'key': 'definition.type', 'type': 'str'}, + 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + **kwargs + ): + super(CommonExportProperties, self).__init__(**kwargs) + self.type = kwargs['type'] + self.timeframe = kwargs['timeframe'] + self.time_period = kwargs.get('time_period', 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) + self.destination = kwargs['destination'] + + +class Dimension(Resource): + """Dimension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: Dimension description. + :vartype description: str + :ivar filter_enabled: Filter enabled. + :vartype filter_enabled: bool + :ivar grouping_enabled: Grouping enabled. + :vartype grouping_enabled: bool + :param data: + :type data: list[str] + :ivar total: Total number of data for the dimension. + :vartype total: int + :ivar category: Dimension category. + :vartype category: str + :ivar usage_start: Usage start. + :vartype usage_start: ~datetime.datetime + :ivar usage_end: Usage end. + :vartype usage_end: ~datetime.datetime + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'description': {'readonly': True}, + 'filter_enabled': {'readonly': True}, + 'grouping_enabled': {'readonly': True}, + 'total': {'readonly': True}, + 'category': {'readonly': True}, + 'usage_start': {'readonly': True}, + 'usage_end': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'filter_enabled': {'key': 'properties.filterEnabled', 'type': 'bool'}, + 'grouping_enabled': {'key': 'properties.groupingEnabled', 'type': 'bool'}, + 'data': {'key': 'properties.data', 'type': '[str]'}, + 'total': {'key': 'properties.total', 'type': 'int'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'usage_start': {'key': 'properties.usageStart', 'type': 'iso-8601'}, + 'usage_end': {'key': 'properties.usageEnd', 'type': 'iso-8601'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.description = None + self.filter_enabled = None + self.grouping_enabled = None + self.data = kwargs.get('data', None) + self.total = None + self.category = None + self.usage_start = None + self.usage_end = None + self.next_link = None + + +class DimensionsListResult(msrest.serialization.Model): + """Result of listing dimensions. It contains a list of available dimensions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of dimensions. + :vartype value: list[~azure.mgmt.costmanagement.models.Dimension] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Dimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionsListResult, self).__init__(**kwargs) + self.value = None + + +class ErrorDetails(msrest.serialization.Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + +Some Error responses: + + +* + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + +* + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + + :param error: The details of the error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class Export(Resource): + """A export resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :param type_properties_definition_type: The type of the query. Possible values include: + "Usage", "ActualCost", "AmortizedCost". + :type type_properties_definition_type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :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". + :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 = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'format': {'constant': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'format': {'key': 'properties.format', 'type': 'str'}, + 'type_properties_definition_type': {'key': 'properties.definition.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'properties.definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'properties.definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'properties.definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'properties.definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'properties.definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'properties.deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + 'status': {'key': 'properties.schedule.status', 'type': 'str'}, + 'recurrence': {'key': 'properties.schedule.recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'properties.schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + **kwargs + ): + super(Export, self).__init__(**kwargs) + self.type_properties_definition_type = kwargs.get('type_properties_definition_type', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', 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) + self.destination = kwargs.get('destination', None) + self.status = kwargs.get('status', None) + self.recurrence = kwargs.get('recurrence', None) + self.recurrence_period = kwargs.get('recurrence_period', None) + + +class ExportDeliveryDestination(msrest.serialization.Model): + """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource id of the storage account where exports will be + delivered. + :type resource_id: str + :param container: Required. The name of the container where exports will be uploaded. + :type container: str + :param root_folder_path: The name of the directory where exports will be uploaded. + :type root_folder_path: str + """ + + _validation = { + 'resource_id': {'required': True}, + 'container': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'container': {'key': 'container', 'type': 'str'}, + 'root_folder_path': {'key': 'rootFolderPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDeliveryDestination, self).__init__(**kwargs) + self.resource_id = kwargs['resource_id'] + self.container = kwargs['container'] + self.root_folder_path = kwargs.get('root_folder_path', None) + + +class ExportExecution(Resource): + """A export execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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 status of the export execution. Possible values include: "Queued", + "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", "DataNotAvailable". + :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus + :param submitted_by: The identifier for the entity that executed the export. For OnDemand + executions, it is the email id. For Scheduled executions, it is the constant value - System. + :type submitted_by: str + :param submitted_time: The time when export was queued to be executed. + :type submitted_time: ~datetime.datetime + :param processing_start_time: The time when export was picked up to be executed. + :type processing_start_time: ~datetime.datetime + :param processing_end_time: The time when export execution finished. + :type processing_end_time: ~datetime.datetime + :param file_name: The name of the file export got written to. + :type file_name: str + :param run_settings: The common properties of the export. + :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, + 'submitted_time': {'key': 'properties.submittedTime', 'type': 'iso-8601'}, + 'processing_start_time': {'key': 'properties.processingStartTime', 'type': 'iso-8601'}, + 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, + 'file_name': {'key': 'properties.fileName', 'type': 'str'}, + 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportExecution, self).__init__(**kwargs) + self.execution_type = kwargs.get('execution_type', None) + self.status = kwargs.get('status', None) + self.submitted_by = kwargs.get('submitted_by', None) + self.submitted_time = kwargs.get('submitted_time', None) + self.processing_start_time = kwargs.get('processing_start_time', None) + 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) + + +class ExportExecutionListResult(msrest.serialization.Model): + """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: The list of export executions. + :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExportExecution]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportExecutionListResult, self).__init__(**kwargs) + self.value = None + + +class ExportListResult(msrest.serialization.Model): + """Result of listing exports. It contains a list of available exports in the scope provided. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of exports. + :vartype value: list[~azure.mgmt.costmanagement.models.Export] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Export]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportListResult, self).__init__(**kwargs) + self.value = None + + +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. + + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Required. Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :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". + :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 = { + 'format': {'constant': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'type': {'key': 'definition.type', 'type': 'str'}, + 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + 'status': {'key': 'schedule.status', 'type': 'str'}, + 'recurrence': {'key': 'schedule.recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + **kwargs + ): + super(ExportProperties, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.recurrence = kwargs.get('recurrence', None) + self.recurrence_period = kwargs.get('recurrence_period', None) + + +class ExportRecurrencePeriod(msrest.serialization.Model): + """The start and end date for recurrence schedule. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date of recurrence. + :type from_property: ~datetime.datetime + :param to: The end date of recurrence. + :type to: ~datetime.datetime + """ + + _validation = { + 'from_property': {'required': True}, + } + + _attribute_map = { + 'from_property': {'key': 'from', 'type': 'iso-8601'}, + 'to': {'key': 'to', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportRecurrencePeriod, self).__init__(**kwargs) + self.from_property = kwargs['from_property'] + self.to = kwargs.get('to', None) + + +class ForecastDefinition(msrest.serialization.Model): + """The definition of a forecast. + + 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 type: Required. The type of the forecast. Possible values include: "Usage", + "ActualCost", "AmortizedCost". + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the forecast. If custom, then a + specific time period must be provided. Possible values include: "MonthToDate", + "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, + 'granularity': {'key': 'dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'dataset.filter', 'type': 'QueryFilter'}, + } + + granularity = "Daily" + + def __init__( + self, + **kwargs + ): + super(ForecastDefinition, self).__init__(**kwargs) + self.type = kwargs['type'] + self.timeframe = kwargs['timeframe'] + self.time_period = kwargs.get('time_period', None) + self.include_actual_cost = kwargs.get('include_actual_cost', None) + self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', 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 KpiProperties(msrest.serialization.Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: "Forecast", "Budget". + :type type: str or ~azure.mgmt.costmanagement.models.KpiType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI?. + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(KpiProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.id = kwargs.get('id', None) + self.enabled = kwargs.get('enabled', None) + + +class Operation(msrest.serialization.Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.CostManagement. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Dimensions, Query. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cost management operations supported by the Microsoft.CostManagement + resource provider. + :vartype value: list[~azure.mgmt.costmanagement.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PivotProperties(msrest.serialization.Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: "Dimension", "TagKey". + :type type: str or ~azure.mgmt.costmanagement.models.PivotType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PivotProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) + + +class ProxyResource(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 type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = kwargs.get('e_tag', None) + + +class QueryAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the query. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__( + self, + **kwargs + ): + super(QueryAggregation, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class QueryColumn(msrest.serialization.Model): + """QueryColumn. + + :param name: The name of column. + :type name: str + :param type: The type of column. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryColumn, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class QueryComparisonExpression(msrest.serialization.Model): + """The comparison expression to be used in the query. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryComparisonExpression, self).__init__(**kwargs) + self.name = kwargs['name'] + self.operator = kwargs['operator'] + self.values = kwargs['values'] + + +class QueryDatasetConfiguration(msrest.serialization.Model): + """The configuration of dataset in the query. + + :param columns: Array of column names to be included in the query. Any valid query column name + is allowed. If not provided, then query includes all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class QueryDefinition(msrest.serialization.Model): + """The definition of a query. + + 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 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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'dataset.filter', 'type': 'QueryFilter'}, + } + + granularity = "Daily" + + def __init__( + self, + **kwargs + ): + super(QueryDefinition, self).__init__(**kwargs) + self.type = kwargs['type'] + self.timeframe = kwargs['timeframe'] + self.time_period = kwargs.get('time_period', 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 QueryFilter(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.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 + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _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'}, + } + + def __init__( + self, + **kwargs + ): + 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) + + +class QueryGrouping(msrest.serialization.Model): + """The group by expression to be used in the query. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values include: "Tag", + "Dimension". + :type type: str or ~azure.mgmt.costmanagement.models.QueryColumnType + :param name: Required. The name of the column to group. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryGrouping, self).__init__(**kwargs) + self.type = kwargs['type'] + self.name = kwargs['name'] + + +class QueryResult(Resource): + """Result of query. It contains all columns listed under groupings and aggregation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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]] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, + 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, + } + + def __init__( + self, + **kwargs + ): + super(QueryResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.columns = kwargs.get('columns', None) + self.rows = kwargs.get('rows', None) + + +class QueryTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the query. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: ~datetime.datetime + :param to: Required. The end date to pull data to. + :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(QueryTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs['from_property'] + self.to = kwargs['to'] + + +class ReportConfigAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the report. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__( + self, + **kwargs + ): + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class ReportConfigComparisonExpression(msrest.serialization.Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = kwargs['name'] + self.operator = kwargs['operator'] + self.values = kwargs['values'] + + +class ReportConfigDataset(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.ReportConfigFilter + """ + + _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': 'ReportConfigFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = kwargs.get('granularity', None) + self.configuration = kwargs.get('configuration', None) + self.aggregation = kwargs.get('aggregation', None) + self.grouping = kwargs.get('grouping', None) + self.sorting = kwargs.get('sorting', None) + self.filter = kwargs.get('filter', None) + + +class ReportConfigDatasetConfiguration(msrest.serialization.Model): + """The configuration of dataset in the report. + + :param columns: Array of column names to be included in the report. Any valid report column + name is allowed. If not provided, then report includes all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + + +class ReportConfigFilter(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.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 items. + :type or_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension. + :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag. + :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, + 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = kwargs.get('and_property', None) + self.or_property = kwargs.get('or_property', None) + self.not_property = kwargs.get('not_property', None) + self.dimension = kwargs.get('dimension', None) + self.tag = kwargs.get('tag', None) + + +class ReportConfigGrouping(msrest.serialization.Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values include: "Tag", + "Dimension". + :type type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version supports subscription + lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = kwargs['type'] + self.name = kwargs['name'] + + +class ReportConfigSorting(msrest.serialization.Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: "Ascending", "Descending". + :type direction: str or ~azure.mgmt.costmanagement.models.ReportConfigSortingDirection + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = kwargs.get('direction', None) + self.name = kwargs['name'] + + +class ReportConfigTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: ~datetime.datetime + :param to: Required. The end date to pull data to. + :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(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = kwargs['from_property'] + self.to = kwargs['to'] + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: ~datetime.datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: ~datetime.datetime + :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: + "Area", "Line", "StackedColumn", "GroupedColumn", "Table". + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values include: "true", "false". + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values include: "ActualCost", + "AmortizedCost", "AHUB". + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :ivar type_properties_query_type: The type of the report. Usage represents actual usage, + forecast represents forecasted data and UsageAndForecast represents both usage and forecasted + data. Actual usage and forecasted data can be differentiated based on dates. Default value: + "Usage". + :vartype type_properties_query_type: str + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. Possible values include: "WeekToDate", "MonthToDate", + "YearToDate", "Custom". + :type timeframe: str or ~azure.mgmt.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'type_properties_query_type': {'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + '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'}, + } + + type_properties_query_type = "Usage" + + def __init__( + self, + **kwargs + ): + super(View, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.scope = kwargs.get('scope', None) + self.created_on = None + self.modified_on = None + self.chart = kwargs.get('chart', None) + self.accumulated = kwargs.get('accumulated', None) + self.metric = kwargs.get('metric', None) + self.kpis = kwargs.get('kpis', None) + self.pivots = kwargs.get('pivots', None) + self.timeframe = kwargs.get('timeframe', None) + self.time_period = kwargs.get('time_period', None) + self.dataset = kwargs.get('dataset', None) + + +class ViewListResult(msrest.serialization.Model): + """Result of listing views. It contains a list of available views. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of views. + :vartype value: list[~azure.mgmt.costmanagement.models.View] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[View]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ViewListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py new file mode 100644 index 00000000000..ef7fa858157 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/models/_models_py3.py @@ -0,0 +1,2061 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Resource(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 type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = None + + +class Alert(Resource): + """An individual alert. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param definition: defines the type of alert. + :type definition: ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition + :param description: Alert description. + :type description: str + :param source: Source of alert. + :type source: str + :param details: Alert details. + :type details: ~azure.mgmt.costmanagement.models.AlertPropertiesDetails + :param cost_entity_id: related budget. + :type cost_entity_id: str + :param status: alert status. + :type status: str + :param creation_time: dateTime in which alert was created. + :type creation_time: str + :param close_time: dateTime in which alert was closed. + :type close_time: str + :param modification_time: dateTime in which alert was last modified. + :type modification_time: str + :param status_modification_user_name: + :type status_modification_user_name: str + :param status_modification_time: dateTime in which the alert status was last modified. + :type status_modification_time: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'definition': {'key': 'properties.definition', 'type': 'AlertPropertiesDefinition'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'AlertPropertiesDetails'}, + 'cost_entity_id': {'key': 'properties.costEntityId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'close_time': {'key': 'properties.closeTime', 'type': 'str'}, + 'modification_time': {'key': 'properties.modificationTime', 'type': 'str'}, + 'status_modification_user_name': {'key': 'properties.statusModificationUserName', 'type': 'str'}, + 'status_modification_time': {'key': 'properties.statusModificationTime', 'type': 'str'}, + } + + def __init__( + self, + *, + definition: Optional["AlertPropertiesDefinition"] = None, + description: Optional[str] = None, + source: Optional[str] = None, + details: Optional["AlertPropertiesDetails"] = None, + cost_entity_id: Optional[str] = None, + status: Optional[str] = None, + creation_time: Optional[str] = None, + close_time: Optional[str] = None, + modification_time: Optional[str] = None, + status_modification_user_name: Optional[str] = None, + status_modification_time: Optional[str] = None, + **kwargs + ): + super(Alert, self).__init__(**kwargs) + self.definition = definition + self.description = description + self.source = source + self.details = details + self.cost_entity_id = cost_entity_id + self.status = status + self.creation_time = creation_time + self.close_time = close_time + self.modification_time = modification_time + self.status_modification_user_name = status_modification_user_name + self.status_modification_time = status_modification_time + + +class AlertPropertiesDefinition(msrest.serialization.Model): + """defines the type of alert. + + :param type: type of alert. + :type type: str + :param category: Alert category. + :type category: str + :param criteria: Criteria that triggered alert. + :type criteria: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + category: Optional[str] = None, + criteria: Optional[str] = None, + **kwargs + ): + super(AlertPropertiesDefinition, self).__init__(**kwargs) + self.type = type + self.category = category + self.criteria = criteria + + +class AlertPropertiesDetails(msrest.serialization.Model): + """Alert details. + + :param time_grain_type: Type of timegrain cadence. + :type time_grain_type: str + :param period_start_date: datetime of periodStartDate. + :type period_start_date: str + :param triggered_by: notificationId that triggered this alert. + :type triggered_by: str + :param resource_group_filter: array of resourceGroups to filter by. + :type resource_group_filter: list[object] + :param resource_filter: array of resources to filter by. + :type resource_filter: list[object] + :param meter_filter: array of meters to filter by. + :type meter_filter: list[object] + :param tag_filter: tags to filter by. + :type tag_filter: object + :param threshold: notification threshold percentage as a decimal which activated this alert. + :type threshold: float + :param operator: operator used to compare currentSpend with amount. + :type operator: str + :param amount: budget threshold amount. + :type amount: float + :param unit: unit of currency being used. + :type unit: str + :param current_spend: current spend. + :type current_spend: float + :param contact_emails: list of emails to contact. + :type contact_emails: list[str] + :param contact_groups: list of action groups to broadcast to. + :type contact_groups: list[str] + :param contact_roles: list of contact roles. + :type contact_roles: list[str] + :param overriding_alert: overriding alert. + :type overriding_alert: str + """ + + _attribute_map = { + 'time_grain_type': {'key': 'timeGrainType', 'type': 'str'}, + 'period_start_date': {'key': 'periodStartDate', 'type': 'str'}, + 'triggered_by': {'key': 'triggeredBy', 'type': 'str'}, + 'resource_group_filter': {'key': 'resourceGroupFilter', 'type': '[object]'}, + 'resource_filter': {'key': 'resourceFilter', 'type': '[object]'}, + 'meter_filter': {'key': 'meterFilter', 'type': '[object]'}, + 'tag_filter': {'key': 'tagFilter', 'type': 'object'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'amount': {'key': 'amount', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_spend': {'key': 'currentSpend', 'type': 'float'}, + 'contact_emails': {'key': 'contactEmails', 'type': '[str]'}, + 'contact_groups': {'key': 'contactGroups', 'type': '[str]'}, + 'contact_roles': {'key': 'contactRoles', 'type': '[str]'}, + 'overriding_alert': {'key': 'overridingAlert', 'type': 'str'}, + } + + def __init__( + self, + *, + time_grain_type: Optional[str] = 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, + threshold: Optional[float] = None, + operator: Optional[str] = None, + amount: Optional[float] = None, + unit: Optional[str] = None, + current_spend: Optional[float] = None, + contact_emails: Optional[List[str]] = None, + contact_groups: Optional[List[str]] = None, + contact_roles: Optional[List[str]] = None, + overriding_alert: Optional[str] = None, + **kwargs + ): + super(AlertPropertiesDetails, self).__init__(**kwargs) + self.time_grain_type = time_grain_type + self.period_start_date = period_start_date + self.triggered_by = triggered_by + self.resource_group_filter = resource_group_filter + self.resource_filter = resource_filter + self.meter_filter = meter_filter + self.tag_filter = tag_filter + self.threshold = threshold + self.operator = operator + self.amount = amount + self.unit = unit + self.current_spend = current_spend + self.contact_emails = contact_emails + self.contact_groups = contact_groups + self.contact_roles = contact_roles + self.overriding_alert = overriding_alert + + +class AlertsResult(msrest.serialization.Model): + """Result of alerts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of alerts. + :vartype value: list[~azure.mgmt.costmanagement.models.Alert] + :ivar next_link: URL to get the next set of alerts results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Alert]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertsResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class 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. + + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Required. Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + """ + + _validation = { + 'format': {'constant': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'type': {'key': 'definition.type', 'type': 'str'}, + 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + *, + type: Union[str, "ExportType"], + timeframe: Union[str, "TimeframeType"], + destination: "ExportDeliveryDestination", + time_period: Optional["QueryTimePeriod"] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + **kwargs + ): + super(CommonExportProperties, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + self.destination = destination + + +class Dimension(Resource): + """Dimension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: Dimension description. + :vartype description: str + :ivar filter_enabled: Filter enabled. + :vartype filter_enabled: bool + :ivar grouping_enabled: Grouping enabled. + :vartype grouping_enabled: bool + :param data: + :type data: list[str] + :ivar total: Total number of data for the dimension. + :vartype total: int + :ivar category: Dimension category. + :vartype category: str + :ivar usage_start: Usage start. + :vartype usage_start: ~datetime.datetime + :ivar usage_end: Usage end. + :vartype usage_end: ~datetime.datetime + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'description': {'readonly': True}, + 'filter_enabled': {'readonly': True}, + 'grouping_enabled': {'readonly': True}, + 'total': {'readonly': True}, + 'category': {'readonly': True}, + 'usage_start': {'readonly': True}, + 'usage_end': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'filter_enabled': {'key': 'properties.filterEnabled', 'type': 'bool'}, + 'grouping_enabled': {'key': 'properties.groupingEnabled', 'type': 'bool'}, + 'data': {'key': 'properties.data', 'type': '[str]'}, + 'total': {'key': 'properties.total', 'type': 'int'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'usage_start': {'key': 'properties.usageStart', 'type': 'iso-8601'}, + 'usage_end': {'key': 'properties.usageEnd', 'type': 'iso-8601'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + data: Optional[List[str]] = None, + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.description = None + self.filter_enabled = None + self.grouping_enabled = None + self.data = data + self.total = None + self.category = None + self.usage_start = None + self.usage_end = None + self.next_link = None + + +class DimensionsListResult(msrest.serialization.Model): + """Result of listing dimensions. It contains a list of available dimensions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of dimensions. + :vartype value: list[~azure.mgmt.costmanagement.models.Dimension] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Dimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionsListResult, self).__init__(**kwargs) + self.value = None + + +class ErrorDetails(msrest.serialization.Model): + """The details of the error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.message = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + +Some Error responses: + + +* + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + +* + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + + :param error: The details of the error. + :type error: ~azure.mgmt.costmanagement.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetails"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Export(Resource): + """A export resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :param type_properties_definition_type: The type of the query. Possible values include: + "Usage", "ActualCost", "AmortizedCost". + :type type_properties_definition_type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :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". + :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 = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + 'format': {'constant': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'format': {'key': 'properties.format', 'type': 'str'}, + 'type_properties_definition_type': {'key': 'properties.definition.type', 'type': 'str'}, + 'timeframe': {'key': 'properties.definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'properties.definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'properties.definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'properties.definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'properties.definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'properties.definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'properties.definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'properties.deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + 'status': {'key': 'properties.schedule.status', 'type': 'str'}, + 'recurrence': {'key': 'properties.schedule.recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'properties.schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + *, + type_properties_definition_type: Optional[Union[str, "ExportType"]] = None, + timeframe: Optional[Union[str, "TimeframeType"]] = None, + time_period: Optional["QueryTimePeriod"] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + destination: Optional["ExportDeliveryDestination"] = None, + status: Optional[Union[str, "StatusType"]] = None, + recurrence: Optional[Union[str, "RecurrenceType"]] = None, + recurrence_period: Optional["ExportRecurrencePeriod"] = None, + **kwargs + ): + super(Export, self).__init__(**kwargs) + self.type_properties_definition_type = type_properties_definition_type + self.timeframe = timeframe + self.time_period = time_period + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + self.destination = destination + self.status = status + self.recurrence = recurrence + self.recurrence_period = recurrence_period + + +class ExportDeliveryDestination(msrest.serialization.Model): + """The destination information for the delivery of the export. To allow access to a storage account, you must register the account's subscription with the Microsoft.CostManagementExports resource provider. This is required once per subscription. When creating an export in the Azure portal, it is done automatically, however API users need to register the subscription. For more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource id of the storage account where exports will be + delivered. + :type resource_id: str + :param container: Required. The name of the container where exports will be uploaded. + :type container: str + :param root_folder_path: The name of the directory where exports will be uploaded. + :type root_folder_path: str + """ + + _validation = { + 'resource_id': {'required': True}, + 'container': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'container': {'key': 'container', 'type': 'str'}, + 'root_folder_path': {'key': 'rootFolderPath', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: str, + container: str, + root_folder_path: Optional[str] = None, + **kwargs + ): + super(ExportDeliveryDestination, self).__init__(**kwargs) + self.resource_id = resource_id + self.container = container + self.root_folder_path = root_folder_path + + +class ExportExecution(Resource): + """A export execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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 status of the export execution. Possible values include: "Queued", + "InProgress", "Completed", "Failed", "Timeout", "NewDataNotAvailable", "DataNotAvailable". + :type status: str or ~azure.mgmt.costmanagement.models.ExecutionStatus + :param submitted_by: The identifier for the entity that executed the export. For OnDemand + executions, it is the email id. For Scheduled executions, it is the constant value - System. + :type submitted_by: str + :param submitted_time: The time when export was queued to be executed. + :type submitted_time: ~datetime.datetime + :param processing_start_time: The time when export was picked up to be executed. + :type processing_start_time: ~datetime.datetime + :param processing_end_time: The time when export execution finished. + :type processing_end_time: ~datetime.datetime + :param file_name: The name of the file export got written to. + :type file_name: str + :param run_settings: The common properties of the export. + :type run_settings: ~azure.mgmt.costmanagement.models.CommonExportProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, + 'submitted_time': {'key': 'properties.submittedTime', 'type': 'iso-8601'}, + 'processing_start_time': {'key': 'properties.processingStartTime', 'type': 'iso-8601'}, + 'processing_end_time': {'key': 'properties.processingEndTime', 'type': 'iso-8601'}, + 'file_name': {'key': 'properties.fileName', 'type': 'str'}, + 'run_settings': {'key': 'properties.runSettings', 'type': 'CommonExportProperties'}, + } + + def __init__( + self, + *, + execution_type: Optional[Union[str, "ExecutionType"]] = None, + status: Optional[Union[str, "ExecutionStatus"]] = None, + submitted_by: Optional[str] = None, + submitted_time: Optional[datetime.datetime] = None, + processing_start_time: Optional[datetime.datetime] = None, + processing_end_time: Optional[datetime.datetime] = None, + file_name: Optional[str] = None, + run_settings: Optional["CommonExportProperties"] = None, + **kwargs + ): + super(ExportExecution, self).__init__(**kwargs) + self.execution_type = execution_type + self.status = status + self.submitted_by = submitted_by + self.submitted_time = submitted_time + self.processing_start_time = processing_start_time + self.processing_end_time = processing_end_time + self.file_name = file_name + self.run_settings = run_settings + + +class ExportExecutionListResult(msrest.serialization.Model): + """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: The list of export executions. + :vartype value: list[~azure.mgmt.costmanagement.models.ExportExecution] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExportExecution]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportExecutionListResult, self).__init__(**kwargs) + self.value = None + + +class ExportListResult(msrest.serialization.Model): + """Result of listing exports. It contains a list of available exports in the scope provided. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of exports. + :vartype value: list[~azure.mgmt.costmanagement.models.Export] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Export]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportListResult, self).__init__(**kwargs) + self.value = None + + +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. + + :ivar format: The format of the export being delivered. Default value: "Csv". + :vartype format: str + :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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + :param destination: Required. Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :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". + :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 = { + 'format': {'constant': True}, + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'type': {'key': 'definition.type', 'type': 'str'}, + 'timeframe': {'key': 'definition.timeframe', 'type': 'str'}, + 'time_period': {'key': 'definition.timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'definition.dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'definition.dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'definition.dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'definition.dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'definition.dataset.filter', 'type': 'QueryFilter'}, + 'destination': {'key': 'deliveryInfo.destination', 'type': 'ExportDeliveryDestination'}, + 'status': {'key': 'schedule.status', 'type': 'str'}, + 'recurrence': {'key': 'schedule.recurrence', 'type': 'str'}, + 'recurrence_period': {'key': 'schedule.recurrencePeriod', 'type': 'ExportRecurrencePeriod'}, + } + + format = "Csv" + granularity = "Daily" + + def __init__( + self, + *, + type: Union[str, "ExportType"], + timeframe: Union[str, "TimeframeType"], + destination: "ExportDeliveryDestination", + time_period: Optional["QueryTimePeriod"] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + status: Optional[Union[str, "StatusType"]] = None, + recurrence: Optional[Union[str, "RecurrenceType"]] = None, + recurrence_period: Optional["ExportRecurrencePeriod"] = None, + **kwargs + ): + super(ExportProperties, self).__init__(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter, destination=destination, **kwargs) + self.status = status + self.recurrence = recurrence + self.recurrence_period = recurrence_period + + +class ExportRecurrencePeriod(msrest.serialization.Model): + """The start and end date for recurrence schedule. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date of recurrence. + :type from_property: ~datetime.datetime + :param to: The end date of recurrence. + :type to: ~datetime.datetime + """ + + _validation = { + 'from_property': {'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: Optional[datetime.datetime] = None, + **kwargs + ): + super(ExportRecurrencePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class ForecastDefinition(msrest.serialization.Model): + """The definition of a forecast. + + 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 type: Required. The type of the forecast. Possible values include: "Usage", + "ActualCost", "AmortizedCost". + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: Required. The time frame for pulling data for the forecast. If custom, then a + specific time period must be provided. Possible values include: "MonthToDate", + "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom". + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'include_actual_cost': {'key': 'includeActualCost', 'type': 'bool'}, + 'include_fresh_partial_cost': {'key': 'includeFreshPartialCost', 'type': 'bool'}, + 'granularity': {'key': 'dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'dataset.filter', 'type': 'QueryFilter'}, + } + + granularity = "Daily" + + def __init__( + self, + *, + type: Union[str, "ForecastType"], + timeframe: Union[str, "ForecastTimeframeType"], + time_period: Optional["QueryTimePeriod"] = None, + include_actual_cost: Optional[bool] = None, + include_fresh_partial_cost: Optional[bool] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + **kwargs + ): + super(ForecastDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.include_actual_cost = include_actual_cost + self.include_fresh_partial_cost = include_fresh_partial_cost + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + + +class KpiProperties(msrest.serialization.Model): + """Each KPI must contain a 'type' and 'enabled' key. + + :param type: KPI type (Forecast, Budget). Possible values include: "Forecast", "Budget". + :type type: str or ~azure.mgmt.costmanagement.models.KpiType + :param id: ID of resource related to metric (budget). + :type id: str + :param enabled: show the KPI in the UI?. + :type enabled: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "KpiType"]] = None, + id: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(KpiProperties, self).__init__(**kwargs) + self.type = type + self.id = id + self.enabled = enabled + + +class Operation(msrest.serialization.Model): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.CostManagement. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Dimensions, Query. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of cost management operations supported by the Microsoft.CostManagement + resource provider. + :vartype value: list[~azure.mgmt.costmanagement.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PivotProperties(msrest.serialization.Model): + """Each pivot must contain a 'type' and 'name'. + + :param type: Data type to show in view. Possible values include: "Dimension", "TagKey". + :type type: str or ~azure.mgmt.costmanagement.models.PivotType + :param name: Data field to show in view. + :type name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "PivotType"]] = None, + name: Optional[str] = None, + **kwargs + ): + super(PivotProperties, self).__init__(**kwargs) + self.type = type + self.name = name + + +class ProxyResource(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 type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + } + + def __init__( + self, + *, + e_tag: Optional[str] = None, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.e_tag = e_tag + + +class QueryAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the query. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(QueryAggregation, self).__init__(**kwargs) + self.name = name + + +class QueryColumn(msrest.serialization.Model): + """QueryColumn. + + :param name: The name of column. + :type name: str + :param type: The type of column. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(QueryColumn, self).__init__(**kwargs) + self.name = name + self.type = type + + +class QueryComparisonExpression(msrest.serialization.Model): + """The comparison expression to be used in the query. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: str, + operator: Union[str, "OperatorType"], + values: List[str], + **kwargs + ): + super(QueryComparisonExpression, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class QueryDatasetConfiguration(msrest.serialization.Model): + """The configuration of dataset in the query. + + :param columns: Array of column names to be included in the query. Any valid query column name + is allowed. If not provided, then query includes all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + *, + columns: Optional[List[str]] = None, + **kwargs + ): + super(QueryDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class QueryDefinition(msrest.serialization.Model): + """The definition of a query. + + 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 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 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 query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :ivar granularity: The granularity of rows in the query. Default value: "Daily". + :vartype granularity: str + :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.QueryFilter + """ + + _validation = { + 'type': {'required': True}, + 'timeframe': {'required': True}, + 'granularity': {'constant': True}, + 'grouping': {'max_items': 2, 'min_items': 0}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'timeframe': {'key': 'timeframe', 'type': 'str'}, + 'time_period': {'key': 'timePeriod', 'type': 'QueryTimePeriod'}, + 'granularity': {'key': 'dataset.granularity', 'type': 'str'}, + 'configuration': {'key': 'dataset.configuration', 'type': 'QueryDatasetConfiguration'}, + 'aggregation': {'key': 'dataset.aggregation', 'type': '{QueryAggregation}'}, + 'grouping': {'key': 'dataset.grouping', 'type': '[QueryGrouping]'}, + 'filter': {'key': 'dataset.filter', 'type': 'QueryFilter'}, + } + + granularity = "Daily" + + def __init__( + self, + *, + type: Union[str, "ExportType"], + timeframe: Union[str, "TimeframeType"], + time_period: Optional["QueryTimePeriod"] = None, + configuration: Optional["QueryDatasetConfiguration"] = None, + aggregation: Optional[Dict[str, "QueryAggregation"]] = None, + grouping: Optional[List["QueryGrouping"]] = None, + filter: Optional["QueryFilter"] = None, + **kwargs + ): + super(QueryDefinition, self).__init__(**kwargs) + self.type = type + self.timeframe = timeframe + self.time_period = time_period + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.filter = filter + + +class QueryFilter(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.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 + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _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'}, + } + + def __init__( + self, + *, + 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, + **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 + + +class QueryGrouping(msrest.serialization.Model): + """The group by expression to be used in the query. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values include: "Tag", + "Dimension". + :type type: str or ~azure.mgmt.costmanagement.models.QueryColumnType + :param name: Required. The name of the column to group. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Union[str, "QueryColumnType"], + name: str, + **kwargs + ): + super(QueryGrouping, self).__init__(**kwargs) + self.type = type + self.name = name + + +class QueryResult(Resource): + """Result of query. It contains all columns listed under groupings and aggregation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, 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]] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'next_link': {'key': 'properties.nextLink', 'type': 'str'}, + 'columns': {'key': 'properties.columns', 'type': '[QueryColumn]'}, + 'rows': {'key': 'properties.rows', 'type': '[[object]]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + columns: Optional[List["QueryColumn"]] = None, + rows: Optional[List[List[object]]] = None, + **kwargs + ): + super(QueryResult, self).__init__(**kwargs) + self.next_link = next_link + self.columns = columns + self.rows = rows + + +class QueryTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the query. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: ~datetime.datetime + :param to: Required. The end date to pull data to. + :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(QueryTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class ReportConfigAggregation(msrest.serialization.Model): + """The aggregation expression to be used in the report. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to aggregate. + :type name: str + :ivar function: Required. The name of the aggregation function to use. Default value: "Sum". + :vartype function: str + """ + + _validation = { + 'name': {'required': True}, + 'function': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'function': {'key': 'function', 'type': 'str'}, + } + + function = "Sum" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(ReportConfigAggregation, self).__init__(**kwargs) + self.name = name + + +class ReportConfigComparisonExpression(msrest.serialization.Model): + """The comparison expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column to use in comparison. + :type name: str + :param operator: Required. The operator to use for comparison. Possible values include: "In", + "Contains". + :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param values: Required. Array of values to use for comparison. + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True}, + 'values': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: str, + operator: Union[str, "OperatorType"], + values: List[str], + **kwargs + ): + super(ReportConfigComparisonExpression, self).__init__(**kwargs) + self.name = name + self.operator = operator + self.values = values + + +class ReportConfigDataset(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.ReportConfigFilter + """ + + _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': 'ReportConfigFilter'}, + } + + 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["ReportConfigFilter"] = None, + **kwargs + ): + super(ReportConfigDataset, self).__init__(**kwargs) + self.granularity = granularity + self.configuration = configuration + self.aggregation = aggregation + self.grouping = grouping + self.sorting = sorting + self.filter = filter + + +class ReportConfigDatasetConfiguration(msrest.serialization.Model): + """The configuration of dataset in the report. + + :param columns: Array of column names to be included in the report. Any valid report column + name is allowed. If not provided, then report includes all columns. + :type columns: list[str] + """ + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '[str]'}, + } + + def __init__( + self, + *, + columns: Optional[List[str]] = None, + **kwargs + ): + super(ReportConfigDatasetConfiguration, self).__init__(**kwargs) + self.columns = columns + + +class ReportConfigFilter(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.ReportConfigFilter] + :param or_property: The logical "OR" expression. Must have at least 2 items. + :type or_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilter] + :param not_property: The logical "NOT" expression. + :type not_property: ~azure.mgmt.costmanagement.models.ReportConfigFilter + :param dimension: Has comparison expression for a dimension. + :type dimension: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + :param tag: Has comparison expression for a tag. + :type tag: ~azure.mgmt.costmanagement.models.ReportConfigComparisonExpression + """ + + _validation = { + 'and_property': {'min_items': 2}, + 'or_property': {'min_items': 2}, + } + + _attribute_map = { + 'and_property': {'key': 'and', 'type': '[ReportConfigFilter]'}, + 'or_property': {'key': 'or', 'type': '[ReportConfigFilter]'}, + 'not_property': {'key': 'not', 'type': 'ReportConfigFilter'}, + 'dimension': {'key': 'dimension', 'type': 'ReportConfigComparisonExpression'}, + 'tag': {'key': 'tag', 'type': 'ReportConfigComparisonExpression'}, + } + + def __init__( + self, + *, + and_property: Optional[List["ReportConfigFilter"]] = None, + or_property: Optional[List["ReportConfigFilter"]] = None, + not_property: Optional["ReportConfigFilter"] = None, + dimension: Optional["ReportConfigComparisonExpression"] = None, + tag: Optional["ReportConfigComparisonExpression"] = None, + **kwargs + ): + super(ReportConfigFilter, self).__init__(**kwargs) + self.and_property = and_property + self.or_property = or_property + self.not_property = not_property + self.dimension = dimension + self.tag = tag + + +class ReportConfigGrouping(msrest.serialization.Model): + """The group by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Has type of the column to group. Possible values include: "Tag", + "Dimension". + :type type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :param name: Required. The name of the column to group. This version supports subscription + lowest possible grain. + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Union[str, "ReportConfigColumnType"], + name: str, + **kwargs + ): + super(ReportConfigGrouping, self).__init__(**kwargs) + self.type = type + self.name = name + + +class ReportConfigSorting(msrest.serialization.Model): + """The order by expression to be used in the report. + + All required parameters must be populated in order to send to Azure. + + :param direction: Direction of sort. Possible values include: "Ascending", "Descending". + :type direction: str or ~azure.mgmt.costmanagement.models.ReportConfigSortingDirection + :param name: Required. The name of the column to sort. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + direction: Optional[Union[str, "ReportConfigSortingDirection"]] = None, + **kwargs + ): + super(ReportConfigSorting, self).__init__(**kwargs) + self.direction = direction + self.name = name + + +class ReportConfigTimePeriod(msrest.serialization.Model): + """The start and end date for pulling data for the report. + + All required parameters must be populated in order to send to Azure. + + :param from_property: Required. The start date to pull data from. + :type from_property: ~datetime.datetime + :param to: Required. The end date to pull data to. + :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(ReportConfigTimePeriod, self).__init__(**kwargs) + self.from_property = from_property + self.to = to + + +class View(ProxyResource): + """States and configurations of Cost Analysis. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type scope: str + :ivar created_on: Date the user created this view. + :vartype created_on: ~datetime.datetime + :ivar modified_on: Date when the user last modified this view. + :vartype modified_on: ~datetime.datetime + :param chart: Chart type of the main view in Cost Analysis. Required. Possible values include: + "Area", "Line", "StackedColumn", "GroupedColumn", "Table". + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. Possible values include: "true", "false". + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. Possible values include: "ActualCost", + "AmortizedCost", "AHUB". + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :ivar type_properties_query_type: The type of the report. Usage represents actual usage, + forecast represents forecasted data and UsageAndForecast represents both usage and forecasted + data. Actual usage and forecasted data can be differentiated based on dates. Default value: + "Usage". + :vartype type_properties_query_type: str + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. Possible values include: "WeekToDate", "MonthToDate", + "YearToDate", "Custom". + :type timeframe: str or ~azure.mgmt.costmanagement.models.ReportTimeframeType + :param time_period: Has time period for pulling data for the report. + :type time_period: ~azure.mgmt.costmanagement.models.ReportConfigTimePeriod + :param dataset: Has definition for data in this report config. + :type dataset: ~azure.mgmt.costmanagement.models.ReportConfigDataset + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'type_properties_query_type': {'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'properties.modifiedOn', 'type': 'iso-8601'}, + 'chart': {'key': 'properties.chart', 'type': 'str'}, + 'accumulated': {'key': 'properties.accumulated', 'type': 'str'}, + 'metric': {'key': 'properties.metric', 'type': 'str'}, + 'kpis': {'key': 'properties.kpis', 'type': '[KpiProperties]'}, + 'pivots': {'key': 'properties.pivots', 'type': '[PivotProperties]'}, + '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'}, + } + + type_properties_query_type = "Usage" + + def __init__( + self, + *, + e_tag: Optional[str] = None, + display_name: Optional[str] = None, + scope: Optional[str] = None, + chart: Optional[Union[str, "ChartType"]] = None, + accumulated: Optional[Union[str, "AccumulatedType"]] = None, + metric: Optional[Union[str, "MetricType"]] = None, + kpis: Optional[List["KpiProperties"]] = None, + pivots: Optional[List["PivotProperties"]] = None, + timeframe: Optional[Union[str, "ReportTimeframeType"]] = None, + time_period: Optional["ReportConfigTimePeriod"] = None, + dataset: Optional["ReportConfigDataset"] = None, + **kwargs + ): + super(View, self).__init__(e_tag=e_tag, **kwargs) + self.display_name = display_name + self.scope = scope + self.created_on = None + self.modified_on = None + self.chart = chart + self.accumulated = accumulated + self.metric = metric + self.kpis = kpis + self.pivots = pivots + self.timeframe = timeframe + self.time_period = time_period + self.dataset = dataset + + +class ViewListResult(msrest.serialization.Model): + """Result of listing views. It contains a list of available views. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of views. + :vartype value: list[~azure.mgmt.costmanagement.models.View] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[View]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ViewListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py new file mode 100644 index 00000000000..6c9a4311b92 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._view_operations import ViewOperations +from ._alert_operations import AlertOperations +from ._forecast_operations import ForecastOperations +from ._dimension_operations import DimensionOperations +from ._query_operations import QueryOperations +from ._export_operations import ExportOperations +from ._operation_operations import OperationOperations + +__all__ = [ + 'ViewOperations', + 'AlertOperations', + 'ForecastOperations', + 'DimensionOperations', + 'QueryOperations', + 'ExportOperations', + 'OperationOperations', +] diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py new file mode 100644 index 00000000000..dc1b90de5db --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_alert_operations.py @@ -0,0 +1,171 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +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 AlertOperations(object): + """AlertOperations 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, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertsResult" + """Lists the alerts for scope defined. + + :param scope: The scope associated with alerts operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertsResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/alerts'} + + def list_external( + self, + external_cloud_provider_type, # type: Union[str, "models.ExternalCloudProviderType"] + external_cloud_provider_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertsResult" + """Lists the Alerts for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertsResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.AlertsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertsResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list_external.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_external.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py new file mode 100644 index 00000000000..aa72450bb03 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_dimension_operations.py @@ -0,0 +1,250 @@ +# 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 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 + +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 DimensionOperations(object): + """DimensionOperations 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, + scope, # type: str + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + skiptoken=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.DimensionsListResult" + """Lists the dimensions by the defined scope. + + :param scope: The scope associated with dimension operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param filter: May be used to filter dimensions by properties/category, properties/usageStart, + properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :type filter: str + :param expand: May be used to expand the properties/data within a dimension category. By + default, data is not included when listing dimensions. + :type expand: str + :param skiptoken: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + :param top: May be used to limit the number of results to the most recent N dimension data. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DimensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.DimensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DimensionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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(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': '/{scope}/providers/Microsoft.CostManagement/dimensions'} + + def by_external_cloud_provider_type( + self, + external_cloud_provider_type, # type: Union[str, "models.ExternalCloudProviderType"] + external_cloud_provider_id, # type: str + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + skiptoken=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.DimensionsListResult" + """Lists the dimensions by the external cloud provider type. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param filter: May be used to filter dimensions by properties/category, properties/usageStart, + properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + :type filter: str + :param expand: May be used to expand the properties/data within a dimension category. By + default, data is not included when listing dimensions. + :type expand: str + :param skiptoken: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: str + :param top: May be used to limit the number of results to the most recent N dimension data. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DimensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.DimensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DimensionsListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DimensionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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(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 + ) + by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py new file mode 100644 index 00000000000..2021519d44e --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_export_operations.py @@ -0,0 +1,512 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ExportOperations(object): + """ExportOperations 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, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ExportListResult" + """The operation to list all exports at the given scope. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ExportListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports'} + + def get( + self, + scope, # type: str + export_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Export" + """The operation to get the export for the defined scope by export name. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Export"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Export', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + def create_or_update( + self, + scope, # type: str + export_name, # type: str + type=None, # type: Optional[Union[str, "models.ExportType"]] + timeframe=None, # type: Optional[Union[str, "models.TimeframeType"]] + time_period=None, # type: Optional["models.QueryTimePeriod"] + configuration=None, # type: Optional["models.QueryDatasetConfiguration"] + aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] + grouping=None, # type: Optional[List["QueryGrouping"]] + filter=None, # type: Optional["models.QueryFilter"] + destination=None, # type: Optional["models.ExportDeliveryDestination"] + status=None, # type: Optional[Union[str, "models.StatusType"]] + recurrence=None, # type: Optional[Union[str, "models.RecurrenceType"]] + recurrence_period=None, # type: Optional["models.ExportRecurrencePeriod"] + **kwargs # type: Any + ): + # type: (...) -> "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 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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :param destination: Has destination for the export being delivered. + :type destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination + :param status: The status of the schedule. Whether active or not. If inactive, the export's + scheduled execution is paused. + :type status: str or ~azure.mgmt.costmanagement.models.StatusType + :param recurrence: The schedule recurrence. + :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 + :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 or ~azure.mgmt.costmanagement.models.Export + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Export"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.Export(type_properties_definition_type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter, destination=destination, status=status, recurrence=recurrence, recurrence_period=recurrence_period) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'Export') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Export', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Export', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + def delete( + self, + scope, # type: str + export_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to delete a export. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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] + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}'} + + def execute( + self, + scope, # type: str + export_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to execute a export. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.execute.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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] + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + execute.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run'} + + def get_execution_history( + self, + scope, # type: str + export_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ExportExecutionListResult" + """The operation to get the execution history of an export for the defined scope by export name. + + :param scope: The scope associated with query and export operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param export_name: Export Name. + :type export_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExportExecutionListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ExportExecutionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ExportExecutionListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get_execution_history.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'exportName': self._serialize.url("export_name", export_name, 'str'), + } + 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExportExecutionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_execution_history.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py new file mode 100644 index 00000000000..5b97876549e --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_forecast_operations.py @@ -0,0 +1,265 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ForecastOperations(object): + """ForecastOperations 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 usage( + self, + scope, # type: str + type, # type: Union[str, "models.ForecastType"] + timeframe, # type: Union[str, "models.ForecastTimeframeType"] + filter=None, # type: Optional[str] + time_period=None, # type: Optional["models.QueryTimePeriod"] + include_actual_cost=None, # type: Optional[bool] + include_fresh_partial_cost=None, # type: Optional[bool] + configuration=None, # type: Optional["models.QueryDatasetConfiguration"] + aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] + grouping=None, # type: Optional[List["QueryGrouping"]] + query_filter=None, # type: Optional["models.QueryFilter"] + **kwargs # type: Any + ): + # type: (...) -> "models.QueryResult" + """Lists the forecast charges for scope defined. + + :param scope: The scope associated with forecast operations. This includes + '/subscriptions/{subscriptionId}/' for subscription scope, + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param type: The type of the forecast. + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: The time frame for pulling data for the forecast. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param filter: May be used to filter forecasts by properties/usageDate (Utc time), + properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', + and 'and'. It does not currently support 'ne', 'or', or 'not'. + :type filter: str + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :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 query_filter: Has filter expression to use in the query. + :type query_filter: ~azure.mgmt.costmanagement.models.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ForecastDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/forecast'} + + def external_cloud_provider_usage( + self, + external_cloud_provider_type, # type: Union[str, "models.ExternalCloudProviderType"] + external_cloud_provider_id, # type: str + type, # type: Union[str, "models.ForecastType"] + timeframe, # type: Union[str, "models.ForecastTimeframeType"] + filter=None, # type: Optional[str] + time_period=None, # type: Optional["models.QueryTimePeriod"] + include_actual_cost=None, # type: Optional[bool] + include_fresh_partial_cost=None, # type: Optional[bool] + configuration=None, # type: Optional["models.QueryDatasetConfiguration"] + aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] + grouping=None, # type: Optional[List["QueryGrouping"]] + query_filter=None, # type: Optional["models.QueryFilter"] + **kwargs # type: Any + ): + # type: (...) -> "models.QueryResult" + """Lists the forecast charges for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param type: The type of the forecast. + :type type: str or ~azure.mgmt.costmanagement.models.ForecastType + :param timeframe: The time frame for pulling data for the forecast. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType + :param filter: May be used to filter forecasts by properties/usageDate (Utc time), + properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', + and 'and'. It does not currently support 'ne', 'or', or 'not'. + :type filter: str + :param time_period: Has time period for pulling data for the forecast. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param include_actual_cost: a boolean determining if actualCost will be included. + :type include_actual_cost: bool + :param include_fresh_partial_cost: a boolean determining if FreshPartialCost will be included. + :type include_fresh_partial_cost: bool + :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 query_filter: Has filter expression to use in the query. + :type query_filter: ~azure.mgmt.costmanagement.models.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ForecastDefinition(type=type, timeframe=timeframe, time_period=time_period, include_actual_cost=include_actual_cost, include_fresh_partial_cost=include_fresh_partial_cost, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=query_filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.external_cloud_provider_usage.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ForecastDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + external_cloud_provider_usage.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py new file mode 100644 index 00000000000..6d83e16b9dc --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_operation_operations.py @@ -0,0 +1,106 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations 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: (...) -> "models.OperationListResult" + """Lists all of the available cost management REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(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/operations'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py new file mode 100644 index 00000000000..8443fd8acae --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_query_operations.py @@ -0,0 +1,239 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueryOperations(object): + """QueryOperations 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 usage( + self, + scope, # type: str + type, # type: Union[str, "models.ExportType"] + timeframe, # type: Union[str, "models.TimeframeType"] + time_period=None, # type: Optional["models.QueryTimePeriod"] + configuration=None, # type: Optional["models.QueryDatasetConfiguration"] + aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] + grouping=None, # type: Optional[List["QueryGrouping"]] + filter=None, # type: Optional["models.QueryFilter"] + **kwargs # type: Any + ): + # type: (...) -> "models.QueryResult" + """Query the usage data for scope defined. + + :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 + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + for Department scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group + scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for billingProfile scope, + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + for invoiceSection scope, and + '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + specific for partners. + :type scope: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'QueryDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/query'} + + def usage_by_external_cloud_provider_type( + self, + external_cloud_provider_type, # type: Union[str, "models.ExternalCloudProviderType"] + external_cloud_provider_id, # type: str + type, # type: Union[str, "models.ExportType"] + timeframe, # type: Union[str, "models.TimeframeType"] + time_period=None, # type: Optional["models.QueryTimePeriod"] + configuration=None, # type: Optional["models.QueryDatasetConfiguration"] + aggregation=None, # type: Optional[Dict[str, "QueryAggregation"]] + grouping=None, # type: Optional[List["QueryGrouping"]] + filter=None, # type: Optional["models.QueryFilter"] + **kwargs # type: Any + ): + # type: (...) -> "models.QueryResult" + """Query the usage data for external cloud provider type defined. + + :param external_cloud_provider_type: The external cloud provider type associated with + dimension/query operations. This includes 'externalSubscriptions' for linked account and + 'externalBillingAccounts' for consolidated account. + :type external_cloud_provider_type: str or ~azure.mgmt.costmanagement.models.ExternalCloudProviderType + :param external_cloud_provider_id: This can be '{externalSubscriptionId}' for linked account or + '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + :type external_cloud_provider_id: str + :param type: The type of the query. + :type type: str or ~azure.mgmt.costmanagement.models.ExportType + :param timeframe: The time frame for pulling data for the query. If custom, then a specific + time period must be provided. + :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType + :param time_period: Has time period for pulling data for the query. + :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod + :param 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.QueryFilter + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QueryResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.QueryDefinition(type=type, timeframe=timeframe, time_period=time_period, configuration=configuration, aggregation=aggregation, grouping=grouping, filter=filter) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.usage_by_external_cloud_provider_type.metadata['url'] + path_format_arguments = { + 'externalCloudProviderType': self._serialize.url("external_cloud_provider_type", external_cloud_provider_type, 'str'), + 'externalCloudProviderId': self._serialize.url("external_cloud_provider_id", external_cloud_provider_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'QueryDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueryResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + usage_by_external_cloud_provider_type.metadata = {'url': '/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py new file mode 100644 index 00000000000..bf08f8e37e3 --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/operations/_view_operations.py @@ -0,0 +1,681 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ViewOperations(object): + """ViewOperations 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: (...) -> "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: ViewListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ViewListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ViewListResult', 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(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/views'} + + def list_by_scope( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ViewListResult" + """Lists all views at the given scope. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ViewListResult or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.ViewListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ViewListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ViewListResult', 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(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_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views'} + + def get( + self, + view_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.View" + """Gets the view by view name. + + :param view_name: View name. + :type view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update( + self, + view_name, # type: str + e_tag=None, # type: Optional[str] + display_name=None, # type: Optional[str] + scope=None, # type: Optional[str] + chart=None, # type: Optional[Union[str, "models.ChartType"]] + accumulated=None, # type: Optional[Union[str, "models.AccumulatedType"]] + metric=None, # type: Optional[Union[str, "models.MetricType"]] + kpis=None, # type: Optional[List["KpiProperties"]] + pivots=None, # type: Optional[List["PivotProperties"]] + timeframe=None, # type: Optional[Union[str, "models.ReportTimeframeType"]] + time_period=None, # type: Optional["models.ReportConfigTimePeriod"] + dataset=None, # type: Optional["models.ReportConfigDataset"] + **kwargs # type: Any + ): + # type: (...) -> "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 does not require eTag. + + :param view_name: View name. + :type view_name: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type scope: str + :param chart: Chart type of the main view in Cost Analysis. Required. + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'View') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete( + self, + view_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to delete a view. + + :param view_name: View name. + :type view_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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(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/views/{viewName}'} + + def get_by_scope( + self, + scope, # type: str + view_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.View" + """Gets the view for the defined scope by view name. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.get_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def create_or_update_by_scope( + self, + scope, # type: str + view_name, # type: str + e_tag=None, # type: Optional[str] + display_name=None, # type: Optional[str] + view_properties_scope=None, # type: Optional[str] + chart=None, # type: Optional[Union[str, "models.ChartType"]] + accumulated=None, # type: Optional[Union[str, "models.AccumulatedType"]] + metric=None, # type: Optional[Union[str, "models.MetricType"]] + kpis=None, # type: Optional[List["KpiProperties"]] + pivots=None, # type: Optional[List["PivotProperties"]] + timeframe=None, # type: Optional[Union[str, "models.ReportTimeframeType"]] + time_period=None, # type: Optional["models.ReportConfigTimePeriod"] + dataset=None, # type: Optional["models.ReportConfigDataset"] + **kwargs # type: Any + ): + # type: (...) -> "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 does not require eTag. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str + :param display_name: User input name of the view. Required. + :type display_name: str + :param view_properties_scope: Cost Management scope to save the view on. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + ExternalBillingAccount scope, and + '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + ExternalSubscription scope. + :type view_properties_scope: str + :param chart: Chart type of the main view in Cost Analysis. Required. + :type chart: str or ~azure.mgmt.costmanagement.models.ChartType + :param accumulated: Show costs accumulated over time. + :type accumulated: str or ~azure.mgmt.costmanagement.models.AccumulatedType + :param metric: Metric to use when displaying costs. + :type metric: str or ~azure.mgmt.costmanagement.models.MetricType + :param kpis: List of KPIs to show in Cost Analysis UI. + :type kpis: list[~azure.mgmt.costmanagement.models.KpiProperties] + :param pivots: Configuration of 3 sub-views in the Cost Analysis UI. + :type pivots: list[~azure.mgmt.costmanagement.models.PivotProperties] + :param timeframe: The time frame for pulling data for the report. If custom, then a specific + time period must be provided. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: View or the result of cls(response) + :rtype: ~azure.mgmt.costmanagement.models.View or ~azure.mgmt.costmanagement.models.View + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.View"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.View(e_tag=e_tag, display_name=display_name, scope=view_properties_scope, chart=chart, accumulated=accumulated, metric=metric, kpis=kpis, pivots=pivots, timeframe=timeframe, time_period=time_period, dataset=dataset) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'View') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('View', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('View', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} + + def delete_by_scope( + self, + scope, # type: str + view_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to delete a view. + + :param scope: The scope associated with view operations. This includes + 'subscriptions/{subscriptionId}' for subscription scope, + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for + Department scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + for EnrollmentAccount scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + for BillingProfile scope, + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + for Management Group scope, + 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for + External Billing Account scope and + 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for + External Subscription scope. + :type scope: str + :param view_name: View name. + :type view_name: str + :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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-11-01" + + # Construct URL + url = self.delete_by_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'viewName': self._serialize.url("view_name", view_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.CostManagement/views/{viewName}'} diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/py.typed b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py new file mode 100644 index 00000000000..23e053083da --- /dev/null +++ b/src/costmanagement/azext_costmanagement/vendored_sdks/costmanagement/setup.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "costmanagementclient" +VERSION = "1.2.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="CostManagementClient", + author_email="", + url="", + keywords=["Swagger", "CostManagementClient"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + CostManagementClient. + """ +) diff --git a/src/costmanagement/report.md b/src/costmanagement/report.md new file mode 100644 index 00000000000..4815cbc0982 --- /dev/null +++ b/src/costmanagement/report.md @@ -0,0 +1,216 @@ +# Azure CLI Module Creation Report + +### costmanagement alert list + +list a costmanagement alert. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +### costmanagement alert list-external + +list-external a costmanagement alert. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--external-cloud-provider-type**|choice|The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.|external_cloud_provider_type| +|**--external-cloud-provider-id**|string|This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.|external_cloud_provider_id| +### costmanagement dimension by-external-cloud-provider-type + +by-external-cloud-provider-type a costmanagement dimension. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--external-cloud-provider-type**|choice|The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.|external_cloud_provider_type| +|**--external-cloud-provider-id**|string|This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.|external_cloud_provider_id| +|**--filter**|string|May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'.|filter| +|**--expand**|string|May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions.|expand| +|**--skiptoken**|string|Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.|skiptoken| +|**--top**|integer|May be used to limit the number of results to the most recent N dimension data.|top| +### costmanagement dimension list + +list a costmanagement dimension. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--filter**|string|May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'.|filter| +|**--expand**|string|May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions.|expand| +|**--skiptoken**|string|Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.|skiptoken| +|**--top**|integer|May be used to limit the number of results to the most recent N dimension data.|top| +### costmanagement export create + +create a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--export-name**|string|Export Name.|export_name| +|**--definition-type**|choice|The type of the query.|type| +|**--definition-timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe| +|**--definition-time-period**|object|Has time period for pulling data for the query.|time_period| +|**--definition-dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--definition-dataset-aggregation**|dictionary|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.|aggregation| +|**--definition-dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--definition-dataset-filter**|object|Has filter expression to use in the query.|filter| +|**--delivery-info-destination**|object|Has destination for the export being delivered.|destination| +|**--schedule-status**|choice|The status of the schedule. Whether active or not. If inactive, the export's scheduled execution is paused.|status| +|**--schedule-recurrence**|choice|The schedule recurrence.|recurrence| +|**--schedule-recurrence-period**|object|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.|recurrence_period| +### costmanagement export delete + +delete a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--export-name**|string|Export Name.|export_name| +### costmanagement export execute + +execute a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--export-name**|string|Export Name.|export_name| +### costmanagement export list + +list a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +### costmanagement export show + +show a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--export-name**|string|Export Name.|export_name| +### costmanagement export update + +create a costmanagement export. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--export-name**|string|Export Name.|export_name| +|**--definition-type**|choice|The type of the query.|type| +|**--definition-timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe| +|**--definition-time-period**|object|Has time period for pulling data for the query.|time_period| +|**--definition-dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--definition-dataset-aggregation**|dictionary|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.|aggregation| +|**--definition-dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--definition-dataset-filter**|object|Has filter expression to use in the query.|filter| +|**--delivery-info-destination**|object|Has destination for the export being delivered.|destination| +|**--schedule-status**|choice|The status of the schedule. Whether active or not. If inactive, the export's scheduled execution is paused.|status| +|**--schedule-recurrence**|choice|The schedule recurrence.|recurrence| +|**--schedule-recurrence-period**|object|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.|recurrence_period| +### costmanagement forecast external-cloud-provider-usage + +external-cloud-provider-usage a costmanagement forecast. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--external-cloud-provider-type**|choice|The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.|external_cloud_provider_type| +|**--external-cloud-provider-id**|string|This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.|external_cloud_provider_id| +|**--type**|choice|The type of the forecast.|type| +|**--timeframe**|choice|The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.|timeframe| +|**--filter**|string|May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.|filter| +|**--time-period**|object|Has time period for pulling data for the forecast.|time_period| +|**--include-actual-cost**|boolean|a boolean determining if actualCost will be included|include_actual_cost| +|**--include-fresh-partial-cost**|boolean|a boolean determining if FreshPartialCost will be included|include_fresh_partial_cost| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--dataset-aggregation**|dictionary|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.|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter| +### costmanagement forecast usage + +usage a costmanagement forecast. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--type**|choice|The type of the forecast.|type| +|**--timeframe**|choice|The time frame for pulling data for the forecast. If custom, then a specific time period must be provided.|timeframe| +|**--filter**|string|May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.|filter| +|**--time-period**|object|Has time period for pulling data for the forecast.|time_period| +|**--include-actual-cost**|boolean|a boolean determining if actualCost will be included|include_actual_cost| +|**--include-fresh-partial-cost**|boolean|a boolean determining if FreshPartialCost will be included|include_fresh_partial_cost| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--dataset-aggregation**|dictionary|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.|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter| +### costmanagement query usage + +usage a costmanagement query. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|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 '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.|scope| +|**--type**|choice|The type of the query.|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--dataset-aggregation**|dictionary|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.|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter| +### costmanagement query usage-by-external-cloud-provider-type + +usage-by-external-cloud-provider-type a costmanagement query. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--external-cloud-provider-type**|choice|The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.|external_cloud_provider_type| +|**--external-cloud-provider-id**|string|This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations.|external_cloud_provider_id| +|**--type**|choice|The type of the query.|type| +|**--timeframe**|choice|The time frame for pulling data for the query. If custom, then a specific time period must be provided.|timeframe| +|**--time-period**|object|Has time period for pulling data for the query.|time_period| +|**--dataset-configuration**|object|Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided.|configuration| +|**--dataset-aggregation**|dictionary|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.|aggregation| +|**--dataset-grouping**|array|Array of group by expression to use in the query. Query can have up to 2 group by clauses.|grouping| +|**--dataset-filter**|object|Has filter expression to use in the query.|filter| +### costmanagement view create + +create a costmanagement view. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.|scope| +|**--view-name**|string|View name|view_name| +|**--e-tag**|string|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.|e_tag| +|**--display-name**|string|User input name of the view. Required.|display_name| +|**--properties-scope**|string|Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.|scope| +|**--chart**|choice|Chart type of the main view in Cost Analysis. Required.|chart| +|**--accumulated**|choice|Show costs accumulated over time.|accumulated| +|**--metric**|choice|Metric to use when displaying costs.|metric| +|**--kpis**|array|List of KPIs to show in Cost Analysis UI.|kpis| +|**--pivots**|array|Configuration of 3 sub-views in the Cost Analysis UI.|pivots| +|**--query-timeframe**|choice|The time frame for pulling data for the report. If custom, then a specific time period must be provided.|timeframe| +|**--query-time-period**|object|Has time period for pulling data for the report.|time_period| +|**--query-dataset**|object|Has definition for data in this report config.|dataset| +|**--scope**|string|Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.|scope| +### costmanagement view delete + +delete a costmanagement view. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.|scope| +|**--view-name**|string|View name|view_name| +### costmanagement view list + +list a costmanagement view. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.|scope| +### costmanagement view show + +show a costmanagement view. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--scope**|string|The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope.|scope| +|**--view-name**|string|View name|view_name| \ No newline at end of file diff --git a/src/costmanagement/setup.cfg b/src/costmanagement/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/costmanagement/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/costmanagement/setup.py b/src/costmanagement/setup.py new file mode 100644 index 00000000000..d99d8b3aa94 --- /dev/null +++ b/src/costmanagement/setup.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='costmanagement', + version=VERSION, + description='Microsoft Azure Command-Line Tools CostManagementClient Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_costmanagement': ['azext_metadata.json']}, +)